Skip to contentSkip to conversation

Add support for MediaTek regulator vibrator driver

PATCH In review Xing Zhang 3 participants 7 messages Apr 29, 2020 – May 7, 2020

Subsystems (3)
lore
Share & tools
lore

Xing Zhang

author
#0 lore raw

PATCH 1/1 Add support for MediaTek regulator vibrator driver

This patchset add regulator vibrator driver for MTK Soc. The driver controls vibrator through regulator's enable and disable.

Xing Zhang (3):
dt-bindings: add regulator vibrator documentation
arm64: mediatek: Add regulator vibrator support
Vibrator: Add regulator vibrator driver

 .../bindings/leds/regulator-vibrator.txt      |  39 ++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/leds/Kconfig                          |  10 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/regulator-vibrator.c             | 450 ++++++++++++++++++
 5 files changed, 501 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/regulator-vibrator.txt
 create mode 100644 drivers/leds/regulator-vibrator.c
author
#1 lore raw

PATCH 1/3 dt-bindings: add regulator vibrator documentation

From: Xing Zhang <[email protected]>

Add the DT binding documentation for regulator vibrator

Change-Id I6a2350b1bac46cf90d6122c6de6cfecddb696928
---
 .../bindings/leds/regulator-vibrator.txt      | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/regulator-vibrator.txt
Documentation/devicetree/bindings/leds/regulator-vibrator.txt new file +39 -0
new file mode 100644
index 000000000000..8f45d3ed13bd
@@ -0,0 +1,39 @@
+* Regulator vibrator device tree bindings
+
+Required Properties:
+ - compatible : Should be "regulator-vibrator"
+ - vibr-supply : Power supply to the vibrator.
+	[*] refer Documentation/devicetree/bindings/regulator/regulator.txt
+
+ - max-volt : The maximum voltage value supplied to the vibrator regulator.
+		[The unit of the voltage is a micro]
+
+ - min-volt : The minimum voltage value supplied to the vibrator regulator.
+		[The unit of the voltage is a micro]
+
+Optional properties:
+ - min-limit : Set the minimum time in ms for vibrator , default is 15ms,
+		if user request duration is smaller, this value will be used instead.
+		the default value comes from the smallest unit that can be sensed.
+
+ - max-limit : Set the maximum time in ms for vibrator.
+		if not set, it means no max limitation.
+
+Example:
+
+	mt6359_vibr_ldo_reg: ldo_vibr {
+		regulator-name = "vibr";
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-enable-ramp-delay = <240>;
+	};
+
+	regulator_vibrator {
+		compatible = "regulator-vibrator";
+		min-volt = <2300000>;
+		max-volt = <3200000>;
+		max-limit = <15000>;
+		min-limit = <15>;
+		vib-supply = <&mt6359_vibr_ldo_reg>;
+	};
+
Signature · 1 line
2.18.0
author
#2 lore raw

PATCH 2/3 arm64: mediatek: Add regulator vibrator support

In reply to Xing Zhang

From: Xing Zhang <[email protected]>

Add CONFIG_LEDS_REGULATOR_VIBRATOR=y in defconfig

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index 24e534d85045..29287e525b46 100644
@@ -723,6 +723,7 @@ CONFIG_LEDS_CLASS=y
 CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_PWM=y
 CONFIG_LEDS_SYSCON=y
+CONFIG_LEDS_REGULATOR_VIBRATOR=y
 CONFIG_LEDS_TRIGGER_DISK=y
 CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_CPU=y
Signature · 1 line
2.18.0
author
#3 lore raw

PATCH 3/3 Vibrator: Add regulator vibrator driver

In reply to Xing Zhang

From: Xing Zhang <[email protected]>

This adds support for trgulator vibrator
The vibration time is controlled by a timer,
just like other led devices

---
 drivers/leds/Kconfig              |  10 +
 drivers/leds/Makefile             |   1 +
 drivers/leds/regulator-vibrator.c | 450 ++++++++++++++++++++++++++++++
 3 files changed, 461 insertions(+)
 create mode 100644 drivers/leds/regulator-vibrator.c
drivers/leds/Kconfig +10 -0
index c664d84e1667..190046e8d386 100644
@@ -846,6 +846,16 @@ config LEDS_TPS6105X
 	  It is a single boost converter primarily for white LEDs and
 	  audio amplifiers.
 
+config LEDS_REGULATOR_VIBRATOR
+	tristate "LED regulator vibrator support"
+	depends on LEDS_CLASS
+	help
+	  This option enables support for LED regulator vibrator.
+	  say 'y' to enable this
+
+	  To compile this driver as a module, choose 'M' here: the module
+	  will be called regulator-vibrator.
+
 config LEDS_IP30
 	tristate "LED support for SGI Octane machines"
 	depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
index 45235d5fb218..46c7bdc51f99 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_LEDS_LM3532)		+= leds-lm3532.o
 obj-$(CONFIG_LEDS_LM3533)		+= leds-lm3533.o
 obj-$(CONFIG_LEDS_LM355x)		+= leds-lm355x.o
 obj-$(CONFIG_LEDS_LM3601X)		+= leds-lm3601x.o
+obj-$(CONFIG_LEDS_LM3697)		+= leds-lm3697.o
 obj-$(CONFIG_LEDS_LM36274)		+= leds-lm36274.o
 obj-$(CONFIG_LEDS_LM3642)		+= leds-lm3642.o
 obj-$(CONFIG_LEDS_LM3692X)		+= leds-lm3692x.o
drivers/leds/regulator-vibrator.c new file +450 -0

450 lines not on this page · raw message

Signature · 1 line
2.18.0
#4 lore raw
In reply to Xing Zhang

Hi!

Quoted 2 lines

This patchset add regulator vibrator driver for MTK Soc. The driver controls vibrator through regulator's enable and disable.

We'd prefer not to have vibrators in led subsystem.

Quoted 11 lines

Xing Zhang (3):
dt-bindings: add regulator vibrator documentation
arm64: mediatek: Add regulator vibrator support
Vibrator: Add regulator vibrator driver

 .../bindings/leds/regulator-vibrator.txt      |  39 ++
 arch/arm64/configs/defconfig                  |   1 +
 drivers/leds/Kconfig                          |  10 +
 drivers/leds/Makefile                         |   1 +
 drivers/leds/regulator-vibrator.c             | 450 ++++++++++++++++++

OTOH, connecting LED to regulator might make some sense. I can take the driver with vibrator functionality stripped, provided it is named the usual way...

Best regards,
Pavel

#5 lore raw

Hi Pavel,

Quoted 13 lines · Pavel Machek

Hi!

Quoted 2 lines

This patchset add regulator vibrator driver for MTK Soc. The driver controls vibrator through regulator's enable and disable.

We'd prefer not to have vibrators in led subsystem.

Quoted 6 lines

Xing Zhang (3):
dt-bindings: add regulator vibrator documentation
arm64: mediatek: Add regulator vibrator support
Vibrator: Add regulator vibrator driver

Quoted 8 lines
Quoted 5 lines
  .../bindings/leds/regulator-vibrator.txt      |  39 ++
  arch/arm64/configs/defconfig                  |   1 +
  drivers/leds/Kconfig                          |  10 +
  drivers/leds/Makefile                         |   1 +
  drivers/leds/regulator-vibrator.c             | 450 ++++++++++++++++++

OTOH, connecting LED to regulator might make some sense. I can take the driver with vibrator functionality stripped, provided it is named the usual way...

We already had an attempt of solving this in more generic way [0], but you opposed then [1]. Just for the record.

[0] https://lore.kernel.org/linux-leds/[email protected]/
[1] https://lore.kernel.org/linux-leds/20170914205804.GA24339@amd/

Signature · 2 lines
Best regards,
Jacek Anaszewski
#6 lore raw
Quoted 22 lines · Jacek Anaszewski

Hi Pavel,

Quoted 19 lines · Pavel Machek

Hi!

Quoted 2 lines

This patchset add regulator vibrator driver for MTK Soc. The driver controls vibrator through regulator's enable and disable.

We'd prefer not to have vibrators in led subsystem.

Quoted 11 lines

Xing Zhang (3):
dt-bindings: add regulator vibrator documentation
arm64: mediatek: Add regulator vibrator support
Vibrator: Add regulator vibrator driver

  .../bindings/leds/regulator-vibrator.txt      |  39 ++
  arch/arm64/configs/defconfig                  |   1 +
  drivers/leds/Kconfig                          |  10 +
  drivers/leds/Makefile                         |   1 +
  drivers/leds/regulator-vibrator.c             | 450 ++++++++++++++++++
Quoted 5 lines
Quoted 2 lines

OTOH, connecting LED to regulator might make some sense. I can take the driver with vibrator functionality stripped, provided it is named the usual way...

We already had an attempt of solving this in more generic way [0], but you opposed then [1]. Just for the record.

That's something different. led-regulator.c might be acceptable. Special code to support vibrator quirks... not so much.

Best regards,

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html