summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-sx150x.c
diff options
context:
space:
mode:
authorWei Chen <Wei.Chen@csr.com>2015-01-15 01:16:10 +0100
committerLinus Walleij <linus.walleij@linaro.org>2015-01-19 11:20:48 +0100
commit04d2264c3bf07f5c3d18165ba78de0a93360c6c0 (patch)
tree04013becb97f5762dcabfa573b23846ea1d805f4 /drivers/gpio/gpio-sx150x.c
parentgpio-generic: add bgpio_set_multiple functions (diff)
downloadlinux-04d2264c3bf07f5c3d18165ba78de0a93360c6c0.tar.xz
linux-04d2264c3bf07f5c3d18165ba78de0a93360c6c0.zip
gpio: sx150x: add dts support for sx150x driver
Current sx150x gpio expander driver doesn't support DTS. Now we added dts support for this driver. Signed-off-by: Wei Chen <Wei.Chen@csr.com> Signed-off-by: Barry Song <Baohua.Song@csr.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-sx150x.c')
-rw-r--r--drivers/gpio/gpio-sx150x.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index 20573ac714fc..88012e2b5b15 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -23,6 +23,11 @@
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/i2c/sx150x.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_gpio.h>
+#include <linux/of_device.h>
#define NO_UPDATE_PENDING -1
@@ -147,6 +152,13 @@ static const struct i2c_device_id sx150x_id[] = {
};
MODULE_DEVICE_TABLE(i2c, sx150x_id);
+static const struct of_device_id sx150x_dt_id[] = {
+ { .compatible = "semtech,sx1508q" },
+ { .compatible = "semtech,sx1509q" },
+ { .compatible = "semtech,sx1506q" },
+ {},
+};
+
static s32 sx150x_i2c_write(struct i2c_client *client, u8 reg, u8 val)
{
s32 err = i2c_smbus_write_byte_data(client, reg, val);
@@ -472,6 +484,8 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
chip->gpio_chip.base = pdata->gpio_base;
chip->gpio_chip.can_sleep = true;
chip->gpio_chip.ngpio = chip->dev_cfg->ngpios;
+ chip->gpio_chip.of_node = client->dev.of_node;
+ chip->gpio_chip.of_gpio_n_cells = 2;
if (pdata->oscio_is_gpo)
++chip->gpio_chip.ngpio;
@@ -666,7 +680,8 @@ static int sx150x_remove(struct i2c_client *client)
static struct i2c_driver sx150x_driver = {
.driver = {
.name = "sx150x",
- .owner = THIS_MODULE
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(sx150x_dt_id),
},
.probe = sx150x_probe,
.remove = sx150x_remove,