diff options
| -rw-r--r-- | drivers/extcon/extcon-max77693.c | 32 | ||||
| -rw-r--r-- | drivers/mfd/max77693-irq.c | 50 | ||||
| -rw-r--r-- | drivers/mfd/max77693.c | 56 | ||||
| -rw-r--r-- | drivers/regulator/max77693.c | 12 | ||||
| -rw-r--r-- | include/linux/mfd/max77693-private.h | 8 |
5 files changed, 54 insertions, 104 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 2c7c3e191591..ba84a6e77e03 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c | |||
| @@ -255,10 +255,10 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, | |||
| 255 | case ADC_DEBOUNCE_TIME_10MS: | 255 | case ADC_DEBOUNCE_TIME_10MS: |
| 256 | case ADC_DEBOUNCE_TIME_25MS: | 256 | case ADC_DEBOUNCE_TIME_25MS: |
| 257 | case ADC_DEBOUNCE_TIME_38_62MS: | 257 | case ADC_DEBOUNCE_TIME_38_62MS: |
| 258 | ret = max77693_update_reg(info->max77693->regmap_muic, | 258 | ret = regmap_update_bits(info->max77693->regmap_muic, |
| 259 | MAX77693_MUIC_REG_CTRL3, | 259 | MAX77693_MUIC_REG_CTRL3, |
| 260 | time << CONTROL3_ADCDBSET_SHIFT, | 260 | CONTROL3_ADCDBSET_MASK, |
| 261 | CONTROL3_ADCDBSET_MASK); | 261 | time << CONTROL3_ADCDBSET_SHIFT); |
| 262 | if (ret) { | 262 | if (ret) { |
| 263 | dev_err(info->dev, "failed to set ADC debounce time\n"); | 263 | dev_err(info->dev, "failed to set ADC debounce time\n"); |
| 264 | return ret; | 264 | return ret; |
| @@ -286,15 +286,15 @@ static int max77693_muic_set_path(struct max77693_muic_info *info, | |||
| 286 | u8 val, bool attached) | 286 | u8 val, bool attached) |
| 287 | { | 287 | { |
| 288 | int ret = 0; | 288 | int ret = 0; |
| 289 | u8 ctrl1, ctrl2 = 0; | 289 | unsigned int ctrl1, ctrl2 = 0; |
| 290 | 290 | ||
| 291 | if (attached) | 291 | if (attached) |
| 292 | ctrl1 = val; | 292 | ctrl1 = val; |
| 293 | else | 293 | else |
| 294 | ctrl1 = CONTROL1_SW_OPEN; | 294 | ctrl1 = CONTROL1_SW_OPEN; |
| 295 | 295 | ||
| 296 | ret = max77693_update_reg(info->max77693->regmap_muic, | 296 | ret = regmap_update_bits(info->max77693->regmap_muic, |
| 297 | MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK); | 297 | MAX77693_MUIC_REG_CTRL1, COMP_SW_MASK, ctrl1); |
| 298 | if (ret < 0) { | 298 | if (ret < 0) { |
| 299 | dev_err(info->dev, "failed to update MUIC register\n"); | 299 | dev_err(info->dev, "failed to update MUIC register\n"); |
| 300 | return ret; | 300 | return ret; |
| @@ -305,9 +305,9 @@ static int max77693_muic_set_path(struct max77693_muic_info *info, | |||
| 305 | else | 305 | else |
| 306 | ctrl2 |= CONTROL2_LOWPWR_MASK; /* LowPwr=1, CPEn=0 */ | 306 | ctrl2 |= CONTROL2_LOWPWR_MASK; /* LowPwr=1, CPEn=0 */ |
| 307 | 307 | ||
| 308 | ret = max77693_update_reg(info->max77693->regmap_muic, | 308 | ret = regmap_update_bits(info->max77693->regmap_muic, |
| 309 | MAX77693_MUIC_REG_CTRL2, ctrl2, | 309 | MAX77693_MUIC_REG_CTRL2, |
| 310 | CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK); | 310 | CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK, ctrl2); |
| 311 | if (ret < 0) { | 311 | if (ret < 0) { |
| 312 | dev_err(info->dev, "failed to update MUIC register\n"); | 312 | dev_err(info->dev, "failed to update MUIC register\n"); |
| 313 | return ret; | 313 | return ret; |
| @@ -969,8 +969,8 @@ static void max77693_muic_irq_work(struct work_struct *work) | |||
| 969 | if (info->irq == muic_irqs[i].virq) | 969 | if (info->irq == muic_irqs[i].virq) |
| 970 | irq_type = muic_irqs[i].irq; | 970 | irq_type = muic_irqs[i].irq; |
| 971 | 971 | ||
| 972 | ret = max77693_bulk_read(info->max77693->regmap_muic, | 972 | ret = regmap_bulk_read(info->max77693->regmap_muic, |
| 973 | MAX77693_MUIC_REG_STATUS1, 2, info->status); | 973 | MAX77693_MUIC_REG_STATUS1, info->status, 2); |
| 974 | if (ret) { | 974 | if (ret) { |
| 975 | dev_err(info->dev, "failed to read MUIC register\n"); | 975 | dev_err(info->dev, "failed to read MUIC register\n"); |
| 976 | mutex_unlock(&info->mutex); | 976 | mutex_unlock(&info->mutex); |
| @@ -1042,8 +1042,8 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info) | |||
| 1042 | mutex_lock(&info->mutex); | 1042 | mutex_lock(&info->mutex); |
| 1043 | 1043 | ||
| 1044 | /* Read STATUSx register to detect accessory */ | 1044 | /* Read STATUSx register to detect accessory */ |
| 1045 | ret = max77693_bulk_read(info->max77693->regmap_muic, | 1045 | ret = regmap_bulk_read(info->max77693->regmap_muic, |
| 1046 | MAX77693_MUIC_REG_STATUS1, 2, info->status); | 1046 | MAX77693_MUIC_REG_STATUS1, info->status, 2); |
| 1047 | if (ret) { | 1047 | if (ret) { |
| 1048 | dev_err(info->dev, "failed to read MUIC register\n"); | 1048 | dev_err(info->dev, "failed to read MUIC register\n"); |
| 1049 | mutex_unlock(&info->mutex); | 1049 | mutex_unlock(&info->mutex); |
| @@ -1095,7 +1095,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1095 | int delay_jiffies; | 1095 | int delay_jiffies; |
| 1096 | int ret; | 1096 | int ret; |
| 1097 | int i; | 1097 | int i; |
| 1098 | u8 id; | 1098 | unsigned int id; |
| 1099 | 1099 | ||
| 1100 | info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info), | 1100 | info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info), |
| 1101 | GFP_KERNEL); | 1101 | GFP_KERNEL); |
| @@ -1204,7 +1204,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1204 | enum max77693_irq_source irq_src | 1204 | enum max77693_irq_source irq_src |
| 1205 | = MAX77693_IRQ_GROUP_NR; | 1205 | = MAX77693_IRQ_GROUP_NR; |
| 1206 | 1206 | ||
| 1207 | max77693_write_reg(info->max77693->regmap_muic, | 1207 | regmap_write(info->max77693->regmap_muic, |
| 1208 | init_data[i].addr, | 1208 | init_data[i].addr, |
| 1209 | init_data[i].data); | 1209 | init_data[i].data); |
| 1210 | 1210 | ||
| @@ -1262,7 +1262,7 @@ static int max77693_muic_probe(struct platform_device *pdev) | |||
| 1262 | max77693_muic_set_path(info, info->path_uart, true); | 1262 | max77693_muic_set_path(info, info->path_uart, true); |
| 1263 | 1263 | ||
| 1264 | /* Check revision number of MUIC device*/ | 1264 | /* Check revision number of MUIC device*/ |
| 1265 | ret = max77693_read_reg(info->max77693->regmap_muic, | 1265 | ret = regmap_read(info->max77693->regmap_muic, |
| 1266 | MAX77693_MUIC_REG_ID, &id); | 1266 | MAX77693_MUIC_REG_ID, &id); |
| 1267 | if (ret < 0) { | 1267 | if (ret < 0) { |
| 1268 | dev_err(&pdev->dev, "failed to read revision number\n"); | 1268 | dev_err(&pdev->dev, "failed to read revision number\n"); |
diff --git a/drivers/mfd/max77693-irq.c b/drivers/mfd/max77693-irq.c index 66b58fe77094..7d8f99f94f27 100644 --- a/drivers/mfd/max77693-irq.c +++ b/drivers/mfd/max77693-irq.c | |||
| @@ -30,8 +30,9 @@ | |||
| 30 | #include <linux/irqdomain.h> | 30 | #include <linux/irqdomain.h> |
| 31 | #include <linux/mfd/max77693.h> | 31 | #include <linux/mfd/max77693.h> |
| 32 | #include <linux/mfd/max77693-private.h> | 32 | #include <linux/mfd/max77693-private.h> |
| 33 | #include <linux/regmap.h> | ||
| 33 | 34 | ||
| 34 | static const u8 max77693_mask_reg[] = { | 35 | static const unsigned int max77693_mask_reg[] = { |
| 35 | [LED_INT] = MAX77693_LED_REG_FLASH_INT_MASK, | 36 | [LED_INT] = MAX77693_LED_REG_FLASH_INT_MASK, |
| 36 | [TOPSYS_INT] = MAX77693_PMIC_REG_TOPSYS_INT_MASK, | 37 | [TOPSYS_INT] = MAX77693_PMIC_REG_TOPSYS_INT_MASK, |
| 37 | [CHG_INT] = MAX77693_CHG_REG_CHG_INT_MASK, | 38 | [CHG_INT] = MAX77693_CHG_REG_CHG_INT_MASK, |
| @@ -118,7 +119,7 @@ static void max77693_irq_sync_unlock(struct irq_data *data) | |||
| 118 | continue; | 119 | continue; |
| 119 | max77693->irq_masks_cache[i] = max77693->irq_masks_cur[i]; | 120 | max77693->irq_masks_cache[i] = max77693->irq_masks_cur[i]; |
| 120 | 121 | ||
| 121 | max77693_write_reg(map, max77693_mask_reg[i], | 122 | regmap_write(map, max77693_mask_reg[i], |
| 122 | max77693->irq_masks_cur[i]); | 123 | max77693->irq_masks_cur[i]); |
| 123 | } | 124 | } |
| 124 | 125 | ||
| @@ -178,11 +179,11 @@ static irqreturn_t max77693_irq_thread(int irq, void *data) | |||
| 178 | { | 179 | { |
| 179 | struct max77693_dev *max77693 = data; | 180 | struct max77693_dev *max77693 = data; |
| 180 | u8 irq_reg[MAX77693_IRQ_GROUP_NR] = {}; | 181 | u8 irq_reg[MAX77693_IRQ_GROUP_NR] = {}; |
| 181 | u8 irq_src; | 182 | unsigned int irq_src; |
| 182 | int ret; | 183 | int ret; |
| 183 | int i, cur_irq; | 184 | int i, cur_irq; |
| 184 | 185 | ||
| 185 | ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_INTSRC, | 186 | ret = regmap_read(max77693->regmap, MAX77693_PMIC_REG_INTSRC, |
| 186 | &irq_src); | 187 | &irq_src); |
| 187 | if (ret < 0) { | 188 | if (ret < 0) { |
| 188 | dev_err(max77693->dev, "Failed to read interrupt source: %d\n", | 189 | dev_err(max77693->dev, "Failed to read interrupt source: %d\n", |
| @@ -190,25 +191,34 @@ static irqreturn_t max77693_irq_thread(int irq, void *data) | |||
| 190 | return IRQ_NONE; | 191 | return IRQ_NONE; |
| 191 | } | 192 | } |
| 192 | 193 | ||
| 193 | if (irq_src & MAX77693_IRQSRC_CHG) | 194 | if (irq_src & MAX77693_IRQSRC_CHG) { |
| 194 | /* CHG_INT */ | 195 | /* CHG_INT */ |
| 195 | ret = max77693_read_reg(max77693->regmap, MAX77693_CHG_REG_CHG_INT, | 196 | unsigned int data; |
| 196 | &irq_reg[CHG_INT]); | 197 | ret = regmap_read(max77693->regmap, |
| 198 | MAX77693_CHG_REG_CHG_INT, &data); | ||
| 199 | irq_reg[CHG_INT] = data; | ||
| 200 | } | ||
| 197 | 201 | ||
| 198 | if (irq_src & MAX77693_IRQSRC_TOP) | 202 | if (irq_src & MAX77693_IRQSRC_TOP) { |
| 199 | /* TOPSYS_INT */ | ||
