Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1505219 > unrolled thread
| Started by | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| First post | 2016-10-20 22:10 +0200 |
| Last post | 2016-10-20 22:10 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/4] Input: goodix - Support dynamic reconfiguration Franklin S Cooper Jr <fcooper@ti.com> - 2016-10-20 22:10 +0200
[PATCH 3/4] Input: goodix - Tweak configuration to use passed in touchscreen resolution Franklin S Cooper Jr <fcooper@ti.com> - 2016-10-20 22:10 +0200
Re: [PATCH 3/4] Input: goodix - Tweak configuration to use passed in touchscreen resolution Rob Herring <robh@kernel.org> - 2016-10-27 01:20 +0200
[PATCH 4/4] Input: goodix - Support interchanging x and y coordinates in hardware Franklin S Cooper Jr <fcooper@ti.com> - 2016-10-20 22:10 +0200
Re: [PATCH 4/4] Input: goodix - Support interchanging x and y coordinates in hardware Rob Herring <robh@kernel.org> - 2016-10-27 01:20 +0200
[PATCH 2/4] Input: goodix - Allow tweaking of configuration file dynamically Franklin S Cooper Jr <fcooper@ti.com> - 2016-10-20 22:10 +0200
| From | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| Date | 2016-10-20 22:10 +0200 |
| Subject | [PATCH 0/4] Input: goodix - Support dynamic reconfiguration |
| Message-ID | <surP3-3PX-11@gated-at.bofh.it> |
Goodix touchscreen controller supports the ability to update its settings
at runtime. Currently, the driver supports this by loading a firmware
and reconfiguring the panel. However, this may lead to a large quantity
of firmwares being created and managed. This is a hassle since likely a
preexisting firmware or even the default configuration is good enough and
only a couple of changes need to be made.
This patchset adds the capability to dynamically alter the firmware
utilizing several new DT properties.
These new properties will allow a user to specify the touchscreen
resolution and also allow x and y coordinates to be interchanged. All of
this configuration changes are done dynamically by the driver and can work
using the default touchscreen controller configuration or even on top of
a firmware that was loaded.
Franklin S Cooper Jr (4):
Input: goodix - Restructure cfg checksum function
Input: goodix - Allow tweaking of configuration file dynamically
Input: goodix - Tweak configuration to use passed in touchscreen
resolution
Input: goodix - Support interchanging x and y coordinates in hardware
.../bindings/input/touchscreen/goodix.txt | 4 +
drivers/input/touchscreen/goodix.c | 109 +++++++++++++++++----
2 files changed, 96 insertions(+), 17 deletions(-)
--
2.10.0
[toc] | [next] | [standalone]
| From | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| Date | 2016-10-20 22:10 +0200 |
| Subject | [PATCH 3/4] Input: goodix - Tweak configuration to use passed in touchscreen resolution |
| Message-ID | <surP3-3PX-13@gated-at.bofh.it> |
| In reply to | #1505219 |
Some goodix touchscreen controllers aren't programed properly to match the
display panel it is used on. Although the defaults may largely work it is
also likely that the screen resolution will be incorrect. Therefore,
add support to allow via DT for the touchscreen resolution to be set and
reprogram the controller to use this updated resolution.
Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
.../bindings/input/touchscreen/goodix.txt | 2 ++
drivers/input/touchscreen/goodix.c | 26 +++++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index c98757a..ebc7cb7 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -19,6 +19,8 @@ Optional properties:
interrupt gpio pin as output to reset the device.
- reset-gpios : GPIO pin used for reset
+ - touchscreen-size-x : horizontal resolution of touchscreen (in pixels)
+ - touchscreen-size-y : vertical resolution of touchscreen (in pixels)
- 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)
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 01e12f8..c2428e1 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -496,6 +496,10 @@ static void goodix_tweak_config(struct goodix_ts_data *ts)
return;
}
+ /* Setting X and Y Resolution */
+ put_unaligned_le16(ts->abs_x_max, &config[RESOLUTION_LOC]);
+ put_unaligned_le16(ts->abs_y_max, &config[RESOLUTION_LOC + 2]);
+
check_sum = goodix_calculate_checksum(ts->cfg_len, config);
config[raw_cfg_len] = check_sum;
@@ -669,6 +673,8 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts)
static int goodix_configure_dev(struct goodix_ts_data *ts)
{
int error;
+ bool alter_config = false;
+ u32 max_x, max_y;
ts->swapped_x_y = device_property_read_bool(&ts->client->dev,
"touchscreen-swapped-x-y");
@@ -676,9 +682,27 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
"touchscreen-inverted-x");
ts->inverted_y = device_property_read_bool(&ts->client->dev,
"touchscreen-inverted-y");
-
goodix_read_config(ts);
+ if (device_property_present(&ts->client->dev, "touchscreen-size-x") &&
+ device_property_present(&ts->client->dev, "touchscreen-size-y")) {
+
+ device_property_read_u32(&ts->client->dev, "touchscreen-size-x",
+ &max_x);
+
+ device_property_read_u32(&ts->client->dev, "touchscreen-size-y",
+ &max_y);
+
+ if (max_x > 0 && max_y > 0) {
+ ts->abs_x_max = max_x;
+ ts->abs_y_max = max_y;
+ alter_config = true;
+ }
+ }
+
+ if (alter_config)
+ goodix_tweak_config(ts);
+
error = goodix_request_input_dev(ts);
if (error)
return error;
--
2.10.0
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-10-27 01:20 +0200 |
| Subject | Re: [PATCH 3/4] Input: goodix - Tweak configuration to use passed in touchscreen resolution |
| Message-ID | <swFEd-25s-1@gated-at.bofh.it> |
| In reply to | #1505220 |
On Thu, Oct 20, 2016 at 02:59:16PM -0500, Franklin S Cooper Jr wrote: > Some goodix touchscreen controllers aren't programed properly to match the > display panel it is used on. Although the defaults may largely work it is > also likely that the screen resolution will be incorrect. Therefore, > add support to allow via DT for the touchscreen resolution to be set and > reprogram the controller to use this updated resolution. > > Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com> > --- > .../bindings/input/touchscreen/goodix.txt | 2 ++ Acked-by: Rob Herring <robh@kernel.org> > drivers/input/touchscreen/goodix.c | 26 +++++++++++++++++++++- > 2 files changed, 27 insertions(+), 1 deletion(-)
[toc] | [prev] | [next] | [standalone]
| From | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| Date | 2016-10-20 22:10 +0200 |
| Subject | [PATCH 4/4] Input: goodix - Support interchanging x and y coordinates in hardware |
| Message-ID | <surP3-3PX-27@gated-at.bofh.it> |
| In reply to | #1505219 |
On systems with a fixed display/touchscreen orientation it is important to
pass in the "correct" x and y coordinates based on the orientation.
Currently, to support landscape and portrait touchscreen-swapped-x-y
simply does the following:
Assuming touchscreen is as follows:
X: 1280 Y:800 programmed in touchscreen controller and also interchange
bit cleared. Assuming ts mounted in portrait mode.
1280 (X)
------
| |
| | 800 (Y)
| |
| |
------
800 (Y)
------
| |
| | 1280 (X)
| |
| |
------
However, the above isn't really what we want especially in distros that
assumes a fixed orientation. In this case what we really want is to
interchange the x and y coordinates so the Y coordinate can return a max
value of 1280 and X can return a max value of 800.
800 (X)
------
| |
| | 1280 (Y)
| |
| |
------
Since the driver is limited to the value reported by the touchscreen
controller this issue can't be fixed purely in the driver. Therefore,
add a new DT property that supports interchanging X and Y coordinates
internally within the hardware.
Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
.../devicetree/bindings/input/touchscreen/goodix.txt | 2 ++
drivers/input/touchscreen/goodix.c | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
index ebc7cb7..b8be2ab 100644
--- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
+++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt
@@ -25,6 +25,8 @@ Optional properties:
- 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)
+ - touchscreen-inter-x-y : X and Y maximum values programmed in the device
+ are interchanged internally in hardware. (boolean)
Example:
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index c2428e1..3f93375 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -39,6 +39,7 @@ struct goodix_ts_data {
bool swapped_x_y;
bool inverted_x;
bool inverted_y;
+ bool interchange_x_y;
unsigned int max_touch_num;
unsigned int int_trigger_type;
int cfg_len;
@@ -76,6 +77,9 @@ struct goodix_ts_data {
#define MAX_CONTACTS_LOC 5
#define TRIGGER_LOC 6
+/* Register Bits */
+#define XY_COORD_INTER 3
+
static const unsigned long goodix_irq_flags[] = {
IRQ_TYPE_EDGE_RISING,
IRQ_TYPE_EDGE_FALLING,
@@ -500,6 +504,10 @@ static void goodix_tweak_config(struct goodix_ts_data *ts)
put_unaligned_le16(ts->abs_x_max, &config[RESOLUTION_LOC]);
put_unaligned_le16(ts->abs_y_max, &config[RESOLUTION_LOC + 2]);
+ if (ts->interchange_x_y)
+ config[TRIGGER_LOC] = config[TRIGGER_LOC] |
+ (1 << XY_COORD_INTER);
+
check_sum = goodix_calculate_checksum(ts->cfg_len, config);
config[raw_cfg_len] = check_sum;
@@ -700,6 +708,11 @@ static int goodix_configure_dev(struct goodix_ts_data *ts)
}
}
+ ts->interchange_x_y = device_property_read_bool(&ts->client->dev,
+ "touchscreen-inter-x-y");
+ if (ts->interchange_x_y)
+ alter_config = true;
+
if (alter_config)
goodix_tweak_config(ts);
--
2.10.0
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2016-10-27 01:20 +0200 |
| Subject | Re: [PATCH 4/4] Input: goodix - Support interchanging x and y coordinates in hardware |
| Message-ID | <swFEd-25s-5@gated-at.bofh.it> |
| In reply to | #1505221 |
On Thu, Oct 20, 2016 at 02:59:17PM -0500, Franklin S Cooper Jr wrote: > On systems with a fixed display/touchscreen orientation it is important to > pass in the "correct" x and y coordinates based on the orientation. > Currently, to support landscape and portrait touchscreen-swapped-x-y > simply does the following: > > Assuming touchscreen is as follows: > X: 1280 Y:800 programmed in touchscreen controller and also interchange > bit cleared. Assuming ts mounted in portrait mode. > > 1280 (X) > ------ > | | > | | 800 (Y) > | | > | | > ------ > > 800 (Y) > ------ > | | > | | 1280 (X) > | | > | | > ------ > > However, the above isn't really what we want especially in distros that > assumes a fixed orientation. In this case what we really want is to > interchange the x and y coordinates so the Y coordinate can return a max > value of 1280 and X can return a max value of 800. > > 800 (X) > ------ > | | > | | 1280 (Y) > | | > | | > ------ > > Since the driver is limited to the value reported by the touchscreen > controller this issue can't be fixed purely in the driver. Therefore, > add a new DT property that supports interchanging X and Y coordinates > internally within the hardware. I'm not sure I follow why existing properties don't cover this. > > Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com> > --- > .../devicetree/bindings/input/touchscreen/goodix.txt | 2 ++ > drivers/input/touchscreen/goodix.c | 13 +++++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt > index ebc7cb7..b8be2ab 100644 > --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.txt > +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.txt > @@ -25,6 +25,8 @@ Optional properties: > - 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) > + - touchscreen-inter-x-y : X and Y maximum values programmed in the device > + are interchanged internally in hardware. (boolean) Minimally this should be vendor specific and have a vendor prefix I think. Rob
[toc] | [prev] | [next] | [standalone]
| From | Franklin S Cooper Jr <fcooper@ti.com> |
|---|---|
| Date | 2016-10-20 22:10 +0200 |
| Subject | [PATCH 2/4] Input: goodix - Allow tweaking of configuration file dynamically |
| Message-ID | <surP3-3PX-19@gated-at.bofh.it> |
| In reply to | #1505219 |
Some goodix touchscreen controllers don't have the correct configuration
firmware for the display panel it is attached to. Therefore, settings such
as touchscreen x and y size may need to be passed in via DT and have the
panel reprogrammed for the updated touchscreen resolution.
This patchset adds support for reading the current configuration firmware
on the panel and allowing it to be modified and rewritten back to the
device.
Currently this function is unused but later patches will make use of it.
Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
---
drivers/input/touchscreen/goodix.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index a43c8ca..01e12f8 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -478,6 +478,34 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
return 0;
}
+static void goodix_tweak_config(struct goodix_ts_data *ts)
+{
+ u8 config[GOODIX_CONFIG_MAX_LENGTH];
+ int error;
+ int raw_cfg_len;
+ u8 check_sum = 0;
+
+ raw_cfg_len = ts->cfg_len - 2;
+
+ error = goodix_i2c_read(ts->client, GOODIX_REG_CONFIG_DATA,
+ config, ts->cfg_len);
+ if (error) {
+ dev_warn(&ts->client->dev,
+ "Error reading config (%d), avoid tweaking config\n",
+ error);
+ return;
+ }
+
+ check_sum = goodix_calculate_checksum(ts->cfg_len, config);
+
+ config[raw_cfg_len] = check_sum;
+ config[raw_cfg_len + 1] = 1;
+
+ error = goodix_send_cfg(ts, ts->cfg_len, config);
+ if (error)
+ dev_warn(&ts->client->dev,
+ "Error writing config (%d)\n", error);
+}
/**
* goodix_read_config - Read the embedded configuration of the panel
*
--
2.10.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web