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

drm/panel: startek-kd070fhfid015: transition to mipi_dsi wrapped functions

Use multi style wrapped functions for mipi_dsi in the
startek-kd070fhfid015 panel.

Signed-off-by: Tejas Vipin <tejasvipin76@gmail.com>
Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240806135949.468636-3-tejasvipin76@gmail.com

authored by

Tejas Vipin and committed by
Douglas Anderson
b080a607 5ddb0a8a

+35 -80
+35 -80
drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
··· 24 24 #include <drm/drm_modes.h> 25 25 #include <drm/drm_panel.h> 26 26 27 - #define DSI_REG_MCAP 0xB0 28 - #define DSI_REG_IS 0xB3 /* Interface Setting */ 29 - #define DSI_REG_IIS 0xB4 /* Interface ID Setting */ 30 - #define DSI_REG_CTRL 0xB6 27 + #define DSI_REG_MCAP 0xb0 28 + #define DSI_REG_IS 0xb3 /* Interface Setting */ 29 + #define DSI_REG_IIS 0xb4 /* Interface ID Setting */ 30 + #define DSI_REG_CTRL 0xb6 31 31 32 32 enum { 33 33 IOVCC = 0, ··· 52 52 static int stk_panel_init(struct stk_panel *stk) 53 53 { 54 54 struct mipi_dsi_device *dsi = stk->dsi; 55 - struct device *dev = &stk->dsi->dev; 56 - int ret; 55 + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi}; 57 56 58 - ret = mipi_dsi_dcs_soft_reset(dsi); 59 - if (ret < 0) { 60 - dev_err(dev, "failed to mipi_dsi_dcs_soft_reset: %d\n", ret); 61 - return ret; 62 - } 63 - mdelay(5); 57 + mipi_dsi_dcs_soft_reset_multi(&dsi_ctx); 58 + mipi_dsi_msleep(&dsi_ctx, 5); 59 + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); 60 + mipi_dsi_msleep(&dsi_ctx, 120); 64 61 65 - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); 66 - if (ret < 0) { 67 - dev_err(dev, "failed to set exit sleep mode: %d\n", ret); 68 - return ret; 69 - } 70 - msleep(120); 71 - 72 - mipi_dsi_generic_write_seq(dsi, DSI_REG_MCAP, 0x04); 62 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_MCAP, 0x04); 73 63 74 64 /* Interface setting, video mode */ 75 - mipi_dsi_generic_write_seq(dsi, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00); 76 - mipi_dsi_generic_write_seq(dsi, DSI_REG_IIS, 0x0C, 0x00); 77 - mipi_dsi_generic_write_seq(dsi, DSI_REG_CTRL, 0x3A, 0xD3); 65 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00); 66 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IIS, 0x0c, 0x00); 67 + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_CTRL, 0x3a, 0xd3); 78 68 79 - ret = mipi_dsi_dcs_set_display_brightness(dsi, 0x77); 80 - if (ret < 0) { 81 - dev_err(dev, "failed to write display brightness: %d\n", ret); 82 - return ret; 83 - } 69 + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x77); 84 70 85 - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 86 - MIPI_DCS_WRITE_MEMORY_START); 71 + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, 72 + MIPI_DCS_WRITE_MEMORY_START); 87 73 88 - ret = mipi_dsi_dcs_set_pixel_format(dsi, 0x77); 89 - if (ret < 0) { 90 - dev_err(dev, "failed to set pixel format: %d\n", ret); 91 - return ret; 92 - } 74 + mipi_dsi_dcs_set_pixel_format_multi(&dsi_ctx, 0x77); 75 + mipi_dsi_dcs_set_column_address_multi(&dsi_ctx, 0, stk->mode->hdisplay - 1); 76 + mipi_dsi_dcs_set_page_address_multi(&dsi_ctx, 0, stk->mode->vdisplay - 1); 93 77 94 - ret = mipi_dsi_dcs_set_column_address(dsi, 0, stk->mode->hdisplay - 1); 95 - if (ret < 0) { 96 - dev_err(dev, "failed to set column address: %d\n", ret); 97 - return ret; 98 - } 99 - 100 - ret = mipi_dsi_dcs_set_page_address(dsi, 0, stk->mode->vdisplay - 1); 101 - if (ret < 0) { 102 - dev_err(dev, "failed to set page address: %d\n", ret); 103 - return ret; 104 - } 105 - 106 - return 0; 78 + return dsi_ctx.accum_err; 107 79 } 108 80 109 81 static int stk_panel_on(struct stk_panel *stk) 110 82 { 111 83 struct mipi_dsi_device *dsi = stk->dsi; 112 - struct device *dev = &stk->dsi->dev; 113 - int ret; 84 + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi}; 114 85 115 - ret = mipi_dsi_dcs_set_display_on(dsi); 116 - if (ret < 0) 117 - dev_err(dev, "failed to set display on: %d\n", ret); 86 + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); 118 87 119 - mdelay(20); 88 + mipi_dsi_msleep(&dsi_ctx, 20); 120 89 121 - return ret; 90 + return dsi_ctx.accum_err; 122 91 } 123 92 124 93 static void stk_panel_off(struct stk_panel *stk) 125 94 { 126 95 struct mipi_dsi_device *dsi = stk->dsi; 127 - struct device *dev = &stk->dsi->dev; 128 - int ret; 96 + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi}; 129 97 130 98 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; 131 99 132 - ret = mipi_dsi_dcs_set_display_off(dsi); 133 - if (ret < 0) 134 - dev_err(dev, "failed to set display off: %d\n", ret); 100 + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); 101 + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); 135 102 136 - ret = mipi_dsi_dcs_enter_sleep_mode(dsi); 137 - if (ret < 0) 138 - dev_err(dev, "failed to enter sleep mode: %d\n", ret); 139 - 140 - msleep(100); 103 + mipi_dsi_msleep(&dsi_ctx, 100); 141 104 } 142 105 143 106 static int stk_panel_unprepare(struct drm_panel *panel) ··· 118 155 static int stk_panel_prepare(struct drm_panel *panel) 119 156 { 120 157 struct stk_panel *stk = to_stk_panel(panel); 121 - struct device *dev = &stk->dsi->dev; 122 158 int ret; 123 159 124 160 gpiod_set_value(stk->reset_gpio, 0); ··· 137 175 gpiod_set_value(stk->reset_gpio, 1); 138 176 mdelay(10); 139 177 ret = stk_panel_init(stk); 140 - if (ret < 0) { 141 - dev_err(dev, "failed to init panel: %d\n", ret); 178 + if (ret < 0) 142 179 goto poweroff; 143 - } 144 180 145 181 ret = stk_panel_on(stk); 146 - if (ret < 0) { 147 - dev_err(dev, "failed to set panel on: %d\n", ret); 182 + if (ret < 0) 148 183 goto poweroff; 149 - } 150 184 151 185 return 0; 152 186 ··· 208 250 static int dsi_dcs_bl_update_status(struct backlight_device *bl) 209 251 { 210 252 struct mipi_dsi_device *dsi = bl_get_data(bl); 211 - struct device *dev = &dsi->dev; 212 - int ret; 253 + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi}; 213 254 214 255 dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; 215 - ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness); 216 - if (ret < 0) { 217 - dev_err(dev, "failed to set DSI control: %d\n", ret); 218 - return ret; 219 - } 256 + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, bl->props.brightness); 257 + if (dsi_ctx.accum_err) 258 + return dsi_ctx.accum_err; 220 259 221 260 dsi->mode_flags |= MIPI_DSI_MODE_LPM; 222 - return 0; 261 + return dsi_ctx.accum_err; 223 262 } 224 263 225 264 static const struct backlight_ops dsi_bl_ops = {