Skip to content

Commit

Permalink
ASoC: hdmi-codec: Use set_jack ops to set jack
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Tzung-Bi Shih <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
chiang831 authored and broonie committed Sep 22, 2020
1 parent 376dd57 commit 55c5cc6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 22 deletions.
3 changes: 0 additions & 3 deletions include/sound/hdmi-codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__ */
12 changes: 4 additions & 8 deletions sound/soc/codecs/hdmi-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions sound/soc/mediatek/mt8173/mt8173-rt5650.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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[] = {
Expand Down
5 changes: 2 additions & 3 deletions sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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[] = {
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/rockchip/rockchip_max98090.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 55c5cc6

Please sign in to comment.