linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yang Kuankuan <ykk@rock-chips.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: David Airlie <airlied@linux.ie>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Shawn Guo <shawn.guo@linaro.org>, Rob Clark <robdclark@gmail.com>,
	Mark Yao <mark.yao@rock-chips.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	djkurtz@chromium.org, dbehr@chromoum.org, mmind00@googlemail.com,
	dianders@chromium.org, marcheu@chromium.org,
	rockchip-discuss@chromium.org
Subject: Re: [PATCH v2 01/12] drm: bridge/dw_hdmi: adjust n/cts setting order
Date: Mon, 02 Feb 2015 08:02:37 -0500	[thread overview]
Message-ID: <54CF756D.1010500@rock-chips.com> (raw)
In-Reply-To: <20150131110704.GU26493@n2100.arm.linux.org.uk>


On 01/31/2015 06:07 AM, Russell King - ARM Linux wrote:
> On Fri, Jan 30, 2015 at 06:25:30AM -0500, Yakir Yang wrote:
>> For Designerware HDMI, the following write sequence is recommended:
>> 1. aud_n3 (set bit ncts_atomic_write if desired)
>> 2. aud_cts3 (set CTS_manual and CTS value if desired/enabled)
>> 3. aud_cts2 (required in CTS_manual)
>> 4. aud_cts1 (required in CTS_manual)
>> 5. aud_n3 (bit ncts_atomic_write with same value as in step 1.)
>> 6. aud_n2
>> 7. aud_n1
>>
>> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
>> ---
>> Changes in v2:
>> - adjust n/cts setting order
>>
>>   drivers/gpu/drm/bridge/dw_hdmi.c | 37 +++++++++++++++++++++----------------
>>   drivers/gpu/drm/bridge/dw_hdmi.h |  6 ++++++
>>   2 files changed, 27 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
>> index cd6a706..423addc 100644
>> --- a/drivers/gpu/drm/bridge/dw_hdmi.c
>> +++ b/drivers/gpu/drm/bridge/dw_hdmi.c
>> @@ -177,26 +177,31 @@ static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 data, unsigned int reg,
>>   	hdmi_modb(hdmi, data << shift, mask, reg);
>>   }
>>   
>> -static void hdmi_set_clock_regenerator_n(struct dw_hdmi *hdmi,
>> -					 unsigned int value)
>> +static void hdmi_regenerate_n_cts(struct dw_hdmi *hdmi, unsigned int n,
>> +				  unsigned int cts)
>>   {
>> -	hdmi_writeb(hdmi, value & 0xff, HDMI_AUD_N1);
>> -	hdmi_writeb(hdmi, (value >> 8) & 0xff, HDMI_AUD_N2);
>> -	hdmi_writeb(hdmi, (value >> 16) & 0x0f, HDMI_AUD_N3);
>> +	/* set ncts_atomic_write */
>> +	hdmi_modb(hdmi, HDMI_AUD_N3_NCTS_ATOMIC_WRITE_SET,
>> +		  HDMI_AUD_N3_NCTS_ATOMIC_WRITE_MASK, HDMI_AUD_N3);
> Bits 7:4 of N3 are marked up in the iMX6 manuals as "reserved".  We need
> some clarification from FSL whether this matters, but at the moment my
> opinion on that is this should be conditionalised against the IP version.

Should we take the design_id(0x13 on iMX6, 0x20 on rk3288) to separate it.


> Setting bit 7 as you do above may not cause any harm on iMX6, but on the
> other hand, we shouldn't be setting bits which are marked as reserved.
>
>> +
>> +	/* set cts manual */
>> +	hdmi_modb(hdmi, HDMI_AUD_CTS3_CTS_MANUAL,
>> +		  HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
>>   
>>   	/* nshift factor = 0 */
>>   	hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3);
>> -}
>> -
>> -static void hdmi_regenerate_cts(struct dw_hdmi *hdmi, unsigned int cts)
>> -{
>> -	/* Must be set/cleared first */
>> -	hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
>>   
>> -	hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1);
>> +	/* set cts values */
>> +	hdmi_modb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK),
>> +		  HDMI_AUD_CTS3_AUDCTS19_16_MASK, HDMI_AUD_CTS3);
>>   	hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2);
>> -	hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
>> -		    HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
>> +	hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1);
>> +
>> +	/* set n values */
>> +	hdmi_modb(hdmi, (n >> 16) & HDMI_AUD_N3_AUDN19_16_MASK,
>> +		  HDMI_AUD_N3_AUDN19_16_MASK, HDMI_AUD_N3);
>> +	hdmi_writeb(hdmi, (n >> 8) & 0xff, HDMI_AUD_N2);
>> +	hdmi_writeb(hdmi, n & 0xff, HDMI_AUD_N1);
> This is definitely moving things in the right direction.  However, I would
> ask that the read-modify-writes to HDMI_AUD_N3 are open-coded rather than
> using hdmi_modb(), and consolidated.  We really don't need to keep
> re-reading this register.

Maybe we also can take design_id to separate it here.

