diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/chips/isp1301_omap.c | 65 |
1 files changed, 47 insertions, 18 deletions
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index 28902ebd5539..e0d56ef2bcb0 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/gpio.h> | ||
28 | #include <linux/usb/ch9.h> | 29 | #include <linux/usb/ch9.h> |
29 | #include <linux/usb/gadget.h> | 30 | #include <linux/usb/gadget.h> |
30 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
@@ -33,7 +34,10 @@ | |||
33 | #include <linux/workqueue.h> | 34 | #include <linux/workqueue.h> |
34 | 35 | ||
35 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
37 | #include <asm/mach-types.h> | ||
38 | |||
36 | #include <mach/usb.h> | 39 | #include <mach/usb.h> |
40 | #include <mach/mux.h> | ||
37 | 41 | ||
38 | 42 | ||
39 | #ifndef DEBUG | 43 | #ifndef DEBUG |
@@ -88,14 +92,9 @@ struct isp1301 { | |||
88 | 92 | ||
89 | /*-------------------------------------------------------------------------*/ | 93 | /*-------------------------------------------------------------------------*/ |
90 | 94 | ||
91 | #ifdef CONFIG_MACH_OMAP_H2 | ||
92 | |||
93 | /* board-specific PM hooks */ | 95 | /* board-specific PM hooks */ |
94 | 96 | ||
95 | #include <asm/gpio.h> | 97 | #if defined(CONFIG_MACH_OMAP_H2) || defined(CONFIG_MACH_OMAP_H3) |
96 | #include <mach/mux.h> | ||
97 | #include <asm/mach-types.h> | ||
98 | |||
99 | 98 | ||
100 | #if defined(CONFIG_TPS65010) || defined(CONFIG_TPS65010_MODULE) | 99 | #if defined(CONFIG_TPS65010) || defined(CONFIG_TPS65010_MODULE) |
101 | 100 | ||
@@ -135,6 +134,33 @@ static inline void notresponding(struct isp1301 *isp) | |||
135 | 134 | ||
136 | #endif | 135 | #endif |
137 | 136 | ||
137 | #if defined(CONFIG_MACH_OMAP_H4) | ||
138 | |||
139 | static void enable_vbus_draw(struct isp1301 *isp, unsigned mA) | ||
140 | { | ||
141 | /* H4 controls this by DIP switch S2.4; no soft control. | ||
142 | * ON means the charger is always enabled. Leave it OFF | ||
143 | * unless the OTG port is used only in B-peripheral mode. | ||
144 | */ | ||
145 | } | ||
146 | |||
147 | static void enable_vbus_source(struct isp1301 *isp) | ||
148 | { | ||
149 | /* this board won't supply more than 8mA vbus power. | ||
150 | * some boards can switch a 100ma "unit load" (or more). | ||
151 | */ | ||
152 | } | ||
153 | |||
154 | |||
155 | /* products will deliver OTG messages with LEDs, GUI, etc */ | ||
156 | static inline void notresponding(struct isp1301 *isp) | ||
157 | { | ||
158 | printk(KERN_NOTICE "OTG device not responding.\n"); | ||
159 | } | ||
160 | |||
161 | |||
162 | #endif | ||
163 | |||
138 | /*-------------------------------------------------------------------------*/ | 164 | /*-------------------------------------------------------------------------*/ |
139 | 165 | ||
140 | static struct i2c_driver isp1301_driver; | 166 | static struct i2c_driver isp1301_driver; |
@@ -334,8 +360,7 @@ static int gadget_suspend(struct isp1301 *isp) | |||
334 | * NOTE: guaranteeing certain response times might mean we shouldn't | 360 | * NOTE: guaranteeing certain response times might mean we shouldn't |
335 | * share keventd's work queue; a realtime task might be safest. | 361 | * share keventd's work queue; a realtime task might be safest. |
336 | */ | 362 | */ |
337 | void | 363 | static void isp1301_defer_work(struct isp1301 *isp, int work) |
338 | isp1301_defer_work(struct isp1301 *isp, int work) | ||
339 | { | 364 | { |
340 | int status; | 365 | int status; |
341 | 366 | ||
@@ -512,7 +537,6 @@ static void update_otg1(struct isp1301 *isp, u8 int_src) | |||
512 | otg_ctrl &= ~OTG_XCEIV_INPUTS; | 537 | otg_ctrl &= ~OTG_XCEIV_INPUTS; |
513 | otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD); | 538 | otg_ctrl &= ~(OTG_ID|OTG_ASESSVLD|OTG_VBUSVLD); |
514 | 539 | ||
515 | |||
516 | if (int_src & INTR_SESS_VLD) | 540 | if (int_src & INTR_SESS_VLD) |
517 | otg_ctrl |= OTG_ASESSVLD; | 541 | otg_ctrl |= OTG_ASESSVLD; |
518 | else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) { | 542 | else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) { |
@@ -886,11 +910,11 @@ static int otg_probe(struct platform_device *dev) | |||
886 | 910 | ||
887 | static int otg_remove(struct platform_device *dev) | 911 | static int otg_remove(struct platform_device *dev) |
888 | { | 912 | { |
889 | otg_dev = 0; | 913 | otg_dev = NULL; |
890 | return 0; | 914 | return 0; |
891 | } | 915 | } |
892 | 916 | ||
893 | struct platform_driver omap_otg_driver = { | 917 | static struct platform_driver omap_otg_driver = { |
894 | .probe = otg_probe, | 918 | .probe = otg_probe, |
895 | .remove = otg_remove, | 919 | .remove = otg_remove, |
896 | .driver = { | 920 | .driver = { |
@@ -1212,6 +1236,8 @@ static void isp1301_release(struct device *dev) | |||
1212 | 1236 | ||
1213 | isp = dev_get_drvdata(dev); | 1237 | isp = dev_get_drvdata(dev); |
1214 | 1238 | ||
1239 | /* FIXME -- not with a "new style" driver, it doesn't!! */ | ||
1240 | |||
1215 | /* ugly -- i2c hijacks our memory hook to wait_for_completion() */ | 1241 | /* ugly -- i2c hijacks our memory hook to wait_for_completion() */ |
1216 | if (isp->i2c_release) | 1242 | if (isp->i2c_release) |
1217 | isp->i2c_release(dev); | 1243 | isp->i2c_release(dev); |
@@ -1233,7 +1259,7 @@ static int __exit isp1301_remove(struct i2c_client *i2c) | |||
1233 | otg_unbind(isp); | 1259 | otg_unbind(isp); |
1234 | #endif | 1260 | #endif |
1235 | if (machine_is_omap_h2()) | 1261 | if (machine_is_omap_h2()) |
1236 | omap_free_gpio(2); | 1262 | gpio_free(2); |
1237 | 1263 | ||
1238 | isp->timer.data = 0; | 1264 | isp->timer.data = 0; |
1239 | set_bit(WORK_STOP, &isp->todo); | 1265 | set_bit(WORK_STOP, &isp->todo); |
@@ -1241,7 +1267,7 @@ static int __exit isp1301_remove(struct i2c_client *i2c) | |||
1241 | flush_scheduled_work(); | 1267 | flush_scheduled_work(); |
1242 | 1268 | ||
1243 | put_device(&i2c->dev); | 1269 | put_device(&i2c->dev); |
1244 | the_transceiver = 0; | 1270 | the_transceiver = NULL; |
1245 | 1271 | ||
1246 | return 0; | 1272 | return 0; |
1247 | } | 1273 | } |
@@ -1295,7 +1321,7 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
1295 | if (!host) { | 1321 | if (!host) { |
1296 | omap_writew(0, OTG_IRQ_EN); | 1322 | omap_writew(0, OTG_IRQ_EN); |
1297 | power_down(isp); | 1323 | power_down(isp); |
1298 | isp->otg.host = 0; | 1324 | isp->otg.host = NULL; |
1299 | return 0; | 1325 | return 0; |
1300 | } | 1326 | } |
1301 | 1327 | ||
@@ -1344,7 +1370,9 @@ static int | |||
1344 | isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | 1370 | isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) |
1345 | { | 1371 | { |
1346 | struct isp1301 *isp = container_of(otg, struct isp1301, otg); | 1372 | struct isp1301 *isp = container_of(otg, struct isp1301, otg); |
1373 | #ifndef CONFIG_USB_OTG | ||
1347 | u32 l; | 1374 | u32 l; |
1375 | #endif | ||
1348 | 1376 | ||
1349 | if (!otg || isp != the_transceiver) | 1377 | if (!otg || isp != the_transceiver) |
1350 | return -ENODEV; | 1378 | return -ENODEV; |
@@ -1354,7 +1382,7 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1354 | if (!isp->otg.default_a) | 1382 | if (!isp->otg.default_a) |
1355 | enable_vbus_draw(isp, 0); | 1383 | enable_vbus_draw(isp, 0); |
1356 | usb_gadget_vbus_disconnect(isp->otg.gadget); | 1384 | usb_gadget_vbus_disconnect(isp->otg.gadget); |
1357 | isp->otg.gadget = 0; | 1385 | isp->otg.gadget = NULL; |
1358 | power_down(isp); | 1386 | power_down(isp); |
1359 | return 0; | 1387 | return 0; |
1360 | } | 1388 | } |
@@ -1379,7 +1407,7 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1379 | power_up(isp); | 1407 | power_up(isp); |
1380 | isp->otg.state = OTG_STATE_B_IDLE; | 1408 | isp->otg.state = OTG_STATE_B_IDLE; |
1381 | 1409 | ||
1382 | if (machine_is_omap_h2()) | 1410 | if (machine_is_omap_h2() || machine_is_omap_h3()) |
1383 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); | 1411 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); |
1384 | 1412 | ||
1385 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, | 1413 | isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING, |
@@ -1499,7 +1527,8 @@ isp1301_start_hnp(struct otg_transceiver *dev) | |||
1499 | 1527 | ||
1500 | /*-------------------------------------------------------------------------*/ | 1528 | /*-------------------------------------------------------------------------*/ |
1501 | 1529 | ||
1502 | static int __init isp1301_probe(struct i2c_client *i2c) | 1530 | static int __init |
1531 | isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | ||
1503 | { | 1532 | { |
1504 | int status; | 1533 | int status; |
1505 | struct isp1301 *isp; | 1534 | struct isp1301 *isp; |
@@ -1647,7 +1676,7 @@ module_init(isp_init); | |||
1647 | static void __exit isp_exit(void) | 1676 | static void __exit isp_exit(void) |
1648 | { | 1677 | { |
1649 | if (the_transceiver) | 1678 | if (the_transceiver) |
1650 | otg_set_transceiver(0); | 1679 | otg_set_transceiver(NULL); |
1651 | i2c_del_driver(&isp1301_driver); | 1680 | i2c_del_driver(&isp1301_driver); |
1652 | } | 1681 | } |
1653 | module_exit(isp_exit); | 1682 | module_exit(isp_exit); |