diff options
Diffstat (limited to 'drivers/gpu/drm/panel/panel-lg-sw43408.c')
| -rw-r--r-- | drivers/gpu/drm/panel/panel-lg-sw43408.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c b/drivers/gpu/drm/panel/panel-lg-sw43408.c index 46a56ea92ad9..293826c5006b 100644 --- a/drivers/gpu/drm/panel/panel-lg-sw43408.c +++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c @@ -20,13 +20,18 @@ #include <drm/display/drm_dsc.h> #include <drm/display/drm_dsc_helper.h> -#define NUM_SUPPLIES 2 +static const struct regulator_bulk_data sw43408_supplies[] = { + { .supply = "vddi", /* 1.8 V */ + .init_load_uA = 62000 }, + { .supply = "vpnl", /* 3.0 V */ + .init_load_uA = 857000 }, +}; struct sw43408_panel { struct drm_panel base; struct mipi_dsi_device *link; - struct regulator_bulk_data supplies[NUM_SUPPLIES]; + struct regulator_bulk_data *supplies; struct gpio_desc *reset_gpio; @@ -52,7 +57,7 @@ static int sw43408_unprepare(struct drm_panel *panel) gpiod_set_value(sw43408->reset_gpio, 1); - ret = regulator_bulk_disable(ARRAY_SIZE(sw43408->supplies), sw43408->supplies); + ret = regulator_bulk_disable(ARRAY_SIZE(sw43408_supplies), sw43408->supplies); return ret ? : ctx.accum_err; } @@ -119,23 +124,28 @@ static int sw43408_program(struct drm_panel *panel) return ctx.accum_err; } +static void sw43408_reset(struct sw43408_panel *ctx) +{ + gpiod_set_value(ctx->reset_gpio, 0); + usleep_range(9000, 10000); + gpiod_set_value(ctx->reset_gpio, 1); + usleep_range(1000, 2000); + gpiod_set_value(ctx->reset_gpio, 0); + usleep_range(9000, 10000); +} + static int sw43408_prepare(struct drm_panel *panel) { struct sw43408_panel *ctx = to_panel_info(panel); int ret; - ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + ret = regulator_bulk_enable(ARRAY_SIZE(sw43408_supplies), ctx->supplies); if (ret < 0) return ret; usleep_range(5000, 6000); - gpiod_set_value(ctx->reset_gpio, 0); - usleep_range(9000, 10000); - gpiod_set_value(ctx->reset_gpio, 1); - usleep_range(1000, 2000); - gpiod_set_value(ctx->reset_gpio, 0); - usleep_range(9000, 10000); + sw43408_reset(ctx); ret = sw43408_program(panel); if (ret) @@ -145,11 +155,11 @@ static int sw43408_prepare(struct drm_panel *panel) poweroff: gpiod_set_value(ctx->reset_gpio, 1); - regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); + regulator_bulk_disable(ARRAY_SIZE(sw43408_supplies), ctx->supplies); return ret; } -static const struct drm_display_mode sw43408_mode = { +static const struct drm_display_mode lh546wf1_ed01_mode = { .clock = (1080 + 20 + 32 + 20) * (2160 + 20 + 4 + 20) * 60 / 1000, .hdisplay = 1080, @@ -171,7 +181,7 @@ static const struct drm_display_mode sw43408_mode = { static int sw43408_get_modes(struct drm_panel *panel, struct drm_connector *connector) { - return drm_connector_helper_get_modes_fixed(connector, &sw43408_mode); + return drm_connector_helper_get_modes_fixed(connector, &lh546wf1_ed01_mode); } static int sw43408_backlight_update_status(struct backlight_device *bl) @@ -214,7 +224,8 @@ static const struct drm_panel_funcs sw43408_funcs = { }; static const struct of_device_id sw43408_of_match[] = { - { .compatible = "lg,sw43408", }, + { .compatible = "lg,sw43408", }, /* legacy */ + { .compatible = "lg,sw43408-lh546wf1-ed01", }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sw43408_of_match); @@ -224,20 +235,17 @@ static int sw43408_add(struct sw43408_panel *ctx) struct device *dev = &ctx->link->dev; int ret; - ctx->supplies[0].supply = "vddi"; /* 1.88 V */ - ctx->supplies[0].init_load_uA = 62000; - ctx->supplies[1].supply = "vpnl"; /* 3.0 V */ - ctx->supplies[1].init_load_uA = 857000; - - ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), - ctx->supplies); + ret = devm_regulator_bulk_get_const(dev, + ARRAY_SIZE(sw43408_supplies), + sw43408_supplies, + &ctx->supplies); if (ret < 0) return ret; ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ctx->reset_gpio)) { - ret = PTR_ERR(ctx->reset_gpio); - return dev_err_probe(dev, ret, "cannot get reset gpio\n"); + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), + "Failed to get reset-gpios\n"); } ret = sw43408_backlight_init(ctx); @@ -294,10 +302,6 @@ static void sw43408_remove(struct mipi_dsi_device *dsi) struct sw43408_panel *ctx = mipi_dsi_get_drvdata(dsi); int ret; - ret = sw43408_unprepare(&ctx->base); - if (ret < 0) - dev_err(&dsi->dev, "failed to unprepare panel: %d\n", ret); - ret = mipi_dsi_detach(dsi); if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); |
