Add mediatek codec mt6359 driver
Subsystems (4)
v5 cover Add mediatek codec mt6359 driver
Add mediatek codec (MT6359) driver
MT6359 support playback and capture feature.
On downlink path, it includes three DACs for handset, headset, and lineout path. On unlink path, it includeds three ADCs for main mic, second mic, 3rd mic, and headset mic.
By scenario, select *_MUX widget to create damp path. And by select mic_type_mux to choose DMIC/AMIC/....
For example, select these MUX widget to create headset path
(1) DAC In Mux --> "Normal Path"
(2) HP Mux --> "Audio Playback"
v5 changes:
1. Don't need to unregister the component which is already relegated to devm.
v4 changes:
1. Add a remove() function to undo regulator_enable(). 2. Removed unnecessary logs. 3. patchwork link: https://patchwork.kernel.org/cover/11715553/ https://patchwork.kernel.org/patch/11716015/ https://patchwork.kernel.org/patch/11715557/ v3 changes: 1. patchwork link: https://patchwork.kernel.org/cover/11714291/ https://patchwork.kernel.org/patch/11714295/ https://patchwork.kernel.org/patch/11714339/
v2 changes:
1. patchwork link: https://patchwork.kernel.org/cover/11706935/ https://patchwork.kernel.org/patch/11708865/ https://patchwork.kernel.org/patch/11706937/
v1 changes:
1.lkml link: https://lkml.org/lkml/2020/3/5/1257
Jiaxin Yu (2):
ASoC: mediatek: mt6359: add codec driver
dt-bindings: mediatek: mt6359: add codec document
.../devicetree/bindings/sound/mt6359.yaml | 68 + sound/soc/codecs/Kconfig | 8 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/mt6359.c | 2753 ++++++++++++++++++++ sound/soc/codecs/mt6359.h | 2640 +++++++++++++++++++ 5 files changed, 5471 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/mt6359.yaml create mode 100644 sound/soc/codecs/mt6359.c create mode 100644 sound/soc/codecs/mt6359.h
Signature · 1 line
1.8.1.1.dirty
PATCH v5 1/2 ASoC: mediatek: mt6359: add codec driver
Add the mt6359 codec driver.
--- sound/soc/codecs/Kconfig | 8 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/mt6359.c | 2753 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/mt6359.h | 2640 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 5403 insertions(+) create mode 100644 sound/soc/codecs/mt6359.c create mode 100644 sound/soc/codecs/mt6359.h
sound/soc/codecs/Kconfig +8 -0
@@ -127,6 +127,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_ML26124 imply SND_SOC_MT6351 imply SND_SOC_MT6358 + imply SND_SOC_MT6359 imply SND_SOC_MT6660 imply SND_SOC_NAU8540 imply SND_SOC_NAU8810
@@ -1724,6 +1725,13 @@ config SND_SOC_MT6358 Enable support for the platform which uses MT6358 as external codec device. +config SND_SOC_MT6359 + tristate "MediaTek MT6359 Codec" + depends on MTK_PMIC_WRAP + help + Enable support for the platform which uses MT6359 as + external codec device. + config SND_SOC_MT6660 tristate "Mediatek MT6660 Speaker Amplifier" depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -126,6 +126,7 @@ snd-soc-msm8916-analog-objs := msm8916-wcd-analog.o snd-soc-msm8916-digital-objs := msm8916-wcd-digital.o snd-soc-mt6351-objs := mt6351.o snd-soc-mt6358-objs := mt6358.o +snd-soc-mt6359-objs := mt6359.o snd-soc-mt6660-objs := mt6660.o snd-soc-nau8540-objs := nau8540.o snd-soc-nau8810-objs := nau8810.o
@@ -431,6 +432,7 @@ obj-$(CONFIG_SND_SOC_MSM8916_WCD_ANALOG) +=snd-soc-msm8916-analog.o obj-$(CONFIG_SND_SOC_MSM8916_WCD_DIGITAL) +=snd-soc-msm8916-digital.o obj-$(CONFIG_SND_SOC_MT6351) += snd-soc-mt6351.o obj-$(CONFIG_SND_SOC_MT6358) += snd-soc-mt6358.o +obj-$(CONFIG_SND_SOC_MT6359) += snd-soc-mt6359.o obj-$(CONFIG_SND_SOC_MT6660) += snd-soc-mt6660.o obj-$(CONFIG_SND_SOC_NAU8540) += snd-soc-nau8540.o obj-$(CONFIG_SND_SOC_NAU8810) += snd-soc-nau8810.o
sound/soc/codecs/mt6359.c new file +2753 -0
2,753 lines not on this page · raw message
sound/soc/codecs/mt6359.h new file +2640 -0
213 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 5 lines
1.8.1.1.dirty _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Part of the diff is not shown here. View the raw message.
Re: [PATCH v5 1/2] ASoC: mediatek: mt6359: add codec driver
Quoted 4 lines · Jiaxin Yu
Add the mt6359 codec driver.
Signed-off-by Jiaxin Yu <[email protected]>
LGTM, thanks.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v5 2/2 dt-bindings: mediatek: mt6359: add codec document
In reply to Jiaxin YuThis patch adds MediaTek MT6359 codec document.
--- .../devicetree/bindings/sound/mt6359.yaml | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/mt6359.yaml
Documentation/devicetree/bindings/sound/mt6359.yaml new file +68 -0
@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/mt6359.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mediatek MT6359 Codec Device Tree Bindings + +maintainers: + - Eason Yen <[email protected]> + - Jiaxin Yu <[email protected]> + - Shane Chien <[email protected]> + +description: | + The communication between MT6359 and SoC is through Mediatek PMIC wrapper. + For more detail, please visit Mediatek PMIC wrapper documentation. + Must be a child node of PMIC wrapper. + +properties: + compatible: + const: mediatek,mt6359-sound + + mediatek,dmic-mode: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Indicates how many data pins are used to transmit two channels of PDM + signal. 0 means two wires, 1 means one wire. Default value is 0. + enum: + - 0 # one wire + - 1 # two wires + + mediatek,mic-type-0: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Specifies the type of mic type connected to adc0 + + enum: + - 0 # IDLE - mic in turn-off status + - 1 # ACC - analog mic with alternating coupling + - 2 # DMIC - digital mic + - 3 # DCC - analog mic with direct couping + - 4 # DCC_ECM_DIFF - analog electret condenser mic with differential mode + - 5 # DCC_ECM_SINGLE - analog electret condenser mic with single mode + + mediatek,mic-type-1: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Specifies the type of mic type connected to adc1 + + mediatek,mic-type-2: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Specifies the type of mic type connected to adc2 + +required: + - compatible + +additionalProperties: false + +examples: + - | + mt6359codec: mt6359codec { + compatible = "mediatek,mt6359-sound"; + mediatek,dmic-mode = <0>; + mediatek,mic-type-0 = <2>; + }; + +...
Signature · 1 line
1.8.1.1.dirty
Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Documentation/devicetree/bindings/sound/mt6359.yaml line 21
Quoted 3 lines · Jiaxin Yu
Documentation/devicetree/bindings/sound/mt6359.yaml new file +3
-0+properties: + compatible: + const: mediatek,mt6359-sound
The compatible string has been removed since v3.
Documentation/devicetree/bindings/sound/mt6359.yaml line 56
Quoted 2 lines
Documentation/devicetree/bindings/sound/mt6359.yaml new file +2
-0+required: + - compatible
The same here.
Documentation/devicetree/bindings/sound/mt6359.yaml line 63
Quoted 4 lines
Documentation/devicetree/bindings/sound/mt6359.yaml new file +4
-0+examples: + - | + mt6359codec: mt6359codec { + compatible = "mediatek,mt6359-sound";
And the same here.
Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Quoted 11 lines · Tzung-Bi Shih
Documentation/devicetree/bindings/sound/mt6359.yaml line 21
Quoted 3 lines · Jiaxin Yu
Documentation/devicetree/bindings/sound/mt6359.yaml new file +3
-0+properties: + compatible: + const: mediatek,mt6359-soundThe compatible string has been removed since v3.
Documentation/devicetree/bindings/sound/mt6359.yaml line 56
Quoted 2 lines
Documentation/devicetree/bindings/sound/mt6359.yaml new file +2
-0+required: + - compatible
Quoted 8 lines
The same here.
Documentation/devicetree/bindings/sound/mt6359.yaml line 63
Quoted 4 lines
Documentation/devicetree/bindings/sound/mt6359.yaml new file +4
-0+examples: + - | + mt6359codec: mt6359codec { + compatible = "mediatek,mt6359-sound";And the same here.
I misunderstood. It still needs the compatible string to match the corresponding driver.
Mark Brown
maintainerRe: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Quoted 9 lines · Tzung-Bi Shih
Quoted 4 lines · Tzung-Bi Shih
Documentation/devicetree/bindings/sound/mt6359.yaml line 56
Quoted 2 lines
Documentation/devicetree/bindings/sound/mt6359.yaml new file +2
-0+required: + - compatibleAnd the same here.
I misunderstood. It still needs the compatible string to match the corresponding driver.
No, it doesn't. The MFD should be registering the platform device.
Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Quoted 6 lines · Mark Brown
Quoted 2 lines · Tzung-Bi Shih
I misunderstood. It still needs the compatible string to match the corresponding driver.
No, it doesn't. The MFD should be registering the platform device.
I guess I see. It lists the mfd_cell when calling devm_mfd_add_devices() in drivers/mfd/mt6397-core.c. It falls back to use driver name and device name to match. As long as the name provided in mfd_cell matches the platform driver name, it works.
But I found struct mfd_cell also contains member .of_compatible. What is the difference if we use compatible string (as is) for this device instead of falling back to use device name to match?
Mark Brown
maintainerRe: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Quoted 3 lines · Tzung-Bi Shih
But I found struct
mfd_cellalso contains member .of_compatible. What is the difference if we use compatible string (as is) for this device instead of falling back to use device name to match?
That's for binding the MFD subdevice to an OF node, you don't need to do that for a device like this - you can just use the of_node of the parent to get at the properties.
Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Quoted 10 lines · Mark Brown
Quoted 3 lines · Tzung-Bi Shih
But I found struct
mfd_cellalso contains member .of_compatible. What is the difference if we use compatible string (as is) for this device instead of falling back to use device name to match?That's for binding the MFD subdevice to an OF node, you don't need to do that for a device like this - you can just use the
of_nodeof the parent to get at the properties.
There is an issue we overlooked. In sound/soc/codecs/mt6359.c, mt6359_parse_dt() cannot read the DT properties
(https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/codecs/mt6359.c?h=for-next#n2640).
The original DTS is as following:
pmic {
compatible = "mediatek,mt6359";
mt6359codec: mt6359codec {
compatible = "mediatek,mt6359-sound"; (1)
mediatek,dmic-mode = <1>;
mediatek,mic-type-0 = <2>; }
}
After removing the line at (1), mt6359_parse_dt() cannot read the DT properties.
The PMIC drivers/mfd/mt6397-core.c:
- "mediatek,mt6359"
- has the struct mfd_cell of mt6359-sound
- adds all mfd_cells via devm_mfd_add_devices().
The audio codec sound/soc/codecs/mt6359.c:
- "mediatek,mt6359-sound"
Here are a few options we can come out with.
1. adds back the compatible string in the DTS
2. gets of_node of parent in mt6359.c, and iterates all children nodes to get the desired properties
3. parses all children nodes in the PMIC driver, and put them into either platform_data or device properties
(https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/include/linux/mfd/core.h?h=for-next#n77)
- The PMIC is common for several sub-devices. It makes less sense to handle subdevice specific logic in the common code.
4. others
Could you share with us what would you suggest for fixing the issue?
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Mark Brown
maintainerRe: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document
Quoted 6 lines · Tzung-Bi Shih
Quoted 3 lines · Mark Brown
That's for binding the MFD subdevice to an OF node, you don't need to do that for a device like this - you can just use the
of_nodeof the parent to get at the properties.
Quoted 8 lines
There is an issue we overlooked. In
sound/soc/codecs/mt6359.c,After removing the line at (1),
mt6359_parse_dt()cannot read the DT properties.Here are a few options we can come out with.
1. adds back the compatible string in the DTS
2. getsof_nodeof parent inmt6359.c, and iterates all children nodes to get the desired properties
Do this, but instead of iterating all the child nodes just look for the named CODEC node that you define in the bindings if you don't want to put the properties in the root MFD node.