2 * NXP ISP1301 USB transceiver driver
4 * Copyright (C) 2012 Roland Stigge
6 * Author: Roland Stigge <stigge@antcom.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/module.h>
14 #include <linux/i2c.h>
16 #define DRV_NAME "isp1301"
18 #define ISP1301_I2C_ADDR 0x2C
20 static const unsigned short normal_i2c
[] = {
21 ISP1301_I2C_ADDR
, ISP1301_I2C_ADDR
+ 1, I2C_CLIENT_END
24 static const struct i2c_device_id isp1301_id
[] = {
29 static struct i2c_client
*isp1301_i2c_client
;
31 static int isp1301_probe(struct i2c_client
*client
,
32 const struct i2c_device_id
*i2c_id
)
34 isp1301_i2c_client
= client
;
38 static int isp1301_remove(struct i2c_client
*client
)
43 static struct i2c_driver isp1301_driver
= {
47 .probe
= isp1301_probe
,
48 .remove
= isp1301_remove
,
49 .id_table
= isp1301_id
,
52 module_i2c_driver(isp1301_driver
);
54 static int match(struct device
*dev
, void *data
)
56 struct device_node
*node
= (struct device_node
*)data
;
57 return (dev
->of_node
== node
) &&
58 (dev
->driver
== &isp1301_driver
.driver
);
61 struct i2c_client
*isp1301_get_client(struct device_node
*node
)
63 if (node
) { /* reference of ISP1301 I2C node via DT */
64 struct device
*dev
= bus_find_device(&i2c_bus_type
, NULL
,
68 return to_i2c_client(dev
);
69 } else { /* non-DT: only one ISP1301 chip supported */
70 return isp1301_i2c_client
;
73 EXPORT_SYMBOL_GPL(isp1301_get_client
);
75 MODULE_AUTHOR("Roland Stigge <stigge@antcom.de>");
76 MODULE_DESCRIPTION("NXP ISP1301 USB transceiver driver");
77 MODULE_LICENSE("GPL");