UPSTREAM: ASoC: hdmi-codec: Add RX support
HDMI interface can also be used as receiver, this patch is to
add such support. The most difference compare with TX is that RX
don't need to get edid information.
Bug: 239396464
Change-Id: Ib5f9f347cd50abe95fa9c8a4856bd1a91117ca67
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1606372608-2329-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 144f836646)
This commit is contained in:
parent
5e75deab3a
commit
056409c7dc
1 changed files with 28 additions and 5 deletions
|
|
@ -282,6 +282,7 @@ struct hdmi_codec_priv {
|
|||
|
||||
static const struct snd_soc_dapm_widget hdmi_widgets[] = {
|
||||
SND_SOC_DAPM_OUTPUT("TX"),
|
||||
SND_SOC_DAPM_OUTPUT("RX"),
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -389,6 +390,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct hdmi_codec_priv *hcp = snd_soc_dai_get_drvdata(dai);
|
||||
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&hcp->lock);
|
||||
|
|
@ -404,7 +406,7 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream,
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (hcp->hcd.ops->get_eld) {
|
||||
if (tx && hcp->hcd.ops->get_eld) {
|
||||
ret = hcp->hcd.ops->get_eld(dai->dev->parent, hcp->hcd.data,
|
||||
hcp->eld, sizeof(hcp->eld));
|
||||
if (ret)
|
||||
|
|
@ -660,14 +662,20 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai)
|
|||
{
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
struct hdmi_codec_daifmt *daifmt;
|
||||
struct snd_soc_dapm_route route = {
|
||||
.sink = "TX",
|
||||
.source = dai->driver->playback.stream_name,
|
||||
struct snd_soc_dapm_route route[] = {
|
||||
{
|
||||
.sink = "TX",
|
||||
.source = dai->driver->playback.stream_name,
|
||||
},
|
||||
{
|
||||
.sink = dai->driver->capture.stream_name,
|
||||
.source = "RX",
|
||||
},
|
||||
};
|
||||
int ret;
|
||||
|
||||
dapm = snd_soc_component_get_dapm(dai->component);
|
||||
ret = snd_soc_dapm_add_routes(dapm, &route, 1);
|
||||
ret = snd_soc_dapm_add_routes(dapm, route, 2);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -757,6 +765,14 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = {
|
|||
.formats = I2S_FORMATS,
|
||||
.sig_bits = 24,
|
||||
},
|
||||
.capture = {
|
||||
.stream_name = "Capture",
|
||||
.channels_min = 2,
|
||||
.channels_max = 8,
|
||||
.rates = HDMI_RATES,
|
||||
.formats = I2S_FORMATS,
|
||||
.sig_bits = 24,
|
||||
},
|
||||
.ops = &hdmi_codec_i2s_dai_ops,
|
||||
.pcm_new = hdmi_codec_pcm_new,
|
||||
};
|
||||
|
|
@ -773,6 +789,13 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = {
|
|||
.rates = HDMI_RATES,
|
||||
.formats = SPDIF_FORMATS,
|
||||
},
|
||||
.capture = {
|
||||
.stream_name = "Capture",
|
||||
.channels_min = 2,
|
||||
.channels_max = 2,
|
||||
.rates = HDMI_RATES,
|
||||
.formats = SPDIF_FORMATS,
|
||||
},
|
||||
.ops = &hdmi_codec_spdif_dai_ops,
|
||||
.pcm_new = hdmi_codec_pcm_new,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue