dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: Peter Rosin <peda@axentia.se>
Cc: David Airlie <airlied@linux.ie>,
	Liviu Dudau <Liviu.Dudau@arm.com>, Jyri Sarha <jsarha@ti.com>,
	Tomi Valkeinen <tomi.valkeinen@ti.com>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/4] drm/i2c: tda998x: add support for pixel repeated modes
Date: Tue, 31 Jul 2018 10:42:47 +0100	[thread overview]
Message-ID: <20180731094247.GI17271@n2100.armlinux.org.uk> (raw)
In-Reply-To: <E1fkQvf-0003nV-CW@rmk-PC.armlinux.org.uk>

On Tue, Jul 31, 2018 at 10:26:55AM +0100, Russell King wrote:
> TDA998x has no support for pixel repeated modes, and the code notes this
> as a "TODO" item.  The implementation appears to be relatively simple,
> so lets add it.
> 
> We need to calculate the serializer clock divisor based on the TMDS
> clock rate, set the repeat control, and set the serializer pixel
> repeat count.  Since the audio code needs the actual TMDS clock,
> record that.

Note that this is an experimental patch - I haven't yet been able to
test it beyond "does it still work with non-doubled modes".  They
tend to be low resolution modes, because the doubling is needed to
maintain a minimum clock rate over HDMI.

The doubled modes are (eg):

VIC 	Name
6	720(1440)x480i@60Hz
7	720(1440)x480i@60Hz
8	720(1440)x240@60Hz
21	720(1440)x576i@50Hz
22	720(1440)x576i@50Hz
23	720(1440)x288@50Hz
24	720(1440)x288@50Hz

They are probably only found with TVs rather than monitors.

