* [PATCH v2 0/3] Add support for Imagis IST3038
@ 2022-11-18 18:21 Lin, Meng-Bo
2022-11-18 18:21 ` [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 Lin, Meng-Bo
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Lin, Meng-Bo @ 2022-11-18 18:21 UTC (permalink / raw)
To: linux-kernel
Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input,
devicetree, ~postmarketos/upstreaming
v2: Drop untested, wildcard ist30xxb
This series adds support for Imagis IST3038, which is a variants of
Imagis IST3038 IC. It has a different register map (labeled protocol b),
but otherwise it seems to be the same IC.
It is also possible to support various other Imagis ICs using protocol b,
such as (but not limited to) IST3044B, IST3026, IST3032, IST3026B,
IST3032B. However, most of them (all except IST3044B) use a different
coordinate format, so extra effort would be needed to support those.
Tested on Samsung Galaxy Core Prime and Grand Max.
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 2022-11-18 18:21 [PATCH v2 0/3] Add support for Imagis IST3038 Lin, Meng-Bo @ 2022-11-18 18:21 ` Lin, Meng-Bo 2022-11-20 10:53 ` Krzysztof Kozlowski 2022-11-30 15:35 ` Mattijs Korpershoek 2022-11-18 18:21 ` [PATCH v2 2/3] input/touchscreen: imagis: Correct the maximum touch area value Lin, Meng-Bo 2022-11-18 18:21 ` [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Lin, Meng-Bo 2 siblings, 2 replies; 9+ messages in thread From: Lin, Meng-Bo @ 2022-11-18 18:21 UTC (permalink / raw) To: linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming From: Markuss Broks <markuss.broks@gmail.com> Imagis IST3038 is a variant (firmware?) of Imagis IST3038 IC, add the compatible for it to the IST3038C bindings. Signed-off-by: Markuss Broks <markuss.broks@gmail.com> [Change from IST3038B to IST3038] Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> --- .../devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml b/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml index e3a2b871e50c..a58c045d2ba1 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml @@ -18,6 +18,7 @@ properties: compatible: enum: + - imagis,ist3038 - imagis,ist3038c reg: -- 2.30.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 2022-11-18 18:21 ` [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 Lin, Meng-Bo @ 2022-11-20 10:53 ` Krzysztof Kozlowski 2022-11-30 15:35 ` Mattijs Korpershoek 1 sibling, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2022-11-20 10:53 UTC (permalink / raw) To: Lin, Meng-Bo, linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming On 18/11/2022 19:21, Lin, Meng-Bo wrote: > From: Markuss Broks <markuss.broks@gmail.com> > > Imagis IST3038 is a variant (firmware?) of Imagis IST3038 IC, > add the compatible for it to the IST3038C bindings. > > Signed-off-by: Markuss Broks <markuss.broks@gmail.com> > [Change from IST3038B to IST3038] > Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> > --- Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 2022-11-18 18:21 ` [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 Lin, Meng-Bo 2022-11-20 10:53 ` Krzysztof Kozlowski @ 2022-11-30 15:35 ` Mattijs Korpershoek 1 sibling, 0 replies; 9+ messages in thread From: Mattijs Korpershoek @ 2022-11-30 15:35 UTC (permalink / raw) To: Lin, Meng-Bo, linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming On Fri, Nov 18, 2022 at 18:21, "Lin, Meng-Bo" <linmengbo0689@protonmail.com> wrote: > From: Markuss Broks <markuss.broks@gmail.com> > > Imagis IST3038 is a variant (firmware?) of Imagis IST3038 IC, > add the compatible for it to the IST3038C bindings. > > Signed-off-by: Markuss Broks <markuss.broks@gmail.com> > [Change from IST3038B to IST3038] > Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > .../devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml b/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml > index e3a2b871e50c..a58c045d2ba1 100644 > --- a/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml > +++ b/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml > @@ -18,6 +18,7 @@ properties: > > compatible: > enum: > + - imagis,ist3038 > - imagis,ist3038c > > reg: > -- > 2.30.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/3] input/touchscreen: imagis: Correct the maximum touch area value 2022-11-18 18:21 [PATCH v2 0/3] Add support for Imagis IST3038 Lin, Meng-Bo 2022-11-18 18:21 ` [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 Lin, Meng-Bo @ 2022-11-18 18:21 ` Lin, Meng-Bo 2022-11-30 15:34 ` Mattijs Korpershoek 2022-11-18 18:21 ` [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Lin, Meng-Bo 2 siblings, 1 reply; 9+ messages in thread From: Lin, Meng-Bo @ 2022-11-18 18:21 UTC (permalink / raw) To: linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming From: Markuss Broks <markuss.broks@gmail.com> As specified in downstream IST3038 driver and proved by testing, the correct maximum reported value of touch area is 16. Signed-off-by: Markuss Broks <markuss.broks@gmail.com> [Change from IST3038B to IST3038] Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> --- drivers/input/touchscreen/imagis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index e2697e6c6d2a..b667914a44f1 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -210,7 +210,7 @@ static int imagis_init_input_dev(struct imagis_ts *ts) input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X); input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y); - input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 16, 0, 0); touchscreen_parse_properties(input_dev, true, &ts->prop); if (!ts->prop.max_x || !ts->prop.max_y) { -- 2.30.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/3] input/touchscreen: imagis: Correct the maximum touch area value 2022-11-18 18:21 ` [PATCH v2 2/3] input/touchscreen: imagis: Correct the maximum touch area value Lin, Meng-Bo @ 2022-11-30 15:34 ` Mattijs Korpershoek 0 siblings, 0 replies; 9+ messages in thread From: Mattijs Korpershoek @ 2022-11-30 15:34 UTC (permalink / raw) To: Lin, Meng-Bo, linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming On Fri, Nov 18, 2022 at 18:21, "Lin, Meng-Bo" <linmengbo0689@protonmail.com> wrote: > From: Markuss Broks <markuss.broks@gmail.com> > > As specified in downstream IST3038 driver and proved by testing, > the correct maximum reported value of touch area is 16. > > Signed-off-by: Markuss Broks <markuss.broks@gmail.com> > [Change from IST3038B to IST3038] > Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/touchscreen/imagis.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c > index e2697e6c6d2a..b667914a44f1 100644 > --- a/drivers/input/touchscreen/imagis.c > +++ b/drivers/input/touchscreen/imagis.c > @@ -210,7 +210,7 @@ static int imagis_init_input_dev(struct imagis_ts *ts) > > input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X); > input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y); > - input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0); > + input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 16, 0, 0); > > touchscreen_parse_properties(input_dev, true, &ts->prop); > if (!ts->prop.max_x || !ts->prop.max_y) { > -- > 2.30.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 2022-11-18 18:21 [PATCH v2 0/3] Add support for Imagis IST3038 Lin, Meng-Bo 2022-11-18 18:21 ` [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 Lin, Meng-Bo 2022-11-18 18:21 ` [PATCH v2 2/3] input/touchscreen: imagis: Correct the maximum touch area value Lin, Meng-Bo @ 2022-11-18 18:21 ` Lin, Meng-Bo 2022-11-30 15:43 ` Mattijs Korpershoek 2 siblings, 1 reply; 9+ messages in thread From: Lin, Meng-Bo @ 2022-11-18 18:21 UTC (permalink / raw) To: linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming From: Markuss Broks <markuss.broks@gmail.com> Imagis IST3038 is another variant of Imagis IST3038 IC, which has a different register interface from IST3038C (possibly firmware defined). This should also work for IST3044B (though untested), however other variants using this interface/protocol(IST3026, IST3032, IST3026B, IST3032B) have a different format for coordinates, and they'd need additional effort to be supported by this driver. Signed-off-by: Markuss Broks <markuss.broks@gmail.com> [Use IST3038C_REG_CHIPID_BASE] Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> --- drivers/input/touchscreen/imagis.c | 62 ++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index b667914a44f1..eb3b0684817f 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -13,7 +13,8 @@ #define IST3038C_HIB_ACCESS (0x800B << 16) #define IST3038C_DIRECT_ACCESS BIT(31) -#define IST3038C_REG_CHIPID 0x40001000 +#define IST3038C_REG_CHIPID_BASE 0x40001000 +#define IST3038C_REG_CHIPID(base) (base | IST3038C_DIRECT_ACCESS) #define IST3038C_REG_HIB_BASE 0x30000100 #define IST3038C_REG_TOUCH_STATUS (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS) #define IST3038C_REG_TOUCH_COORD (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS | 0x8) @@ -31,8 +32,24 @@ #define IST3038C_FINGER_COUNT_SHIFT 12 #define IST3038C_FINGER_STATUS_MASK GENMASK(9, 0) +#define IST30XX_REG_STATUS 0x20 +#define IST30XXB_REG_CHIPID_BASE 0x40000000 +#define IST30XX_WHOAMI 0x30003000 +#define IST30XXA_WHOAMI 0x300a300a +#define IST30XXB_WHOAMI 0x300b300b +#define IST3038_WHOAMI 0x30383038 + +struct imagis_properties { + unsigned int interrupt_msg_cmd; + unsigned int touch_coord_cmd; + unsigned int chipid_base; + unsigned int whoami_val; + bool protocol_b; +}; + struct imagis_ts { struct i2c_client *client; + const struct imagis_properties *tdata; struct input_dev *input_dev; struct touchscreen_properties prop; struct regulator_bulk_data supplies[2]; @@ -84,8 +101,7 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) int i; int error; - error = imagis_i2c_read_reg(ts, IST3038C_REG_INTR_MESSAGE, - &intr_message); + error = imagis_i2c_read_reg(ts, ts->tdata->interrupt_msg_cmd, &intr_message); if (error) { dev_err(&ts->client->dev, "failed to read the interrupt message: %d\n", error); @@ -104,9 +120,13 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) finger_pressed = intr_message & IST3038C_FINGER_STATUS_MASK; for (i = 0; i < finger_count; i++) { - error = imagis_i2c_read_reg(ts, - IST3038C_REG_TOUCH_COORD + (i * 4), - &finger_status); + if (ts->tdata->protocol_b) + error = imagis_i2c_read_reg(ts, + ts->tdata->touch_coord_cmd, &finger_status); + else + error = imagis_i2c_read_reg(ts, + ts->tdata->touch_coord_cmd + (i * 4), + &finger_status); if (error) { dev_err(&ts->client->dev, "failed to read coordinates for finger %d: %d\n", @@ -261,6 +281,12 @@ static int imagis_probe(struct i2c_client *i2c) ts->client = i2c; + ts->tdata = device_get_match_data(dev); + if (!ts->tdata) { + dev_err(dev, "missing chip data\n"); + return -EINVAL; + } + error = imagis_init_regulators(ts); if (error) { dev_err(dev, "regulator init error: %d\n", error); @@ -279,15 +305,13 @@ static int imagis_probe(struct i2c_client *i2c) return error; } - error = imagis_i2c_read_reg(ts, - IST3038C_REG_CHIPID | IST3038C_DIRECT_ACCESS, - &chip_id); + error = imagis_i2c_read_reg(ts, IST3038C_REG_CHIPID(ts->tdata->chipid_base), &chip_id); if (error) { dev_err(dev, "chip ID read failure: %d\n", error); return error; } - if (chip_id != IST3038C_WHOAMI) { + if (chip_id != ts->tdata->whoami_val) { dev_err(dev, "unknown chip ID: 0x%x\n", chip_id); return -EINVAL; } @@ -343,9 +367,25 @@ static int __maybe_unused imagis_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(imagis_pm_ops, imagis_suspend, imagis_resume); +static const struct imagis_properties imagis_3038_data = { + .interrupt_msg_cmd = IST30XX_REG_STATUS, + .touch_coord_cmd = IST30XX_REG_STATUS, + .chipid_base = IST30XXB_REG_CHIPID_BASE, + .whoami_val = IST3038_WHOAMI, + .protocol_b = true, +}; + +static const struct imagis_properties imagis_3038c_data = { + .interrupt_msg_cmd = IST3038C_REG_INTR_MESSAGE, + .touch_coord_cmd = IST3038C_REG_TOUCH_COORD, + .chipid_base = IST3038C_REG_CHIPID_BASE, + .whoami_val = IST3038C_WHOAMI, +}; + #ifdef CONFIG_OF static const struct of_device_id imagis_of_match[] = { - { .compatible = "imagis,ist3038c", }, + { .compatible = "imagis,ist3038", .data = &imagis_3038_data }, + { .compatible = "imagis,ist3038c", .data = &imagis_3038c_data }, { }, }; MODULE_DEVICE_TABLE(of, imagis_of_match); -- 2.30.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 2022-11-18 18:21 ` [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Lin, Meng-Bo @ 2022-11-30 15:43 ` Mattijs Korpershoek 0 siblings, 0 replies; 9+ messages in thread From: Mattijs Korpershoek @ 2022-11-30 15:43 UTC (permalink / raw) To: Lin, Meng-Bo, linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Henrik Rydberg, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming On Fri, Nov 18, 2022 at 18:21, "Lin, Meng-Bo" <linmengbo0689@protonmail.com> wrote: > From: Markuss Broks <markuss.broks@gmail.com> > > Imagis IST3038 is another variant of Imagis IST3038 IC, which has > a different register interface from IST3038C (possibly firmware defined). > > This should also work for IST3044B (though untested), however other > variants using this interface/protocol(IST3026, IST3032, IST3026B, > IST3032B) have a different format for coordinates, and they'd need > additional effort to be supported by this driver. > > Signed-off-by: Markuss Broks <markuss.broks@gmail.com> > [Use IST3038C_REG_CHIPID_BASE] > Signed-off-by: Lin, Meng-Bo <linmengbo0689@protonmail.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> > --- > drivers/input/touchscreen/imagis.c | 62 ++++++++++++++++++++++++------ > 1 file changed, 51 insertions(+), 11 deletions(-) > > diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c > index b667914a44f1..eb3b0684817f 100644 > --- a/drivers/input/touchscreen/imagis.c > +++ b/drivers/input/touchscreen/imagis.c > @@ -13,7 +13,8 @@ > > #define IST3038C_HIB_ACCESS (0x800B << 16) > #define IST3038C_DIRECT_ACCESS BIT(31) > -#define IST3038C_REG_CHIPID 0x40001000 > +#define IST3038C_REG_CHIPID_BASE 0x40001000 > +#define IST3038C_REG_CHIPID(base) (base | IST3038C_DIRECT_ACCESS) > #define IST3038C_REG_HIB_BASE 0x30000100 > #define IST3038C_REG_TOUCH_STATUS (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS) > #define IST3038C_REG_TOUCH_COORD (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS | 0x8) > @@ -31,8 +32,24 @@ > #define IST3038C_FINGER_COUNT_SHIFT 12 > #define IST3038C_FINGER_STATUS_MASK GENMASK(9, 0) > > +#define IST30XX_REG_STATUS 0x20 > +#define IST30XXB_REG_CHIPID_BASE 0x40000000 > +#define IST30XX_WHOAMI 0x30003000 > +#define IST30XXA_WHOAMI 0x300a300a > +#define IST30XXB_WHOAMI 0x300b300b > +#define IST3038_WHOAMI 0x30383038 > + > +struct imagis_properties { > + unsigned int interrupt_msg_cmd; > + unsigned int touch_coord_cmd; > + unsigned int chipid_base; > + unsigned int whoami_val; > + bool protocol_b; > +}; > + > struct imagis_ts { > struct i2c_client *client; > + const struct imagis_properties *tdata; > struct input_dev *input_dev; > struct touchscreen_properties prop; > struct regulator_bulk_data supplies[2]; > @@ -84,8 +101,7 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) > int i; > int error; > > - error = imagis_i2c_read_reg(ts, IST3038C_REG_INTR_MESSAGE, > - &intr_message); > + error = imagis_i2c_read_reg(ts, ts->tdata->interrupt_msg_cmd, &intr_message); > if (error) { > dev_err(&ts->client->dev, > "failed to read the interrupt message: %d\n", error); > @@ -104,9 +120,13 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) > finger_pressed = intr_message & IST3038C_FINGER_STATUS_MASK; > > for (i = 0; i < finger_count; i++) { > - error = imagis_i2c_read_reg(ts, > - IST3038C_REG_TOUCH_COORD + (i * 4), > - &finger_status); > + if (ts->tdata->protocol_b) > + error = imagis_i2c_read_reg(ts, > + ts->tdata->touch_coord_cmd, &finger_status); > + else > + error = imagis_i2c_read_reg(ts, > + ts->tdata->touch_coord_cmd + (i * 4), > + &finger_status); > if (error) { > dev_err(&ts->client->dev, > "failed to read coordinates for finger %d: %d\n", > @@ -261,6 +281,12 @@ static int imagis_probe(struct i2c_client *i2c) > > ts->client = i2c; > > + ts->tdata = device_get_match_data(dev); > + if (!ts->tdata) { > + dev_err(dev, "missing chip data\n"); > + return -EINVAL; > + } > + > error = imagis_init_regulators(ts); > if (error) { > dev_err(dev, "regulator init error: %d\n", error); > @@ -279,15 +305,13 @@ static int imagis_probe(struct i2c_client *i2c) > return error; > } > > - error = imagis_i2c_read_reg(ts, > - IST3038C_REG_CHIPID | IST3038C_DIRECT_ACCESS, > - &chip_id); > + error = imagis_i2c_read_reg(ts, IST3038C_REG_CHIPID(ts->tdata->chipid_base), &chip_id); > if (error) { > dev_err(dev, "chip ID read failure: %d\n", error); > return error; > } > > - if (chip_id != IST3038C_WHOAMI) { > + if (chip_id != ts->tdata->whoami_val) { > dev_err(dev, "unknown chip ID: 0x%x\n", chip_id); > return -EINVAL; > } > @@ -343,9 +367,25 @@ static int __maybe_unused imagis_resume(struct device *dev) > > static SIMPLE_DEV_PM_OPS(imagis_pm_ops, imagis_suspend, imagis_resume); > > +static const struct imagis_properties imagis_3038_data = { > + .interrupt_msg_cmd = IST30XX_REG_STATUS, > + .touch_coord_cmd = IST30XX_REG_STATUS, > + .chipid_base = IST30XXB_REG_CHIPID_BASE, > + .whoami_val = IST3038_WHOAMI, > + .protocol_b = true, > +}; > + > +static const struct imagis_properties imagis_3038c_data = { > + .interrupt_msg_cmd = IST3038C_REG_INTR_MESSAGE, > + .touch_coord_cmd = IST3038C_REG_TOUCH_COORD, > + .chipid_base = IST3038C_REG_CHIPID_BASE, > + .whoami_val = IST3038C_WHOAMI, > +}; > + > #ifdef CONFIG_OF > static const struct of_device_id imagis_of_match[] = { > - { .compatible = "imagis,ist3038c", }, > + { .compatible = "imagis,ist3038", .data = &imagis_3038_data }, > + { .compatible = "imagis,ist3038c", .data = &imagis_3038c_data }, > { }, > }; > MODULE_DEVICE_TABLE(of, imagis_of_match); > -- > 2.30.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 0/3] Add support for Imagis IST3038 and clarify the usage of protocol_b
@ 2024-06-13 2:56 Raymond Hackley
2024-06-13 2:57 ` [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Raymond Hackley
0 siblings, 1 reply; 9+ messages in thread
From: Raymond Hackley @ 2024-06-13 2:56 UTC (permalink / raw)
To: linux-kernel
Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Stephan Gerhold, Nikita Travkin, linux-input,
devicetree, ~postmarketos/upstreaming
Imagis IST3038 is another variant of Imagis IST3038 IC, which has
a different register interface from IST3038C (possibly firmware defined).
Unlike IST3038C/IST3032C, IST3038 has different registers for commands,
which means IST3038 doesn't use protocol B.
Similar to IST3032C and maybe the other variants, IST3038 has touch keys
support, which provides KEY_APPSELECT and KEY_BACK.
Add support for IST3038 with touch keys.
protocol_b is a property, which tells Imagis panel to use a different
format for coordinates.
IST30XXC series is known for using protocol B, while the other series
aren't. Note this could be confusing, unlike the model name implies.
Adjust the usage of protocol_b to avoid confusion.
---
v2: Sort the compatible enties in alphabetical order.
Document the binding before using in the driver.
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 2024-06-13 2:56 [PATCH v2 0/3] Add support for Imagis IST3038 and clarify the usage of protocol_b Raymond Hackley @ 2024-06-13 2:57 ` Raymond Hackley 0 siblings, 0 replies; 9+ messages in thread From: Raymond Hackley @ 2024-06-13 2:57 UTC (permalink / raw) To: linux-kernel Cc: Markuss Broks, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Stephan Gerhold, Nikita Travkin, linux-input, devicetree, ~postmarketos/upstreaming Imagis IST3038 is another variant of Imagis IST3038 IC, which has a different register interface from IST3038C (possibly firmware defined). Unlike IST3038C/IST3032C, IST3038 has different registers for commands, which means IST3038 doesn't use protocol B. Similar to IST3032C and maybe the other variants, IST3038 has touch keys support, which provides KEY_APPSELECT and KEY_BACK. Add support for IST3038 with touch keys. Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com> --- drivers/input/touchscreen/imagis.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index 886bcfc8497a..aeabf8d057de 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -12,9 +12,17 @@ #include <linux/property.h> #include <linux/regulator/consumer.h> +#define IST30XX_REG_STATUS 0x20 +#define IST30XX_REG_CHIPID (0x40000000 | IST3038C_DIRECT_ACCESS) + +#define IST30XX_WHOAMI 0x30003000 +#define IST30XXA_WHOAMI 0x300a300a +#define IST30XXB_WHOAMI 0x300b300b +#define IST3038_WHOAMI 0x30383038 + #define IST3032C_WHOAMI 0x32c +#define IST3038C_WHOAMI 0x38c -#define IST3038B_REG_STATUS 0x20 #define IST3038B_REG_CHIPID 0x30 #define IST3038B_WHOAMI 0x30380b @@ -25,7 +33,6 @@ #define IST3038C_REG_TOUCH_STATUS (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS) #define IST3038C_REG_TOUCH_COORD (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS | 0x8) #define IST3038C_REG_INTR_MESSAGE (IST3038C_REG_HIB_BASE | IST3038C_HIB_ACCESS | 0x4) -#define IST3038C_WHOAMI 0x38c #define IST3038C_CHIP_ON_DELAY_MS 60 #define IST3038C_I2C_RETRY_COUNT 3 #define IST3038C_MAX_FINGER_NUM 10 @@ -397,9 +404,17 @@ static const struct imagis_properties imagis_3032c_data = { .protocol_b = true, }; +static const struct imagis_properties imagis_3038_data = { + .interrupt_msg_cmd = IST30XX_REG_STATUS, + .touch_coord_cmd = IST30XX_REG_STATUS, + .whoami_cmd = IST30XX_REG_CHIPID, + .whoami_val = IST3038_WHOAMI, + .touch_keys_supported = true, +}; + static const struct imagis_properties imagis_3038b_data = { - .interrupt_msg_cmd = IST3038B_REG_STATUS, - .touch_coord_cmd = IST3038B_REG_STATUS, + .interrupt_msg_cmd = IST30XX_REG_STATUS, + .touch_coord_cmd = IST30XX_REG_STATUS, .whoami_cmd = IST3038B_REG_CHIPID, .whoami_val = IST3038B_WHOAMI, }; @@ -415,6 +430,7 @@ static const struct imagis_properties imagis_3038c_data = { #ifdef CONFIG_OF static const struct of_device_id imagis_of_match[] = { { .compatible = "imagis,ist3032c", .data = &imagis_3032c_data }, + { .compatible = "imagis,ist3038", .data = &imagis_3038_data }, { .compatible = "imagis,ist3038b", .data = &imagis_3038b_data }, { .compatible = "imagis,ist3038c", .data = &imagis_3038c_data }, { }, -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-13 2:57 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-11-18 18:21 [PATCH v2 0/3] Add support for Imagis IST3038 Lin, Meng-Bo 2022-11-18 18:21 ` [PATCH v2 1/3] dt-bindings: input/touchscreen: Add compatible for IST3038 Lin, Meng-Bo 2022-11-20 10:53 ` Krzysztof Kozlowski 2022-11-30 15:35 ` Mattijs Korpershoek 2022-11-18 18:21 ` [PATCH v2 2/3] input/touchscreen: imagis: Correct the maximum touch area value Lin, Meng-Bo 2022-11-30 15:34 ` Mattijs Korpershoek 2022-11-18 18:21 ` [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Lin, Meng-Bo 2022-11-30 15:43 ` Mattijs Korpershoek -- strict thread matches above, loose matches on Subject: below -- 2024-06-13 2:56 [PATCH v2 0/3] Add support for Imagis IST3038 and clarify the usage of protocol_b Raymond Hackley 2024-06-13 2:57 ` [PATCH v2 3/3] input/touchscreen: imagis: Add supports for Imagis IST3038 Raymond Hackley
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).