ASoC: mediatek: mt8183: support DP audio
Subsystems (7)
cover ASoC: mediatek: mt8183: support DP audio
(This series depends on https://lore.kernel.org/patchwork/patch/1126819/
which has not applied to the maintainer's tree yet.)
This series makes mt8183-mt6358-ts3a227-max98357 support DP (display port) audio output.
ASoC: hdmi-codec: add PCM trigger operator
- add a PCM trigger callback if codec driver is interested in PCM events.
drm: bridge: it6505: bridge to hdmi-codec
- add audio feature support of it6505.
- bridge to hdmi-codec so that ASoC can use the audio feature.
- defer the "enabling" after receiving PCM START or RESUME event.
ASoC: dt-bindings: mt8183: add a property "mediatek,hdmi-codec"
ASoC: mediatek: mt8183: use hdmi-codec
- bind to hdmi-codec in mt8183-mt6358-ts3a227-max98357.
drm: bridge: it6505: report connector status
ASoC: mediatek: mt8183: support HDMI jack reporting
- use the mechanism from the following patch
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-September/155302.html
to report jack status (from DRM to ASoC).
Allen Chen (1):
drm: bridge: it6505: bridge to hdmi-codec
Tzung-Bi Shih (5):
ASoC: hdmi-codec: add PCM trigger operator
ASoC: dt-bindings: mt8183: add a property "mediatek,hdmi-codec"
ASoC: mediatek: mt8183: use hdmi-codec
drm: bridge: it6505: report connector status
ASoC: mediatek: mt8183: support HDMI jack reporting
.../sound/mt8183-mt6358-ts3a227-max98357.txt | 2 + drivers/gpu/drm/bridge/ite-it6505.c | 191 +++++++++++++++++- include/sound/hdmi-codec.h | 13 ++ sound/soc/codecs/hdmi-codec.c | 31 +++ sound/soc/mediatek/Kconfig | 3 +- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 36 +++- 6 files changed, 266 insertions(+), 10 deletions(-)
Signature · 1 line
2.23.0.866.gb869b98d4c-goog
PATCH 1/6 ASoC: hdmi-codec: add PCM trigger operator
HDMI codec may be also interested in PCM triggers. Add PCM trigger operator.
--- include/sound/hdmi-codec.h | 13 +++++++++++++ sound/soc/codecs/hdmi-codec.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
include/sound/hdmi-codec.h +13 -0
@@ -50,6 +50,13 @@ struct hdmi_codec_params {typedef void (*hdmi_codec_plugged_cb )(struct device *dev,bool plugged); +enum { +HDMI_CODEC_TRIGGER_EVENT_STOP , +HDMI_CODEC_TRIGGER_EVENT_START , +HDMI_CODEC_TRIGGER_EVENT_SUSPEND , +HDMI_CODEC_TRIGGER_EVENT_RESUME , +}; +struct hdmi_codec_pdata ;struct hdmi_codec_ops {/*
@@ -66,6 +73,12 @@ struct hdmi_codec_ops {struct hdmi_codec_daifmt *fmt, struct hdmi_codec_params *hparms); +/* +* PCM trigger callback. +* Optional +*/ +int (*trigger)(struct device *dev,int event); +/* * Shuts down the audio stream. * Mandatory
sound/soc/codecs/hdmi-codec.c +31 -0
@@ -565,12 +565,42 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute)return 0 ; } +static int hdmi_codec_trigger (struct snd_pcm_substream *substream,int cmd, +struct snd_soc_dai *dai) +{ +struct hdmi_codec_priv *hcp =snd_soc_dai_get_drvdata (dai); +int event; + +if (!hcp->hcd.ops->trigger) +return 0 ; + +switch (cmd) { +case SNDRV_PCM_TRIGGER_STOP : + event =HDMI_CODEC_TRIGGER_EVENT_STOP ; +break ; +case SNDRV_PCM_TRIGGER_START : + event =HDMI_CODEC_TRIGGER_EVENT_START ; +break ; +case SNDRV_PCM_TRIGGER_SUSPEND : + event =HDMI_CODEC_TRIGGER_EVENT_SUSPEND ; +break ; +case SNDRV_PCM_TRIGGER_RESUME : + event =HDMI_CODEC_TRIGGER_EVENT_RESUME ; +break ; +default : +return -EINVAL ; + } + +return hcp->hcd.ops->trigger (dai->dev->parent, event); +} +static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = { .startup = hdmi_codec_startup, .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, .set_fmt = hdmi_codec_i2s_set_fmt, .digital_mute = hdmi_codec_digital_mute, + .trigger = hdmi_codec_trigger, };static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = {
@@ -578,6 +608,7 @@ static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = { .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, .digital_mute = hdmi_codec_digital_mute, + .trigger = hdmi_codec_trigger, };#define HDMI_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
Signature · 1 line
2.23.0.866.gb869b98d4c-goog
Re: [PATCH 1/6] ASoC: hdmi-codec: add PCM trigger operator
Hi Tzung-Bi,
We would want to confirm with you as we work on the hdmi-codec for the mt8186.
Do you have any plan to continue working on this series? We may take over as well.
Thanks,
Allen
Quoted 99 lines · Tzung-Bi Shih
HDMI codec may be also interested in PCM triggers. Add PCM trigger operator.
Signed-off-by Tzung-Bi Shih <[email protected]>--- include/sound/hdmi-codec.h | 13 +++++++++++++ sound/soc/codecs/hdmi-codec.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)include/sound/hdmi-codec.h +13
-0@@ -50,6 +50,13 @@ struct hdmi_codec_params {typedef void (*hdmi_codec_plugged_cb )(struct device *dev,bool plugged); +enum { +HDMI_CODEC_TRIGGER_EVENT_STOP , +HDMI_CODEC_TRIGGER_EVENT_START , +HDMI_CODEC_TRIGGER_EVENT_SUSPEND , +HDMI_CODEC_TRIGGER_EVENT_RESUME , +}; +struct hdmi_codec_pdata ;struct hdmi_codec_ops {/* @@ -66,6 +73,12 @@ struct hdmi_codec_ops {struct hdmi_codec_daifmt *fmt, struct hdmi_codec_params *hparms); +/* +* PCM trigger callback. +* Optional +*/ +int (*trigger)(struct device *dev,int event); +/* * Shuts down the audio stream. * Mandatory sound/soc/codecs/hdmi- renamed from sound/soc/codecs/hdmi-codec.c +0
-0
codec.c
indexb5fd8f08726e..1ba2fa26ba03100644sound/soc/codecs/hdmi-codec.c +30
-0@@ -565,12 +565,42 @@ static int hdmi_codec_digital_mute(struct snd_soc_dai *dai, int mute) return 0; } +static int hdmi_codec_trigger (struct snd_pcm_substream *substream,int cmd, +struct snd_soc_dai *dai) +{ +struct hdmi_codec_priv *hcp =snd_soc_dai_get_drvdata (dai); +int event; + +if (!hcp->hcd.ops->trigger) +return 0 ; + +switch (cmd) { +case SNDRV_PCM_TRIGGER_STOP : + event =HDMI_CODEC_TRIGGER_EVENT_STOP ; +break ; +case SNDRV_PCM_TRIGGER_START : + event =HDMI_CODEC_TRIGGER_EVENT_START ; +break ; +case SNDRV_PCM_TRIGGER_SUSPEND : + event =HDMI_CODEC_TRIGGER_EVENT_SUSPEND ; +break ; +case SNDRV_PCM_TRIGGER_RESUME : + event =HDMI_CODEC_TRIGGER_EVENT_RESUME ; +break ; +default : +return -EINVAL ; + } + +return hcp->hcd.ops->trigger (dai->dev->parent, event); +} +static const struct snd_soc_dai_ops hdmi_codec_i2s_dai_ops = { .startup = hdmi_codec_startup, .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, .set_fmt = hdmi_codec_i2s_set_fmt, .digital_mute = hdmi_codec_digital_mute, + .trigger = hdmi_codec_trigger, };static const struct
snd_soc_dai_opshdmi_codec_spdif_dai_ops= {sound/soc/codecs/hdmi-codec.c +1
-0@@ -578,6 +608,7 @@ static const struct snd_soc_dai_ops hdmi_codec_spdif_dai_ops = { .shutdown = hdmi_codec_shutdown, .hw_params = hdmi_codec_hw_params, .digital_mute = hdmi_codec_digital_mute, + .trigger = hdmi_codec_trigger, };#define
HDMI_RATES(SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100|\
Re: [PATCH 1/6] ASoC: hdmi-codec: add PCM trigger operator
Quoted 5 lines · Allen-KH Cheng (程冠勳)
We would want to confirm with you as we work on the hdmi-codec for the mt8186.
Do you have any plan to continue working on this series? We may take over as well.
No (from testing's perspective). Please take over it as you require.
PATCH 2/6 drm: bridge: it6505: bridge to hdmi-codec
In reply to Tzung-Bi ShihFrom: Allen Chen <[email protected]>
Bridge to hdmi-codec to support audio feature.
It is observed that some DP-to-HDMI dongles will get into bad states if sending InfoFrame without audio data. Defer to enable it6505's audio feature when PCM triggers START or RESUME.
--- drivers/gpu/drm/bridge/ite-it6505.c | 152 ++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+)
drivers/gpu/drm/bridge/ite-it6505.c +152 -0
@@ -26,6 +26,8 @@#include <drm/drm_dp_helper.h> #include <drm/drm_edid.h> +#include <sound/hdmi-codec.h> +#define AX 0#define BX 1#define AUDSEL I2S
@@ -146,6 +148,7 @@ struct it6505 {struct notifier_block event_nb;struct extcon_dev *extcon;struct work_struct extcon_wq; +struct delayed_work delayed_audio;enum sys_status status;bool hbr;u8 en_ssc;
@@ -1223,6 +1226,149 @@ static void it6505_set_audio(struct it6505 *it6505)dptxset (it6505,0xD3 ,0x20 ,0x00 ); } +static void it6505_delayed_audio (struct work_struct *work) +{ + struct it6505 *it6505 = container_of(work, struct it6505, + delayed_audio.work); + +it6505_set_audio (it6505); + it6505->en_audio =1 ; +} + +static int it6505_audio_hw_params (struct device *dev,void *data, +struct hdmi_codec_daifmt *daifmt, +struct hdmi_codec_params *params) +{ +struct it6505 *it6505 =dev_get_drvdata (dev); +unsigned int channel_num = params->cea.channels; + +DRM_DEV_DEBUG_DRIVER (dev,"setting %d Hz, %d bit, %d channels\n" , + params->sample_rate, params->sample_width, + channel_num); + +if (!it6505->bridge.encoder) +return -ENODEV ; + +switch (params->sample_rate) { +case 24000 : + it6505->aud_fs =AUD24K ; +break ; +case 32000 : + it6505->aud_fs =AUD32K ; +break ; +case 44100 : + it6505->aud_fs =AUD44P1K ; +break ; +case 48000 : + it6505->aud_fs =AUD48K ; +break ; +case 88200 : + it6505->aud_fs =AUD88P2K ; +break ; +case 96000 : + it6505->aud_fs =AUD96K ; +break ; +case 176400 : + it6505->aud_fs =AUD176P4K ; +break ; +case 192000 : + it6505->aud_fs =AUD192K ; +break ; +default : +DRM_DEV_DEBUG_DRIVER (dev,"sample rate: %d Hz not support" , + params->sample_rate); +return -EINVAL ; + } + +switch (params->sample_width) { +case 16 : + it6505->audwordlength =AUD16BIT ; +break ; +case 18 : + it6505->audwordlength =AUD18BIT ; +break ; +case 20 : + it6505->audwordlength =AUD20BIT ; +break ; +case 24 : +case 32 : + it6505->audwordlength =AUD24BIT ; +break ; +default : +DRM_DEV_DEBUG_DRIVER (dev,"wordlength: %d bit not support" , + params->sample_width); +return -EINVAL ; + } + +if (channel_num ==0 || channel_num %2 ) { +DRM_DEV_DEBUG_DRIVER (dev,"channel number: %d not support" , + channel_num); +return -EINVAL ; + } + it6505->aud_ch = channel_num; + +return 0 ; +} + +static int it6505_audio_trigger (struct device *dev,int event) +{ +struct it6505 *it6505 =dev_get_drvdata (dev); + +DRM_DEV_DEBUG_DRIVER (dev,"event: %d" , event); +switch (event) { +case HDMI_CODEC_TRIGGER_EVENT_START : +case HDMI_CODEC_TRIGGER_EVENT_RESUME : +queue_delayed_work (system_wq, &it6505->delayed_audio, +msecs_to_jiffies (180 )); +break ; +case HDMI_CODEC_TRIGGER_EVENT_STOP : +case HDMI_CODEC_TRIGGER_EVENT_SUSPEND : +cancel_delayed_work (&it6505->delayed_audio); +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static void it6505_audio_shutdown (struct device *dev,void *data) +{ +struct it6505 *it6505 =dev_get_drvdata (dev); + +dptxset (it6505,0xE8 ,0x22 ,0x00 ); +dptxset (it6505,0x05 ,0x02 ,0x02 ); + it6505->en_audio =0 ; +} + +static const struct hdmi_codec_ops it6505_audio_codec_ops = { + .hw_params = it6505_audio_hw_params, + .trigger = it6505_audio_trigger, + .audio_shutdown = it6505_audio_shutdown, +}; + +static int it6505_register_audio_driver (struct device *dev) +{ +struct it6505 *it6505 =dev_get_drvdata (dev); +struct hdmi_codec_pdata codec_data = { + .ops = &it6505_audio_codec_ops, + .max_i2s_channels =8 , + .i2s =1 , + }; +struct platform_device *pdev; + + pdev =platform_device_register_data (dev,HDMI_CODEC_DRV_NAME , +PLATFORM_DEVID_AUTO , &codec_data, +sizeof (codec_data)); +if (IS_ERR (pdev)) +return PTR_ERR (pdev); + +INIT_DELAYED_WORK (&it6505->delayed_audio, it6505_delayed_audio); + +DRM_DEV_DEBUG_DRIVER (dev,"bound to %s" ,HDMI_CODEC_DRV_NAME ); +return 0 ; +} +/*************************************************************************** * DPCD Read and EDID ***************************************************************************/
@@ -2460,6 +2606,12 @@ static int it6505_i2c_probe(struct i2c_client *client,return err; } + err =it6505_register_audio_driver (dev); +if (err <0 ) { +DRM_DEV_ERROR (dev,"Failed to register audio driver: %d" , err); +return err; + } +/* Register aux channel */ it6505->aux.name ="DP-AUX" ; it6505->aux.dev = dev;
Signature · 1 line
2.23.0.866.gb869b98d4c-goog
PATCH 3/6 ASoC: dt-bindings: mt8183: add a property "mediatek, hdmi-codec"
In reply to Tzung-Bi ShihAdd an optional property "mediatek,hdmi-codec".
--- .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +2 -0
@@ -8,6 +8,7 @@ Optional properties: - mediatek,headset-codec: the phandles of ts3a227 codecs - mediatek,ec-codec: the phandle of EC codecs. See google,cros-ec-codec.txt for more details. +- mediatek,hdmi-codec: the phandles of HDMI codec Example:
@@ -15,6 +16,7 @@ Example: compatible = "mediatek,mt8183_mt6358_ts3a227_max98357"; mediatek,headset-codec = <&ts3a227>; mediatek,ec-codec = <&ec_codec>; + mediatek,hdmi-codec = <&it6505dptx>; mediatek,platform = <&afe>; };
Signature · 1 line
2.23.0.866.gb869b98d4c-goog
Re: [alsa-devel] [PATCH 3/6] ASoC: dt-bindings: mt8183: add a property "mediatek, hdmi-codec"
Quoted 7 lines · Tzung-Bi Shih
Add an optional property "mediatek,hdmi-codec".
Signed-off-by Tzung-Bi Shih <[email protected]>--- .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt | 2 ++ 1 file changed, 2 insertions(+)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/6 ASoC: mediatek: mt8183: use hdmi-codec
In reply to Tzung-Bi ShihAdd DAI link to use hdmi-codec.
--- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +10 -6
@@ -191,7 +191,7 @@ SND_SOC_DAILINK_DEFS(i2s5,SND_SOC_DAILINK_DEFS (tdm,DAILINK_COMP_ARRAY (COMP_CPU ("TDM" )), -DAILINK_COMP_ARRAY (COMP_DUMMY ()), +DAILINK_COMP_ARRAY (COMP_CODEC (NULL ,"i2s-hifi" )),DAILINK_COMP_ARRAY (COMP_EMPTY ()));static int mt8183_mt6358_tdm_startup (struct snd_pcm_substream *substream)
@@ -479,7 +479,7 @@ static int mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) {struct snd_soc_card *card = &mt8183_mt6358_ts3a227_max98357_card; -struct device_node *platform_node, *ec_codec; +struct device_node *platform_node, *ec_codec, *hdmi_codec;struct snd_soc_dai_link *dai_link;struct mt8183_mt6358_ts3a227_max98357_priv *priv;int ret;
@@ -496,9 +496,12 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) ec_codec =of_parse_phandle (pdev->dev.of_node,"mediatek,ec-codec" ,0 ); + hdmi_codec =of_parse_phandle (pdev->dev.of_node, +"mediatek,hdmi-codec" ,0 ); +for_each_card_prelinks (card, i, dai_link) { -if (dai_link->platforms->name) -continue ; +if (!dai_link->platforms->name) + dai_link->platforms->of_node = platform_node;if (ec_codec &&strcmp (dai_link->name,"Wake on Voice" ) ==0 ) { dai_link->cpus[0 ].name =NULL ;
@@ -509,9 +512,10 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) dai_link->codecs[0 ].dai_name ="Wake on Voice" ; dai_link->platforms[0 ].of_node = ec_codec; dai_link->ignore =0 ; - }else { - dai_link->platforms->of_node = platform_node; } + +if (hdmi_codec &&strcmp (dai_link->name,"TDM" ) ==0 ) + dai_link->codecs->of_node = hdmi_codec; } mt8183_mt6358_ts3a227_max98357_headset_dev.dlc.of_node =
Signature · 1 line
2.23.0.866.gb869b98d4c-goog
PATCH 5/6 drm: bridge: it6505: report connector status
In reply to Tzung-Bi ShihWhen a connector connected or disconnected, report the jack status.
--- drivers/gpu/drm/bridge/ite-it6505.c | 39 +++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +37 -2
@@ -180,6 +180,10 @@ struct it6505 {bool powered;/* it6505 driver hold option */ unsigned int drv_hold; + +hdmi_codec_plugged_cb plugged_cb; +struct device *codec_dev; +enum drm_connector_status last_connector_status; };static const struct regmap_range it6505_bridge_volatile_ranges[] = {
@@ -882,15 +886,31 @@ static const struct drm_connector_helper_funcs it6505_connector_helper_funcs = { .get_modes = it6505_get_modes, }; +static void it6505_update_plugged_status (struct it6505 *it6505, +enum drm_connector_status status) +{ +if (it6505->plugged_cb && it6505->codec_dev) + it6505->plugged_cb (it6505->codec_dev, + status == connector_status_connected); +} +static enum drm_connector_status it6505_detect (struct drm_connector *connector,bool force) {struct it6505 *it6505 =connector_to_it6505 (connector); +enum drm_connector_status status;if (gpiod_get_value (it6505->pdata.gpiod_hpd)) -return connector_status_disconnected; + status = connector_status_disconnected; +else + status = connector_status_connected; + +if (status != it6505->last_connector_status) { + it6505->last_connector_status = status; +it6505_update_plugged_status (it6505, status); + } -return connector_status_connected; +return status; }static const struct drm_connector_funcs it6505_connector_funcs = {
@@ -1341,10 +1361,23 @@ static void it6505_audio_shutdown(struct device *dev, void *data) it6505->en_audio =0 ; } +static int it6505_audio_hook_plugged_cb (struct device *dev,void *data, +hdmi_codec_plugged_cb fn, +struct device *codec_dev) +{ +struct it6505 *it6505 = data; + + it6505->plugged_cb = fn; + it6505->codec_dev = codec_dev; +it6505_update_plugged_status (it6505, it6505->last_connector_status); +return 0 ; +} +static const struct hdmi_codec_ops it6505_audio_codec_ops = { .hw_params = it6505_audio_hw_params, .trigger = it6505_audio_trigger, .audio_shutdown = it6505_audio_shutdown, + .hook_plugged_cb = it6505_audio_hook_plugged_cb, };static int it6505_register_audio_driver (struct device *dev)
@@ -1354,6 +1387,7 @@ static int it6505_register_audio_driver(struct device *dev) .ops = &it6505_audio_codec_ops, .max_i2s_channels = 8, .i2s = 1, + .data = it6505, };struct platform_device *pdev;
@@ -1364,6 +1398,7 @@ static int it6505_register_audio_driver(struct device *dev)return PTR_ERR (pdev);INIT_DELAYED_WORK (&it6505->delayed_audio, it6505_delayed_audio); + it6505->last_connector_status = connector_status_disconnected;DRM_DEV_DEBUG_DRIVER (dev,"bound to %s" ,HDMI_CODEC_DRV_NAME );return 0 ;
Signature · 1 line
2.23.0.866.gb869b98d4c-goog
PATCH 6/6 ASoC: mediatek: mt8183: support HDMI jack reporting
In reply to Tzung-Bi ShihSupport HDMI jack reporting.
--- sound/soc/mediatek/Kconfig | 3 ++- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-)
sound/soc/mediatek/Kconfig +2 -1
@@ -126,9 +126,10 @@ config SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A select SND_SOC_BT_SCO select SND_SOC_TS3A227E select SND_SOC_CROS_EC_CODEC + select SND_SOC_HDMI_CODEC help This adds ASoC driver for Mediatek MT8183 boards - with the MT6358 TS3A227E MAX98357A audio codec. + with the MT6358 TS3A227E MAX98357A audio codec and HDMI codec. Select Y if you have such device. If unsure select "N".
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +19 -1
@@ -11,6 +11,7 @@#include <sound/soc.h> #include <sound/jack.h> #include <linux/pinctrl/consumer.h> +#include <sound/hdmi-codec.h> #include "mt8183-afe-common.h" #include "../../codecs/ts3a227e.h"
@@ -30,7 +31,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {struct mt8183_mt6358_ts3a227_max98357_priv {struct pinctrl *pinctrl;struct pinctrl_state *pin_states[PIN_STATE_MAX ]; -struct snd_soc_jack headset_jack; +struct snd_soc_jack headset_jack, hdmi_jack; }; static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -270,6 +271,22 @@ static const struct snd_soc_ops mt8183_mt6358_ts3a227_max98357_wov_ops = { .shutdown = mt8183_mt6358_ts3a227_max98357_wov_shutdown, }; +static int +mt8183_mt6358_ts3a227_max98357_hdmi_init (struct snd_soc_pcm_runtime *rtd) +{ +struct mt8183_mt6358_ts3a227_max98357_priv *priv = +snd_soc_card_get_drvdata (rtd->card); +int ret; + + ret =snd_soc_card_jack_new (rtd->card,"HDMI Jack" ,SND_JACK_LINEOUT , + &priv->hdmi_jack,NULL ,0 ); +if (ret) +return ret; + +return hdmi_codec_set_jack_detect (rtd->codec_dai->component, + &priv->hdmi_jack); +} +static struct snd_soc_dai_link mt8183_mt6358_ts3a227_max98357_dai_links[] = {/* FE */
@@ -436,6 +453,7 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = { .ignore_suspend = 1, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup, .ops = &mt8183_mt6358_tdm_ops, + .init = mt8183_mt6358_ts3a227_max98357_hdmi_init, SND_SOC_DAILINK_REG(tdm), }, };
Signature · 1 line
2.23.0.866.gb869b98d4c-goog