diff --git a/arch/arm64/boot/dts/apple/t6050-j714c.dts b/arch/arm64/boot/dts/apple/t6050-j714c.dts index f6da08c085819..9eb50fbc19327 100644 --- a/arch/arm64/boot/dts/apple/t6050-j714c.dts +++ b/arch/arm64/boot/dts/apple/t6050-j714c.dts @@ -153,8 +153,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 driver is not on this branch. 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 { @@ -205,17 +205,16 @@ }; }; -&i2c2 { - status = "disabled"; -}; +/* The headphone jack's CS42L84 on i2c2 */ +#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>; }; /* diff --git a/arch/arm64/boot/dts/apple/t6050-j873s.dts b/arch/arm64/boot/dts/apple/t6050-j873s.dts index 3ed8c503ebdc5..ff5518b32ff54 100644 --- a/arch/arm64/boot/dts/apple/t6050-j873s.dts +++ b/arch/arm64/boot/dts/apple/t6050-j873s.dts @@ -144,6 +144,9 @@ #include "t6050-peripherals.dtsi" #include "t6050-media.dtsi" +/* The headphone jack's CS42L84 on i2c2 (its pinctrl_ap reserves no ranges) */ +#include "t6050-jack.dtsi" + /* * Rear ports 1 and 2's USB4 routers with their PCIe and DP tunnels, and rear port 1 (ATC0, hpm0, * the debug port) itself. The J873s ADT has acio0-2, acio-cpu0-2, dart-acio0-2 and apciec0-2 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 0000000000000..ae47ddb869348 --- /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-k116c.dts b/arch/arm64/boot/dts/apple/t6050-k116c.dts index 4cc28acf5043b..0f740d4153a89 100644 --- a/arch/arm64/boot/dts/apple/t6050-k116c.dts +++ b/arch/arm64/boot/dts/apple/t6050-k116c.dts @@ -55,6 +55,12 @@ #define T6050_TOUCHID_FIRMWARE "apple/mesacal-k116c.bin", "apple/msrk-k116c.bin" #include "t6050-touchid.dtsi" +/* + * The headphone jack's CS42L84 on i2c2, as on the K114 boards; t6050-k114-k116.dtsi + * already exposes its pins 134 and 139. + */ +#include "t6050-jack.dtsi" + /* The USB-C ports ATC1 and ATC2, as on the other K boards */ #include "t6050-k114-k116-usb.dtsi" #include "t6050-k114-usb.dtsi"