linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: "Jernej Škrabec" <jernej.skrabec@siol.net>
Cc: wens@csie.org, robh+dt@kernel.org, sboyd@kernel.org,
	airlied@linux.ie, architt@codeaurora.org, a.hajda@samsung.com,
	Laurent.pinchart@ideasonboard.com, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com
Subject: Re: [PATCH v2 18/29] drm/sun4i: dw-hdmi: Add quirk for setting TMDS clock
Date: Tue, 9 Oct 2018 11:14:02 +0200	[thread overview]
Message-ID: <20181009091402.gjaruavagscq6wt5@flea> (raw)
In-Reply-To: <8016466.hta3A6eauk@jernej-laptop>

[-- Attachment #1: Type: text/plain, Size: 4518 bytes --]

On Mon, Oct 08, 2018 at 05:09:42PM +0200, Jernej Škrabec wrote:
> Dne ponedeljek, 08. oktober 2018 ob 11:14:06 CEST je Maxime Ripard napisal(a):
> > Hi,
> > 
> > On Sun, Oct 07, 2018 at 11:38:54AM +0200, Jernej Skrabec wrote:
> > > It turns out that H6 HDMI BSP kernel driver doesn't change TMDS rate at
> > > all. At this point it is not clear whether it is just not necessary or
> > > it would cause some kind of issues.
> > > 
> > > Add a quirk for it.
> > > 
> > > Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> > > Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
> > > ---
> > > 
> > >  drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 5 ++++-
> > >  drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 1 +
> > >  2 files changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> > > b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index ec122136ee9d..e9e93f174b35
> > > 100644
> > > --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> > > +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
> > > @@ -165,7 +165,9 @@ static int sun8i_dw_hdmi_bind(struct device *dev,
> > > struct device *master,> 
> > >  		goto err_disable_clk_tmds;
> > >  	
> > >  	}
> > > 
> > > -	drm_encoder_helper_add(encoder, &sun8i_dw_hdmi_encoder_helper_funcs);
> > > +	if (hdmi->quirks->set_rate)
> > > +		drm_encoder_helper_add(encoder,
> > > +				       &sun8i_dw_hdmi_encoder_helper_funcs);
> > 
> > That seems a bit backward, it only works because we only have mode_set
> > at the moment, and the only thing it does is changing the clock
> > rate. As soon as we change one of these two assumptions, the code will
> > break.
> > 
> > Why not just return in mode_set if that boolean is true?
> 
> My original intention was to optimize execution time a bit. If there is no 
> helpers registered, there is no need to call callback which does nothing. But 
> your way is probably more reasonable approach.
> 
> However, I'm pretty sure that even older HDMI controller doesn't need this 
> rate changing code. All tests shown that changing HDMI controller divider 
> doesn't have an effect on video or audio output. It's only there because BSP 
> kernel driver set rate and AW engineer said it's necessary.

Maybe we can simply remove it then, and see if it breaks. Given the
feedback from Allwinner, I'd prefer to have the behaviour they
recommend though, at least from MMC experience, it proved to be
needed.

> > 
> > >  	drm_encoder_init(drm, encoder, &sun8i_dw_hdmi_encoder_funcs,
> > >  	
> > >  			 DRM_MODE_ENCODER_TMDS, NULL);
> > > 
> > > @@ -235,6 +237,7 @@ static int sun8i_dw_hdmi_remove(struct platform_device
> > > *pdev)> 
> > >  static const struct sun8i_dw_hdmi_quirks sun8i_a83t_quirks = {
> > >  
> > >  	.mode_valid = sun8i_dw_hdmi_mode_valid_a83t,
> > > 
> > > +	.set_rate = true,
> > > 
> > >  };
> > >  
> > >  static const struct of_device_id sun8i_dw_hdmi_dt_ids[] = {
> > > 
> > > diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
> > > b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index a645b8bc9f58..f9eb663865a4
> > > 100644
> > > --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
> > > +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
> > > @@ -173,6 +173,7 @@ struct sun8i_hdmi_phy {
> > > 
> > >  struct sun8i_dw_hdmi_quirks {
> > >  
> > >  	enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
> > >  	
> > >  					   const struct drm_display_mode *mode);
> > > 
> > > +	bool set_rate;
> > 
> > This triggers a check in checkpatch. You should address them (and
> > there's several in your series).
> 
> Till now we used bools in driver internal structures in spite of this 
> warnings. So should we start using unsigned int? Or maybe bitfield with 
> unsigned int as a base according to https://lkml.org/lkml/2017/11/21/384

That warning has been introduced pretty recently, so we do indeed have
some drivers that use a bool in their structure.

> As far as other issues reported by strict checkpatch go, most of them are DT 
> lines over 80 charachters. This was tolerated till now. Last type of issues is 
> that macro parameters weren't enclosed with braces. These issues won't be 
> reported anymore in new series because sun8i_csc.h won't be touched if I drop 
> patch which renames DE2 register macros (but original issue will remain).

Yeah, I don't worry about those.

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-10-09  9:14 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-07  9:38 [PATCH v2 00/29] Allwinner H6 DE3 and HDMI support Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 01/29] dt-bindings: bus: add H6 DE3 bus binding Jernej Skrabec
2018-10-08  8:31   ` Maxime Ripard
2018-10-08 14:25     ` Jernej Škrabec
2018-10-07  9:38 ` [PATCH v2 02/29] clk: sunxi-ng: Adjust MP clock parent rate when allowed Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 03/29] clk: sunxi-ng: Use u64 for calculation of NM rate Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 04/29] clk: sunxi-ng: h6: Set video PLLs limits Jernej Skrabec
2018-10-12  8:13   ` [linux-sunxi] " Jagan Teki
2018-10-12  9:03     ` Chen-Yu Tsai
2018-10-07  9:38 ` [PATCH v2 05/29] dt-bindings: clock: sun8i-de2: Add H6 DE3 clock description Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 06/29] clk: sunxi-ng: Add support for H6 DE3 clocks Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 07/29] dt-bindings: display: sun4i-drm: Add H6 display engine compatibles Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 08/29] drm/sun4i: Add compatible for H6 display engine Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 09/29] drm/sun4i: Rework DE2 register defines Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 10/29] drm/sun4i: Rename DE2 registers related macros Jernej Skrabec
2018-10-08 10:18   ` Maxime Ripard
2018-10-08 14:28     ` Jernej Škrabec
2018-10-09 15:53       ` Maxime Ripard
2018-10-07  9:38 ` [PATCH v2 11/29] drm/sun4i: Fix DE2 mixer size Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 12/29] drm/sun4i: Disable unused DE2 sub-engines Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 13/29] drm/sun4i: Add basic support for DE3 Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 14/29] drm/sun4i: Add support for H6 DE3 mixer 0 Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 15/29] drm/bridge/synopsys: dw-hdmi: Enable workaround for v2.12a Jernej Skrabec
2018-10-09 17:40   ` Laurent Pinchart
2018-10-09 17:56     ` Ilia Mirkin
2018-10-09 21:23       ` Russell King - ARM Linux
2018-10-15 17:43     ` [linux-sunxi] " Jernej Škrabec
2018-10-07  9:38 ` [PATCH v2 16/29] drm/sun4i: Not all DW HDMI controllers has scrambled addresses Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 17/29] drm/sun4i: dw-hdmi: Make mode_valid function configurable Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 18/29] drm/sun4i: dw-hdmi: Add quirk for setting TMDS clock Jernej Skrabec
2018-10-08  9:14   ` Maxime Ripard
2018-10-08 15:09     ` Jernej Škrabec
2018-10-09  9:14       ` Maxime Ripard [this message]
2018-10-07  9:38 ` [PATCH v2 19/29] dt-bindings: display: sunxi: add DT binding for Allwinner H6 DW HDMI Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 20/29] drm/sun4i: Add support for H6 DW HDMI controller Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 21/29] drm/sun4i: dw-hdmi-phy: Reorder quirks by family Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 22/29] drm/sun4i: Add support for Synopsys HDMI PHY Jernej Skrabec
2018-10-07  9:38 ` [PATCH v2 23/29] drm/sun4i: Add support for H6 " Jernej Skrabec
2018-10-07  9:39 ` [PATCH v2 24/29] drm/sun4i: Initialize registers in tcon-top driver Jernej Skrabec
2018-10-07  9:39 ` [PATCH v2 25/29] drm: sun4i: add quirks for TCON TOP Jernej Skrabec
2018-10-08  8:51   ` Maxime Ripard
2018-10-08  9:06     ` Chen-Yu Tsai
2018-10-08 10:20       ` Maxime Ripard
2018-10-08 10:50         ` Chen-Yu Tsai
2018-10-08 12:33           ` Maxime Ripard
2018-10-08 13:10             ` Chen-Yu Tsai
2018-10-08 14:30     ` Jernej Škrabec
2018-10-07  9:39 ` [PATCH v2 26/29] dt-bindings: display: sun4i-drm: document H6 " Jernej Skrabec
2018-10-07  9:39 ` [PATCH v2 27/29] drm: sun4i: add support for " Jernej Skrabec
2018-10-07  9:39 ` [PATCH v2 28/29] arm64: dts: allwinner: h6: Add HDMI pipeline Jernej Skrabec
2018-10-07  9:39 ` [PATCH v2 29/29] arm64: dts: allwinner: h6: Enable HDMI output on Pine H64 board Jernej Skrabec
2018-10-07  9:50 ` [linux-sunxi] [PATCH v2 00/29] Allwinner H6 DE3 and HDMI support Jernej Škrabec

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=20181009091402.gjaruavagscq6wt5@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=architt@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=wens@csie.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;
as well as URLs for NNTP newsgroup(s).