diff options
author | Krzysztof Kozlowski <k.kozlowski.k@gmail.com> | 2015-07-15 08:59:53 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-16 16:39:30 -0400 |
commit | 309a3e00a511a233acb25eec567a4b11c99d016a (patch) | |
tree | 58e5f5ada4c558ddf481bb2845888ef01fa65c63 /drivers/extcon/extcon-max77843.c | |
parent | cceb433a1e2930301b33c79016eff147eb555cea (diff) |
mfd/extcon: max77843: Rename defines to allow inclusion with max77693
Add MAX77843_MUIC prefix to some of the defines used in max77843 extcon
driver so the max77693-private.h can be included simultaneously with
max77843-private.h.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/extcon/extcon-max77843.c')
-rw-r--r-- | drivers/extcon/extcon-max77843.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/drivers/extcon/extcon-max77843.c b/drivers/extcon/extcon-max77843.c index 4dfe0a6337d8..f652c4199870 100644 --- a/drivers/extcon/extcon-max77843.c +++ b/drivers/extcon/extcon-max77843.c | |||
@@ -206,11 +206,11 @@ static int max77843_muic_set_path(struct max77843_muic_info *info, | |||
206 | if (attached) | 206 | if (attached) |
207 | ctrl1 = val; | 207 | ctrl1 = val; |
208 | else | 208 | else |
209 | ctrl1 = CONTROL1_SW_OPEN; | 209 | ctrl1 = MAX77843_MUIC_CONTROL1_SW_OPEN; |
210 | 210 | ||
211 | ret = regmap_update_bits(max77843->regmap_muic, | 211 | ret = regmap_update_bits(max77843->regmap_muic, |
212 | MAX77843_MUIC_REG_CONTROL1, | 212 | MAX77843_MUIC_REG_CONTROL1, |
213 | CONTROL1_COM_SW, ctrl1); | 213 | MAX77843_MUIC_CONTROL1_COM_SW, ctrl1); |
214 | if (ret < 0) { | 214 | if (ret < 0) { |
215 | dev_err(info->dev, "Cannot switch MUIC port\n"); | 215 | dev_err(info->dev, "Cannot switch MUIC port\n"); |
216 | return ret; | 216 | return ret; |
@@ -244,7 +244,7 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info, | |||
244 | 244 | ||
245 | adc = info->status[MAX77843_MUIC_STATUS1] & | 245 | adc = info->status[MAX77843_MUIC_STATUS1] & |
246 | MAX77843_MUIC_STATUS1_ADC_MASK; | 246 | MAX77843_MUIC_STATUS1_ADC_MASK; |
247 | adc >>= STATUS1_ADC_SHIFT; | 247 | adc >>= MAX77843_MUIC_STATUS1_ADC_SHIFT; |
248 | 248 | ||
249 | switch (group) { | 249 | switch (group) { |
250 | case MAX77843_CABLE_GROUP_ADC: | 250 | case MAX77843_CABLE_GROUP_ADC: |
@@ -310,7 +310,7 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info, | |||
310 | /* Get VBVolt register bit */ | 310 | /* Get VBVolt register bit */ |
311 | gnd_type |= (info->status[MAX77843_MUIC_STATUS2] & | 311 | gnd_type |= (info->status[MAX77843_MUIC_STATUS2] & |
312 | MAX77843_MUIC_STATUS2_VBVOLT_MASK); | 312 | MAX77843_MUIC_STATUS2_VBVOLT_MASK); |
313 | gnd_type >>= STATUS2_VBVOLT_SHIFT; | 313 | gnd_type >>= MAX77843_MUIC_STATUS2_VBVOLT_SHIFT; |
314 | 314 | ||
315 | /* Offset of GND cable */ | 315 | /* Offset of GND cable */ |
316 | gnd_type |= MAX77843_MUIC_GND_USB_HOST; | 316 | gnd_type |= MAX77843_MUIC_GND_USB_HOST; |
@@ -339,7 +339,9 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info) | |||
339 | switch (gnd_cable_type) { | 339 | switch (gnd_cable_type) { |
340 | case MAX77843_MUIC_GND_USB_HOST: | 340 | case MAX77843_MUIC_GND_USB_HOST: |
341 | case MAX77843_MUIC_GND_USB_HOST_VB: | 341 | case MAX77843_MUIC_GND_USB_HOST_VB: |
342 | ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached); | 342 | ret = max77843_muic_set_path(info, |
343 | MAX77843_MUIC_CONTROL1_SW_USB, | ||
344 | attached); | ||
343 | if (ret < 0) | 345 | if (ret < 0) |
344 | return ret; | 346 | return ret; |
345 | 347 | ||
@@ -347,7 +349,9 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info) | |||
347 | break; | 349 | break; |
348 | case MAX77843_MUIC_GND_MHL_VB: | 350 | case MAX77843_MUIC_GND_MHL_VB: |
349 | case MAX77843_MUIC_GND_MHL: | 351 | case MAX77843_MUIC_GND_MHL: |
350 | ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); | 352 | ret = max77843_muic_set_path(info, |
353 | MAX77843_MUIC_CONTROL1_SW_OPEN, | ||
354 | attached); | ||
351 | if (ret < 0) | 355 | if (ret < 0) |
352 | return ret; | 356 | return ret; |
353 | 357 | ||
@@ -366,7 +370,7 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info, | |||
366 | int cable_type, bool attached) | 370 | int cable_type, bool attached) |
367 | { | 371 | { |
368 | int ret; | 372 | int ret; |
369 | u8 path = CONTROL1_SW_OPEN; | 373 | u8 path = MAX77843_MUIC_CONTROL1_SW_OPEN; |
370 | 374 | ||
371 | dev_dbg(info->dev, "external connector is %s (adc:0x%02x)\n", | 375 | dev_dbg(info->dev, "external connector is %s (adc:0x%02x)\n", |
372 | attached ? "attached" : "detached", cable_type); | 376 | attached ? "attached" : "detached", cable_type); |
@@ -374,10 +378,10 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info, | |||
374 | switch (cable_type) { | 378 | switch (cable_type) { |
375 | case MAX77843_MUIC_ADC_FACTORY_MODE_USB_OFF: | 379 | case MAX77843_MUIC_ADC_FACTORY_MODE_USB_OFF: |
376 | case MAX77843_MUIC_ADC_FACTORY_MODE_USB_ON: | 380 | case MAX77843_MUIC_ADC_FACTORY_MODE_USB_ON: |
377 | path = CONTROL1_SW_USB; | 381 | path = MAX77843_MUIC_CONTROL1_SW_USB; |
378 | break; | 382 | break; |
379 | case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF: | 383 | case MAX77843_MUIC_ADC_FACTORY_MODE_UART_OFF: |
380 | path = CONTROL1_SW_UART; | 384 | path = MAX77843_MUIC_CONTROL1_SW_UART; |
381 | break; | 385 | break; |
382 | default: | 386 | default: |
383 | return -EINVAL; | 387 | return -EINVAL; |
@@ -475,14 +479,18 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info) | |||
475 | 479 | ||
476 | switch (chg_type) { | 480 | switch (chg_type) { |
477 | case MAX77843_MUIC_CHG_USB: | 481 | case MAX77843_MUIC_CHG_USB: |
478 | ret = max77843_muic_set_path(info, CONTROL1_SW_USB, attached); | 482 | ret = max77843_muic_set_path(info, |
483 | MAX77843_MUIC_CONTROL1_SW_USB, | ||
484 | attached); | ||
479 | if (ret < 0) | 485 | if (ret < 0) |
480 | return ret; | 486 | return ret; |
481 | 487 | ||
482 | extcon_set_cable_state_(info->edev, EXTCON_USB, attached); | 488 | extcon_set_cable_state_(info->edev, EXTCON_USB, attached); |
483 | break; | 489 | break; |
484 | case MAX77843_MUIC_CHG_DOWNSTREAM: | 490 | case MAX77843_MUIC_CHG_DOWNSTREAM: |
485 | ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); | 491 | ret = max77843_muic_set_path(info, |
492 | MAX77843_MUIC_CONTROL1_SW_OPEN, | ||
493 | attached); | ||
486 | if (ret < 0) | 494 | if (ret < 0) |
487 | return ret; | 495 | return ret; |
488 | 496 | ||
@@ -490,14 +498,18 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info) | |||
490 | attached); | 498 | attached); |
491 | break; | 499 | break; |
492 | case MAX77843_MUIC_CHG_DEDICATED: | 500 | case MAX77843_MUIC_CHG_DEDICATED: |
493 | ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); | 501 | ret = max77843_muic_set_path(info, |
502 | MAX77843_MUIC_CONTROL1_SW_OPEN, | ||
503 | attached); | ||
494 | if (ret < 0) | 504 | if (ret < 0) |
495 | return ret; | 505 | return ret; |
496 | 506 | ||
497 | extcon_set_cable_state_(info->edev, EXTCON_TA, attached); | 507 | extcon_set_cable_state_(info->edev, EXTCON_TA, attached); |
498 | break; | 508 | break; |
499 | case MAX77843_MUIC_CHG_SPECIAL_500MA: | 509 | case MAX77843_MUIC_CHG_SPECIAL_500MA: |
500 | ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); | 510 | ret = max77843_muic_set_path(info, |
511 | MAX77843_MUIC_CONTROL1_SW_OPEN, | ||
512 | attached); | ||
501 | if (ret < 0) | 513 | if (ret < 0) |
502 | return ret; | 514 | return ret; |
503 | 515 | ||
@@ -505,7 +517,9 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info) | |||
505 | attached); | 517 | attached); |
506 | break; | 518 | break; |
507 | case MAX77843_MUIC_CHG_SPECIAL_1A: | 519 | case MAX77843_MUIC_CHG_SPECIAL_1A: |
508 | ret = max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); | 520 | ret = max77843_muic_set_path(info, |
521 | MAX77843_MUIC_CONTROL1_SW_OPEN, | ||
522 | attached); | ||
509 | if (ret < 0) | 523 | if (ret < 0) |
510 | return ret; | 524 | return ret; |
511 | 525 | ||
@@ -529,7 +543,8 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info) | |||
529 | "failed to detect %s accessory (chg_type:0x%x)\n", | 543 | "failed to detect %s accessory (chg_type:0x%x)\n", |
530 | attached ? "attached" : "detached", chg_type); | 544 | attached ? "attached" : "detached", chg_type); |
531 | 545 | ||
532 | max77843_muic_set_path(info, CONTROL1_SW_OPEN, attached); | 546 | max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_OPEN, |
547 | attached); | ||
533 | return -EINVAL; | 548 | return -EINVAL; |
534 | } | 549 | } |
535 | 550 | ||
@@ -668,7 +683,7 @@ static int max77843_muic_set_debounce_time(struct max77843_muic_info *info, | |||
668 | ret = regmap_update_bits(max77843->regmap_muic, | 683 | ret = regmap_update_bits(max77843->regmap_muic, |
669 | MAX77843_MUIC_REG_CONTROL4, | 684 | MAX77843_MUIC_REG_CONTROL4, |
670 | MAX77843_MUIC_CONTROL4_ADCDBSET_MASK, | 685 | MAX77843_MUIC_CONTROL4_ADCDBSET_MASK, |
671 | time << CONTROL4_ADCDBSET_SHIFT); | 686 | time << MAX77843_MUIC_CONTROL4_ADCDBSET_SHIFT); |
672 | if (ret < 0) { | 687 | if (ret < 0) { |
673 | dev_err(info->dev, "Cannot write MUIC regmap\n"); | 688 | dev_err(info->dev, "Cannot write MUIC regmap\n"); |
674 | return ret; | 689 | return ret; |
@@ -769,7 +784,7 @@ static int max77843_muic_probe(struct platform_device *pdev) | |||
769 | max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS); | 784 | max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS); |
770 | 785 | ||
771 | /* Set initial path for UART */ | 786 | /* Set initial path for UART */ |
772 | max77843_muic_set_path(info, CONTROL1_SW_UART, true); | 787 | max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true); |
773 | 788 | ||
774 | /* Check revision number of MUIC device */ | 789 | /* Check revision number of MUIC device */ |
775 | ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id); | 790 | ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id); |