Message ID | 20190412150625.28384-1-luca@z3ntu.xyz |
---|---|
State | Superseded, archived |
Headers | show |
Series | [v3,1/3] dt-bindings: input: add GPIO controllable vibrator | expand |
Context | Check | Description |
---|---|---|
robh/checkpatch | success |
Quoting Luca Weiss (2019-04-12 08:06:24) > diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c > new file mode 100644 > index 000000000000..3fd2dfd4f670 > --- /dev/null > +++ b/drivers/input/misc/gpio-vibra.c > @@ -0,0 +1,209 @@ > + > +static int gpio_vibrator_probe(struct platform_device *pdev) > +{ [...] > + vibrator->input->id.bustype = BUS_HOST; > + vibrator->input->close = gpio_vibrator_close; > + > + input_set_drvdata(vibrator->input, vibrator); > + input_set_capability(vibrator->input, EV_FF, FF_RUMBLE); > + > + err = input_ff_create_memless(vibrator->input, NULL, > + gpio_vibrator_play_effect); > + if (err) { > + dev_err(&pdev->dev, "Couldn't create FF dev: %d", err); > + return err; > + } > + > + err = input_register_device(vibrator->input); > + if (err) { > + dev_err(&pdev->dev, "Couldn't register input dev: %d", err); All the printks in this file need a newline. > + return err; > + } > + > + platform_set_drvdata(pdev, vibrator); > + > + return 0; > +} > + > + > +#ifdef CONFIG_OF > +static const struct of_device_id gpio_vibra_dt_match_table[] = { > + { .compatible = "gpio-vibrator" }, > + {}, Nitpick: Drop the comma on the sentinel so nothing can go after it without causing a compilation error. > +}; > +MODULE_DEVICE_TABLE(of, gpio_vibra_dt_match_table); > +#endif > +
On Freitag, 12. April 2019 19:43:52 CEST Stephen Boyd wrote: > Quoting Luca Weiss (2019-04-12 08:06:24) > > > diff --git a/drivers/input/misc/gpio-vibra.c > > b/drivers/input/misc/gpio-vibra.c new file mode 100644 > > index 000000000000..3fd2dfd4f670 > > --- /dev/null > > +++ b/drivers/input/misc/gpio-vibra.c > > @@ -0,0 +1,209 @@ > > + > > +static int gpio_vibrator_probe(struct platform_device *pdev) > > +{ > > [...] > > > + vibrator->input->id.bustype = BUS_HOST; > > + vibrator->input->close = gpio_vibrator_close; > > + > > + input_set_drvdata(vibrator->input, vibrator); > > + input_set_capability(vibrator->input, EV_FF, FF_RUMBLE); > > + > > + err = input_ff_create_memless(vibrator->input, NULL, > > + gpio_vibrator_play_effect); > > + if (err) { > > + dev_err(&pdev->dev, "Couldn't create FF dev: %d", err); > > + return err; > > + } > > + > > + err = input_register_device(vibrator->input); > > + if (err) { > > + dev_err(&pdev->dev, "Couldn't register input dev: %d", > > err); > All the printks in this file need a newline. Fixed. > > + return err; > > + } > > + > > + platform_set_drvdata(pdev, vibrator); > > + > > + return 0; > > +} > > + > > + > > +#ifdef CONFIG_OF > > +static const struct of_device_id gpio_vibra_dt_match_table[] = { > > + { .compatible = "gpio-vibrator" }, > > + {}, > > Nitpick: Drop the comma on the sentinel so nothing can go after it > without causing a compilation error. Changed as well. > > +}; > > +MODULE_DEVICE_TABLE(of, gpio_vibra_dt_match_table); > > +#endif > > + Thanks for the review! Will send a v4 shortly. Luca
On Freitag, 12. April 2019 17:06:23 CEST Luca Weiss wrote: > Provide a simple driver for GPIO controllable vibrators. > It will be used by the Fairphone 2. > > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > --- > .../bindings/input/gpio-vibrator.txt | 20 +++++++++++++++++++ > 1 file changed, 20 insertions(+) > create mode 100644 > Documentation/devicetree/bindings/input/gpio-vibrator.txt > > diff --git a/Documentation/devicetree/bindings/input/gpio-vibrator.txt > b/Documentation/devicetree/bindings/input/gpio-vibrator.txt new file mode > 100644 > index 000000000000..93e5a8e7622d > --- /dev/null > +++ b/Documentation/devicetree/bindings/input/gpio-vibrator.txt > @@ -0,0 +1,20 @@ > +* GPIO vibrator device tree bindings > + > +Registers a GPIO device as vibrator, where the vibration motor just has the > +capability to turn on or off. If the device is connected to a pwm, you > should +use the pwm-vibrator driver instead. > + > +Required properties: > +- compatible: should contain "gpio-vibrator" > +- enable-gpios: Should contain a GPIO handle > + > +Optional properties: > +- vcc-supply: Phandle for the regulator supplying power > + > +Example from Fairphone 2: > + > +vibrator { > + compatible = "gpio-vibrator"; > + enable-gpios = <&msmgpio 86 GPIO_ACTIVE_HIGH>; > + vcc-supply = <&pm8941_l18>; > +}; I see that the yaml based device tree binding docs seem to be the new hotness? Is there any "policy" / preference about new drivers? Luca
On Wed, Apr 17, 2019 at 11:02 AM Luca Weiss <luca@z3ntu.xyz> wrote: > > On Freitag, 12. April 2019 17:06:23 CEST Luca Weiss wrote: > > Provide a simple driver for GPIO controllable vibrators. > > It will be used by the Fairphone 2. > > > > Signed-off-by: Luca Weiss <luca@z3ntu.xyz> > > --- > > .../bindings/input/gpio-vibrator.txt | 20 +++++++++++++++++++ > > 1 file changed, 20 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/input/gpio-vibrator.txt > > > > diff --git a/Documentation/devicetree/bindings/input/gpio-vibrator.txt > > b/Documentation/devicetree/bindings/input/gpio-vibrator.txt new file mode > > 100644 > > index 000000000000..93e5a8e7622d > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/input/gpio-vibrator.txt > > @@ -0,0 +1,20 @@ > > +* GPIO vibrator device tree bindings > > + > > +Registers a GPIO device as vibrator, where the vibration motor just has the > > +capability to turn on or off. If the device is connected to a pwm, you > > should +use the pwm-vibrator driver instead. > > + > > +Required properties: > > +- compatible: should contain "gpio-vibrator" > > +- enable-gpios: Should contain a GPIO handle > > + > > +Optional properties: > > +- vcc-supply: Phandle for the regulator supplying power > > + > > +Example from Fairphone 2: > > + > > +vibrator { > > + compatible = "gpio-vibrator"; > > + enable-gpios = <&msmgpio 86 GPIO_ACTIVE_HIGH>; > > + vcc-supply = <&pm8941_l18>; > > +}; > > I see that the yaml based device tree binding docs seem to be the new hotness? > Is there any "policy" / preference about new drivers? Not required yet, but welcomed. It's still a trickle so we can work out any issues and in some cases the common bindings still need to be done. I'm starting to ask subsystem maintainers to require DT schemas though. This one looks straightforward to use the schema. Rob
diff --git a/Documentation/devicetree/bindings/input/gpio-vibrator.txt b/Documentation/devicetree/bindings/input/gpio-vibrator.txt new file mode 100644 index 000000000000..93e5a8e7622d --- /dev/null +++ b/Documentation/devicetree/bindings/input/gpio-vibrator.txt @@ -0,0 +1,20 @@ +* GPIO vibrator device tree bindings + +Registers a GPIO device as vibrator, where the vibration motor just has the +capability to turn on or off. If the device is connected to a pwm, you should +use the pwm-vibrator driver instead. + +Required properties: +- compatible: should contain "gpio-vibrator" +- enable-gpios: Should contain a GPIO handle + +Optional properties: +- vcc-supply: Phandle for the regulator supplying power + +Example from Fairphone 2: + +vibrator { + compatible = "gpio-vibrator"; + enable-gpios = <&msmgpio 86 GPIO_ACTIVE_HIGH>; + vcc-supply = <&pm8941_l18>; +};
Provide a simple driver for GPIO controllable vibrators. It will be used by the Fairphone 2. Signed-off-by: Luca Weiss <luca@z3ntu.xyz> --- .../bindings/input/gpio-vibrator.txt | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/gpio-vibrator.txt