aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-max77693.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2014-07-22 21:05:34 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2014-07-22 21:05:34 -0400
commit6b18aa180645706155da991847bb36b10c1c84c8 (patch)
treed2c2ed47d2b2290cfdcb6261e932dd07e6523485 /drivers/extcon/extcon-max77693.c
parentac65a625a0961e7a96f2e5e182073691d0474c04 (diff)
parent342d669c1ee421323f552a62729d3a3d0065093c (diff)
Merge tag 'mfd-extcon-regulator-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into extcon-next
Immutable branch between MFD, Extcon and Regulator due for v3.17
Diffstat (limited to 'drivers/extcon/extcon-max77693.c')
-rw-r--r--drivers/extcon/extcon-max77693.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index e9ec6ae8b0d8..042bf742c207 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);
@@ -1154,7 +1154,8 @@ static int max77693_muic_probe(struct platform_device *pdev)
1154 struct max77693_muic_irq *muic_irq = &muic_irqs[i]; 1154 struct max77693_muic_irq *muic_irq = &muic_irqs[i];
1155 unsigned int virq = 0; 1155 unsigned int virq = 0;
1156 1156
1157 virq = irq_create_mapping(max77693->irq_domain, muic_irq->irq); 1157 virq = regmap_irq_get_virq(max77693->irq_data_muic,
1158 muic_irq->irq);
1158 if (!virq) { 1159 if (!virq) {
1159 ret = -EINVAL; 1160 ret = -EINVAL;
1160 goto err_irq; 1161 goto err_irq;
@@ -1203,7 +1204,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
1203 enum max77693_irq_source irq_src 1204 enum max77693_irq_source irq_src
1204 = MAX77693_IRQ_GROUP_NR; 1205 = MAX77693_IRQ_GROUP_NR;
1205 1206
1206 max77693_write_reg(info->max77693->regmap_muic, 1207 regmap_write(info->max77693->regmap_muic,
1207 init_data[i].addr, 1208 init_data[i].addr,
1208 init_data[i].data); 1209 init_data[i].data);
1209 1210
@@ -1261,7 +1262,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
1261 max77693_muic_set_path(info, info->path_uart, true); 1262 max77693_muic_set_path(info, info->path_uart, true);
1262 1263
1263 /* Check revision number of MUIC device*/ 1264 /* Check revision number of MUIC device*/
1264 ret = max77693_read_reg(info->max77693->regmap_muic, 1265 ret = regmap_read(info->max77693->regmap_muic,
1265 MAX77693_MUIC_REG_ID, &id); 1266 MAX77693_MUIC_REG_ID, &id);
1266 if (ret < 0) { 1267 if (ret < 0) {
1267 dev_err(&pdev->dev, "failed to read revision number\n"); 1268 dev_err(&pdev->dev, "failed to read revision number\n");