Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,14 @@ properties:
audio-codec:
type: object
description:
Audio codec support with MT6358 and MT6397.
Audio codec support with MT6323, MT6358 and MT6397.
additionalProperties: true

properties:
compatible:
oneOf:
- enum:
- mediatek,mt6323-sound
- mediatek,mt6358-sound
- mediatek,mt6359-codec
- mediatek,mt6397-codec
Expand Down
32 changes: 32 additions & 0 deletions Documentation/devicetree/bindings/sound/mediatek,mt6572-afe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/mediatek,mt6572-afe.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: MediaTek AFE PCM controller for MT6572

maintainers:
- Custom Firmware <gabin278@gmail.com>

properties:
compatible:
const: mediatek,mt6572-audio

clocks:
maxItems: 1

interrupts:
maxItems: 1

iram:
$ref: /schemas/types.yaml#/definitions/phandle
description: on-chip audio SRAM used for the DL1 playback buffers.

required:
- compatible
- clocks
- interrupts
- iram

additionalProperties: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'the machine binding'? perhaps devicetree?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rephrased similar to other mtk socs

%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/mediatek,mt6572-mt6323.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: MediaTek MT6572 sound card with the MT6323 PMIC codec

maintainers:
- Custom Firmware <gabin278@gmail.com>

description:
MediaTek MT6572 SoC-based sound card using the MT6323 PMIC analog codec
for playback, with an optional external speaker amplifier.

allOf:
- $ref: sound-card-common.yaml#

properties:
compatible:
const: mediatek,mt6572-mt6323-sound

mediatek,platform:
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle to the MT6572 AFE platform.

aux-devs:
$ref: /schemas/types.yaml#/definitions/phandle-array
description:
List of phandles pointing to auxiliary devices, such as an external
speaker amplifier, to be added to the sound card.

hp-det-gpios:
maxItems: 1
description: Optional headphone-jack plug-detect GPIO.

required:
- compatible
- mediatek,platform

unevaluatedProperties: false
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| power key: mediatek,mt6323-keys | 🟢 OK | 🟢 OK | 🔴 TBD | 🟢 OK |
| haptics: regulator-haptic | 🟢 OK | 🔴 TBD | 🔴 TBD | 🟢 OK |
| charger | 🔴 DEAD | 🔴 DEAD | 🔴 DEAD | 🔴 DEAD |
| audio (playback + headphone jack) | 🔴 TBD | 🟡 partial: playback + jack + speaker, no capture | 🔴 TBD | 🟡 partial: playback + jack + speaker, no capture |

### Per-device components
| | JTY D101 | Lenovo A369i | Energy Phone Colors | Prestigio PAP5500 DUO |
Expand Down Expand Up @@ -48,7 +49,7 @@ all of these need upstreaming
| fhctl | subset of apmixed iirc | 🔴 DEAD | not sure if we really need it |
| mmsys | mediatek,mt6572-mmsys | 🟡 partial | some dbi clocks from cg1 are missing |
| mfgcfg | mediatek,mt6572-mfgcfg | 🟢 OK | |
| audio | | 🔴 DEAD | not needed for now, can't test |
| audio | mediatek,mt6572-audsys | 🟡 partial | used as a syscon; the AFE driver maps the regs directly, no dedicated clock driver yet |

### Pinctrl
missing emmc r1r0 pins, needs upstreaming
Expand Down Expand Up @@ -146,7 +147,13 @@ mostly useless i'd say, they're not full hw engines but rather only parts of the
not existent in the upstream

### Audio
needs afe/i2s/etc drivers
| component | driver / binding | status | note |
|--------------------|------------------------------|---------|---------------------------------------|
| AFE (DL1 playback) | mediatek,mt6572-audio | 🟢 OK | DL1 playback front-end; no UL/capture |
| sound card | mediatek,mt6572-mt6323-sound | 🟢 OK | machine: routing, jack, speaker amp |
| analog codec | mediatek,mt6323-sound | 🟢 OK | MT6323 PMIC: DAC, headphone, volume |
| capture (mic) | | 🔴 DEAD | |
| i2s | | 🔴 DEAD | |

### Pericfg
it seems to be clock + reset controller for NAND and USB
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/boot/dts/mediatek/mt6323.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#io-channel-cells = <1>;
};

mt6323_codec: audio-codec {
compatible = "mediatek,mt6323-sound";
};

efuse {
compatible = "mediatek,mt6323-efuse";

Expand Down
7 changes: 7 additions & 0 deletions arch/arm/boot/dts/mediatek/mt6572-lenovo-a369i.dts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@
min-microvolt = <1200000>;
max-microvolt = <3300000>;
};

sound {
compatible = "mediatek,mt6572-mt6323-sound";
mediatek,platform = <&afe>;
audio-routing = "Speaker", "Speaker Driver";
hp-det-gpios = <&pio 136 GPIO_ACTIVE_LOW>;
};
};

&bls {
Expand Down
29 changes: 29 additions & 0 deletions arch/arm/boot/dts/mediatek/mt6572-prestigio-pap5500-duo.dts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,28 @@
};
};

