OSDN Git Service

ASoC: hdmi-codec: Use set_jack ops to set jack
authorCheng-Yi Chiang <cychiang@chromium.org>
Tue, 22 Sep 2020 06:23:16 +0000 (14:23 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 22 Sep 2020 11:48:03 +0000 (12:48 +0100)
Use set_jack ops to set jack so machine drivers do not need to include
hdmi-codec.h explicitly.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200922062316.1172935-1-cychiang@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/hdmi-codec.h
sound/soc/codecs/hdmi-codec.c
sound/soc/mediatek/mt8173/mt8173-rt5650.c
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
sound/soc/rockchip/rockchip_max98090.c

index 7754631..b559708 100644 (file)
@@ -117,9 +117,6 @@ struct hdmi_codec_pdata {
 struct snd_soc_component;
 struct snd_soc_jack;
 
-int hdmi_codec_set_jack_detect(struct snd_soc_component *component,
-                              struct snd_soc_jack *jack);
-
 #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec"
 
 #endif /* __HDMI_CODEC_H__ */
index 8c6f540..403d4c6 100644 (file)
@@ -698,13 +698,9 @@ static void plugged_cb(struct device *dev, bool plugged)
                hdmi_codec_jack_report(hcp, 0);
 }
 
-/**
- * hdmi_codec_set_jack_detect - register HDMI plugged callback
- * @component: the hdmi-codec instance
- * @jack: ASoC jack to report (dis)connection events on
- */
-int hdmi_codec_set_jack_detect(struct snd_soc_component *component,
-                              struct snd_soc_jack *jack)
+static int hdmi_codec_set_jack(struct snd_soc_component *component,
+                              struct snd_soc_jack *jack,
+                              void *data)
 {
        struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
        int ret = -EOPNOTSUPP;
@@ -720,7 +716,6 @@ int hdmi_codec_set_jack_detect(struct snd_soc_component *component,
        }
        return ret;
 }
-EXPORT_SYMBOL_GPL(hdmi_codec_set_jack_detect);
 
 static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai)
 {
@@ -806,6 +801,7 @@ static const struct snd_soc_component_driver hdmi_driver = {
        .use_pmdown_time        = 1,
        .endianness             = 1,
        .non_legacy_dai_naming  = 1,
+       .set_jack               = hdmi_codec_set_jack,
 };
 
 static int hdmi_codec_probe(struct platform_device *pdev)
index 347b095..c28ebf8 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/of_gpio.h>
 #include <sound/soc.h>
 #include <sound/jack.h>
-#include <sound/hdmi-codec.h>
 #include "../../codecs/rt5645.h"
 
 #define MCLK_FOR_CODECS                12288000
@@ -154,8 +153,8 @@ static int mt8173_rt5650_hdmi_init(struct snd_soc_pcm_runtime *rtd)
        if (ret)
                return ret;
 
-       return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component,
-                                         &mt8173_rt5650_hdmi_jack);
+       return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component,
+                                         &mt8173_rt5650_hdmi_jack, NULL);
 }
 
 enum {
index 68fe23b..15e48cd 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/pinctrl/consumer.h>
-#include <sound/hdmi-codec.h>
 #include <sound/jack.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
@@ -375,8 +374,8 @@ static int mt8183_da7219_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd)
        if (ret)
                return ret;
 
-       return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component,
-                                         &priv->hdmi_jack);
+       return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component,
+                                         &priv->hdmi_jack, NULL);
 }
 
 static struct snd_soc_dai_link mt8183_da7219_dai_links[] = {
index 07410d7..327dfad 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/pinctrl/consumer.h>
-#include <sound/hdmi-codec.h>
 #include <sound/jack.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
@@ -350,8 +349,8 @@ mt8183_mt6358_ts3a227_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd)
        if (ret)
                return ret;
 
-       return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component,
-                                         &priv->hdmi_jack);
+       return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component,
+                                         &priv->hdmi_jack, NULL);
 }
 
 static struct snd_soc_dai_link mt8183_mt6358_ts3a227_dai_links[] = {
index 9acfd02..c8f1a28 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
 #include <sound/core.h>
-#include <sound/hdmi-codec.h>
 #include <sound/jack.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
@@ -238,7 +237,7 @@ static int rk_hdmi_init(struct snd_soc_pcm_runtime *runtime)
                return ret;
        }
 
-       return hdmi_codec_set_jack_detect(component, &rk_hdmi_jack);
+       return snd_soc_component_set_jack(component, &rk_hdmi_jack, NULL);
 }
 
 /* max98090 dai_link */