aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tps65090.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2013-01-29 04:05:15 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-13 18:22:55 -0500
commit40719314f259ab9409ca3d48551c17aa23bc2b4d (patch)
tree21d2202158e90aa4c3f798c1527a229290e6a444 /drivers/mfd/tps65090.c
parent5f384c1f8be19487f904731d7232120dcfeca8e1 (diff)
mfd: tps65090: add DT support for tps65090
Add device tree support for the TI PMIC TPS65090. The device can be registered through platform or DT. Add device tree binding document for this device. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/tps65090.c')
-rw-r--r--drivers/mfd/tps65090.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index 8d12a8e00d9c..b49654587ce5 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -25,6 +25,8 @@
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/mfd/core.h> 26#include <linux/mfd/core.h>
27#include <linux/mfd/tps65090.h> 27#include <linux/mfd/tps65090.h>
28#include <linux/of.h>
29#include <linux/of_device.h>
28#include <linux/err.h> 30#include <linux/err.h>
29 31
30#define NUM_INT_REG 2 32#define NUM_INT_REG 2
@@ -148,18 +150,31 @@ static const struct regmap_config tps65090_regmap_config = {
148 .volatile_reg = is_volatile_reg, 150 .volatile_reg = is_volatile_reg,
149}; 151};
150 152
153#ifdef CONFIG_OF
154static const struct of_device_id tps65090_of_match[] = {
155 { .compatible = "ti,tps65090",},
156 {},
157};
158MODULE_DEVICE_TABLE(of, tps65090_of_match);
159#endif
160
151static int tps65090_i2c_probe(struct i2c_client *client, 161static int tps65090_i2c_probe(struct i2c_client *client,
152 const struct i2c_device_id *id) 162 const struct i2c_device_id *id)
153{ 163{
154 struct tps65090_platform_data *pdata = client->dev.platform_data; 164 struct tps65090_platform_data *pdata = client->dev.platform_data;
165 int irq_base = 0;
155 struct tps65090 *tps65090; 166 struct tps65090 *tps65090;
156 int ret; 167 int ret;
157 168
158 if (!pdata) { 169 if (!pdata && !client->dev.of_node) {
159 dev_err(&client->dev, "tps65090 requires platform data\n"); 170 dev_err(&client->dev,
171 "tps65090 requires platform data or of_node\n");
160 return -EINVAL; 172 return -EINVAL;
161 } 173 }
162 174
175 if (pdata)
176 irq_base = pdata->irq_base;
177
163 tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL); 178 tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL);
164 if (!tps65090) { 179 if (!tps65090) {
165 dev_err(&client->dev, "mem alloc for tps65090 failed\n"); 180 dev_err(&client->dev, "mem alloc for tps65090 failed\n");
@@ -178,7 +193,7 @@ static int tps65090_i2c_probe(struct i2c_client *client,
178 193
179 if (client->irq) { 194 if (client->irq) {
180 ret = regmap_add_irq_chip(tps65090->rmap, client->irq, 195 ret = regmap_add_irq_chip(tps65090->rmap, client->irq,
181 IRQF_ONESHOT | IRQF_TRIGGER_LOW, pdata->irq_base, 196 IRQF_ONESHOT | IRQF_TRIGGER_LOW, irq_base,
182 &tps65090_irq_chip, &tps65090->irq_data); 197 &tps65090_irq_chip, &tps65090->irq_data);
183 if (ret) { 198 if (ret) {
184 dev_err(&client->dev, 199 dev_err(&client->dev,
@@ -247,6 +262,7 @@ static struct i2c_driver tps65090_driver = {
247 .driver = { 262 .driver = {
248 .name = "tps65090", 263 .name = "tps65090",
249 .owner = THIS_MODULE, 264 .owner = THIS_MODULE,
265 .of_match_table = of_match_ptr(tps65090_of_match),
250 .pm = &tps65090_pm_ops, 266 .pm = &tps65090_pm_ops,
251 }, 267 },
252 .probe = tps65090_i2c_probe, 268 .probe = tps65090_i2c_probe,