public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Cong Yang" <yangcong5@huaqin.corp-partner.google.com>,
	<quic_jesszhan@quicinc.com>, <neil.armstrong@linaro.org>,
	<dianders@chromium.org>, <linus.walleij@linaro.org>,
	<airlied@gmail.com>, <dmitry.baryshkov@linaro.org>
Cc: <dri-devel@lists.freedesktop.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1 4/4] drm/panel: ili9806e: Break some CMDS into helper functions
Date: Wed, 10 Jul 2024 11:02:03 +0200	[thread overview]
Message-ID: <D2LQJROQYIY3.2Q88EXS8HUDLQ@kernel.org> (raw)
In-Reply-To: <20240710084715.1119935-5-yangcong5@huaqin.corp-partner.google.com>

On Wed Jul 10, 2024 at 10:47 AM CEST, Cong Yang wrote:
> Break select page cmds into helper function.

Why though? I don't find that anything easier to read. In fact, I
deliberately chose not to factor that out into a function. It's just
a sequence of magic commands, taken straight from the datasheet. So,
I'd like to keep it that way.

-michael

> Signed-off-by: Cong Yang <yangcong5@huaqin.corp-partner.google.com>
> ---
>  drivers/gpu/drm/panel/panel-ilitek-ili9806e.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e.c
> index e4a44cd26c4d..68fb9a1a4d80 100644
> --- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e.c
> +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e.c
> @@ -35,6 +35,12 @@ struct ili9806e_panel {
>  	enum drm_panel_orientation orientation;
>  };
>  
> +#define ILI9806E_DCS_SWITCH_PAGE	0xff
> +
> +#define ili9806e_switch_page(ctx, page) \
> +	mipi_dsi_dcs_write_seq_multi(ctx, ILI9806E_DCS_SWITCH_PAGE, \
> +				     0xff, 0x98, 0x06, 0x04, (page))
> +
>  static const char * const regulator_names[] = {
>  	"vdd",
>  	"vccio",
> @@ -227,7 +233,7 @@ static void ili9806e_dsi_remove(struct mipi_dsi_device *dsi)
>  static void com35h3p70ulc_init(struct mipi_dsi_multi_context *ctx)
>  {
>  	/* Switch to page 1 */
> -	mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0xff, 0x98, 0x06, 0x04, 0x01);
> +	ili9806e_switch_page(ctx, 0x01);
>  	/* Interface Settings */
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x08, 0x18);
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x21, 0x01);
> @@ -285,14 +291,14 @@ static void com35h3p70ulc_init(struct mipi_dsi_multi_context *ctx)
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0xcf, 0x0a);
>  
>  	/* Switch to page 7 */
> -	mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0xff, 0x98, 0x06, 0x04, 0x07);
> +	ili9806e_switch_page(ctx, 0x07);
>  	/* Power Control */
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x06, 0x00);
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x18, 0x1d);
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x17, 0x32);
>  
>  	/* Switch to page 6 */
> -	mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0xff, 0x98, 0x06, 0x04, 0x06);
> +	ili9806e_switch_page(ctx, 0x06);
>  	/* GIP settings */
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x00, 0x20);
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x01, 0x02);
> @@ -352,7 +358,7 @@ static void com35h3p70ulc_init(struct mipi_dsi_multi_context *ctx)
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x53, 0x12);
>  
>  	/* Switch to page 0 */
> -	mipi_dsi_dcs_write_seq_multi(ctx, 0xff, 0xff, 0x98, 0x06, 0x04, 0x00);
> +	ili9806e_switch_page(ctx, 0x00);
>  	/* Interface Pixel format */
>  	mipi_dsi_dcs_write_seq_multi(ctx, 0x3a, 0x60);
>  };


  reply	other threads:[~2024-07-10  9:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-10  8:47 [PATCH v1 0/4] Break some CMDS into helper functions Cong Yang
2024-07-10  8:47 ` [PATCH v1 1/4] drm/panel: boe-tv101wum-nl6: " Cong Yang
2024-07-10 19:12   ` Doug Anderson
2024-07-10  8:47 ` [PATCH v1 2/4] drm/panel: nt35521: " Cong Yang
2024-07-10 19:12   ` Doug Anderson
2024-07-10  8:47 ` [PATCH v1 3/4] drm/panel: nt36672e: " Cong Yang
2024-07-10 19:12   ` Doug Anderson
2024-07-10  8:47 ` [PATCH v1 4/4] drm/panel: ili9806e: " Cong Yang
2024-07-10  9:02   ` Michael Walle [this message]
2024-07-10 19:12     ` Doug Anderson
2024-07-10 19:38       ` Michael Walle
2024-07-11  1:08         ` cong yang
2024-07-11 19:36           ` Doug Anderson
2024-07-12 14:56             ` neil.armstrong
2024-07-12 15:50               ` Doug Anderson
2024-07-24  7:59                 ` neil.armstrong
2024-07-25 15:00 ` (subset) [PATCH v1 0/4] " Neil Armstrong

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=D2LQJROQYIY3.2Q88EXS8HUDLQ@kernel.org \
    --to=mwalle@kernel.org \
    --cc=airlied@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_jesszhan@quicinc.com \
    --cc=yangcong5@huaqin.corp-partner.google.com \
    /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