From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: Tejas Vipin <tejasvipin76@gmail.com>,
<maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
<tzimmermann@suse.de>, <neil.armstrong@linaro.org>
Cc: <dianders@chromium.org>, <airlied@gmail.com>, <daniel@ffwll.ch>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] drm/panel: startek-kd070fhfid015: transition to mipi_dsi wrapped functions
Date: Thu, 8 Aug 2024 14:02:17 -0700 [thread overview]
Message-ID: <61da2ecf-88c1-4d03-afb0-98f0395ad229@quicinc.com> (raw)
In-Reply-To: <20240806135949.468636-3-tejasvipin76@gmail.com>
On 8/6/2024 6:59 AM, Tejas Vipin wrote:
> 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>
> ---
> .../drm/panel/panel-startek-kd070fhfid015.c | 115 ++++++------------
> 1 file changed, 35 insertions(+), 80 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
> index 0156689f41cd..c0c95355b743 100644
> --- a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
> +++ b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c
> @@ -24,10 +24,10 @@
> #include <drm/drm_modes.h>
> #include <drm/drm_panel.h>
>
> -#define DSI_REG_MCAP 0xB0
> -#define DSI_REG_IS 0xB3 /* Interface Setting */
> -#define DSI_REG_IIS 0xB4 /* Interface ID Setting */
> -#define DSI_REG_CTRL 0xB6
> +#define DSI_REG_MCAP 0xb0
> +#define DSI_REG_IS 0xb3 /* Interface Setting */
> +#define DSI_REG_IIS 0xb4 /* Interface ID Setting */
> +#define DSI_REG_CTRL 0xb6
>
> enum {
> IOVCC = 0,
> @@ -52,92 +52,55 @@ static inline struct stk_panel *to_stk_panel(struct drm_panel *panel)
> static int stk_panel_init(struct stk_panel *stk)
> {
> struct mipi_dsi_device *dsi = stk->dsi;
> - struct device *dev = &stk->dsi->dev;
> - int ret;
> -
> - ret = mipi_dsi_dcs_soft_reset(dsi);
> - if (ret < 0) {
> - dev_err(dev, "failed to mipi_dsi_dcs_soft_reset: %d\n", ret);
> - return ret;
> - }
> - mdelay(5);
> + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>
> - ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> - if (ret < 0) {
> - dev_err(dev, "failed to set exit sleep mode: %d\n", ret);
> - return ret;
> - }
> - msleep(120);
> + mipi_dsi_dcs_soft_reset_multi(&dsi_ctx);
> + mipi_dsi_msleep(&dsi_ctx, 5);
> + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
> + mipi_dsi_msleep(&dsi_ctx, 120);
>
> - mipi_dsi_generic_write_seq(dsi, DSI_REG_MCAP, 0x04);
> + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_MCAP, 0x04);
>
> /* Interface setting, video mode */
> - mipi_dsi_generic_write_seq(dsi, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00);
> - mipi_dsi_generic_write_seq(dsi, DSI_REG_IIS, 0x0C, 0x00);
> - mipi_dsi_generic_write_seq(dsi, DSI_REG_CTRL, 0x3A, 0xD3);
> + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00);
> + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IIS, 0x0c, 0x00);
> + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_CTRL, 0x3a, 0xd3);
>
> - ret = mipi_dsi_dcs_set_display_brightness(dsi, 0x77);
> - if (ret < 0) {
> - dev_err(dev, "failed to write display brightness: %d\n", ret);
> - return ret;
> - }
> + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x77);
>
> - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY,
> - MIPI_DCS_WRITE_MEMORY_START);
> + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY,
> + MIPI_DCS_WRITE_MEMORY_START);
>
> - ret = mipi_dsi_dcs_set_pixel_format(dsi, 0x77);
> - if (ret < 0) {
> - dev_err(dev, "failed to set pixel format: %d\n", ret);
> - return ret;
> - }
> + mipi_dsi_dcs_set_pixel_format_multi(&dsi_ctx, 0x77);
> + mipi_dsi_dcs_set_column_address_multi(&dsi_ctx, 0, stk->mode->hdisplay - 1);
> + mipi_dsi_dcs_set_page_address_multi(&dsi_ctx, 0, stk->mode->vdisplay - 1);
>
> - ret = mipi_dsi_dcs_set_column_address(dsi, 0, stk->mode->hdisplay - 1);
> - if (ret < 0) {
> - dev_err(dev, "failed to set column address: %d\n", ret);
> - return ret;
> - }
> -
> - ret = mipi_dsi_dcs_set_page_address(dsi, 0, stk->mode->vdisplay - 1);
> - if (ret < 0) {
> - dev_err(dev, "failed to set page address: %d\n", ret);
> - return ret;
> - }
> -
> - return 0;
> + return dsi_ctx.accum_err;
> }
>
> static int stk_panel_on(struct stk_panel *stk)
> {
> struct mipi_dsi_device *dsi = stk->dsi;
> - struct device *dev = &stk->dsi->dev;
> - int ret;
> + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>
> - ret = mipi_dsi_dcs_set_display_on(dsi);
> - if (ret < 0)
> - dev_err(dev, "failed to set display on: %d\n", ret);
> + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
>
> - mdelay(20);
> + mipi_dsi_msleep(&dsi_ctx, 20);
>
> - return ret;
> + return dsi_ctx.accum_err;
> }
>
> static void stk_panel_off(struct stk_panel *stk)
> {
> struct mipi_dsi_device *dsi = stk->dsi;
> - struct device *dev = &stk->dsi->dev;
> - int ret;
> + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>
> dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>
> - ret = mipi_dsi_dcs_set_display_off(dsi);
> - if (ret < 0)
> - dev_err(dev, "failed to set display off: %d\n", ret);
> + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
> + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
>
> - ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
> - if (ret < 0)
> - dev_err(dev, "failed to enter sleep mode: %d\n", ret);
> -
> - msleep(100);
> + mipi_dsi_msleep(&dsi_ctx, 100);
> }
>
> static int stk_panel_unprepare(struct drm_panel *panel)
> @@ -155,7 +118,6 @@ static int stk_panel_unprepare(struct drm_panel *panel)
> static int stk_panel_prepare(struct drm_panel *panel)
> {
> struct stk_panel *stk = to_stk_panel(panel);
> - struct device *dev = &stk->dsi->dev;
> int ret;
>
> gpiod_set_value(stk->reset_gpio, 0);
> @@ -175,16 +137,12 @@ static int stk_panel_prepare(struct drm_panel *panel)
> gpiod_set_value(stk->reset_gpio, 1);
> mdelay(10);
> ret = stk_panel_init(stk);
> - if (ret < 0) {
> - dev_err(dev, "failed to init panel: %d\n", ret);
> + if (ret < 0)
> goto poweroff;
> - }
>
> ret = stk_panel_on(stk);
> - if (ret < 0) {
> - dev_err(dev, "failed to set panel on: %d\n", ret);
> + if (ret < 0)
> goto poweroff;
> - }
>
> return 0;
>
> @@ -250,18 +208,15 @@ static int dsi_dcs_bl_get_brightness(struct backlight_device *bl)
> static int dsi_dcs_bl_update_status(struct backlight_device *bl)
> {
> struct mipi_dsi_device *dsi = bl_get_data(bl);
> - struct device *dev = &dsi->dev;
> - int ret;
> + struct mipi_dsi_multi_context dsi_ctx = {.dsi = dsi};
>
> dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> - ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness);
> - if (ret < 0) {
> - dev_err(dev, "failed to set DSI control: %d\n", ret);
> - return ret;
> - }
> + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, bl->props.brightness);
> + if (dsi_ctx.accum_err)
> + return dsi_ctx.accum_err;
>
> dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> - return 0;
> + return dsi_ctx.accum_err;
> }
>
> static const struct backlight_ops dsi_bl_ops = {
> --
> 2.46.0
>
next prev parent reply other threads:[~2024-08-08 21:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 13:59 [PATCH v3 0/2] add more multi functions to streamline error handling Tejas Vipin
2024-08-06 13:59 ` [PATCH v3 1/2] drm/mipi-dsi: add more multi functions for better " Tejas Vipin
2024-08-07 22:53 ` Doug Anderson
2024-08-13 18:16 ` Doug Anderson
2024-08-06 13:59 ` [PATCH v3 2/2] drm/panel: startek-kd070fhfid015: transition to mipi_dsi wrapped functions Tejas Vipin
2024-08-07 22:54 ` Doug Anderson
2024-08-08 21:02 ` Jessica Zhang [this message]
2024-08-13 18:16 ` Doug Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=61da2ecf-88c1-4d03-afb0-98f0395ad229@quicinc.com \
--to=quic_jesszhan@quicinc.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=tejasvipin76@gmail.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®