diff --git a/arch/arm64/boot/dts/apple/t6050-j714c.dts b/arch/arm64/boot/dts/apple/t6050-j714c.dts index cf1d62c690fc..02e2bf0a3f1e 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714c.dts @@ -142,8 +142,8 @@ * 0 left woofer 1, 1 right woofer 1, 2 left woofer 2, 3 right woofer 2, 4 left tweeter, * 5 right tweeter. * - * There is no sound card yet: the AOP audio driver is not on this branch, and the jack codec - * (i2c2) is not described. The amps stay in shutdown until a stream asks for them. + * There is no sound card yet: the AOP audio service is not enabled on this board. The jack + * codec is on i2c2 (t6050-jack.dtsi). The amps stay in shutdown until a stream asks for them. */ / { speaker_sdz: regulator-sn012776-sdz { @@ -194,17 +194,16 @@ }; }; -&i2c2 { - status = "disabled"; -}; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" /* * Only the pins a node here names are exposed, as on the J716c: pin 112's register - * takes an SError when read. 80 is PCIe port 0's PERST#, 106 the amps' fault interrupt and - * 107 their shutdown line. + * takes an SError when read. 80 is PCIe port 0's PERST#, 106 the amps' fault interrupt, + * 107 their shutdown line, and 134 and 139 the jack codec's interrupt and reset. */ &pinctrl_ap { - gpio-reserved-ranges = <0 80>, <81 25>, <108 113>; + gpio-reserved-ranges = <0 80>, <81 25>, <108 26>, <135 4>, <140 81>; }; /* This board's SMC fan and power keys are not yet checked */ diff --git a/arch/arm64/boot/dts/apple/t6050-j714s.dts b/arch/arm64/boot/dts/apple/t6050-j714s.dts index 383ec08bedbe..d33eeaa3eca0 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714s.dts @@ -833,23 +833,8 @@ }; }; -/* - * The CS42L84 headphone codec (ADT /arm-io/i2c2/audio-codec-output): its reset line - * is AP pin 139, driven high to run the codec, and its interrupt AP pin 134, level - * low. - */ -&i2c2 { - status = "okay"; - - jack_codec: codec@4b { - compatible = "cirrus,cs42l84"; - reg = <0x4b>; - reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; - interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; - #sound-dai-cells = <0>; - sound-name-prefix = "Jack"; - }; -}; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" / { sound { diff --git a/arch/arm64/boot/dts/apple/t6050-j716c.dts b/arch/arm64/boot/dts/apple/t6050-j716c.dts index 8fdea5242027..54d13696dd9e 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716c.dts @@ -170,17 +170,17 @@ status = "disabled"; }; -&i2c2 { - status = "disabled"; -}; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" /* * Pin 112's register (0x29c0001c0) takes an SError when read, so only the pins a node - * here names are exposed: 80 (PCIe port 0's PERST#, ADT pci-bridge0 function-perst). + * here names are exposed: 80 (PCIe port 0's PERST#, ADT pci-bridge0 function-perst), and + * 134 and 139 (the jack codec's interrupt and reset). * A reserved line cannot be requested, so a node that names a new pin opens it here too. */ &pinctrl_ap { - gpio-reserved-ranges = <0 80>, <81 140>; + gpio-reserved-ranges = <0 80>, <81 53>, <135 4>, <140 81>; }; /* This board's SMC fan and power keys are not yet checked */ diff --git a/arch/arm64/boot/dts/apple/t6050-j716s.dts b/arch/arm64/boot/dts/apple/t6050-j716s.dts index 43747a4ce6be..774318470310 100644 --- a/arch/arm64/boot/dts/apple/t6050-j716s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j716s.dts @@ -445,21 +445,21 @@ status = "okay"; }; -/* Audio is not brought up: six sn012776 on i2c1/i2c3 and a cs42l84 on i2c2 */ +/* The speakers are not brought up: six sn012776 on i2c1/i2c3 */ &i2c1 { status = "disabled"; }; -&i2c2 { - status = "disabled"; -}; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" /* * Pin 112 takes an SError when read (as on the J716c), so only the pins a node - * here names are exposed: 80 (PCIe port 0's PERST#). + * here names are exposed: 80 (PCIe port 0's PERST#), and 134 and 139 (the jack + * codec's interrupt and reset). */ &pinctrl_ap { - gpio-reserved-ranges = <0 80>, <81 140>; + gpio-reserved-ranges = <0 80>, <81 53>, <135 4>, <140 81>; }; /* diff --git a/arch/arm64/boot/dts/apple/t6050-j775d.dts b/arch/arm64/boot/dts/apple/t6050-j775d.dts index 68b4c324aca0..4adf6975666c 100644 --- a/arch/arm64/boot/dts/apple/t6050-j775d.dts +++ b/arch/arm64/boot/dts/apple/t6050-j775d.dts @@ -256,16 +256,8 @@ }; }; -&i2c2 { - jack_codec: codec@4b { - compatible = "cirrus,cs42l84"; - reg = <0x4b>; - reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; - interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; - #sound-dai-cells = <0>; - sound-name-prefix = "Jack"; - }; -}; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" /* * The console is on the USB debug link, which drains only while a host reads diff --git a/arch/arm64/boot/dts/apple/t6050-j873s.dts b/arch/arm64/boot/dts/apple/t6050-j873s.dts index 0a7976e50230..c00743e06986 100644 --- a/arch/arm64/boot/dts/apple/t6050-j873s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j873s.dts @@ -32,5 +32,8 @@ status = "disabled"; }; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" + #define T6050_J873S #include "t6050-peripherals.dtsi" diff --git a/arch/arm64/boot/dts/apple/t6050-jack.dtsi b/arch/arm64/boot/dts/apple/t6050-jack.dtsi new file mode 100644 index 000000000000..ae47ddb86934 --- /dev/null +++ b/arch/arm64/boot/dts/apple/t6050-jack.dtsi @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ OR MIT +/* + * The 3.5 mm headphone jack's CS42L84 codec, the same on every T6050 board + * that has one (from each board's ADT): on i2c2 at 0x4b, its reset line on + * AP pin 139, driven high to run the codec, and its interrupt on AP pin 134, + * level low. + * + * A board that includes this file also exposes pins 134 and 139 in its + * pinctrl_ap gpio-reserved-ranges. The jack only reports a plug and plays + * through a sound card (macaudio) whose jack link names &jack_codec; a board + * without one gets the codec alone. + * + * Copyright The Asahi Linux Contributors + */ + +#include +#include + +&i2c2 { + status = "okay"; + + jack_codec: codec@4b { + compatible = "cirrus,cs42l84"; + reg = <0x4b>; + reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; + interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; + #sound-dai-cells = <0>; + sound-name-prefix = "Jack"; + }; +}; diff --git a/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi b/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi index f7cedd1a4c85..25261efa8ba7 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi +++ b/arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi @@ -131,18 +131,17 @@ status = "disabled"; }; -&i2c2 { - status = "disabled"; -}; +/* The headphone jack's CS42L84 on i2c2 (t6050-jack.dtsi) */ +#include "t6050-jack.dtsi" /* * As on J716c, where reading pin 112 takes an SError, only the pins a node - * here names are exposed, and none is yet. The N1 on PCIe port 0 needs its - * board's platform ID, which the static ADT does not carry, so the port and - * its PERST# pin stay unused for now. + * here names are exposed: 134 and 139, the jack codec's interrupt and reset. + * The N1 on PCIe port 0 needs its board's platform ID, which the static ADT + * does not carry, so the port and its PERST# pin stay unused for now. */ &pinctrl_ap { - gpio-reserved-ranges = <0 221>; + gpio-reserved-ranges = <0 134>, <135 4>, <140 81>; }; /* diff --git a/arch/arm64/boot/dts/apple/t6050-k114c.dts b/arch/arm64/boot/dts/apple/t6050-k114c.dts index 13ea865ba58e..47831878b2f0 100644 --- a/arch/arm64/boot/dts/apple/t6050-k114c.dts +++ b/arch/arm64/boot/dts/apple/t6050-k114c.dts @@ -225,24 +225,6 @@ }; }; -/* - * The CS42L84 headphone codec (ADT /arm-io/i2c2/audio-codec-output): its reset line - * is AP pin 139, driven high to run the codec, and its interrupt AP pin 134, level - * low. - */ -&i2c2 { - status = "okay"; - - jack_codec: codec@4b { - compatible = "cirrus,cs42l84"; - reg = <0x4b>; - reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; - interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; - #sound-dai-cells = <0>; - sound-name-prefix = "Jack"; - }; -}; - / { sound { compatible = "apple,j714-macaudio", "apple,macaudio"; diff --git a/arch/arm64/boot/dts/apple/t6050-k116s.dts b/arch/arm64/boot/dts/apple/t6050-k116s.dts index fe6468edc72c..25817478cc72 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116s.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116s.dts @@ -712,24 +712,6 @@ }; }; -/* - * The CS42L84 headphone codec (ADT /arm-io/i2c2/audio-codec-output, reg 0x4b): reset on AP - * pin 139 (function-reset GPIO(0x8b, 0x1)), driven high to run; interrupt AP pin 134, level - * low. i2c2 is disabled by t6050-k114-k116.dtsi; re-enabled here. - */ -&i2c2 { - status = "okay"; - - jack_codec: codec@4b { - compatible = "cirrus,cs42l84"; - reg = <0x4b>; - reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_HIGH>; - interrupts-extended = <&pinctrl_ap 134 IRQ_TYPE_LEVEL_LOW>; - #sound-dai-cells = <0>; - sound-name-prefix = "Jack"; - }; -}; - /* ADT admac-base-ns: 0x293800000, IRQ 637, 13 TX + 13 RX channels, dart-aop stream 8 */ &admac_base_ns { status = "okay";