mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
	linux-arm-msm@vger.kernel.org, andersson@kernel.org,
	agross@kernel.org, krzysztof.kozlowski@linaro.org
Cc: marijn.suijten@somainline.org, Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Douglas Anderson <dianders@chromium.org>,
	Loic Poulain <loic.poulain@linaro.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Vinod Koul <vkoul@kernel.org>,
	Vladimir Lypak <vladimir.lypak@gmail.com>,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/10] drm/msm/dsi: Zero-terminate msm_dsi_config::io_start
Date: Sat, 11 Feb 2023 15:19:08 +0200	[thread overview]
Message-ID: <71b63ae5-1b2c-b0a9-913c-99b657133f0f@linaro.org> (raw)
In-Reply-To: <20230211115110.1462920-4-konrad.dybcio@linaro.org>

On 11/02/2023 13:51, Konrad Dybcio wrote:
> In preparation for supporting multiple sets of possible base registers,
> Zero-terminate the array that contains them to remove the need of
> specifying num_dsi for each set.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>   drivers/gpu/drm/msm/dsi/dsi_cfg.c  | 39 ++++++++++--------------------
>   drivers/gpu/drm/msm/dsi/dsi_cfg.h  |  4 +--
>   drivers/gpu/drm/msm/dsi/dsi_host.c |  2 +-
>   3 files changed, 16 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
> index 068d45b3a8f0..5f62c563bd1c 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
> @@ -22,9 +22,8 @@ static const struct msm_dsi_config apq8064_dsi_cfg = {
>   	.bus_clk_names = dsi_v2_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names),
>   	.io_start = {
> -		{ 0x4700000, 0x5800000 },
> +		{ 0x4700000, 0x5800000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_6g_bus_clk_names[] = {
> @@ -44,9 +43,8 @@ static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = {
>   	.bus_clk_names = dsi_6g_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
>   	.io_start = {
> -		{ 0xfd922800, 0xfd922b00 },
> +		{ 0xfd922800, 0xfd922b00, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_8916_bus_clk_names[] = {
> @@ -65,9 +63,8 @@ static const struct msm_dsi_config msm8916_dsi_cfg = {
>   	.bus_clk_names = dsi_8916_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names),
>   	.io_start = {
> -		{ 0x1a98000 },
> +		{ 0x1a98000, 0 },
>   	},
> -	.num_dsi = 1,
>   };
>   
>   static const char * const dsi_8976_bus_clk_names[] = {
> @@ -86,9 +83,8 @@ static const struct msm_dsi_config msm8976_dsi_cfg = {
>   	.bus_clk_names = dsi_8976_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names),
>   	.io_start = {
> -		{ 0x1a94000, 0x1a96000 },
> +		{ 0x1a94000, 0x1a96000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const struct regulator_bulk_data msm8994_dsi_regulators[] = {
> @@ -107,9 +103,8 @@ static const struct msm_dsi_config msm8994_dsi_cfg = {
>   	.bus_clk_names = dsi_6g_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names),
>   	.io_start = {
> -		{ 0xfd998000, 0xfd9a0000 },
> +		{ 0xfd998000, 0xfd9a0000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_8996_bus_clk_names[] = {
> @@ -129,9 +124,8 @@ static const struct msm_dsi_config msm8996_dsi_cfg = {
>   	.bus_clk_names = dsi_8996_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_8996_bus_clk_names),
>   	.io_start = {
> -		{ 0x994000, 0x996000 },
> +		{ 0x994000, 0x996000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_msm8998_bus_clk_names[] = {
> @@ -150,9 +144,8 @@ static const struct msm_dsi_config msm8998_dsi_cfg = {
>   	.bus_clk_names = dsi_msm8998_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_msm8998_bus_clk_names),
>   	.io_start = {
> -		{ 0xc994000, 0xc996000 },
> +		{ 0xc994000, 0xc996000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_sdm660_bus_clk_names[] = {
> @@ -170,9 +163,8 @@ static const struct msm_dsi_config sdm660_dsi_cfg = {
>   	.bus_clk_names = dsi_sdm660_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_sdm660_bus_clk_names),
>   	.io_start = {
> -		{ 0xc994000, 0xc996000 },
> +		{ 0xc994000, 0xc996000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_sdm845_bus_clk_names[] = {
> @@ -194,9 +186,8 @@ static const struct msm_dsi_config sdm845_dsi_cfg = {
>   	.bus_clk_names = dsi_sdm845_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names),
>   	.io_start = {
> -		{ 0xae94000, 0xae96000 },
> +		{ 0xae94000, 0xae96000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const struct regulator_bulk_data sm8550_dsi_regulators[] = {
> @@ -210,9 +201,8 @@ static const struct msm_dsi_config sm8550_dsi_cfg = {
>   	.bus_clk_names = dsi_sdm845_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names),
>   	.io_start = {
> -		{ 0xae94000, 0xae96000 },
> +		{ 0xae94000, 0xae96000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const struct regulator_bulk_data sc7180_dsi_regulators[] = {
> @@ -226,9 +216,8 @@ static const struct msm_dsi_config sc7180_dsi_cfg = {
>   	.bus_clk_names = dsi_sc7180_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_sc7180_bus_clk_names),
>   	.io_start = {
> -		{ 0xae94000 },
> +		{ 0xae94000, 0 },
>   	},
> -	.num_dsi = 1,
>   };
>   
>   static const char * const dsi_sc7280_bus_clk_names[] = {
> @@ -246,9 +235,8 @@ static const struct msm_dsi_config sc7280_dsi_cfg = {
>   	.bus_clk_names = dsi_sc7280_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_sc7280_bus_clk_names),
>   	.io_start = {
> -		{ 0xae94000, 0xae96000 },
> +		{ 0xae94000, 0xae96000, 0 },
>   	},
> -	.num_dsi = 2,
>   };
>   
>   static const char * const dsi_qcm2290_bus_clk_names[] = {
> @@ -266,9 +254,8 @@ static const struct msm_dsi_config qcm2290_dsi_cfg = {
>   	.bus_clk_names = dsi_qcm2290_bus_clk_names,
>   	.num_bus_clks = ARRAY_SIZE(dsi_qcm2290_bus_clk_names),
>   	.io_start = {
> -		{ 0x5e94000 },
> +		{ 0x5e94000, 0 },
>   	},
> -	.num_dsi = 1,
>   };
>   
>   static const struct msm_dsi_host_cfg_ops msm_dsi_v2_host_ops = {
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> index df9f09876ccb..03493cc6b772 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
> @@ -41,8 +41,8 @@ struct msm_dsi_config {
>   	int num_regulators;
>   	const char * const *bus_clk_names;
>   	const int num_bus_clks;
> -	const resource_size_t io_start[VARIANTS_MAX][DSI_MAX];
> -	const int num_dsi;
> +	/* Allow + 1 entry for the zero-terminator */
> +	const resource_size_t io_start[VARIANTS_MAX][DSI_MAX + 1];
>   };
>   
>   struct msm_dsi_host_cfg_ops {
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 22ba8726b0ea..f5092b4d0757 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -1868,7 +1868,7 @@ static int dsi_host_get_id(struct msm_dsi_host *msm_host)
>   	if (!res)
>   		return -EINVAL;
>   
> -	for (i = 0; i < cfg->num_dsi; i++) {
> +	for (i = 0; cfg->io_start[0][i]; i++) {
>   		if (cfg->io_start[0][i] == res->start)
>   			return i;
>   	}

I think we have the easier way to do this: always loop towards DSI_MAX. 
Empty cells will contain the value of 0 which can not match against 
valid starting address.

Also please shift this patch to the first place, it will be logical to 
add VARIANT_MAX after removing num_dsi.

-- 
With best wishes
Dmitry


  reply	other threads:[~2023-02-11 13:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230211115110.1462920-1-konrad.dybcio@linaro.org>
2023-02-11 11:51 ` [PATCH 01/10] dt-bindings: display/msm: dsi-controller-main: Fix deprecated QCM2290 compatible Konrad Dybcio
2023-02-11 11:51 ` [PATCH 02/10] drm/msm/dsi: Turn msm_dsi_config::io_start into a 2d array Konrad Dybcio
2023-02-11 13:17   ` Dmitry Baryshkov
2023-02-13  9:16     ` Konrad Dybcio
2023-02-11 11:51 ` [PATCH 03/10] drm/msm/dsi: Zero-terminate msm_dsi_config::io_start Konrad Dybcio
2023-02-11 13:19   ` Dmitry Baryshkov [this message]
2023-02-13  9:18     ` Konrad Dybcio
2023-02-13 11:41       ` Dmitry Baryshkov
2023-02-11 11:51 ` [PATCH 04/10] drm/msm/dsi: dsi_host: Fix DSI index detection when version clash occurs Konrad Dybcio
2023-02-11 13:26   ` Dmitry Baryshkov
2023-02-13  9:19     ` Konrad Dybcio
2023-02-11 11:51 ` [PATCH 05/10] drm/msm/dsi: dsi_cfg: Deduplicate identical structs Konrad Dybcio
2023-02-11 15:52   ` Dmitry Baryshkov
2023-02-13  9:20     ` Konrad Dybcio
2023-02-11 11:51 ` [PATCH 06/10] drm/msm/dsi: dsi_cfg: Merge SC7180 config into SDM845 Konrad Dybcio
2023-02-11 15:52   ` Dmitry Baryshkov
2023-02-13  9:20     ` Konrad Dybcio
2023-02-11 11:51 ` [PATCH 07/10] drm/msm/dsi: Switch the QCM2290-specific compatible to index autodetection Konrad Dybcio
2023-02-11 11:51 ` [PATCH 08/10] drm/msm/dsi: Remove custom DSI config handling Konrad Dybcio
2023-02-11 15:53   ` Dmitry Baryshkov
2023-02-11 11:51 ` [PATCH 09/10] dt-bindings: display/msm: dsi-controller-main: Add SM6115 Konrad Dybcio
2023-02-11 11:51 ` [PATCH 10/10] arm64: dts: qcom: sm6115: Use the correct DSI compatible Konrad Dybcio

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=71b63ae5-1b2c-b0a9-913c-99b657133f0f@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=marijn.suijten@somainline.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=vkoul@kernel.org \
    --cc=vladimir.lypak@gmail.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

all inboxes | Powered by JetHome®