diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2013-02-12 06:44:19 -0500 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2013-02-13 17:53:42 -0500 |
commit | e3e5bc02d2365d3e09164fd9a559011399ca2a4f (patch) | |
tree | 491a0532982f0731d8de14c9599817e68c5bc479 /drivers/extcon/extcon-max8997.c | |
parent | 45d4a4e6f5e5dcdd00b7c9d370cfb9694358e4e9 (diff) |
extcon: max8997: Move defined constant to header file
This patch move defined constants to header file(max77693-private.h)
because of mask/unmask selectively interrupt of MUIC device according
to attribute of H/W board.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-max8997.c')
-rw-r--r-- | drivers/extcon/extcon-max8997.c | 92 |
1 files changed, 31 insertions, 61 deletions
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index d16090ddd65a..0fb1d48b0741 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
@@ -30,51 +30,6 @@ | |||
30 | 30 | ||
31 | #define DEV_NAME "max8997-muic" | 31 | #define DEV_NAME "max8997-muic" |
32 | 32 | ||
33 | /* MAX8997-MUIC STATUS1 register */ | ||
34 | #define STATUS1_ADC_SHIFT 0 | ||
35 | #define STATUS1_ADCLOW_SHIFT 5 | ||
36 | #define STATUS1_ADCERR_SHIFT 6 | ||
37 | #define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT) | ||
38 | #define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT) | ||
39 | #define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT) | ||
40 | |||
41 | /* MAX8997-MUIC STATUS2 register */ | ||
42 | #define STATUS2_CHGTYP_SHIFT 0 | ||
43 | #define STATUS2_CHGDETRUN_SHIFT 3 | ||
44 | #define STATUS2_DCDTMR_SHIFT 4 | ||
45 | #define STATUS2_DBCHG_SHIFT 5 | ||
46 | #define STATUS2_VBVOLT_SHIFT 6 | ||
47 | #define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT) | ||
48 | #define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT) | ||
49 | #define STATUS2_DCDTMR_MASK (0x1 << STATUS2_DCDTMR_SHIFT) | ||
50 | #define STATUS2_DBCHG_MASK (0x1 << STATUS2_DBCHG_SHIFT) | ||
51 | #define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT) | ||
52 | |||
53 | /* MAX8997-MUIC STATUS3 register */ | ||
54 | #define STATUS3_OVP_SHIFT 2 | ||
55 | #define STATUS3_OVP_MASK (0x1 << STATUS3_OVP_SHIFT) | ||
56 | |||
57 | /* MAX8997-MUIC CONTROL1 register */ | ||
58 | #define COMN1SW_SHIFT 0 | ||
59 | #define COMP2SW_SHIFT 3 | ||
60 | #define COMN1SW_MASK (0x7 << COMN1SW_SHIFT) | ||
61 | #define COMP2SW_MASK (0x7 << COMP2SW_SHIFT) | ||
62 | #define SW_MASK (COMP2SW_MASK | COMN1SW_MASK) | ||
63 | |||
64 | #define MAX8997_SW_USB ((1 << COMP2SW_SHIFT) | (1 << COMN1SW_SHIFT)) | ||
65 | #define MAX8997_SW_AUDIO ((2 << COMP2SW_SHIFT) | (2 << COMN1SW_SHIFT)) | ||
66 | #define MAX8997_SW_UART ((3 << COMP2SW_SHIFT) | (3 << COMN1SW_SHIFT)) | ||
67 | #define MAX8997_SW_OPEN ((0 << COMP2SW_SHIFT) | (0 << COMN1SW_SHIFT)) | ||
68 | |||
69 | #define MAX8997_ADC_GROUND 0x00 | ||
70 | #define MAX8997_ADC_MHL 0x01 | ||
71 | #define MAX8997_ADC_JIG_USB_1 0x18 | ||
72 | #define MAX8997_ADC_JIG_USB_2 0x19 | ||
73 | #define MAX8997_ADC_DESKDOCK 0x1a | ||
74 | #define MAX8997_ADC_JIG_UART 0x1c | ||
75 | #define MAX8997_ADC_CARDOCK 0x1d | ||
76 | #define MAX8997_ADC_OPEN 0x1f | ||
77 | |||
78 | struct max8997_muic_irq { | 33 | struct max8997_muic_irq { |
79 | unsigned int irq; | 34 | unsigned int irq; |
80 | const char *name; | 35 | const char *name; |
@@ -109,17 +64,32 @@ struct max8997_muic_info { | |||
109 | struct extcon_dev *edev; | 64 | struct extcon_dev *edev; |
110 | }; | 65 | }; |
111 | 66 | ||
67 | enum { | ||
68 | EXTCON_CABLE_USB = 0, | ||
69 | EXTCON_CABLE_USB_HOST, | ||
70 | EXTCON_CABLE_TA, | ||
71 | EXTCON_CABLE_FAST_CHARGER, | ||
72 | EXTCON_CABLE_SLOW_CHARGER, | ||
73 | EXTCON_CABLE_CHARGE_DOWNSTREAM, | ||
74 | EXTCON_CABLE_MHL, | ||
75 | EXTCON_CABLE_DOCK_DESK, | ||
76 | EXTCON_CABLE_DOCK_CARD, | ||
77 | EXTCON_CABLE_JIG, | ||
78 | |||
79 | _EXTCON_CABLE_NUM, | ||
80 | }; | ||
81 | |||
112 | static const char *max8997_extcon_cable[] = { | 82 | static const char *max8997_extcon_cable[] = { |
113 | [0] = "USB", | 83 | [EXTCON_CABLE_USB] = "USB", |
114 | [1] = "USB-Host", | 84 | [EXTCON_CABLE_USB_HOST] = "USB-Host", |
115 | [2] = "TA", | 85 | [EXTCON_CABLE_TA] = "TA", |
116 | [3] = "Fast-charger", | 86 | [EXTCON_CABLE_FAST_CHARGER] = "Fast-charger", |
117 | [4] = "Slow-charger", | 87 | [EXTCON_CABLE_SLOW_CHARGER] = "Slow-charger", |
118 | [5] = "Charge-downstream", | 88 | [EXTCON_CABLE_CHARGE_DOWNSTREAM] = "Charge-downstream", |
119 | [6] = "MHL", | 89 | [EXTCON_CABLE_MHL] = "MHL", |
120 | [7] = "Dock-desk", | 90 | [EXTCON_CABLE_DOCK_DESK] = "Dock-Desk", |
121 | [8] = "Dock-card", | 91 | [EXTCON_CABLE_DOCK_CARD] = "Dock-Card", |
122 | [9] = "JIG", | 92 | [EXTCON_CABLE_JIG] = "JIG", |
123 | 93 | ||
124 | NULL, | 94 | NULL, |
125 | }; | 95 | }; |
@@ -132,8 +102,8 @@ static int max8997_muic_handle_usb(struct max8997_muic_info *info, | |||
132 | if (usb_type == MAX8997_USB_HOST) { | 102 | if (usb_type == MAX8997_USB_HOST) { |
133 | /* switch to USB */ | 103 | /* switch to USB */ |
134 | ret = max8997_update_reg(info->muic, MAX8997_MUIC_REG_CONTROL1, | 104 | ret = max8997_update_reg(info->muic, MAX8997_MUIC_REG_CONTROL1, |
135 | attached ? MAX8997_SW_USB : MAX8997_SW_OPEN, | 105 | attached ? CONTROL1_SW_USB : CONTROL1_SW_OPEN, |
136 | SW_MASK); | 106 | CONTROL1_SW_MASK); |
137 | if (ret) { | 107 | if (ret) { |
138 | dev_err(info->dev, "failed to update muic register\n"); | 108 | dev_err(info->dev, "failed to update muic register\n"); |
139 | goto out; | 109 | goto out; |
@@ -163,8 +133,8 @@ static int max8997_muic_handle_dock(struct max8997_muic_info *info, | |||
163 | 133 | ||
164 | /* switch to AUDIO */ | 134 | /* switch to AUDIO */ |
165 | ret = max8997_update_reg(info->muic, MAX8997_MUIC_REG_CONTROL1, | 135 | ret = max8997_update_reg(info->muic, MAX8997_MUIC_REG_CONTROL1, |
166 | attached ? MAX8997_SW_AUDIO : MAX8997_SW_OPEN, | 136 | attached ? CONTROL1_SW_AUDIO : CONTROL1_SW_OPEN, |
167 | SW_MASK); | 137 | CONTROL1_SW_MASK); |
168 | if (ret) { | 138 | if (ret) { |
169 | dev_err(info->dev, "failed to update muic register\n"); | 139 | dev_err(info->dev, "failed to update muic register\n"); |
170 | goto out; | 140 | goto out; |
@@ -192,8 +162,8 @@ static int max8997_muic_handle_jig_uart(struct max8997_muic_info *info, | |||
192 | 162 | ||
193 | /* switch to UART */ | 163 | /* switch to UART */ |
194 | ret = max8997_update_reg(info->muic, MAX8997_MUIC_REG_CONTROL1, | 164 | ret = max8997_update_reg(info->muic, MAX8997_MUIC_REG_CONTROL1, |
195 | attached ? MAX8997_SW_UART : MAX8997_SW_OPEN, | 165 | attached ? CONTROL1_SW_UART : CONTROL1_SW_OPEN, |
196 | SW_MASK); | 166 | CONTROL1_SW_MASK); |
197 | if (ret) { | 167 | if (ret) { |
198 | dev_err(info->dev, "failed to update muic register\n"); | 168 | dev_err(info->dev, "failed to update muic register\n"); |
199 | goto out; | 169 | goto out; |