mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
drm/panel: himax-hx83121a: add backlight regulator support
The backlight, when managed by the panel controller, could be powered by an external regulator, and shutting down the regulator could power off the backlight. Add support for such a regulator. It's powered off when the backlight is 0 (either by setting brightness to 0 or setting bl_power), and powered on when the backlight should be operating. Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20260608162622.403713-3-zhengxingda@iscas.ac.cn
This commit is contained in:
committed by
Neil Armstrong
parent
ae8dbbe895
commit
98b46e693b
@@ -34,7 +34,9 @@ struct himax {
|
||||
struct drm_dsc_config dsc;
|
||||
struct gpio_desc *reset_gpio;
|
||||
struct regulator_bulk_data *supplies;
|
||||
struct regulator *bl_supply;
|
||||
struct backlight_device *backlight;
|
||||
bool backlight_enabled;
|
||||
};
|
||||
|
||||
struct panel_desc {
|
||||
@@ -195,7 +197,27 @@ static int himax_bl_update_status(struct backlight_device *bl)
|
||||
{
|
||||
struct himax *ctx = bl_get_data(bl);
|
||||
u16 brightness = backlight_get_brightness(bl);
|
||||
int ret = 0;
|
||||
|
||||
if (!brightness) {
|
||||
if (ctx->backlight_enabled)
|
||||
ret = regulator_disable(ctx->bl_supply);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ctx->backlight_enabled = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* TODO: brightness to raw map table */
|
||||
if (!ctx->backlight_enabled)
|
||||
ret = regulator_enable(ctx->bl_supply);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ctx->backlight_enabled = true;
|
||||
|
||||
return mipi_dsi_dcs_set_display_brightness_large(to_primary_dsi(ctx),
|
||||
brightness);
|
||||
}
|
||||
@@ -647,6 +669,10 @@ static int himax_probe(struct mipi_dsi_device *dsi)
|
||||
ctx->panel.prepare_prev_first = true;
|
||||
|
||||
if (desc->has_dcs_backlight) {
|
||||
ctx->bl_supply = devm_regulator_get_optional(dev, "bl");
|
||||
if (IS_ERR(ctx->bl_supply))
|
||||
return dev_err_probe(dev, PTR_ERR(ctx->bl_supply),
|
||||
"Failed to get backlight supply\n");
|
||||
ctx->backlight = himax_create_backlight(ctx);
|
||||
if (IS_ERR(ctx->backlight))
|
||||
return dev_err_probe(dev, PTR_ERR(ctx->backlight),
|
||||
|
||||
Reference in New Issue
Block a user