Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix sound on ASUS Transformers

Merge series from Svyatoslav Ryhel <clamor95@gmail.com>:

- add quirk for headset detection used by some T30 devices
(ASUS Transformers, LG Optimus 4X HD and Vu);
- add RT5631 and MAX9808x machine drivers
- update bindings

---
Changes from v1
- fm34 dropped for re-work
- quirk for headset detection and rt5631 bringup splitted
- minor adjustments in binding updates
- improvement of rt5631 rate asignment
---

David Heidelberg (1):
dt-bindings: sound: nvidia,tegra-audio: add RT5631 CODEC

Svyatoslav Ryhel (7):
dt-bindings: sound: nvidia,tegra-audio-common: add
coupled-mic-hp-detect property
ASoC: tegra: Support coupled mic-hp detection
ARM: tegra: transformers: update sound nodes
ASoC: tegra: Support RT5631 by machine driver
ARM: tegra: transformers: bind RT5631 sound nodes
dt-bindings: sound: nvidia,tegra-audio: add MAX9808x CODEC
ASoC: tegra: Support MAX9808x by machine driver

.../sound/nvidia,tegra-audio-common.yaml | 4 +
.../sound/nvidia,tegra-audio-max9808x.yaml | 90 +++++++++++++
.../sound/nvidia,tegra-audio-rt5631.yaml | 85 ++++++++++++
arch/arm/boot/dts/tegra20-asus-tf101.dts | 7 +-
arch/arm/boot/dts/tegra30-asus-tf201.dts | 17 +++
arch/arm/boot/dts/tegra30-asus-tf300t.dts | 5 +-
arch/arm/boot/dts/tegra30-asus-tf300tg.dts | 17 +++
arch/arm/boot/dts/tegra30-asus-tf700t.dts | 17 +++
.../dts/tegra30-asus-transformer-common.dtsi | 9 +-
sound/soc/tegra/Kconfig | 18 +++
sound/soc/tegra/tegra_asoc_machine.c | 125 +++++++++++++++++-
11 files changed, 380 insertions(+), 14 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max9808x.yaml
create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5631.yaml

--
2.37.2

