Re: [PATCH v3] Input: rotary_encoder - support binary encoding of states

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, Apr 7, 2016 at 1:58 PM, Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> It's not advisable to use this encoding, but to support existing devices
> add support for this to the driver.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---

Ack for the binding, but...

> @@ -213,6 +222,17 @@ static int rotary_encoder_probe(struct platform_device *pdev)
>         encoder->rollover =
>                 device_property_read_bool(dev, "rotary-encoder,rollover");
>
> +       err = device_property_read_string(dev, "rotary-encoder,encoding",
> +                                         &encoding);
> +       if (!err && !strcmp(encoding, "binary")) {
> +               encoder->encoding = ROTENC_BINARY;
> +       } else if (err || !strcmp(encoding, "gray")) {
> +               encoder->encoding = ROTENC_GRAY;
> +       } else {
> +               dev_err(dev, "unknown encoding setting");
> +               return -EINVAL;

device_property_match_string() here instead.

> +       }
> +
>         device_property_read_u32(dev, "linux,axis", &encoder->axis);
>         encoder->relative_axis =
>                 device_property_read_bool(dev, "rotary-encoder,relative-axis");
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux