Skip to content

Commit 165663a

Browse files
committed
power: supply: generic-adc-battery: add DT support
This adds full DT support to the driver. Because of the previous changes just adding a compatible value is enough. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
1 parent 33088c0 commit 165663a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/power/supply/generic-adc-battery.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/slab.h>
2323
#include <linux/iio/consumer.h>
2424
#include <linux/iio/types.h>
25+
#include <linux/of.h>
2526
#include <linux/devm-helpers.h>
2627

2728
#define JITTER_DEFAULT 10 /* hope 10ms is enough */
@@ -175,6 +176,7 @@ static int gab_probe(struct platform_device *pdev)
175176
if (!adc_bat)
176177
return -ENOMEM;
177178

179+
psy_cfg.of_node = pdev->dev.of_node;
178180
psy_cfg.drv_data = adc_bat;
179181
psy_desc = &adc_bat->psy_desc;
180182
psy_desc->name = dev_name(&pdev->dev);
@@ -288,10 +290,17 @@ static int __maybe_unused gab_resume(struct device *dev)
288290

289291
static SIMPLE_DEV_PM_OPS(gab_pm_ops, gab_suspend, gab_resume);
290292

293+
static const struct of_device_id gab_match[] = {
294+
{ .compatible = "adc-battery" },
295+
{ }
296+
};
297+
MODULE_DEVICE_TABLE(of, gab_match);
298+
291299
static struct platform_driver gab_driver = {
292300
.driver = {
293301
.name = "generic-adc-battery",
294302
.pm = &gab_pm_ops,
303+
.of_match_table = gab_match,
295304
},
296305
.probe = gab_probe,
297306
};

0 commit comments

Comments
 (0)