From: Russell King <rmk+kernel@arm.linux.org.uk>
To: linux-rockchip@lists.infradead.org, alsa-devel@alsa-project.org,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
Jaroslav Kysela <perex@perex.cz>, Mark Brown <broonie@kernel.org>,
Yakir Yang <ykk@rock-chips.com>,
Andy Yan <andy.yan@rock-chips.com>
Subject: [PATCH 7/9] drm: bridge/dw_hdmi: remove ratio support from ACR code
Date: Sat, 08 Aug 2015 17:10:37 +0100 [thread overview]
Message-ID: <E1ZO6hh-0003Nc-A7@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20150808160936.GN7557@n2100.arm.linux.org.uk>
We never set the ratio for CTS/N calculation for the audio clock
regenerator (ACR) to anything but 100, so this adds pointless
complexity. Should we support pixel repetition, we should update the
CTS/N calculation code to use those parameters or the actual TMDS clock
rate instead of a ratio.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
drivers/gpu/drm/bridge/dw_hdmi.c | 44 ++++++++++++++++------------------------
1 file changed, 18 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 5576cd7d7abb..60487bff48e3 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -140,7 +140,6 @@ struct dw_hdmi {
unsigned int audio_cts;
unsigned int audio_n;
bool audio_enable;
- int ratio;
void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
u8 (*read)(struct dw_hdmi *hdmi, int offset);
@@ -217,8 +216,7 @@ static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts,
hdmi_writeb(hdmi, n & 0xff, HDMI_AUD_N1);
}
-static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk,
- unsigned int ratio)
+static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk)
{
unsigned int n = (128 * freq) / 1000;
unsigned int mult = 1;
@@ -231,9 +229,9 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk,
switch (freq) {
case 32000:
if (pixel_clk == 25175000)
- n = (ratio == 150) ? 9152 : 4576;
+ n = 4576;
else if (pixel_clk == 27027000)
- n = (ratio == 150) ? 8192 : 4096;
+ n = 4096;
else if (pixel_clk == 74176000 || pixel_clk == 148352000)
n = 11648;
else
@@ -247,7 +245,7 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk,
else if (pixel_clk == 74176000)
n = 17836;
else if (pixel_clk == 148352000)
- n = (ratio == 150) ? 17836 : 8918;
+ n = 8918;
else
n = 6272;
n *= mult;
@@ -255,13 +253,13 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk,
case 48000:
if (pixel_clk == 25175000)
- n = (ratio == 150) ? 9152 : 6864;
+ n = 6864;
else if (pixel_clk == 27027000)
- n = (ratio == 150) ? 8192 : 6144;
+ n = 6144;
else if (pixel_clk == 74176000)
n = 11648;
else if (pixel_clk == 148352000)
- n = (ratio == 150) ? 11648 : 5824;
+ n = 5824;
else
n = 6144;
n *= mult;
@@ -274,13 +272,11 @@ static unsigned int hdmi_compute_n(unsigned int freq, unsigned long pixel_clk,
return n;
}
-static unsigned int hdmi_compute_cts(unsigned int freq, unsigned long pixel_clk,
- unsigned int ratio)
+static unsigned int hdmi_compute_cts(unsigned int freq, unsigned long pixel_clk)
{
unsigned int cts = 0;
- pr_debug("%s: freq: %d pixel_clk: %ld ratio: %d\n", __func__, freq,
- pixel_clk, ratio);
+ pr_debug("%s: freq: %d pixel_clk: %ld\n", __func__, freq, pixel_clk);
switch (freq) {
case 32000:
@@ -341,26 +337,24 @@ static unsigned int hdmi_compute_cts(unsigned int freq, unsigned long pixel_clk,
default:
break;
}
- if (ratio == 100)
- return cts;
- return (cts * ratio) / 100;
+ return cts;
}
static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi,
- unsigned long pixel_clk, unsigned int sample_rate, unsigned int ratio)
+ unsigned long pixel_clk, unsigned int sample_rate)
{
unsigned int n, cts;
- n = hdmi_compute_n(sample_rate, pixel_clk, ratio);
- cts = hdmi_compute_cts(sample_rate, pixel_clk, ratio);
+ n = hdmi_compute_n(sample_rate, pixel_clk);
+ cts = hdmi_compute_cts(sample_rate, pixel_clk);
if (!cts) {
dev_err(hdmi->dev,
"%s: pixel clock/sample rate not supported: %luMHz / %ukHz\n",
__func__, pixel_clk, sample_rate);
}
- dev_dbg(hdmi->dev, "%s: samplerate=%ukHz ratio=%d pixelclk=%luMHz N=%d cts=%d\n",
- __func__, sample_rate, ratio, pixel_clk, n, cts);
+ dev_dbg(hdmi->dev, "%s: samplerate=%ukHz pixelclk=%luMHz N=%d cts=%d\n",
+ __func__, sample_rate, pixel_clk, n, cts);
spin_lock_irq(&hdmi->audio_lock);
hdmi->audio_n = n;
@@ -372,8 +366,7 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi,
static void hdmi_init_clk_regenerator(struct dw_hdmi *hdmi)
{
mutex_lock(&hdmi->audio_mutex);
- hdmi_set_clk_regenerator(hdmi, 74250000, hdmi->sample_rate,
- hdmi->ratio);
+ hdmi_set_clk_regenerator(hdmi, 74250000, hdmi->sample_rate);
mutex_unlock(&hdmi->audio_mutex);
}
@@ -381,7 +374,7 @@ static void hdmi_clk_regenerator_update_pixel_clock(struct dw_hdmi *hdmi)
{
mutex_lock(&hdmi->audio_mutex);
hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock,
- hdmi->sample_rate, hdmi->ratio);
+ hdmi->sample_rate);
mutex_unlock(&hdmi->audio_mutex);
}
@@ -390,7 +383,7 @@ void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate)
mutex_lock(&hdmi->audio_mutex);
hdmi->sample_rate = rate;
hdmi_set_clk_regenerator(hdmi, hdmi->hdmi_data.video_mode.mpixelclock,
- hdmi->sample_rate, hdmi->ratio);
+ hdmi->sample_rate);
mutex_unlock(&hdmi->audio_mutex);
}
EXPORT_SYMBOL_GPL(dw_hdmi_set_sample_rate);
@@ -1746,7 +1739,6 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
hdmi->dev = dev;
hdmi->dev_type = plat_data->dev_type;
hdmi->sample_rate = 48000;
- hdmi->ratio = 100;
hdmi->encoder = encoder;
hdmi->disabled = true;
hdmi->rxsense = true;
--
2.1.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-08-08 16:10 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-08 16:02 [PATCH 00/12] dw-hdmi development Russell King - ARM Linux
2015-08-08 16:09 ` [PATCH 0/9] dw-hdmi audio support Russell King - ARM Linux
2015-08-08 16:10 ` [PATCH 1/9] drm: bridge/dw_hdmi-ahb-audio: add audio driver Russell King
2015-08-10 10:05 ` Takashi Iwai
2015-08-10 10:39 ` Russell King - ARM Linux
2015-08-10 12:23 ` Takashi Iwai
2015-08-10 16:49 ` Russell King - ARM Linux
2015-08-10 18:16 ` Mark Brown
2015-08-14 13:54 ` [PATCH v2 1/9] drm: bridge/dw_hdmi-ahb-audio: add audio driver David Airlie <airlied@linux.ie>, Sascha Hauer <s.hauer@pengutronix.de>, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jaroslav Kysela <perex@perex.cz>, linux-rockchip@lists.infradead.org, Mark Brown <broonie@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, Yakir Yang <ykk@rock-chips.com>, Andy Yan <andy.yan@rock-chips.com>, Jon Nettleton <jon.nettleton@gmail.com>, linux-arm-kernel@lists.infradead.org Russell King
2015-08-14 14:04 ` [PATCH v2 1/9] drm: bridge/dw_hdmi-ahb-audio: add audio driver Russell King
2015-08-14 14:34 ` [alsa-devel] " Takashi Iwai
2015-10-06 18:07 ` [PATCH " Fabio Estevam
2015-10-06 18:18 ` Russell King - ARM Linux
2015-10-06 18:45 ` Fabio Estevam
2015-10-06 18:54 ` Russell King - ARM Linux
2015-10-06 20:25 ` Fabio Estevam
2015-10-09 16:00 ` Russell King - ARM Linux
2015-10-09 16:02 ` Fabio Estevam
2015-10-09 16:11 ` Russell King - ARM Linux
2015-08-08 16:10 ` [PATCH 2/9] drm: bridge/dw_hdmi-ahb-audio: parse ELD from HDMI driver Russell King
2015-08-08 16:10 ` [PATCH 3/9] drm: bridge/dw_hdmi-ahb-audio: basic support for multi-channel PCM audio Russell King
2015-08-08 16:10 ` [PATCH 4/9] drm: bridge/dw_hdmi-ahb-audio: allow larger buffer sizes Russell King
2015-08-08 16:10 ` [PATCH 5/9] drm: bridge/dw_hdmi: avoid being recursive in N calculation Russell King
2015-09-04 17:50 ` Doug Anderson
2015-08-08 16:10 ` [PATCH 6/9] drm: bridge/dw_hdmi: adjust pixel clock values " Russell King
2015-09-04 18:21 ` Doug Anderson
2015-09-04 19:48 ` Doug Anderson
2015-09-04 21:24 ` Russell King - ARM Linux
2015-09-04 23:50 ` Doug Anderson
2015-09-05 0:27 ` Russell King - ARM Linux
2015-09-05 2:03 ` Doug Anderson
2015-09-05 8:31 ` Russell King - ARM Linux
2015-09-05 13:46 ` Doug Anderson
2015-09-05 14:01 ` Russell King - ARM Linux
2015-09-05 19:44 ` Doug Anderson
2015-09-05 8:34 ` Russell King - ARM Linux
2015-09-05 13:50 ` Doug Anderson
2015-08-08 16:10 ` Russell King [this message]
2015-09-04 18:24 ` [PATCH 7/9] drm: bridge/dw_hdmi: remove ratio support from ACR code Doug Anderson
2015-08-08 16:10 ` [PATCH 8/9] drm: bridge/dw_hdmi: replace CTS calculation for the ACR Russell King
2015-09-04 20:00 ` Doug Anderson
2015-08-08 16:10 ` [PATCH 9/9] drm: bridge/dw_hdmi-i2s-audio: add audio driver Russell King
2015-08-10 15:48 ` Russell King - ARM Linux
2015-08-10 16:26 ` Yakir Yang
2015-08-27 8:42 ` [PATCH 0/9] dw-hdmi audio support Philipp Zabel
2016-01-05 15:40 ` [alsa-devel] " Jean-Michel Hautbois
2016-01-05 15:54 ` Fabio Estevam
2016-01-05 16:04 ` Russell King - ARM Linux
2016-01-07 8:21 ` Jean-Michel Hautbois
2015-08-10 12:21 ` [PATCH 00/12] dw-hdmi development Thierry Reding
2015-08-18 10:37 ` 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=E1ZO6hh-0003Nc-A7@rmk-PC.arm.linux.org.uk \
--to=rmk+kernel@arm.linux.org.uk \
--cc=alsa-devel@alsa-project.org \
--cc=andy.yan@rock-chips.com \
--cc=broonie@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=fabio.estevam@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=perex@perex.cz \
--cc=ykk@rock-chips.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).