19952f691SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
28c0984e5SSebastian Reichel /*
38c0984e5SSebastian Reichel  * Battery charger driver for TI's tps65090
48c0984e5SSebastian Reichel  *
58c0984e5SSebastian Reichel  * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
68c0984e5SSebastian Reichel 
78c0984e5SSebastian Reichel  */
88c0984e5SSebastian Reichel #include <linux/delay.h>
98c0984e5SSebastian Reichel #include <linux/err.h>
108c0984e5SSebastian Reichel #include <linux/freezer.h>
118c0984e5SSebastian Reichel #include <linux/init.h>
128c0984e5SSebastian Reichel #include <linux/interrupt.h>
138c0984e5SSebastian Reichel #include <linux/kernel.h>
148c0984e5SSebastian Reichel #include <linux/kthread.h>
158c0984e5SSebastian Reichel #include <linux/module.h>
16*2ce8284cSRob Herring #include <linux/of.h>
178c0984e5SSebastian Reichel #include <linux/platform_device.h>
188c0984e5SSebastian Reichel #include <linux/power_supply.h>
198c0984e5SSebastian Reichel #include <linux/slab.h>
208c0984e5SSebastian Reichel 
218c0984e5SSebastian Reichel #include <linux/mfd/tps65090.h>
228c0984e5SSebastian Reichel 
238c0984e5SSebastian Reichel #define TPS65090_CHARGER_ENABLE	BIT(0)
248c0984e5SSebastian Reichel #define TPS65090_VACG		BIT(1)
258c0984e5SSebastian Reichel #define TPS65090_NOITERM	BIT(5)
268c0984e5SSebastian Reichel 
278c0984e5SSebastian Reichel #define POLL_INTERVAL		(HZ * 2)	/* Used when no irq */
288c0984e5SSebastian Reichel 
298c0984e5SSebastian Reichel struct tps65090_charger {
308c0984e5SSebastian Reichel 	struct	device	*dev;
318c0984e5SSebastian Reichel 	int	ac_online;
328c0984e5SSebastian Reichel 	int	prev_ac_online;
338c0984e5SSebastian Reichel 	int	irq;
348c0984e5SSebastian Reichel 	struct task_struct	*poll_task;
358c0984e5SSebastian Reichel 	bool			passive_mode;
368c0984e5SSebastian Reichel 	struct power_supply	*ac;
378c0984e5SSebastian Reichel 	struct tps65090_platform_data *pdata;
388c0984e5SSebastian Reichel };
398c0984e5SSebastian Reichel 
408c0984e5SSebastian Reichel static enum power_supply_property tps65090_ac_props[] = {
418c0984e5SSebastian Reichel 	POWER_SUPPLY_PROP_ONLINE,
428c0984e5SSebastian Reichel };
438c0984e5SSebastian Reichel 
tps65090_low_chrg_current(struct tps65090_charger * charger)448c0984e5SSebastian Reichel static int tps65090_low_chrg_current(struct tps65090_charger *charger)
458c0984e5SSebastian Reichel {
468c0984e5SSebastian Reichel 	int ret;
478c0984e5SSebastian Reichel 
488c0984e5SSebastian Reichel 	if (charger->passive_mode)
498c0984e5SSebastian Reichel 		return 0;
508c0984e5SSebastian Reichel 
518c0984e5SSebastian Reichel 	ret = tps65090_write(charger->dev->parent, TPS65090_REG_CG_CTRL5,
528c0984e5SSebastian Reichel 			TPS65090_NOITERM);
538c0984e5SSebastian Reichel 	if (ret < 0) {
548c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): error reading in register 0x%x\n",
558c0984e5SSebastian Reichel 			__func__, TPS65090_REG_CG_CTRL5);
568c0984e5SSebastian Reichel 		return ret;
578c0984e5SSebastian Reichel 	}
588c0984e5SSebastian Reichel 	return 0;
598c0984e5SSebastian Reichel }
608c0984e5SSebastian Reichel 
tps65090_enable_charging(struct tps65090_charger * charger)618c0984e5SSebastian Reichel static int tps65090_enable_charging(struct tps65090_charger *charger)
628c0984e5SSebastian Reichel {
638c0984e5SSebastian Reichel 	int ret;
648c0984e5SSebastian Reichel 	uint8_t ctrl0 = 0;
658c0984e5SSebastian Reichel 
668c0984e5SSebastian Reichel 	if (charger->passive_mode)
678c0984e5SSebastian Reichel 		return 0;
688c0984e5SSebastian Reichel 
698c0984e5SSebastian Reichel 	ret = tps65090_read(charger->dev->parent, TPS65090_REG_CG_CTRL0,
708c0984e5SSebastian Reichel 			    &ctrl0);
718c0984e5SSebastian Reichel 	if (ret < 0) {
728c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): error reading in register 0x%x\n",
738c0984e5SSebastian Reichel 				__func__, TPS65090_REG_CG_CTRL0);
748c0984e5SSebastian Reichel 		return ret;
758c0984e5SSebastian Reichel 	}
768c0984e5SSebastian Reichel 
778c0984e5SSebastian Reichel 	ret = tps65090_write(charger->dev->parent, TPS65090_REG_CG_CTRL0,
788c0984e5SSebastian Reichel 				(ctrl0 | TPS65090_CHARGER_ENABLE));
798c0984e5SSebastian Reichel 	if (ret < 0) {
808c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): error writing in register 0x%x\n",
818c0984e5SSebastian Reichel 				__func__, TPS65090_REG_CG_CTRL0);
828c0984e5SSebastian Reichel 		return ret;
838c0984e5SSebastian Reichel 	}
848c0984e5SSebastian Reichel 	return 0;
858c0984e5SSebastian Reichel }
868c0984e5SSebastian Reichel 
tps65090_config_charger(struct tps65090_charger * charger)878c0984e5SSebastian Reichel static int tps65090_config_charger(struct tps65090_charger *charger)
888c0984e5SSebastian Reichel {
898c0984e5SSebastian Reichel 	uint8_t intrmask = 0;
908c0984e5SSebastian Reichel 	int ret;
918c0984e5SSebastian Reichel 
928c0984e5SSebastian Reichel 	if (charger->passive_mode)
938c0984e5SSebastian Reichel 		return 0;
948c0984e5SSebastian Reichel 
958c0984e5SSebastian Reichel 	if (charger->pdata->enable_low_current_chrg) {
968c0984e5SSebastian Reichel 		ret = tps65090_low_chrg_current(charger);
978c0984e5SSebastian Reichel 		if (ret < 0) {
988c0984e5SSebastian Reichel 			dev_err(charger->dev,
998c0984e5SSebastian Reichel 				"error configuring low charge current\n");
1008c0984e5SSebastian Reichel 			return ret;
1018c0984e5SSebastian Reichel 		}
1028c0984e5SSebastian Reichel 	}
1038c0984e5SSebastian Reichel 
1048c0984e5SSebastian Reichel 	/* Enable the VACG interrupt for AC power detect */
1058c0984e5SSebastian Reichel 	ret = tps65090_read(charger->dev->parent, TPS65090_REG_INTR_MASK,
1068c0984e5SSebastian Reichel 			    &intrmask);
1078c0984e5SSebastian Reichel 	if (ret < 0) {
1088c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): error reading in register 0x%x\n",
1098c0984e5SSebastian Reichel 			__func__, TPS65090_REG_INTR_MASK);
1108c0984e5SSebastian Reichel 		return ret;
1118c0984e5SSebastian Reichel 	}
1128c0984e5SSebastian Reichel 
1138c0984e5SSebastian Reichel 	ret = tps65090_write(charger->dev->parent, TPS65090_REG_INTR_MASK,
1148c0984e5SSebastian Reichel 			     (intrmask | TPS65090_VACG));
1158c0984e5SSebastian Reichel 	if (ret < 0) {
1168c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): error writing in register 0x%x\n",
1178c0984e5SSebastian Reichel 			__func__, TPS65090_REG_CG_CTRL0);
1188c0984e5SSebastian Reichel 		return ret;
1198c0984e5SSebastian Reichel 	}
1208c0984e5SSebastian Reichel 
1218c0984e5SSebastian Reichel 	return 0;
1228c0984e5SSebastian Reichel }
1238c0984e5SSebastian Reichel 
tps65090_ac_get_property(struct power_supply * psy,enum power_supply_property psp,union power_supply_propval * val)1248c0984e5SSebastian Reichel static int tps65090_ac_get_property(struct power_supply *psy,
1258c0984e5SSebastian Reichel 			enum power_supply_property psp,
1268c0984e5SSebastian Reichel 			union power_supply_propval *val)
1278c0984e5SSebastian Reichel {
1288c0984e5SSebastian Reichel 	struct tps65090_charger *charger = power_supply_get_drvdata(psy);
1298c0984e5SSebastian Reichel 
1308c0984e5SSebastian Reichel 	if (psp == POWER_SUPPLY_PROP_ONLINE) {
1318c0984e5SSebastian Reichel 		val->intval = charger->ac_online;
1328c0984e5SSebastian Reichel 		charger->prev_ac_online = charger->ac_online;
1338c0984e5SSebastian Reichel 		return 0;
1348c0984e5SSebastian Reichel 	}
1358c0984e5SSebastian Reichel 	return -EINVAL;
1368c0984e5SSebastian Reichel }
1378c0984e5SSebastian Reichel 
tps65090_charger_isr(int irq,void * dev_id)1388c0984e5SSebastian Reichel static irqreturn_t tps65090_charger_isr(int irq, void *dev_id)
1398c0984e5SSebastian Reichel {
1408c0984e5SSebastian Reichel 	struct tps65090_charger *charger = dev_id;
1418c0984e5SSebastian Reichel 	int ret;
1428c0984e5SSebastian Reichel 	uint8_t status1 = 0;
1438c0984e5SSebastian Reichel 	uint8_t intrsts = 0;
1448c0984e5SSebastian Reichel 
1458c0984e5SSebastian Reichel 	ret = tps65090_read(charger->dev->parent, TPS65090_REG_CG_STATUS1,
1468c0984e5SSebastian Reichel 			    &status1);
1478c0984e5SSebastian Reichel 	if (ret < 0) {
1488c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): Error in reading reg 0x%x\n",
1498c0984e5SSebastian Reichel 				__func__, TPS65090_REG_CG_STATUS1);
1508c0984e5SSebastian Reichel 		return IRQ_HANDLED;
1518c0984e5SSebastian Reichel 	}
1528c0984e5SSebastian Reichel 	msleep(75);
1538c0984e5SSebastian Reichel 	ret = tps65090_read(charger->dev->parent, TPS65090_REG_INTR_STS,
1548c0984e5SSebastian Reichel 			    &intrsts);
1558c0984e5SSebastian Reichel 	if (ret < 0) {
1568c0984e5SSebastian Reichel 		dev_err(charger->dev, "%s(): Error in reading reg 0x%x\n",
1578c0984e5SSebastian Reichel 				__func__, TPS65090_REG_INTR_STS);
1588c0984e5SSebastian Reichel 		return IRQ_HANDLED;
1598c0984e5SSebastian Reichel 	}
1608c0984e5SSebastian Reichel 
1618c0984e5SSebastian Reichel 	if (intrsts & TPS65090_VACG) {
1628c0984e5SSebastian Reichel 		ret = tps65090_enable_charging(charger);
1638c0984e5SSebastian Reichel 		if (ret < 0)
1648c0984e5SSebastian Reichel 			return IRQ_HANDLED;
1658c0984e5SSebastian Reichel 		charger->ac_online = 1;
1668c0984e5SSebastian Reichel 	} else {
1678c0984e5SSebastian Reichel 		charger->ac_online = 0;
1688c0984e5SSebastian Reichel 	}
1698c0984e5SSebastian Reichel 
1708c0984e5SSebastian Reichel 	/* Clear interrupts. */
1718c0984e5SSebastian Reichel 	if (!charger->passive_mode) {
1728c0984e5SSebastian Reichel 		ret = tps65090_write(charger->dev->parent,
1738c0984e5SSebastian Reichel 				     TPS65090_REG_INTR_STS, 0x00);
1748c0984e5SSebastian Reichel 		if (ret < 0) {
1758c0984e5SSebastian Reichel 			dev_err(charger->dev,
1768c0984e5SSebastian Reichel 				"%s(): Error in writing reg 0x%x\n",
1778c0984e5SSebastian Reichel 				__func__, TPS65090_REG_INTR_STS);
1788c0984e5SSebastian Reichel 		}
1798c0984e5SSebastian Reichel 	}
1808c0984e5SSebastian Reichel 
1818c0984e5SSebastian Reichel 	if (charger->prev_ac_online != charger->ac_online)
1828c0984e5SSebastian Reichel 		power_supply_changed(charger->ac);
1838c0984e5SSebastian Reichel 
1848c0984e5SSebastian Reichel 	return IRQ_HANDLED;
1858c0984e5SSebastian Reichel }
1868c0984e5SSebastian Reichel 
1878c0984e5SSebastian Reichel static struct tps65090_platform_data *
tps65090_parse_dt_charger_data(struct platform_device * pdev)1888c0984e5SSebastian Reichel 		tps65090_parse_dt_charger_data(struct platform_device *pdev)
1898c0984e5SSebastian Reichel {
1908c0984e5SSebastian Reichel 	struct tps65090_platform_data *pdata;
1918c0984e5SSebastian Reichel 	struct device_node *np = pdev->dev.of_node;
1928c0984e5SSebastian Reichel 	unsigned int prop;
1938c0984e5SSebastian Reichel 
1948c0984e5SSebastian Reichel 	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
1958c0984e5SSebastian Reichel 	if (!pdata) {
1968c0984e5SSebastian Reichel 		dev_err(&pdev->dev, "Memory alloc for tps65090_pdata failed\n");
1978c0984e5SSebastian Reichel 		return NULL;
1988c0984e5SSebastian Reichel 	}
1998c0984e5SSebastian Reichel 
2008c0984e5SSebastian Reichel 	prop = of_property_read_bool(np, "ti,enable-low-current-chrg");
2018c0984e5SSebastian Reichel 	pdata->enable_low_current_chrg = prop;
2028c0984e5SSebastian Reichel 
2038c0984e5SSebastian Reichel 	pdata->irq_base = -1;
2048c0984e5SSebastian Reichel 
2058c0984e5SSebastian Reichel 	return pdata;
2068c0984e5SSebastian Reichel 
2078c0984e5SSebastian Reichel }
2088c0984e5SSebastian Reichel 
tps65090_charger_poll_task(void * data)2098c0984e5SSebastian Reichel static int tps65090_charger_poll_task(void *data)
2108c0984e5SSebastian Reichel {
2118c0984e5SSebastian Reichel 	set_freezable();
2128c0984e5SSebastian Reichel 
2138c0984e5SSebastian Reichel 	while (!kthread_should_stop()) {
2148c0984e5SSebastian Reichel 		schedule_timeout_interruptible(POLL_INTERVAL);
2158c0984e5SSebastian Reichel 		try_to_freeze();
2168c0984e5SSebastian Reichel 		tps65090_charger_isr(-1, data);
2178c0984e5SSebastian Reichel 	}
2188c0984e5SSebastian Reichel 	return 0;
2198c0984e5SSebastian Reichel }
2208c0984e5SSebastian Reichel 
2218c0984e5SSebastian Reichel static const struct power_supply_desc tps65090_charger_desc = {
2228c0984e5SSebastian Reichel 	.name			= "tps65090-ac",
2238c0984e5SSebastian Reichel 	.type			= POWER_SUPPLY_TYPE_MAINS,
2248c0984e5SSebastian Reichel 	.get_property		= tps65090_ac_get_property,
2258c0984e5SSebastian Reichel 	.properties		= tps65090_ac_props,
2268c0984e5SSebastian Reichel 	.num_properties		= ARRAY_SIZE(tps65090_ac_props),
2278c0984e5SSebastian Reichel };
2288c0984e5SSebastian Reichel 
tps65090_charger_probe(struct platform_device * pdev)2298c0984e5SSebastian Reichel static int tps65090_charger_probe(struct platform_device *pdev)
2308c0984e5SSebastian Reichel {
2318c0984e5SSebastian Reichel 	struct tps65090_charger *cdata;
2328c0984e5SSebastian Reichel 	struct tps65090_platform_data *pdata;
2338c0984e5SSebastian Reichel 	struct power_supply_config psy_cfg = {};
2348c0984e5SSebastian Reichel 	uint8_t status1 = 0;
2358c0984e5SSebastian Reichel 	int ret;
2368c0984e5SSebastian Reichel 	int irq;
2378c0984e5SSebastian Reichel 
2388c0984e5SSebastian Reichel 	pdata = dev_get_platdata(pdev->dev.parent);
2398c0984e5SSebastian Reichel 
2408c0984e5SSebastian Reichel 	if (IS_ENABLED(CONFIG_OF) && !pdata && pdev->dev.of_node)
2418c0984e5SSebastian Reichel 		pdata = tps65090_parse_dt_charger_data(pdev);
2428c0984e5SSebastian Reichel 
2438c0984e5SSebastian Reichel 	if (!pdata) {
2448c0984e5SSebastian Reichel 		dev_err(&pdev->dev, "%s():no platform data available\n",
2458c0984e5SSebastian Reichel 				__func__);
2468c0984e5SSebastian Reichel 		return -ENODEV;
2478c0984e5SSebastian Reichel 	}
2488c0984e5SSebastian Reichel 
2498c0984e5SSebastian Reichel 	cdata = devm_kzalloc(&pdev->dev, sizeof(*cdata), GFP_KERNEL);
2508c0984e5SSebastian Reichel 	if (!cdata) {
2518c0984e5SSebastian Reichel 		dev_err(&pdev->dev, "failed to allocate memory status\n");
2528c0984e5SSebastian Reichel 		return -ENOMEM;
2538c0984e5SSebastian Reichel 	}
2548c0984e5SSebastian Reichel 
2558c0984e5SSebastian Reichel 	platform_set_drvdata(pdev, cdata);
2568c0984e5SSebastian Reichel 
2578c0984e5SSebastian Reichel 	cdata->dev			= &pdev->dev;
2588c0984e5SSebastian Reichel 	cdata->pdata			= pdata;
2598c0984e5SSebastian Reichel 
2608c0984e5SSebastian Reichel 	psy_cfg.supplied_to		= pdata->supplied_to;
2618c0984e5SSebastian Reichel 	psy_cfg.num_supplicants		= pdata->num_supplicants;
2628c0984e5SSebastian Reichel 	psy_cfg.of_node			= pdev->dev.of_node;
2638c0984e5SSebastian Reichel 	psy_cfg.drv_data		= cdata;
2648c0984e5SSebastian Reichel 
2658c0984e5SSebastian Reichel 	cdata->ac = power_supply_register(&pdev->dev, &tps65090_charger_desc,
2668c0984e5SSebastian Reichel 			&psy_cfg);
2678c0984e5SSebastian Reichel 	if (IS_ERR(cdata->ac)) {
2688c0984e5SSebastian Reichel 		dev_err(&pdev->dev, "failed: power supply register\n");
2698c0984e5SSebastian Reichel 		return PTR_ERR(cdata->ac);
2708c0984e5SSebastian Reichel 	}
2718c0984e5SSebastian Reichel 
2728c0984e5SSebastian Reichel 	irq = platform_get_irq(pdev, 0);
2738c0984e5SSebastian Reichel 	if (irq < 0)
2748c0984e5SSebastian Reichel 		irq = -ENXIO;
2758c0984e5SSebastian Reichel 	cdata->irq = irq;
2768c0984e5SSebastian Reichel 
2778c0984e5SSebastian Reichel 	ret = tps65090_config_charger(cdata);
2788c0984e5SSebastian Reichel 	if (ret < 0) {
2798c0984e5SSebastian Reichel 		dev_err(&pdev->dev, "charger config failed, err %d\n", ret);
2808c0984e5SSebastian Reichel 		goto fail_unregister_supply;
2818c0984e5SSebastian Reichel 	}
2828c0984e5SSebastian Reichel 
2838c0984e5SSebastian Reichel 	/* Check for charger presence */
2848c0984e5SSebastian Reichel 	ret = tps65090_read(cdata->dev->parent, TPS65090_REG_CG_STATUS1,
2858c0984e5SSebastian Reichel 			&status1);
2868c0984e5SSebastian Reichel 	if (ret < 0) {
2878c0984e5SSebastian Reichel 		dev_err(cdata->dev, "%s(): Error in reading reg 0x%x", __func__,
2888c0984e5SSebastian Reichel 			TPS65090_REG_CG_STATUS1);
2898c0984e5SSebastian Reichel 		goto fail_unregister_supply;
2908c0984e5SSebastian Reichel 	}
2918c0984e5SSebastian Reichel 
2928c0984e5SSebastian Reichel 	if (status1 != 0) {
2938c0984e5SSebastian Reichel 		ret = tps65090_enable_charging(cdata);
2948c0984e5SSebastian Reichel 		if (ret < 0) {
2958c0984e5SSebastian Reichel 			dev_err(cdata->dev, "error enabling charger\n");
2968c0984e5SSebastian Reichel 			goto fail_unregister_supply;
2978c0984e5SSebastian Reichel 		}
2988c0984e5SSebastian Reichel 		cdata->ac_online = 1;
2998c0984e5SSebastian Reichel 		power_supply_changed(cdata->ac);
3008c0984e5SSebastian Reichel 	}
3018c0984e5SSebastian Reichel 
3028c0984e5SSebastian Reichel 	if (irq != -ENXIO) {
3038c0984e5SSebastian Reichel 		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
3042469b836Sdongjian 			tps65090_charger_isr, IRQF_ONESHOT, "tps65090-charger", cdata);
3058c0984e5SSebastian Reichel 		if (ret) {
3068c0984e5SSebastian Reichel 			dev_err(cdata->dev,
3078c0984e5SSebastian Reichel 				"Unable to register irq %d err %d\n", irq,
3088c0984e5SSebastian Reichel 				ret);
3098c0984e5SSebastian Reichel 			goto fail_unregister_supply;
3108c0984e5SSebastian Reichel 		}
3118c0984e5SSebastian Reichel 	} else {
3128c0984e5SSebastian Reichel 		cdata->poll_task = kthread_run(tps65090_charger_poll_task,
3138c0984e5SSebastian Reichel 					      cdata, "ktps65090charger");
3148c0984e5SSebastian Reichel 		cdata->passive_mode = true;
3158c0984e5SSebastian Reichel 		if (IS_ERR(cdata->poll_task)) {
3168c0984e5SSebastian Reichel 			ret = PTR_ERR(cdata->poll_task);
3178c0984e5SSebastian Reichel 			dev_err(cdata->dev,
3188c0984e5SSebastian Reichel 				"Unable to run kthread err %d\n", ret);
3198c0984e5SSebastian Reichel 			goto fail_unregister_supply;
3208c0984e5SSebastian Reichel 		}
3218c0984e5SSebastian Reichel 	}
3228c0984e5SSebastian Reichel 
3238c0984e5SSebastian Reichel 	return 0;
3248c0984e5SSebastian Reichel 
3258c0984e5SSebastian Reichel fail_unregister_supply:
3268c0984e5SSebastian Reichel 	power_supply_unregister(cdata->ac);
3278c0984e5SSebastian Reichel 
3288c0984e5SSebastian Reichel 	return ret;
3298c0984e5SSebastian Reichel }
3308c0984e5SSebastian Reichel 
tps65090_charger_remove(struct platform_device * pdev)3318c0984e5SSebastian Reichel static int tps65090_charger_remove(struct platform_device *pdev)
3328c0984e5SSebastian Reichel {
3338c0984e5SSebastian Reichel 	struct tps65090_charger *cdata = platform_get_drvdata(pdev);
3348c0984e5SSebastian Reichel 
3358c0984e5SSebastian Reichel 	if (cdata->irq == -ENXIO)
3368c0984e5SSebastian Reichel 		kthread_stop(cdata->poll_task);
3378c0984e5SSebastian Reichel 	power_supply_unregister(cdata->ac);
3388c0984e5SSebastian Reichel 
3398c0984e5SSebastian Reichel 	return 0;
3408c0984e5SSebastian Reichel }
3418c0984e5SSebastian Reichel 
3428c0984e5SSebastian Reichel static const struct of_device_id of_tps65090_charger_match[] = {
3438c0984e5SSebastian Reichel 	{ .compatible = "ti,tps65090-charger", },
3448c0984e5SSebastian Reichel 	{ /* end */ }
3458c0984e5SSebastian Reichel };
3468c0984e5SSebastian Reichel MODULE_DEVICE_TABLE(of, of_tps65090_charger_match);
3478c0984e5SSebastian Reichel 
3488c0984e5SSebastian Reichel static struct platform_driver tps65090_charger_driver = {
3498c0984e5SSebastian Reichel 	.driver	= {
3508c0984e5SSebastian Reichel 		.name	= "tps65090-charger",
3518c0984e5SSebastian Reichel 		.of_match_table = of_tps65090_charger_match,
3528c0984e5SSebastian Reichel 	},
3538c0984e5SSebastian Reichel 	.probe	= tps65090_charger_probe,
3548c0984e5SSebastian Reichel 	.remove = tps65090_charger_remove,
3558c0984e5SSebastian Reichel };
3568c0984e5SSebastian Reichel module_platform_driver(tps65090_charger_driver);
3578c0984e5SSebastian Reichel 
3588c0984e5SSebastian Reichel MODULE_LICENSE("GPL v2");
3598c0984e5SSebastian Reichel MODULE_AUTHOR("Syed Rafiuddin <srafiuddin@nvidia.com>");
3608c0984e5SSebastian Reichel MODULE_DESCRIPTION("tps65090 battery charger driver");
361