Commit bf2627d6 authored by Axel Lin's avatar Axel Lin Committed by MyungJoo Ham

extcon: max77693: Use max77693_update_reg for rmw operations

This simplifies the code.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent 909f9ec0
...@@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = { ...@@ -239,25 +239,19 @@ const char *max77693_extcon_cable[] = {
static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
enum max77693_muic_adc_debounce_time time) enum max77693_muic_adc_debounce_time time)
{ {
int ret = 0; int ret;
u8 ctrl3;
switch (time) { switch (time) {
case ADC_DEBOUNCE_TIME_5MS: case ADC_DEBOUNCE_TIME_5MS:
case ADC_DEBOUNCE_TIME_10MS: case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS: case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS: case ADC_DEBOUNCE_TIME_38_62MS:
ret = max77693_read_reg(info->max77693->regmap_muic, ret = max77693_update_reg(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL3, &ctrl3); MAX77693_MUIC_REG_CTRL3,
ctrl3 &= ~CONTROL3_ADCDBSET_MASK; time << CONTROL3_ADCDBSET_SHIFT,
ctrl3 |= (time << CONTROL3_ADCDBSET_SHIFT); CONTROL3_ADCDBSET_MASK);
if (ret)
ret = max77693_write_reg(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL3, ctrl3);
if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n"); dev_err(info->dev, "failed to set ADC debounce time\n");
ret = -EINVAL;
}
break; break;
default: default:
dev_err(info->dev, "invalid ADC debounce time\n"); dev_err(info->dev, "invalid ADC debounce time\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment