From: Russell King <rmk+kernel@armlinux.org.uk>
To: Sven Van Asbroeck <thesven73@gmail.com>,
Mark Brown <broonie@kernel.org>,
Peter Ujfalusi <peter.ujfalusi@ti.com>,
Jyri Sarha <jsarha@ti.com>
Cc: David Airlie <airlied@linux.ie>, dri-devel@lists.freedesktop.org
Subject: [PATCH 10/13] drm/i2c: tda998x: get rid of params in audio settings
Date: Tue, 11 Jun 2019 12:02:23 +0100 [thread overview]
Message-ID: <E1haeXn-0001yg-IP@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20190611110052.iw6qbw2yvypxus6t@shell.armlinux.org.uk>
Get rid of the tda998x_audio_params structure in audio_settings, which
is now just used for platform data.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
drivers/gpu/drm/i2c/tda998x_drv.c | 43 +++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 4b5491e20ab6..783cbc9c97b2 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -49,7 +49,9 @@ struct tda998x_audio_route {
struct tda998x_audio_settings {
const struct tda998x_audio_route *route;
- struct tda998x_audio_params params;
+ struct hdmi_audio_infoframe cea;
+ unsigned int sample_rate;
+ u8 status[5];
u8 ena_ap;
u8 i2s_format;
u8 cts_n;
@@ -1000,7 +1002,7 @@ static void tda998x_configure_audio(struct tda998x_priv *priv)
if (settings->ena_ap == 0)
return;
- adiv = tda998x_get_adiv(priv, settings->params.sample_rate);
+ adiv = tda998x_get_adiv(priv, settings->sample_rate);
/* Enable audio ports */
reg_write(priv, REG_ENA_AP, settings->ena_ap);
@@ -1017,7 +1019,7 @@ static void tda998x_configure_audio(struct tda998x_priv *priv)
* This is the approximate value of N, which happens to be
* the recommended values for non-coherent clocks.
*/
- n = 128 * settings->params.sample_rate / 1000;
+ n = 128 * settings->sample_rate / 1000;
/* Write the CTS and N values */
buf[0] = 0x44;
@@ -1036,17 +1038,17 @@ static void tda998x_configure_audio(struct tda998x_priv *priv)
* The REG_CH_STAT_B-registers skip IEC958 AES2 byte, because
* there is a separate register for each I2S wire.
*/
- buf[0] = settings->params.status[0];
- buf[1] = settings->params.status[1];
- buf[2] = settings->params.status[3];
- buf[3] = settings->params.status[4];
+ buf[0] = settings->status[0];
+ buf[1] = settings->status[1];
+ buf[2] = settings->status[3];
+ buf[3] = settings->status[4];
reg_write_range(priv, REG_CH_STAT_B(0), buf, 4);
tda998x_audio_mute(priv, true);
msleep(20);
tda998x_audio_mute(priv, false);
- tda998x_write_aif(priv, &settings->params.cea);
+ tda998x_write_aif(priv, &settings->cea);
}
static int tda998x_audio_hw_params(struct device *dev, void *data,
@@ -1058,15 +1060,12 @@ static int tda998x_audio_hw_params(struct device *dev, void *data,
bool spdif = daifmt->fmt == HDMI_SPDIF;
int ret;
struct tda998x_audio_settings audio = {
- .params = {
- .sample_width = params->sample_width,
- .sample_rate = params->sample_rate,
- .cea = params->cea,
- },
+ .sample_rate = params->sample_rate,
+ .cea = params->cea,
};
- memcpy(audio.params.status, params->iec.status,
- min(sizeof(audio.params.status), sizeof(params->iec.status)));
+ memcpy(audio.status, params->iec.status,
+ min(sizeof(audio.status), sizeof(params->iec.status)));
switch (daifmt->fmt) {
case HDMI_I2S:
@@ -1678,9 +1677,15 @@ static int tda998x_get_audio_ports(struct tda998x_priv *priv,
return -EINVAL;
}
+ if (!ena_ap) {
+ dev_err(&priv->hdmi->dev, "invalid zero port config\n");
+ continue;
+ }
+
if (priv->audio_port_enable[route]) {
dev_err(&priv->hdmi->dev,
- "There can only be on I2S port and one SPDIF port\n");
+ "%s format already configured\n",
+ route == AUDIO_ROUTE_SPDIF ? "SPDIF" : "I2S");
return -EINVAL;
}
@@ -1712,7 +1717,11 @@ static int tda998x_set_config(struct tda998x_priv *priv,
route = AUDIO_ROUTE_I2S + spdif;
priv->audio.route = &tda998x_audio_route[route];
- priv->audio.params = p->audio_params;
+ priv->audio.cea = p->audio_params.cea;
+ priv->audio.sample_rate = p->audio_params.sample_rate;
+ memcpy(priv->audio.status, p->audio_params.status,
+ min(sizeof(priv->audio.status),
+ sizeof(p->audio_params.status)));
priv->audio.ena_ap = p->audio_params.config;
priv->audio.i2s_format = I2S_FORMAT_PHILIPS;
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-06-11 11:09 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-11 11:00 [PATCH 00/13] tda998x updates Russell King - ARM Linux admin
2019-06-11 11:01 ` [PATCH 01/13] drm/i2c: tda998x: introduce tda998x_audio_settings Russell King
2019-06-12 15:24 ` Sven Van Asbroeck
2019-06-13 9:52 ` Russell King - ARM Linux admin
2019-06-11 11:01 ` [PATCH 02/13] drm/i2c: tda998x: implement different I2S flavours Russell King
2019-06-11 11:01 ` [PATCH 03/13] drm/i2c: tda998x: improve programming of audio divisor Russell King
2019-06-12 15:25 ` Sven Van Asbroeck
2019-06-12 16:26 ` Russell King - ARM Linux admin
2019-06-11 11:01 ` [PATCH 04/13] drm/i2c: tda998x: derive CTS_N value from aclk sample rate ratio Russell King
2019-06-12 15:27 ` Sven Van Asbroeck
2019-06-12 16:28 ` Russell King - ARM Linux admin
2019-06-12 16:37 ` Sven Van Asbroeck
2019-06-12 16:42 ` Russell King - ARM Linux admin
2019-06-12 16:45 ` Sven Van Asbroeck
2019-06-11 11:01 ` [PATCH 05/13] drm/i2c: tda998x: store audio port enable in settings Russell King
2019-06-11 11:02 ` [PATCH 06/13] drm/i2c: tda998x: index audio port enable config by route type Russell King
2019-06-11 11:02 ` [PATCH 07/13] drm/i2c: tda998x: configure both fields of AIP_CLKSEL together Russell King
2019-06-11 11:02 ` [PATCH 08/13] drm/i2c: tda998x: move audio routing configuration Russell King
2019-06-12 15:36 ` Sven Van Asbroeck
2019-06-12 16:32 ` Russell King - ARM Linux admin
2019-06-11 11:02 ` [PATCH 09/13] drm/i2c: tda998x: clean up tda998x_configure_audio() Russell King
2019-06-12 15:37 ` Sven Van Asbroeck
2019-06-11 11:02 ` Russell King [this message]
2019-06-11 11:02 ` [PATCH 11/13] drm/i2c: tda998x: add support for pixel repeated modes Russell King
2019-06-11 11:02 ` [PATCH 12/13] drm/i2c: tda998x: add bridge timing information Russell King
2019-06-12 15:38 ` Sven Van Asbroeck
2019-06-13 10:01 ` Russell King - ARM Linux admin
2019-06-11 11:02 ` [PATCH 13/13] drm/i2c: tda998x: improve correctness of quantisation range Russell King
2019-06-12 15:40 ` [PATCH 00/13] tda998x updates Sven Van Asbroeck
2019-06-13 10:52 ` Russell King - ARM Linux admin
2019-06-13 14:29 ` [PATCH v2 " Russell King - ARM Linux admin
2019-06-13 14:30 ` [PATCH v2 01/13] drm/i2c: tda998x: introduce tda998x_audio_settings Russell King
2019-06-13 18:48 ` Sven Van Asbroeck
2019-06-13 20:36 ` Russell King - ARM Linux admin
2019-06-13 14:31 ` [PATCH v2 02/13] drm/i2c: tda998x: implement different I2S flavours Russell King
2019-06-13 14:31 ` [PATCH v2 03/13] drm/i2c: tda998x: improve programming of audio divisor Russell King
2019-06-13 14:31 ` [PATCH v2 04/13] drm/i2c: tda998x: derive CTS_N value from aclk sample rate ratio Russell King
2019-06-13 14:31 ` [PATCH v2 05/13] drm/i2c: tda998x: store audio port enable in settings Russell King
2019-06-13 14:31 ` [PATCH v2 06/13] drm/i2c: tda998x: index audio port enable config by route type Russell King
2019-06-13 14:31 ` [PATCH v2 07/13] drm/i2c: tda998x: configure both fields of AIP_CLKSEL together Russell King
2019-06-13 14:31 ` [PATCH v2 08/13] drm/i2c: tda998x: move audio routing configuration Russell King
2019-06-13 14:31 ` [PATCH v2 09/13] drm/i2c: tda998x: clean up tda998x_configure_audio() Russell King
2019-06-13 14:31 ` [PATCH v2 10/13] drm/i2c: tda998x: get rid of params in audio settings Russell King
2019-06-13 14:31 ` [PATCH v2 11/13] drm/i2c: tda998x: add support for pixel repeated modes Russell King
2019-06-13 14:31 ` [PATCH v2 12/13] drm/i2c: tda998x: improve correctness of quantisation range Russell King
2019-06-13 14:31 ` [PATCH v2 13/13] drm/i2c: tda998x: add vendor specific infoframe support Russell King
2019-06-13 19:51 ` [PATCH v2 00/13] tda998x updates Sven Van Asbroeck
2019-06-13 20:56 ` Russell King - ARM Linux admin
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=E1haeXn-0001yg-IP@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=airlied@linux.ie \
--cc=broonie@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jsarha@ti.com \
--cc=peter.ujfalusi@ti.com \
--cc=thesven73@gmail.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