Unverified Commit 55c5cc63 authored by Cheng-Yi Chiang's avatar Cheng-Yi Chiang Committed by Mark Brown
Browse files

ASoC: hdmi-codec: Use set_jack ops to set jack



Use set_jack ops to set jack so machine drivers do not need to include
hdmi-codec.h explicitly.

Signed-off-by: default avatarCheng-Yi Chiang <cychiang@chromium.org>
Reviewed-by: default avatarTzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200922062316.1172935-1-cychiang@chromium.org


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 376dd57d
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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__ */
+4 −8
Original line number Diff line number Diff line
@@ -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)
+2 −3
Original line number Diff line number Diff line
@@ -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 {
+2 −3
Original line number Diff line number Diff line
@@ -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[] = {
+2 −3
Original line number Diff line number Diff line
@@ -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[] = {
Loading