aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2019-03-01 16:21:38 -0500
committerRussell King <rmk+kernel@armlinux.org.uk>2019-06-13 16:54:56 -0400
commit900b2b7250b8fe49270e9272a1d937fa69350538 (patch)
treeef77488677f3d19b9dddc77330b7b23c0d370339
parent26f7bf1251c70bafe99f73edd222f6126b395b3b (diff)
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>
-rw-r--r--drivers/gpu/drm/i2c/tda998x_drv.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 0d47cd14011d..e4f0f5699d65 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -849,16 +849,14 @@ tda998x_write_if(struct tda998x_priv *priv, u8 bit, u16 addr,
849 reg_set(priv, REG_DIP_IF_FLAGS, bit); 849 reg_set(priv, REG_DIP_IF_FLAGS, bit);
850} 850}
851 851
852static int tda998x_write_aif(struct tda998x_priv *priv, 852static void tda998x_write_aif(struct tda998x_priv *priv,
853 const struct hdmi_audio_infoframe *cea) 853 const struct hdmi_audio_infoframe *cea)
854{ 854{
855 union hdmi_infoframe frame; 855 union hdmi_infoframe frame;
856 856
857 frame.audio = *cea; 857 frame.audio = *cea;
858 858
859 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, &frame); 859 tda998x_write_if(priv, DIP_IF_FLAGS_IF4, REG_IF4_HB0, &frame);
860
861 return 0;
862} 860}
863 861
864static void 862static void
@@ -992,15 +990,15 @@ static void tda998x_audio_mute(struct tda998x_priv *priv, bool on)
992 } 990 }
993} 991}
994 992
995static int tda998x_configure_audio(struct tda998x_priv *priv, 993static void tda998x_configure_audio(struct tda998x_priv *priv)
996 const struct tda998x_audio_settings *settings)
997{ 994{
995 const struct tda998x_audio_settings *settings = &priv->audio;
998 u8 buf[6], adiv; 996 u8 buf[6], adiv;
999 u32 n; 997 u32 n;
1000 998
1001 /* If audio is not configured, there is nothing to do. */ 999 /* If audio is not configured, there is nothing to do. */
1002 if (settings->ena_ap == 0) 1000 if (settings->ena_ap == 0)
1003 return 0; 1001 return;
1004 1002
1005 adiv = tda998x_get_adiv(priv, settings->params.sample_rate); 1003 adiv = tda998x_get_adiv(priv, settings->params.sample_rate);
1006 1004
@@ -1048,7 +1046,7 @@ static int tda998x_configure_audio(struct tda998x_priv *priv,
1048 msleep(20); 1046 msleep(20);
1049 tda998x_audio_mute(priv, false); 1047 tda998x_audio_mute(priv, false);
1050 1048
1051 return tda998x_write_aif(priv, &settings->params.cea); 1049 tda998x_write_aif(priv, &settings->params.cea);
1052} 1050}
1053 1051
1054static int tda998x_audio_hw_params(struct device *dev, void *data, 1052static 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,
1108 return ret; 1106 return ret;
1109 1107
1110 mutex_lock(&priv->audio_mutex); 1108 mutex_lock(&priv->audio_mutex);
1109 priv->audio = audio;
1111 if (priv->supports_infoframes && priv->sink_has_audio) 1110 if (priv->supports_infoframes && priv->sink_has_audio)
1112 ret = tda998x_configure_audio(priv, &audio); 1111 tda998x_configure_audio(priv);
1113 else
1114 ret = 0;
1115
1116 if (ret == 0)
1117 priv->audio = audio;
1118 mutex_unlock(&priv->audio_mutex); 1112 mutex_unlock(&priv->audio_mutex);
1119 1113
1120 return ret; 1114 return 0;
1121} 1115}
1122 1116
1123static void tda998x_audio_shutdown(struct device *dev, void *data) 1117static void tda998x_audio_shutdown(struct device *dev, void *data)
@@ -1629,7 +1623,7 @@ static void tda998x_bridge_mode_set(struct drm_bridge *bridge,
1629 tda998x_write_avi(priv, adjusted_mode); 1623 tda998x_write_avi(priv, adjusted_mode);
1630 1624
1631 if (priv->sink_has_audio) 1625 if (priv->sink_has_audio)
1632 tda998x_configure_audio(priv, &priv->audio); 1626 tda998x_configure_audio(priv);
1633 } 1627 }
1634 1628
1635 mutex_unlock(&priv->audio_mutex); 1629 mutex_unlock(&priv->audio_mutex);