Commit 511cb174 authored by Keerthy's avatar Keerthy Committed by Lee Jones

mfd: tps65217: Introduce dependency on CONFIG_OF

Currently the driver boots only via device tree hence add a
dependency on CONFIG_OF. This leaves with a bunch of unused code
so clean that up. This patch also makes use of probe_new function
in place of the probe function so as to avoid passing i2c_device_id.
Signed-off-by: default avatarKeerthy <j-keerthy@ti.com>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent cfc95173
...@@ -1338,7 +1338,7 @@ config MFD_TPS65090 ...@@ -1338,7 +1338,7 @@ config MFD_TPS65090
config MFD_TPS65217 config MFD_TPS65217
tristate "TI TPS65217 Power Management / White LED chips" tristate "TI TPS65217 Power Management / White LED chips"
depends on I2C depends on I2C && OF
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
select IRQ_DOMAIN select IRQ_DOMAIN
......
...@@ -311,37 +311,20 @@ static const struct regmap_config tps65217_regmap_config = { ...@@ -311,37 +311,20 @@ static const struct regmap_config tps65217_regmap_config = {
}; };
static const struct of_device_id tps65217_of_match[] = { static const struct of_device_id tps65217_of_match[] = {
{ .compatible = "ti,tps65217", .data = (void *)TPS65217 }, { .compatible = "ti,tps65217"},
{ /* sentinel */ }, { /* sentinel */ },
}; };
MODULE_DEVICE_TABLE(of, tps65217_of_match); MODULE_DEVICE_TABLE(of, tps65217_of_match);
static int tps65217_probe(struct i2c_client *client, static int tps65217_probe(struct i2c_client *client)
const struct i2c_device_id *ids)
{ {
struct tps65217 *tps; struct tps65217 *tps;
unsigned int version; unsigned int version;
unsigned long chip_id = ids->driver_data;
const struct of_device_id *match;
bool status_off = false; bool status_off = false;
int ret; int ret;
if (client->dev.of_node) { status_off = of_property_read_bool(client->dev.of_node,
match = of_match_device(tps65217_of_match, &client->dev); "ti,pmic-shutdown-controller");
if (!match) {
dev_err(&client->dev,
"Failed to find matching dt id\n");
return -EINVAL;
}
chip_id = (unsigned long)match->data;
status_off = of_property_read_bool(client->dev.of_node,
"ti,pmic-shutdown-controller");
}
if (!chip_id) {
dev_err(&client->dev, "id is null.\n");
return -ENODEV;
}
tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
if (!tps) if (!tps)
...@@ -349,7 +332,6 @@ static int tps65217_probe(struct i2c_client *client, ...@@ -349,7 +332,6 @@ static int tps65217_probe(struct i2c_client *client,
i2c_set_clientdata(client, tps); i2c_set_clientdata(client, tps);
tps->dev = &client->dev; tps->dev = &client->dev;
tps->id = chip_id;
tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config); tps->regmap = devm_regmap_init_i2c(client, &tps65217_regmap_config);
if (IS_ERR(tps->regmap)) { if (IS_ERR(tps->regmap)) {
...@@ -430,7 +412,7 @@ static struct i2c_driver tps65217_driver = { ...@@ -430,7 +412,7 @@ static struct i2c_driver tps65217_driver = {
.of_match_table = tps65217_of_match, .of_match_table = tps65217_of_match,
}, },
.id_table = tps65217_id_table, .id_table = tps65217_id_table,
.probe = tps65217_probe, .probe_new = tps65217_probe,
.remove = tps65217_remove, .remove = tps65217_remove,
}; };
......
...@@ -228,11 +228,6 @@ static int tps65217_regulator_probe(struct platform_device *pdev) ...@@ -228,11 +228,6 @@ static int tps65217_regulator_probe(struct platform_device *pdev)
int i, ret; int i, ret;
unsigned int val; unsigned int val;
if (tps65217_chip_id(tps) != TPS65217) {
dev_err(&pdev->dev, "Invalid tps chip version\n");
return -ENODEV;
}
/* Allocate memory for strobes */ /* Allocate memory for strobes */
tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) * tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) *
TPS65217_NUM_REGULATOR, GFP_KERNEL); TPS65217_NUM_REGULATOR, GFP_KERNEL);
......
...@@ -275,17 +275,9 @@ static int tps65217_bl_probe(struct platform_device *pdev) ...@@ -275,17 +275,9 @@ static int tps65217_bl_probe(struct platform_device *pdev)
struct tps65217_bl_pdata *pdata; struct tps65217_bl_pdata *pdata;
struct backlight_properties bl_props; struct backlight_properties bl_props;
if (tps->dev->of_node) { pdata = tps65217_bl_parse_dt(pdev);
pdata = tps65217_bl_parse_dt(pdev); if (IS_ERR(pdata))
if (IS_ERR(pdata)) return PTR_ERR(pdata);
return PTR_ERR(pdata);
} else {
pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "no platform data provided\n");
return -EINVAL;
}
}
tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl), tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl),
GFP_KERNEL); GFP_KERNEL);
......
...@@ -263,7 +263,6 @@ struct tps65217_board { ...@@ -263,7 +263,6 @@ struct tps65217_board {
struct tps65217 { struct tps65217 {
struct device *dev; struct device *dev;
struct tps65217_board *pdata; struct tps65217_board *pdata;
unsigned long id;
struct regulator_desc desc[TPS65217_NUM_REGULATOR]; struct regulator_desc desc[TPS65217_NUM_REGULATOR];
struct regmap *regmap; struct regmap *regmap;
u8 *strobes; u8 *strobes;
...@@ -278,11 +277,6 @@ static inline struct tps65217 *dev_to_tps65217(struct device *dev) ...@@ -278,11 +277,6 @@ static inline struct tps65217 *dev_to_tps65217(struct device *dev)
return dev_get_drvdata(dev); return dev_get_drvdata(dev);
} }
static inline unsigned long tps65217_chip_id(struct tps65217 *tps65217)
{
return tps65217->id;
}
int tps65217_reg_read(struct tps65217 *tps, unsigned int reg, int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,
unsigned int *val); unsigned int *val);
int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, int tps65217_reg_write(struct tps65217 *tps, unsigned int reg,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment