2023-01-11 13:25:26

by Jiri Valek - 2N

[permalink] [raw]
Subject: [PATCH v4 0/2] Input: cap11xx add support for cap1203, cap1293 and cap1298

PATCH 1 - add compatible string for new models
PATCH 2 - add support for new models into driver

Changes in v2:
- Fixed if statement in PATCH 2.

Changes in v3:
- Model names sorted alphabetically in PATCH 2.

Changes in v4:
- Model names sorted alphabetically also in PATCH 1.

Jiri Valek - 2N (2):
dt-bindings: input: microchip,cap11xx: add cap1203, cap1293 and
cap1298
Input: cap11xx - add support for cap1203, cap1293 and cap1298

.../bindings/input/microchip,cap11xx.yaml | 3 +++
drivers/input/keyboard/cap11xx.c | 19 +++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)

--
2.25.1


2023-01-11 13:25:34

by Jiri Valek - 2N

[permalink] [raw]
Subject: [PATCH v4 2/2] Input: cap11xx - add support for cap1203, cap1293 and cap1298

Add basic support for more CAP1xxx sensors.
All models from CAP1xxx family are register-compatible.
Some advanced features are not used and disabled by default.

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Jiri Valek - 2N <[email protected]>
---
Changes in v2:
- Fixed if statement.

Changes in v3:
- Model names sorted alphabetically.

Changes in v4
- No changes.

drivers/input/keyboard/cap11xx.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
index 79afd0386e3f..ce27168302a8 100644
--- a/drivers/input/keyboard/cap11xx.c
+++ b/drivers/input/keyboard/cap11xx.c
@@ -98,14 +98,20 @@ enum {
CAP1106,
CAP1126,
CAP1188,
+ CAP1203,
CAP1206,
+ CAP1293,
+ CAP1298
};

static const struct cap11xx_hw_model cap11xx_devices[] = {
[CAP1106] = { .product_id = 0x55, .num_channels = 6, .num_leds = 0, .no_gain = false },
[CAP1126] = { .product_id = 0x53, .num_channels = 6, .num_leds = 2, .no_gain = false },
[CAP1188] = { .product_id = 0x50, .num_channels = 8, .num_leds = 8, .no_gain = false },
+ [CAP1203] = { .product_id = 0x6d, .num_channels = 3, .num_leds = 0, .no_gain = true },
[CAP1206] = { .product_id = 0x67, .num_channels = 6, .num_leds = 0, .no_gain = true },
+ [CAP1293] = { .product_id = 0x6f, .num_channels = 3, .num_leds = 0, .no_gain = false },
+ [CAP1298] = { .product_id = 0x71, .num_channels = 8, .num_leds = 0, .no_gain = false },
};

static const struct reg_default cap11xx_reg_defaults[] = {
@@ -377,7 +383,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
if (error < 0)
return error;

- dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev);
+ dev_info(dev, "CAP11XX detected, model %s, revision 0x%02x\n",
+ id->name, rev);
node = dev->of_node;

if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) {
@@ -390,7 +397,9 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
}

