summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i2c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-03-01 19:12:28 +0000
committerRussell King <rmk+kernel@armlinux.org.uk>2019-06-13 21:54:45 +0100
commit82642ab7345d7e736c6f1dee58c033ea6b41d2e9 (patch)
tree8d3be9168b816bb908bd01fd6d16384c5c705f56 /drivers/gpu/drm/i2c
parenta03a915b8387286dfd1e7500705124414802ede7 (diff)
drm/i2c: tda998x: store audio port enable in settings
Store the audio port enable register in the audio settings structure, which can never be zero for a valid audio configuration. Use this to signal whether we have audio configured, rather than AFMT_UNUSED. Tested-by: Sven Van Asbroeck <TheSven73@gmail.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/i2c')
-rw-r--r--drivers/gpu/drm/i2c/tda998x_drv.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 9b3e47f408ca..9590c4f92969 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -42,6 +42,7 @@ struct tda998x_audio_port {
struct tda998x_audio_settings {
struct tda998x_audio_params params;
+ u8 ena_ap;
u8 i2s_format;
u8 cts_n;
};
@@ -961,10 +962,14 @@ static int tda998x_configure_audio(struct tda998x_priv *priv,
u8 buf[6], clksel_aip, clksel_fs, adiv;
u32 n;
+ /* If audio is not configured, there is nothing to do. */
+ if (settings->ena_ap == 0)
+ return 0;
+
adiv = tda998x_get_adiv(priv, settings->params.sample_rate);
/* Enable audio ports */
- reg_write(priv, REG_ENA_AP, settings->params.config);
+ reg_write(priv, REG_ENA_AP, settings->ena_ap);
/* Set audio input source */
switch (settings->params.format) {
@@ -1074,9 +1079,9 @@ static int tda998x_audio_hw_params(struct device *dev, void *data,
for (i = 0; i < ARRAY_SIZE(priv->audio_port); i++)
if (priv->audio_port[i].format == audio.params.format)
- audio.params.config = priv->audio_port[i].config;
+ audio.ena_ap = priv->audio_port[i].config;
- if (audio.params.config == 0) {
+ if (audio.ena_ap == 0) {
dev_err(dev, "%s: No audio configuration found\n", __func__);
return -EINVAL;
}
@@ -1116,8 +1121,7 @@ static void tda998x_audio_shutdown(struct device *dev, void *data)
mutex_lock(&priv->audio_mutex);
reg_write(priv, REG_ENA_AP, 0);
-
- priv->audio.params.format = AFMT_UNUSED;
+ priv->audio.ena_ap = 0;
mutex_unlock(&priv->audio_mutex);
}
@@ -1623,8 +1627,7 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
tda998x_write_avi(priv, adjusted_mode);
- if (priv->audio.params.format != AFMT_UNUSED &&
- priv->sink_has_audio)
+ if (priv->sink_has_audio)
tda998x_configure_audio(priv, &priv->audio);
}
@@ -1705,6 +1708,7 @@ static int tda998x_set_config(struct tda998x_priv *priv,
bool spdif = p->audio_params.format == AFMT_SPDIF;
priv->audio.params = p->audio_params;
+ priv->audio.ena_ap = p->audio_params.config;
priv->audio.i2s_format = I2S_FORMAT_PHILIPS;
ratio = spdif ? 64 : p->audio_params.sample_width * 2;