mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
misc: cs40l2x: Add bounds checking to click comp. enable control
Added a safety check such that all non-zero values written to the comp_enable control are translated to '1' when passed to the DSP. Change-Id: I359def9737eeb8e1f77abdd76ce8d7a3ef069ee5 Signed-off-by: Jeff LaBundy <jeff.labundy@cirrus.com> Signed-off-by: Ravi Vembu <raviv@motorola.com> Mot-CRs-Fixed: (CR) Reviewed-on: https://gerrit.mot.com/1202247 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Submit-Approved: Jira Key
This commit is contained in:
parent
fa036da139
commit
58e01af0a2
2 changed files with 6 additions and 2 deletions
|
|
@ -794,7 +794,7 @@ static ssize_t cs40l2x_comp_enable_show(struct device *dev,
|
|||
mutex_lock(&cs40l2x->lock);
|
||||
ret = regmap_read(cs40l2x->regmap,
|
||||
cs40l2x_dsp_reg(cs40l2x, "COMPENSATION_ENABLE",
|
||||
CS40L2X_XM_UNPACKED_TYPE), &val);
|
||||
CS40L2X_XM_UNPACKED_TYPE), &val);
|
||||
mutex_unlock(&cs40l2x->lock);
|
||||
|
||||
if (ret) {
|
||||
|
|
@ -820,7 +820,8 @@ static ssize_t cs40l2x_comp_enable_store(struct device *dev,
|
|||
mutex_lock(&cs40l2x->lock);
|
||||
ret = regmap_write(cs40l2x->regmap,
|
||||
cs40l2x_dsp_reg(cs40l2x, "COMPENSATION_ENABLE",
|
||||
CS40L2X_XM_UNPACKED_TYPE), val);
|
||||
CS40L2X_XM_UNPACKED_TYPE),
|
||||
val ? CS40L2X_COMP_ENABLED : CS40L2X_COMP_DISABLED);
|
||||
mutex_unlock(&cs40l2x->lock);
|
||||
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -754,6 +754,9 @@
|
|||
#define CS40L2X_GPIO1_ENABLED 1
|
||||
#define CS40L2X_GPIO1_DISABLED 0
|
||||
|
||||
#define CS40L2X_COMP_ENABLED 1
|
||||
#define CS40L2X_COMP_DISABLED 0
|
||||
|
||||
bool cs40l2x_readable_reg(struct device *dev, unsigned int reg);
|
||||
bool cs40l2x_precious_reg(struct device *dev, unsigned int reg);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue