aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2013-02-13 01:04:15 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2013-02-13 17:54:36 -0500
commit685dc9a7dbfede28cc4a0fe4e65804194ec04fa5 (patch)
treea9fdfc0c829dde97092c3e92d0ee70ce61a56436
parentf73f6232af9131f7b6fc6e377267e4a441727eb3 (diff)
extcon: max8997: Set default UART/USB path on probe
This patch set default H/W line path according to platfomr data. The MAX8997 MUIC device can possibly set UART/USB or UART_AUX /USB_AUX to internal H/W line path of MUIC device. Namely, only one H/W line is used for two operation. For example, if H/W line path of MAX8997 device set UART/USB, micro usb cable is connected to AP(Application Processor) and if H/W line path set UART_AUX/USB_AUX, micro usb cable is connected to CP(Coprocessor). Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
-rw-r--r--drivers/extcon/extcon-max8997.c28
-rw-r--r--include/linux/mfd/max8997.h7
2 files changed, 33 insertions, 2 deletions
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 35338a090c06..349f65f6a4a4 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -127,6 +127,13 @@ struct max8997_muic_info {
127 127
128 struct max8997_muic_platform_data *muic_pdata; 128 struct max8997_muic_platform_data *muic_pdata;
129 enum max8997_muic_charger_type pre_charger_type; 129 enum max8997_muic_charger_type pre_charger_type;
130
131 /*
132 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
133 * h/w path of COMP2/COMN1 on CONTROL1 register.
134 */
135 int path_usb;
136 int path_uart;
130}; 137};
131 138
132enum { 139enum {
@@ -322,7 +329,7 @@ static int max8997_muic_handle_usb(struct max8997_muic_info *info,
322 int ret = 0; 329 int ret = 0;
323 330
324 if (usb_type == MAX8997_USB_HOST) { 331 if (usb_type == MAX8997_USB_HOST) {
325 ret = max8997_muic_set_path(info, CONTROL1_SW_USB, attached); 332 ret = max8997_muic_set_path(info, info->path_usb, attached);
326 if (ret < 0) { 333 if (ret < 0) {
327 dev_err(info->dev, "failed to update muic register\n"); 334 dev_err(info->dev, "failed to update muic register\n");
328 return ret; 335 return ret;
@@ -378,7 +385,7 @@ static int max8997_muic_handle_jig_uart(struct max8997_muic_info *info,
378 int ret = 0; 385 int ret = 0;
379 386
380 /* switch to UART */ 387 /* switch to UART */
381 ret = max8997_muic_set_path(info, CONTROL1_SW_UART, attached); 388 ret = max8997_muic_set_path(info, info->path_uart, attached);
382 if (ret) { 389 if (ret) {
383 dev_err(info->dev, "failed to update muic register\n"); 390 dev_err(info->dev, "failed to update muic register\n");
384 return -EINVAL; 391 return -EINVAL;
@@ -694,6 +701,23 @@ static int max8997_muic_probe(struct platform_device *pdev)
694 } 701 }
695 } 702 }
696 703
704 /*
705 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
706 * h/w path of COMP2/COMN1 on CONTROL1 register.
707 */
708 if (pdata->muic_pdata->path_uart)
709 info->path_uart = pdata->muic_pdata->path_uart;
710 else
711 info->path_uart = CONTROL1_SW_UART;
712
713 if (pdata->muic_pdata->path_usb)
714 info->path_usb = pdata->muic_pdata->path_usb;
715 else
716 info->path_usb = CONTROL1_SW_USB;
717
718 /* Set initial path for UART */
719 max8997_muic_set_path(info, info->path_uart, true);
720
697 /* Set ADC debounce time */ 721 /* Set ADC debounce time */
698 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); 722 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);
699 723
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 65f8d6a3a608..2d2d67b6a393 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -92,6 +92,13 @@ struct max8997_muic_reg_data {
92struct max8997_muic_platform_data { 92struct max8997_muic_platform_data {
93 struct max8997_muic_reg_data *init_data; 93 struct max8997_muic_reg_data *init_data;
94 int num_init_data; 94 int num_init_data;
95
96 /*
97 * Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
98 * h/w path of COMP2/COMN1 on CONTROL1 register.
99 */
100 int path_usb;
101 int path_uart;
95}; 102};
96 103
97enum max8997_haptic_motor_type { 104enum max8997_haptic_motor_type {