Message ID | 20241128-z2-v2-0-76cc59bbf117@gmail.com |
---|---|
Headers | show |
Series | Driver for Apple Z2 touchscreens. | expand |
Sasha Finkelstein via B4 Relay 於 2024/11/29 早上6:29 寫道: > From: Sasha Finkelstein <fnkl.kernel@gmail.com> > > Adds device tree entries for the touchbar digitizer > > Co-developed-by: Janne Grunau <j@jannau.net> > Signed-off-by: Janne Grunau <j@jannau.net> > Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com> > --- > arch/arm64/boot/dts/apple/t8103-j293.dts | 26 ++++++++++++++++++++++++++ > arch/arm64/boot/dts/apple/t8103.dtsi | 20 ++++++++++++++++++++ > arch/arm64/boot/dts/apple/t8112-j493.dts | 24 ++++++++++++++++++++++++ > arch/arm64/boot/dts/apple/t8112.dtsi | 14 ++++++++++++++ > 4 files changed, 84 insertions(+) > > diff --git a/arch/arm64/boot/dts/apple/t8103-j293.dts b/arch/arm64/boot/dts/apple/t8103-j293.dts > index 56b0c67bfcda321b60c621de092643017693ff91..c31eb3f6f54268cafc9197a9244a5954fbb42802 100644 > --- a/arch/arm64/boot/dts/apple/t8103-j293.dts > +++ b/arch/arm64/boot/dts/apple/t8103-j293.dts > @@ -17,6 +17,14 @@ / { > compatible = "apple,j293", "apple,t8103", "apple,arm-platform"; > model = "Apple MacBook Pro (13-inch, M1, 2020)"; > > + /* > + * All of those are used by the bootloader to pass calibration > + * blobs and other device-specific properties > + */ > + aliases { > + touchbar0 = &touchbar0; > + }; > + > led-controller { > compatible = "pwm-leds"; > led-0 { > @@ -49,3 +57,21 @@ &i2c4 { > &fpwm1 { > status = "okay"; > }; > + > +&spi0 { > + status = "okay"; > + > + touchbar0: touchbar@0 { > + compatible = "apple,j293-touchbar"; > + reg = <0>; > + spi-max-frequency = <11500000>; > + spi-cs-setup-delay-ns = <2000>; > + spi-cs-hold-delay-ns = <2000>; > + reset-gpios = <&pinctrl_ap 139 GPIO_ACTIVE_LOW>; > + interrupts-extended = <&pinctrl_ap 194 IRQ_TYPE_EDGE_FALLING>; > + firmware-name = "apple/dfrmtfw-j293.bin"; > + touchscreen-size-x = <23045>; > + touchscreen-size-y = <640>; > + touchscreen-inverted-y; > + }; > +}; > diff --git a/arch/arm64/boot/dts/apple/t8103.dtsi b/arch/arm64/boot/dts/apple/t8103.dtsi > index 9b0dad6b618444ac6b1c9735c50cccfc3965f947..9b83341a799d9a37578e5461e6b184f81ee7435c 100644 > --- a/arch/arm64/boot/dts/apple/t8103.dtsi > +++ b/arch/arm64/boot/dts/apple/t8103.dtsi > @@ -326,6 +326,13 @@ clkref: clock-ref { > clock-output-names = "clkref"; > }; > > + clk_200m: clock-200m { > + compatible = "fixed-clock"; > + #clock-cells = <0>; > + clock-frequency = <200000000>; > + clock-output-names = "clk_200m"; > + }; > + > /* > * This is a fabulated representation of the input clock > * to NCO since we don't know the true clock tree. > @@ -441,6 +448,19 @@ fpwm1: pwm@235044000 { > status = "disabled"; > }; > > + spi0: spi@235100000 { > + compatible = "apple,t8103-spi", "apple,spi"; > + reg = <0x2 0x35100000 0x0 0x4000>; > + interrupt-parent = <&aic>; > + interrupts = <AIC_IRQ 614 IRQ_TYPE_LEVEL_HIGH>; > + cs-gpios = <&pinctrl_ap 109 GPIO_ACTIVE_LOW>; > + clocks = <&clk_200m>; > + power-domains = <&ps_spi0>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; /* only used in J293 */ > + }; > + > serial0: serial@235200000 { > compatible = "apple,s5l-uart"; > reg = <0x2 0x35200000 0x0 0x1000>; > diff --git a/arch/arm64/boot/dts/apple/t8112-j493.dts b/arch/arm64/boot/dts/apple/t8112-j493.dts > index 0ad908349f55406783942735a2e9dad54cda00ec..3332cc87cdf1a418c4c2247639baf5d2a42ed3c2 100644 > --- a/arch/arm64/boot/dts/apple/t8112-j493.dts > +++ b/arch/arm64/boot/dts/apple/t8112-j493.dts > @@ -17,8 +17,13 @@ / { > compatible = "apple,j493", "apple,t8112", "apple,arm-platform"; > model = "Apple MacBook Pro (13-inch, M2, 2022)"; > > + /* > + * All of those are used by the bootloader to pass calibration > + * blobs and other device-specific properties > + */ > aliases { > bluetooth0 = &bluetooth0; > + touchbar0 = &touchbar0; > wifi0 = &wifi0; > }; > > @@ -67,3 +72,22 @@ &i2c4 { > &fpwm1 { > status = "okay"; > }; > + > +&spi3 { > + status = "okay"; > + > + touchbar0: touchbar@0 { > + compatible = "apple,j493-touchbar"; > + reg = <0>; > + spi-max-frequency = <8000000>; > + spi-cs-setup-delay-ns = <2000>; > + spi-cs-hold-delay-ns = <2000>; > + Remove the empty line > + reset-gpios = <&pinctrl_ap 170 GPIO_ACTIVE_LOW>; > + interrupts-extended = <&pinctrl_ap 174 IRQ_TYPE_EDGE_FALLING>; > + firmware-name = "apple/dfrmtfw-j493.bin"; > + touchscreen-size-x = <23045>; > + touchscreen-size-y = <640>; > + touchscreen-inverted-y; > + }; > +}; > diff --git a/arch/arm64/boot/dts/apple/t8112.dtsi b/arch/arm64/boot/dts/apple/t8112.dtsi > index 1666e6ab250bc0be9b8318e3c8fc903ccd3f3760..977c1ca5e8c1b566bb3876b6619ea8812b98e072 100644 > --- a/arch/arm64/boot/dts/apple/t8112.dtsi > +++ b/arch/arm64/boot/dts/apple/t8112.dtsi > @@ -467,6 +467,20 @@ fpwm1: pwm@235044000 { > status = "disabled"; > }; > > + spi3: spi@23510c000 { > + compatible = "apple,t8112-spi", "apple,spi"; > + reg = <0x2 0x3510c000 0x0 0x4000>; > + interrupt-parent = <&aic>; > + interrupts = <AIC_IRQ 751 IRQ_TYPE_LEVEL_HIGH>; > + clocks = <&clkref>; > + pinctrl-0 = <&spi3_pins>; > + pinctrl-names = "default"; > + power-domains = <&ps_spi3>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; /* only used in J493 */ ? > + }; > + > serial0: serial@235200000 { > compatible = "apple,s5l-uart"; > reg = <0x2 0x35200000 0x0 0x1000>; > Nick Chan
On Thu, Nov 28, 2024 at 5:29 PM Sasha Finkelstein via B4 Relay <devnull+fnkl.kernel.gmail.com@kernel.org> wrote: > > Hi. > > This series adds support for Apple touchscreens using the Z2 protocol. > Those are used as the primary touchscreen on mobile Apple devices, and for the > touchbar on laptops using the M-series chips. (T1/T2 laptops have a coprocessor > in charge of speaking Z2 to the touchbar). > > Originally sent as a RFC at https://lore.kernel.org/all/20230223-z2-for-ml-v1-0-028f2b85dc15@gmail.com/ > The changes since then mostly address the review feedback, but also > add another machine that has this specific controller. > > Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com> > --- > Changes in v2: > - In a separate patch, fixed an issue that prevented the SPI controller > from using GPIO CS, and as such, moved the hardware quirk to there > - Went back to uploading the firmware in probe() instad of open() > - Other changes addressing the review feedback > - Link to v1: https://lore.kernel.org/r/20241126-z2-v1-0-c43c4cc6200d@gmail.com > > --- > Sasha Finkelstein (4): > dt-bindings: input: touchscreen: Add Z2 controller > input: apple_z2: Add a driver for Apple Z2 touchscreens > arm64: dts: apple: Add touchbar digitizer nodes > MAINTAINERS: Add entries for Apple Z2 touchscreen driver > > .../input/touchscreen/apple,z2-multitouch.yaml | 69 ++++ > MAINTAINERS | 2 + > arch/arm64/boot/dts/apple/t8103-j293.dts | 26 ++ > arch/arm64/boot/dts/apple/t8103.dtsi | 20 + > arch/arm64/boot/dts/apple/t8112-j493.dts | 24 ++ > arch/arm64/boot/dts/apple/t8112.dtsi | 14 + > drivers/input/touchscreen/Kconfig | 13 + > drivers/input/touchscreen/Makefile | 1 + > drivers/input/touchscreen/apple_z2.c | 458 +++++++++++++++++++++ > 9 files changed, 627 insertions(+) > --- > base-commit: 9f16d5e6f220661f73b36a4be1b21575651d8833 > change-id: 20241124-z2-c012b528ea0d > Series LGTM. Reviewed-by: Neal Gompa <neal@gompa.dev>
Hi. This series adds support for Apple touchscreens using the Z2 protocol. Those are used as the primary touchscreen on mobile Apple devices, and for the touchbar on laptops using the M-series chips. (T1/T2 laptops have a coprocessor in charge of speaking Z2 to the touchbar). Originally sent as a RFC at https://lore.kernel.org/all/20230223-z2-for-ml-v1-0-028f2b85dc15@gmail.com/ The changes since then mostly address the review feedback, but also add another machine that has this specific controller. Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com> --- Changes in v2: - In a separate patch, fixed an issue that prevented the SPI controller from using GPIO CS, and as such, moved the hardware quirk to there - Went back to uploading the firmware in probe() instad of open() - Other changes addressing the review feedback - Link to v1: https://lore.kernel.org/r/20241126-z2-v1-0-c43c4cc6200d@gmail.com --- Sasha Finkelstein (4): dt-bindings: input: touchscreen: Add Z2 controller input: apple_z2: Add a driver for Apple Z2 touchscreens arm64: dts: apple: Add touchbar digitizer nodes MAINTAINERS: Add entries for Apple Z2 touchscreen driver .../input/touchscreen/apple,z2-multitouch.yaml | 69 ++++ MAINTAINERS | 2 + arch/arm64/boot/dts/apple/t8103-j293.dts | 26 ++ arch/arm64/boot/dts/apple/t8103.dtsi | 20 + arch/arm64/boot/dts/apple/t8112-j493.dts | 24 ++ arch/arm64/boot/dts/apple/t8112.dtsi | 14 + drivers/input/touchscreen/Kconfig | 13 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/apple_z2.c | 458 +++++++++++++++++++++ 9 files changed, 627 insertions(+) --- base-commit: 9f16d5e6f220661f73b36a4be1b21575651d8833 change-id: 20241124-z2-c012b528ea0d