cap1106: add support for cap11xx variants
Subsystems (3)
v3 cover cap1106: add support for cap11xx variants
Changes from v2:
* Rename apply relevant CAP1106 references to CAP11XX to make generic for variant support
Matt Ranostay (3):
cap11xx: make driver generic for variant support
cap11xx: Add support for various cap11xx devices
cap11xx: support for irq-active-high option
.../devicetree/bindings/input/cap1106.txt | 53 --- .../devicetree/bindings/input/cap11xx.txt | 59 ++++ drivers/input/keyboard/Kconfig | 8 +- drivers/input/keyboard/Makefile | 2 +- drivers/input/keyboard/cap1106.c | 341 ------------------- drivers/input/keyboard/cap11xx.c | 372 +++++++++++++++++++++ 6 files changed, 436 insertions(+), 399 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/cap1106.txt create mode 100644 Documentation/devicetree/bindings/input/cap11xx.txt delete mode 100644 drivers/input/keyboard/cap1106.c create mode 100644 drivers/input/keyboard/cap11xx.c
Signature · 1 line
1.9.1
PATCH v3 1/3 cap11xx: make driver generic for variant support
cap1106 driver can support much more one device make the driver generic for support of similiar parts.
--- .../devicetree/bindings/input/cap1106.txt | 53 ---- .../devicetree/bindings/input/cap11xx.txt | 54 ++++ drivers/input/keyboard/Kconfig | 8 +- drivers/input/keyboard/Makefile | 2 +- drivers/input/keyboard/cap1106.c | 341 --------------------- drivers/input/keyboard/cap11xx.c | 340 ++++++++++++++++++++ 6 files changed, 399 insertions(+), 399 deletions(-) delete mode 100644 Documentation/devicetree/bindings/input/cap1106.txt create mode 100644 Documentation/devicetree/bindings/input/cap11xx.txt delete mode 100644 drivers/input/keyboard/cap1106.c create mode 100644 drivers/input/keyboard/cap11xx.c
Documentation/devicetree/bindings/input/cap1106.txt deleted +0 -53
@@ -1,53 +0,0 @@ -Device tree bindings for Microchip CAP1106, 6 channel capacitive touch sensor - -The node for this driver must be a child of a I2C controller node, as the -device communication via I2C only. - -Required properties: - - compatible: Must be "microchip,cap1106" - - reg: The I2C slave address of the device. - Only 0x28 is valid. - - interrupts: Property describing the interrupt line the - device's ALERT#/CM_IRQ# pin is connected to. - The device only has one interrupt source. - -Optional properties: - - autorepeat: Enables the Linux input system's autorepeat - feature on the input device. - - microchip,sensor-gain: Defines the gain of the sensor circuitry. This - effectively controls the sensitivity, as a - smaller delta capacitance is required to - generate the same delta count values. - Valid values are 1, 2, 4, and 8. - By default, a gain of 1 is set. - - linux,keycodes: Specifies an array of numeric keycode values to - be used for the channels. If this property is - omitted, KEY_A, KEY_B, etc are used as - defaults. The array must have exactly six - entries. - -Example: - -i2c_controller { - cap1106@28 { - compatible = "microchip,cap1106"; - interrupt-parent = <&gpio1>; - interrupts = <0 0>; - reg = <0x28>; - autorepeat; - microchip,sensor-gain = <2>; - - linux,keycodes = <103 /* KEY_UP */ - 106 /* KEY_RIGHT */ - 108 /* KEY_DOWN */ - 105 /* KEY_LEFT */ - 109 /* KEY_PAGEDOWN */ - 104>; /* KEY_PAGEUP */ - }; -}
Documentation/devicetree/bindings/input/cap11xx.txt new file +54 -0
54 lines not on this page · raw message
drivers/input/keyboard/Kconfig +4 -4
@@ -665,14 +665,14 @@ config KEYBOARD_CROS_EC To compile this driver as a module, choose M here: the module will be called cros_ec_keyb. -config KEYBOARD_CAP1106 - tristate "Microchip CAP1106 touch sensor" +config KEYBOARD_CAP11XX + tristate "Microchip CAP11XX based touch sensors" depends on OF && I2C select REGMAP_I2C help - Say Y here to enable the CAP1106 touch sensor driver. + Say Y here to enable the CAP11XX touch sensor driver. To compile this driver as a module, choose M here: the - module will be called cap1106. + module will be called cap11xx. endif
drivers/input/keyboard/Makefile +1 -1
@@ -11,7 +11,7 @@ obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o -obj-$(CONFIG_KEYBOARD_CAP1106) += cap1106.o +obj-$(CONFIG_KEYBOARD_CAP11XX) += cap11xx.o obj-$(CONFIG_KEYBOARD_CLPS711X) += clps711x-keypad.o obj-$(CONFIG_KEYBOARD_CROS_EC) += cros_ec_keyb.o obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o
drivers/input/keyboard/cap1106.c deleted +0 -341
341 lines not on this page · raw message
drivers/input/keyboard/cap11xx.c new file +340 -0
340 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v3 1/3] cap11xx: make driver generic for variant support
Quoted 4 lines · Matt Ranostay
cap1106 driver can support much more one device make the driver generic for support of similiar parts.
Signed-off-by Matt Ranostay <[email protected]>
Quoted 8 lines
--- .../devicetree/bindings/input/cap1106.txt | 53 ---- .../devicetree/bindings/input/cap11xx.txt | 54 ++++ drivers/input/keyboard/Kconfig | 8 +- drivers/input/keyboard/Makefile | 2 +- drivers/input/keyboard/cap1106.c | 341 --------------------- drivers/input/keyboard/cap11xx.c | 340 ++++++++++++++++++++ 6 files changed, 399 insertions(+), 399 deletions(-)
As I've said, such a patch is really a whole lot more readable if you use the -M switch for git format-patch to detect renames.
Other than that, the series now looks good to me. I can't test it, however, as I don't have access to the hardware anymore.
Thanks,
Daniel
Re: [PATCH v3 1/3] cap11xx: make driver generic for variant support
Quoted 14 lines · Daniel Mack
Quoted 4 lines · Matt Ranostay
cap1106 driver can support much more one device make the driver generic for support of similiar parts.
Signed-off-by Matt Ranostay <[email protected]>Quoted 8 lines
--- .../devicetree/bindings/input/cap1106.txt | 53 ---- .../devicetree/bindings/input/cap11xx.txt | 54 ++++ drivers/input/keyboard/Kconfig | 8 +- drivers/input/keyboard/Makefile | 2 +- drivers/input/keyboard/cap1106.c | 341 --------------------- drivers/input/keyboard/cap11xx.c | 340 ++++++++++++++++++++ 6 files changed, 399 insertions(+), 399 deletions(-)
Quoted 3 lines
As I've said, such a patch is really a whole lot more readable if you use the -M switch for git format-patch to detect renames.
TIL I learned of new git format-patch option. Will resubmit v4.
Quoted 3 lines
Other than that, the series now looks good to me. I can't test it, however, as I don't have access to the hardware anymore.
Yeah I can't confirm it works on cap1106 but there is no reason it wouldn't work.
Cap1188 works as expected.
Thanks,
Matt
Quoted 7 lines
Reviewed-by Daniel Mack <[email protected]>Thanks,
Daniel
PATCH v3 2/3 cap11xx: Add support for various cap11xx devices
In reply to Matt RanostaySeveral other variants of the cap11xx device exists with a varying number of capacitance detection channels. Add support for creating the channels dynamically.
--- .../devicetree/bindings/input/cap11xx.txt | 3 +- drivers/input/keyboard/cap11xx.c | 65 +++++++++++++++------- 2 files changed, 46 insertions(+), 22 deletions(-)
Documentation/devicetree/bindings/input/cap11xx.txt +2 -1
@@ -7,9 +7,10 @@ Required properties: compatible: Must be on the following, depending on the model: "microchip,cap1106" + "microchip,cap1126" + "microchip,cap1188" reg: The I2C slave address of the device. - Only 0x28 is valid. interrupts: Property describing the interrupt line the device's ALERT#/CM_IRQ# pin is connected to.
drivers/input/keyboard/cap11xx.c +44 -21
142 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 3/3 cap11xx: support for irq-active-high option
In reply to Matt RanostaySome applications need to use the irq-active-high push-pull option. This allows it be enabled in the device tree child node.
--- Documentation/devicetree/bindings/input/cap11xx.txt | 4 ++++ drivers/input/keyboard/cap11xx.c | 8 ++++++++ 2 files changed, 12 insertions(+)
Documentation/devicetree/bindings/input/cap11xx.txt +4 -0
@@ -28,6 +28,10 @@ Optional properties: Valid values are 1, 2, 4, and 8. By default, a gain of 1 is set. + microchip,irq-active-high: By default the interrupt pin is active low + open drain. This property allows using the active + high push-pull output. + linux,keycodes: Specifies an array of numeric keycode values to be used for the channels. If this property is omitted, KEY_A, KEY_B, etc are used as
drivers/input/keyboard/cap11xx.c +8 -0
@@ -46,6 +46,7 @@#define CAP11XX_REG_STANDBY_SENSITIVITY 0x42#define CAP11XX_REG_STANDBY_THRESH 0x43#define CAP11XX_REG_CONFIG2 0x44 +#define CAP11XX_REG_CONFIG2_ALT_POL BIT(6)#define CAP11XX_REG_SENSOR_BASE_CNT (X ) (0x50 + (X))#define CAP11XX_REG_SENSOR_CALIB (0xb1 + (X))#define CAP11XX_REG_SENSOR_CALIB_LSB1 0xb9
@@ -259,6 +260,13 @@ static int cap11xx_i2c_probe(struct i2c_client *i2c_client,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; + } +/* Provide some useful defaults */ for (i =0 ; i < priv->num_channels; i++) priv->keycodes[i] =KEY_A + i;
Signature · 1 line
1.9.1