- if (id->driver_data != CAP1206) {
+ if ((id->driver_data == CAP1106) ||
+ (id->driver_data == CAP1126) ||
+ (id->driver_data == CAP1188)) {
if (of_property_read_bool(node, "microchip,irq-active-high")) {
error = regmap_update_bits(priv->regmap,
CAP11XX_REG_CONFIG2,
@@ -483,7 +492,10 @@ static const struct of_device_id cap11xx_dt_ids[] = {
{ .compatible = "microchip,cap1106", },
{ .compatible = "microchip,cap1126", },
{ .compatible = "microchip,cap1188", },
+ { .compatible = "microchip,cap1203", },
{ .compatible = "microchip,cap1206", },
+ { .compatible = "microchip,cap1293", },
+ { .compatible = "microchip,cap1298", },
{}
};
MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
@@ -492,7 +504,10 @@ static const struct i2c_device_id cap11xx_i2c_ids[] = {
{ "cap1106", CAP1106 },
{ "cap1126", CAP1126 },
{ "cap1188", CAP1188 },
+ { "cap1203", CAP1203 },
{ "cap1206", CAP1206 },
+ { "cap1293", CAP1293 },
+ { "cap1298", CAP1298 },
{}
};
MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);
--
2.25.1

2023-01-11 13:51:15

by Jiri Valek - 2N

[permalink] [raw]
Subject: [PATCH v4 1/2] dt-bindings: input: microchip,cap11xx: add cap1203, cap1293 and cap1298

Add support for cap1203, cap1293 and cap1298.

Signed-off-by: Jiri Valek - 2N <[email protected]>
---
Changes in v2:
- No changes.

Changes in v3:
- No changes.

Changes in v4
- Model names sorted alphabetically.

Documentation/devicetree/bindings/input/microchip,cap11xx.yaml | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml b/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
index 67d4d8f86a2d..5fa625b5c5fb 100644
--- a/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
+++ b/Documentation/devicetree/bindings/input/microchip,cap11xx.yaml
@@ -19,7 +19,10 @@ properties:
- microchip,cap1106
- microchip,cap1126
- microchip,cap1188
+ - microchip,cap1203
- microchip,cap1206
+ - microchip,cap1293
+ - microchip,cap1298

reg:
maxItems: 1
--
2.25.1

2023-02-03 15:17:12

by Mattijs Korpershoek

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] Input: cap11xx - add support for cap1203, cap1293 and cap1298

On Wed, Jan 11, 2023 at 14:11, Jiri Valek - 2N <[email protected]> wrote:

> Add basic support for more CAP1xxx sensors.
> All models from CAP1xxx family are register-compatible.
> Some advanced features are not used and disabled by default.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Jiri Valek - 2N <[email protected]>

Reviewed-by: Mattijs Korpershoek <[email protected]>

Small nitpick below

> ---
> Changes in v2:
> - Fixed if statement.
>
> Changes in v3:
> - Model names sorted alphabetically.
>
> Changes in v4
> - No changes.
>
> drivers/input/keyboard/cap11xx.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
> index 79afd0386e3f..ce27168302a8 100644
> --- a/drivers/input/keyboard/cap11xx.c
> +++ b/drivers/input/keyboard/cap11xx.c
> @@ -98,14 +98,20 @@ enum {
> CAP1106,
> CAP1126,
> CAP1188,
> + CAP1203,
> CAP1206,
> + CAP1293,
> + CAP1298
> };
>
> static const struct cap11xx_hw_model cap11xx_devices[] = {
> [CAP1106] = { .product_id = 0x55, .num_channels = 6, .num_leds = 0, .no_gain = false },
> [CAP1126] = { .product_id = 0x53, .num_channels = 6, .num_leds = 2, .no_gain = false },
> [CAP1188] = { .product_id = 0x50, .num_channels = 8, .num_leds = 8, .no_gain = false },
> + [CAP1203] = { .product_id = 0x6d, .num_channels = 3, .num_leds = 0, .no_gain = true },
> [CAP1206] = { .product_id = 0x67, .num_channels = 6, .num_leds = 0, .no_gain = true },
> + [CAP1293] = { .product_id = 0x6f, .num_channels = 3, .num_leds = 0, .no_gain = false },
> + [CAP1298] = { .product_id = 0x71, .num_channels = 8, .num_leds = 0, .no_gain = false },
> };
>
> static const struct reg_default cap11xx_reg_defaults[] = {
> @@ -377,7 +383,8 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
> if (error < 0)
> return error;
>
> - dev_info(dev, "CAP11XX detected, revision 0x%02x\n", rev);
> + dev_info(dev, "CAP11XX detected, model %s, revision 0x%02x\n",
> + id->name, rev);
> node = dev->of_node;
>
> if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) {
> @@ -390,7 +397,9 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client)
> dev_err(dev, "Invalid sensor-gain value %d\n", gain32);
> }
>
> - if (id->driver_data != CAP1206) {
> + if ((id->driver_data == CAP1106) ||
> + (id->driver_data == CAP1126) ||
> + (id->driver_data == CAP1188)) {

checkpatch --strict is not happy about this indendation:
CHECK: Alignment should match open parenthesis

> if (of_property_read_bool(node, "microchip,irq-active-high")) {
> error = regmap_update_bits(priv->regmap,
> CAP11XX_REG_CONFIG2,
> @@ -483,7 +492,10 @@ static const struct of_device_id cap11xx_dt_ids[] = {
> { .compatible = "microchip,cap1106", },
> { .compatible = "microchip,cap1126", },
> { .compatible = "microchip,cap1188", },
> + { .compatible = "microchip,cap1203", },
> { .compatible = "microchip,cap1206", },
> + { .compatible = "microchip,cap1293", },
> + { .compatible = "microchip,cap1298", },
> {}
> };
> MODULE_DEVICE_TABLE(of, cap11xx_dt_ids);
> @@ -492,7 +504,10 @@ static const struct i2c_device_id cap11xx_i2c_ids[] = {
> { "cap1106", CAP1106 },
> { "cap1126", CAP1126 },
> { "cap1188", CAP1188 },
> + { "cap1203", CAP1203 },
> { "cap1206", CAP1206 },
> + { "cap1293", CAP1293 },
> + { "cap1298", CAP1298 },
> {}
> };
> MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids);
> --
> 2.25.1