mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuogee Hsieh <quic_khsieh@quicinc.com>
To: Stephen Boyd <swboyd@chromium.org>,
	Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, <patches@lists.linux.dev>,
	Sean Paul <sean@poorly.run>, <dri-devel@lists.freedesktop.org>,
	<freedreno@lists.freedesktop.org>,
	Vinod Polimera <quic_vpolimer@quicinc.com>
Subject: Re: [PATCH 1/7] drm/msm/dp: Replace open-coded drm_dp_read_dpcd_caps()
Date: Thu, 31 Aug 2023 13:27:15 -0700	[thread overview]
Message-ID: <de6855ec-0122-034b-1b9a-7478681b4209@quicinc.com> (raw)
In-Reply-To: <20230829184735.2841739-2-swboyd@chromium.org>


On 8/29/2023 11:47 AM, Stephen Boyd wrote:
> This function duplicates the common function drm_dp_read_dpcd_caps().
> The array of DPCD registers filled in is one size larger than the
> function takes, but from what I can tell that extra byte was never used.
> Resize the array and use the common function to reduce the code here.
>
> Cc: Vinod Polimera <quic_vpolimer@quicinc.com>
> Cc: Kuogee Hsieh <quic_khsieh@quicinc.com>
> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Tested-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
>   drivers/gpu/drm/msm/dp/dp_panel.c | 42 ++++---------------------------
>   drivers/gpu/drm/msm/dp/dp_panel.h |  4 +--
>   2 files changed, 6 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c
> index 42d52510ffd4..09d4f6c38ef8 100644
> --- a/drivers/gpu/drm/msm/dp/dp_panel.c
> +++ b/drivers/gpu/drm/msm/dp/dp_panel.c
> @@ -48,47 +48,15 @@ static int dp_panel_read_dpcd(struct dp_panel *dp_panel)
>   	ssize_t rlen;
>   	struct dp_panel_private *panel;
>   	struct dp_link_info *link_info;
> -	u8 *dpcd, major = 0, minor = 0, temp;
> -	u32 offset = DP_DPCD_REV;
> +	u8 *dpcd, major, minor;
>   
> +	panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
>   	dpcd = dp_panel->dpcd;
> +	rc = drm_dp_read_dpcd_caps(panel->aux, dpcd);
> +	if (rc)
> +		return rc;
>   
> -	panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
>   	link_info = &dp_panel->link_info;
> -
> -	rlen = drm_dp_dpcd_read(panel->aux, offset,
> -			dpcd, (DP_RECEIVER_CAP_SIZE + 1));
> -	if (rlen < (DP_RECEIVER_CAP_SIZE + 1)) {
> -		DRM_ERROR("dpcd read failed, rlen=%zd\n", rlen);
> -		if (rlen == -ETIMEDOUT)
> -			rc = rlen;
> -		else
> -			rc = -EINVAL;
> -
> -		goto end;
> -	}
> -
> -	temp = dpcd[DP_TRAINING_AUX_RD_INTERVAL];
> -
> -	/* check for EXTENDED_RECEIVER_CAPABILITY_FIELD_PRESENT */
> -	if (temp & BIT(7)) {
> -		drm_dbg_dp(panel->drm_dev,
> -				"using EXTENDED_RECEIVER_CAPABILITY_FIELD\n");
> -		offset = DPRX_EXTENDED_DPCD_FIELD;
> -	}
> -
> -	rlen = drm_dp_dpcd_read(panel->aux, offset,
> -		dpcd, (DP_RECEIVER_CAP_SIZE + 1));
> -	if (rlen < (DP_RECEIVER_CAP_SIZE + 1)) {
> -		DRM_ERROR("dpcd read failed, rlen=%zd\n", rlen);
> -		if (rlen == -ETIMEDOUT)
> -			rc = rlen;
> -		else
> -			rc = -EINVAL;
> -
> -		goto end;
> -	}
> -
>   	link_info->revision = dpcd[DP_DPCD_REV];
>   	major = (link_info->revision >> 4) & 0x0f;
>   	minor = link_info->revision & 0x0f;
> diff --git a/drivers/gpu/drm/msm/dp/dp_panel.h b/drivers/gpu/drm/msm/dp/dp_panel.h
> index ed1030e17e1b..6d733480a62d 100644
> --- a/drivers/gpu/drm/msm/dp/dp_panel.h
> +++ b/drivers/gpu/drm/msm/dp/dp_panel.h
> @@ -13,8 +13,6 @@
>   
>   struct edid;
>   
> -#define DPRX_EXTENDED_DPCD_FIELD	0x2200
> -
>   #define DP_DOWNSTREAM_PORTS		4
>   #define DP_DOWNSTREAM_CAP_SIZE		4
>   
> @@ -40,7 +38,7 @@ struct dp_panel_psr {
>   
>   struct dp_panel {
>   	/* dpcd raw data */
> -	u8 dpcd[DP_RECEIVER_CAP_SIZE + 1];
> +	u8 dpcd[DP_RECEIVER_CAP_SIZE];
>   	u8 ds_cap_info[DP_DOWNSTREAM_PORTS * DP_DOWNSTREAM_CAP_SIZE];
>   	u32 ds_port_cnt;
>   	u32 dfp_present;

  reply	other threads:[~2023-08-31 20:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 18:47 [PATCH 0/7] drm/msm/dp: Simplify DPCD related code with helpers Stephen Boyd
2023-08-29 18:47 ` [PATCH 1/7] drm/msm/dp: Replace open-coded drm_dp_read_dpcd_caps() Stephen Boyd
2023-08-31 20:27   ` Kuogee Hsieh [this message]
2023-09-03 22:37   ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 2/7] drm/msm/dp: Use drm_dp_read_sink_count() helper Stephen Boyd
2023-08-31 20:27   ` Kuogee Hsieh
2023-09-03 22:37   ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 3/7] drm/msm/dp: Remove dead code related to downstream cap info Stephen Boyd
2023-08-31 20:28   ` Kuogee Hsieh
2023-08-31 20:28   ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 4/7] drm/msm/dp: Remove aux_cfg_update_done and related code Stephen Boyd
2023-08-31 20:28   ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 5/7] drm/msm/dp: Simplify with drm_dp_{max_link_rate,max_lane_count}() Stephen Boyd
2023-08-31 20:29   ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 6/7] drm/msm/dp: Inline dp_link_parse_sink_count() Stephen Boyd
2023-08-31 20:29   ` Kuogee Hsieh
2023-09-03 22:39   ` Dmitry Baryshkov
2023-08-29 18:47 ` [PATCH 7/7] drm/msm/dp: Remove dp_display_is_ds_bridge() Stephen Boyd
2023-08-31 20:29   ` Kuogee Hsieh
2023-09-03 22:40   ` Dmitry Baryshkov
2023-09-05 21:52     ` Stephen Boyd
2023-09-03 22:45 ` [PATCH 0/7] drm/msm/dp: Simplify DPCD related code with helpers Dmitry Baryshkov
2023-10-08 14:01 ` Dmitry Baryshkov

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=de6855ec-0122-034b-1b9a-7478681b4209@quicinc.com \
    --to=quic_khsieh@quicinc.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_vpolimer@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    /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®