Re: [v2 PATCH] RISC-V: Add a PE/COFF compliant Image header.
On Wed, May 01, 2019 at 12:56:07PM -0700, Atish Patra wrote: > Currently, last stage boot loaders such as U-Boot can accept only > uImage which is an unnecessary additional step in automating boot flows. > > Add a PE/COFF compliant image header that boot loaders can parse and > directly load kernel flat Image. The existing booting methods will continue > to work as it is. > > Another goal of this header is to support EFI stub for RISC-V in future. > EFI specification needs PE/COFF image header in the beginning of the kernel > image in order to load it as an EFI application. In order to support > EFI stub, code0 should be replaced with "MZ" magic string and res5(at > offset 0x3c) should point to the rest of the PE/COFF header (which will > be added during EFI support). > > Tested on both QEMU and HiFive Unleashed using OpenSBI + U-Boot + Linux. Hello Palmer, it would be great if this patch could go in with the 5.2 merge window. Is there anything particular blocking its acceptance? Regards, Karsten -- Ich widerspreche hiermit ausdrücklich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung.
Re: [U-Boot] [v4 PATCH] RISCV: image: Add booti support
On Mon, May 06, 2019 at 10:06:39PM +0200, Heinrich Schuchardt wrote: > On 5/6/19 8:11 PM, Atish Patra wrote: > > This patch adds booti support for RISC-V Linux kernel. The existing > > bootm method will also continue to work as it is. [...] > > + "boot arm64/riscv Linux Image image from memory", booti_help_text > > %s/Image image/image/ > > "arm64/riscv" is distracting. If I am on RISC-V I cannot boot an ARM64 > image here. Remove the reference to the architecture, please. Hello, I'm not sure about the last point - ISTR (please correct me if my memory betrays me here) that an arm64 U-Boot can in principle be used to boot either an arm64 or an armv7 kernel, but the commands are different in those cases (booti for an arm64 "Image" format kernel and bootz for an armv7 "zImage" format kernel), so having the information which kernel format is supported by the respective commands appears useful to me. If the arm64 kernel image format would have a distinctive name (like "zImage" on armv7 or "bzImage" on x86) that would be less problematic, but with the confusion potential of "boot a Linux Image" (as in the arm64/riscv-specific "Image" format) vs "boot a Linux image" (as in generally some form of kernel image), I think explicitly mentioning the supported architectures makes sense. Regards, Karsten -- Ich widerspreche hiermit ausdrücklich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung.
Re: [PATCH] RISC-V: Add an Image header that boot loader can parse.
On Mon, Apr 29, 2019 at 10:42:40PM -0700, Atish Patra wrote: > On 4/29/19 4:40 PM, Palmer Dabbelt wrote: > > On Tue, 23 Apr 2019 16:25:06 PDT (-0700), atish.pa...@wdc.com wrote: > > > Currently, last stage boot loaders such as U-Boot can accept only > > > uImage which is an unnecessary additional step in automating boot flows. > > > > > > Add a simple image header that boot loaders can parse and directly > > > load kernel flat Image. The existing booting methods will continue to > > > work as it is. > > > > > > Tested on both QEMU and HiFive Unleashed using OpenSBI + U-Boot + Linux. > > > > > > Signed-off-by: Atish Patra > > > --- > > > arch/riscv/include/asm/image.h | 32 > > > arch/riscv/kernel/head.S | 28 > > > 2 files changed, 60 insertions(+) > > > create mode 100644 arch/riscv/include/asm/image.h > > > > > > diff --git a/arch/riscv/include/asm/image.h > > > b/arch/riscv/include/asm/image.h > > > new file mode 100644 > > > index ..76a7e0d4068a > > > --- /dev/null > > > +++ b/arch/riscv/include/asm/image.h > > > @@ -0,0 +1,32 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 */ > > > + > > > +#ifndef __ASM_IMAGE_H > > > +#define __ASM_IMAGE_H > > > + > > > +#define RISCV_IMAGE_MAGIC"RISCV" > > > + > > > +#ifndef __ASSEMBLY__ > > > +/* > > > + * struct riscv_image_header - riscv kernel image header > > > + * > > > + * @code0: Executable code > > > + * @code1: Executable code > > > + * @text_offset: Image load offset > > > + * @image_size: Effective Image size > > > + * @reserved:reserved > > > + * @magic: Magic number > > > + * @reserved:reserved > > > + */ > > > + > > > +struct riscv_image_header { > > > + u32 code0; > > > + u32 code1; > > > + u64 text_offset; > > > + u64 image_size; > > > + u64 res1; > > > + u64 magic; > > > + u32 res2; > > > + u32 res3; > > > +}; > > > > I don't want to invent our own file format. Is there a reason we can't just > > use something standard? Off the top of my head I can think of ELF files and > > multiboot. > > Additional header is required to accommodate PE header format. Currently, > this is only used for booti command but it will be reused for EFI headers as > well. Linux kernel Image can pretend as an EFI application if PE/COFF header > is present. This removes the need of an explicit EFI boot loader and EFI > firmware can directly load Linux (obviously after EFI stub implementation > for RISC-V). > > ARM64 follows the similar header format as well. > https://www.kernel.org/doc/Documentation/arm64/booting.txt Hello Atish, the arm64 header looks a bit different (quoted from the aforementioned URL): u32 code0;/* Executable code */ u32 code1;/* Executable code */ u64 text_offset; /* Image load offset, little endian */ u64 image_size; /* Effective Image size, little endian */ u64 flags;/* kernel flags, little endian */ u64 res2 = 0;/* reserved */ u64 res3 = 0;/* reserved */ u64 res4 = 0;/* reserved */ u32 magic = 0x644d5241; /* Magic number, little endian, "ARM\x64" */ u32 res5; /* reserved (used for PE COFF offset) */ What I am unclear about is in which ways a RISC-V PE/COFF header differs from an arm64 one as the arm64 struct is longer than your RISC-V header and for arm64 the PE offset field is in the last field, i.e. outside of the area covered by your RISC-V structure definition. Can you perhaps explain this part in a bit more detail or does anybody else have a pointer to a specification of the RISC-V PE/COFF header format (I have found a lot of documents about COFF in general, but nothing specific to RISC-V). Regards, Karsten -- Ich widerspreche hiermit ausdrücklich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung.
Re: [GIT PULL] RISC-V Updates for the 4.19 Merge Window
On Sat, Aug 18, 2018 at 06:37:59AM -0700, Guenter Roeck wrote: > On Fri, Aug 17, 2018 at 01:28:11PM -0700, Palmer Dabbelt wrote: > [ ... ] > > > > This tag boots a Fedora root filesystem on QEMU's master branch for me, > > and before this morning's rebase (from 4.18-rc8 to 4.18) it booted on > > the HiFive Unleashed. > > Do you have vmlinux embedded in bbl ? > > With separate bbl and vmlinux, and the following qemu command line > (with qemu 3.0) > > qemu-system-riscv64 -M virt -m 512M -no-reboot \ > -bios bbl -kernel vmlinux \ > -netdev user,id=net0 -device virtio-net-device,netdev=net0 \ > -device virtio-blk-device,drive=d0 \ > -drive file=rootfs.ext2,if=none,id=d0,format=raw \ > -append 'root=/dev/vda rw console=ttyS0,115200' \ > -nographic -monitor none > > all I get is > > rom: requested regions overlap (rom mrom.reset. free=0x0001cbe8, > addr=0x1000) > > However, the she system boots fine with the same qemu command line if I use > qemu > built from https://github.com/riscv/riscv-qemu.git, branch qemu-for-upstream. Hello, AFAICS the qemu patch that adds support for handling separate bbl and kernel images, i.e. https://github.com/riscv/riscv-qemu/commit/6338416ecf4717197c635b5abf9c17465d2d0da0 hasn't yet made it into upstream qemu, so using the "-bios" option for bbl generally doesn't work with (upstream) qemu 3.0. Regards, Karsten -- Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung.
Re: [GIT PULL] RISC-V Updates for the 4.19 Merge Window
On Sat, Aug 18, 2018 at 06:37:59AM -0700, Guenter Roeck wrote: > On Fri, Aug 17, 2018 at 01:28:11PM -0700, Palmer Dabbelt wrote: > [ ... ] > > > > This tag boots a Fedora root filesystem on QEMU's master branch for me, > > and before this morning's rebase (from 4.18-rc8 to 4.18) it booted on > > the HiFive Unleashed. > > Do you have vmlinux embedded in bbl ? > > With separate bbl and vmlinux, and the following qemu command line > (with qemu 3.0) > > qemu-system-riscv64 -M virt -m 512M -no-reboot \ > -bios bbl -kernel vmlinux \ > -netdev user,id=net0 -device virtio-net-device,netdev=net0 \ > -device virtio-blk-device,drive=d0 \ > -drive file=rootfs.ext2,if=none,id=d0,format=raw \ > -append 'root=/dev/vda rw console=ttyS0,115200' \ > -nographic -monitor none > > all I get is > > rom: requested regions overlap (rom mrom.reset. free=0x0001cbe8, > addr=0x1000) > > However, the she system boots fine with the same qemu command line if I use > qemu > built from https://github.com/riscv/riscv-qemu.git, branch qemu-for-upstream. Hello, AFAICS the qemu patch that adds support for handling separate bbl and kernel images, i.e. https://github.com/riscv/riscv-qemu/commit/6338416ecf4717197c635b5abf9c17465d2d0da0 hasn't yet made it into upstream qemu, so using the "-bios" option for bbl generally doesn't work with (upstream) qemu 3.0. Regards, Karsten -- Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der Werbung sowie der Markt- oder Meinungsforschung.
[PATCH 2/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket)
The Olimex A20-SOM-EVB is an evaluation board for the Olimex A20-SOM system-on-module. The baseboard provides a full-size SD socket (connected to mmc3) in addition to the micro-SD socket on the SOM itself (which is connected to mmc0). Enable the mmc3 controller in the dts. Signed-off-by: Karsten Merker --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index 6562a6bc..6a3d95d 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -176,6 +176,16 @@ status = "okay"; }; + { + pinctrl-names = "default"; + pinctrl-0 = <_pins_a>, <_cd_pin_olimex_som_evb>; + vmmc-supply = <_vcc3v3>; + bus-width = <4>; + cd-gpios = < 7 0 GPIO_ACTIVE_HIGH>; /* PH0 */ + cd-inverted; + status = "okay"; +}; + { status = "okay"; }; @@ -198,6 +208,13 @@ allwinner,drive = ; allwinner,pull = ; }; + + mmc3_cd_pin_olimex_som_evb: mmc3_cd_pin@0 { + allwinner,pins = "PH0"; + allwinner,function = "gpio_in"; + allwinner,drive = ; + allwinner,pull = ; + }; }; _ahci_5v { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: LRADC-keys, MMC3 and typo fix in the sunxi LRADC binding
Hello, the Olimex A20-SOM-EVB is an evaluation board for the Olimex A20-SOM system-on-module. This patchset adds/enables some more hardware features in the board dts: - Patch 1 adds support for the LRADC-keys on the baseboard. - Patch 2 enables the MMC3 controller to allow use of the full-size SD card socket on the baseboard. While adding the LRADC-keys support, I have stumbled over a typo in the bindings documentation. Patch 3 fixes that. Regards, Karsten Karsten Merker (3): ARM: dts: sun7i: Olimex A20-SOM-EVB: Add LRADC keys ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket) ARM: dts: sunxi: allwinner,sun4i-a10-lradc-keys binding: typo fix .../devicetree/bindings/input/sun4i-lradc-keys.txt | 2 +- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 73 ++ 2 files changed, 74 insertions(+), 1 deletion(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: Add LRADC keys
The Olimex A20-SOM-EVB is an evaluation board for the Olimex A20-SOM system-on-module. It provides a set of android-style buttons (labeled "VOL+", "VOL-", "MENU", "SEARCH", "HOME", "ESC" and "ENTER") which are connected to a low-resolution ADC via a resistor network. This patch adds appropriate button definitions to the board dts. The voltages assigned to the keys are specified in the board schematics published by the manufacturer. Signed-off-by: Karsten Merker --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 56 ++ 1 file changed, 56 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index b7fe102..6562a6bc 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -1,5 +1,6 @@ /* * Copyright 2015 - Marcus Cooper + * Copyright 2015 - Karsten Merker * * This file is dual-licensed: you can use it either under the terms * of the GPL or the X11 license, at your option. Note that this dual @@ -45,6 +46,7 @@ #include "sunxi-common-regulators.dtsi" #include +#include #include #include @@ -110,6 +112,60 @@ }; }; + { + vref-supply = <_vcc3v0>; + status = "okay"; + + button@190 { + label = "Volume Up"; + linux,code = ; + channel = <0>; + voltage = <19>; + }; + + button@390 { + label = "Volume Down"; + linux,code = ; + channel = <0>; + voltage = <39>; + }; + + button@600 { + label = "Menu"; + linux,code = ; + channel = <0>; + voltage = <60>; + }; + + button@800 { + label = "Search"; + linux,code = ; + channel = <0>; + voltage = <80>; + }; + + button@980 { + label = "Home"; + linux,code = ; + channel = <0>; + voltage = <98>; + }; + + button@1180 { + label = "Esc"; + linux,code = ; + channel = <0>; + voltage = <118>; + }; + + button@1400 { + label = "Enter"; + linux,code = ; + channel = <0>; + voltage = <140>; + }; +}; + { pinctrl-names = "default"; pinctrl-0 = <_pins_a>, <_cd_pin_reference_design>; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] ARM: dts: sunxi: allwinner,sun4i-a10-lradc-keys binding: typo fix
Trivial typo fix ("mut" -> "must") in the sunxi LRADC-keys binding documentation. Signed-off-by: Karsten Merker --- Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt index b9c32f6..4357e49 100644 --- a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt +++ b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt @@ -12,7 +12,7 @@ Each key is represented as a sub-node of "allwinner,sun4i-a10-lradc-keys": Required subnode-properties: - label: Descriptive name of the key. - linux,code: Keycode to emit. - - channel: Channel this key is attached to, mut be 0 or 1. + - channel: Channel this key is attached to, must be 0 or 1. - voltage: Voltage in µV at lradc input when this key is pressed. Example: -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] ARM: dts: sunxi: allwinner,sun4i-a10-lradc-keys binding: typo fix
Trivial typo fix ("mut" -> "must") in the sunxi LRADC-keys binding documentation. Signed-off-by: Karsten Merker <mer...@debian.org> --- Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt index b9c32f6..4357e49 100644 --- a/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt +++ b/Documentation/devicetree/bindings/input/sun4i-lradc-keys.txt @@ -12,7 +12,7 @@ Each key is represented as a sub-node of "allwinner,sun4i-a10-lradc-keys": Required subnode-properties: - label: Descriptive name of the key. - linux,code: Keycode to emit. - - channel: Channel this key is attached to, mut be 0 or 1. + - channel: Channel this key is attached to, must be 0 or 1. - voltage: Voltage in µV at lradc input when this key is pressed. Example: -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: LRADC-keys, MMC3 and typo fix in the sunxi LRADC binding
Hello, the Olimex A20-SOM-EVB is an evaluation board for the Olimex A20-SOM system-on-module. This patchset adds/enables some more hardware features in the board dts: - Patch 1 adds support for the LRADC-keys on the baseboard. - Patch 2 enables the MMC3 controller to allow use of the full-size SD card socket on the baseboard. While adding the LRADC-keys support, I have stumbled over a typo in the bindings documentation. Patch 3 fixes that. Regards, Karsten Karsten Merker (3): ARM: dts: sun7i: Olimex A20-SOM-EVB: Add LRADC keys ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket) ARM: dts: sunxi: allwinner,sun4i-a10-lradc-keys binding: typo fix .../devicetree/bindings/input/sun4i-lradc-keys.txt | 2 +- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 73 ++ 2 files changed, 74 insertions(+), 1 deletion(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: Enable mmc3 (baseboard SD socket)
The Olimex A20-SOM-EVB is an evaluation board for the Olimex A20-SOM system-on-module. The baseboard provides a full-size SD socket (connected to mmc3) in addition to the micro-SD socket on the SOM itself (which is connected to mmc0). Enable the mmc3 controller in the dts. Signed-off-by: Karsten Merker <mer...@debian.org> --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 17 + 1 file changed, 17 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index 6562a6bc..6a3d95d 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -176,6 +176,16 @@ status = "okay"; }; + { + pinctrl-names = "default"; + pinctrl-0 = <_pins_a>, <_cd_pin_olimex_som_evb>; + vmmc-supply = <_vcc3v3>; + bus-width = <4>; + cd-gpios = < 7 0 GPIO_ACTIVE_HIGH>; /* PH0 */ + cd-inverted; + status = "okay"; +}; + { status = "okay"; }; @@ -198,6 +208,13 @@ allwinner,drive = ; allwinner,pull = ; }; + + mmc3_cd_pin_olimex_som_evb: mmc3_cd_pin@0 { + allwinner,pins = "PH0"; + allwinner,function = "gpio_in"; + allwinner,drive = ; + allwinner,pull = ; + }; }; _ahci_5v { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] ARM: dts: sun7i: Olimex A20-SOM-EVB: Add LRADC keys
The Olimex A20-SOM-EVB is an evaluation board for the Olimex A20-SOM system-on-module. It provides a set of android-style buttons (labeled "VOL+", "VOL-", "MENU", "SEARCH", "HOME", "ESC" and "ENTER") which are connected to a low-resolution ADC via a resistor network. This patch adds appropriate button definitions to the board dts. The voltages assigned to the keys are specified in the board schematics published by the manufacturer. Signed-off-by: Karsten Merker <mer...@debian.org> --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 56 ++ 1 file changed, 56 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index b7fe102..6562a6bc 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -1,5 +1,6 @@ /* * Copyright 2015 - Marcus Cooper <codekip...@gmail.com> + * Copyright 2015 - Karsten Merker <mer...@debian.org> * * This file is dual-licensed: you can use it either under the terms * of the GPL or the X11 license, at your option. Note that this dual @@ -45,6 +46,7 @@ #include "sunxi-common-regulators.dtsi" #include +#include #include #include @@ -110,6 +112,60 @@ }; }; + { + vref-supply = <_vcc3v0>; + status = "okay"; + + button@190 { + label = "Volume Up"; + linux,code = ; + channel = <0>; + voltage = <19>; + }; + + button@390 { + label = "Volume Down"; + linux,code = ; + channel = <0>; + voltage = <39>; + }; + + button@600 { + label = "Menu"; + linux,code = ; + channel = <0>; + voltage = <60>; + }; + + button@800 { + label = "Search"; + linux,code = ; + channel = <0>; + voltage = <80>; + }; + + button@980 { + label = "Home"; + linux,code = ; + channel = <0>; + voltage = <98>; + }; + + button@1180 { + label = "Esc"; + linux,code = ; + channel = <0>; + voltage = <118>; + }; + + button@1400 { + label = "Enter"; + linux,code = ; + channel = <0>; + voltage = <140>; + }; +}; + { pinctrl-names = "default"; pinctrl-0 = <_pins_a>, <_cd_pin_reference_design>; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 2/3] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary anymore. This patch replaces it by setting the inverted_x and inverted_y flags instead. Signed-off-by: Karsten Merker Reviewed-by: Irina Tirdea Tested-by: Bastien Nocera Acked-by: Bastien Nocera --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 6985d72..2d888ea 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -39,7 +39,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -267,11 +266,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -708,10 +702,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 1/3] Input: goodix - add axis swapping and axis inversion support
Implement support for the following device-tree and ACPI 5.1 DSD properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker Tested-by: Bastien Nocera Tested-by: Irina Tirdea (with ACPI DSD properties) Tested-by: Aleksei Mamlin (with device-tree properties) --- drivers/input/touchscreen/goodix.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index a793b8c..6985d72 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -53,6 +54,9 @@ struct goodix_ts_data { atomic_t open_count; /* Protects power management calls and access to suspended flag */ struct mutex mutex; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_GPIO_INT_NAME "irq" @@ -268,6 +272,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -673,6 +685,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -680,6 +694,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -687,6 +703,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -812,6 +830,13 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) { int error; + ts->swapped_x_y = device_property_read_bool(>client->dev, + "touchscreen-swapped-x-y"); + ts->inverted_x = device_property_read_bool(>client->dev, + "touchscreen-inverted-x"); + ts->inverted_y = device_property_read_bool(>client->dev, + "touchscreen-inverted-y"); + goodix_read_config(ts); error = goodix_request_input_dev(ts); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 0/3] Input: goodix - add axis swapping and axis inversion support
Hello, this is v4 of my "Input: goodix - add axis swapping and axis inversion support" patchset. The goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v11 0/8] Goodix touchscreen enhancements" series by Irina Tirdea: https://www.spinics.net/lists/linux-input/msg42146.html The axis swapping has successfully been tested on an MSI Primo 81 tablet and on a Wexler TAB7200 tablet; the x/y inversion resp. the rotated_screen functionality has successfully been tested on a WinBook TW100. Regards, Karsten Changelog: v1: * Initial version (based von v6 of Irina Tirdea's "Goodix touchscreen enhancements" series). Reviewed-by: Bastien Nocera v2: * Rebase against v8 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Fix a typo in the commit message. * Add an update for the goodix dt bindings documentation (patch No. 3). * Reviews/Tests: Patch 1+2: Tested-by: Bastien Nocera Acked-by: Bastien Nocera Patch 2+3: Reviewed-by: Irina Tirdea v3: * Rebase against v9 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Address the review comments for patch No. 1 by Irina Tirdea (https://www.spinics.net/lists/linux-input/msg41536.html): - Move reading the dt properties from goodix_ts_probe to goodix_configure_dev to make them work properly in all configurations (with and without gpio declarations). - Use the new unified device properties API (device_property_*) instead of the classic DT API (of_property_*). This provides support for ACPI 5.1 DSD properties as well as for device-tree properties. * Reviews/Tests: Tested-by: Irina Tirdea (with ACPI DSD properties) Tested-by: Aleksei Mamlin (with device-tree properties) v4: * Rebase against v11 of Irina Tirdea's "Goodix touchscreen enhancements" series (no functional changes). Karsten Merker (3): Input: goodix - add axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Input: goodix - update dt bindings documentation (axis swapping/inversion) .../bindings/input/touchscreen/goodix.txt | 5 drivers/input/touchscreen/goodix.c | 31 ++ 2 files changed, 31 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 3/3] Input: goodix - update dt bindings documentation (axis swapping/inversion)
The goodix touchscreen driver has gained support for the optional touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y properties as described in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt. Document these properties in the goodix bindings description. Signed-off-by: Karsten Merker Reviewed-by: Irina Tirdea --- Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt index a8492e3..ef5f42d 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt @@ -23,6 +23,11 @@ Optional properties: device. ESD is disabled if this property is not set or is set to 0. + - touchscreen-inverted-x : X axis is inverted (boolean) + - touchscreen-inverted-y : Y axis is inverted (boolean) + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) + (swapping is done after inverting the axis) + Example: i2c@ { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 3/3] Input: goodix - update dt bindings documentation (axis swapping/inversion)
The goodix touchscreen driver has gained support for the optional touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y properties as described in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt. Document these properties in the goodix bindings description. Signed-off-by: Karsten Merker <mer...@debian.org> Reviewed-by: Irina Tirdea <irina.tir...@intel.com> --- Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt index a8492e3..ef5f42d 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt @@ -23,6 +23,11 @@ Optional properties: device. ESD is disabled if this property is not set or is set to 0. + - touchscreen-inverted-x : X axis is inverted (boolean) + - touchscreen-inverted-y : Y axis is inverted (boolean) + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) + (swapping is done after inverting the axis) + Example: i2c@ { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 1/3] Input: goodix - add axis swapping and axis inversion support
Implement support for the following device-tree and ACPI 5.1 DSD properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker <mer...@debian.org> Tested-by: Bastien Nocera <had...@hadess.net> Tested-by: Irina Tirdea <irina.tir...@intel.com> (with ACPI DSD properties) Tested-by: Aleksei Mamlin <mamli...@gmail.com> (with device-tree properties) --- drivers/input/touchscreen/goodix.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index a793b8c..6985d72 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker <mer...@debian.org> * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -53,6 +54,9 @@ struct goodix_ts_data { atomic_t open_count; /* Protects power management calls and access to suspended flag */ struct mutex mutex; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_GPIO_INT_NAME "irq" @@ -268,6 +272,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -673,6 +685,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -680,6 +694,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -687,6 +703,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -812,6 +830,13 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) { int error; + ts->swapped_x_y = device_property_read_bool(>client->dev, + "touchscreen-swapped-x-y"); + ts->inverted_x = device_property_read_bool(>client->dev, + "touchscreen-inverted-x"); + ts->inverted_y = device_property_read_bool(>client->dev, + "touchscreen-inverted-y"); + goodix_read_config(ts); error = goodix_request_input_dev(ts); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 0/3] Input: goodix - add axis swapping and axis inversion support
Hello, this is v4 of my "Input: goodix - add axis swapping and axis inversion support" patchset. The goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v11 0/8] Goodix touchscreen enhancements" series by Irina Tirdea: https://www.spinics.net/lists/linux-input/msg42146.html The axis swapping has successfully been tested on an MSI Primo 81 tablet and on a Wexler TAB7200 tablet; the x/y inversion resp. the rotated_screen functionality has successfully been tested on a WinBook TW100. Regards, Karsten Changelog: v1: * Initial version (based von v6 of Irina Tirdea's "Goodix touchscreen enhancements" series). Reviewed-by: Bastien Nocera <had...@hadess.net> v2: * Rebase against v8 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Fix a typo in the commit message. * Add an update for the goodix dt bindings documentation (patch No. 3). * Reviews/Tests: Patch 1+2: Tested-by: Bastien Nocera <had...@hadess.net> Acked-by: Bastien Nocera <had...@hadess.net> Patch 2+3: Reviewed-by: Irina Tirdea <irina.tir...@intel.com> v3: * Rebase against v9 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Address the review comments for patch No. 1 by Irina Tirdea (https://www.spinics.net/lists/linux-input/msg41536.html): - Move reading the dt properties from goodix_ts_probe to goodix_configure_dev to make them work properly in all configurations (with and without gpio declarations). - Use the new unified device properties API (device_property_*) instead of the classic DT API (of_property_*). This provides support for ACPI 5.1 DSD properties as well as for device-tree properties. * Reviews/Tests: Tested-by: Irina Tirdea <irina.tir...@intel.com> (with ACPI DSD properties) Tested-by: Aleksei Mamlin <mamli...@gmail.com> (with device-tree properties) v4: * Rebase against v11 of Irina Tirdea's "Goodix touchscreen enhancements" series (no functional changes). Karsten Merker (3): Input: goodix - add axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Input: goodix - update dt bindings documentation (axis swapping/inversion) .../bindings/input/touchscreen/goodix.txt | 5 drivers/input/touchscreen/goodix.c | 31 ++ 2 files changed, 31 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4 2/3] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary anymore. This patch replaces it by setting the inverted_x and inverted_y flags instead. Signed-off-by: Karsten Merker <mer...@debian.org> Reviewed-by: Irina Tirdea <irina.tir...@intel.com> Tested-by: Bastien Nocera <had...@hadess.net> Acked-by: Bastien Nocera <had...@hadess.net> --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 6985d72..2d888ea 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -39,7 +39,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -267,11 +266,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -708,10 +702,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: dts: sunxi: sun6i-a31s-primo81.dts: add touchscreen axis swapping property
The MSI Primo81 has a display in portrait mode but a touchscreen in landscape mode. To have both of them use the same coordinate system, the touchscreen-swapped-x-y property has to be set for the touchscreen. Signed-off-by: Karsten Merker --- arch/arm/boot/dts/sun6i-a31s-primo81.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts index 2d4250b..68b479b 100644 --- a/arch/arm/boot/dts/sun6i-a31s-primo81.dts +++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts @@ -83,6 +83,7 @@ reg = <0x5d>; interrupt-parent = <>; interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; /* PA3 */ + touchscreen-swapped-x-y; }; }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ARM: dts: sunxi: sun6i-a31s-primo81.dts: add touchscreen axis swapping property
The MSI Primo81 has a display in portrait mode but a touchscreen in landscape mode. To have both of them use the same coordinate system, the touchscreen-swapped-x-y property has to be set for the touchscreen. Signed-off-by: Karsten Merker <mer...@debian.org> --- arch/arm/boot/dts/sun6i-a31s-primo81.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/sun6i-a31s-primo81.dts b/arch/arm/boot/dts/sun6i-a31s-primo81.dts index 2d4250b..68b479b 100644 --- a/arch/arm/boot/dts/sun6i-a31s-primo81.dts +++ b/arch/arm/boot/dts/sun6i-a31s-primo81.dts @@ -83,6 +83,7 @@ reg = <0x5d>; interrupt-parent = <>; interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>; /* PA3 */ + touchscreen-swapped-x-y; }; }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 2/3] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary anymore. This patch replaces it by setting the inverted_x and inverted_y flags instead. Signed-off-by: Karsten Merker Reviewed-by: Irina Tirdea Tested-by: Bastien Nocera Acked-by: Bastien Nocera --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index b585123..22eff28 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -40,7 +40,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -270,11 +269,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -701,10 +695,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 3/3] Input: goodix - update dt bindings documentation (axis swapping/inversion)
The goodix touchscreen driver has gained support for the optional touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y properties as described in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt. Document these properties in the goodix bindings description. Signed-off-by: Karsten Merker Reviewed-by: Irina Tirdea --- Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt index 4db3393..4ecd0e1 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt @@ -14,6 +14,7 @@ Required properties: - interrupts : Interrupt to which the chip is connected - irq-gpio: GPIO pin used for IRQ - reset-gpio : GPIO pin used for reset + Optional properties: - esd-recovery-timeout-ms : ESD poll time (in milli seconds) for the driver to @@ -21,6 +22,11 @@ Optional properties: device. ESD is disabled if this property is not set or is set to 0. + - touchscreen-inverted-x : X axis is inverted (boolean) + - touchscreen-inverted-y : Y axis is inverted (boolean) + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) + (swapping is done after inverting the axis) + Example: i2c@ { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 1/3] Input: goodix - add axis swapping and axis inversion support
Implement support for the following device-tree and ACPI 5.1 DSD properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker Tested-by: Bastien Nocera --- drivers/input/touchscreen/goodix.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 22bfc4b..b585123 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -53,6 +54,9 @@ struct goodix_ts_data { atomic_t open_count; /* Protects power management calls and access to suspended flag */ struct mutex mutex; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_GPIO_INT_NAME "irq" @@ -271,6 +275,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -666,6 +678,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -673,6 +687,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -680,6 +696,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -805,6 +823,13 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) { int error; + ts->swapped_x_y = device_property_read_bool(>client->dev, + "touchscreen-swapped-x-y"); + ts->inverted_x = device_property_read_bool(>client->dev, + "touchscreen-inverted-x"); + ts->inverted_y = device_property_read_bool(>client->dev, + "touchscreen-inverted-y"); + goodix_read_config(ts); error = goodix_request_input_dev(ts); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 0/3] Input: goodix - add axis swapping and axis inversion support
Hello, this is v3 of my "Input: goodix - add axis swapping and axis inversion support" patchset. The goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v9 0/9] Goodix touchscreen enhancements" series by Irina Tirdea: https://www.spinics.net/lists/linux-input/msg41501.html The axis swapping has successfully been tested on an (arm-based) MSI Primo 81 tablet; the x/y inversion resp. the rotated_screen functionality has successfully been tested on a WinBook TW100. @Bastien: You had acked patch No. 1 in v2 of the patchset. I have not transferred that ack to v3 of the same patch because I have have introduced some changes into that patch (based on Irina's review comments, cf. the changelog below) after your ack. I would apprechiate very much if you could take a look and tell me whether your ack extends to v3 as well. Regards, Karsten Changelog: v1: * Initial version (based von v6 of Irina Tirdea's "Goodix touchscreen enhancements" series). Reviewed-by: Bastien Nocera v2: * Rebase against v8 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Fix a typo in the commit message. * Add an update for the goodix dt bindings documentation (patch No. 3). * Reviews/Tests: Patch 1+2: Tested-by: Bastien Nocera Acked-by: Bastien Nocera Patch 2+3: Reviewed-by: Irina Tirdea v3: * Rebase against v9 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Address the review comments for patch No. 1 by Irina Tirdea (https://www.spinics.net/lists/linux-input/msg41536.html): - Move reading the dt properties from goodix_ts_probe to goodix_configure_dev to make them work properly in all configurations (with and without gpio declarations). - Use the new unified device properties API (device_property_*) instead of the classic DT API (of_property_*). This provides support for ACPI 5.1 DSD properties as well as for device-tree properties. Karsten Merker (3): Input: goodix - add axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Input: goodix - update dt bindings documentation (axis swapping/inversion) .../bindings/input/touchscreen/goodix.txt | 6 + drivers/input/touchscreen/goodix.c | 31 ++ 2 files changed, 32 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 0/3] Input: goodix - add axis swapping and axis inversion support
Hello, this is v3 of my "Input: goodix - add axis swapping and axis inversion support" patchset. The goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v9 0/9] Goodix touchscreen enhancements" series by Irina Tirdea: https://www.spinics.net/lists/linux-input/msg41501.html The axis swapping has successfully been tested on an (arm-based) MSI Primo 81 tablet; the x/y inversion resp. the rotated_screen functionality has successfully been tested on a WinBook TW100. @Bastien: You had acked patch No. 1 in v2 of the patchset. I have not transferred that ack to v3 of the same patch because I have have introduced some changes into that patch (based on Irina's review comments, cf. the changelog below) after your ack. I would apprechiate very much if you could take a look and tell me whether your ack extends to v3 as well. Regards, Karsten Changelog: v1: * Initial version (based von v6 of Irina Tirdea's "Goodix touchscreen enhancements" series). Reviewed-by: Bastien Nocera <had...@hadess.net> v2: * Rebase against v8 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Fix a typo in the commit message. * Add an update for the goodix dt bindings documentation (patch No. 3). * Reviews/Tests: Patch 1+2: Tested-by: Bastien Nocera <had...@hadess.net> Acked-by: Bastien Nocera <had...@hadess.net> Patch 2+3: Reviewed-by: Irina Tirdea <irina.tir...@intel.com> v3: * Rebase against v9 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Address the review comments for patch No. 1 by Irina Tirdea (https://www.spinics.net/lists/linux-input/msg41536.html): - Move reading the dt properties from goodix_ts_probe to goodix_configure_dev to make them work properly in all configurations (with and without gpio declarations). - Use the new unified device properties API (device_property_*) instead of the classic DT API (of_property_*). This provides support for ACPI 5.1 DSD properties as well as for device-tree properties. Karsten Merker (3): Input: goodix - add axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Input: goodix - update dt bindings documentation (axis swapping/inversion) .../bindings/input/touchscreen/goodix.txt | 6 + drivers/input/touchscreen/goodix.c | 31 ++ 2 files changed, 32 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 1/3] Input: goodix - add axis swapping and axis inversion support
Implement support for the following device-tree and ACPI 5.1 DSD properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker <mer...@debian.org> Tested-by: Bastien Nocera <had...@hadess.net> --- drivers/input/touchscreen/goodix.c | 25 + 1 file changed, 25 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 22bfc4b..b585123 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker <mer...@debian.org> * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -53,6 +54,9 @@ struct goodix_ts_data { atomic_t open_count; /* Protects power management calls and access to suspended flag */ struct mutex mutex; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_GPIO_INT_NAME "irq" @@ -271,6 +275,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -666,6 +678,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -673,6 +687,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -680,6 +696,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -805,6 +823,13 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) { int error; + ts->swapped_x_y = device_property_read_bool(>client->dev, + "touchscreen-swapped-x-y"); + ts->inverted_x = device_property_read_bool(>client->dev, + "touchscreen-inverted-x"); + ts->inverted_y = device_property_read_bool(>client->dev, + "touchscreen-inverted-y"); + goodix_read_config(ts); error = goodix_request_input_dev(ts); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 2/3] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary anymore. This patch replaces it by setting the inverted_x and inverted_y flags instead. Signed-off-by: Karsten Merker <mer...@debian.org> Reviewed-by: Irina Tirdea <irina.tir...@intel.com> Tested-by: Bastien Nocera <had...@hadess.net> Acked-by: Bastien Nocera <had...@hadess.net> --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index b585123..22eff28 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -40,7 +40,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -270,11 +269,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -701,10 +695,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V3 3/3] Input: goodix - update dt bindings documentation (axis swapping/inversion)
The goodix touchscreen driver has gained support for the optional touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y properties as described in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt. Document these properties in the goodix bindings description. Signed-off-by: Karsten Merker <mer...@debian.org> Reviewed-by: Irina Tirdea <irina.tir...@intel.com> --- Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt index 4db3393..4ecd0e1 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt @@ -14,6 +14,7 @@ Required properties: - interrupts : Interrupt to which the chip is connected - irq-gpio: GPIO pin used for IRQ - reset-gpio : GPIO pin used for reset + Optional properties: - esd-recovery-timeout-ms : ESD poll time (in milli seconds) for the driver to @@ -21,6 +22,11 @@ Optional properties: device. ESD is disabled if this property is not set or is set to 0. + - touchscreen-inverted-x : X axis is inverted (boolean) + - touchscreen-inverted-y : Y axis is inverted (boolean) + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) + (swapping is done after inverting the axis) + Example: i2c@ { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 0/3] Input: goodix - add axis swapping and axis inversion support
Hello, this is v2 of my "Input: goodix - add axis swapping and axis inversion support" patchset. The goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v8 0/9] Goodix touchscreen enhancements" series by Irina Tirdea: https://www.spinics.net/lists/linux-input/msg41437.html I have successfully tested the axis swapping on an (arm-based) MSI Primo 81 tablet, but I lack appropriate hardware to do a real-world test of the "rotated_screen" code path, so I would appreciate very much if somebody with appropriate hardware (WinBook TW100 or TW700) could give it a try. Regards, Karsten Changelog: v1: * Initial version (based von v6 of Irina Tirdea's "Goodix touchscreen enhancements" series). Reviewed-by: Bastien Nocera v2: * Rebase against v8 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Fix a typo in the commit message. * Add an update for the goodix dt bindings documentation (patch No. 3). Karsten Merker (3): Input: goodix - add dt axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Input: goodix - update dt bindings documentation (axis swapping/inversion) .../bindings/input/touchscreen/goodix.txt | 6 drivers/input/touchscreen/goodix.c | 33 ++ 2 files changed, 34 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 1/3] Input: goodix - add dt axis swapping and axis inversion support
Implement support for the following device-tree properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker --- drivers/input/touchscreen/goodix.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 22bfc4b..a05bdad 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -53,6 +54,9 @@ struct goodix_ts_data { atomic_t open_count; /* Protects power management calls and access to suspended flag */ struct mutex mutex; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_GPIO_INT_NAME "irq" @@ -271,6 +275,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -666,6 +678,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -673,6 +687,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -680,6 +696,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -950,6 +968,15 @@ static int goodix_ts_probe(struct i2c_client *client, return 0; } +#ifdef CONFIG_OF + ts->swapped_x_y = of_property_read_bool(client->dev.of_node, + "touchscreen-swapped-x-y"); + ts->inverted_x = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-x"); + ts->inverted_y = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-y"); +#endif + return goodix_configure_dev(ts); err_free_cfg_name: -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 3/3] Input: goodix - update dt bindings documentation (axis swapping/inversion)
The goodix touchscreen driver has gained support for the optional touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y properties as described in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt. Document these properties in the goodix bindings description. Signed-off-by: Karsten Merker --- Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt index 4db3393..4ecd0e1 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt @@ -14,6 +14,7 @@ Required properties: - interrupts : Interrupt to which the chip is connected - irq-gpio: GPIO pin used for IRQ - reset-gpio : GPIO pin used for reset + Optional properties: - esd-recovery-timeout-ms : ESD poll time (in milli seconds) for the driver to @@ -21,6 +22,11 @@ Optional properties: device. ESD is disabled if this property is not set or is set to 0. + - touchscreen-inverted-x : X axis is inverted (boolean) + - touchscreen-inverted-y : Y axis is inverted (boolean) + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) + (swapping is done after inverting the axis) + Example: i2c@ { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 2/3] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary any more. This patch replaces it by setting the inverted_x and inverted_y flags instead. Signed-off-by: Karsten Merker --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index a05bdad..d910b27 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -40,7 +40,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -270,11 +269,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -701,10 +695,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 3/3] Input: goodix - update dt bindings documentation (axis swapping/inversion)
The goodix touchscreen driver has gained support for the optional touchscreen-inverted-x, touchscreen-inverted-y and touchscreen-swapped-x-y properties as described in Documentation/devicetree/bindings/input/touchscreen/touchscreen.txt. Document these properties in the goodix bindings description. Signed-off-by: Karsten Merker <mer...@debian.org> --- Documentation/devicetree/bindings/input/touchscreen/goodix.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt index 4db3393..4ecd0e1 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt @@ -14,6 +14,7 @@ Required properties: - interrupts : Interrupt to which the chip is connected - irq-gpio: GPIO pin used for IRQ - reset-gpio : GPIO pin used for reset + Optional properties: - esd-recovery-timeout-ms : ESD poll time (in milli seconds) for the driver to @@ -21,6 +22,11 @@ Optional properties: device. ESD is disabled if this property is not set or is set to 0. + - touchscreen-inverted-x : X axis is inverted (boolean) + - touchscreen-inverted-y : Y axis is inverted (boolean) + - touchscreen-swapped-x-y : X and Y axis are swapped (boolean) + (swapping is done after inverting the axis) + Example: i2c@ { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 2/3] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary any more. This patch replaces it by setting the inverted_x and inverted_y flags instead. Signed-off-by: Karsten Merker <mer...@debian.org> --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index a05bdad..d910b27 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -40,7 +40,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -270,11 +269,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -701,10 +695,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 0/3] Input: goodix - add axis swapping and axis inversion support
Hello, this is v2 of my "Input: goodix - add axis swapping and axis inversion support" patchset. The goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v8 0/9] Goodix touchscreen enhancements" series by Irina Tirdea: https://www.spinics.net/lists/linux-input/msg41437.html I have successfully tested the axis swapping on an (arm-based) MSI Primo 81 tablet, but I lack appropriate hardware to do a real-world test of the "rotated_screen" code path, so I would appreciate very much if somebody with appropriate hardware (WinBook TW100 or TW700) could give it a try. Regards, Karsten Changelog: v1: * Initial version (based von v6 of Irina Tirdea's "Goodix touchscreen enhancements" series). Reviewed-by: Bastien Nocera <had...@hadess.net> v2: * Rebase against v8 of Irina Tirdea's "Goodix touchscreen enhancements" series. * Fix a typo in the commit message. * Add an update for the goodix dt bindings documentation (patch No. 3). Karsten Merker (3): Input: goodix - add dt axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" Input: goodix - update dt bindings documentation (axis swapping/inversion) .../bindings/input/touchscreen/goodix.txt | 6 drivers/input/touchscreen/goodix.c | 33 ++ 2 files changed, 34 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC V2 1/3] Input: goodix - add dt axis swapping and axis inversion support
Implement support for the following device-tree properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker <mer...@debian.org> --- drivers/input/touchscreen/goodix.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 22bfc4b..a05bdad 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker <mer...@debian.org> * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -53,6 +54,9 @@ struct goodix_ts_data { atomic_t open_count; /* Protects power management calls and access to suspended flag */ struct mutex mutex; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_GPIO_INT_NAME "irq" @@ -271,6 +275,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -666,6 +678,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -673,6 +687,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -680,6 +696,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -950,6 +968,15 @@ static int goodix_ts_probe(struct i2c_client *client, return 0; } +#ifdef CONFIG_OF + ts->swapped_x_y = of_property_read_bool(client->dev.of_node, + "touchscreen-swapped-x-y"); + ts->inverted_x = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-x"); + ts->inverted_y = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-y"); +#endif + return goodix_configure_dev(ts); err_free_cfg_name: -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support
Hello, the goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v6 0/9] Goodix touchscreen enhancements" series by Irina Tirdea: http://www.spinics.net/lists/linux-input/msg40992.html I have successfully tested the axis swapping on an (arm-based) MSI Primo 81 tablet, but I lack appropriate hardware to do a real-world test of the "rotated_screen" code path, so I would apprechiate very much if somebody with appropriate hardware could give it a try. This is my first go at modifying an input driver; any kind of feedback and hints is welcome. Regards, Karsten Karsten Merker (2): Input: goodix - add dt axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" drivers/input/touchscreen/goodix.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] Input: goodix - add dt axis swapping and axis inversion support
Implement support for the following device-tree properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker --- drivers/input/touchscreen/goodix.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index f8e5b49..f2b1590 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -48,6 +49,9 @@ struct goodix_ts_data { unsigned long irq_flags; atomic_t esd_timeout; struct delayed_work esd_work; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_DEVICE_ESD_TIMEOUT_PROPERTY "esd-recovery-timeout-ms" @@ -262,6 +266,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -670,6 +682,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -677,6 +691,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -684,6 +700,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -913,6 +931,15 @@ static int goodix_ts_probe(struct i2c_client *client, ts->cfg_len = goodix_get_cfg_len(ts->id); +#ifdef CONFIG_OF + ts->swapped_x_y = of_property_read_bool(client->dev.of_node, + "touchscreen-swapped-x-y"); + ts->inverted_x = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-x"); + ts->inverted_y = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-y"); +#endif + goodix_read_config(ts); if (ts->gpiod_int && ts->gpiod_rst) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary any more. This patch replaces it by setting the inverted-x and inverted-x flags instead. Signed-off-by: Karsten Merker --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index f2b1590..6ce909c 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -39,7 +39,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -261,11 +260,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -705,10 +699,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen"
The goodix touchscreen driver uses a "rotated_screen" flag for systems on which the touchscreen is mounted rotated by 180 degrees with respect to the display. With the addition of support for the dt properties "touchscreen-inverted-x" and "touchscreen-inverted-y", a separate "rotated_screen" flag is not necessary any more. This patch replaces it by setting the inverted-x and inverted-x flags instead. Signed-off-by: Karsten Merker <mer...@debian.org> --- drivers/input/touchscreen/goodix.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index f2b1590..6ce909c 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -39,7 +39,6 @@ struct goodix_ts_data { int abs_y_max; unsigned int max_touch_num; unsigned int int_trigger_type; - bool rotated_screen; int cfg_len; struct gpio_desc *gpiod_int; struct gpio_desc *gpiod_rst; @@ -261,11 +260,6 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) int input_y = get_unaligned_le16(_data[3]); int input_w = get_unaligned_le16(_data[5]); - if (ts->rotated_screen) { - input_x = ts->abs_x_max - input_x; - input_y = ts->abs_y_max - input_y; - } - /* Inversions have to happen before axis swapping */ if (ts->inverted_x) input_x = ts->abs_x_max - input_x; @@ -705,10 +699,12 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->max_touch_num = GOODIX_MAX_CONTACTS; } - ts->rotated_screen = dmi_check_system(rotated_screen); - if (ts->rotated_screen) + if (dmi_check_system(rotated_screen)) { + ts->inverted_x = true; + ts->inverted_y = true; dev_dbg(>client->dev, "Applying '180 degrees rotated screen' quirk\n"); + } } /** -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] Input: goodix - add dt axis swapping and axis inversion support
Implement support for the following device-tree properties in the goodix touchscreen driver: - touchscreen-inverted-x: X axis is inverted (boolean) - touchscreen-inverted-y: Y axis is inverted (boolean) - touchscreen-swapped-x-y: X and Y axis are swapped (boolean) These are necessary on tablets which have a display in portrait format while the touchscreen is in landscape format, such as e.g. the MSI Primo 81. Signed-off-by: Karsten Merker <mer...@debian.org> --- drivers/input/touchscreen/goodix.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index f8e5b49..f2b1590 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -2,6 +2,7 @@ * Driver for Goodix Touchscreens * * Copyright (c) 2014 Red Hat Inc. + * Copyright (c) 2015 K. Merker <mer...@debian.org> * * This code is based on gt9xx.c authored by and...@goodix.com: * @@ -48,6 +49,9 @@ struct goodix_ts_data { unsigned long irq_flags; atomic_t esd_timeout; struct delayed_work esd_work; + bool swapped_x_y; + bool inverted_x; + bool inverted_y; }; #define GOODIX_DEVICE_ESD_TIMEOUT_PROPERTY "esd-recovery-timeout-ms" @@ -262,6 +266,14 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) input_y = ts->abs_y_max - input_y; } + /* Inversions have to happen before axis swapping */ + if (ts->inverted_x) + input_x = ts->abs_x_max - input_x; + if (ts->inverted_y) + input_y = ts->abs_y_max - input_y; + if (ts->swapped_x_y) + swap(input_x, input_y); + input_mt_slot(ts->input_dev, id); input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true); input_report_abs(ts->input_dev, ABS_MT_POSITION_X, input_x); @@ -670,6 +682,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) error); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = GOODIX_INT_TRIGGER; ts->max_touch_num = GOODIX_MAX_CONTACTS; return; @@ -677,6 +691,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) ts->abs_x_max = get_unaligned_le16([RESOLUTION_LOC]); ts->abs_y_max = get_unaligned_le16([RESOLUTION_LOC + 2]); + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->int_trigger_type = config[TRIGGER_LOC] & 0x03; ts->max_touch_num = config[MAX_CONTACTS_LOC] & 0x0f; if (!ts->abs_x_max || !ts->abs_y_max || !ts->max_touch_num) { @@ -684,6 +700,8 @@ static void goodix_read_config(struct goodix_ts_data *ts) "Invalid config, using defaults\n"); ts->abs_x_max = GOODIX_MAX_WIDTH; ts->abs_y_max = GOODIX_MAX_HEIGHT; + if (ts->swapped_x_y) + swap(ts->abs_x_max, ts->abs_y_max); ts->max_touch_num = GOODIX_MAX_CONTACTS; } @@ -913,6 +931,15 @@ static int goodix_ts_probe(struct i2c_client *client, ts->cfg_len = goodix_get_cfg_len(ts->id); +#ifdef CONFIG_OF + ts->swapped_x_y = of_property_read_bool(client->dev.of_node, + "touchscreen-swapped-x-y"); + ts->inverted_x = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-x"); + ts->inverted_y = of_property_read_bool(client->dev.of_node, + "touchscreen-inverted-y"); +#endif + goodix_read_config(ts); if (ts->gpiod_int && ts->gpiod_rst) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH RFC 0/2] Input: Goodix - add axis swapping and inversion support
Hello, the goodix touchscreen driver has gained device-tree support in kernel 4.1, but doesn't currently support the touchscreen-swapped-x-y, touchscreen-inverted-x and touchscreen-inverted-y properties. On systems which combine a portrait-mode display with a landscape-mode touchscreen, such as e.g. the MSI Primo 81 tablet, support for these features is necessary to have the touchscreen and the display use the same coordinate system. With support for axis inversion, the "rotated_screen" flag in the driver can also be removed, as "rotated_screen" is just a special case of x/y axis inversion. This patchset sits on top of the "[PATCH v6 0/9] Goodix touchscreen enhancements" series by Irina Tirdea: http://www.spinics.net/lists/linux-input/msg40992.html I have successfully tested the axis swapping on an (arm-based) MSI Primo 81 tablet, but I lack appropriate hardware to do a real-world test of the "rotated_screen" code path, so I would apprechiate very much if somebody with appropriate hardware could give it a try. This is my first go at modifying an input driver; any kind of feedback and hints is welcome. Regards, Karsten Karsten Merker (2): Input: goodix - add dt axis swapping and axis inversion support Input: goodix - use "inverted_[xy]" flags instead of "rotated_screen" drivers/input/touchscreen/goodix.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] kbuild: builddeb: Include dtbs in the Debian package built by "make deb-pkg"
Native Debian kernel packages include any dtbs that were generated during the kernel build process in /usr/lib/${packagename}. Do the same for Debian packages built by scripts/package/builddeb (executed by the "deb-pkg" target). Signed-off-by: Karsten Merker --- scripts/package/builddeb | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 88dbf23..944b560 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -143,6 +143,11 @@ else cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path" fi +# If dtbs have been built for this arch, include them in the package +if [ -d "arch/$ARCH/boot/dts" ]; then + find "arch/$ARCH/boot/dts" -iname '*.dtb' -exec sh -c "mkdir -p '$tmpdir/usr/lib/$packagename'; cp '{}' '$tmpdir/usr/lib/$packagename/'" \; +fi + if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install rm -f "$tmpdir/lib/modules/$version/build" -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
[PATCH] kbuild: builddeb: Include dtbs in the Debian package built by make deb-pkg
Native Debian kernel packages include any dtbs that were generated during the kernel build process in /usr/lib/${packagename}. Do the same for Debian packages built by scripts/package/builddeb (executed by the deb-pkg target). Signed-off-by: Karsten Merker mer...@debian.org --- scripts/package/builddeb | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 88dbf23..944b560 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -143,6 +143,11 @@ else cp arch/$ARCH/boot/$KBUILD_IMAGE $tmpdir/$installed_image_path fi +# If dtbs have been built for this arch, include them in the package +if [ -d arch/$ARCH/boot/dts ]; then + find arch/$ARCH/boot/dts -iname '*.dtb' -exec sh -c mkdir -p '$tmpdir/usr/lib/$packagename'; cp '{}' '$tmpdir/usr/lib/$packagename/' \; +fi + if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then INSTALL_MOD_PATH=$tmpdir $MAKE KBUILD_SRC= modules_install rm -f $tmpdir/lib/modules/$version/build -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in Please read the FAQ at http://www.tux.org/lkml/