linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Daniel Mack <zonque@gmail.com>
Cc: "dtor@mail.ru" <dtor@mail.ru>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"dh.herrmann@gmail.com" <dh.herrmann@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2] Input: Add driver for Microchip's CAP1106
Date: Mon, 14 Jul 2014 10:52:47 +0100	[thread overview]
Message-ID: <20140714095247.GB4980@leverpostej> (raw)
In-Reply-To: <1405073193-21448-1-git-send-email-zonque@gmail.com>

On Fri, Jul 11, 2014 at 11:06:33AM +0100, Daniel Mack wrote:
> This patch adds a driver for Microchips CAP1106, an I2C driven, 6-channel
> capacitive touch sensor.
> 
> For now, only the capacitive buttons are supported, and no specific
> settings that can be tweaked for individual channels, except for the
> device-wide sensitivity gain. The defaults seem to work just fine out of
> the box, so I'll leave configurable parameters for someone who's in need
> of them and who can actually measure the impact. All registers are
> prepared, however. Many of them are just not used for now.
> 
> The implementation does not make any attempt to be compatible to platform
> data driven boards, but fully depends on CONFIG_OF.
> 
> Power management functions are also left for volounteers with the ability
> to actually test them.
> 
> Signed-off-by: Daniel Mack <zonque@gmail.com>
> ---
> v2:
>  * Fix potential deadlocks pointed out by David.
> 
>  .../devicetree/bindings/input/cap1106.txt          |  63 ++++
>  drivers/input/keyboard/Kconfig                     |  10 +
>  drivers/input/keyboard/Makefile                    |   1 +
>  drivers/input/keyboard/cap1106.c                   | 378 +++++++++++++++++++++
>  4 files changed, 452 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/cap1106.txt
>  create mode 100644 drivers/input/keyboard/cap1106.c
> 
> diff --git a/Documentation/devicetree/bindings/input/cap1106.txt b/Documentation/devicetree/bindings/input/cap1106.txt
> new file mode 100644
> index 0000000..57f5af3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/cap1106.txt
> @@ -0,0 +1,63 @@
> +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.
> +       interrupt:              Node describing the interrupt line the device's
> +                               ALERT#/CM_IRQ# pin is connected to.

s/interrupt/interrupts/

This is a _property_, not a node.

I take it the device only has a single interrupt line?

> +
> +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.

Does the official documentation describe this in absolute terms?

> +
> +To define details of each individual button channel, six subnodes can be
> +specified. Inside each of those, the following property is valid:
> +
> +       linux,keycode:  Specify the numeric identifier of the keycode to be
> +                       generated when this channel is activated. If this
> +                       property is omitted, KEY_A, KEY_B, etc are used as
> +                       defaults.

What are those subnodes, and how are they told apart? Name, compatible?

I strongly recommend against relying on the order of the DT. It's very
easy for that to get messed up and makes things hard to read.

Is is not possible to use linux,keymap and treat the buttons as a
matrix keypad? Then you don't need subnodes at all, and you can have a
sparse keymap if you want.

[...]

> +struct cap1106_priv {
> +       struct regmap *regmap;
> +       struct input_dev *idev;
> +       struct work_struct work;
> +       spinlock_t lock;
> +       bool closed:1;

I don't think you're saving anything here by trying to have a bool
bitfield.

[...]

> +       i = 0;
> +       for_each_child_of_node(node, child) {
> +               if (i == CAP1106_NUM_CHN) {
> +                       dev_err(dev, "Too many button nodes.\n");
> +                       return -EINVAL;
> +               }
> +
> +               if (!of_property_read_u32(child, "linux,keycode", &tmp32))
> +                       priv->keycodes[i] = tmp32;
> +
> +               i++;
> +       }

I don't think that it is a good idea to rely on the order of sub-nodes
in the DTB.

[...]

> +       if (of_get_property(node, "autorepeat", NULL))
> +               __set_bit(EV_REP, priv->idev->evbit);

Use of_property_read_bool.

/me mutters usual grumblings about the autorepeat property.

Thanks,
Mark.

  reply	other threads:[~2014-07-14  9:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 10:06 [PATCH v2] Input: Add driver for Microchip's CAP1106 Daniel Mack
2014-07-14  9:52 ` Mark Rutland [this message]
2014-07-14 10:20   ` Daniel Mack
2014-07-15  8:51     ` Mark Rutland
2014-07-15  9:12       ` Daniel Mack
2014-07-15 14:42         ` Mark Rutland
2014-07-15 16:41       ` Dmitry Torokhov
2014-07-15 17:17         ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140714095247.GB4980@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dh.herrmann@gmail.com \
    --cc=dtor@mail.ru \
    --cc=linux-input@vger.kernel.org \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).