diff options
Diffstat (limited to 'drivers/mfd/axp20x.c')
-rw-r--r-- | drivers/mfd/axp20x.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index da1e8ce35a..666b9ea98c 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -23,7 +23,7 @@ #include <module.h> #include <of.h> #include <of_device.h> -#include <regmap.h> +#include <linux/regmap.h> #include <regulator.h> #define AXP20X_OFF BIT(7) @@ -38,6 +38,7 @@ static const char * const axp20x_model_names[] = { "AXP221", "AXP223", "AXP288", + "AXP313A", "AXP803", "AXP806", "AXP809", @@ -68,6 +69,12 @@ static const struct regmap_config axp288_regmap_config = { .max_register = AXP288_FG_TUNE5, }; +static const struct regmap_config axp313a_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = AXP313A_POK_CONTROL, +}; + static const struct regmap_config axp806_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -141,6 +148,9 @@ static const struct mfd_cell axp152_cells[] = { { .name = "axp20x-pek", }, + { + .name = "axp20x-regulator", + }, }; static const struct mfd_cell axp288_cells[] = { @@ -157,6 +167,13 @@ static const struct mfd_cell axp288_cells[] = { }, }; +static const struct mfd_cell axp313a_cells[] = { + { + .name = "axp313a-regulator" + }, +}; + + static const struct mfd_cell axp803_cells[] = { { .name = "axp221-pek", @@ -231,7 +248,7 @@ static void axp20x_power_off(struct poweroff_handler *handler) int axp20x_match_device(struct axp20x_dev *axp20x) { - struct device_d *dev = axp20x->dev; + struct device *dev = axp20x->dev; const struct of_device_id *of_id; of_id = of_match_device(dev->driver->of_compatible, dev); @@ -268,6 +285,11 @@ int axp20x_match_device(struct axp20x_dev *axp20x) axp20x->nr_cells = ARRAY_SIZE(axp288_cells); axp20x->regmap_cfg = &axp288_regmap_config; break; + case AXP313A_ID: + axp20x->cells = axp313a_cells; + axp20x->nr_cells = ARRAY_SIZE(axp313a_cells); + axp20x->regmap_cfg = &axp313a_regmap_config; + break; case AXP803_ID: axp20x->nr_cells = ARRAY_SIZE(axp803_cells); axp20x->cells = axp803_cells; @@ -326,9 +348,9 @@ int axp20x_device_probe(struct axp20x_dev *axp20x) * property "x-powers,master-mode" to override the default. */ if (axp20x->variant == AXP806_ID) { - if (of_property_read_bool(axp20x->dev->device_node, + if (of_property_read_bool(axp20x->dev->of_node, "x-powers,master-mode") || - of_property_read_bool(axp20x->dev->device_node, + of_property_read_bool(axp20x->dev->of_node, "x-powers,self-working-mode")) regmap_write(axp20x->regmap, AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT_ADDR_MASTER_MODE); @@ -337,6 +359,8 @@ int axp20x_device_probe(struct axp20x_dev *axp20x) AXP806_REG_ADDR_EXT_ADDR_SLAVE_MODE); } + axp20x->dev->priv = axp20x; + ret = mfd_add_devices(axp20x->dev, axp20x->cells, axp20x->nr_cells); if (ret) return dev_err_probe(axp20x->dev, ret, "failed to add MFD devices\n"); @@ -346,11 +370,9 @@ int axp20x_device_probe(struct axp20x_dev *axp20x) axp20x->poweroff.poweroff = axp20x_power_off; axp20x->poweroff.priority = 200; - if (axp20x->variant != AXP288_ID) + if (!(axp20x->variant == AXP288_ID) || (axp20x->variant == AXP313A_ID)) poweroff_handler_register(&axp20x->poweroff); - dev_info(axp20x->dev, "AXP20X driver loaded\n"); - return 0; } EXPORT_SYMBOL(axp20x_device_probe); |