2 * NXP ISP1301 USB transceiver driver
4 * Copyright (C) 2012 Roland Stigge
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 static const struct i2c_device_id isp1301_id[] = {
23 static struct i2c_client *isp1301_i2c_client;
25 static int isp1301_probe(struct i2c_client *client,
26 const struct i2c_device_id *i2c_id)
28 isp1301_i2c_client = client;
32 static int isp1301_remove(struct i2c_client *client)
37 static struct i2c_driver isp1301_driver = {
41 .probe = isp1301_probe,
42 .remove = isp1301_remove,
43 .id_table = isp1301_id,
46 module_i2c_driver(isp1301_driver);
48 static int match(struct device *dev, void *data)
50 struct device_node *node = (struct device_node *)data;
51 return (dev->of_node == node) &&
52 (dev->driver == &isp1301_driver.driver);
55 struct i2c_client *isp1301_get_client(struct device_node *node)
57 if (node) { /* reference of ISP1301 I2C node via DT */
58 struct device *dev = bus_find_device(&i2c_bus_type, NULL,
62 return to_i2c_client(dev);
63 } else { /* non-DT: only one ISP1301 chip supported */
64 return isp1301_i2c_client;
67 EXPORT_SYMBOL_GPL(isp1301_get_client);
70 MODULE_DESCRIPTION("NXP ISP1301 USB transceiver driver");
71 MODULE_LICENSE("GPL");