>
> I'd also like to check that this does not cause a regression on iMX6 SoCs
> with my audio driver; I'm aware that there are some issues to do with how
> these registers are written, and the published errata workaround in the
> iMX6 errata documentation doesn't seem to always work.
>
>>   }
>>   
>>   static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk,
>> @@ -355,8 +360,8 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi,
>>   		__func__, hdmi->sample_rate, hdmi->ratio,
>>   		pixel_clk, clk_n, clk_cts);
>>   
>> -	hdmi_set_clock_regenerator_n(hdmi, clk_n);
>> -	hdmi_regenerate_cts(hdmi, clk_cts);
>> +	hdmi_regenerate_n_cts(hdmi, clk_n, clk_cts);
>> +	hdmi_set_schnl(hdmi);
> I'd prefer the addition of hdmi_set_schnl() to be in the patch which adds
> that new function.  However, as I mentioned in my reply to that patch,
> other versions of this IP do not have these registers, and it may not be
> safe to write to them.  We need to find a way to know whether this IP
> has the AHB DMA support or not and act accordingly.
>



  reply	other threads:[~2015-02-02 13:03 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 11:23 [PATCH v2 0/12] Those patches is used for dw_hdmi audio support Yakir Yang
2015-01-30 11:25 ` [PATCH v2 01/12] drm: bridge/dw_hdmi: adjust n/cts setting order Yakir Yang
2015-01-31 11:07   ` Russell King - ARM Linux
2015-02-02 13:02     ` Yang Kuankuan [this message]
2015-01-30 11:27 ` [PATCH v2 02/12] drm: bridge/dw_hdmi: add audio sample channel status setting Yakir Yang
2015-01-31 11:08   ` Russell King - ARM Linux
2015-01-31 11:22     ` Yang Kuankuan
2015-01-31 11:30       ` Russell King - ARM Linux
2015-01-30 11:28 ` [PATCH v2 03/12] drm: bridge/dw_hdmi: add irq control to suspend/resume Yakir Yang
2015-01-31 11:11   ` Russell King - ARM Linux
2015-01-31 11:18     ` Yang Kuankuan
2015-01-30 11:28 ` [PATCH v2 04/12] drm: rockchip/dw_hdmi_rockchip: add resume/suspend support Yakir Yang
2015-01-31 11:13   ` Russell King - ARM Linux
2015-01-31 12:30     ` Yang Kuankuan
2015-01-30 11:29 ` [PATCH v2 05/12] drm: rockchip/vop: filter interlace display mode Yakir Yang
2015-02-02  8:00   ` Daniel Kurtz
2015-02-02  8:28     ` Yang Kuankuan
2015-01-30 11:30 ` [PATCH v2 06/12] drm: bridge/dw_hdmi: add audio support for more display resolutions Yakir Yang
2015-01-31 11:20   ` Russell King - ARM Linux
2015-01-31 13:28     ` Yang Kuankuan
2015-01-30 11:31 ` [PATCH v2 07/12] drm: bridge/dw_hdmi: enable audio support for No-CEA " Yakir Yang
2015-01-31 11:41   ` Russell King - ARM Linux
2015-01-30 11:32 ` [PATCH v2 08/12] drm: bridge/dw_hdmi: add audio config interfaces Yakir Yang
2015-01-31 11:48   ` Russell King - ARM Linux
2015-01-31 14:34     ` Yang Kuankuan
2015-02-02  4:02       ` Daniel Kurtz
2015-02-02 11:53         ` Russell King - ARM Linux
2015-02-02 12:32           ` Yang Kuankuan
2015-02-02 13:09             ` Russell King - ARM Linux
2015-02-03  3:05               ` Yang Kuankuan
2015-02-04  3:02               ` Yang Kuankuan
2015-01-30 11:33 ` [PATCH v2 09/12] drm: bridge/dw_hdmi: creat dw-hdmi-audio platform device Yakir Yang
2015-01-30 11:41 ` [PATCH v2 10/12] ASoC: dw-hdmi-audio: add codec driver for dw hdmi audio Yakir Yang
2015-01-31 11:39   ` Russell King - ARM Linux
2015-01-30 11:43 ` [PATCH v2 11/12] ASoC: rockchip-hdmi-audio: add sound driver for " Yakir Yang
2015-01-30 11:44 ` [PATCH v2 12/12] dt-bindings: Add documentation for Rockchip dw-hdmi-audio Yakir Yang
2015-01-31 11:36   ` Russell King - ARM Linux
2015-01-31 13:51     ` Yang Kuankuan
2015-01-31 12:00 ` [PATCH v2 0/12] Those patches is used for dw_hdmi audio support Russell King - ARM Linux
2015-02-02 13:02   ` Yang Kuankuan

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=54CF756D.1010500@rock-chips.com \
    --to=ykk@rock-chips.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dbehr@chromoum.org \
    --cc=dianders@chromium.org \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marcheu@chromium.org \
    --cc=mark.yao@rock-chips.com \
    --cc=mmind00@googlemail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robdclark@gmail.com \
    --cc=rockchip-discuss@chromium.org \
    --cc=shawn.guo@linaro.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).