drm/i2c: tda998x: clean up tda998x_configure_audio()
tda998x_configure_audio() is called via some paths where an error return is meaningless, and as a result of moving the audio routing code, this function no longer returns any errors, so let's make it void. We can also make tda998x_write_aif() return void as well. tda998x_configure_audio() also only ever needs to write the current audio settings, so simplify the code in tda998x_audio_hw_params() so that can happen. Tested-by: Sven Van Asbroeck <TheSven73@gmail.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
This commit is contained in:
parent
26f7bf1251
commit
900b2b7250
@ -849,7 +849,7 @@ tda998x_write_if(struct tda998x_priv *priv, u8 bit, u16 addr,
|
|||||||
reg_set(priv, REG_DIP_IF_FLAGS, bit);
|
reg_set(priv, REG_DIP_IF_FLAGS, bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tda998x_write_aif(struct tda998x_priv *priv,
|
static void tda998x_write_aif(struct tda998x_priv *priv,
|
||||||
const struct hdmi_audio_infoframe *cea)
|
const struct hdmi_audio_infoframe *cea)
|
||||||
{
|
{
|
||||||
union hdmi_infoframe frame;
|
union hdmi_infoframe frame;
|
||||||
@ -857,8 +857,6 @@ static int tda998x_write_aif(struct tda998x_priv *priv,
|
|||||||
frame.audio = *cea;
|
frame.audio = *cea;
|
||||||
|
|
||||||
tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, &frame);
|
tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, &frame);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -992,15 +990,15 @@ static void tda998x_audio_mute(struct tda998x_priv *priv, bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tda998x_configure_audio(struct tda998x_priv *priv,
|
static void tda998x_configure_audio(struct tda998x_priv *priv)
|
||||||
const struct tda998x_audio_settings *settings)
|
|
||||||
{
|
{
|
||||||
|
const struct tda998x_audio_settings *settings = &priv->audio;
|
||||||
u8 buf[6], adiv;
|
u8 buf[6], adiv;
|
||||||
u32 n;
|
u32 n;
|
||||||
|
|
||||||
/* If audio is not configured, there is nothing to do. */
|
/* If audio is not configured, there is nothing to do. */
|
||||||
if (settings->ena_ap == 0)
|
if (settings->ena_ap == 0)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
adiv = tda998x_get_adiv(priv, settings->params.sample_rate);
|
adiv = tda998x_get_adiv(priv, settings->params.sample_rate);
|
||||||
|
|
||||||
@ -1048,7 +1046,7 @@ static int tda998x_configure_audio(struct tda998x_priv *priv,
|
|||||||
msleep(20);
|
msleep(20);
|
||||||
tda998x_audio_mute(priv, false);
|
tda998x_audio_mute(priv, false);
|
||||||
|
|
||||||
return tda998x_write_aif(priv, &settings->params.cea);
|
tda998x_write_aif(priv, &settings->params.cea);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tda998x_audio_hw_params(struct device *dev, void *data,
|
static int tda998x_audio_hw_params(struct device *dev, void *data,
|
||||||
@ -1108,16 +1106,12 @@ static int tda998x_audio_hw_params(struct device *dev, void *data,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
mutex_lock(&priv->audio_mutex);
|
mutex_lock(&priv->audio_mutex);
|
||||||
if (priv->supports_infoframes && priv->sink_has_audio)
|
|
||||||
ret = tda998x_configure_audio(priv, &audio);
|
|
||||||
else
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
if (ret == 0)
|
|
||||||
priv->audio = audio;
|
priv->audio = audio;
|
||||||
|
if (priv->supports_infoframes && priv->sink_has_audio)
|
||||||
|
tda998x_configure_audio(priv);
|
||||||
mutex_unlock(&priv->audio_mutex);
|
mutex_unlock(&priv->audio_mutex);
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tda998x_audio_shutdown(struct device *dev, void *data)
|
static void tda998x_audio_shutdown(struct device *dev, void *data)
|
||||||
@ -1629,7 +1623,7 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
|
|||||||
tda998x_write_avi(priv, adjusted_mode);
|
tda998x_write_avi(priv, adjusted_mode);
|
||||||
|
|
||||||
if (priv->sink_has_audio)
|
if (priv->sink_has_audio)
|
||||||
tda998x_configure_audio(priv, &priv->audio);
|
tda998x_configure_audio(priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&priv->audio_mutex);
|
mutex_unlock(&priv->audio_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user