[PATCH 0/6] ASoC: mediatek: mt8183: support DP audio
This series is a follow up for a long time ago series (https://patchwork.kernel.org/cover/11204303/).
The old series bound too much on the patches of DRM bridge and ASoC machine driver. And unluckily, the dependencies (https://lore.kernel.org/patchwork/patch/1126819/) have not applied.
Revewing the ASoC patches in the old series, I found that they could be decoupled from the DRM bridge patches. And they are harmless as it is an optional attribute ("hdmi-codec") in DTS.
This series arranges and rebases the harmless ASoC patches for mt8183-mt6358-ts3a227-max98357 and mt8183-da7219-max98357.
The 1st and 4th patch add an optional DT property. The 1st patch was acked long time ago (https://patchwork.kernel.org/patch/11204321/).
The 2nd and 5th patch add DAI link for using hdmi-codec.
The 3rd and 6th patch support the HDMI jack reporting.
Tzung-Bi Shih (6): ASoC: dt-bindings: mt8183: add a property "mediatek,hdmi-codec" ASoC: mediatek: mt8183: use hdmi-codec ASoC: mediatek: mt8183: support HDMI jack reporting ASoC: dt-bindings: mt8183-da7219: add a property "mediatek,hdmi-codec" ASoC: mediatek: mt8183-da7219: use hdmi-codec ASoC: mediatek: mt8183-da7219: support HDMI jack reporting
.../bindings/sound/mt8183-da7219-max98357.txt | 4 +++ .../sound/mt8183-mt6358-ts3a227-max98357.txt | 2 ++ sound/soc/mediatek/Kconfig | 2 ++ .../mediatek/mt8183/mt8183-da7219-max98357.c | 29 +++++++++++++++++-- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 29 +++++++++++++++++-- 5 files changed, 60 insertions(+), 6 deletions(-)
Adds an optional property "mediatek,hdmi-codec".
Acked-by: Rob Herring robh@kernel.org Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- .../bindings/sound/mt8183-mt6358-ts3a227-max98357.txt | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt index 5afd3d8dab84..5e455129eb96 100644 --- a/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt +++ b/Documentation/devicetree/bindings/sound/mt8183-mt6358-ts3a227-max98357.txt @@ -9,6 +9,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:
@@ -16,6 +17,7 @@ Example: compatible = "mediatek,mt8183_mt6358_ts3a227_max98357"; mediatek,headset-codec = <&ts3a227>; mediatek,ec-codec = <&ec_codec>; + mediatek,hdmi-codec = <&it6505dptx>; mediatek,platform = <&afe>; };
Adds DAI link to use hdmi-codec.
Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 964f2f821782..c375e9f91a34 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -258,7 +258,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) @@ -562,7 +562,7 @@ static int mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) { struct snd_soc_card *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; const struct of_device_id *match; @@ -583,6 +583,8 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) card->dev = &pdev->dev;
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 (ec_codec && strcmp(dai_link->name, "Wake on Voice") == 0) { @@ -626,6 +628,9 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) } }
+ if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) + dai_link->codecs->of_node = hdmi_codec; + if (!dai_link->platforms->name) dai_link->platforms->of_node = platform_node; }
Supports HDMI jack reporting.
Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- sound/soc/mediatek/Kconfig | 1 + .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index 786a8d5031e4..ba120e9441d0 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -127,6 +127,7 @@ config SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A select SND_SOC_BT_SCO select SND_SOC_TS3A227E select SND_SOC_CROS_EC_CODEC if CROS_EC + select SND_SOC_HDMI_CODEC help This adds ASoC driver for Mediatek MT8183 boards with the MT6358 TS3A227E MAX98357A RT1015 audio codec. diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index c375e9f91a34..bd04c4bd309b 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -9,6 +9,7 @@ #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> @@ -36,7 +37,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, @@ -337,6 +338,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(asoc_rtd_to_codec(rtd, 0)->component, + &priv->hdmi_jack); +} + static struct snd_soc_dai_link mt8183_mt6358_ts3a227_dai_links[] = { /* FE */ { @@ -499,6 +516,7 @@ static struct snd_soc_dai_link mt8183_mt6358_ts3a227_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), }, };
Adds an optional property "mediatek,hdmi-codec".
Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- .../devicetree/bindings/sound/mt8183-da7219-max98357.txt | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt b/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt index f7f3b83da630..6787ce8789dd 100644 --- a/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt +++ b/Documentation/devicetree/bindings/sound/mt8183-da7219-max98357.txt @@ -6,11 +6,15 @@ Required properties: - mediatek,headset-codec: the phandles of da7219 codecs - mediatek,platform: the phandle of MT8183 ASoC platform
+Optional properties: +- mediatek,hdmi-codec: the phandles of HDMI codec + Example:
sound { compatible = "mediatek,mt8183_da7219_max98357"; mediatek,headset-codec = <&da7219>; + mediatek,hdmi-codec = <&it6505dptx>; mediatek,platform = <&afe>; };
Adds DAI link to use hdmi-codec.
Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index bc551a4af25f..cbef4a538224 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -354,7 +354,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 struct snd_soc_dai_link mt8183_da7219_dai_links[] = { @@ -627,7 +627,7 @@ static struct snd_soc_card mt8183_da7219_rt1015_card = { static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) { struct snd_soc_card *card; - struct device_node *platform_node; + struct device_node *platform_node, *hdmi_codec; struct snd_soc_dai_link *dai_link; struct mt8183_da7219_max98357_priv *priv; struct pinctrl *pinctrl; @@ -648,6 +648,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) card = (struct snd_soc_card *)match->data; card->dev = &pdev->dev;
+ hdmi_codec = of_parse_phandle(pdev->dev.of_node, + "mediatek,hdmi-codec", 0); + for_each_card_prelinks(card, i, dai_link) { if (strcmp(dai_link->name, "I2S3") == 0) { if (card == &mt8183_da7219_max98357_card) { @@ -679,6 +682,9 @@ static int mt8183_da7219_max98357_dev_probe(struct platform_device *pdev) } }
+ if (hdmi_codec && strcmp(dai_link->name, "TDM") == 0) + dai_link->codecs->of_node = hdmi_codec; + if (!dai_link->platforms->name) dai_link->platforms->of_node = platform_node; }
Supports HDMI jack reporting.
Signed-off-by: Tzung-Bi Shih tzungbi@google.com --- sound/soc/mediatek/Kconfig | 1 + .../mediatek/mt8183/mt8183-da7219-max98357.c | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig index ba120e9441d0..f7bc007bbdec 100644 --- a/sound/soc/mediatek/Kconfig +++ b/sound/soc/mediatek/Kconfig @@ -142,6 +142,7 @@ config SND_SOC_MT8183_DA7219_MAX98357A select SND_SOC_RT1015 select SND_SOC_DA7219 select SND_SOC_BT_SCO + select SND_SOC_HDMI_CODEC help This adds ASoC driver for Mediatek MT8183 boards with the DA7219 MAX98357A RT1015 audio codec. diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index cbef4a538224..edfbf34a2f45 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -10,6 +10,7 @@ #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> @@ -26,7 +27,7 @@ #define RT1015_DEV1_NAME "rt1015.6-0029"
struct mt8183_da7219_max98357_priv { - 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, @@ -357,6 +358,21 @@ SND_SOC_DAILINK_DEFS(tdm, DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "i2s-hifi")), DAILINK_COMP_ARRAY(COMP_EMPTY()));
+static int mt8183_da7219_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd) +{ + struct mt8183_da7219_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(asoc_rtd_to_codec(rtd, 0)->component, + &priv->hdmi_jack); +} + static struct snd_soc_dai_link mt8183_da7219_dai_links[] = { /* FE */ { @@ -511,6 +527,7 @@ static struct snd_soc_dai_link mt8183_da7219_dai_links[] = { .dpcm_playback = 1, .ignore_suspend = 1, .be_hw_params_fixup = mt8183_i2s_hw_params_fixup, + .init = mt8183_da7219_max98357_hdmi_init, SND_SOC_DAILINK_REG(tdm), }, };
On Fri, 10 Jul 2020 13:24:59 +0800, Tzung-Bi Shih wrote:
This series is a follow up for a long time ago series (https://patchwork.kernel.org/cover/11204303/).
The old series bound too much on the patches of DRM bridge and ASoC machine driver. And unluckily, the dependencies (https://lore.kernel.org/patchwork/patch/1126819/) have not applied.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/6] ASoC: dt-bindings: mt8183: add a property "mediatek, hdmi-codec" commit: cc07e14b149e4260075093c06b371bcb31574ccc [2/6] ASoC: mediatek: mt8183: use hdmi-codec commit: f2024dc55fcb743469238aa11f9967e0752ac600 [3/6] ASoC: mediatek: mt8183: support HDMI jack reporting commit: 88abbf627a56efcd7f24aa119f07069d3d10bd0b [4/6] ASoC: dt-bindings: mt8183-da7219: add a property "mediatek, hdmi-codec" commit: 5653841d1e6bace7897a0b5ca681fa37945fa11b [5/6] ASoC: mediatek: mt8183-da7219: use hdmi-codec commit: 5bdbe977117741a6bf4958c8dfdcb6b9263e9f1c [6/6] ASoC: mediatek: mt8183-da7219: support HDMI jack reporting commit: e25f8afd8869bd97a4d0baea5d8da730913c8541
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Mark Brown
-
Tzung-Bi Shih