xref: /linux/drivers/video/backlight/tps65217_bl.c (revision 2b12dfa124dbadf391cb9a616aaa6b056823bf75)
1eebfdc17SMatthias Kaehlcke /*
2eebfdc17SMatthias Kaehlcke  * tps65217_bl.c
3eebfdc17SMatthias Kaehlcke  *
4eebfdc17SMatthias Kaehlcke  * TPS65217 backlight driver
5eebfdc17SMatthias Kaehlcke  *
6eebfdc17SMatthias Kaehlcke  * Copyright (C) 2012 Matthias Kaehlcke
7eebfdc17SMatthias Kaehlcke  * Author: Matthias Kaehlcke <matthias@kaehlcke.net>
8eebfdc17SMatthias Kaehlcke  *
9eebfdc17SMatthias Kaehlcke  * This program is free software; you can redistribute it and/or
10eebfdc17SMatthias Kaehlcke  * modify it under the terms of the GNU General Public License as
11eebfdc17SMatthias Kaehlcke  * published by the Free Software Foundation version 2.
12eebfdc17SMatthias Kaehlcke  *
13eebfdc17SMatthias Kaehlcke  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14eebfdc17SMatthias Kaehlcke  * kind, whether express or implied; without even the implied warranty
15eebfdc17SMatthias Kaehlcke  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16eebfdc17SMatthias Kaehlcke  * GNU General Public License for more details.
17eebfdc17SMatthias Kaehlcke  */
18eebfdc17SMatthias Kaehlcke 
19eebfdc17SMatthias Kaehlcke #include <linux/kernel.h>
20eebfdc17SMatthias Kaehlcke #include <linux/backlight.h>
21eebfdc17SMatthias Kaehlcke #include <linux/err.h>
22eebfdc17SMatthias Kaehlcke #include <linux/fb.h>
23eebfdc17SMatthias Kaehlcke #include <linux/mfd/tps65217.h>
24eebfdc17SMatthias Kaehlcke #include <linux/module.h>
25eebfdc17SMatthias Kaehlcke #include <linux/platform_device.h>
26eebfdc17SMatthias Kaehlcke #include <linux/slab.h>
27eebfdc17SMatthias Kaehlcke 
28eebfdc17SMatthias Kaehlcke struct tps65217_bl {
29eebfdc17SMatthias Kaehlcke 	struct tps65217 *tps;
30eebfdc17SMatthias Kaehlcke 	struct device *dev;
31eebfdc17SMatthias Kaehlcke 	struct backlight_device *bl;
32eebfdc17SMatthias Kaehlcke 	bool is_enabled;
33eebfdc17SMatthias Kaehlcke };
34eebfdc17SMatthias Kaehlcke 
35eebfdc17SMatthias Kaehlcke static int tps65217_bl_enable(struct tps65217_bl *tps65217_bl)
36eebfdc17SMatthias Kaehlcke {
37eebfdc17SMatthias Kaehlcke 	int rc;
38eebfdc17SMatthias Kaehlcke 
39eebfdc17SMatthias Kaehlcke 	rc = tps65217_set_bits(tps65217_bl->tps, TPS65217_REG_WLEDCTRL1,
40eebfdc17SMatthias Kaehlcke 			TPS65217_WLEDCTRL1_ISINK_ENABLE,
41eebfdc17SMatthias Kaehlcke 			TPS65217_WLEDCTRL1_ISINK_ENABLE, TPS65217_PROTECT_NONE);
42eebfdc17SMatthias Kaehlcke 	if (rc) {
43eebfdc17SMatthias Kaehlcke 		dev_err(tps65217_bl->dev,
44eebfdc17SMatthias Kaehlcke 			"failed to enable backlight: %d\n", rc);
45eebfdc17SMatthias Kaehlcke 		return rc;
46eebfdc17SMatthias Kaehlcke 	}
47eebfdc17SMatthias Kaehlcke 
48eebfdc17SMatthias Kaehlcke 	tps65217_bl->is_enabled = true;
49eebfdc17SMatthias Kaehlcke 
50eebfdc17SMatthias Kaehlcke 	dev_dbg(tps65217_bl->dev, "backlight enabled\n");
51eebfdc17SMatthias Kaehlcke 
52eebfdc17SMatthias Kaehlcke 	return 0;
53eebfdc17SMatthias Kaehlcke }
54eebfdc17SMatthias Kaehlcke 
55eebfdc17SMatthias Kaehlcke static int tps65217_bl_disable(struct tps65217_bl *tps65217_bl)
56eebfdc17SMatthias Kaehlcke {
57eebfdc17SMatthias Kaehlcke 	int rc;
58eebfdc17SMatthias Kaehlcke 
59eebfdc17SMatthias Kaehlcke 	rc = tps65217_clear_bits(tps65217_bl->tps,
60eebfdc17SMatthias Kaehlcke 				TPS65217_REG_WLEDCTRL1,
61eebfdc17SMatthias Kaehlcke 				TPS65217_WLEDCTRL1_ISINK_ENABLE,
62eebfdc17SMatthias Kaehlcke 				TPS65217_PROTECT_NONE);
63eebfdc17SMatthias Kaehlcke 	if (rc) {
64eebfdc17SMatthias Kaehlcke 		dev_err(tps65217_bl->dev,
65eebfdc17SMatthias Kaehlcke 			"failed to disable backlight: %d\n", rc);
66eebfdc17SMatthias Kaehlcke 		return rc;
67eebfdc17SMatthias Kaehlcke 	}
68eebfdc17SMatthias Kaehlcke 
69eebfdc17SMatthias Kaehlcke 	tps65217_bl->is_enabled = false;
70eebfdc17SMatthias Kaehlcke 
71eebfdc17SMatthias Kaehlcke 	dev_dbg(tps65217_bl->dev, "backlight disabled\n");
72eebfdc17SMatthias Kaehlcke 
73eebfdc17SMatthias Kaehlcke 	return 0;
74eebfdc17SMatthias Kaehlcke }
75eebfdc17SMatthias Kaehlcke 
76eebfdc17SMatthias Kaehlcke static int tps65217_bl_update_status(struct backlight_device *bl)
77eebfdc17SMatthias Kaehlcke {
78eebfdc17SMatthias Kaehlcke 	struct tps65217_bl *tps65217_bl = bl_get_data(bl);
79eebfdc17SMatthias Kaehlcke 	int rc;
80eebfdc17SMatthias Kaehlcke 	int brightness = bl->props.brightness;
81eebfdc17SMatthias Kaehlcke 
82eebfdc17SMatthias Kaehlcke 	if (bl->props.state & BL_CORE_SUSPENDED)
83eebfdc17SMatthias Kaehlcke 		brightness = 0;
84eebfdc17SMatthias Kaehlcke 
85eebfdc17SMatthias Kaehlcke 	if ((bl->props.power != FB_BLANK_UNBLANK) ||
86eebfdc17SMatthias Kaehlcke 		(bl->props.fb_blank != FB_BLANK_UNBLANK))
87eebfdc17SMatthias Kaehlcke 		/* framebuffer in low power mode or blanking active */
88eebfdc17SMatthias Kaehlcke 		brightness = 0;
89eebfdc17SMatthias Kaehlcke 
90eebfdc17SMatthias Kaehlcke 	if (brightness > 0) {
91eebfdc17SMatthias Kaehlcke 		rc = tps65217_reg_write(tps65217_bl->tps,
92eebfdc17SMatthias Kaehlcke 					TPS65217_REG_WLEDCTRL2,
93eebfdc17SMatthias Kaehlcke 					brightness - 1,
94eebfdc17SMatthias Kaehlcke 					TPS65217_PROTECT_NONE);
95eebfdc17SMatthias Kaehlcke 		if (rc) {
96eebfdc17SMatthias Kaehlcke 			dev_err(tps65217_bl->dev,
97eebfdc17SMatthias Kaehlcke 				"failed to set brightness level: %d\n", rc);
98eebfdc17SMatthias Kaehlcke 			return rc;
99eebfdc17SMatthias Kaehlcke 		}
100eebfdc17SMatthias Kaehlcke 
101eebfdc17SMatthias Kaehlcke 		dev_dbg(tps65217_bl->dev, "brightness set to %d\n", brightness);
102eebfdc17SMatthias Kaehlcke 
103eebfdc17SMatthias Kaehlcke 		if (!tps65217_bl->is_enabled)
104eebfdc17SMatthias Kaehlcke 			rc = tps65217_bl_enable(tps65217_bl);
105eebfdc17SMatthias Kaehlcke 	} else {
106eebfdc17SMatthias Kaehlcke 		rc = tps65217_bl_disable(tps65217_bl);
107eebfdc17SMatthias Kaehlcke 	}
108eebfdc17SMatthias Kaehlcke 
109eebfdc17SMatthias Kaehlcke 	return rc;
110eebfdc17SMatthias Kaehlcke }
111eebfdc17SMatthias Kaehlcke 
112eebfdc17SMatthias Kaehlcke static const struct backlight_ops tps65217_bl_ops = {
113eebfdc17SMatthias Kaehlcke 	.options	= BL_CORE_SUSPENDRESUME,
114eebfdc17SMatthias Kaehlcke 	.update_status	= tps65217_bl_update_status,
115eebfdc17SMatthias Kaehlcke };
116eebfdc17SMatthias Kaehlcke 
117eebfdc17SMatthias Kaehlcke static int tps65217_bl_hw_init(struct tps65217_bl *tps65217_bl,
118eebfdc17SMatthias Kaehlcke 			struct tps65217_bl_pdata *pdata)
119eebfdc17SMatthias Kaehlcke {
120eebfdc17SMatthias Kaehlcke 	int rc;
121eebfdc17SMatthias Kaehlcke 
122eebfdc17SMatthias Kaehlcke 	rc = tps65217_bl_disable(tps65217_bl);
123eebfdc17SMatthias Kaehlcke 	if (rc)
124eebfdc17SMatthias Kaehlcke 		return rc;
125eebfdc17SMatthias Kaehlcke 
126eebfdc17SMatthias Kaehlcke 	switch (pdata->isel) {
127eebfdc17SMatthias Kaehlcke 	case TPS65217_BL_ISET1:
128eebfdc17SMatthias Kaehlcke 		/* select ISET_1 current level */
129eebfdc17SMatthias Kaehlcke 		rc = tps65217_clear_bits(tps65217_bl->tps,
130eebfdc17SMatthias Kaehlcke 					TPS65217_REG_WLEDCTRL1,
131eebfdc17SMatthias Kaehlcke 					TPS65217_WLEDCTRL1_ISEL,
132eebfdc17SMatthias Kaehlcke 					TPS65217_PROTECT_NONE);
133eebfdc17SMatthias Kaehlcke 		if (rc) {
134eebfdc17SMatthias Kaehlcke 			dev_err(tps65217_bl->dev,
135eebfdc17SMatthias Kaehlcke 				"failed to select ISET1 current level: %d)\n",
136eebfdc17SMatthias Kaehlcke 				rc);
137eebfdc17SMatthias Kaehlcke 			return rc;
138eebfdc17SMatthias Kaehlcke 		}
139eebfdc17SMatthias Kaehlcke 
140eebfdc17SMatthias Kaehlcke 		dev_dbg(tps65217_bl->dev, "selected ISET1 current level\n");
141eebfdc17SMatthias Kaehlcke 
142eebfdc17SMatthias Kaehlcke 		break;
143eebfdc17SMatthias Kaehlcke 
144eebfdc17SMatthias Kaehlcke 	case TPS65217_BL_ISET2:
145eebfdc17SMatthias Kaehlcke 		/* select ISET2 current level */
146eebfdc17SMatthias Kaehlcke 		rc = tps65217_set_bits(tps65217_bl->tps, TPS65217_REG_WLEDCTRL1,
147eebfdc17SMatthias Kaehlcke 				TPS65217_WLEDCTRL1_ISEL,
148eebfdc17SMatthias Kaehlcke 				TPS65217_WLEDCTRL1_ISEL, TPS65217_PROTECT_NONE);
149eebfdc17SMatthias Kaehlcke 		if (rc) {
150eebfdc17SMatthias Kaehlcke 			dev_err(tps65217_bl->dev,
151eebfdc17SMatthias Kaehlcke 				"failed to select ISET2 current level: %d\n",
152eebfdc17SMatthias Kaehlcke 				rc);
153eebfdc17SMatthias Kaehlcke 			return rc;
154eebfdc17SMatthias Kaehlcke 		}
155eebfdc17SMatthias Kaehlcke 
156eebfdc17SMatthias Kaehlcke 		dev_dbg(tps65217_bl->dev, "selected ISET2 current level\n");
157eebfdc17SMatthias Kaehlcke 
158eebfdc17SMatthias Kaehlcke 		break;
159eebfdc17SMatthias Kaehlcke 
160eebfdc17SMatthias Kaehlcke 	default:
161eebfdc17SMatthias Kaehlcke 		dev_err(tps65217_bl->dev,
162eebfdc17SMatthias Kaehlcke 			"invalid value for current level: %d\n", pdata->isel);
163eebfdc17SMatthias Kaehlcke 		return -EINVAL;
164eebfdc17SMatthias Kaehlcke 	}
165eebfdc17SMatthias Kaehlcke 
166eebfdc17SMatthias Kaehlcke 	/* set PWM frequency */
167eebfdc17SMatthias Kaehlcke 	rc = tps65217_set_bits(tps65217_bl->tps,
168eebfdc17SMatthias Kaehlcke 			TPS65217_REG_WLEDCTRL1,
169eebfdc17SMatthias Kaehlcke 			TPS65217_WLEDCTRL1_FDIM_MASK,
170eebfdc17SMatthias Kaehlcke 			pdata->fdim,
171eebfdc17SMatthias Kaehlcke 			TPS65217_PROTECT_NONE);
172eebfdc17SMatthias Kaehlcke 	if (rc) {
173eebfdc17SMatthias Kaehlcke 		dev_err(tps65217_bl->dev,
174eebfdc17SMatthias Kaehlcke 			"failed to select PWM dimming frequency: %d\n",
175eebfdc17SMatthias Kaehlcke 			rc);
176eebfdc17SMatthias Kaehlcke 		return rc;
177eebfdc17SMatthias Kaehlcke 	}
178eebfdc17SMatthias Kaehlcke 
179eebfdc17SMatthias Kaehlcke 	return 0;
180eebfdc17SMatthias Kaehlcke }
181eebfdc17SMatthias Kaehlcke 
182eebfdc17SMatthias Kaehlcke #ifdef CONFIG_OF
183eebfdc17SMatthias Kaehlcke static struct tps65217_bl_pdata *
184eebfdc17SMatthias Kaehlcke tps65217_bl_parse_dt(struct platform_device *pdev)
185eebfdc17SMatthias Kaehlcke {
186eebfdc17SMatthias Kaehlcke 	struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
187*2b12dfa1SJohan Hovold 	struct device_node *node;
188eebfdc17SMatthias Kaehlcke 	struct tps65217_bl_pdata *pdata, *err;
189eebfdc17SMatthias Kaehlcke 	u32 val;
190eebfdc17SMatthias Kaehlcke 
191*2b12dfa1SJohan Hovold 	node = of_get_child_by_name(tps->dev->of_node, "backlight");
192eebfdc17SMatthias Kaehlcke 	if (!node)
193eebfdc17SMatthias Kaehlcke 		return ERR_PTR(-ENODEV);
194eebfdc17SMatthias Kaehlcke 
195eebfdc17SMatthias Kaehlcke 	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
196eebfdc17SMatthias Kaehlcke 	if (!pdata) {
197eebfdc17SMatthias Kaehlcke 		err = ERR_PTR(-ENOMEM);
198eebfdc17SMatthias Kaehlcke 		goto err;
199eebfdc17SMatthias Kaehlcke 	}
200eebfdc17SMatthias Kaehlcke 
201eebfdc17SMatthias Kaehlcke 	pdata->isel = TPS65217_BL_ISET1;
202eebfdc17SMatthias Kaehlcke 	if (!of_property_read_u32(node, "isel", &val)) {
203eebfdc17SMatthias Kaehlcke 		if (val < TPS65217_BL_ISET1 ||
204eebfdc17SMatthias Kaehlcke 			val > TPS65217_BL_ISET2) {
205eebfdc17SMatthias Kaehlcke 			dev_err(&pdev->dev,
206eebfdc17SMatthias Kaehlcke 				"invalid 'isel' value in the device tree\n");
207eebfdc17SMatthias Kaehlcke 			err = ERR_PTR(-EINVAL);
208eebfdc17SMatthias Kaehlcke 			goto err;
209eebfdc17SMatthias Kaehlcke 		}
210eebfdc17SMatthias Kaehlcke 
211eebfdc17SMatthias Kaehlcke 		pdata->isel = val;
212eebfdc17SMatthias Kaehlcke 	}
213eebfdc17SMatthias Kaehlcke 
214eebfdc17SMatthias Kaehlcke 	pdata->fdim = TPS65217_BL_FDIM_200HZ;
215eebfdc17SMatthias Kaehlcke 	if (!of_property_read_u32(node, "fdim", &val)) {
216eebfdc17SMatthias Kaehlcke 		switch (val) {
217eebfdc17SMatthias Kaehlcke 		case 100:
218eebfdc17SMatthias Kaehlcke 			pdata->fdim = TPS65217_BL_FDIM_100HZ;
219eebfdc17SMatthias Kaehlcke 			break;
220eebfdc17SMatthias Kaehlcke 
221eebfdc17SMatthias Kaehlcke 		case 200:
222eebfdc17SMatthias Kaehlcke 			pdata->fdim = TPS65217_BL_FDIM_200HZ;
223eebfdc17SMatthias Kaehlcke 			break;
224eebfdc17SMatthias Kaehlcke 
225eebfdc17SMatthias Kaehlcke 		case 500:
226eebfdc17SMatthias Kaehlcke 			pdata->fdim = TPS65217_BL_FDIM_500HZ;
227eebfdc17SMatthias Kaehlcke 			break;
228eebfdc17SMatthias Kaehlcke 
229eebfdc17SMatthias Kaehlcke 		case 1000:
230eebfdc17SMatthias Kaehlcke 			pdata->fdim = TPS65217_BL_FDIM_1000HZ;
231eebfdc17SMatthias Kaehlcke 			break;
232eebfdc17SMatthias Kaehlcke 
233eebfdc17SMatthias Kaehlcke 		default:
234eebfdc17SMatthias Kaehlcke 			dev_err(&pdev->dev,
235eebfdc17SMatthias Kaehlcke 				"invalid 'fdim' value in the device tree\n");
236eebfdc17SMatthias Kaehlcke 			err = ERR_PTR(-EINVAL);
237eebfdc17SMatthias Kaehlcke 			goto err;
238eebfdc17SMatthias Kaehlcke 		}
239eebfdc17SMatthias Kaehlcke 	}
240eebfdc17SMatthias Kaehlcke 
2414d22f8c3SMatus Ujhelyi 	if (!of_property_read_u32(node, "default-brightness", &val)) {
2425158cc2dSChristos Gkekas 		if (val > 100) {
2434d22f8c3SMatus Ujhelyi 			dev_err(&pdev->dev,
2444d22f8c3SMatus Ujhelyi 				"invalid 'default-brightness' value in the device tree\n");
2454d22f8c3SMatus Ujhelyi 			err = ERR_PTR(-EINVAL);
2464d22f8c3SMatus Ujhelyi 			goto err;
2474d22f8c3SMatus Ujhelyi 		}
2484d22f8c3SMatus Ujhelyi 
2494d22f8c3SMatus Ujhelyi 		pdata->dft_brightness = val;
2504d22f8c3SMatus Ujhelyi 	}
2514d22f8c3SMatus Ujhelyi 
252eebfdc17SMatthias Kaehlcke 	of_node_put(node);
253eebfdc17SMatthias Kaehlcke 
254eebfdc17SMatthias Kaehlcke 	return pdata;
255eebfdc17SMatthias Kaehlcke 
256eebfdc17SMatthias Kaehlcke err:
257eebfdc17SMatthias Kaehlcke 	of_node_put(node);
258eebfdc17SMatthias Kaehlcke 
259eebfdc17SMatthias Kaehlcke 	return err;
260eebfdc17SMatthias Kaehlcke }
261eebfdc17SMatthias Kaehlcke #else
262eebfdc17SMatthias Kaehlcke static struct tps65217_bl_pdata *
263eebfdc17SMatthias Kaehlcke tps65217_bl_parse_dt(struct platform_device *pdev)
264eebfdc17SMatthias Kaehlcke {
265eebfdc17SMatthias Kaehlcke 	return NULL;
266eebfdc17SMatthias Kaehlcke }
267eebfdc17SMatthias Kaehlcke #endif
268eebfdc17SMatthias Kaehlcke 
269eebfdc17SMatthias Kaehlcke static int tps65217_bl_probe(struct platform_device *pdev)
270eebfdc17SMatthias Kaehlcke {
271eebfdc17SMatthias Kaehlcke 	int rc;
272eebfdc17SMatthias Kaehlcke 	struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
273eebfdc17SMatthias Kaehlcke 	struct tps65217_bl *tps65217_bl;
274eebfdc17SMatthias Kaehlcke 	struct tps65217_bl_pdata *pdata;
275eebfdc17SMatthias Kaehlcke 	struct backlight_properties bl_props;
276eebfdc17SMatthias Kaehlcke 
277eebfdc17SMatthias Kaehlcke 	pdata = tps65217_bl_parse_dt(pdev);
278eebfdc17SMatthias Kaehlcke 	if (IS_ERR(pdata))
279eebfdc17SMatthias Kaehlcke 		return PTR_ERR(pdata);
280eebfdc17SMatthias Kaehlcke 
281eebfdc17SMatthias Kaehlcke 	tps65217_bl = devm_kzalloc(&pdev->dev, sizeof(*tps65217_bl),
282eebfdc17SMatthias Kaehlcke 				GFP_KERNEL);
2833d8e4b40SJingoo Han 	if (tps65217_bl == NULL)
284eebfdc17SMatthias Kaehlcke 		return -ENOMEM;
285eebfdc17SMatthias Kaehlcke 
286eebfdc17SMatthias Kaehlcke 	tps65217_bl->tps = tps;
287eebfdc17SMatthias Kaehlcke 	tps65217_bl->dev = &pdev->dev;
288eebfdc17SMatthias Kaehlcke 	tps65217_bl->is_enabled = false;
289eebfdc17SMatthias Kaehlcke 
290eebfdc17SMatthias Kaehlcke 	rc = tps65217_bl_hw_init(tps65217_bl, pdata);
291eebfdc17SMatthias Kaehlcke 	if (rc)
292eebfdc17SMatthias Kaehlcke 		return rc;
293eebfdc17SMatthias Kaehlcke 
294eebfdc17SMatthias Kaehlcke 	memset(&bl_props, 0, sizeof(struct backlight_properties));
295eebfdc17SMatthias Kaehlcke 	bl_props.type = BACKLIGHT_RAW;
296eebfdc17SMatthias Kaehlcke 	bl_props.max_brightness = 100;
297eebfdc17SMatthias Kaehlcke 
298626d0908SJingoo Han 	tps65217_bl->bl = devm_backlight_device_register(&pdev->dev, pdev->name,
299eebfdc17SMatthias Kaehlcke 						tps65217_bl->dev, tps65217_bl,
300eebfdc17SMatthias Kaehlcke 						&tps65217_bl_ops, &bl_props);
301eebfdc17SMatthias Kaehlcke 	if (IS_ERR(tps65217_bl->bl)) {
302eebfdc17SMatthias Kaehlcke 		dev_err(tps65217_bl->dev,
303eebfdc17SMatthias Kaehlcke 			"registration of backlight device failed: %d\n", rc);
304eebfdc17SMatthias Kaehlcke 		return PTR_ERR(tps65217_bl->bl);
305eebfdc17SMatthias Kaehlcke 	}
306eebfdc17SMatthias Kaehlcke 
3074d22f8c3SMatus Ujhelyi 	tps65217_bl->bl->props.brightness = pdata->dft_brightness;
3084d22f8c3SMatus Ujhelyi 	backlight_update_status(tps65217_bl->bl);
309c6bed9deSAxel Lin 	platform_set_drvdata(pdev, tps65217_bl);
310eebfdc17SMatthias Kaehlcke 
311eebfdc17SMatthias Kaehlcke 	return 0;
312eebfdc17SMatthias Kaehlcke }
313eebfdc17SMatthias Kaehlcke 
314fcf13f0bSEnric Balletbo i Serra #ifdef CONFIG_OF
315fcf13f0bSEnric Balletbo i Serra static const struct of_device_id tps65217_bl_of_match[] = {
316fcf13f0bSEnric Balletbo i Serra 	{ .compatible = "ti,tps65217-bl", },
317fcf13f0bSEnric Balletbo i Serra 	{ /* sentinel */ },
318fcf13f0bSEnric Balletbo i Serra };
319fcf13f0bSEnric Balletbo i Serra MODULE_DEVICE_TABLE(of, tps65217_bl_of_match);
320fcf13f0bSEnric Balletbo i Serra #endif
321fcf13f0bSEnric Balletbo i Serra 
322eebfdc17SMatthias Kaehlcke static struct platform_driver tps65217_bl_driver = {
323eebfdc17SMatthias Kaehlcke 	.probe		= tps65217_bl_probe,
324eebfdc17SMatthias Kaehlcke 	.driver		= {
325eebfdc17SMatthias Kaehlcke 		.name	= "tps65217-bl",
326fcf13f0bSEnric Balletbo i Serra 		.of_match_table = of_match_ptr(tps65217_bl_of_match),
327eebfdc17SMatthias Kaehlcke 	},
328eebfdc17SMatthias Kaehlcke };
329eebfdc17SMatthias Kaehlcke 
330c6bed9deSAxel Lin module_platform_driver(tps65217_bl_driver);
331eebfdc17SMatthias Kaehlcke 
332eebfdc17SMatthias Kaehlcke MODULE_DESCRIPTION("TPS65217 Backlight driver");
333eebfdc17SMatthias Kaehlcke MODULE_LICENSE("GPL v2");
334eebfdc17SMatthias Kaehlcke MODULE_AUTHOR("Matthias Kaehlcke <matthias@kaehlcke.net>");
335