mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 19:13:03 -04:00
drm/ssd130x: Add per-family update backlight logic
ssd130x_update_bl() runs for every SSD13xx panel, but it only works for SSD130x and SSD132x: it writes the single global SSD13XX_CONTRAST (0x81) command, which those two families expose. SSD133x has no such command -- it has three per-channel contrast registers (CONTRAST_A/B/C) that must be scaled together -- so ssd130x_update_bl() has no effect on it. Make backlight_ops.update_status a per-family choice. SSD130x and SSD132x keep ssd130x_update_bl() because they share the SSD13XX_CONTRAST interface, while SSD133x gets ssd133x_update_bl(), which drives the three channels through ssd133x_set_contrast(). Signed-off-by: Amit Barzilai <amit.barzilai22@gmail.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260729053054.29374-3-amit.barzilai22@gmail.com Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
committed by
Javier Martinez Canillas
parent
a16d5be8ea
commit
2996ceebe3
@@ -1711,8 +1711,25 @@ static int ssd130x_update_bl(struct backlight_device *bdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct backlight_ops ssd130xfb_bl_ops = {
|
||||
.update_status = ssd130x_update_bl,
|
||||
static int ssd133x_update_bl(struct backlight_device *bdev)
|
||||
{
|
||||
struct ssd130x_device *ssd130x = bl_get_data(bdev);
|
||||
|
||||
ssd130x->contrast = backlight_get_brightness(bdev);
|
||||
|
||||
return ssd133x_set_contrast(ssd130x, ssd130x->contrast);
|
||||
}
|
||||
|
||||
static const struct backlight_ops ssd130xfb_bl_ops[] = {
|
||||
[SSD130X_FAMILY] = {
|
||||
.update_status = ssd130x_update_bl,
|
||||
},
|
||||
[SSD132X_FAMILY] = {
|
||||
.update_status = ssd130x_update_bl,
|
||||
},
|
||||
[SSD133X_FAMILY] = {
|
||||
.update_status = ssd133x_update_bl,
|
||||
},
|
||||
};
|
||||
|
||||
static void ssd130x_parse_properties(struct ssd130x_device *ssd130x)
|
||||
@@ -1919,7 +1936,8 @@ struct ssd130x_device *ssd130x_probe(struct device *dev, struct regmap *regmap)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
bl = devm_backlight_device_register(dev, dev_name(dev), dev, ssd130x,
|
||||
&ssd130xfb_bl_ops, NULL);
|
||||
&ssd130xfb_bl_ops[ssd130x->device_info->family_id],
|
||||
NULL);
|
||||
if (IS_ERR(bl))
|
||||
return ERR_PTR(dev_err_probe(dev, PTR_ERR(bl),
|
||||
"Unable to register backlight device\n"));
|
||||
|
||||
Reference in New Issue
Block a user