1e7647de0SChiaEn Wu // SPDX-License-Identifier: GPL-2.0-only
2e7647de0SChiaEn Wu /*
3e7647de0SChiaEn Wu * Copyright (C) 2022 Richtek Technology Corp.
4e7647de0SChiaEn Wu *
5e7647de0SChiaEn Wu * Author: ChiaEn Wu <chiaen_wu@richtek.com>
6e7647de0SChiaEn Wu */
7e7647de0SChiaEn Wu
8e7647de0SChiaEn Wu #include <linux/backlight.h>
9e7647de0SChiaEn Wu #include <linux/bitfield.h>
10e7647de0SChiaEn Wu #include <linux/bits.h>
11e7647de0SChiaEn Wu #include <linux/gpio/consumer.h>
12e7647de0SChiaEn Wu #include <linux/kernel.h>
13e7647de0SChiaEn Wu #include <linux/minmax.h>
14e7647de0SChiaEn Wu #include <linux/mod_devicetable.h>
15e7647de0SChiaEn Wu #include <linux/module.h>
16e7647de0SChiaEn Wu #include <linux/platform_device.h>
17e7647de0SChiaEn Wu #include <linux/property.h>
18e7647de0SChiaEn Wu #include <linux/regmap.h>
19e7647de0SChiaEn Wu
20e7647de0SChiaEn Wu #define MT6370_REG_DEV_INFO 0x100
21e7647de0SChiaEn Wu #define MT6370_REG_BL_EN 0x1A0
22e7647de0SChiaEn Wu #define MT6370_REG_BL_BSTCTRL 0x1A1
23e7647de0SChiaEn Wu #define MT6370_REG_BL_PWM 0x1A2
24e7647de0SChiaEn Wu #define MT6370_REG_BL_DIM2 0x1A4
25e7647de0SChiaEn Wu
26e7647de0SChiaEn Wu #define MT6370_VENID_MASK GENMASK(7, 4)
27e7647de0SChiaEn Wu #define MT6370_BL_EXT_EN_MASK BIT(7)
28e7647de0SChiaEn Wu #define MT6370_BL_EN_MASK BIT(6)
29e7647de0SChiaEn Wu #define MT6370_BL_CODE_MASK BIT(0)
30e7647de0SChiaEn Wu #define MT6370_BL_CH_MASK GENMASK(5, 2)
31e7647de0SChiaEn Wu #define MT6370_BL_CH_SHIFT 2
32e7647de0SChiaEn Wu #define MT6370_BL_DIM2_COMMON_MASK GENMASK(2, 0)
33e7647de0SChiaEn Wu #define MT6370_BL_DIM2_COMMON_SHIFT 3
34e7647de0SChiaEn Wu #define MT6370_BL_DIM2_6372_MASK GENMASK(5, 0)
35e7647de0SChiaEn Wu #define MT6370_BL_DIM2_6372_SHIFT 6
36e7647de0SChiaEn Wu #define MT6370_BL_PWM_EN_MASK BIT(7)
37e7647de0SChiaEn Wu #define MT6370_BL_PWM_HYS_EN_MASK BIT(2)
38e7647de0SChiaEn Wu #define MT6370_BL_PWM_HYS_SEL_MASK GENMASK(1, 0)
39e7647de0SChiaEn Wu #define MT6370_BL_OVP_EN_MASK BIT(7)
40e7647de0SChiaEn Wu #define MT6370_BL_OVP_SEL_MASK GENMASK(6, 5)
41e7647de0SChiaEn Wu #define MT6370_BL_OVP_SEL_SHIFT 5
42e7647de0SChiaEn Wu #define MT6370_BL_OC_EN_MASK BIT(3)
43e7647de0SChiaEn Wu #define MT6370_BL_OC_SEL_MASK GENMASK(2, 1)
44e7647de0SChiaEn Wu #define MT6370_BL_OC_SEL_SHIFT 1
45e7647de0SChiaEn Wu
46e7647de0SChiaEn Wu #define MT6370_BL_PWM_HYS_TH_MIN_STEP 1
47e7647de0SChiaEn Wu #define MT6370_BL_PWM_HYS_TH_MAX_STEP 64
48e7647de0SChiaEn Wu #define MT6370_BL_OVP_MIN_UV 17000000
49e7647de0SChiaEn Wu #define MT6370_BL_OVP_MAX_UV 29000000
50e7647de0SChiaEn Wu #define MT6370_BL_OVP_STEP_UV 4000000
51e7647de0SChiaEn Wu #define MT6370_BL_OCP_MIN_UA 900000
52e7647de0SChiaEn Wu #define MT6370_BL_OCP_MAX_UA 1800000
53e7647de0SChiaEn Wu #define MT6370_BL_OCP_STEP_UA 300000
54e7647de0SChiaEn Wu #define MT6370_BL_MAX_COMMON_BRIGHTNESS 2048
55e7647de0SChiaEn Wu #define MT6370_BL_MAX_6372_BRIGHTNESS 16384
56e7647de0SChiaEn Wu #define MT6370_BL_MAX_CH 15
57e7647de0SChiaEn Wu
58e7647de0SChiaEn Wu enum {
59e7647de0SChiaEn Wu MT6370_VID_COMMON = 1,
60e7647de0SChiaEn Wu MT6370_VID_6372,
61e7647de0SChiaEn Wu };
62e7647de0SChiaEn Wu
63e7647de0SChiaEn Wu struct mt6370_priv {
64e7647de0SChiaEn Wu u8 dim2_mask;
65e7647de0SChiaEn Wu u8 dim2_shift;
66e7647de0SChiaEn Wu int def_max_brightness;
67e7647de0SChiaEn Wu struct backlight_device *bl;
68e7647de0SChiaEn Wu struct device *dev;
69e7647de0SChiaEn Wu struct gpio_desc *enable_gpio;
70e7647de0SChiaEn Wu struct regmap *regmap;
71e7647de0SChiaEn Wu };
72e7647de0SChiaEn Wu
mt6370_bl_update_status(struct backlight_device * bl_dev)73e7647de0SChiaEn Wu static int mt6370_bl_update_status(struct backlight_device *bl_dev)
74e7647de0SChiaEn Wu {
75e7647de0SChiaEn Wu struct mt6370_priv *priv = bl_get_data(bl_dev);
76e7647de0SChiaEn Wu int brightness = backlight_get_brightness(bl_dev);
77e7647de0SChiaEn Wu unsigned int enable_val;
78e7647de0SChiaEn Wu u8 brightness_val[2];
79e7647de0SChiaEn Wu int ret;
80e7647de0SChiaEn Wu
81e7647de0SChiaEn Wu if (brightness) {
82e7647de0SChiaEn Wu brightness_val[0] = (brightness - 1) & priv->dim2_mask;
83e7647de0SChiaEn Wu brightness_val[1] = (brightness - 1) >> priv->dim2_shift;
84e7647de0SChiaEn Wu
85e7647de0SChiaEn Wu ret = regmap_raw_write(priv->regmap, MT6370_REG_BL_DIM2,
86e7647de0SChiaEn Wu brightness_val, sizeof(brightness_val));
87e7647de0SChiaEn Wu if (ret)
88e7647de0SChiaEn Wu return ret;
89e7647de0SChiaEn Wu }
90e7647de0SChiaEn Wu
91e7647de0SChiaEn Wu gpiod_set_value(priv->enable_gpio, !!brightness);
92e7647de0SChiaEn Wu
93e7647de0SChiaEn Wu enable_val = brightness ? MT6370_BL_EN_MASK : 0;
94e7647de0SChiaEn Wu return regmap_update_bits(priv->regmap, MT6370_REG_BL_EN,
95e7647de0SChiaEn Wu MT6370_BL_EN_MASK, enable_val);
96e7647de0SChiaEn Wu }
97e7647de0SChiaEn Wu
mt6370_bl_get_brightness(struct backlight_device * bl_dev)98e7647de0SChiaEn Wu static int mt6370_bl_get_brightness(struct backlight_device *bl_dev)
99e7647de0SChiaEn Wu {
100e7647de0SChiaEn Wu struct mt6370_priv *priv = bl_get_data(bl_dev);
101e7647de0SChiaEn Wu unsigned int enable;
102e7647de0SChiaEn Wu u8 brightness_val[2];
103e7647de0SChiaEn Wu int brightness, ret;
104e7647de0SChiaEn Wu
105e7647de0SChiaEn Wu ret = regmap_read(priv->regmap, MT6370_REG_BL_EN, &enable);
106e7647de0SChiaEn Wu if (ret)
107e7647de0SChiaEn Wu return ret;
108e7647de0SChiaEn Wu
109e7647de0SChiaEn Wu if (!(enable & MT6370_BL_EN_MASK))
110e7647de0SChiaEn Wu return 0;
111e7647de0SChiaEn Wu
112e7647de0SChiaEn Wu ret = regmap_raw_read(priv->regmap, MT6370_REG_BL_DIM2,
113e7647de0SChiaEn Wu brightness_val, sizeof(brightness_val));
114e7647de0SChiaEn Wu if (ret)
115e7647de0SChiaEn Wu return ret;
116e7647de0SChiaEn Wu
117e7647de0SChiaEn Wu brightness = brightness_val[1] << priv->dim2_shift;
118e7647de0SChiaEn Wu brightness += brightness_val[0] & priv->dim2_mask;
119e7647de0SChiaEn Wu
120e7647de0SChiaEn Wu return brightness + 1;
121e7647de0SChiaEn Wu }
122e7647de0SChiaEn Wu
123e7647de0SChiaEn Wu static const struct backlight_ops mt6370_bl_ops = {
124e7647de0SChiaEn Wu .options = BL_CORE_SUSPENDRESUME,
125e7647de0SChiaEn Wu .update_status = mt6370_bl_update_status,
126e7647de0SChiaEn Wu .get_brightness = mt6370_bl_get_brightness,
127e7647de0SChiaEn Wu };
128e7647de0SChiaEn Wu
mt6370_init_backlight_properties(struct mt6370_priv * priv,struct backlight_properties * props)129e7647de0SChiaEn Wu static int mt6370_init_backlight_properties(struct mt6370_priv *priv,
130e7647de0SChiaEn Wu struct backlight_properties *props)
131e7647de0SChiaEn Wu {
132e7647de0SChiaEn Wu struct device *dev = priv->dev;
133e7647de0SChiaEn Wu u8 prop_val;
134e7647de0SChiaEn Wu u32 brightness, ovp_uV, ocp_uA;
135e7647de0SChiaEn Wu unsigned int mask, val;
136e7647de0SChiaEn Wu int ret;
137e7647de0SChiaEn Wu
138e7647de0SChiaEn Wu /* Vendor optional properties */
139e7647de0SChiaEn Wu val = 0;
140e7647de0SChiaEn Wu if (device_property_read_bool(dev, "mediatek,bled-pwm-enable"))
141e7647de0SChiaEn Wu val |= MT6370_BL_PWM_EN_MASK;
142e7647de0SChiaEn Wu
143e7647de0SChiaEn Wu if (device_property_read_bool(dev, "mediatek,bled-pwm-hys-enable"))
144e7647de0SChiaEn Wu val |= MT6370_BL_PWM_HYS_EN_MASK;
145e7647de0SChiaEn Wu
146e7647de0SChiaEn Wu ret = device_property_read_u8(dev,
147e7647de0SChiaEn Wu "mediatek,bled-pwm-hys-input-th-steps",
148e7647de0SChiaEn Wu &prop_val);
149e7647de0SChiaEn Wu if (!ret) {
150e7647de0SChiaEn Wu prop_val = clamp_val(prop_val,
151e7647de0SChiaEn Wu MT6370_BL_PWM_HYS_TH_MIN_STEP,
152e7647de0SChiaEn Wu MT6370_BL_PWM_HYS_TH_MAX_STEP);
153e7647de0SChiaEn Wu prop_val = prop_val <= 1 ? 0 :
154e7647de0SChiaEn Wu prop_val <= 4 ? 1 :
155e7647de0SChiaEn Wu prop_val <= 16 ? 2 : 3;
156e7647de0SChiaEn Wu val |= prop_val;
157e7647de0SChiaEn Wu }
158e7647de0SChiaEn Wu
159e7647de0SChiaEn Wu ret = regmap_update_bits(priv->regmap, MT6370_REG_BL_PWM,
160e7647de0SChiaEn Wu val, val);
161e7647de0SChiaEn Wu if (ret)
162e7647de0SChiaEn Wu return ret;
163e7647de0SChiaEn Wu
164e7647de0SChiaEn Wu val = 0;
165e7647de0SChiaEn Wu if (device_property_read_bool(dev, "mediatek,bled-ovp-shutdown"))
166e7647de0SChiaEn Wu val |= MT6370_BL_OVP_EN_MASK;
167e7647de0SChiaEn Wu
168e7647de0SChiaEn Wu ret = device_property_read_u32(dev, "mediatek,bled-ovp-microvolt",
169e7647de0SChiaEn Wu &ovp_uV);
170e7647de0SChiaEn Wu if (!ret) {
171e7647de0SChiaEn Wu ovp_uV = clamp_val(ovp_uV, MT6370_BL_OVP_MIN_UV,
172e7647de0SChiaEn Wu MT6370_BL_OVP_MAX_UV);
173e7647de0SChiaEn Wu ovp_uV = DIV_ROUND_UP(ovp_uV - MT6370_BL_OVP_MIN_UV,
174e7647de0SChiaEn Wu MT6370_BL_OVP_STEP_UV);
175e7647de0SChiaEn Wu val |= ovp_uV << MT6370_BL_OVP_SEL_SHIFT;
176e7647de0SChiaEn Wu }
177e7647de0SChiaEn Wu
178e7647de0SChiaEn Wu if (device_property_read_bool(dev, "mediatek,bled-ocp-shutdown"))
179e7647de0SChiaEn Wu val |= MT6370_BL_OC_EN_MASK;
180e7647de0SChiaEn Wu
181e7647de0SChiaEn Wu ret = device_property_read_u32(dev, "mediatek,bled-ocp-microamp",
182e7647de0SChiaEn Wu &ocp_uA);
183e7647de0SChiaEn Wu if (!ret) {
184e7647de0SChiaEn Wu ocp_uA = clamp_val(ocp_uA, MT6370_BL_OCP_MIN_UA,
185e7647de0SChiaEn Wu MT6370_BL_OCP_MAX_UA);
186e7647de0SChiaEn Wu ocp_uA = DIV_ROUND_UP(ocp_uA - MT6370_BL_OCP_MIN_UA,
187e7647de0SChiaEn Wu MT6370_BL_OCP_STEP_UA);
188e7647de0SChiaEn Wu val |= ocp_uA << MT6370_BL_OC_SEL_SHIFT;
189e7647de0SChiaEn Wu }
190e7647de0SChiaEn Wu
191e7647de0SChiaEn Wu ret = regmap_update_bits(priv->regmap, MT6370_REG_BL_BSTCTRL,
192e7647de0SChiaEn Wu val, val);
193e7647de0SChiaEn Wu if (ret)
194e7647de0SChiaEn Wu return ret;
195e7647de0SChiaEn Wu
196e7647de0SChiaEn Wu /* Common properties */
197e7647de0SChiaEn Wu ret = device_property_read_u32(dev, "max-brightness", &brightness);
198e7647de0SChiaEn Wu if (ret)
199e7647de0SChiaEn Wu brightness = priv->def_max_brightness;
200e7647de0SChiaEn Wu
201e7647de0SChiaEn Wu props->max_brightness = min_t(u32, brightness, priv->def_max_brightness);
202e7647de0SChiaEn Wu
203e7647de0SChiaEn Wu ret = device_property_read_u32(dev, "default-brightness", &brightness);
204e7647de0SChiaEn Wu if (ret)
205e7647de0SChiaEn Wu brightness = props->max_brightness;
206e7647de0SChiaEn Wu
207e7647de0SChiaEn Wu props->brightness = min_t(u32, brightness, props->max_brightness);
208e7647de0SChiaEn Wu
209e7647de0SChiaEn Wu val = 0;
210e7647de0SChiaEn Wu if (device_property_read_bool(dev, "mediatek,bled-exponential-mode-enable")) {
211e7647de0SChiaEn Wu val |= MT6370_BL_CODE_MASK;
212e7647de0SChiaEn Wu props->scale = BACKLIGHT_SCALE_NON_LINEAR;
213e7647de0SChiaEn Wu } else
214e7647de0SChiaEn Wu props->scale = BACKLIGHT_SCALE_LINEAR;
215e7647de0SChiaEn Wu
216e7647de0SChiaEn Wu ret = device_property_read_u8(dev, "mediatek,bled-channel-use",
217e7647de0SChiaEn Wu &prop_val);
218e7647de0SChiaEn Wu if (ret) {
219e7647de0SChiaEn Wu dev_err(dev, "mediatek,bled-channel-use DT property missing\n");
220e7647de0SChiaEn Wu return ret;
221e7647de0SChiaEn Wu }
222e7647de0SChiaEn Wu
223e7647de0SChiaEn Wu if (!prop_val || prop_val > MT6370_BL_MAX_CH) {
224e7647de0SChiaEn Wu dev_err(dev,
225e7647de0SChiaEn Wu "No channel specified or over than upper bound (%d)\n",
226e7647de0SChiaEn Wu prop_val);
227e7647de0SChiaEn Wu return -EINVAL;
228e7647de0SChiaEn Wu }
229e7647de0SChiaEn Wu
230e7647de0SChiaEn Wu mask = MT6370_BL_EXT_EN_MASK | MT6370_BL_CH_MASK;
231e7647de0SChiaEn Wu val |= prop_val << MT6370_BL_CH_SHIFT;
232e7647de0SChiaEn Wu
233e7647de0SChiaEn Wu if (priv->enable_gpio)
234e7647de0SChiaEn Wu val |= MT6370_BL_EXT_EN_MASK;
235e7647de0SChiaEn Wu
236e7647de0SChiaEn Wu return regmap_update_bits(priv->regmap, MT6370_REG_BL_EN, mask, val);
237e7647de0SChiaEn Wu }
238e7647de0SChiaEn Wu
mt6370_check_vendor_info(struct mt6370_priv * priv)239e7647de0SChiaEn Wu static int mt6370_check_vendor_info(struct mt6370_priv *priv)
240e7647de0SChiaEn Wu {
241e7647de0SChiaEn Wu /*
242e7647de0SChiaEn Wu * Because MT6372 uses 14 bits to control the brightness,
243e7647de0SChiaEn Wu * MT6370 and MT6371 use 11 bits. This function is used
244e7647de0SChiaEn Wu * to check the vendor's ID and set the relative hardware
245e7647de0SChiaEn Wu * mask, shift and default maximum brightness value that
246e7647de0SChiaEn Wu * should be used.
247e7647de0SChiaEn Wu */
248e7647de0SChiaEn Wu unsigned int dev_info, hw_vid, of_vid;
249e7647de0SChiaEn Wu int ret;
250e7647de0SChiaEn Wu
251e7647de0SChiaEn Wu ret = regmap_read(priv->regmap, MT6370_REG_DEV_INFO, &dev_info);
252e7647de0SChiaEn Wu if (ret)
253e7647de0SChiaEn Wu return ret;
254e7647de0SChiaEn Wu
255e7647de0SChiaEn Wu of_vid = (uintptr_t)device_get_match_data(priv->dev);
256e7647de0SChiaEn Wu hw_vid = FIELD_GET(MT6370_VENID_MASK, dev_info);
257e7647de0SChiaEn Wu hw_vid = (hw_vid == 0x9 || hw_vid == 0xb) ? MT6370_VID_6372 : MT6370_VID_COMMON;
258e7647de0SChiaEn Wu if (hw_vid != of_vid)
259e7647de0SChiaEn Wu return dev_err_probe(priv->dev, -EINVAL,
260e7647de0SChiaEn Wu "Buggy DT, wrong compatible string\n");
261e7647de0SChiaEn Wu
262e7647de0SChiaEn Wu if (hw_vid == MT6370_VID_6372) {
263e7647de0SChiaEn Wu priv->dim2_mask = MT6370_BL_DIM2_6372_MASK;
264e7647de0SChiaEn Wu priv->dim2_shift = MT6370_BL_DIM2_6372_SHIFT;
265e7647de0SChiaEn Wu priv->def_max_brightness = MT6370_BL_MAX_6372_BRIGHTNESS;
266e7647de0SChiaEn Wu } else {
267e7647de0SChiaEn Wu priv->dim2_mask = MT6370_BL_DIM2_COMMON_MASK;
268e7647de0SChiaEn Wu priv->dim2_shift = MT6370_BL_DIM2_COMMON_SHIFT;
269e7647de0SChiaEn Wu priv->def_max_brightness = MT6370_BL_MAX_COMMON_BRIGHTNESS;
270e7647de0SChiaEn Wu }
271e7647de0SChiaEn Wu
272e7647de0SChiaEn Wu return 0;
273e7647de0SChiaEn Wu }
274e7647de0SChiaEn Wu
mt6370_bl_probe(struct platform_device * pdev)275e7647de0SChiaEn Wu static int mt6370_bl_probe(struct platform_device *pdev)
276e7647de0SChiaEn Wu {
277e7647de0SChiaEn Wu struct backlight_properties props = {
278e7647de0SChiaEn Wu .type = BACKLIGHT_RAW,
279e7647de0SChiaEn Wu };
280e7647de0SChiaEn Wu struct device *dev = &pdev->dev;
281e7647de0SChiaEn Wu struct mt6370_priv *priv;
282e7647de0SChiaEn Wu int ret;
283e7647de0SChiaEn Wu
284e7647de0SChiaEn Wu priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
285e7647de0SChiaEn Wu if (!priv)
286e7647de0SChiaEn Wu return -ENOMEM;
287e7647de0SChiaEn Wu
288e7647de0SChiaEn Wu priv->dev = dev;
289e7647de0SChiaEn Wu
290e7647de0SChiaEn Wu priv->regmap = dev_get_regmap(dev->parent, NULL);
291e7647de0SChiaEn Wu if (!priv->regmap)
292e7647de0SChiaEn Wu return dev_err_probe(dev, -ENODEV, "Failed to get regmap\n");
293e7647de0SChiaEn Wu
294e7647de0SChiaEn Wu ret = mt6370_check_vendor_info(priv);
295e7647de0SChiaEn Wu if (ret)
296e7647de0SChiaEn Wu return dev_err_probe(dev, ret, "Failed to check vendor info\n");
297e7647de0SChiaEn Wu
298e7647de0SChiaEn Wu priv->enable_gpio = devm_gpiod_get_optional(dev, "enable",
299e7647de0SChiaEn Wu GPIOD_OUT_HIGH);
300e7647de0SChiaEn Wu if (IS_ERR(priv->enable_gpio))
301e7647de0SChiaEn Wu return dev_err_probe(dev, PTR_ERR(priv->enable_gpio),
302e7647de0SChiaEn Wu "Failed to get 'enable' gpio\n");
303e7647de0SChiaEn Wu
304e7647de0SChiaEn Wu ret = mt6370_init_backlight_properties(priv, &props);
305e7647de0SChiaEn Wu if (ret)
306e7647de0SChiaEn Wu return dev_err_probe(dev, ret,
307e7647de0SChiaEn Wu "Failed to init backlight properties\n");
308e7647de0SChiaEn Wu
309e7647de0SChiaEn Wu priv->bl = devm_backlight_device_register(dev, pdev->name, dev, priv,
310e7647de0SChiaEn Wu &mt6370_bl_ops, &props);
311e7647de0SChiaEn Wu if (IS_ERR(priv->bl))
312e7647de0SChiaEn Wu return dev_err_probe(dev, PTR_ERR(priv->bl),
313e7647de0SChiaEn Wu "Failed to register backlight\n");
314e7647de0SChiaEn Wu
315e7647de0SChiaEn Wu backlight_update_status(priv->bl);
316e7647de0SChiaEn Wu platform_set_drvdata(pdev, priv);
317e7647de0SChiaEn Wu
318e7647de0SChiaEn Wu return 0;
319e7647de0SChiaEn Wu }
320e7647de0SChiaEn Wu
mt6370_bl_remove(struct platform_device * pdev)321*519e5cc5SUwe Kleine-König static void mt6370_bl_remove(struct platform_device *pdev)
322e7647de0SChiaEn Wu {
323e7647de0SChiaEn Wu struct mt6370_priv *priv = platform_get_drvdata(pdev);
324e7647de0SChiaEn Wu struct backlight_device *bl_dev = priv->bl;
325e7647de0SChiaEn Wu
326e7647de0SChiaEn Wu bl_dev->props.brightness = 0;
327e7647de0SChiaEn Wu backlight_update_status(priv->bl);
328e7647de0SChiaEn Wu }
329e7647de0SChiaEn Wu
330e7647de0SChiaEn Wu static const struct of_device_id mt6370_bl_of_match[] = {
331e7647de0SChiaEn Wu { .compatible = "mediatek,mt6370-backlight", .data = (void *)MT6370_VID_COMMON },
332e7647de0SChiaEn Wu { .compatible = "mediatek,mt6372-backlight", .data = (void *)MT6370_VID_6372 },
333e7647de0SChiaEn Wu {}
334e7647de0SChiaEn Wu };
335e7647de0SChiaEn Wu MODULE_DEVICE_TABLE(of, mt6370_bl_of_match);
336e7647de0SChiaEn Wu
337e7647de0SChiaEn Wu static struct platform_driver mt6370_bl_driver = {
338e7647de0SChiaEn Wu .driver = {
339e7647de0SChiaEn Wu .name = "mt6370-backlight",
340e7647de0SChiaEn Wu .of_match_table = mt6370_bl_of_match,
341e7647de0SChiaEn Wu },
342e7647de0SChiaEn Wu .probe = mt6370_bl_probe,
343*519e5cc5SUwe Kleine-König .remove_new = mt6370_bl_remove,
344e7647de0SChiaEn Wu };
345e7647de0SChiaEn Wu module_platform_driver(mt6370_bl_driver);
346e7647de0SChiaEn Wu
347e7647de0SChiaEn Wu MODULE_AUTHOR("ChiaEn Wu <chiaen_wu@richtek.com>");
348e7647de0SChiaEn Wu MODULE_DESCRIPTION("MediaTek MT6370 Backlight Driver");
349e7647de0SChiaEn Wu MODULE_LICENSE("GPL v2");
350