From e2afe95a87a268bcdca2fb489d9c8a485e3aca85 Mon Sep 17 00:00:00 2001 From: Yassine Oudjana Date: Thu, 9 Sep 2021 22:23:39 -0700 Subject: dt-bindings: input: Add binding for cypress-sf Add a device tree binding for Cypress StreetFighter. Signed-off-by: Yassine Oudjana Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20210907174341.422013-3-y.oudjana@protonmail.com Signed-off-by: Dmitry Torokhov --- .../devicetree/bindings/input/cypress-sf.yaml | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/cypress-sf.yaml (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/input/cypress-sf.yaml b/Documentation/devicetree/bindings/input/cypress-sf.yaml new file mode 100644 index 000000000000..c0b051466272 --- /dev/null +++ b/Documentation/devicetree/bindings/input/cypress-sf.yaml @@ -0,0 +1,61 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/input/cypress-sf.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress StreetFighter touchkey controller + +maintainers: + - Yassine Oudjana + +allOf: + - $ref: input.yaml# + +properties: + compatible: + const: cypress,sf3155 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + avdd-supply: + description: Regulator for AVDD analog voltage + + vdd-supply: + description: Regulator for VDD digital voltage + + linux,keycodes: + minItems: 1 + maxItems: 8 + +required: + - compatible + - reg + - interrupts + - avdd-supply + - vdd-supply + +additionalProperties: false + +examples: + - | + #include + #include + i2c { + #address-cells = <1>; + #size-cells = <0>; + + touchkey@28 { + compatible = "cypress,sf3155"; + reg = <0x28>; + interrupt-parent = <&msmgpio>; + interrupts = <77 IRQ_TYPE_EDGE_FALLING>; + avdd-supply = <&vreg_l6a_1p8>; + vdd-supply = <&vdd_3v2_tp>; + linux,keycodes = ; + }; + }; -- cgit v1.2.3 From 322a552e19550872eb9f3a54330a5f615db42916 Mon Sep 17 00:00:00 2001 From: Jesse Taube Date: Tue, 2 Nov 2021 16:55:49 -0700 Subject: Input: cap11xx - add support for cap1206 According to the datasheet "The CAP1206 is pin- and register-compatible with the CAP1106, with the exception of the GAIN[1:0] bits and ALT_POL bit"(57). So, this patch aims to disable them as they are no longer used. Signed-off-by: Jesse Taube Signed-off-by: Dmitry Torokhov --- .../devicetree/bindings/input/cap11xx.txt | 1 + drivers/input/keyboard/cap11xx.c | 43 +++++++++++++++------- 2 files changed, 30 insertions(+), 14 deletions(-) (limited to 'Documentation/devicetree') diff --git a/Documentation/devicetree/bindings/input/cap11xx.txt b/Documentation/devicetree/bindings/input/cap11xx.txt index 8c67a0b5058d..74b91c398d22 100644 --- a/Documentation/devicetree/bindings/input/cap11xx.txt +++ b/Documentation/devicetree/bindings/input/cap11xx.txt @@ -9,6 +9,7 @@ Required properties: "microchip,cap1106" "microchip,cap1126" "microchip,cap1188" + "microchip,cap1206" reg: The I2C slave address of the device. diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c index 688e2bef682e..7c85343cd32f 100644 --- a/drivers/input/keyboard/cap11xx.c +++ b/drivers/input/keyboard/cap11xx.c @@ -91,18 +91,21 @@ struct cap11xx_hw_model { u8 product_id; unsigned int num_channels; unsigned int num_leds; + bool no_gain; }; enum { CAP1106, CAP1126, CAP1188, + CAP1206, }; static const struct cap11xx_hw_model cap11xx_devices[] = { - [CAP1106] = { .product_id = 0x55, .num_channels = 6, .num_leds = 0 }, - [CAP1126] = { .product_id = 0x53, .num_channels = 6, .num_leds = 2 }, - [CAP1188] = { .product_id = 0x50, .num_channels = 8, .num_leds = 8 }, + [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 }, + [CAP1206] = { .product_id = 0x67, .num_channels = 6, .num_leds = 0, .no_gain = true }, }; static const struct reg_default cap11xx_reg_defaults[] = { @@ -378,17 +381,24 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client, node = dev->of_node; if (!of_property_read_u32(node, "microchip,sensor-gain", &gain32)) { - if (is_power_of_2(gain32) && gain32 <= 8) + if (cap->no_gain) + dev_warn(dev, + "This version doesn't support sensor gain\n"); + else if (is_power_of_2(gain32) && gain32 <= 8) gain = ilog2(gain32); else dev_err(dev, "Invalid sensor-gain value %d\n", gain32); } - if (of_property_read_bool(node, "microchip,irq-active-high")) { - error = regmap_update_bits(priv->regmap, CAP11XX_REG_CONFIG2, - CAP11XX_REG_CONFIG2_ALT_POL, 0); - if (error) - return error; + if (id->driver_data != CAP1206) { + if (of_property_read_bool(node, "microchip,irq-active-high")) { + error = regmap_update_bits(priv->regmap, + CAP11XX_REG_CONFIG2, + CAP11XX_REG_CONFIG2_ALT_POL, + 0); + if (error) + return error; + } } /* Provide some useful defaults */ @@ -398,11 +408,14 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client, of_property_read_u32_array(node, "linux,keycodes", priv->keycodes, cap->num_channels); - error = regmap_update_bits(priv->regmap, CAP11XX_REG_MAIN_CONTROL, - CAP11XX_REG_MAIN_CONTROL_GAIN_MASK, - gain << CAP11XX_REG_MAIN_CONTROL_GAIN_SHIFT); - if (error) - return error; + if (!cap->no_gain) { + error = regmap_update_bits(priv->regmap, + CAP11XX_REG_MAIN_CONTROL, + CAP11XX_REG_MAIN_CONTROL_GAIN_MASK, + gain << CAP11XX_REG_MAIN_CONTROL_GAIN_SHIFT); + if (error) + return error; + } /* Disable autorepeat. The Linux input system has its own handling. */ error = regmap_write(priv->regmap, CAP11XX_REG_REPEAT_RATE, 0); @@ -470,6 +483,7 @@ static const struct of_device_id cap11xx_dt_ids[] = { { .compatible = "microchip,cap1106", }, { .compatible = "microchip,cap1126", }, { .compatible = "microchip,cap1188", }, + { .compatible = "microchip,cap1206", }, {} }; MODULE_DEVICE_TABLE(of, cap11xx_dt_ids); @@ -478,6 +492,7 @@ static const struct i2c_device_id cap11xx_i2c_ids[] = { { "cap1106", CAP1106 }, { "cap1126", CAP1126 }, { "cap1188", CAP1188 }, + { "cap1206", CAP1206 }, {} }; MODULE_DEVICE_TABLE(i2c, cap11xx_i2c_ids); -- cgit v1.2.3