Message ID | 20241126-z2-v1-0-c43c4cc6200d@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Driver for Apple Z2 touchscreens. | expand |
Hi Sasha, On Tue, Nov 26, 2024 at 09:47:58PM +0100, Sasha Finkelstein via B4 Relay 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. > > The extra gpio needed to be toggled turned out to be a quirk of the > j293, normal CS is unusable on it, and a gpio has to be used instead. > (j493 does not have this quirk) I believe this needs to be done at the SPI controller level. See "cs-gpiods" property in Documentation/devicetree/bindings/spi/spi-controller.yaml that, as far as I understand, allows overriding controller's native CS handling with a GPIO when needed. Cc-ing Mark Brown. Thanks.
On Wed, 27 Nov 2024 at 02:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > I believe this needs to be done at the SPI controller level. See > "cs-gpiods" property in > Documentation/devicetree/bindings/spi/spi-controller.yaml that, as far > as I understand, allows overriding controller's native CS handling with > a GPIO when needed. I have already tried doing that (adding the relevant gpio as cs-gpios on the controller) and for some reason none of my attempts worked. Since there is no hardware documentation, I can't really tell why, could be possible that we need both native CS and that gpio, could be memory barrier issues somewhere in the driver core, but the method above is the only one i could get to work.
On 26/11/2024 21:47, Sasha Finkelstein via B4 Relay 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. Then this is v2, not v1. Look: b4 diff '<20241126-z2-v1-0-c43c4cc6200d@gmail.com>' Grabbing thread from lore.kernel.org/all/20241126-z2-v1-0-c43c4cc6200d@gmail.com/t.mbox.gz --- Analyzing 16 messages in the thread Could not find lower series to compare against. Also we expect changelog in cover letter or individual patches. Best regards, Krzysztof
On 2024/11/27 17:29, Sasha Finkelstein wrote: > On Wed, 27 Nov 2024 at 02:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: >> I believe this needs to be done at the SPI controller level. See >> "cs-gpiods" property in >> Documentation/devicetree/bindings/spi/spi-controller.yaml that, as far >> as I understand, allows overriding controller's native CS handling with >> a GPIO when needed. > > I have already tried doing that (adding the relevant gpio as cs-gpios > on the controller) > and for some reason none of my attempts worked. Since there is no hardware > documentation, I can't really tell why, could be possible that we need both > native CS and that gpio, could be memory barrier issues somewhere in > the driver core, > but the method above is the only one i could get to work. Are you sure this isn't just a pinmux problem, i.e. the bootloader initializes the pinmux for hardware CS only on one device and not the other? See spi3_pins in the DTS in our downstream tree (and the reference from the SPI controller). If the rest of the SPI pins are already working properly you can just try with the CS pin (same index as on the gpio spec). Ideally we'd list the 4 pins, but someone needs to reverse engineer the mapping with m1n1 gpiola since we don't know what it is. If it really doesn't work with native CS and proper pinmux then cs-gpios on the controller should work. If it doesn't something weird is going on elsewhere. There's only one CS line, needing both makes no sense. - Hector
On 2024/11/28 0:29, Hector Martin wrote: > > > On 2024/11/27 17:29, Sasha Finkelstein wrote: >> On Wed, 27 Nov 2024 at 02:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: >>> I believe this needs to be done at the SPI controller level. See >>> "cs-gpiods" property in >>> Documentation/devicetree/bindings/spi/spi-controller.yaml that, as far >>> as I understand, allows overriding controller's native CS handling with >>> a GPIO when needed. >> >> I have already tried doing that (adding the relevant gpio as cs-gpios >> on the controller) >> and for some reason none of my attempts worked. Since there is no hardware >> documentation, I can't really tell why, could be possible that we need both >> native CS and that gpio, could be memory barrier issues somewhere in >> the driver core, >> but the method above is the only one i could get to work. > > Are you sure this isn't just a pinmux problem, i.e. the bootloader > initializes the pinmux for hardware CS only on one device and not the other? > > See spi3_pins in the DTS in our downstream tree (and the reference from > the SPI controller). If the rest of the SPI pins are already working > properly you can just try with the CS pin (same index as on the gpio > spec). Ideally we'd list the 4 pins, but someone needs to reverse > engineer the mapping with m1n1 gpiola since we don't know what it is. > > If it really doesn't work with native CS and proper pinmux then cs-gpios > on the controller should work. If it doesn't something weird is going on > elsewhere. There's only one CS line, needing both makes no sense. > Looked into this. The pins are 67=CLK, 68=MOSI, 69=MISO for spi0 on t8103 (they should be added to pinctrl even though they are already configured by iBoot, ping Janne). It does sound like there's no hardware CS for SPI0, so the referenced GPIO 109 is probably just a GPIO. In that case it should work when declared as a cs for the SPI controller node. If that doesn't work we need to figure out why and fix it, not add it into the z2 driver. - Hector
On Thu, Nov 28, 2024 at 01:20:09AM +0900, Hector Martin wrote: > > > On 2024/11/28 0:29, Hector Martin wrote: > > > > > > On 2024/11/27 17:29, Sasha Finkelstein wrote: > >> On Wed, 27 Nov 2024 at 02:51, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > >>> I believe this needs to be done at the SPI controller level. See > >>> "cs-gpiods" property in > >>> Documentation/devicetree/bindings/spi/spi-controller.yaml that, as far > >>> as I understand, allows overriding controller's native CS handling with > >>> a GPIO when needed. > >> > >> I have already tried doing that (adding the relevant gpio as cs-gpios > >> on the controller) > >> and for some reason none of my attempts worked. Since there is no hardware > >> documentation, I can't really tell why, could be possible that we need both > >> native CS and that gpio, could be memory barrier issues somewhere in > >> the driver core, > >> but the method above is the only one i could get to work. > > > > Are you sure this isn't just a pinmux problem, i.e. the bootloader > > initializes the pinmux for hardware CS only on one device and not the other? > > > > See spi3_pins in the DTS in our downstream tree (and the reference from > > the SPI controller). If the rest of the SPI pins are already working > > properly you can just try with the CS pin (same index as on the gpio > > spec). Ideally we'd list the 4 pins, but someone needs to reverse > > engineer the mapping with m1n1 gpiola since we don't know what it is. > > > > If it really doesn't work with native CS and proper pinmux then cs-gpios > > on the controller should work. If it doesn't something weird is going on > > elsewhere. There's only one CS line, needing both makes no sense. > > > > Looked into this. The pins are 67=CLK, 68=MOSI, 69=MISO for spi0 on > t8103 (they should be added to pinctrl even though they are already > configured by iBoot, ping Janne). queued for the next revision of my "Add Apple SPI controller and spi-nor dt nodes" series [0] and imported in the downstream kernel. thanks Janne [0] https://lore.kernel.org/asahi/20241127-asahi-spi-dt-v1-0-907c9447f623@jannau.net/
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. The extra gpio needed to be toggled turned out to be a quirk of the j293, normal CS is unusable on it, and a gpio has to be used instead. (j493 does not have this quirk) Signed-off-by: Sasha Finkelstein <fnkl.kernel@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 | 83 ++++ MAINTAINERS | 2 + arch/arm64/boot/dts/apple/t8103-j293.dts | 24 + arch/arm64/boot/dts/apple/t8103.dtsi | 19 + arch/arm64/boot/dts/apple/t8112-j493.dts | 20 + arch/arm64/boot/dts/apple/t8112.dtsi | 14 + drivers/input/touchscreen/Kconfig | 13 + drivers/input/touchscreen/Makefile | 1 + drivers/input/touchscreen/apple_z2.c | 495 +++++++++++++++++++++ 9 files changed, 671 insertions(+) --- base-commit: 9f16d5e6f220661f73b36a4be1b21575651d8833 change-id: 20241124-z2-c012b528ea0d