aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorWei Chen <Wei.Chen@csr.com>2015-01-14 19:16:10 -0500
committerLinus Walleij <linus.walleij@linaro.org>2015-01-19 05:20:48 -0500
commit04d2264c3bf07f5c3d18165ba78de0a93360c6c0 (patch)
tree04013becb97f5762dcabfa573b23846ea1d805f4 /drivers/gpio
parent73c4ceda09db2c9a2ff8bb2e90cc98ce1a827c34 (diff)
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')
-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 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/i2c/sx150x.h> 25#include <linux/i2c/sx150x.h>
26#include <linux/of.h>
27#include <linux/of_address.h>
28#include <linux/of_irq.h>
29#include <linux/of_gpio.h>
30#include <linux/of_device.h>
26 31
27#define NO_UPDATE_PENDING -1 32#define NO_UPDATE_PENDING -1
28 33
@@ -147,6 +152,13 @@ static const struct i2c_device_id sx150x_id[] = {
147}; 152};
148MODULE_DEVICE_TABLE(i2c, sx150x_id); 153MODULE_DEVICE_TABLE(i2c, sx150x_id);
149 154
155static const struct of_device_id sx150x_dt_id[] = {
156 { .compatible = "semtech,sx1508q" },
157 { .compatible = "semtech,sx1509q" },
158 { .compatible = "semtech,sx1506q" },
159 {},
160};
161
150static s32 sx150x_i2c_write(struct i2c_client *client, u8 reg, u8 val) 162static s32 sx150x_i2c_write(struct i2c_client *client, u8 reg, u8 val)
151{ 163{
152 s32 err = i2c_smbus_write_byte_data(client, reg, val); 164 s32 err = i2c_smbus_write_byte_data(client, reg, val);
@@ -472,6 +484,8 @@ static void sx150x_init_chip(struct sx150x_chip *chip,
472 chip->gpio_chip.base = pdata->gpio_base; 484 chip->gpio_chip.base = pdata->gpio_base;
473 chip->gpio_chip.can_sleep = true; 485 chip->gpio_chip.can_sleep = true;
474 chip->gpio_chip.ngpio = chip->dev_cfg->ngpios; 486 chip->gpio_chip.ngpio = chip->dev_cfg->ngpios;
487 chip->gpio_chip.of_node = client->dev.of_node;
488 chip->gpio_chip.of_gpio_n_cells = 2;
475 if (pdata->oscio_is_gpo) 489 if (pdata->oscio_is_gpo)
476 ++chip->gpio_chip.ngpio; 490 ++chip->gpio_chip.ngpio;
477 491
@@ -666,7 +680,8 @@ static int sx150x_remove(struct i2c_client *client)
666static struct i2c_driver sx150x_driver = { 680static struct i2c_driver sx150x_driver = {
667 .driver = { 681 .driver = {
668 .name = "sx150x", 682 .name = "sx150x",
669 .owner = THIS_MODULE 683 .owner = THIS_MODULE,
684 .of_match_table = of_match_ptr(sx150x_dt_id),
670 }, 685 },
671 .probe = sx150x_probe, 686 .probe = sx150x_probe,
672 .remove = sx150x_remove, 687 .remove = sx150x_remove,