linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Philippe CORNU <philippe.cornu@st.com>,
	"a.hajda@samsung.com" <a.hajda@samsung.com>,
	"Laurent.pinchart@ideasonboard.com" 
	<Laurent.pinchart@ideasonboard.com>,
	"jonas@kwiboo.se" <jonas@kwiboo.se>,
	"jernej.skrabec@siol.net" <jernej.skrabec@siol.net>
Cc: "heiko.stuebner@theobroma-systems.com" 
	<heiko.stuebner@theobroma-systems.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Yannick FERTRE <yannick.fertre@st.com>,
	"linux-amlogic@lists.infradead.org" 
	<linux-amlogic@lists.infradead.org>
Subject: Re: [PATCH] drm/bridge: dw-mipi-dsi: permit configuring the escape clock rate
Date: Fri, 11 Sep 2020 15:02:32 +0200	[thread overview]
Message-ID: <20e589a9-ce81-e53e-72b1-6022f632d591@baylibre.com> (raw)
In-Reply-To: <078aae69-936f-cb78-623f-6bdcb1c2630d@st.com>

On 11/09/2020 10:29, Philippe CORNU wrote:
> 
> 
> On 9/4/20 2:55 PM, Neil Armstrong wrote:
>> The Amlogic D-PHY in the Amlogic AXG SoC Family does support a frequency
>> higher than 10MHz for the TX Escape Clock, thus make the target rate
>> configurable.
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>   drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 25 +++++++++++++++----
>>   include/drm/bridge/dw_mipi_dsi.h              |  1 +
>>   2 files changed, 21 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> index d580b2aa4ce9..31fc965c66fd 100644
>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
>> @@ -562,15 +562,30 @@ static void dw_mipi_dsi_disable(struct dw_mipi_dsi *dsi)
>>   
>>   static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
>>   {
>> +	const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
>> +	unsigned int esc_rate; /* in MHz */
>> +	u32 esc_clk_division;
>> +	int ret;
>> +
>>   	/*
>>   	 * The maximum permitted escape clock is 20MHz and it is derived from
>> -	 * lanebyteclk, which is running at "lane_mbps / 8".  Thus we want:
>> -	 *
>> -	 *     (lane_mbps >> 3) / esc_clk_division < 20
>> +	 * lanebyteclk, which is running at "lane_mbps / 8".
>> +	 */
>> +	if (phy_ops->get_esc_clk_rate) {
>> +		ret = phy_ops->get_esc_clk_rate(dsi->plat_data->priv_data,
>> +						&esc_rate);
>> +		if (ret)
>> +			DRM_DEBUG_DRIVER("Phy get_esc_clk_rate() failed\n");
>> +	} else
>> +		esc_rate = 20; /* Default to 20MHz */
>> +
>> +	/*
>> +	 * We want :
>> +	 *     (lane_mbps >> 3) / esc_clk_division < X
>>   	 * which is:
>> -	 *     (lane_mbps >> 3) / 20 > esc_clk_division
>> +	 *     (lane_mbps >> 3) / X > esc_clk_division
>>   	 */
>> -	u32 esc_clk_division = (dsi->lane_mbps >> 3) / 20 + 1;
>> +	esc_clk_division = (dsi->lane_mbps >> 3) / esc_rate + 1;
>>   
>>   	dsi_write(dsi, DSI_PWR_UP, RESET);
>>   
>> diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h
>> index b0e390b3288e..bda8aa7c2280 100644
>> --- a/include/drm/bridge/dw_mipi_dsi.h
>> +++ b/include/drm/bridge/dw_mipi_dsi.h
>> @@ -36,6 +36,7 @@ struct dw_mipi_dsi_phy_ops {
>>   			     unsigned int *lane_mbps);
>>   	int (*get_timing)(void *priv_data, unsigned int lane_mbps,
>>   			  struct dw_mipi_dsi_dphy_timing *timing);
>> +	int (*get_esc_clk_rate)(void *priv_data, unsigned int *esc_clk_rate);
>>   };
>>   
>>   struct dw_mipi_dsi_host_ops {
>>
> 
> Hi Neil,
> Thank you for the patch
> 
> Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
> 
> Philippe :-)
> 

Thanks !

Applying to drm-misc-next

Neil

      reply	other threads:[~2020-09-11 14:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 12:55 [PATCH] drm/bridge: dw-mipi-dsi: permit configuring the escape clock rate Neil Armstrong
2020-09-11  8:29 ` Philippe CORNU
2020-09-11 13:02   ` Neil Armstrong [this message]

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=20e589a9-ce81-e53e-72b1-6022f632d591@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko.stuebner@theobroma-systems.com \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philippe.cornu@st.com \
    --cc=yannick.fertre@st.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;
as well as URLs for NNTP newsgroup(s).