Lines Matching full:ktd253
3 * Backlight driver for the Kinetic KTD253
38 static void ktd253_backlight_set_max_ratio(struct ktd253_backlight *ktd253) in ktd253_backlight_set_max_ratio() argument
40 gpiod_set_value_cansleep(ktd253->gpiod, 1); in ktd253_backlight_set_max_ratio()
45 static int ktd253_backlight_stepdown(struct ktd253_backlight *ktd253) in ktd253_backlight_stepdown() argument
63 gpiod_set_value(ktd253->gpiod, 0); in ktd253_backlight_stepdown()
65 gpiod_set_value(ktd253->gpiod, 1); in ktd253_backlight_stepdown()
68 dev_err(ktd253->dev, "PCM on backlight took too long (%llu ns)\n", ns); in ktd253_backlight_stepdown()
77 struct ktd253_backlight *ktd253 = bl_get_data(bl); in ktd253_backlight_update_status() local
80 u16 current_ratio = ktd253->ratio; in ktd253_backlight_update_status()
83 dev_dbg(ktd253->dev, "new brightness/ratio: %d/32\n", brightness); in ktd253_backlight_update_status()
92 gpiod_set_value_cansleep(ktd253->gpiod, 0); in ktd253_backlight_update_status()
95 * to actually switch the KTD253 off. in ktd253_backlight_update_status()
98 ktd253->ratio = 0; in ktd253_backlight_update_status()
103 ktd253_backlight_set_max_ratio(ktd253); in ktd253_backlight_update_status()
113 ret = ktd253_backlight_stepdown(ktd253); in ktd253_backlight_update_status()
120 gpiod_set_value_cansleep(ktd253->gpiod, 0); in ktd253_backlight_update_status()
122 ktd253_backlight_set_max_ratio(ktd253); in ktd253_backlight_update_status()
131 ktd253->ratio = current_ratio; in ktd253_backlight_update_status()
133 dev_dbg(ktd253->dev, "new ratio set to %d/32\n", target_ratio); in ktd253_backlight_update_status()
147 struct ktd253_backlight *ktd253; in ktd253_backlight_probe() local
152 ktd253 = devm_kzalloc(dev, sizeof(*ktd253), GFP_KERNEL); in ktd253_backlight_probe()
153 if (!ktd253) in ktd253_backlight_probe()
155 ktd253->dev = dev; in ktd253_backlight_probe()
175 ktd253->gpiod = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); in ktd253_backlight_probe()
176 if (IS_ERR(ktd253->gpiod)) { in ktd253_backlight_probe()
177 ret = PTR_ERR(ktd253->gpiod); in ktd253_backlight_probe()
182 gpiod_set_consumer_name(ktd253->gpiod, dev_name(dev)); in ktd253_backlight_probe()
186 bl = devm_backlight_device_register(dev, dev_name(dev), dev, ktd253, in ktd253_backlight_probe()
202 ktd253->bl = bl; in ktd253_backlight_probe()
210 { .compatible = "kinetic,ktd253" },
218 .name = "ktd253-backlight",
226 MODULE_DESCRIPTION("Kinetic KTD253 Backlight Driver");
228 MODULE_ALIAS("platform:ktd253-backlight");