From 6b3c7c2112792b6ce6f9259447b2e695f25b1baa Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 08:00:31 +0000 Subject: [PATCH 1/7] Changes required to bring up display on 3.2.4 --- drivers/gpu/msm/adreno.c | 4 +- drivers/gpu/msm/kgsl.c | 68 ++++++++++++++--------- drivers/gpu/msm/kgsl.h | 1 + drivers/video/msm/mdss/mdss_fb.c | 12 ++++ drivers/video/msm/mdss/mdss_fb.h | 1 + drivers/video/msm/mdss/mdss_mdp_overlay.c | 16 +++--- include/linux/kref.h | 22 ++++++++ include/linux/mmc/card.h | 1 + include/linux/msm_mdp.h | 29 ++++++++++ 9 files changed, 119 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index 36a306b6951..65d63f073eb 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -838,8 +838,10 @@ static void adreno_iommu_setstate(struct kgsl_device *device, num_iommu_units = kgsl_mmu_get_num_iommu_units(&device->mmu); context = idr_find(&device->context_idr, context_id); - if (context == NULL) + if (context == NULL) { + kgsl_mmu_device_setstate(&device->mmu, KGSL_CONTEXT_INVALID); return; + } kgsl_context_get(context); diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c index d580e8f4bec..3759c80eada 100644 --- a/drivers/gpu/msm/kgsl.c +++ b/drivers/gpu/msm/kgsl.c @@ -59,6 +59,9 @@ struct kgsl_dma_buf_meta { struct sg_table *table; }; +static void kgsl_put_process_private(struct kgsl_device *device, + struct kgsl_process_private *private); + static void kgsl_mem_entry_detach_process(struct kgsl_mem_entry *entry); /** @@ -386,14 +389,19 @@ kgsl_mem_entry_untrack_gpuaddr(struct kgsl_process_private *process, */ static int kgsl_mem_entry_attach_process(struct kgsl_mem_entry *entry, - struct kgsl_process_private *process) + struct kgsl_device_private *dev_priv) { int ret; + struct kgsl_process_private *process = dev_priv->process_priv; + + ret = kref_get_unless_zero(&process->refcount); + if (!ret) + return -EBADF; while (1) { if (idr_pre_get(&process->mem_idr, GFP_KERNEL) == 0) { ret = -ENOMEM; - goto err; + goto err_put_proc_priv; } spin_lock(&process->mem_lock); @@ -404,9 +412,10 @@ kgsl_mem_entry_attach_process(struct kgsl_mem_entry *entry, if (ret == 0) break; else if (ret != -EAGAIN) - goto err; + goto err_put_proc_priv; } entry->priv = process; + entry->dev_priv = dev_priv; spin_lock(&process->mem_lock); ret = kgsl_mem_entry_track_gpuaddr(process, entry); @@ -414,14 +423,17 @@ kgsl_mem_entry_attach_process(struct kgsl_mem_entry *entry, idr_remove(&process->mem_idr, entry->id); spin_unlock(&process->mem_lock); if (ret) - goto err; + goto err_put_proc_priv; /* map the memory after unlocking if gpuaddr has been assigned */ if (entry->memdesc.gpuaddr) { ret = kgsl_mmu_map(process->pagetable, &entry->memdesc); if (ret) kgsl_mem_entry_detach_process(entry); } -err: + return ret; + +err_put_proc_priv: + kgsl_put_process_private(dev_priv->device, process); return ret; } @@ -444,6 +456,7 @@ static void kgsl_mem_entry_detach_process(struct kgsl_mem_entry *entry) entry->priv->stats[entry->memtype].cur -= entry->memdesc.size; spin_unlock(&entry->priv->mem_lock); + kgsl_put_process_private(entry->dev_priv->device, entry->priv); entry->priv = NULL; } @@ -770,11 +783,6 @@ EXPORT_SYMBOL(kgsl_resume_driver); */ static void kgsl_destroy_process_private(struct kref *kref) { - - struct kgsl_mem_entry *entry = NULL; - int next = 0; - - struct kgsl_process_private *private = container_of(kref, struct kgsl_process_private, refcount); @@ -798,20 +806,6 @@ static void kgsl_destroy_process_private(struct kref *kref) if (private->debug_root) debugfs_remove_recursive(private->debug_root); - while (1) { - rcu_read_lock(); - entry = idr_get_next(&private->mem_idr, &next); - rcu_read_unlock(); - if (entry == NULL) - break; - kgsl_mem_entry_put(entry); - /* - * Always start back at the beginning, to - * ensure all entries are removed, - * like list_for_each_entry_safe. - */ - next = 0; - } kgsl_mmu_putpagetable(private->pagetable); idr_destroy(&private->mem_idr); @@ -952,6 +946,7 @@ static int kgsl_release(struct inode *inodep, struct file *filep) struct kgsl_process_private *private = dev_priv->process_priv; struct kgsl_device *device = dev_priv->device; struct kgsl_context *context; + struct kgsl_mem_entry *entry; int next = 0; filep->private_data = NULL; @@ -971,6 +966,25 @@ static int kgsl_release(struct inode *inodep, struct file *filep) next = next + 1; } + next = 0; + while (1) { + spin_lock(&private->mem_lock); + entry = idr_get_next(&private->mem_idr, &next); + spin_unlock(&private->mem_lock); + if (entry == NULL) + break; + /* + * If the free pending flag is not set it means that user space + * did not free it's reference to this entry, in that case + * free a reference to this entry, other references are from + * within kgsl so they will be freed eventually by kgsl + */ + if (entry->dev_priv == dev_priv && !entry->pending_free) { + entry->pending_free = 1; + kgsl_mem_entry_put(entry); + } + next = next + 1; + } /* * Clean up any to-be-freed entries that belong to this * process and this device. This is done after the context @@ -2199,7 +2213,7 @@ static long kgsl_ioctl_map_user_mem(struct kgsl_device_private *dev_priv, /* echo back flags */ param->flags = entry->memdesc.flags; - result = kgsl_mem_entry_attach_process(entry, private); + result = kgsl_mem_entry_attach_process(entry, dev_priv); if (result) goto error_attach; @@ -2475,7 +2489,7 @@ kgsl_ioctl_gpumem_alloc(struct kgsl_device_private *dev_priv, if (result) return result; - result = kgsl_mem_entry_attach_process(entry, private); + result = kgsl_mem_entry_attach_process(entry, dev_priv); if (result != 0) goto err; @@ -2508,7 +2522,7 @@ kgsl_ioctl_gpumem_alloc_id(struct kgsl_device_private *dev_priv, if (result != 0) goto err; - result = kgsl_mem_entry_attach_process(entry, private); + result = kgsl_mem_entry_attach_process(entry, dev_priv); if (result != 0) goto err; diff --git a/drivers/gpu/msm/kgsl.h b/drivers/gpu/msm/kgsl.h index d05d3917469..c8cac28b056 100644 --- a/drivers/gpu/msm/kgsl.h +++ b/drivers/gpu/msm/kgsl.h @@ -197,6 +197,7 @@ struct kgsl_mem_entry { struct kgsl_process_private *priv; /* Initialized to 0, set to 1 when entry is marked for freeing */ int pending_free; + struct kgsl_device_private *dev_priv; }; #ifdef CONFIG_MSM_KGSL_MMU_PAGE_FAULT diff --git a/drivers/video/msm/mdss/mdss_fb.c b/drivers/video/msm/mdss/mdss_fb.c index a67c23163bb..d83a6232547 100644 --- a/drivers/video/msm/mdss/mdss_fb.c +++ b/drivers/video/msm/mdss/mdss_fb.c @@ -242,6 +242,9 @@ static void mdss_fb_remove_sysfs(struct msm_fb_data_type *mfd) static void mdss_fb_shutdown(struct platform_device *pdev) { struct msm_fb_data_type *mfd = platform_get_drvdata(pdev); + mutex_lock(&mfd->lock); + mfd->shut_down_signalled = 1; + mutex_unlock(&mfd->lock); lock_fb_info(mfd->fbi); mdss_fb_release_all(mfd->fbi, true); @@ -1102,6 +1105,11 @@ static int mdss_fb_open(struct fb_info *info, int user) if (!mfd->ref_cnt) { mutex_lock(&mfd->lock); + if (mfd->index == 0 && mfd->shut_down_signalled) { + pr_err("FB open after shut down for fb0!!\n"); + mutex_unlock(&mfd->lock); + return -EPERM; + } mfd->is_commit_allowed = true; mutex_unlock(&mfd->lock); result = mdss_fb_blank_sub(FB_BLANK_UNBLANK, info, @@ -1272,7 +1280,9 @@ static void mdss_fb_pan_idle(struct msm_fb_data_type *mfd) { int ret; + mutex_lock(&mfd->sync_mutex); if (mfd->is_committing) { + mutex_unlock(&mfd->sync_mutex); ret = wait_for_completion_timeout( &mfd->commit_comp, msecs_to_jiffies(WAIT_DISP_OP_TIMEOUT)); @@ -1288,6 +1298,8 @@ static void mdss_fb_pan_idle(struct msm_fb_data_type *mfd) complete_all(&mfd->commit_comp); mutex_unlock(&mfd->sync_mutex); } + } else { + mutex_unlock(&mfd->sync_mutex); } } diff --git a/drivers/video/msm/mdss/mdss_fb.h b/drivers/video/msm/mdss/mdss_fb.h index 1c1d2210b0f..64c934c64bb 100644 --- a/drivers/video/msm/mdss/mdss_fb.h +++ b/drivers/video/msm/mdss/mdss_fb.h @@ -154,6 +154,7 @@ struct msm_fb_data_type { struct completion commit_comp; u32 is_committing; bool is_commit_allowed; + u32 shut_down_signalled; struct work_struct commit_work; void *msm_fb_backup; struct completion power_set_comp; diff --git a/drivers/video/msm/mdss/mdss_mdp_overlay.c b/drivers/video/msm/mdss/mdss_mdp_overlay.c index 0820945a7e5..282c8c9ded9 100755 --- a/drivers/video/msm/mdss/mdss_mdp_overlay.c +++ b/drivers/video/msm/mdss/mdss_mdp_overlay.c @@ -1926,10 +1926,11 @@ static int mdss_mdp_overlay_ioctl_handler(struct msm_fb_data_type *mfd, u32 cmd, void __user *argp) { struct mdss_overlay_private *mdp5_data = mfd_to_mdp5_data(mfd); - struct mdp_overlay req; + struct mdp_overlay *req; int val, ret = -ENOSYS; struct msmfb_metadata metadata; + req = kmalloc(sizeof(*req), GFP_KERNEL); switch (cmd) { case MSMFB_MDP_PP: ret = mdss_mdp_pp_ioctl(mfd, argp); @@ -1942,12 +1943,12 @@ static int mdss_mdp_overlay_ioctl_handler(struct msm_fb_data_type *mfd, break; case MSMFB_OVERLAY_GET: - ret = copy_from_user(&req, argp, sizeof(req)); + ret = copy_from_user(req, argp, sizeof(*req)); if (!ret) { - ret = mdss_mdp_overlay_get(mfd, &req); + ret = mdss_mdp_overlay_get(mfd, req); if (!IS_ERR_VALUE(ret)) - ret = copy_to_user(argp, &req, sizeof(req)); + ret = copy_to_user(argp, req, sizeof(*req)); } if (ret) @@ -1955,12 +1956,12 @@ static int mdss_mdp_overlay_ioctl_handler(struct msm_fb_data_type *mfd, break; case MSMFB_OVERLAY_SET: - ret = copy_from_user(&req, argp, sizeof(req)); + ret = copy_from_user(req, argp, sizeof(*req)); if (!ret) { - ret = mdss_mdp_overlay_set(mfd, &req); + ret = mdss_mdp_overlay_set(mfd, req); if (!IS_ERR_VALUE(ret)) - ret = copy_to_user(argp, &req, sizeof(req)); + ret = copy_to_user(argp, req, sizeof(*req)); } if (ret) pr_debug("OVERLAY_SET failed (%d)\n", ret); @@ -2046,6 +2047,7 @@ static int mdss_mdp_overlay_ioctl_handler(struct msm_fb_data_type *mfd, break; } + kfree(req); return ret; } diff --git a/include/linux/kref.h b/include/linux/kref.h index 9c07dcebded..aa5acc26019 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -93,4 +93,26 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref) { return kref_sub(kref, 1, release); } + + +/** + * kref_get_unless_zero - Increment refcount for object unless it is zero. + * @kref: object. + * + * Return non-zero if the increment succeeded. Otherwise return 0. + * + * This function is intended to simplify locking around refcounting for + * objects that can be looked up from a lookup structure, and which are + * removed from that lookup structure in the object destructor. + * Operations on such objects require at least a read lock around + * lookup + kref_get, and a write lock around kref_put + remove from lookup + * structure. Furthermore, RCU implementations become extremely tricky. + * With a lookup followed by a kref_get_unless_zero *with return value check* + * locking in the kref_put path can be deferred to the actual removal from + * the lookup structure and RCU lookups become trivial. + */ +static inline int __must_check kref_get_unless_zero(struct kref *kref) +{ + return atomic_add_unless(&kref->refcount, 1, 0); +} #endif /* _KREF_H_ */ diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index f848f9fcde5..3ec75f75c11 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -220,6 +220,7 @@ enum mmc_blk_status { MMC_BLK_NEW_REQUEST, MMC_BLK_URGENT, MMC_BLK_URGENT_DONE, + MMC_BLK_NO_REQ_TO_STOP, }; struct mmc_wr_pack_stats { diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h index fa460a17557..2150e4596ca 100644 --- a/include/linux/msm_mdp.h +++ b/include/linux/msm_mdp.h @@ -194,6 +194,7 @@ enum { #define MDP_FB_PAGE_PROTECTION_INVALID (5) /* Count of the number of MDP_FB_PAGE_PROTECTION_... values. */ #define MDP_NUM_FB_PAGE_PROTECTION_VALUES (5) +#define MAX_PLANES 4 struct mdp_rect { uint32_t x; @@ -405,6 +406,33 @@ struct mdp_overlay_pp_params { struct mdp_hist_lut_data hist_lut_cfg; }; +struct mdp_scale_data { + uint8_t change_pxl_ext; + uint8_t enable_pxl_ext; + + int init_phase_x[MAX_PLANES]; + int phase_step_x[MAX_PLANES]; + int init_phase_y[MAX_PLANES]; + int phase_step_y[MAX_PLANES]; + + int num_ext_pxls_left[MAX_PLANES]; + int num_ext_pxls_right[MAX_PLANES]; + int num_ext_pxls_top[MAX_PLANES]; + int num_ext_pxls_btm[MAX_PLANES]; + + int left_ftch[MAX_PLANES]; + int left_rpt[MAX_PLANES]; + int right_ftch[MAX_PLANES]; + int right_rpt[MAX_PLANES]; + + int top_rpt[MAX_PLANES]; + int btm_rpt[MAX_PLANES]; + int top_ftch[MAX_PLANES]; + int btm_ftch[MAX_PLANES]; + + uint32_t roi_w[MAX_PLANES]; +}; + struct mdp_overlay { struct msmfb_img src; struct mdp_rect src_rect; @@ -419,6 +447,7 @@ struct mdp_overlay { uint8_t horz_deci; uint8_t vert_deci; struct mdp_overlay_pp_params overlay_pp_cfg; + struct mdp_scale_data scale; }; struct msmfb_overlay_3d { From f9ee5ed6de701230a07efe96eace6b7be81d92e5 Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 14:17:17 +0000 Subject: [PATCH 2/7] Update to USB and Power Driver --- drivers/power/charger_smb349.c | 105 ++++++++++++++++++++++++--------- drivers/power/qpnp-charger.c | 20 ++++++- drivers/usb/gadget/f_mtp.c | 4 +- drivers/usb/host/ehci-msm2.c | 9 +++ 4 files changed, 107 insertions(+), 31 deletions(-) diff --git a/drivers/power/charger_smb349.c b/drivers/power/charger_smb349.c index 4c5d59cb2fe..03c978078c6 100755 --- a/drivers/power/charger_smb349.c +++ b/drivers/power/charger_smb349.c @@ -83,6 +83,7 @@ #define SMB349_CHG_TIMEOUT_MIN 0x00 #define SMB349_IS_APSD_DONE(value) ((value) & (1 << 6)) +#define SMB349_IS_POWER_OK(value) ((value) & (1 << 0)) #define SMB349_APSD_RESULT_OTHER (1 << 0) #define SMB349_APSD_RESULT_SDP (1 << 1) @@ -122,6 +123,8 @@ #define SMB349_INTSTAT_D_CHG_TIMEOUT (1<<1) #define SMB349_INTSTAT_D_APSD_CMPL (1<<7) #define SMB349_INTSTAT_D_AICL_CMPL (1<<5) +#define SMB349_INTSTAT_E_UV (1<<1) +#define SMB349_INTSTAT_E_UV_STATUS (1<<0) enum { SMB349_USB_MODE_1, @@ -156,7 +159,6 @@ struct smb349_priv { atomic_t suspended; int handle_irq; }; - /* DEBUG */ //#define SMB349_DEBUG @@ -341,12 +343,13 @@ static int smb349_config_fixup(struct smb349_priv *priv) { int ret = -1, i = 0; int fixup_values[] = { - 0x7a, 0x61, 0xb7, 0xed, - 0x38, 0x14, 0x7a, 0xcf, - -1, 0x00, 0x54, 0xa1, - 0x07, 0xa3, 0x38, -1, - 0xe + -1, -1, -1, -1, + -1, -1, -1, -1, + -1, -1, -1, -1, + 0x07, 0xa3, -1, -1, + -1 }; + u8 value = 0xff; if (smb349_config(priv, 1)) { @@ -656,11 +659,11 @@ static void smb349_irq_worker(struct work_struct *work) u8 value = 0xff; int ret = -1; int idx = 0; + int disconnected = 0; + struct smb349_priv *priv = container_of(work, struct smb349_priv, irq_work.work); - BUG_ON(!priv); - /* Check interrupt status E (disconnect) register first */ ret = smb349_i2c_read(priv->i2c_client, SMB349_INTSTAT_REG_E, &value); @@ -671,9 +674,15 @@ static void smb349_irq_worker(struct work_struct *work) dev_dbg(priv->dev, "INTSTAT_REG_E is %02x\n", value); - if ((atomic_read(&priv->ac_online) | - atomic_read(&priv->usb_online)) - && (value & (1 << 0))) { + disconnected = (value & SMB349_INTSTAT_E_UV_STATUS); + + /* If the cable is not present, run disconnect routine + if the irq is still enabled or if we have not already + run the disconnect routine */ + if (((value & SMB349_INTSTAT_E_UV) | + atomic_read(&priv->ac_online) | + atomic_read(&priv->usb_online)) && + disconnected) { dev_info(priv->dev, "USB disconnected\n"); @@ -795,19 +804,24 @@ static void smb349_irq_worker(struct work_struct *work) power_supply_changed(&priv->ac); } - /* Check for APSD status */ - if (value & SMB349_INTSTAT_D_APSD_CMPL) { - if (!SMB349_IS_APSD_DONE(value)) { - dev_warn(priv->dev, "Spurious APSD IRQ!\n"); - } else { - smb349_apsd_complete(priv); + /* Don't handle charger detect IRQs if cable has already been + unplugged */ + if (!disconnected) { + /* Check for APSD status */ + if (value & SMB349_INTSTAT_D_APSD_CMPL) { + if (!SMB349_IS_APSD_DONE(value)) { + dev_warn(priv->dev, + "Spurious APSD IRQ!\n"); + } else { + smb349_apsd_complete(priv); + } } - } - /* Check for AICL status */ - if ((value & SMB349_INTSTAT_D_AICL_CMPL) && - SMB349_IS_AICL_DONE(value)) { - smb349_aicl_complete(priv); + /* Check for AICL status */ + if ((value & SMB349_INTSTAT_D_AICL_CMPL) && + SMB349_IS_AICL_DONE(value)) { + smb349_aicl_complete(priv); + } } } @@ -827,8 +841,44 @@ static void smb349_irq_worker(struct work_struct *work) if (priv->polling_mode) schedule_delayed_work(&priv->irq_work, msecs_to_jiffies(1000)); else - enable_irq(gpio_to_irq(priv->chrg_stat)); + enable_irq(priv->irq); + ret = smb349_i2c_read(priv->i2c_client, SMB349_INTSTAT_REG_F, &value); + + if (ret) { + dev_warn(priv->dev, + "Failed to read SMB349_INTSTAT_REG_F: %d\n", ret); + } else { + dev_dbg(priv->dev, + "INTSTAT_REG_F is %02x\n", value); + if (!disconnected) { + if (!SMB349_IS_POWER_OK(value)) { + atomic_set(&priv->ac_online, 0); + atomic_set(&priv->usb_online, 0); + power_supply_changed(&priv->usb); + power_supply_changed(&priv->ac); + power_supply_set_present(priv->dwc3_usb, 0); + /* newer parts go back to defaults after unplug */ + smb349_config_fixup(priv); + /* Locate the first smaller input current limit*/ + for (idx = ARRAY_SIZE(smb349_input_current_limits) - 1; idx >= 0; idx--) + if (smb349_input_current_limits[idx] <= priv->current_limit) + break; + dev_info(priv->dev, "Change current_limt to [%d]\n", priv->current_limit); + if (idx < 0) { + dev_err(priv->dev, "Invalid current limit value\n"); + } else { + if (smb349_change_current_limit(priv, idx)) { + dev_err(priv->dev, "Unable to change input current limit\n"); + } + } + } + } else { + if (SMB349_IS_POWER_OK(value)) { + smb349_apsd_complete(priv); + } + } + } priv->handle_irq = 0; } @@ -836,10 +886,9 @@ static irqreturn_t smb349_irq(int irq, void *data) { struct smb349_priv *priv = (struct smb349_priv *)data; - disable_irq_nosync(gpio_to_irq(priv->chrg_stat)); + disable_irq_nosync(priv->irq); priv->handle_irq = 1; - /* Need to wait until i2c susbsytem is resumed */ if (!atomic_read(&priv->suspended)) { /* Scrub through the registers to ack any interrupts */ @@ -2160,7 +2209,9 @@ static int smb349_probe(struct i2c_client *client, gpio_request(priv->chrg_stat, "chrg_stat"); gpio_direction_input(priv->chrg_stat); - if (request_irq(gpio_to_irq(priv->chrg_stat), + priv->irq = gpio_to_irq(priv->chrg_stat); + + if (request_irq(priv->irq, smb349_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "smb349_irq", priv)) { @@ -2168,8 +2219,6 @@ static int smb349_probe(struct i2c_client *client, goto err1; } - priv->irq = gpio_to_irq(priv->chrg_stat); - enable_irq_wake(priv->irq); /* this will make the irq wakeupable */ /* Check APSD status */ diff --git a/drivers/power/qpnp-charger.c b/drivers/power/qpnp-charger.c index bfa079b19e8..fa6b77a81cf 100755 --- a/drivers/power/qpnp-charger.c +++ b/drivers/power/qpnp-charger.c @@ -216,6 +216,8 @@ extern int bq27541_get_property_backdoor( #define BMS1_EN_CTL 0x4046 #define BMS_EN BIT(7) +#define ENUM_T_STOP_BIT BIT(0) + struct qpnp_chg_irq { unsigned int irq; unsigned long disabled; @@ -446,6 +448,7 @@ qpnp_chg_masked_write(struct qpnp_chg_chip *chip, u16 base, return 0; } +#if !defined(CONFIG_ARCH_MSM8974_THOR) && !defined(CONFIG_ARCH_MSM8974_APOLLO) static void qpnp_chg_enable_irq(struct qpnp_chg_irq *irq) { @@ -463,6 +466,7 @@ qpnp_chg_disable_irq(struct qpnp_chg_irq *irq) disable_irq_nosync(irq->irq); } } +#endif #define USB_OTG_EN_BIT BIT(0) static int @@ -817,6 +821,8 @@ qpnp_bat_if_adc_measure_work(struct work_struct *work) pr_err("request ADC error\n"); } +#if !defined(CONFIG_ARCH_MSM8974_THOR) && !defined(CONFIG_ARCH_MSM8974_APOLLO) + #define EOC_CHECK_PERIOD_MS 10000 static irqreturn_t qpnp_chg_vbatdet_lo_irq_handler(int irq, void *_chip) @@ -866,7 +872,6 @@ qpnp_chg_usb_chg_gone_irq_handler(int irq, void *_chip) return IRQ_HANDLED; } -#define ENUM_T_STOP_BIT BIT(0) static irqreturn_t qpnp_chg_usb_usbin_valid_irq_handler(int irq, void *_chip) { @@ -1007,6 +1012,8 @@ qpnp_chg_chgr_chg_fastchg_irq_handler(int irq, void *_chip) return IRQ_HANDLED; } +#endif + static int qpnp_dc_property_is_writeable(struct power_supply *psy, enum power_supply_property psp) @@ -1964,6 +1971,8 @@ static struct regulator_ops qpnp_chg_boost_reg_ops = { .list_voltage = qpnp_chg_regulator_boost_list_voltage, }; +#if !defined(CONFIG_ARCH_MSM8974_THOR) && !defined(CONFIG_ARCH_MSM8974_APOLLO) + #define MIN_DELTA_MV_TO_INCREASE_VDD_MAX 13 #define MAX_DELTA_VDD_MAX_MV 30 static void @@ -2084,6 +2093,8 @@ qpnp_eoc_work(struct work_struct *work) wake_unlock(&chip->eoc_wake_lock); } +#endif + #define HYSTERISIS_DECIDEGC 20 static void qpnp_chg_adc_notification(enum qpnp_tm_state state, void *ctx) @@ -2224,6 +2235,7 @@ qpnp_chg_setup_flags(struct qpnp_chg_chip *chip) chip->flags |= BOOST_FLASH_WA; } +#if !defined(CONFIG_ARCH_MSM8974_THOR) && !defined(CONFIG_ARCH_MSM8974_APOLLO) static int qpnp_chg_request_irqs(struct qpnp_chg_chip *chip) { @@ -2421,6 +2433,7 @@ qpnp_chg_request_irqs(struct qpnp_chg_chip *chip) return rc; } +#endif #define WDOG_EN_BIT BIT(7) static int @@ -3178,7 +3191,9 @@ qpnp_charger_probe(struct spmi_device *spmi) wake_lock_init(&chip->eoc_wake_lock, WAKE_LOCK_SUSPEND, "qpnp-chg-eoc-lock"); +#if !defined(CONFIG_ARCH_MSM8974_THOR) && !defined(CONFIG_ARCH_MSM8974_APOLLO) INIT_DELAYED_WORK(&chip->eoc_work, qpnp_eoc_work); +#endif INIT_DELAYED_WORK(&chip->arb_stop_work, qpnp_arb_stop_work); if (chip->dc_chgpth_base) { @@ -3254,6 +3269,8 @@ qpnp_charger_probe(struct spmi_device *spmi) qpnp_chg_schedule_snapshot(chip); device_create_file(&spmi->dev, &dev_attr_snapshot_seconds); #endif + +#if !defined(CONFIG_ARCH_MSM8974_THOR) && !defined(CONFIG_ARCH_MSM8974_APOLLO) rc = qpnp_chg_request_irqs(chip); if (rc) { pr_err("failed to request interrupts %d\n", rc); @@ -3262,6 +3279,7 @@ qpnp_charger_probe(struct spmi_device *spmi) qpnp_chg_usb_usbin_valid_irq_handler(USBIN_VALID_IRQ, chip); qpnp_chg_dc_dcin_valid_irq_handler(DCIN_VALID_IRQ, chip); +#endif power_supply_set_present(chip->usb_psy, qpnp_chg_is_usb_chg_plugged_in(chip)); diff --git a/drivers/usb/gadget/f_mtp.c b/drivers/usb/gadget/f_mtp.c index b36b7e22ee7..c1cfc8ff195 100644 --- a/drivers/usb/gadget/f_mtp.c +++ b/drivers/usb/gadget/f_mtp.c @@ -788,8 +788,8 @@ static void send_file_work(struct work_struct *data) break; } - if (count > MTP_BULK_BUFFER_SIZE) - xfer = MTP_BULK_BUFFER_SIZE; + if (count > mtp_tx_req_len) + xfer = mtp_tx_req_len; else xfer = count; diff --git a/drivers/usb/host/ehci-msm2.c b/drivers/usb/host/ehci-msm2.c index c5242320c6d..c125c00eaf5 100644 --- a/drivers/usb/host/ehci-msm2.c +++ b/drivers/usb/host/ehci-msm2.c @@ -1209,6 +1209,14 @@ static int msm_ehci_bus_resume(struct usb_hcd *hcd) return 0; } +static void ehci_set_autosuspend_delay(struct usb_device *dev) +{ + if (!dev->parent) /* no delay for RH */ + pm_runtime_set_autosuspend_delay(&dev->dev, 0); + else + pm_runtime_set_autosuspend_delay(&dev->dev, 4000); +} + static struct hc_driver msm_hc2_driver = { .description = hcd_name, .product_desc = "Qualcomm EHCI Host Controller", @@ -1253,6 +1261,7 @@ static struct hc_driver msm_hc2_driver = { */ .bus_suspend = ehci_bus_suspend, .bus_resume = msm_ehci_bus_resume, + .set_autosuspend_delay = ehci_set_autosuspend_delay, }; static int msm_ehci_init_clocks(struct msm_hcd *mhcd, u32 init) From ae15227e1258cb16327725c3b0a824658c4c2feb Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 14:36:23 +0000 Subject: [PATCH 3/7] Update net, mmc, misc and media drivers --- .../msm/camera_v1/gemini/msm_gemini_hw.c | 2 +- .../msm/camera_v1/gemini/msm_gemini_hw.h | 3 +- .../msm/camera_v1/gemini/msm_gemini_sync.c | 10 ++- drivers/misc/qseecom.c | 80 +++++++++++++++++++ drivers/mmc/card/block.c | 4 + drivers/mmc/core/core.c | 6 +- drivers/net/wan/bwan.c | 8 ++ 7 files changed, 109 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c index 79c533e9092..de0ed97f58f 100644 --- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c +++ b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.c @@ -433,7 +433,7 @@ void msm_gemini_hw_delay(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us) } } -int msm_gemini_hw_exec_cmds(struct msm_gemini_hw_cmd *hw_cmd_p, int m_cmds) +int msm_gemini_hw_exec_cmds(struct msm_gemini_hw_cmd *hw_cmd_p, uint32_t m_cmds) { int is_copy_to_user = -1; uint32_t data; diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h index aa6c4aa18b7..4d082828826 100644 --- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h +++ b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_hw.h @@ -94,7 +94,8 @@ uint32_t msm_gemini_hw_read(struct msm_gemini_hw_cmd *hw_cmd_p); void msm_gemini_hw_write(struct msm_gemini_hw_cmd *hw_cmd_p); int msm_gemini_hw_wait(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us); void msm_gemini_hw_delay(struct msm_gemini_hw_cmd *hw_cmd_p, int m_us); -int msm_gemini_hw_exec_cmds(struct msm_gemini_hw_cmd *hw_cmd_p, int m_cmds); +int msm_gemini_hw_exec_cmds(struct msm_gemini_hw_cmd *hw_cmd_p, + uint32_t m_cmds); void msm_gemini_io_dump(int size); #define MSM_GEMINI_PIPELINE_CLK_128MHZ 128 /* 8MP 128MHz */ diff --git a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c index 50c728412ae..0796b8dcb0b 100644 --- a/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c +++ b/drivers/media/platform/msm/camera_v1/gemini/msm_gemini_sync.c @@ -23,6 +23,8 @@ #include "msm_gemini_platform.h" #include "msm_gemini_common.h" +#define UINT32_MAX (0xFFFFFFFFU) + static int release_buf; /* size is based on 4k page size */ @@ -804,7 +806,7 @@ int msm_gemini_ioctl_hw_cmds(struct msm_gemini_device *pgmn_dev, void * __user arg) { int is_copy_to_user; - int len; + uint32_t len; uint32_t m; struct msm_gemini_hw_cmds *hw_cmds_p; struct msm_gemini_hw_cmd *hw_cmd_p; @@ -814,6 +816,12 @@ int msm_gemini_ioctl_hw_cmds(struct msm_gemini_device *pgmn_dev, return -EFAULT; } + if ((m == 0) || (m > ((UINT32_MAX - sizeof(struct msm_gemini_hw_cmds)) / + sizeof(struct msm_gemini_hw_cmd)))) { + GMN_PR_ERR("%s:%d] m_cmds out of range\n", __func__, __LINE__); + return -EFAULT; + } + len = sizeof(struct msm_gemini_hw_cmds) + sizeof(struct msm_gemini_hw_cmd) * (m - 1); hw_cmds_p = kmalloc(len, GFP_KERNEL); diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 204294f3d25..0d166d96e2b 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -3778,6 +3778,84 @@ static int __devinit qseecom_remove(struct platform_device *pdev) return ret; }; +static int qseecom_suspend(struct platform_device *pdev, pm_message_t state) +{ + int ret = 0; + struct qseecom_clk *qclk; + qclk = &qseecom.qsee; + + if (qseecom.cumulative_mode != INACTIVE) { + ret = __qseecom_set_msm_bus_request(INACTIVE); + if (ret) + pr_err("Fail to scale down bus\n"); + } + mutex_lock(&clk_access_lock); + if (qclk->clk_access_cnt) { + if (qclk->ce_clk != NULL) + clk_disable_unprepare(qclk->ce_clk); + if (qclk->ce_core_clk != NULL) + clk_disable_unprepare(qclk->ce_core_clk); + if (qclk->ce_bus_clk != NULL) + clk_disable_unprepare(qclk->ce_bus_clk); + } + mutex_unlock(&clk_access_lock); + return 0; +} + +static int qseecom_resume(struct platform_device *pdev) +{ + int mode = 0; + int ret = 0; + struct qseecom_clk *qclk; + qclk = &qseecom.qsee; + + if (qseecom.cumulative_mode >= 3) + mode = HIGH; + else + mode = qseecom.cumulative_mode; + + if (qseecom.cumulative_mode != INACTIVE) { + ret = __qseecom_set_msm_bus_request(mode); + if (ret) + pr_err("Fail to scale down bus\n"); + } + + mutex_lock(&clk_access_lock); + if (qclk->clk_access_cnt) { + + /* Enable CE core clk */ + ret = clk_prepare_enable(qclk->ce_core_clk); + if (ret) { + pr_err("Unable to enable/prepare CE core clk\n"); + qclk->clk_access_cnt--; + goto err; + } + /* Enable CE clk */ + ret = clk_prepare_enable(qclk->ce_clk); + if (ret) { + pr_err("Unable to enable/prepare CE iface clk\n"); + qclk->clk_access_cnt--; + goto ce_clk_err; + } + /* Enable AXI clk */ + ret = clk_prepare_enable(qclk->ce_bus_clk); + if (ret) { + pr_err("Unable to enable/prepare CE bus clk\n"); + qclk->clk_access_cnt--; + goto ce_bus_clk_err; + } + } + mutex_unlock(&clk_access_lock); + return 0; + +ce_bus_clk_err: + clk_disable_unprepare(qclk->ce_clk); +ce_clk_err: + clk_disable_unprepare(qclk->ce_core_clk); +err: + mutex_unlock(&clk_access_lock); + return -EIO; +} static struct of_device_id qseecom_match[] = { { .compatible = "qcom,qseecom", @@ -3788,6 +3866,8 @@ static struct of_device_id qseecom_match[] = { static struct platform_driver qseecom_plat_driver = { .probe = qseecom_probe, .remove = qseecom_remove, + .suspend = qseecom_suspend, + .resume = qseecom_resume, .driver = { .name = "qseecom", .owner = THIS_MODULE, diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 7c8cec55905..3525f9cffaa 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -2071,6 +2071,10 @@ static void mmc_blk_write_packing_control(struct mmc_queue *mq, { struct mmc_host *host = mq->card->host; int data_dir; + + // disable the pack write command for samsung parts + if (mq->card->cid.manfid == 0x15 ) + return; if (!(host->caps2 & MMC_CAP2_PACKED_WR)) return; diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index fe77d81f402..a52da483e34 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -753,7 +753,11 @@ static int mmc_wait_for_data_req_done(struct mmc_host *host, */ mmc_update_clk_scaling(host); err = mmc_stop_request(host); - if (err && !context_info->is_done_rcv) { + if (err == MMC_BLK_NO_REQ_TO_STOP) { + pending_is_urgent = true; + /* wait for done/new/urgent event */ + continue; + } else if (err && !context_info->is_done_rcv) { err = MMC_BLK_ABORT; break; } diff --git a/drivers/net/wan/bwan.c b/drivers/net/wan/bwan.c index 9fb82093e64..32e4194d51f 100644 --- a/drivers/net/wan/bwan.c +++ b/drivers/net/wan/bwan.c @@ -940,6 +940,13 @@ static int __devexit bwan_remove(struct platform_device *pdev) return misc_deregister(&bwan_modem_misc); } +static void bwan_shutdown(struct platform_device *pdev) +{ + printk(KERN_INFO "bwan shutdown\n"); + gpio_direction_output(gpio_wan_usb_en, 0); + bwan_pulse_gpio_wan_shutdown(POWER_OFF_HOLD_TIME); +} + static int bwan_suspend(struct platform_device *pdev, pm_message_t state) { @@ -971,6 +978,7 @@ static struct platform_driver bwan_driver = { .resume = bwan_resume, .probe = bwan_probe, .remove = bwan_remove, + .shutdown = bwan_shutdown, }; static int __init bwan_init(void) From 13ee28e213e5d962cf564deb464f1c76d743a71d Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 15:14:48 +0000 Subject: [PATCH 4/7] Updated crypto, gpio, input and iommu drivers --- drivers/crypto/msm/qce50.c | 33 ----------- drivers/crypto/msm/qcrypto.c | 59 ++++++++++++++++--- drivers/gpio/gpiolib.c | 4 +- drivers/input/misc/ad7146.c | 20 +++---- .../touchscreen/synaptics_dsx_fw_update.c | 12 ++-- drivers/input/touchscreen/synaptics_dsx_i2c.c | 6 +- .../input/touchscreen/synaptics_dsx_rmi_dev.c | 12 ++-- .../synaptics_dsx_test_reporting.c | 4 +- drivers/iommu/msm_iommu-v1.c | 3 +- 9 files changed, 83 insertions(+), 70 deletions(-) diff --git a/drivers/crypto/msm/qce50.c b/drivers/crypto/msm/qce50.c index e8c75483bdc..925e3d1c61f 100644 --- a/drivers/crypto/msm/qce50.c +++ b/drivers/crypto/msm/qce50.c @@ -3444,21 +3444,6 @@ static int __qce_init_clk(struct qce_device *pce_dev) void qce_suspend(void *p) { - int ret = 0; - struct qce_device *pce_dev = (struct qce_device *)p; - if (!pce_dev) - return; - - ret = qce_enable_clk(p); - if (ret) { - pr_err("%s Unable enable clk\n", __func__); - return; - } - - qce_sps_exit_ep_conn(pce_dev, &pce_dev->ce_sps.consumer); - qce_sps_exit_ep_conn(pce_dev, &pce_dev->ce_sps.producer); - - qce_disable_clk(p); return; } @@ -3466,24 +3451,6 @@ EXPORT_SYMBOL(qce_suspend); void qce_resume(void *p) { - int ret = 0; - struct qce_device *pce_dev = (struct qce_device *)p; - if (!pce_dev) - return; - - ret = qce_enable_clk(p); - if (ret) { - pr_err("%s Unable enable clk.\n", __func__); - return; - } - ret = qce_sps_init(pce_dev); - if (ret) { - pr_err("%s Unable init sps.\n", __func__); - return; - } - qce_init_ce_cfg_val(pce_dev); - qce_setup_ce_sps_data(pce_dev); - qce_disable_clk(p); } EXPORT_SYMBOL(qce_resume); diff --git a/drivers/crypto/msm/qcrypto.c b/drivers/crypto/msm/qcrypto.c index 0cb1523098d..1560689cf26 100755 --- a/drivers/crypto/msm/qcrypto.c +++ b/drivers/crypto/msm/qcrypto.c @@ -3561,12 +3561,13 @@ static struct crypto_alg _qcrypto_aead_ccm_algo = { } }; +struct crypto_priv *cp; static int _qcrypto_probe(struct platform_device *pdev) { int rc = 0; void *handle; - struct crypto_priv *cp; + int i; struct msm_ce_hw_support *platform_support; @@ -3798,9 +3799,33 @@ static int _qcrypto_probe(struct platform_device *pdev) static int _qcrypto_suspend(struct platform_device *pdev, pm_message_t state) { - if (qseecom_created_key_flag == true) + if (qseecom_created_key_flag == true) { + int ret = 0; + mutex_lock(&qcrypto_sent_bw_req); + if (cp->high_bw_req == true) { + del_timer_sync(&(cp->bw_scale_down_timer)); + ret = msm_bus_scale_client_update_request( + cp->bus_scale_handle, 0); + if (ret) { + pr_err("%s Unable to set to low bandwidth\n", + __func__); + return ret; + } + ret = qce_disable_clk(cp->qce); + if (ret) { + pr_err("%s Unable disable clk\n", __func__); + ret = msm_bus_scale_client_update_request( + cp->bus_scale_handle, 1); + if (ret) + pr_err("%s Unable to set to high bandwidth\n", + __func__); + return ret; + } + } + mutex_unlock(&qcrypto_sent_bw_req); qce_suspend(((struct crypto_priv *) platform_get_drvdata(pdev))->qce); + } return 0; } @@ -3808,14 +3833,32 @@ static int _qcrypto_resume(struct platform_device *pdev) { if (qseecom_created_key_flag == true) { int ret = 0; - uint8_t hash32[32] = {0}; - ret = qseecom_create_key_kclient( - QSEOS_KM_USAGE_DISK_ENCRYPTION, hash32); - if (ret) { - pr_err("create key error in _qcrypto_resume.\n"); - return ret; + mutex_lock(&qcrypto_sent_bw_req); + if (cp->high_bw_req == true) { + ret = qce_enable_clk(cp->qce); + if (ret) { + pm_relax(&cp->pdev->dev); + pr_err("%s Unable enable clk\n", __func__); + return ret; + } + ret = msm_bus_scale_client_update_request( + cp->bus_scale_handle, 1); + if (ret) { + pr_err("%s Unable to set to high bandwidth\n", + __func__); + qce_disable_clk(cp->qce); + return ret; + } + + cp->bw_scale_down_timer.data = + (unsigned long)(cp); + cp->bw_scale_down_timer.expires = jiffies + + msecs_to_jiffies(QCRYPTO_HIGH_BANDWIDTH_TIMEOUT); + add_timer(&(cp->bw_scale_down_timer)); } + mutex_unlock(&qcrypto_sent_bw_req); + qce_resume(((struct crypto_priv *) platform_get_drvdata(pdev))->qce); } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index b62cc77908c..6cc010b7690 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -670,8 +670,8 @@ static ssize_t unexport_store(struct class *class, } static struct class_attribute gpio_class_attrs[] = { - __ATTR(export, 0222, NULL, export_store), - __ATTR(unexport, 0222, NULL, unexport_store), + __ATTR(export, 0220, NULL, export_store), + __ATTR(unexport, 0220, NULL, unexport_store), __ATTR_NULL, }; diff --git a/drivers/input/misc/ad7146.c b/drivers/input/misc/ad7146.c index e01a39b4c7d..00fd3e61a53 100644 --- a/drivers/input/misc/ad7146.c +++ b/drivers/input/misc/ad7146.c @@ -536,12 +536,12 @@ static ssize_t store_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t show_reg_read(struct device *dev, struct device_attribute *attr, char *buf); -static DEVICE_ATTR(reg_read, S_IRWXUGO, show_reg_read, store_reg_read); +static DEVICE_ATTR(reg_read, S_IRUGO | S_IWUSR, show_reg_read, store_reg_read); /*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/ static ssize_t store_reg_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); -static DEVICE_ATTR(reg_write, S_IRWXUGO, NULL, store_reg_write); +static DEVICE_ATTR(reg_write, S_IRUGO | S_IWUSR, NULL, store_reg_write); /*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/ @@ -549,7 +549,7 @@ static ssize_t store_temp_comp(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t show_temp_comp(struct device *dev, struct device_attribute *attr, char *buf); -static DEVICE_ATTR(temp_comp, S_IRWXUGO, show_temp_comp, store_temp_comp); +static DEVICE_ATTR(temp_comp, S_IRUGO | S_IWUSR, show_temp_comp, store_temp_comp); /*--------------------------------------------------------------*/ #ifdef SENSOR_ACTIVE_ON @@ -558,30 +558,30 @@ static ssize_t store_intr_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t show_intr_mode(struct device *dev, struct device_attribute *attr, char *buf); -static DEVICE_ATTR(intr_mode, S_IRWXUGO, show_intr_mode, store_intr_mode); +static DEVICE_ATTR(intr_mode, S_IRUGO | S_IWUSR, show_intr_mode, store_intr_mode); /*--------------------------------------------------------------*/ #endif #endif /*--------------------------------------------------------------*/ static ssize_t redo_filp_calib(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); -static DEVICE_ATTR(filp_config, S_IRWXUGO, NULL, redo_filp_calib); +static DEVICE_ATTR(filp_config, S_IRUGO | S_IWUSR, NULL, redo_filp_calib); /*--------------------------------------------------------------*/ static ssize_t store_stage_info(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t show_stage_info(struct device *dev, struct device_attribute *attr, char *buf); -static DEVICE_ATTR(stage_info, S_IRWXUGO, show_stage_info, store_stage_info); +static DEVICE_ATTR(stage_info, S_IRUGO | S_IWUSR, show_stage_info, store_stage_info); /*--------------------------------------------------------------*/ static ssize_t do_calibrate(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); -static DEVICE_ATTR(calibrate, S_IRWXUGO, NULL, do_calibrate); +static DEVICE_ATTR(calibrate, S_IRUGO | S_IWUSR, NULL, do_calibrate); /*--------------------------------------------------------------*/ static ssize_t store_status(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t show_status(struct device *dev, struct device_attribute *attr, char *buf); -static DEVICE_ATTR(status, S_IRWXUGO, show_status, store_status); +static DEVICE_ATTR(status, S_IRUGO | S_IWUSR, show_status, store_status); static int ad7146_enable(struct ad7146_chip *ad7146); static int ad7146_disable(struct ad7146_chip *ad7146); /*--------------------------------------------------------------*/ @@ -589,11 +589,11 @@ static ssize_t do_autotune(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); static ssize_t show_autotune(struct device *dev, struct device_attribute *attr, char *buf); -static DEVICE_ATTR(autotune, S_IRWXUGO, show_autotune, do_autotune); +static DEVICE_ATTR(autotune, S_IRUGO | S_IWUSR, show_autotune, do_autotune); /*--------------------------------------------------------------*/ static ssize_t do_davetune(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); -static DEVICE_ATTR(davetune, S_IRWXUGO, show_autotune, do_davetune); +static DEVICE_ATTR(davetune, S_IRUGO | S_IWUSR, show_autotune, do_davetune); /*--------------------------------------------------------------*/ static struct attribute *ad7146_sysfs_entries[] = { &dev_attr_reg_read.attr, diff --git a/drivers/input/touchscreen/synaptics_dsx_fw_update.c b/drivers/input/touchscreen/synaptics_dsx_fw_update.c index bbdf39e79d9..f50ff2b2c4d 100644 --- a/drivers/input/touchscreen/synaptics_dsx_fw_update.c +++ b/drivers/input/touchscreen/synaptics_dsx_fw_update.c @@ -260,7 +260,7 @@ struct synaptics_rmi4_fwu_handle { static struct bin_attribute dev_attr_data = { .attr = { .name = "data", - .mode = (S_IRUGO | S_IWUGO), + .mode = (S_IRUGO | S_IWUSR), }, .size = 0, .read = fwu_sysfs_show_image, @@ -268,19 +268,19 @@ static struct bin_attribute dev_attr_data = { }; static struct device_attribute attrs[] = { - __ATTR(doreflash, S_IWUGO, + __ATTR(doreflash, S_IWUSR, synaptics_rmi4_show_error, fwu_sysfs_do_reflash_store), - __ATTR(writeconfig, S_IWUGO, + __ATTR(writeconfig, S_IWUSR, synaptics_rmi4_show_error, fwu_sysfs_write_config_store), - __ATTR(readconfig, S_IWUGO, + __ATTR(readconfig, S_IWUSR, synaptics_rmi4_show_error, fwu_sysfs_read_config_store), - __ATTR(configarea, S_IWUGO, + __ATTR(configarea, S_IWUSR, synaptics_rmi4_show_error, fwu_sysfs_config_area_store), - __ATTR(imagesize, S_IWUGO, + __ATTR(imagesize, S_IWUSR, synaptics_rmi4_show_error, fwu_sysfs_image_size_store), __ATTR(blocksize, S_IRUGO, diff --git a/drivers/input/touchscreen/synaptics_dsx_i2c.c b/drivers/input/touchscreen/synaptics_dsx_i2c.c index ff35f680e58..54ce15d3205 100644 --- a/drivers/input/touchscreen/synaptics_dsx_i2c.c +++ b/drivers/input/touchscreen/synaptics_dsx_i2c.c @@ -230,11 +230,11 @@ struct synaptics_rmi4_exp_fn { static struct device_attribute attrs[] = { #ifdef CONFIG_HAS_EARLYSUSPEND - __ATTR(full_pm_cycle, (S_IRUGO | S_IWUGO), + __ATTR(full_pm_cycle, (S_IRUGO | S_IWUSR), synaptics_rmi4_full_pm_cycle_show, synaptics_rmi4_full_pm_cycle_store), #endif - __ATTR(reset, S_IWUGO, + __ATTR(reset, S_IWUSR, synaptics_rmi4_show_error, synaptics_rmi4_f01_reset_store), __ATTR(productinfo, S_IRUGO, @@ -249,7 +249,7 @@ static struct device_attribute attrs[] = { __ATTR(flashprog, S_IRUGO, synaptics_rmi4_f01_flashprog_show, synaptics_rmi4_store_error), - __ATTR(0dbutton, (S_IRUGO | S_IWUGO), + __ATTR(0dbutton, (S_IRUGO | S_IWUSR), synaptics_rmi4_0dbutton_show, synaptics_rmi4_0dbutton_store), }; diff --git a/drivers/input/touchscreen/synaptics_dsx_rmi_dev.c b/drivers/input/touchscreen/synaptics_dsx_rmi_dev.c index 49cc788e1d2..6203d476427 100644 --- a/drivers/input/touchscreen/synaptics_dsx_rmi_dev.c +++ b/drivers/input/touchscreen/synaptics_dsx_rmi_dev.c @@ -79,7 +79,7 @@ struct rmidev_data { static struct bin_attribute attr_data = { .attr = { .name = "data", - .mode = (S_IRUGO | S_IWUGO), + .mode = (S_IRUGO | S_IWUSR), }, .size = 0, .read = rmidev_sysfs_data_show, @@ -87,16 +87,16 @@ static struct bin_attribute attr_data = { }; static struct device_attribute attrs[] = { - __ATTR(open, S_IWUGO, + __ATTR(open, S_IWUSR, synaptics_rmi4_show_error, rmidev_sysfs_open_store), - __ATTR(release, S_IWUGO, + __ATTR(release, S_IWUSR, synaptics_rmi4_show_error, rmidev_sysfs_release_store), - __ATTR(address, S_IWUGO, + __ATTR(address, S_IWUSR, synaptics_rmi4_show_error, rmidev_sysfs_address_store), - __ATTR(length, S_IWUGO, + __ATTR(length, S_IWUSR, synaptics_rmi4_show_error, rmidev_sysfs_length_store), __ATTR(attn_state, S_IRUGO, @@ -614,6 +614,7 @@ static int rmidev_init_device(struct synaptics_rmi4_data *rmi4_data) goto err_char_device; } +#if 0 retval = gpio_export(rmi4_data->board->irq_gpio, false); if (retval < 0) { dev_err(&rmi4_data->i2c_client->dev, @@ -632,6 +633,7 @@ static int rmidev_init_device(struct synaptics_rmi4_data *rmi4_data) __func__, rmi4_data->board->irq_gpio); } } +#endif rmidev->sysfs_dir = kobject_create_and_add("rmidev", &rmi4_data->input_dev->dev.kobj); diff --git a/drivers/input/touchscreen/synaptics_dsx_test_reporting.c b/drivers/input/touchscreen/synaptics_dsx_test_reporting.c index f5a2d213243..3370f063c8a 100644 --- a/drivers/input/touchscreen/synaptics_dsx_test_reporting.c +++ b/drivers/input/touchscreen/synaptics_dsx_test_reporting.c @@ -85,7 +85,7 @@ static ssize_t concat(synaptics_rmi4_f54, _##propname##_store)(\ const char *buf, size_t count);\ \ struct device_attribute dev_attr_##propname =\ - __ATTR(propname, S_IWUGO,\ + __ATTR(propname, S_IWUSR,\ synaptics_rmi4_show_error,\ concat(synaptics_rmi4_f54, _##propname##_store)); @@ -101,7 +101,7 @@ static ssize_t concat(synaptics_rmi4_f54, _##propname##_store)(\ const char *buf, size_t count);\ \ struct device_attribute dev_attr_##propname =\ - __ATTR(propname, (S_IRUGO | S_IWUGO),\ + __ATTR(propname, (S_IRUGO | S_IWUSR),\ concat(synaptics_rmi4_f54, _##propname##_show),\ concat(synaptics_rmi4_f54, _##propname##_store)); diff --git a/drivers/iommu/msm_iommu-v1.c b/drivers/iommu/msm_iommu-v1.c index 06c6d9424dd..6e4650cab5b 100644 --- a/drivers/iommu/msm_iommu-v1.c +++ b/drivers/iommu/msm_iommu-v1.c @@ -887,7 +887,8 @@ irqreturn_t msm_iommu_fault_handler_v2(int irq, void *dev_id) __print_ctx_regs(drvdata->base, ctx_drvdata->num, fsr); } - SET_FSR(drvdata->base, ctx_drvdata->num, fsr); + if (ret != -EBUSY) + SET_FSR(drvdata->base, ctx_drvdata->num, fsr); ret = IRQ_HANDLED; } else ret = IRQ_NONE; From 7674bb831972c443494a968c2ebb20767b77c1b7 Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 15:51:55 +0000 Subject: [PATCH 5/7] Add watchdog reset time to dtsi files --- arch/arm/boot/dts/apollo.dtsi | 4 ++++ arch/arm/boot/dts/thor.dtsi | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/apollo.dtsi b/arch/arm/boot/dts/apollo.dtsi index d7507561adc..5ed899be9c1 100755 --- a/arch/arm/boot/dts/apollo.dtsi +++ b/arch/arm/boot/dts/apollo.dtsi @@ -22,6 +22,10 @@ status = "ok"; }; + qcom,wdt@f9017000 { + qcom,bark-time = <12000>; + }; + qcom,mdss_dsi_jdi_dualmipi0_video { status = "ok"; qcom,cont-splash-enabled; diff --git a/arch/arm/boot/dts/thor.dtsi b/arch/arm/boot/dts/thor.dtsi index edb7cfb2056..d3136f49143 100755 --- a/arch/arm/boot/dts/thor.dtsi +++ b/arch/arm/boot/dts/thor.dtsi @@ -21,6 +21,10 @@ status = "ok"; }; + qcom,wdt@f9017000 { + qcom,bark-time = <12000>; + }; + qcom,mdss_dsi_novatek_1080p_video { qcom,mdss-pan-dsi-dlane-swap = <1>; status = "ok"; From ab319a0115c2068220a832dffb15914ea70e6522 Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 15:54:03 +0000 Subject: [PATCH 6/7] Updated perf configs for apollo and thor devices --- arch/arm/configs/apollo-perf_defconfig | 5 ++--- arch/arm/configs/thor-perf_defconfig | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm/configs/apollo-perf_defconfig b/arch/arm/configs/apollo-perf_defconfig index bf2ce6c1d3a..cb1d6dc5ce7 100644 --- a/arch/arm/configs/apollo-perf_defconfig +++ b/arch/arm/configs/apollo-perf_defconfig @@ -66,7 +66,6 @@ CONFIG_MSM_ADSP_LOADER=m CONFIG_MSM_OCMEM=y CONFIG_MSM_OCMEM_LOCAL_POWER_CTRL=y CONFIG_MSM_OCMEM_DEBUG=y -CONFIG_MSM_OCMEM_NONSECURE=y # CONFIG_MSM_RTB is not set # CONFIG_MSM_RTB_SEPARATE_CPUS is not set CONFIG_MSM_CACHE_ERP=y @@ -74,8 +73,8 @@ CONFIG_MSM_L1_ERR_PANIC=y CONFIG_MSM_L1_RECOV_ERR_PANIC=y CONFIG_MSM_L1_ERR_LOG=y CONFIG_MSM_L2_ERP_PRINT_ACCESS_ERRORS=y -CONFIG_MSM_L2_ERP_PORT_PANIC=y -CONFIG_MSM_L2_ERP_2BIT_PANIC=y +#CONFIG_MSM_L2_ERP_PORT_PANIC=y +#CONFIG_MSM_L2_ERP_2BIT_PANIC=y # CONFIG_MSM_CACHE_DUMP is not set # CONFIG_MSM_CACHE_DUMP_ON_PANIC is not set CONFIG_MSM_ENABLE_WDOG_DEBUG_CONTROL=y diff --git a/arch/arm/configs/thor-perf_defconfig b/arch/arm/configs/thor-perf_defconfig index 23e691771b1..ce346689fc3 100755 --- a/arch/arm/configs/thor-perf_defconfig +++ b/arch/arm/configs/thor-perf_defconfig @@ -67,7 +67,6 @@ CONFIG_MSM_ADSP_LOADER=m CONFIG_MSM_OCMEM=y CONFIG_MSM_OCMEM_LOCAL_POWER_CTRL=y CONFIG_MSM_OCMEM_DEBUG=y -CONFIG_MSM_OCMEM_NONSECURE=y # CONFIG_MSM_RTB is not set # CONFIG_MSM_RTB_SEPARATE_CPUS is not set CONFIG_MSM_CACHE_ERP=y @@ -75,8 +74,8 @@ CONFIG_MSM_L1_ERR_PANIC=y CONFIG_MSM_L1_RECOV_ERR_PANIC=y CONFIG_MSM_L1_ERR_LOG=y CONFIG_MSM_L2_ERP_PRINT_ACCESS_ERRORS=y -CONFIG_MSM_L2_ERP_PORT_PANIC=y -CONFIG_MSM_L2_ERP_2BIT_PANIC=y +#CONFIG_MSM_L2_ERP_PORT_PANIC=y +#CONFIG_MSM_L2_ERP_2BIT_PANIC=y # CONFIG_MSM_CACHE_DUMP is not set # CONFIG_MSM_CACHE_DUMP_ON_PANIC is not set CONFIG_MSM_ENABLE_WDOG_DEBUG_CONTROL=y From dd4e6a61a7053a9734d87107dac422b2875d83ee Mon Sep 17 00:00:00 2001 From: ggow Date: Wed, 3 Dec 2014 19:48:33 +0000 Subject: [PATCH 7/7] Bug fixes to kernel core and sound sub-system --- kernel/events/core.c | 2 +- sound/soc/codecs/max97236.c | 2 +- sound/soc/msm/lpass-dma.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index fd126f82b57..aafa4c1acd9 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -5118,7 +5118,7 @@ static void sw_perf_event_destroy(struct perf_event *event) static int perf_swevent_init(struct perf_event *event) { - int event_id = event->attr.config; + u64 event_id = event->attr.config; if (event->attr.type != PERF_TYPE_SOFTWARE) return -ENOENT; diff --git a/sound/soc/codecs/max97236.c b/sound/soc/codecs/max97236.c index 12861e98309..e8e1377c494 100644 --- a/sound/soc/codecs/max97236.c +++ b/sound/soc/codecs/max97236.c @@ -1473,7 +1473,7 @@ static int max97236_pm_resume(struct device *dev) max97236->jack_state = M97236_JACK_STATE_NONE; if (test_jack_presence(max97236, 10)) - snd_soc_jack_report(max97236->jack, max97236->jack_state, 0x7E00000); + snd_soc_jack_report(max97236->jack, max97236->jack_state, SND_JACK_HEADSET | SND_JACK_LINEOUT); dev_info(max97236->codec->dev, "resume exit\n"); diff --git a/sound/soc/msm/lpass-dma.c b/sound/soc/msm/lpass-dma.c index 50938dfe9e6..547aef0c9ab 100644 --- a/sound/soc/msm/lpass-dma.c +++ b/sound/soc/msm/lpass-dma.c @@ -403,7 +403,7 @@ static int __devinit dai_probe(struct platform_device *pdev) pr_debug("%s Error rc=%d\n", __func__, rc); goto error; } - for (i = 0; i <= MAX_CHANNELS; i++) { + for (i = 0; i < MAX_CHANNELS; i++) { dai[i] = kzalloc(sizeof(struct dai_drv), GFP_KERNEL); if (!dai[0]) { pr_debug("Allocation failed for dma_channel = 0\n");