diff options
| author | Robert Baldyga <r.baldyga@samsung.com> | 2014-05-21 02:52:47 -0400 |
|---|---|---|
| committer | Lee Jones <lee.jones@linaro.org> | 2014-06-17 10:16:10 -0400 |
| commit | d0540f91cf74fab90e1143d8d40da8a5b5fabc8a (patch) | |
| tree | 92f7a18906c67cbc598a4e2b182eea34699fcd97 | |
| parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) | |
mfd: max77693: Remove unnecessary wrapper functions
This patch removes wrapper functions used to access regmap, and
make driver using regmap_*() functions instead.
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
| -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 */ | 203 | /* TOPSYS_INT */ |
| 200 | ret = max77693_read_reg(max77693->regmap, | 204 | unsigned int data; |
| 201 | MAX77693_PMIC_REG_TOPSYS_INT, &irq_reg[TOPSYS_INT]); | 205 | ret = regmap_read(max77693->regmap, |
| 206 | MAX77693_PMIC_REG_TOPSYS_INT, &data); | ||
| 207 | irq_reg[TOPSYS_INT] = data; | ||
| 208 | } | ||
| 202 | 209 | ||
| 203 | if (irq_src & MAX77693_IRQSRC_FLASH) | 210 | if (irq_src & MAX77693_IRQSRC_FLASH) { |
| 204 | /* LED_INT */ | 211 | /* LED_INT */ |
| 205 | ret = max77693_read_reg(max77693->regmap, | 212 | unsigned int data; |
| 206 | MAX77693_LED_REG_FLASH_INT, &irq_reg[LED_INT]); | 213 | ret = regmap_read(max77693->regmap, |
| 214 | MAX77693_LED_REG_FLASH_INT, &data); | ||
| 215 | irq_reg[LED_INT] = data; | ||
| 216 | } | ||
| 207 | 217 | ||
| 208 | if (irq_src & MAX77693_IRQSRC_MUIC) | 218 | if (irq_src & MAX77693_IRQSRC_MUIC) |
| 209 | /* MUIC INT1 ~ INT3 */ | 219 | /* MUIC INT1 ~ INT3 */ |
| 210 | max77693_bulk_read(max77693->regmap_muic, MAX77693_MUIC_REG_INT1, | 220 | regmap_bulk_read(max77693->regmap_muic, MAX77693_MUIC_REG_INT1, |
| 211 | MAX77693_NUM_IRQ_MUIC_REGS, &irq_reg[MUIC_INT1]); | 221 | &irq_reg[MUIC_INT1], MAX77693_NUM_IRQ_MUIC_REGS); |
| 212 | 222 | ||
| 213 | /* Apply masking */ | 223 | /* Apply masking */ |
| 214 | for (i = 0; i < MAX77693_IRQ_GROUP_NR; i++) { | 224 | for (i = 0; i < MAX77693_IRQ_GROUP_NR; i++) { |
| @@ -263,7 +273,7 @@ int max77693_irq_init(struct max77693_dev *max77693) | |||
| 263 | struct irq_domain *domain; | 273 | struct irq_domain *domain; |
| 264 | int i; | 274 | int i; |
| 265 | int ret = 0; | 275 | int ret = 0; |
| 266 | u8 intsrc_mask; | 276 | unsigned int intsrc_mask; |
| 267 | 277 | ||
| 268 | mutex_init(&max77693->irqlock); | 278 | mutex_init(&max77693->irqlock); |
| 269 | 279 | ||
| @@ -286,9 +296,9 @@ int max77693_irq_init(struct max77693_dev *max77693) | |||
| 286 | if (max77693_mask_reg[i] == MAX77693_REG_INVALID) | 296 | if (max77693_mask_reg[i] == MAX77693_REG_INVALID) |
| 287 | continue; | 297 | continue; |
| 288 | if (i >= MUIC_INT1 && i <= MUIC_INT3) | 298 | if (i >= MUIC_INT1 && i <= MUIC_INT3) |
| 289 | max77693_write_reg(map, max77693_mask_reg[i], 0x00); | 299 | regmap_write(map, max77693_mask_reg[i], 0x00); |
| 290 | else | 300 | else |
| 291 | max77693_write_reg(map, max77693_mask_reg[i], 0xff); | 301 | regmap_write(map, max77693_mask_reg[i], 0xff); |
| 292 | } | 302 | } |
| 293 | 303 | ||
| 294 | domain = irq_domain_add_linear(NULL, MAX77693_IRQ_NR, | 304 | domain = irq_domain_add_linear(NULL, MAX77693_IRQ_NR, |
| @@ -301,7 +311,7 @@ int max77693_irq_init(struct max77693_dev *max77693) | |||
| 301 | max77693->irq_domain = domain; | 311 | max77693->irq_domain = domain; |
| 302 | 312 | ||
| 303 | /* Unmask max77693 interrupt */ | 313 | /* Unmask max77693 interrupt */ |
| 304 | ret = max77693_read_reg(max77693->regmap, | 314 | ret = regmap_read(max77693->regmap, |
| 305 | MAX77693_PMIC_REG_INTSRC_MASK, &intsrc_mask); | 315 | MAX77693_PMIC_REG_INTSRC_MASK, &intsrc_mask); |
| 306 | if (ret < 0) { | 316 | if (ret < 0) { |
| 307 | dev_err(max77693->dev, "fail to read PMIC register\n"); | 317 | dev_err(max77693->dev, "fail to read PMIC register\n"); |
| @@ -311,7 +321,7 @@ int max77693_irq_init(struct max77693_dev *max77693) | |||
| 311 | intsrc_mask &= ~(MAX77693_IRQSRC_CHG); | 321 | intsrc_mask &= ~(MAX77693_IRQSRC_CHG); |
| 312 | intsrc_mask &= ~(MAX77693_IRQSRC_FLASH); | 322 | intsrc_mask &= ~(MAX77693_IRQSRC_FLASH); |
| 313 | intsrc_mask &= ~(MAX77693_IRQSRC_MUIC); | 323 | intsrc_mask &= ~(MAX77693_IRQSRC_MUIC); |
| 314 | ret = max77693_write_reg(max77693->regmap, | 324 | ret = regmap_write(max77693->regmap, |
| 315 | MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask); | 325 | MAX77693_PMIC_REG_INTSRC_MASK, intsrc_mask); |
| 316 | if (ret < 0) { | 326 | if (ret < 0) { |
| 317 | dev_err(max77693->dev, "fail to write PMIC register\n"); | 327 | dev_err(max77693->dev, "fail to write PMIC register\n"); |
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index 7e05428c756d..a0308336adaf 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
| @@ -49,58 +49,6 @@ static const struct mfd_cell max77693_devs[] = { | |||
| 49 | { .name = "max77693-haptic", }, | 49 | { .name = "max77693-haptic", }, |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest) | ||
| 53 | { | ||
| 54 | unsigned int val; | ||
| 55 | int ret; | ||
| 56 | |||
| 57 | ret = regmap_read(map, reg, &val); | ||
| 58 | *dest = val; | ||
| 59 | |||
| 60 | return ret; | ||
| 61 | } | ||
| 62 | EXPORT_SYMBOL_GPL(max77693_read_reg); | ||
| 63 | |||
| 64 | int max77693_bulk_read(struct regmap *map, u8 reg, int count, u8 *buf) | ||
| 65 | { | ||
| 66 | int ret; | ||
| 67 | |||
| 68 | ret = regmap_bulk_read(map, reg, buf, count); | ||
| 69 | |||
| 70 | return ret; | ||
| 71 | } | ||
| 72 | EXPORT_SYMBOL_GPL(max77693_bulk_read); | ||
| 73 | |||
| 74 | int max77693_write_reg(struct regmap *map, u8 reg, u8 value) | ||
| 75 | { | ||
| 76 | int ret; | ||
| 77 | |||
| 78 | ret = regmap_write(map, reg, value); | ||
| 79 | |||
| 80 | return ret; | ||
| 81 | } | ||
| 82 | EXPORT_SYMBOL_GPL(max77693_write_reg); | ||
| 83 | |||
| 84 | int max77693_bulk_write(struct regmap *map, u8 reg, int count, u8 *buf) | ||
| 85 | { | ||
| 86 | int ret; | ||
| 87 | |||
| 88 | ret = regmap_bulk_write(map, reg, buf, count); | ||
| 89 | |||
| 90 | return ret; | ||
| 91 | } | ||
| 92 | EXPORT_SYMBOL_GPL(max77693_bulk_write); | ||
| 93 | |||
| 94 | int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask) | ||
| 95 | { | ||
| 96 | int ret; | ||
| 97 | |||
| 98 | ret = regmap_update_bits(map, reg, mask, val); | ||
| 99 | |||
| 100 | return ret; | ||
| 101 | } | ||
| 102 | EXPORT_SYMBOL_GPL(max77693_update_reg); | ||
| 103 | |||
| 104 | static const struct regmap_config max77693_regmap_config = { | 52 | static const struct regmap_config max77693_regmap_config = { |
| 105 | .reg_bits = 8, | 53 | .reg_bits = 8, |
| 106 | .val_bits = 8, | 54 | .val_bits = 8, |
| @@ -117,7 +65,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
| 117 | const struct i2c_device_id *id) | 65 | const struct i2c_device_id *id) |
| 118 | { | 66 | { |
| 119 | struct max77693_dev *max77693; | 67 | struct max77693_dev *max77693; |
| 120 | u8 reg_data; | 68 | unsigned int reg_data; |
| 121 | int ret = 0; | 69 | int ret = 0; |
| 122 | 70 | ||
| 123 | max77693 = devm_kzalloc(&i2c->dev, | 71 | max77693 = devm_kzalloc(&i2c->dev, |
| @@ -139,7 +87,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
| 139 | return ret; | 87 | return ret; |
| 140 | } | 88 | } |
| 141 | 89 | ||
| 142 | ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, | 90 | ret = regmap_read(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, |
| 143 | ®_data); | 91 | ®_data); |
| 144 | if (ret < 0) { | 92 | if (ret < 0) { |
| 145 | dev_err(max77693->dev, "device not found on this channel\n"); | 93 | dev_err(max77693->dev, "device not found on this channel\n"); |
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c index 653a58b49cdf..c67ff05fc1dd 100644 --- a/drivers/regulator/max77693.c +++ b/drivers/regulator/max77693.c | |||
| @@ -31,6 +31,7 @@ | |||
| 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/regulator/of_regulator.h> | 33 | #include <linux/regulator/of_regulator.h> |
| 34 | #include <linux/regmap.h> | ||
| 34 | 35 | ||
| 35 | #define CHGIN_ILIM_STEP_20mA 20000 | 36 | #define CHGIN_ILIM_STEP_20mA 20000 |
| 36 | 37 | ||
| @@ -39,9 +40,9 @@ | |||
| 39 | static int max77693_chg_is_enabled(struct regulator_dev *rdev) | 40 | static int max77693_chg_is_enabled(struct regulator_dev *rdev) |
| 40 | { | 41 | { |
| 41 | int ret; | 42 | int ret; |
| 42 | u8 val; | 43 | unsigned int val; |
| 43 | 44 | ||
| 44 | ret = max77693_read_reg(rdev->regmap, rdev->desc->enable_reg, &val); | 45 | ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val); |
| 45 | if (ret) | 46 | if (ret) |
| 46 | return ret; | 47 | return ret; |
| 47 | 48 | ||
| @@ -57,12 +58,11 @@ static int max77693_chg_get_current_limit(struct regulator_dev *rdev) | |||
| 57 | { | 58 | { |
| 58 | unsigned int chg_min_uA = rdev->constraints->min_uA; | 59 | unsigned int chg_min_uA = rdev->constraints->min_uA; |
| 59 | unsigned int chg_max_uA = rdev->constraints->max_uA; | 60 | unsigned int chg_max_uA = rdev->constraints->max_uA; |
| 60 | u8 reg, sel; | 61 | unsigned int reg, sel; |
| 61 | unsigned int val; | 62 | unsigned int val; |
| 62 | int ret; | 63 | int ret; |
| 63 | 64 | ||
| 64 | ret = max77693_read_reg(rdev->regmap, | 65 | ret = regmap_read(rdev->regmap, MAX77693_CHG_REG_CHG_CNFG_09, ®); |
| 65 | MAX77693_CHG_REG_CHG_CNFG_09, ®); | ||
| 66 | if (ret < 0) | 66 | if (ret < 0) |
| 67 | return ret; | 67 | return ret; |
| 68 | 68 | ||
| @@ -96,7 +96,7 @@ static int max77693_chg_set_current_limit(struct regulator_dev *rdev, | |||
| 96 | /* the first four codes for charger current are all 60mA */ | 96 | /* the first four codes for charger current are all 60mA */ |
| 97 | sel += 3; | 97 | sel += 3; |
| 98 | 98 | ||
| 99 | return max77693_write_reg(rdev->regmap, | 99 | return regmap_write(rdev->regmap, |
| 100 | MAX77693_CHG_REG_CHG_CNFG_09, sel); | 100 | MAX77693_CHG_REG_CHG_CNFG_09, sel); |
| 101 | } | 101 | } |
| 102 | /* end of CHARGER regulator ops */ | 102 | /* end of CHARGER regulator ops */ |
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index 3e050b933dd0..80ec31d561c4 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h | |||
| @@ -332,14 +332,6 @@ enum max77693_types { | |||
| 332 | TYPE_MAX77693, | 332 | TYPE_MAX77693, |
| 333 | }; | 333 | }; |
| 334 | 334 | ||
| 335 | extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest); | ||
| 336 | extern int max77693_bulk_read(struct regmap *map, u8 reg, int count, | ||
| 337 | u8 *buf); | ||
| 338 | extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value); | ||
| 339 | extern int max77693_bulk_write(struct regmap *map, u8 reg, int count, | ||
| 340 | u8 *buf); | ||
| 341 | extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask); | ||
| 342 | |||
| 343 | extern int max77693_irq_init(struct max77693_dev *max77686); | 335 | extern int max77693_irq_init(struct max77693_dev *max77686); |
| 344 | extern void max77693_irq_exit(struct max77693_dev *max77686); | 336 | extern void max77693_irq_exit(struct max77693_dev *max77686); |
| 345 | extern int max77693_irq_resume(struct max77693_dev *max77686); | 337 | extern int max77693_irq_resume(struct max77693_dev *max77686); |
