mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Hermes Wu <Hermes.Wu@ite.com.tw>
Cc: Kenneth Hung <Kenneth.hung@ite.com.tw>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Allen Chen <allen.chen@ite.com.tw>,
	"open list:DRM DRIVERS" <dri-devel@lists.freedesktop.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 08/11] drm/bridge: it6505: fix HDCP KSV list did not read correctly.
Date: Thu, 26 Sep 2024 10:10:41 +0200	[thread overview]
Message-ID: <5d3e7f6f-1980-4afb-9559-ad23d5779393@collabora.com> (raw)
In-Reply-To: <20240926075018.22328-4-Hermes.Wu@ite.com.tw>

Il 26/09/24 09:50, Hermes Wu ha scritto:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
> 
> When running the HDCP CTS test on UNIGRAF DPR-100.
> KSV list must be read from DPCD with 5 byte boundary.
> 
> The original aux operation using AUX_NATIVE_READ can not read back the
> KSV list correctly.
> Change to CMD_AUX_GET_KSV_LIST operaction.
> 
> 
> Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
>   drivers/gpu/drm/bridge/ite-it6505.c | 46 +++++++++++++++++++++--------
>   1 file changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 82986f28f653..143d58ed1b0e 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -1188,6 +1188,35 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,
>   	return 0;
>   }
>   
> +static int it6505_get_ksvlist(struct it6505 *it6505, u8 *buf, size_t len)
> +{
> +	int i, request_size, ret;
> +	struct device *dev = it6505->dev;
> +	enum aux_cmd_reply reply;

struct device *dev = it6505->dev;
enum aux_cmd_reply reply;
int request_size, ret;
int i = 0;

> +
> +	for (i = 0; i < len; ) {

do {

> +		request_size = min_t(int, (int)len - i, 15);
> +
> +		ret = it6505_aux_do_transfer(it6505, CMD_AUX_GET_KSV_LIST,
> +					     DP_AUX_HDCP_KSV_FIFO,
> +					     buf + i, request_size, &reply);
> +
> +		DRM_DEV_DEBUG_DRIVER(dev, "request_size = %d, ret =%d", request_size, ret);
> +		if (ret < 0)
> +			return ret;
> +
> +		i += request_size;
> +	}

} while (i < len);

> +
> +	DRM_DEV_DEBUG_DRIVER(dev, "ksv read cnt = %d down_stream_cnt=%d ", i, i / 5);
> +
> +	for (i = 0 ; i < len; i += 5)

Add braces to this loop, otherwise if DRM_DEV_DEBUG_DRIVER() suddenly becomes
empty (because of some configuration option in the future, etc) you'll get build
breakages.

> +		DRM_DEV_DEBUG_DRIVER(dev, "ksv[%d] = %02X%02X%02X%02X%02X",
> +				     i / 5, buf[i], buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4]);
> +
> +	return len;
> +}
> +
>   static void it6505_variable_config(struct it6505 *it6505)
>   {
>   	it6505->link_rate_bw_code = HBR;
> @@ -1969,7 +1998,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
>   {
>   	struct device *dev = it6505->dev;
>   	u8 binfo[2];
> -	int down_stream_count, i, err, msg_count = 0;
> +	int down_stream_count, err, msg_count = 0;
>   
>   	err = it6505_get_dpcd(it6505, DP_AUX_HDCP_BINFO, binfo,
>   			      ARRAY_SIZE(binfo));
> @@ -1994,18 +2023,11 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
>   			down_stream_count);
>   		return 0;
>   	}
> +	err =  it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5);
> +	if (err < 0)
> +		return err;
>   
> -	for (i = 0; i < down_stream_count; i++) {
> -		err = it6505_get_dpcd(it6505, DP_AUX_HDCP_KSV_FIFO +
> -				      (i % 3) * DRM_HDCP_KSV_LEN,
> -				      sha1_input + msg_count,
> -				      DRM_HDCP_KSV_LEN);
> -
> -		if (err < 0)
> -			return err;
> -
> -		msg_count += 5;
> -	}
> +	msg_count += down_stream_count * 5;
>   
>   	it6505->hdcp_down_stream_count = down_stream_count;
>   	sha1_input[msg_count++] = binfo[0];



  reply	other threads:[~2024-09-26  8:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26  7:50 [PATCH v4 05/11] drm/bridge: it6505: increase supports of HDCP repeater ksv devices Hermes Wu
2024-09-26  7:50 ` [PATCH v4 06/11] drm/bridge: it6505: fix HDCP Bstatus check Hermes Wu
2024-09-26  8:09   ` Dmitry Baryshkov
2024-09-26  8:10   ` AngeloGioacchino Del Regno
2024-09-26  7:50 ` [PATCH v4 07/11] drm/bridge: it6505: fix HDCP encription not enable when R0 ready Hermes Wu
2024-09-26  7:50 ` [PATCH v4 08/11] drm/bridge: it6505: fix HDCP KSV list did not read correctly Hermes Wu
2024-09-26  8:10   ` AngeloGioacchino Del Regno [this message]
2024-09-26  7:50 ` [PATCH v4 09/11] drm/bridge: it6505: fix HDCP CTS compare V matching without retry Hermes Wu
2024-09-26  8:07 ` [PATCH v4 05/11] drm/bridge: it6505: increase supports of HDCP repeater ksv devices Dmitry Baryshkov
2024-09-27  2:18   ` Hermes.Wu
2024-09-27  8:50     ` Dmitry Baryshkov
2024-09-27  4:06   ` Hermes.Wu

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=5d3e7f6f-1980-4afb-9559-ad23d5779393@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Hermes.Wu@ite.com.tw \
    --cc=Kenneth.hung@ite.com.tw \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=allen.chen@ite.com.tw \
    --cc=andrzej.hajda@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --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®