Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panel: samsung-s6e88a0-ams452ef01: transition to mipi_dsi wrapped functions

Changes the samsung-s6e88a0-ams452ef01 panel to use multi style functions
for improved error handling.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250122031110.286079-1-tejasvipin76@gmail.com

authored by

Tejas Vipin and committed by
Douglas Anderson
ce8c69ec 7f3b1193

+31 -60
+31 -60
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c
··· 39 39 static int s6e88a0_ams452ef01_on(struct s6e88a0_ams452ef01 *ctx) 40 40 { 41 41 struct mipi_dsi_device *dsi = ctx->dsi; 42 - struct device *dev = &dsi->dev; 43 - int ret; 42 + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; 44 43 45 44 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 46 45 47 - mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); // enable LEVEL2 commands 48 - mipi_dsi_dcs_write_seq(dsi, 0xcc, 0x4c); // set Pixel Clock Divider polarity 46 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); // enable LEVEL2 commands 47 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcc, 0x4c); // set Pixel Clock Divider polarity 49 48 50 - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 51 - if (ret < 0) { 52 - dev_err(dev, "Failed to exit sleep mode: %d\n", ret); 53 - return ret; 54 - } 55 - msleep(120); 49 + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); 50 + mipi_dsi_msleep(&dsi_ctx, 120); 56 51 57 52 // set default brightness/gama 58 - mipi_dsi_dcs_write_seq(dsi, 0xca, 59 - 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, // V255 RR,GG,BB 60 - 0x80, 0x80, 0x80, // V203 R,G,B 61 - 0x80, 0x80, 0x80, // V151 R,G,B 62 - 0x80, 0x80, 0x80, // V87 R,G,B 63 - 0x80, 0x80, 0x80, // V51 R,G,B 64 - 0x80, 0x80, 0x80, // V35 R,G,B 65 - 0x80, 0x80, 0x80, // V23 R,G,B 66 - 0x80, 0x80, 0x80, // V11 R,G,B 67 - 0x6b, 0x68, 0x71, // V3 R,G,B 68 - 0x00, 0x00, 0x00); // V1 R,G,B 53 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xca, 54 + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,// V255 RR,GG,BB 55 + 0x80, 0x80, 0x80, // V203 R,G,B 56 + 0x80, 0x80, 0x80, // V151 R,G,B 57 + 0x80, 0x80, 0x80, // V87 R,G,B 58 + 0x80, 0x80, 0x80, // V51 R,G,B 59 + 0x80, 0x80, 0x80, // V35 R,G,B 60 + 0x80, 0x80, 0x80, // V23 R,G,B 61 + 0x80, 0x80, 0x80, // V11 R,G,B 62 + 0x6b, 0x68, 0x71, // V3 R,G,B 63 + 0x00, 0x00, 0x00); // V1 R,G,B 69 64 // set default Amoled Off Ratio 70 - mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x40, 0x0a, 0x17, 0x00, 0x0a); 71 - mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x2c, 0x0b); // set default elvss voltage 72 - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 73 - mipi_dsi_dcs_write_seq(dsi, 0xf7, 0x03); // gamma/aor update 74 - mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); // disable LEVEL2 commands 65 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, 0x40, 0x0a, 0x17, 0x00, 0x0a); 66 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb6, 0x2c, 0x0b); // set default elvss voltage 67 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00); 68 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf7, 0x03); // gamma/aor update 69 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); // disable LEVEL2 commands 75 70 76 - ret = mipi_dsi_dcs_set_display_on(dsi); 77 - if (ret < 0) { 78 - dev_err(dev, "Failed to set display on: %d\n", ret); 79 - return ret; 80 - } 71 + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); 81 72 82 - return 0; 73 + return dsi_ctx.accum_err; 83 74 } 84 75 85 - static int s6e88a0_ams452ef01_off(struct s6e88a0_ams452ef01 *ctx) 76 + static void s6e88a0_ams452ef01_off(struct s6e88a0_ams452ef01 *ctx) 86 77 { 87 78 struct mipi_dsi_device *dsi = ctx->dsi; 88 - struct device *dev = &dsi->dev; 89 - int ret; 79 + struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi}; 90 80 91 81 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; 92 82 93 - ret = mipi_dsi_dcs_set_display_off(dsi); 94 - if (ret < 0) { 95 - dev_err(dev, "Failed to set display off: %d\n", ret); 96 - return ret; 97 - } 98 - msleep(35); 99 - 100 - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); 101 - if (ret < 0) { 102 - dev_err(dev, "Failed to enter sleep mode: %d\n", ret); 103 - return ret; 104 - } 105 - msleep(120); 106 - 107 - return 0; 83 + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); 84 + mipi_dsi_msleep(&dsi_ctx, 35); 85 + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); 86 + mipi_dsi_msleep(&dsi_ctx, 120); 108 87 } 109 88 110 89 static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel) 111 90 { 112 91 struct s6e88a0_ams452ef01 *ctx = to_s6e88a0_ams452ef01(panel); 113 - struct device *dev = &ctx->dsi->dev; 114 92 int ret; 115 93 116 94 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); 117 - if (ret < 0) { 118 - dev_err(dev, "Failed to enable regulators: %d\n", ret); 95 + if (ret < 0) 119 96 return ret; 120 - } 121 97 122 98 s6e88a0_ams452ef01_reset(ctx); 123 99 124 100 ret = s6e88a0_ams452ef01_on(ctx); 125 101 if (ret < 0) { 126 - dev_err(dev, "Failed to initialize panel: %d\n", ret); 127 102 gpiod_set_value_cansleep(ctx->reset_gpio, 0); 128 103 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), 129 104 ctx->supplies); ··· 111 136 static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel) 112 137 { 113 138 struct s6e88a0_ams452ef01 *ctx = to_s6e88a0_ams452ef01(panel); 114 - struct device *dev = &ctx->dsi->dev; 115 - int ret; 116 139 117 - ret = s6e88a0_ams452ef01_off(ctx); 118 - if (ret < 0) 119 - dev_err(dev, "Failed to un-initialize panel: %d\n", ret); 140 + s6e88a0_ams452ef01_off(ctx); 120 141 121 142 gpiod_set_value_cansleep(ctx->reset_gpio, 0); 122 143 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);