> 
> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/gpu/drm/i2c/tda998x_drv.c | 26 ++++++++++++++++----------
>  1 file changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
> index a31809ce30e2..08ce28cbdec4 100644
> --- a/drivers/gpu/drm/i2c/tda998x_drv.c
> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c
> @@ -241,6 +241,7 @@ struct tda998x_priv {
>  # define HVF_CNTRL_1_PAD(x)       (((x) & 3) << 4)
>  # define HVF_CNTRL_1_SEMI_PLANAR  (1 << 6)
>  #define REG_RPT_CNTRL             REG(0x00, 0xf0)     /* write */
> +# define RPT_CNTRL_REPEAT(x)      ((x) & 15)
>  #define REG_I2S_FORMAT            REG(0x00, 0xfc)     /* read/write */
>  # define I2S_FORMAT(x)            (((x) & 3) << 0)
>  #define REG_AIP_CLKSEL            REG(0x00, 0xfd)     /* write */
> @@ -1342,7 +1343,7 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
>  	u16 vwin1_line_s, vwin1_line_e;
>  	u16 vwin2_line_s, vwin2_line_e;
>  	u16 de_pix_s, de_pix_e;
> -	u8 reg, div, rep;
> +	u8 reg, div, rep, sel_clk;
>  
>  	/*
>  	 * Internally TDA998x is using ITU-R BT.656 style sync but
> @@ -1405,7 +1406,16 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
>  			       (mode->vsync_end - mode->vsync_start)/2;
>  	}
>  
> -	tmds_clock = mode->clock;
> +	/*
> +	 * Select pixel repeat depending on the double-clock flag
> +	 * (which means we have to repeat each pixel once.)
> +	 */
> +	rep = mode->flags & DRM_MODE_FLAG_DBLCLK ? 1 : 0;
> +	sel_clk = SEL_CLK_ENA_SC_CLK | SEL_CLK_SEL_CLK1 |
> +		  SEL_CLK_SEL_VRF_CLK(rep ? 2 : 0);
> +
> +	/* the TMDS clock is scaled up by the pixel repeat */
> +	tmds_clock = mode->clock * (1 + rep);
>  
>  	/*
>  	 * The divisor is power-of-2. The TDA9983B datasheet gives
> @@ -1421,6 +1431,8 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
>  
>  	mutex_lock(&priv->audio_mutex);
>  
> +	priv->tmds_clock = tmds_clock;
> +
>  	/* mute the audio FIFO: */
>  	reg_set(priv, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_FIFO);
>  
> @@ -1443,12 +1455,8 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
>  	reg_write(priv, REG_SERIALIZER, 0);
>  	reg_write(priv, REG_HVF_CNTRL_1, HVF_CNTRL_1_VQR(0));
>  
> -	/* TODO enable pixel repeat for pixel rates less than 25Msamp/s */
> -	rep = 0;
> -	reg_write(priv, REG_RPT_CNTRL, 0);
> -	reg_write(priv, REG_SEL_CLK, SEL_CLK_SEL_VRF_CLK(0) |
> -			SEL_CLK_SEL_CLK1 | SEL_CLK_ENA_SC_CLK);
> -
> +	reg_write(priv, REG_RPT_CNTRL, RPT_CNTRL_REPEAT(rep));
> +	reg_write(priv, REG_SEL_CLK, sel_clk);
>  	reg_write(priv, REG_PLL_SERIAL_2, PLL_SERIAL_2_SRL_NOSC(div) |
>  			PLL_SERIAL_2_SRL_PR(rep));
>  
> @@ -1516,8 +1524,6 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
>  	/* must be last register set: */
>  	reg_write(priv, REG_TBG_CNTRL_0, 0);
>  
> -	priv->tmds_clock = adjusted_mode->clock;
> -
>  	/* CEA-861B section 6 says that:
>  	 * CEA version 1 (CEA-861) has no support for infoframes.
>  	 * CEA version 2 (CEA-861A) supports version 1 AVI infoframes,
> -- 
> 2.7.4
> 

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up

  reply	other threads:[~2018-07-31  9:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 16:41 [PATCH v2 0/7] tda998x: allow use with bridge based devices Russell King - ARM Linux
2018-07-30 16:42 ` [PATCH v2 1/7] drm/i2c: tda998x: find the drm_device via the drm_connector Russell King
2018-07-30 16:42 ` [PATCH v2 2/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Russell King
2018-07-31  5:46   ` Peter Rosin
2018-07-30 16:42 ` [PATCH v2 3/7] drm/i2c: tda998x: move tda998x_set_config() into tda998x_create() Russell King
2018-07-30 16:42 ` [PATCH v2 4/7] drm/i2c: tda998x: convert to bridge driver Russell King
2018-07-31  7:37   ` Peter Rosin
2018-08-08 19:09   ` Sean Paul
2018-08-08 22:15     ` Russell King - ARM Linux
2018-08-10 16:11       ` Sean Paul
2018-08-10 16:50         ` Russell King - ARM Linux
2018-08-10 17:02           ` Sean Paul
2018-08-10 17:16             ` Russell King - ARM Linux
2018-08-14 10:42               ` Daniel Vetter
2018-08-14 10:48                 ` Russell King - ARM Linux
2018-08-14 11:11                   ` Daniel Vetter
2018-08-27 16:15   ` Andrzej Hajda
2018-08-27 17:59     ` Russell King - ARM Linux
2018-08-28  7:31       ` Andrzej Hajda
2018-07-30 16:42 ` [PATCH v2 5/7] drm/i2c: tda998x: allocate tda998x_priv inside tda998x_create() Russell King
2018-07-30 16:42 ` [PATCH v2 6/7] drm/i2c: tda998x: cleanup from previous changes Russell King
2018-07-30 16:42 ` [PATCH v2 7/7] drm/i2c: tda998x: register bridge outside of component helper Russell King
2018-08-27 16:19   ` Andrzej Hajda
2018-07-31  5:44 ` [PATCH v2 0/7] tda998x: allow use with bridge based devices Peter Rosin
2018-07-31  7:41   ` Russell King - ARM Linux
2018-07-31  7:53     ` Peter Rosin
2018-07-31  9:23       ` Russell King - ARM Linux
2018-07-31  9:26         ` [PATCH 1/4] drm/i2c: tda998x: move mode_valid() to bridge Russell King
2018-08-27 16:24           ` Andrzej Hajda
2018-07-31  9:26         ` [PATCH 2/4] drm/i2c: tda998x: get rid of private fill_modes function Russell King
2018-07-31  9:26         ` [PATCH 3/4] drm/i2c: tda998x: correct PLL divider calculation Russell King
2018-07-31  9:26         ` [PATCH 4/4] drm/i2c: tda998x: add support for pixel repeated modes Russell King
2018-07-31  9:42           ` Russell King - ARM Linux [this message]
2018-07-31 10:43         ` [PATCH v2 0/7] tda998x: allow use with bridge based devices Peter Rosin
2018-07-31 11:15           ` Russell King - ARM Linux
2018-08-01  9:01             ` Peter Rosin
2018-08-01  9:35               ` Russell King - ARM Linux
2018-08-02  6:06                 ` Peter Rosin
2018-11-12 16:50                   ` Peter Rosin
2018-11-12 17:00                     ` Russell King - ARM Linux

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=20180731094247.GI17271@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Liviu.Dudau@arm.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=peda@axentia.se \
    --cc=tomi.valkeinen@ti.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).