mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: <linux-arm-msm@vger.kernel.org>,
	<freedreno@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v3 1/4] drm/msm/mdss: generate MDSS data for MDP5 platforms
Date: Wed, 7 Feb 2024 10:25:35 -0800	[thread overview]
Message-ID: <89d02d5c-4af1-9f40-483f-1efb39b2a33d@quicinc.com> (raw)
In-Reply-To: <20240106-fd-migrate-mdp5-v3-1-3d2750378063@linaro.org>



On 1/5/2024 3:34 PM, Dmitry Baryshkov wrote:
> Older (mdp5) platforms do not use per-SoC compatible strings. Instead
> they use a single compat entry 'qcom,mdss'. To facilitate migrating
> these platforms to the DPU driver provide a way to generate the MDSS /
> UBWC data at runtime, when the DPU driver asks for it.
> 
> It is not possible to generate this data structure at the probe time,
> since some platforms might not have MDP_CLK enabled, which makes reading
> HW_REV register return 0.
> 

I would have expected a crash if clock was not enabled and we tried to 
access the hw_rev register.

> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/gpu/drm/msm/msm_mdss.c | 51 ++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 51 insertions(+)
> 
> diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
> index 455b2e3a0cdd..566a5dd5b8e8 100644
> --- a/drivers/gpu/drm/msm/msm_mdss.c
> +++ b/drivers/gpu/drm/msm/msm_mdss.c
> @@ -3,6 +3,7 @@
>    * Copyright (c) 2018, The Linux Foundation
>    */
>   
> +#include <linux/bitfield.h>
>   #include <linux/clk.h>
>   #include <linux/delay.h>
>   #include <linux/interconnect.h>
> @@ -213,6 +214,49 @@ static void msm_mdss_setup_ubwc_dec_40(struct msm_mdss *msm_mdss)
>   	}
>   }
>   
> +#define MDSS_HW_MAJ_MIN		GENMASK(31, 16)
> +
> +#define MDSS_HW_MSM8996		0x1007
> +#define MDSS_HW_MSM8937		0x100e
> +#define MDSS_HW_MSM8956		0x1010

This should be 0x100B in the docs I see.

> +#define MDSS_HW_MSM8998		0x3000
> +#define MDSS_HW_SDM660		0x3002
> +#define MDSS_HW_SDM630		0x3003
> +
> +/*
> + * MDP5 platforms use generic qcom,mdp5 compat string, so we have to generate this data
> + */
> +static const struct msm_mdss_data *msm_mdss_generate_mdp5_mdss_data(struct msm_mdss *mdss)
> +{
> +	struct msm_mdss_data *data;
> +	u32 hw_rev;
> +
> +	data = devm_kzalloc(mdss->dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
> +		return NULL;
> +
> +	hw_rev = readl_relaxed(mdss->mmio + HW_REV);
> +	hw_rev = FIELD_GET(MDSS_HW_MAJ_MIN, hw_rev);
> +
> +	if (hw_rev == MDSS_HW_MSM8996 ||
> +	    hw_rev == MDSS_HW_MSM8937 ||
> +	    hw_rev == MDSS_HW_MSM8956 ||
> +	    hw_rev == MDSS_HW_MSM8998 ||
> +	    hw_rev == MDSS_HW_SDM660 ||
> +	    hw_rev == MDSS_HW_SDM630) {
> +		data->ubwc_dec_version = UBWC_1_0;
> +		data->ubwc_enc_version = UBWC_1_0;
> +	}
> +
> +	if (hw_rev == MDSS_HW_MSM8996 ||
> +	    hw_rev == MDSS_HW_MSM8998)
> +		data->highest_bank_bit = 2;
> +	else
> +		data->highest_bank_bit = 1;
> +
> +	return data;
> +}
> +
>   const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev)
>   {
>   	struct msm_mdss *mdss;
> @@ -222,6 +266,13 @@ const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev)
>   
>   	mdss = dev_get_drvdata(dev);
>   
> +	/*
> +	 * We could not do it at the probe time, since hw revision register was
> +	 * not readable. Fill data structure now for the MDP5 platforms.
> +	 */
> +	if (!mdss->mdss_data && mdss->is_mdp5)
> +		mdss->mdss_data = msm_mdss_generate_mdp5_mdss_data(mdss);
> +
>   	return mdss->mdss_data;
>   }
>   
> 

  reply	other threads:[~2024-02-07 18:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 23:34 [PATCH v3 0/4] drm/msm: provide migration path from MDP5 to DPU driver Dmitry Baryshkov
2024-01-05 23:34 ` [PATCH v3 1/4] drm/msm/mdss: generate MDSS data for MDP5 platforms Dmitry Baryshkov
2024-02-07 18:25   ` Abhinav Kumar [this message]
2024-02-07 19:59     ` Dmitry Baryshkov
2024-01-05 23:34 ` [PATCH v3 2/4] drm/msm/dpu: support binding to the mdp5 devices Dmitry Baryshkov
2024-02-07 18:47   ` Abhinav Kumar
2024-02-07 19:56     ` Dmitry Baryshkov
2024-02-07 20:05       ` Abhinav Kumar
2024-01-05 23:34 ` [PATCH v3 3/4] drm/msm: add a kernel param to select between MDP5 and DPU drivers Dmitry Baryshkov
2024-01-06  0:04   ` Carl Vanderlip
2024-01-06  0:38     ` Dmitry Baryshkov
2024-01-08 17:57       ` Carl Vanderlip
2024-01-08 19:07         ` Dmitry Baryshkov
2024-01-09 19:32           ` Carl Vanderlip
2024-02-07 19:19   ` Abhinav Kumar
2024-01-05 23:34 ` [PATCH v3 4/4] drm/msm/dpu: add support for SDM660 and SDM630 platforms Dmitry Baryshkov
2024-02-07 19:50   ` Abhinav Kumar

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=89d02d5c-4af1-9f40-483f-1efb39b2a33d@quicinc.com \
    --to=quic_abhinavk@quicinc.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    /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®