/ {
/* speaker amplifier (Yamaha YDA145), fed from the codec HP output */
speaker_amp: audio-amplifier {
compatible = "simple-audio-amplifier";
pinctrl-names = "default";
pinctrl-0 = <&speaker_amplifier_pins>;
enable-gpios = <&pio 139 GPIO_ACTIVE_HIGH>;
sound-name-prefix = "Speaker Amp";
};

sound {
compatible = "mediatek,mt6572-mt6323-sound";
mediatek,platform = <&afe>;
aux-devs = <&speaker_amp>;
audio-routing =
"Speaker Amp INL", "HP Driver",
"Speaker Amp INR", "HP Driver",
"Speaker", "Speaker Amp OUTL",
"Speaker", "Speaker Amp OUTR";
hp-det-gpios = <&pio 142 GPIO_ACTIVE_HIGH>;
};
};

&pwm {
pinctrl-0 = <&bl_pwm_pins>;
Expand Down Expand Up @@ -293,6 +315,13 @@
};
};

speaker_amplifier_pins: speaker-amplifier-pins {
pins {
pinmux = <MT6572_PIN_139_BPI_BUS9__FUNC_GPIO139>;
output-low;
};
};

pmic_int_pins: pmic-int-pins {
pins {
pinmux = <MT6572_PIN_7_PMIC_EINT__FUNC_PMIC_EINT>;
Expand Down
20 changes: 20 additions & 0 deletions arch/arm/boot/dts/mediatek/mt6572.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,26 @@
status = "disabled";
};

audsys: clock-controller@11140000 {
/* audio clock gates + AFE syscon; simple-mfd adds the AFE child */
compatible = "mediatek,mt6572-audsys", "syscon",
"simple-mfd";
reg = <0x11140000 0x1000>;
#clock-cells = <1>;

afe: audio-controller {
compatible = "mediatek,mt6572-audio";
clocks = <&topckgen CLK_TOP_AUDIO>;
iram = <&audio_sram>;
interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_LOW>;
};
};

audio_sram: sram@11141000 {
compatible = "mmio-sram";
reg = <0x11141000 0x4000>;
};

mfgcfg: syscon@13000000 {
compatible = "mediatek,mt6572-mfgcfg", "syscon";
reg = <0x13000000 0x1000>;
Expand Down
3 changes: 3 additions & 0 deletions drivers/mfd/mt6397-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ static const struct mfd_cell mt6323_devs[] = {
.num_resources = ARRAY_SIZE(mt6323_pwrc_resources),
.resources = mt6323_pwrc_resources,
.of_compatible = "mediatek,mt6323-pwrc"
}, {
.name = "mt6323-sound",
.of_compatible = "mediatek,mt6323-sound"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong order, this goes before thermal

}, {
.name = "mt6323-thermal",
.of_compatible = "mediatek,mt6323-thermal",
Expand Down
4 changes: 2 additions & 2 deletions drivers/pinctrl/mediatek/pinctrl-mtk-mt6572.h
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ static const struct mtk_pin_desc mtk_pins_mt6572[] = {
),
MTK_PIN(
136, "GPIO136",
MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT),
MTK_EINT_FUNCTION(4, 2),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsquash. this should be separate commit so i can squash this with initial pinctrl commit

DRV_GRP0,
MTK_FUNCTION(0, "GPIO136"),
MTK_FUNCTION(1, "BPI_BUS6"),
Expand Down Expand Up @@ -1348,7 +1348,7 @@ static const struct mtk_pin_desc mtk_pins_mt6572[] = {
),
MTK_PIN(
142, "GPIO142",
MTK_EINT_FUNCTION(NO_EINT_SUPPORT, NO_EINT_SUPPORT),
MTK_EINT_FUNCTION(3, 7),
DRV_GRP2,
MTK_FUNCTION(0, "GPIO142"),
MTK_FUNCTION(1, "BPI_BUS12"),
Expand Down
7 changes: 7 additions & 0 deletions sound/soc/codecs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ config SND_SOC_ALL_CODECS
imply SND_SOC_MAX9877
imply SND_SOC_MC13783
imply SND_SOC_ML26124
imply SND_SOC_MT6323
imply SND_SOC_MT6351
imply SND_SOC_MT6357
imply SND_SOC_MT6358
Expand Down Expand Up @@ -2756,6 +2757,12 @@ config SND_SOC_ML26124
tristate
depends on I2C

config SND_SOC_MT6323
tristate "MediaTek MT6323 Codec"
help
Enable support for the platform which uses MT6323 as
external codec device.

config SND_SOC_MT6351
tristate "MediaTek MT6351 Codec"

Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ snd-soc-mc13783-y := mc13783.o
snd-soc-ml26124-y := ml26124.o
snd-soc-msm8916-analog-y := msm8916-wcd-analog.o
snd-soc-msm8916-digital-y := msm8916-wcd-digital.o
snd-soc-mt6323-y := mt6323.o
snd-soc-mt6351-y := mt6351.o
snd-soc-mt6357-y := mt6357.o
snd-soc-mt6358-y := mt6358.o
Expand Down Expand Up @@ -620,6 +621,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_MT6357) += snd-soc-mt6357.o
obj-$(CONFIG_SND_SOC_MT6323) += snd-soc-mt6323.o
obj-$(CONFIG_SND_SOC_MT6358) += snd-soc-mt6358.o
obj-$(CONFIG_SND_SOC_MT6359) += snd-soc-mt6359.o
obj-$(CONFIG_SND_SOC_MT6359_ACCDET) += mt6359-accdet.o
Expand Down
Loading