Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Backlight driver for the Kinetic KTD253
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Based on code and know-how from the Samsung GT-S7710
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Gareth Phillips <gareth.phillips@samsung.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/gpio/consumer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/limits.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/property.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /* Current ratio is n/32 from 1/32 to 32/32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define KTD253_MIN_RATIO 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define KTD253_MAX_RATIO 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define KTD253_DEFAULT_RATIO 13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define KTD253_T_LOW_NS (200 + 10) /* Additional 10ns as safety factor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define KTD253_T_HIGH_NS (200 + 10) /* Additional 10ns as safety factor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define KTD253_T_OFF_CRIT_NS 100000 /* 100 us, now it doesn't look good */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define KTD253_T_OFF_MS 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) struct ktd253_backlight {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct backlight_device *bl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	struct gpio_desc *gpiod;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	u16 ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) static void ktd253_backlight_set_max_ratio(struct ktd253_backlight *ktd253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	gpiod_set_value_cansleep(ktd253->gpiod, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	ndelay(KTD253_T_HIGH_NS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	/* We always fall back to this when we power on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static int ktd253_backlight_stepdown(struct ktd253_backlight *ktd253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	 * These GPIO operations absolutely can NOT sleep so no _cansleep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	 * suffixes, and no using GPIO expanders on slow buses for this!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	 * The maximum number of cycles of the loop is 32  so the time taken
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	 * should nominally be:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	 * (T_LOW_NS + T_HIGH_NS + loop_time) * 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	 * Architectures do not always support ndelay() and we will get a few us
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	 * instead. If we get to a critical time limit an interrupt has likely
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	 * occured in the low part of the loop and we need to restart from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	 * top so we have the backlight in a known state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	u64 ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	ns = ktime_get_ns();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	gpiod_set_value(ktd253->gpiod, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	ndelay(KTD253_T_LOW_NS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	gpiod_set_value(ktd253->gpiod, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	ns = ktime_get_ns() - ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	if (ns >= KTD253_T_OFF_CRIT_NS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		dev_err(ktd253->dev, "PCM on backlight took too long (%llu ns)\n", ns);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		return -EAGAIN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	ndelay(KTD253_T_HIGH_NS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static int ktd253_backlight_update_status(struct backlight_device *bl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	struct ktd253_backlight *ktd253 = bl_get_data(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	int brightness = backlight_get_brightness(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	u16 target_ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	u16 current_ratio = ktd253->ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	dev_dbg(ktd253->dev, "new brightness/ratio: %d/32\n", brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	target_ratio = brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	if (target_ratio == current_ratio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		/* This is already right */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	if (target_ratio == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		gpiod_set_value_cansleep(ktd253->gpiod, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		 * We need to keep the GPIO low for at least this long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		 * to actually switch the KTD253 off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		msleep(KTD253_T_OFF_MS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		ktd253->ratio = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	if (current_ratio == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		ktd253_backlight_set_max_ratio(ktd253);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		current_ratio = KTD253_MAX_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	while (current_ratio != target_ratio) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		 * These GPIO operations absolutely can NOT sleep so no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		 * _cansleep suffixes, and no using GPIO expanders on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		 * slow buses for this!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		ret = ktd253_backlight_stepdown(ktd253);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		if (ret == -EAGAIN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			 * Something disturbed the backlight setting code when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			 * running so we need to bring the PWM back to a known
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			 * state. This shouldn't happen too much.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			gpiod_set_value_cansleep(ktd253->gpiod, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 			msleep(KTD253_T_OFF_MS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			ktd253_backlight_set_max_ratio(ktd253);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			current_ratio = KTD253_MAX_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		} else if (current_ratio == KTD253_MIN_RATIO) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			/* After 1/32 we loop back to 32/32 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			current_ratio = KTD253_MAX_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			current_ratio--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	ktd253->ratio = current_ratio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	dev_dbg(ktd253->dev, "new ratio set to %d/32\n", target_ratio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static const struct backlight_ops ktd253_backlight_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	.options	= BL_CORE_SUSPENDRESUME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	.update_status	= ktd253_backlight_update_status,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static int ktd253_backlight_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	struct backlight_device *bl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	struct ktd253_backlight *ktd253;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	u32 max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	u32 brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	ktd253 = devm_kzalloc(dev, sizeof(*ktd253), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	if (!ktd253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	ktd253->dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	ret = device_property_read_u32(dev, "max-brightness", &max_brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		max_brightness = KTD253_MAX_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	if (max_brightness > KTD253_MAX_RATIO) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		/* Clamp brightness to hardware max */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		dev_err(dev, "illegal max brightness specified\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		max_brightness = KTD253_MAX_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	ret = device_property_read_u32(dev, "default-brightness", &brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		brightness = KTD253_DEFAULT_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	if (brightness > max_brightness) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		/* Clamp default brightness to max brightness */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		dev_err(dev, "default brightness exceeds max brightness\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		brightness = max_brightness;
^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) 	if (brightness)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		/* This will be the default ratio when the KTD253 is enabled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		ktd253->ratio = KTD253_MAX_RATIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		ktd253->ratio = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	ktd253->gpiod = devm_gpiod_get(dev, "enable",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 				       brightness ? GPIOD_OUT_HIGH :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 				       GPIOD_OUT_LOW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (IS_ERR(ktd253->gpiod)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		ret = PTR_ERR(ktd253->gpiod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		if (ret != -EPROBE_DEFER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			dev_err(dev, "gpio line missing or invalid.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 					    &ktd253_backlight_ops, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	if (IS_ERR(bl)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		dev_err(dev, "failed to register backlight\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		return PTR_ERR(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	bl->props.max_brightness = max_brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	/* When we just enable the GPIO line we set max brightness */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	if (brightness) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		bl->props.brightness = brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		bl->props.power = FB_BLANK_UNBLANK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		bl->props.brightness = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		bl->props.power = FB_BLANK_POWERDOWN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	ktd253->bl = bl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	platform_set_drvdata(pdev, bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	backlight_update_status(bl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) static const struct of_device_id ktd253_backlight_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	{ .compatible = "kinetic,ktd253" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	{ /* sentinel */ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) MODULE_DEVICE_TABLE(of, ktd253_backlight_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static struct platform_driver ktd253_backlight_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		.name = "ktd253-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		.of_match_table = ktd253_backlight_of_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.probe		= ktd253_backlight_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) module_platform_driver(ktd253_backlight_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) MODULE_AUTHOR("Linus Walleij <linus.walleij@linaro.org>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) MODULE_DESCRIPTION("Kinetic KTD253 Backlight Driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) MODULE_ALIAS("platform:ktd253-backlight");