aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 11:45:33 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 11:45:33 -0500
commit8062d94a545457a83d5291bd62c3bfd14200bba0 (patch)
treea6a7aaaea5dff00f7415a93189720a1164ae30dd /drivers/power
parent15e68a803573974409972e761d8f08f03fce5bdb (diff)
parent6e13c6505cdff9766d5268ffb8c972c1a2f996e6 (diff)
Merge tag 'xceiv-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
USB: transceiver changes for 3.4 Here we have a big rework done by Heikki Krogerus (thanks) which splits OTG functionality away from transceivers. We have known for quite a long time that struct otg_transceiver was a bad name for the structure, considering transceiver is far from being OTG-specific (see 4e67185).
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/isp1704_charger.c106
-rw-r--r--drivers/power/pda_power.c10
-rw-r--r--drivers/power/twl4030_charger.c20
3 files changed, 73 insertions, 63 deletions
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index b806667b59ae..1289a5f790a1 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -56,7 +56,7 @@ static u16 isp170x_id[] = {
56struct isp1704_charger { 56struct isp1704_charger {
57 struct device *dev; 57 struct device *dev;
58 struct power_supply psy; 58 struct power_supply psy;
59 struct otg_transceiver *otg; 59 struct usb_phy *phy;
60 struct notifier_block nb; 60 struct notifier_block nb;
61 struct work_struct work; 61 struct work_struct work;
62 62
@@ -71,6 +71,16 @@ struct isp1704_charger {
71 unsigned max_power; 71 unsigned max_power;
72}; 72};
73 73
74static inline int isp1704_read(struct isp1704_charger *isp, u32 reg)
75{
76 return usb_phy_io_read(isp->phy, reg);
77}
78
79static inline int isp1704_write(struct isp1704_charger *isp, u32 val, u32 reg)
80{
81 return usb_phy_io_write(isp->phy, val, reg);
82}
83
74/* 84/*
75 * Disable/enable the power from the isp1704 if a function for it 85 * Disable/enable the power from the isp1704 if a function for it
76 * has been provided with platform data. 86 * has been provided with platform data.
@@ -97,31 +107,31 @@ static inline int isp1704_charger_type(struct isp1704_charger *isp)
97 u8 otg_ctrl; 107 u8 otg_ctrl;
98 int type = POWER_SUPPLY_TYPE_USB_DCP; 108 int type = POWER_SUPPLY_TYPE_USB_DCP;
99 109
100 func_ctrl = otg_io_read(isp->otg, ULPI_FUNC_CTRL); 110 func_ctrl = isp1704_read(isp, ULPI_FUNC_CTRL);
101 otg_ctrl = otg_io_read(isp->otg, ULPI_OTG_CTRL); 111 otg_ctrl = isp1704_read(isp, ULPI_OTG_CTRL);
102 112
103 /* disable pulldowns */ 113 /* disable pulldowns */
104 reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN; 114 reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN;
105 otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), reg); 115 isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), reg);
106 116
107 /* full speed */ 117 /* full speed */
108 otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), 118 isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
109 ULPI_FUNC_CTRL_XCVRSEL_MASK); 119 ULPI_FUNC_CTRL_XCVRSEL_MASK);
110 otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), 120 isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL),
111 ULPI_FUNC_CTRL_FULL_SPEED); 121 ULPI_FUNC_CTRL_FULL_SPEED);
112 122
113 /* Enable strong pull-up on DP (1.5K) and reset */ 123 /* Enable strong pull-up on DP (1.5K) and reset */
114 reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; 124 reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET;
115 otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), reg); 125 isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), reg);
116 usleep_range(1000, 2000); 126 usleep_range(1000, 2000);
117 127
118 reg = otg_io_read(isp->otg, ULPI_DEBUG); 128 reg = isp1704_read(isp, ULPI_DEBUG);
119 if ((reg & 3) != 3) 129 if ((reg & 3) != 3)
120 type = POWER_SUPPLY_TYPE_USB_CDP; 130 type = POWER_SUPPLY_TYPE_USB_CDP;
121 131
122 /* recover original state */ 132 /* recover original state */
123 otg_io_write(isp->otg, ULPI_FUNC_CTRL, func_ctrl); 133 isp1704_write(isp, ULPI_FUNC_CTRL, func_ctrl);
124 otg_io_write(isp->otg, ULPI_OTG_CTRL, otg_ctrl); 134 isp1704_write(isp, ULPI_OTG_CTRL, otg_ctrl);
125 135
126 return type; 136 return type;
127} 137}
@@ -136,28 +146,28 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp)
136 u8 r; 146 u8 r;
137 147
138 /* Reset the transceiver */ 148 /* Reset the transceiver */
139 r = otg_io_read(isp->otg, ULPI_FUNC_CTRL); 149 r = isp1704_read(isp, ULPI_FUNC_CTRL);
140 r |= ULPI_FUNC_CTRL_RESET; 150 r |= ULPI_FUNC_CTRL_RESET;
141 otg_io_write(isp->otg, ULPI_FUNC_CTRL, r); 151 isp1704_write(isp, ULPI_FUNC_CTRL, r);
142 usleep_range(1000, 2000); 152 usleep_range(1000, 2000);
143 153
144 /* Set normal mode */ 154 /* Set normal mode */
145 r &= ~(ULPI_FUNC_CTRL_RESET | ULPI_FUNC_CTRL_OPMODE_MASK); 155 r &= ~(ULPI_FUNC_CTRL_RESET | ULPI_FUNC_CTRL_OPMODE_MASK);
146 otg_io_write(isp->otg, ULPI_FUNC_CTRL, r); 156 isp1704_write(isp, ULPI_FUNC_CTRL, r);
147 157
148 /* Clear the DP and DM pull-down bits */ 158 /* Clear the DP and DM pull-down bits */
149 r = ULPI_OTG_CTRL_DP_PULLDOWN | ULPI_OTG_CTRL_DM_PULLDOWN; 159 r = ULPI_OTG_CTRL_DP_PULLDOWN | ULPI_OTG_CTRL_DM_PULLDOWN;
150 otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), r); 160 isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), r);
151 161
152 /* Enable strong pull-up on DP (1.5K) and reset */ 162 /* Enable strong pull-up on DP (1.5K) and reset */
153 r = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; 163 r = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET;
154 otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), r); 164 isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), r);
155 usleep_range(1000, 2000); 165 usleep_range(1000, 2000);
156 166
157 /* Read the line state */ 167 /* Read the line state */
158 if (!otg_io_read(isp->otg, ULPI_DEBUG)) { 168 if (!isp1704_read(isp, ULPI_DEBUG)) {
159 /* Disable strong pull-up on DP (1.5K) */ 169 /* Disable strong pull-up on DP (1.5K) */
160 otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), 170 isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
161 ULPI_FUNC_CTRL_TERMSELECT); 171 ULPI_FUNC_CTRL_TERMSELECT);
162 return 1; 172 return 1;
163 } 173 }
@@ -165,23 +175,23 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp)
165 /* Is it a charger or PS/2 connection */ 175 /* Is it a charger or PS/2 connection */
166 176
167 /* Enable weak pull-up resistor on DP */ 177 /* Enable weak pull-up resistor on DP */
168 otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL), 178 isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL),
169 ISP1704_PWR_CTRL_DP_WKPU_EN); 179 ISP1704_PWR_CTRL_DP_WKPU_EN);
170 180
171 /* Disable strong pull-up on DP (1.5K) */ 181 /* Disable strong pull-up on DP (1.5K) */
172 otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), 182 isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
173 ULPI_FUNC_CTRL_TERMSELECT); 183 ULPI_FUNC_CTRL_TERMSELECT);
174 184
175 /* Enable weak pull-down resistor on DM */ 185 /* Enable weak pull-down resistor on DM */
176 otg_io_write(isp->otg, ULPI_SET(ULPI_OTG_CTRL), 186 isp1704_write(isp, ULPI_SET(ULPI_OTG_CTRL),
177 ULPI_OTG_CTRL_DM_PULLDOWN); 187 ULPI_OTG_CTRL_DM_PULLDOWN);
178 188
179 /* It's a charger if the line states are clear */ 189 /* It's a charger if the line states are clear */
180 if (!(otg_io_read(isp->otg, ULPI_DEBUG))) 190 if (!(isp1704_read(isp, ULPI_DEBUG)))
181 ret = 1; 191 ret = 1;
182 192
183 /* Disable weak pull-up resistor on DP */ 193 /* Disable weak pull-up resistor on DP */
184 otg_io_write(isp->otg, ULPI_CLR(ISP1704_PWR_CTRL), 194 isp1704_write(isp, ULPI_CLR(ISP1704_PWR_CTRL),
185 ISP1704_PWR_CTRL_DP_WKPU_EN); 195 ISP1704_PWR_CTRL_DP_WKPU_EN);
186 196
187 return ret; 197 return ret;
@@ -193,14 +203,14 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp)
193 u8 pwr_ctrl; 203 u8 pwr_ctrl;
194 int ret = 0; 204 int ret = 0;
195 205
196 pwr_ctrl = otg_io_read(isp->otg, ISP1704_PWR_CTRL); 206 pwr_ctrl = isp1704_read(isp, ISP1704_PWR_CTRL);
197 207
198 /* set SW control bit in PWR_CTRL register */ 208 /* set SW control bit in PWR_CTRL register */
199 otg_io_write(isp->otg, ISP1704_PWR_CTRL, 209 isp1704_write(isp, ISP1704_PWR_CTRL,
200 ISP1704_PWR_CTRL_SWCTRL); 210 ISP1704_PWR_CTRL_SWCTRL);
201 211
202 /* enable manual charger detection */ 212 /* enable manual charger detection */
203 otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL), 213 isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL),
204 ISP1704_PWR_CTRL_SWCTRL 214 ISP1704_PWR_CTRL_SWCTRL
205 | ISP1704_PWR_CTRL_DPVSRC_EN); 215 | ISP1704_PWR_CTRL_DPVSRC_EN);
206 usleep_range(1000, 2000); 216 usleep_range(1000, 2000);
@@ -208,7 +218,7 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp)
208 timeout = jiffies + msecs_to_jiffies(300); 218 timeout = jiffies + msecs_to_jiffies(300);
209 do { 219 do {
210 /* Check if there is a charger */ 220 /* Check if there is a charger */
211 if (otg_io_read(isp->otg, ISP1704_PWR_CTRL) 221 if (isp1704_read(isp, ISP1704_PWR_CTRL)
212 & ISP1704_PWR_CTRL_VDAT_DET) { 222 & ISP1704_PWR_CTRL_VDAT_DET) {
213 ret = isp1704_charger_verify(isp); 223 ret = isp1704_charger_verify(isp);
214 break; 224 break;
@@ -216,7 +226,7 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp)
216 } while (!time_after(jiffies, timeout) && isp->online); 226 } while (!time_after(jiffies, timeout) && isp->online);
217 227
218 /* recover original state */ 228 /* recover original state */
219 otg_io_write(isp->otg, ISP1704_PWR_CTRL, pwr_ctrl); 229 isp1704_write(isp, ISP1704_PWR_CTRL, pwr_ctrl);
220 230
221 return ret; 231 return ret;
222} 232}
@@ -264,8 +274,8 @@ static void isp1704_charger_work(struct work_struct *data)
264 case POWER_SUPPLY_TYPE_USB: 274 case POWER_SUPPLY_TYPE_USB:
265 default: 275 default:
266 /* enable data pullups */ 276 /* enable data pullups */
267 if (isp->otg->gadget) 277 if (isp->phy->otg->gadget)
268 usb_gadget_connect(isp->otg->gadget); 278 usb_gadget_connect(isp->phy->otg->gadget);
269 } 279 }
270 break; 280 break;
271 case USB_EVENT_NONE: 281 case USB_EVENT_NONE:
@@ -283,8 +293,8 @@ static void isp1704_charger_work(struct work_struct *data)
283 * chargers. The pullups may be enabled elsewhere, so this can 293 * chargers. The pullups may be enabled elsewhere, so this can
284 * not be the final solution. 294 * not be the final solution.
285 */ 295 */
286 if (isp->otg->gadget) 296 if (isp->phy->otg->gadget)
287 usb_gadget_disconnect(isp->otg->gadget); 297 usb_gadget_disconnect(isp->phy->otg->gadget);
288 298
289 isp1704_charger_set_power(isp, 0); 299 isp1704_charger_set_power(isp, 0);
290 break; 300 break;
@@ -364,11 +374,11 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp)
364 int ret = -ENODEV; 374 int ret = -ENODEV;
365 375
366 /* Test ULPI interface */ 376 /* Test ULPI interface */
367 ret = otg_io_write(isp->otg, ULPI_SCRATCH, 0xaa); 377 ret = isp1704_write(isp, ULPI_SCRATCH, 0xaa);
368 if (ret < 0) 378 if (ret < 0)
369 return ret; 379 return ret;
370 380
371 ret = otg_io_read(isp->otg, ULPI_SCRATCH); 381 ret = isp1704_read(isp, ULPI_SCRATCH);
372 if (ret < 0) 382 if (ret < 0)
373 return ret; 383 return ret;
374 384
@@ -376,13 +386,13 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp)
376 return -ENODEV; 386 return -ENODEV;
377 387
378 /* Verify the product and vendor id matches */ 388 /* Verify the product and vendor id matches */
379 vendor = otg_io_read(isp->otg, ULPI_VENDOR_ID_LOW); 389 vendor = isp1704_read(isp, ULPI_VENDOR_ID_LOW);
380 vendor |= otg_io_read(isp->otg, ULPI_VENDOR_ID_HIGH) << 8; 390 vendor |= isp1704_read(isp, ULPI_VENDOR_ID_HIGH) << 8;
381 if (vendor != NXP_VENDOR_ID) 391 if (vendor != NXP_VENDOR_ID)
382 return -ENODEV; 392 return -ENODEV;
383 393
384 product = otg_io_read(isp->otg, ULPI_PRODUCT_ID_LOW); 394 product = isp1704_read(isp, ULPI_PRODUCT_ID_LOW);
385 product |= otg_io_read(isp->otg, ULPI_PRODUCT_ID_HIGH) << 8; 395 product |= isp1704_read(isp, ULPI_PRODUCT_ID_HIGH) << 8;
386 396
387 for (i = 0; i < ARRAY_SIZE(isp170x_id); i++) { 397 for (i = 0; i < ARRAY_SIZE(isp170x_id); i++) {
388 if (product == isp170x_id[i]) { 398 if (product == isp170x_id[i]) {
@@ -405,8 +415,8 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
405 if (!isp) 415 if (!isp)
406 return -ENOMEM; 416 return -ENOMEM;
407 417
408 isp->otg = otg_get_transceiver(); 418 isp->phy = usb_get_transceiver();
409 if (!isp->otg) 419 if (!isp->phy)
410 goto fail0; 420 goto fail0;
411 421
412 isp->dev = &pdev->dev; 422 isp->dev = &pdev->dev;
@@ -429,14 +439,14 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
429 goto fail1; 439 goto fail1;
430 440
431 /* 441 /*
432 * REVISIT: using work in order to allow the otg notifications to be 442 * REVISIT: using work in order to allow the usb notifications to be
433 * made atomically in the future. 443 * made atomically in the future.
434 */ 444 */
435 INIT_WORK(&isp->work, isp1704_charger_work); 445 INIT_WORK(&isp->work, isp1704_charger_work);
436 446
437 isp->nb.notifier_call = isp1704_notifier_call; 447 isp->nb.notifier_call = isp1704_notifier_call;
438 448
439 ret = otg_register_notifier(isp->otg, &isp->nb); 449 ret = usb_register_notifier(isp->phy, &isp->nb);
440 if (ret) 450 if (ret)
441 goto fail2; 451 goto fail2;
442 452
@@ -449,13 +459,13 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
449 * enumerated. The charger driver should be always loaded before any 459 * enumerated. The charger driver should be always loaded before any
450 * gadget is loaded. 460 * gadget is loaded.
451 */ 461 */
452 if (isp->otg->gadget) 462 if (isp->phy->otg->gadget)
453 usb_gadget_disconnect(isp->otg->gadget); 463 usb_gadget_disconnect(isp->phy->otg->gadget);
454 464
455 /* Detect charger if VBUS is valid (the cable was already plugged). */ 465 /* Detect charger if VBUS is valid (the cable was already plugged). */
456 ret = otg_io_read(isp->otg, ULPI_USB_INT_STS); 466 ret = isp1704_read(isp, ULPI_USB_INT_STS);
457 isp1704_charger_set_power(isp, 0); 467 isp1704_charger_set_power(isp, 0);
458 if ((ret & ULPI_INT_VBUS_VALID) && !isp->otg->default_a) { 468 if ((ret & ULPI_INT_VBUS_VALID) && !isp->phy->otg->default_a) {
459 isp->event = USB_EVENT_VBUS; 469 isp->event = USB_EVENT_VBUS;
460 schedule_work(&isp->work); 470 schedule_work(&isp->work);
461 } 471 }
@@ -464,7 +474,7 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
464fail2: 474fail2:
465 power_supply_unregister(&isp->psy); 475 power_supply_unregister(&isp->psy);
466fail1: 476fail1:
467 otg_put_transceiver(isp->otg); 477 usb_put_transceiver(isp->phy);
468fail0: 478fail0:
469 kfree(isp); 479 kfree(isp);
470 480
@@ -477,9 +487,9 @@ static int __devexit isp1704_charger_remove(struct platform_device *pdev)
477{ 487{
478 struct isp1704_charger *isp = platform_get_drvdata(pdev); 488 struct isp1704_charger *isp = platform_get_drvdata(pdev);
479 489
480 otg_unregister_notifier(isp->otg, &isp->nb); 490 usb_unregister_notifier(isp->phy, &isp->nb);
481 power_supply_unregister(&isp->psy); 491 power_supply_unregister(&isp->psy);
482 otg_put_transceiver(isp->otg); 492 usb_put_transceiver(isp->phy);
483 isp1704_charger_set_power(isp, 0); 493 isp1704_charger_set_power(isp, 0);
484 kfree(isp); 494 kfree(isp);
485 495
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index fd49689738af..214468f4444a 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -40,7 +40,7 @@ static struct timer_list polling_timer;
40static int polling; 40static int polling;
41 41
42#ifdef CONFIG_USB_OTG_UTILS 42#ifdef CONFIG_USB_OTG_UTILS
43static struct otg_transceiver *transceiver; 43static struct usb_phy *transceiver;
44static struct notifier_block otg_nb; 44static struct notifier_block otg_nb;
45#endif 45#endif
46 46
@@ -321,7 +321,7 @@ static int pda_power_probe(struct platform_device *pdev)
321 } 321 }
322 322
323#ifdef CONFIG_USB_OTG_UTILS 323#ifdef CONFIG_USB_OTG_UTILS
324 transceiver = otg_get_transceiver(); 324 transceiver = usb_get_transceiver();
325 if (transceiver && !pdata->is_usb_online) { 325 if (transceiver && !pdata->is_usb_online) {
326 pdata->is_usb_online = otg_is_usb_online; 326 pdata->is_usb_online = otg_is_usb_online;
327 } 327 }
@@ -375,7 +375,7 @@ static int pda_power_probe(struct platform_device *pdev)
375#ifdef CONFIG_USB_OTG_UTILS 375#ifdef CONFIG_USB_OTG_UTILS
376 if (transceiver && pdata->use_otg_notifier) { 376 if (transceiver && pdata->use_otg_notifier) {
377 otg_nb.notifier_call = otg_handle_notification; 377 otg_nb.notifier_call = otg_handle_notification;
378 ret = otg_register_notifier(transceiver, &otg_nb); 378 ret = usb_register_notifier(transceiver, &otg_nb);
379 if (ret) { 379 if (ret) {
380 dev_err(dev, "failure to register otg notifier\n"); 380 dev_err(dev, "failure to register otg notifier\n");
381 goto otg_reg_notifier_failed; 381 goto otg_reg_notifier_failed;
@@ -409,7 +409,7 @@ usb_supply_failed:
409 free_irq(ac_irq->start, &pda_psy_ac); 409 free_irq(ac_irq->start, &pda_psy_ac);
410#ifdef CONFIG_USB_OTG_UTILS 410#ifdef CONFIG_USB_OTG_UTILS
411 if (transceiver) 411 if (transceiver)
412 otg_put_transceiver(transceiver); 412 usb_put_transceiver(transceiver);
413#endif 413#endif
414ac_irq_failed: 414ac_irq_failed:
415 if (pdata->is_ac_online) 415 if (pdata->is_ac_online)
@@ -444,7 +444,7 @@ static int pda_power_remove(struct platform_device *pdev)
444 power_supply_unregister(&pda_psy_ac); 444 power_supply_unregister(&pda_psy_ac);
445#ifdef CONFIG_USB_OTG_UTILS 445#ifdef CONFIG_USB_OTG_UTILS
446 if (transceiver) 446 if (transceiver)
447 otg_put_transceiver(transceiver); 447 usb_put_transceiver(transceiver);
448#endif 448#endif
449 if (ac_draw) { 449 if (ac_draw) {
450 regulator_put(ac_draw); 450 regulator_put(ac_draw);
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index 54b9198fa576..fdad850c77d3 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -69,8 +69,8 @@ struct twl4030_bci {
69 struct device *dev; 69 struct device *dev;
70 struct power_supply ac; 70 struct power_supply ac;
71 struct power_supply usb; 71 struct power_supply usb;
72 struct otg_transceiver *transceiver; 72 struct usb_phy *transceiver;
73 struct notifier_block otg_nb; 73 struct notifier_block usb_nb;
74 struct work_struct work; 74 struct work_struct work;
75 int irq_chg; 75 int irq_chg;
76 int irq_bci; 76 int irq_bci;
@@ -279,7 +279,7 @@ static void twl4030_bci_usb_work(struct work_struct *data)
279static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val, 279static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val,
280 void *priv) 280 void *priv)
281{ 281{
282 struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb); 282 struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, usb_nb);
283 283
284 dev_dbg(bci->dev, "OTG notify %lu\n", val); 284 dev_dbg(bci->dev, "OTG notify %lu\n", val);
285 285
@@ -479,10 +479,10 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
479 479
480 INIT_WORK(&bci->work, twl4030_bci_usb_work); 480 INIT_WORK(&bci->work, twl4030_bci_usb_work);
481 481
482 bci->transceiver = otg_get_transceiver(); 482 bci->transceiver = usb_get_transceiver();
483 if (bci->transceiver != NULL) { 483 if (bci->transceiver != NULL) {
484 bci->otg_nb.notifier_call = twl4030_bci_usb_ncb; 484 bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
485 otg_register_notifier(bci->transceiver, &bci->otg_nb); 485 usb_register_notifier(bci->transceiver, &bci->usb_nb);
486 } 486 }
487 487
488 /* Enable interrupts now. */ 488 /* Enable interrupts now. */
@@ -508,8 +508,8 @@ static int __init twl4030_bci_probe(struct platform_device *pdev)
508 508
509fail_unmask_interrupts: 509fail_unmask_interrupts:
510 if (bci->transceiver != NULL) { 510 if (bci->transceiver != NULL) {
511 otg_unregister_notifier(bci->transceiver, &bci->otg_nb); 511 usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
512 otg_put_transceiver(bci->transceiver); 512 usb_put_transceiver(bci->transceiver);
513 } 513 }
514 free_irq(bci->irq_bci, bci); 514 free_irq(bci->irq_bci, bci);
515fail_bci_irq: 515fail_bci_irq:
@@ -539,8 +539,8 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev)
539 TWL4030_INTERRUPTS_BCIIMR2A); 539 TWL4030_INTERRUPTS_BCIIMR2A);
540 540
541 if (bci->transceiver != NULL) { 541 if (bci->transceiver != NULL) {
542 otg_unregister_notifier(bci->transceiver, &bci->otg_nb); 542 usb_unregister_notifier(bci->transceiver, &bci->usb_nb);
543 otg_put_transceiver(bci->transceiver); 543 usb_put_transceiver(bci->transceiver);
544 } 544 }
545 free_irq(bci->irq_bci, bci); 545 free_irq(bci->irq_bci, bci);
546 free_irq(bci->irq_chg, bci); 546 free_irq(bci->irq_chg, bci);