* [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time.
@ 2014-09-03 5:50 Jonghwa Lee
2014-09-03 5:55 ` Chanwoo Choi
0 siblings, 1 reply; 4+ messages in thread
From: Jonghwa Lee @ 2014-09-03 5:50 UTC (permalink / raw)
To: linux-kernel; +Cc: myungjoo.ham, cw00.choi, r.baldyga, Jonghwa Lee
When it writes some value other than 0 to BTLDset and JIGset, muic device
will be reset automatically. And it happens during updating ADC debounce time,
because it shares same register. To update ADC debounce time without reset,
set value only to ADCDbset and 0 to BTLDset and JIGset.
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
---
drivers/extcon/extcon-max77693.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 77460f2..661a3bb 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -255,10 +255,15 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
- ret = regmap_update_bits(info->max77693->regmap_muic,
+ /*
+ * Don't touch BTLDset, JIGset when you want to change adc
+ * debounce time. BTLDset, JIGset reflects actual pin status
+ * and are not configurable.
+ */
+ ret = regmap_write_bits(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL3,
- CONTROL3_ADCDBSET_MASK,
- time << CONTROL3_ADCDBSET_SHIFT);
+ (CONTROL3_ADCDBSET_MASK &
+ time << CONTROL3_ADCDBSET_SHIFT));
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n");
return ret;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time.
2014-09-03 5:50 [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time Jonghwa Lee
@ 2014-09-03 5:55 ` Chanwoo Choi
2014-09-03 6:39 ` jonghwa3.lee
0 siblings, 1 reply; 4+ messages in thread
From: Chanwoo Choi @ 2014-09-03 5:55 UTC (permalink / raw)
To: Jonghwa Lee; +Cc: linux-kernel, myungjoo.ham, r.baldyga
On 09/03/2014 02:50 PM, Jonghwa Lee wrote:
> When it writes some value other than 0 to BTLDset and JIGset, muic device
> will be reset automatically. And it happens during updating ADC debounce time,
> because it shares same register. To update ADC debounce time without reset,
> set value only to ADCDbset and 0 to BTLDset and JIGset.
>
> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
> ---
> drivers/extcon/extcon-max77693.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
> index 77460f2..661a3bb 100644
> --- a/drivers/extcon/extcon-max77693.c
> +++ b/drivers/extcon/extcon-max77693.c
> @@ -255,10 +255,15 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
> case ADC_DEBOUNCE_TIME_10MS:
> case ADC_DEBOUNCE_TIME_25MS:
> case ADC_DEBOUNCE_TIME_38_62MS:
> - ret = regmap_update_bits(info->max77693->regmap_muic,
> + /*
> + * Don't touch BTLDset, JIGset when you want to change adc
> + * debounce time. BTLDset, JIGset reflects actual pin status
> + * and are not configurable.
> + */
> + ret = regmap_write_bits(info->max77693->regmap_muic,
> MAX77693_MUIC_REG_CTRL3,
> - CONTROL3_ADCDBSET_MASK,
> - time << CONTROL3_ADCDBSET_SHIFT);
> + (CONTROL3_ADCDBSET_MASK &
> + time << CONTROL3_ADCDBSET_SHIFT));
Do you make this patch on extcon-next branch?
The max77693_muic_set_debounce_time() of extcon-max77693.c
use regmap_update_bits instead of regmap_write_bits as following:
switch (time) {
case ADC_DEBOUNCE_TIME_5MS:
case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS:
ret = regmap_update_bits(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL3,
CONTROL3_ADCDBSET_MASK,
time << CONTROL3_ADCDBSET_SHIFT);
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n");
return ret;
}
Thanks,
Chanwoo Choi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time.
2014-09-03 5:55 ` Chanwoo Choi
@ 2014-09-03 6:39 ` jonghwa3.lee
2014-09-03 6:56 ` Chanwoo Choi
0 siblings, 1 reply; 4+ messages in thread
From: jonghwa3.lee @ 2014-09-03 6:39 UTC (permalink / raw)
To: Chanwoo Choi; +Cc: linux-kernel, myungjoo.ham, r.baldyga
On 2014년 09월 03일 14:55, Chanwoo Choi wrote:
> On 09/03/2014 02:50 PM, Jonghwa Lee wrote:
>> When it writes some value other than 0 to BTLDset and JIGset, muic device
>> will be reset automatically. And it happens during updating ADC debounce time,
>> because it shares same register. To update ADC debounce time without reset,
>> set value only to ADCDbset and 0 to BTLDset and JIGset.
>>
>> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
>> ---
>> drivers/extcon/extcon-max77693.c | 11 ++++++++---
>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
>> index 77460f2..661a3bb 100644
>> --- a/drivers/extcon/extcon-max77693.c
>> +++ b/drivers/extcon/extcon-max77693.c
>> @@ -255,10 +255,15 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
>> case ADC_DEBOUNCE_TIME_10MS:
>> case ADC_DEBOUNCE_TIME_25MS:
>> case ADC_DEBOUNCE_TIME_38_62MS:
>> - ret = regmap_update_bits(info->max77693->regmap_muic,
>> + /*
>> + * Don't touch BTLDset, JIGset when you want to change adc
>> + * debounce time. BTLDset, JIGset reflects actual pin status
>> + * and are not configurable.
>> + */
>> + ret = regmap_write_bits(info->max77693->regmap_muic,
>> MAX77693_MUIC_REG_CTRL3,
>> - CONTROL3_ADCDBSET_MASK,
>> - time << CONTROL3_ADCDBSET_SHIFT);
>> + (CONTROL3_ADCDBSET_MASK &
>> + time << CONTROL3_ADCDBSET_SHIFT));
>
> Do you make this patch on extcon-next branch?
>
> The max77693_muic_set_debounce_time() of extcon-max77693.c
> use regmap_update_bits instead of regmap_write_bits as following:
This patch intends to use 'regmap_write_bits()' not 'regmap_update_bits()'.
With using regmap_update_bits(), it would writes some value to BTLDset and
JIGset then muic device will loose current state.
Thanks,
Jonghwa
>
> switch (time) {
> case ADC_DEBOUNCE_TIME_5MS:
> case ADC_DEBOUNCE_TIME_10MS:
> case ADC_DEBOUNCE_TIME_25MS:
> case ADC_DEBOUNCE_TIME_38_62MS:
> ret = regmap_update_bits(info->max77693->regmap_muic,
> MAX77693_MUIC_REG_CTRL3,
> CONTROL3_ADCDBSET_MASK,
> time << CONTROL3_ADCDBSET_SHIFT);
> if (ret) {
> dev_err(info->dev, "failed to set ADC debounce time\n");
> return ret;
> }
>
>
> Thanks,
> Chanwoo Choi
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time.
2014-09-03 6:39 ` jonghwa3.lee
@ 2014-09-03 6:56 ` Chanwoo Choi
0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2014-09-03 6:56 UTC (permalink / raw)
To: jonghwa3.lee; +Cc: linux-kernel, myungjoo.ham, r.baldyga
On 09/03/2014 03:39 PM, jonghwa3.lee@samsung.com wrote:
> On 2014년 09월 03일 14:55, Chanwoo Choi wrote:
>
>> On 09/03/2014 02:50 PM, Jonghwa Lee wrote:
>>> When it writes some value other than 0 to BTLDset and JIGset, muic device
>>> will be reset automatically. And it happens during updating ADC debounce time,
>>> because it shares same register. To update ADC debounce time without reset,
>>> set value only to ADCDbset and 0 to BTLDset and JIGset.
>>>
>>> Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
>>> ---
>>> drivers/extcon/extcon-max77693.c | 11 ++++++++---
>>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
>>> index 77460f2..661a3bb 100644
>>> --- a/drivers/extcon/extcon-max77693.c
>>> +++ b/drivers/extcon/extcon-max77693.c
>>> @@ -255,10 +255,15 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
>>> case ADC_DEBOUNCE_TIME_10MS:
>>> case ADC_DEBOUNCE_TIME_25MS:
>>> case ADC_DEBOUNCE_TIME_38_62MS:
>>> - ret = regmap_update_bits(info->max77693->regmap_muic,
>>> + /*
>>> + * Don't touch BTLDset, JIGset when you want to change adc
>>> + * debounce time. BTLDset, JIGset reflects actual pin status
>>> + * and are not configurable.
>>> + */
>>> + ret = regmap_write_bits(info->max77693->regmap_muic,
>>> MAX77693_MUIC_REG_CTRL3,
>>> - CONTROL3_ADCDBSET_MASK,
>>> - time << CONTROL3_ADCDBSET_SHIFT);
>>> + (CONTROL3_ADCDBSET_MASK &
>>> + time << CONTROL3_ADCDBSET_SHIFT));
>>
>> Do you make this patch on extcon-next branch?
>>
>> The max77693_muic_set_debounce_time() of extcon-max77693.c
>> use regmap_update_bits instead of regmap_write_bits as following:
>
>
> This patch intends to use 'regmap_write_bits()' not 'regmap_update_bits()'.
You're right. It is my mistake to review this patch.
> With using regmap_update_bits(), it would writes some value to BTLDset and
> JIGset then muic device will loose current state.
OK, I'll apply yout next patch(v2).
Thanks,
Chanwoo Choi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-03 6:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-03 5:50 [PATCH] extcon: max77693: Fix a bug occured at changing ADC debounce time Jonghwa Lee
2014-09-03 5:55 ` Chanwoo Choi
2014-09-03 6:39 ` jonghwa3.lee
2014-09-03 6:56 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox