[PATCH 0/4] Add support for vibrator motor for TBS A711 Tablet

32 views
Skip to first unread message

Ondrej Jirman

unread,
Feb 22, 2020, 6:14:34 PM2/22/20
to linux...@googlegroups.com, Dmitry Torokhov, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Ondrej Jirman, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
The tablet has a vibrator. Expose it via input subsystem (EV_FF).

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (4):
dt-bindings: input: gpio-vibrator: Don't require enable-gpios
input: gpio-vibra: Allow to use vcc-supply alone to control the
vibrator
ARM: dts: sun8i-a83t-tbs-a711: Add support for the vibrator motor
ARM: dts: sun8i-a83t-tbs-a711: Increase voltage on the vibrator

.../devicetree/bindings/input/gpio-vibrator.yaml | 1 -
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 9 +++++++--
drivers/input/misc/gpio-vibra.c | 3 ++-
3 files changed, 9 insertions(+), 4 deletions(-)

--
2.25.1

Ondrej Jirman

unread,
Feb 22, 2020, 6:14:34 PM2/22/20
to linux...@googlegroups.com, Dmitry Torokhov, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Ondrej Jirman, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
It is possible to turn the motor on/off just by enabling/disabling
the vcc-supply.

Signed-off-by: Ondrej Jirman <meg...@megous.com>
---
Documentation/devicetree/bindings/input/gpio-vibrator.yaml | 1 -
1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/input/gpio-vibrator.yaml b/Documentation/devicetree/bindings/input/gpio-vibrator.yaml
index b98bf9363c8ff..f8f4093a0a454 100644
--- a/Documentation/devicetree/bindings/input/gpio-vibrator.yaml
+++ b/Documentation/devicetree/bindings/input/gpio-vibrator.yaml
@@ -24,7 +24,6 @@ properties:

required:
- compatible
- - enable-gpios

examples:
- |
--
2.25.1

Ondrej Jirman

unread,
Feb 22, 2020, 6:14:35 PM2/22/20
to linux...@googlegroups.com, Dmitry Torokhov, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Ondrej Jirman, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
Make enable-gpio optional to allow using this driver with
boards that have vibrator connected to a power supply without
intermediate gpio based enable circuitry.

Signed-off-by: Ondrej Jirman <meg...@megous.com>
---
drivers/input/misc/gpio-vibra.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c
index f79f75595dd73..f11877f04b43c 100644
--- a/drivers/input/misc/gpio-vibra.c
+++ b/drivers/input/misc/gpio-vibra.c
@@ -121,7 +121,8 @@ static int gpio_vibrator_probe(struct platform_device *pdev)
return err;
}

- vibrator->gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW);
+ vibrator->gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
+ GPIOD_OUT_LOW);
err = PTR_ERR_OR_ZERO(vibrator->gpio);
if (err) {
if (err != -EPROBE_DEFER)
--
2.25.1

Ondrej Jirman

unread,
Feb 22, 2020, 6:14:36 PM2/22/20
to linux...@googlegroups.com, Dmitry Torokhov, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Ondrej Jirman, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
The board has a vibrator mottor. Hook it to the input subsystem.

Signed-off-by: Ondrej Jirman <meg...@megous.com>
---
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index 2fd31a0a0b344..a22920275e99b 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -99,6 +99,11 @@ panel_input: endpoint {
};
};

+ vibrator {
+ compatible = "gpio-vibrator";
+ vcc-supply = <&reg_ldo_io1>;
+ };
+
reg_gps: reg-gps {
compatible = "regulator-fixed";
regulator-name = "gps";
--
2.25.1

Ondrej Jirman

unread,
Feb 22, 2020, 6:14:36 PM2/22/20
to linux...@googlegroups.com, Dmitry Torokhov, Rob Herring, Maxime Ripard, Chen-Yu Tsai, Ondrej Jirman, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
Vibrator motor is weak at the current voltage. Increase the voltage.

Signed-off-by: Ondrej Jirman <meg...@megous.com>
---
arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index a22920275e99b..314491cdafca2 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -434,8 +434,8 @@ &reg_ldo_io0 {
};

&reg_ldo_io1 {
- regulator-min-microvolt = <3100000>;
- regulator-max-microvolt = <3100000>;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
regulator-name = "vcc-vb";
status = "okay";
};
--
2.25.1

Ondřej Jirman

unread,
Feb 24, 2020, 9:14:42 AM2/24/20
to Maxime Ripard, linux...@googlegroups.com, Dmitry Torokhov, Rob Herring, Chen-Yu Tsai, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
Hello,

On Mon, Feb 24, 2020 at 10:10:59AM +0100, Maxime Ripard wrote:
> Hi,
>
> On Sun, Feb 23, 2020 at 12:14:27AM +0100, Ondrej Jirman wrote:
> > The board has a vibrator mottor. Hook it to the input subsystem.
> >
> > Signed-off-by: Ondrej Jirman <meg...@megous.com>
> > ---
> > arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> > index 2fd31a0a0b344..a22920275e99b 100644
> > --- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> > +++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
> > @@ -99,6 +99,11 @@ panel_input: endpoint {
> > };
> > };
> >
> > + vibrator {
> > + compatible = "gpio-vibrator";
> > + vcc-supply = <&reg_ldo_io1>;
> > + };
> > +
>
> LDO IO1 can also be muxed in as a GPIO iirc, why did you choose the
> regulator instead?

According to the specification, LDO needs to be enabled (value 0b11)
to achieve the specified max driving current of 150mA:

https://megous.com/dl/tmp/92b7d9d94820c3ba.png

Otherwise the chip is probably just using the regular CMOS logic output
(typically limited to around 20-35mA, but not specified in this datasheet),
which would be probably overdriven, if we try to drive the motor with it.

And since we're driving a motor directly, the more the better.

thank you and regards,
o.

> Maxime


Rob Herring

unread,
Feb 26, 2020, 5:25:31 PM2/26/20
to Ondrej Jirman, linux...@googlegroups.com, Dmitry Torokhov, Chen-Yu Tsai, Ondrej Jirman, Mark Rutland, Luca Weiss, Tomas Novotny, linux...@vger.kernel.org, devic...@vger.kernel.org, linux-...@vger.kernel.org, linux-ar...@lists.infradead.org
On Sun, 23 Feb 2020 00:14:25 +0100, Ondrej Jirman wrote:
> It is possible to turn the motor on/off just by enabling/disabling
> the vcc-supply.
>
> Signed-off-by: Ondrej Jirman <meg...@megous.com>
> ---
> Documentation/devicetree/bindings/input/gpio-vibrator.yaml | 1 -
> 1 file changed, 1 deletion(-)
>

Acked-by: Rob Herring <ro...@kernel.org>
Reply all
Reply to author
Forward
0 new messages