+318 -4
+4
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-common.yaml
··· 80 80 type: boolean 81 81 description: The Mic Jack represents state of the headset microphone pin 82 82 83 + nvidia,coupled-mic-hp-det: 84 + type: boolean 85 + description: The Mic detect GPIO is viable only if HP detect GPIO is active 86 + 83 87 additionalProperties: true
+90
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-max9808x.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-max9808x.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: NVIDIA Tegra audio complex with MAX9808x CODEC 8 + 9 + maintainers: 10 + - Jon Hunter <jonathanh@nvidia.com> 11 + - Thierry Reding <thierry.reding@gmail.com> 12 + 13 + allOf: 14 + - $ref: nvidia,tegra-audio-common.yaml# 15 + 16 + properties: 17 + compatible: 18 + oneOf: 19 + - items: 20 + - pattern: '^[a-z0-9]+,tegra-audio-max98088(-[a-z0-9]+)+$' 21 + - const: nvidia,tegra-audio-max98088 22 + - items: 23 + - pattern: '^[a-z0-9]+,tegra-audio-max98089(-[a-z0-9]+)+$' 24 + - const: nvidia,tegra-audio-max98089 25 + 26 + nvidia,audio-routing: 27 + $ref: /schemas/types.yaml#/definitions/non-unique-string-array 28 + description: | 29 + A list of the connections between audio components. 30 + Each entry is a pair of strings, the first being the connection's sink, 31 + the second being the connection's source. Valid names for sources and 32 + sinks are the pins (documented in the binding document), 33 + and the jacks on the board. 34 + minItems: 2 35 + items: 36 + enum: 37 + # Board Connectors 38 + - "Int Spk" 39 + - "Headphone Jack" 40 + - "Earpiece" 41 + - "Headset Mic" 42 + - "Internal Mic 1" 43 + - "Internal Mic 2" 44 + 45 + # CODEC Pins 46 + - HPL 47 + - HPR 48 + - SPKL 49 + - SPKR 50 + - RECL 51 + - RECR 52 + - INA1 53 + - INA2 54 + - INB1 55 + - INB2 56 + - MIC1 57 + - MIC2 58 + - MICBIAS 59 + 60 + unevaluatedProperties: false 61 + 62 + examples: 63 + - | 64 + #include <dt-bindings/clock/tegra30-car.h> 65 + #include <dt-bindings/soc/tegra-pmc.h> 66 + sound { 67 + compatible = "lge,tegra-audio-max98089-p895", 68 + "nvidia,tegra-audio-max98089"; 69 + nvidia,model = "LG Optimus Vu MAX98089"; 70 + 71 + nvidia,audio-routing = 72 + "Headphone Jack", "HPL", 73 + "Headphone Jack", "HPR", 74 + "Int Spk", "SPKL", 75 + "Int Spk", "SPKR", 76 + "Earpiece", "RECL", 77 + "Earpiece", "RECR", 78 + "INA1", "Headset Mic", 79 + "MIC1", "MICBIAS", 80 + "MICBIAS", "Internal Mic 1", 81 + "MIC2", "Internal Mic 2"; 82 + 83 + nvidia,i2s-controller = <&tegra_i2s0>; 84 + nvidia,audio-codec = <&codec>; 85 + 86 + clocks = <&tegra_car TEGRA30_CLK_PLL_A>, 87 + <&tegra_car TEGRA30_CLK_PLL_A_OUT0>, 88 + <&tegra_pmc TEGRA_PMC_CLK_OUT_1>; 89 + clock-names = "pll_a", "pll_a_out0", "mclk"; 90 + };
+85
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-rt5631.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-rt5631.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: NVIDIA Tegra audio complex with RT5631 CODEC 8 + 9 + maintainers: 10 + - Jon Hunter <jonathanh@nvidia.com> 11 + - Thierry Reding <thierry.reding@gmail.com> 12 + 13 + allOf: 14 + - $ref: nvidia,tegra-audio-common.yaml# 15 + 16 + properties: 17 + compatible: 18 + items: 19 + - pattern: '^[a-z0-9]+,tegra-audio-rt5631(-[a-z0-9]+)+$' 20 + - const: nvidia,tegra-audio-rt5631 21 + 22 + nvidia,audio-routing: 23 + $ref: /schemas/types.yaml#/definitions/non-unique-string-array 24 + description: | 25 + A list of the connections between audio components. 26 + Each entry is a pair of strings, the first being the connection's sink, 27 + the second being the connection's source. Valid names for sources and 28 + sinks are the pins (documented in the binding document), 29 + and the jacks on the board. 30 + minItems: 2 31 + items: 32 + enum: 33 + # Board Connectors 34 + - "Int Spk" 35 + - "Headphone Jack" 36 + - "Mic Jack" 37 + - "Int Mic" 38 + 39 + # CODEC Pins 40 + - MIC1 41 + - MIC2 42 + - AXIL 43 + - AXIR 44 + - MONOIN_RXN 45 + - MONOIN_RXP 46 + - DMIC 47 + - MIC Bias1 48 + - MIC Bias2 49 + - MONO_IN 50 + - AUXO1 51 + - AUXO2 52 + - SPOL 53 + - SPOR 54 + - HPOL 55 + - HPOR 56 + - MONO 57 + 58 + unevaluatedProperties: false 59 + 60 + examples: 61 + - | 62 + #include <dt-bindings/clock/tegra30-car.h> 63 + #include <dt-bindings/soc/tegra-pmc.h> 64 + sound { 65 + compatible = "asus,tegra-audio-rt5631-tf700t", 66 + "nvidia,tegra-audio-rt5631"; 67 + nvidia,model = "Asus Transformer Infinity TF700T RT5631"; 68 + 69 + nvidia,audio-routing = 70 + "Headphone Jack", "HPOL", 71 + "Headphone Jack", "HPOR", 72 + "Int Spk", "SPOL", 73 + "Int Spk", "SPOR", 74 + "MIC1", "MIC Bias1", 75 + "MIC Bias1", "Mic Jack", 76 + "DMIC", "Int Mic"; 77 + 78 + nvidia,i2s-controller = <&tegra_i2s1>; 79 + nvidia,audio-codec = <&rt5631>; 80 + 81 + clocks = <&tegra_car TEGRA30_CLK_PLL_A>, 82 + <&tegra_car TEGRA30_CLK_PLL_A_OUT0>, 83 + <&tegra_pmc TEGRA_PMC_CLK_OUT_1>; 84 + clock-names = "pll_a", "pll_a_out0", "mclk"; 85 + };
+18
sound/soc/tegra/Kconfig
··· 189 189 config SND_SOC_TEGRA_MACHINE_DRV 190 190 tristate 191 191 192 + config SND_SOC_TEGRA_RT5631 193 + tristate "SoC Audio support for Tegra boards using an RT5631 codec" 194 + depends on SND_SOC_TEGRA && I2C && GPIOLIB 195 + select SND_SOC_TEGRA_MACHINE_DRV 196 + select SND_SOC_RT5631 197 + help 198 + Say Y or M here if you want to add support for SoC audio on Tegra 199 + boards using the RT5631 codec, such as Transformer. 200 + 192 201 config SND_SOC_TEGRA_RT5640 193 202 tristate "SoC Audio support for Tegra boards using an RT5640 codec" 194 203 depends on I2C && GPIOLIB ··· 262 253 help 263 254 Say Y or M here if you want to add support for SoC audio on Tegra 264 255 boards using the MAX98090 codec, such as Venice2. 256 + 257 + config SND_SOC_TEGRA_MAX98088 258 + tristate "SoC Audio support for Tegra boards using a MAX9808x codec" 259 + depends on I2C && GPIOLIB 260 + select SND_SOC_TEGRA_MACHINE_DRV 261 + select SND_SOC_MAX98088 262 + help 263 + Say Y or M here if you want to add support for SoC audio on Tegra 264 + boards using the MAX98088 codec, such as LG X3. 265 265 266 266 config SND_SOC_TEGRA_RT5677 267 267 tristate "SoC Audio support for Tegra boards using a RT5677 codec"
+121 -4
sound/soc/tegra/tegra_asoc_machine.c
··· 51 51 }; 52 52 53 53 /* Mic Jack */ 54 + static int coupled_mic_hp_check(void *data) 55 + { 56 + struct tegra_machine *machine = (struct tegra_machine *)data; 57 + 58 + /* Detect mic insertion only if 3.5 jack is in */ 59 + if (gpiod_get_value_cansleep(machine->gpiod_hp_det) && 60 + gpiod_get_value_cansleep(machine->gpiod_mic_det)) 61 + return SND_JACK_MICROPHONE; 62 + 63 + return 0; 64 + } 54 65 55 66 static struct snd_soc_jack tegra_machine_mic_jack; 56 67 ··· 86 75 gpiod_set_value_cansleep(machine->gpiod_spkr_en, 87 76 SND_SOC_DAPM_EVENT_ON(event)); 88 77 89 - if (!strcmp(w->name, "Mic Jack")) 78 + if (!strcmp(w->name, "Mic Jack") || !strcmp(w->name, "Headset Mic")) 90 79 gpiod_set_value_cansleep(machine->gpiod_ext_mic_en, 91 80 SND_SOC_DAPM_EVENT_ON(event)); 92 81 93 - if (!strcmp(w->name, "Int Mic")) 82 + if (!strcmp(w->name, "Int Mic") || !strcmp(w->name, "Internal Mic 2")) 94 83 gpiod_set_value_cansleep(machine->gpiod_int_mic_en, 95 84 SND_SOC_DAPM_EVENT_ON(event)); 96 85 ··· 108 97 SND_SOC_DAPM_HP("Headphones", NULL), 109 98 SND_SOC_DAPM_SPK("Speakers", tegra_machine_event), 110 99 SND_SOC_DAPM_SPK("Int Spk", tegra_machine_event), 100 + SND_SOC_DAPM_SPK("Earpiece", NULL), 111 101 SND_SOC_DAPM_MIC("Int Mic", tegra_machine_event), 112 102 SND_SOC_DAPM_MIC("Mic Jack", tegra_machine_event), 113 103 SND_SOC_DAPM_MIC("Internal Mic 1", NULL), 114 - SND_SOC_DAPM_MIC("Internal Mic 2", NULL), 115 - SND_SOC_DAPM_MIC("Headset Mic", NULL), 104 + SND_SOC_DAPM_MIC("Internal Mic 2", tegra_machine_event), 105 + SND_SOC_DAPM_MIC("Headset Mic", tegra_machine_event), 116 106 SND_SOC_DAPM_MIC("Digital Mic", NULL), 117 107 SND_SOC_DAPM_MIC("Mic", NULL), 118 108 SND_SOC_DAPM_LINE("Line In Jack", NULL), ··· 124 112 static const struct snd_kcontrol_new tegra_machine_controls[] = { 125 113 SOC_DAPM_PIN_SWITCH("Speakers"), 126 114 SOC_DAPM_PIN_SWITCH("Int Spk"), 115 + SOC_DAPM_PIN_SWITCH("Earpiece"), 127 116 SOC_DAPM_PIN_SWITCH("Int Mic"), 128 117 SOC_DAPM_PIN_SWITCH("Headset Mic"), 129 118 SOC_DAPM_PIN_SWITCH("Internal Mic 1"), ··· 196 183 return err; 197 184 } 198 185 186 + tegra_machine_mic_jack_gpio.data = machine; 199 187 tegra_machine_mic_jack_gpio.desc = machine->gpiod_mic_det; 188 + 189 + if (of_property_read_bool(card->dev->of_node, 190 + "nvidia,coupled-mic-hp-det")) { 191 + tegra_machine_mic_jack_gpio.desc = machine->gpiod_hp_det; 192 + tegra_machine_mic_jack_gpio.jack_status_check = coupled_mic_hp_check; 193 + }; 200 194 201 195 err = snd_soc_jack_add_gpios(&tegra_machine_mic_jack, 1, 202 196 &tegra_machine_mic_jack_gpio); ··· 252 232 break; 253 233 default: 254 234 mclk = 12000000; 235 + break; 236 + } 237 + 238 + return mclk; 239 + } 240 + 241 + static unsigned int tegra_machine_mclk_rate_6mhz(unsigned int srate) 242 + { 243 + unsigned int mclk; 244 + 245 + switch (srate) { 246 + case 8000: 247 + case 16000: 248 + case 64000: 249 + mclk = 8192000; 250 + break; 251 + case 11025: 252 + case 22050: 253 + case 88200: 254 + mclk = 11289600; 255 + break; 256 + case 96000: 257 + mclk = 12288000; 258 + break; 259 + default: 260 + mclk = 256 * srate; 255 261 break; 256 262 } 257 263 ··· 720 674 .add_hp_jack = true, 721 675 }; 722 676 677 + /* MAX98088 machine */ 678 + 679 + SND_SOC_DAILINK_DEFS(max98088_hifi, 680 + DAILINK_COMP_ARRAY(COMP_EMPTY()), 681 + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "HiFi")), 682 + DAILINK_COMP_ARRAY(COMP_EMPTY())); 683 + 684 + static struct snd_soc_dai_link tegra_max98088_dai = { 685 + .name = "MAX98088", 686 + .stream_name = "MAX98088 PCM", 687 + .init = tegra_asoc_machine_init, 688 + .dai_fmt = SND_SOC_DAIFMT_I2S | 689 + SND_SOC_DAIFMT_NB_NF | 690 + SND_SOC_DAIFMT_CBS_CFS, 691 + SND_SOC_DAILINK_REG(max98088_hifi), 692 + }; 693 + 694 + static struct snd_soc_card snd_soc_tegra_max98088 = { 695 + .components = "codec:max98088", 696 + .dai_link = &tegra_max98088_dai, 697 + .num_links = 1, 698 + .fully_routed = true, 699 + }; 700 + 701 + static const struct tegra_asoc_data tegra_max98088_data = { 702 + .mclk_rate = tegra_machine_mclk_rate_12mhz, 703 + .card = &snd_soc_tegra_max98088, 704 + .add_common_dapm_widgets = true, 705 + .add_common_controls = true, 706 + .add_common_snd_ops = true, 707 + .add_mic_jack = true, 708 + .add_hp_jack = true, 709 + }; 710 + 723 711 /* SGTL5000 machine */ 724 712 725 713 SND_SOC_DAILINK_DEFS(sgtl5000_hifi, ··· 945 865 .add_headset_jack = true, 946 866 }; 947 867 868 + /* RT5631 machine */ 869 + 870 + SND_SOC_DAILINK_DEFS(rt5631_hifi, 871 + DAILINK_COMP_ARRAY(COMP_EMPTY()), 872 + DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "rt5631-hifi")), 873 + DAILINK_COMP_ARRAY(COMP_EMPTY())); 874 + 875 + static struct snd_soc_dai_link tegra_rt5631_dai = { 876 + .name = "RT5631", 877 + .stream_name = "RT5631 PCM", 878 + .init = tegra_asoc_machine_init, 879 + .dai_fmt = SND_SOC_DAIFMT_I2S | 880 + SND_SOC_DAIFMT_NB_NF | 881 + SND_SOC_DAIFMT_CBS_CFS, 882 + SND_SOC_DAILINK_REG(rt5631_hifi), 883 + }; 884 + 885 + static struct snd_soc_card snd_soc_tegra_rt5631 = { 886 + .components = "codec:rt5631", 887 + .dai_link = &tegra_rt5631_dai, 888 + .num_links = 1, 889 + .fully_routed = true, 890 + }; 891 + 892 + static const struct tegra_asoc_data tegra_rt5631_data = { 893 + .mclk_rate = tegra_machine_mclk_rate_6mhz, 894 + .card = &snd_soc_tegra_rt5631, 895 + .add_common_dapm_widgets = true, 896 + .add_common_controls = true, 897 + .add_common_snd_ops = true, 898 + .add_mic_jack = true, 899 + .add_hp_jack = true, 900 + }; 901 + 948 902 static const struct of_device_id tegra_machine_of_match[] = { 949 903 { .compatible = "nvidia,tegra-audio-trimslice", .data = &tegra_trimslice_data }, 950 904 { .compatible = "nvidia,tegra-audio-max98090", .data = &tegra_max98090_data }, 905 + { .compatible = "nvidia,tegra-audio-max98088", .data = &tegra_max98088_data }, 906 + { .compatible = "nvidia,tegra-audio-max98089", .data = &tegra_max98088_data }, 951 907 { .compatible = "nvidia,tegra-audio-sgtl5000", .data = &tegra_sgtl5000_data }, 952 908 { .compatible = "nvidia,tegra-audio-wm9712", .data = &tegra_wm9712_data }, 953 909 { .compatible = "nvidia,tegra-audio-wm8753", .data = &tegra_wm8753_data }, 954 910 { .compatible = "nvidia,tegra-audio-rt5677", .data = &tegra_rt5677_data }, 955 911 { .compatible = "nvidia,tegra-audio-rt5640", .data = &tegra_rt5640_data }, 956 912 { .compatible = "nvidia,tegra-audio-alc5632", .data = &tegra_rt5632_data }, 913 + { .compatible = "nvidia,tegra-audio-rt5631", .data = &tegra_rt5631_data }, 957 914 {}, 958 915 }; 959 916 MODULE_DEVICE_TABLE(of, tegra_machine_of_match);