^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Based on pwm_bl.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct led_bl_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct backlight_device *bl_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct led_classdev **leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) bool enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) int nb_leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) unsigned int *levels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned int default_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned int max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static void led_bl_set_brightness(struct led_bl_data *priv, int level)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int bkl_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) if (priv->levels)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) bkl_brightness = priv->levels[level];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) bkl_brightness = level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) for (i = 0; i < priv->nb_leds; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) led_set_brightness(priv->leds[i], bkl_brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) priv->enabled = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static void led_bl_power_off(struct led_bl_data *priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) if (!priv->enabled)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) for (i = 0; i < priv->nb_leds; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) led_set_brightness(priv->leds[i], LED_OFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) priv->enabled = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static int led_bl_update_status(struct backlight_device *bl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) struct led_bl_data *priv = bl_get_data(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) int brightness = backlight_get_brightness(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) if (brightness > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) led_bl_set_brightness(priv, brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) led_bl_power_off(priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static const struct backlight_ops led_bl_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .update_status = led_bl_update_status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static int led_bl_get_leds(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct led_bl_data *priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) int i, nb_leds, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct device_node *node = dev->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct led_classdev **leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) unsigned int max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) unsigned int default_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ret = of_count_phandle_with_args(node, "leds", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) dev_err(dev, "Unable to get led count\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) nb_leds = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) if (nb_leds < 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) dev_err(dev, "At least one LED must be specified!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) if (!leds)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) for (i = 0; i < nb_leds; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) leds[i] = devm_of_led_get(dev, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) if (IS_ERR(leds[i]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) return PTR_ERR(leds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* check that the LEDs all have the same brightness range */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) max_brightness = leds[0]->max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) for (i = 1; i < nb_leds; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) if (max_brightness != leds[i]->max_brightness) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) dev_err(dev, "LEDs must have identical ranges\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) /* get the default brightness from the first LED from the list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) default_brightness = leds[0]->brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) priv->nb_leds = nb_leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) priv->leds = leds;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) priv->max_brightness = max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) priv->default_brightness = default_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static int led_bl_parse_levels(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct led_bl_data *priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct device_node *node = dev->of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) int num_levels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) u32 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) if (!node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) num_levels = of_property_count_u32_elems(node, "brightness-levels");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) if (num_levels > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) unsigned int db;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) u32 *levels = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) levels = devm_kzalloc(dev, sizeof(u32) * num_levels,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (!levels)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) ret = of_property_read_u32_array(node, "brightness-levels",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) levels,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) num_levels);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * Try to map actual LED brightness to backlight brightness
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) db = priv->default_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) for (i = 0 ; i < num_levels; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) if ((i && db > levels[i-1]) && db <= levels[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) priv->default_brightness = i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) priv->max_brightness = num_levels - 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) priv->levels = levels;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) } else if (num_levels >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) dev_warn(dev, "Not enough levels defined\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) ret = of_property_read_u32(node, "default-brightness-level", &value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) if (!ret && value <= priv->max_brightness)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) priv->default_brightness = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) else if (!ret && value > priv->max_brightness)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) dev_warn(dev, "Invalid default brightness. Ignoring it\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static int led_bl_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) struct backlight_properties props;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct led_bl_data *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) int ret, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (!priv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) platform_set_drvdata(pdev, priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) priv->dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) ret = led_bl_get_leds(&pdev->dev, priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ret = led_bl_parse_levels(&pdev->dev, priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) dev_err(&pdev->dev, "Failed to parse DT data\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) memset(&props, 0, sizeof(struct backlight_properties));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) props.type = BACKLIGHT_RAW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) props.max_brightness = priv->max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) props.brightness = priv->default_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) props.power = (priv->default_brightness > 0) ? FB_BLANK_POWERDOWN :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) FB_BLANK_UNBLANK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) priv->bl_dev = backlight_device_register(dev_name(&pdev->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) &pdev->dev, priv, &led_bl_ops, &props);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if (IS_ERR(priv->bl_dev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) dev_err(&pdev->dev, "Failed to register backlight\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) return PTR_ERR(priv->bl_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) for (i = 0; i < priv->nb_leds; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) led_sysfs_disable(priv->leds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) backlight_update_status(priv->bl_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) static int led_bl_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) struct led_bl_data *priv = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) struct backlight_device *bl = priv->bl_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) backlight_device_unregister(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) led_bl_power_off(priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) for (i = 0; i < priv->nb_leds; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) led_sysfs_enable(priv->leds[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) static const struct of_device_id led_bl_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) { .compatible = "led-backlight" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) MODULE_DEVICE_TABLE(of, led_bl_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) static struct platform_driver led_bl_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) .name = "led-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) .of_match_table = of_match_ptr(led_bl_of_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) .probe = led_bl_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .remove = led_bl_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) module_platform_driver(led_bl_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) MODULE_DESCRIPTION("LED based Backlight Driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) MODULE_ALIAS("platform:led-backlight");