Skip to contentSkip to conversation

treewide: add vibrator support for various MSM SOCs

PATCH Superseded Brian Masney 2 participants 6 messages Sep 19, 2018 – Sep 25, 2018

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover treewide: add vibrator support for various MSM SOCs

This patch set adds support for the vibrator found on various Qualcomm MSM SOCs. The driver was tested on a LG Nexus 5 (hammerhead) phone. This is based on work from:

Jonathan Marek from qcom,pwm-vibrator.c in the PostmarketOS repo:
https://gitlab.com/postmarketOS/linux-postmarketos/commit/7647fb36cb1cbd060f8b52087a68ab93583292b5

Jongrak Kwon and Devin Kim from msm_pwm_vibrator.c in the downstream Android 3.4.0 sources:
https://android.googlesource.com/kernel/msm/+/android-msm-lenok-3.10-lollipop-wear-release/drivers/misc/msm_pwm_vibrator.c

Driver was tested using rumble-test from:
https://git.collabora.com/cgit/user/sre/rumble-test.git/plain/rumble-test.c

Brian Masney (3):
dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver
pwm: msm-vibrator: new driver for the vibrator found on various MSM
SOCs
ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for
vibrator

 .../bindings/pwm/pwm-msm-vibrator.txt         |  38 +++
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    |  39 +++
 drivers/pwm/Kconfig                           |   9 +
 drivers/pwm/Makefile                          |   1 +
 drivers/pwm/pwm-msm-vibrator.c                | 227 ++++++++++++++++++
 5 files changed, 314 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
 create mode 100644 drivers/pwm/pwm-msm-vibrator.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver

This patch adds the device tree bindings for the pwm-msm-vibrator.c driver that supports the vibrator found on various Qualcomm MSM SOCs.

---
 .../bindings/pwm/pwm-msm-vibrator.txt         | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +38 -0
new file mode 100644
index 000000000000..4638a25345f9
@@ -0,0 +1,38 @@
+* PWM driver for the vibrator found on various MSM SOCs.
+
+Required properties:
+
+  - compatible: Should be one of
+		"qcom,msm8226-pwm-vibrator"
+		"qcom,msm8974-pwm-vibrator"
+  - reg: the base address and length of the IO memory for the registers.
+  - #pwm-cells: set to 3.
+  - pinctrl-names: set to default.
+  - pinctrl-0: phandles pointing to pin configuration nodes. See
+               Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+  - clock-names: set to pwm
+  - clocks: phandle of the clock used by the PWM module. See
+            Documentation/devicetree/bindings/clock/clock-bindings.txt
+  - enable-gpios: GPIO that enables the vibrator.
+
+Optional properties:
+
+  - vcc-supply: phandle to the regulator that provides power to the sensor.
+
+Example from a LG Nexus 5 (hammerhead) phone:
+
+msm_pwm_vibrator_enable: msm_pwm_vibrator@fd8c3450 {
+	reg = <0xfd8c3450 0x400>;
+	compatible = "qcom,msm8974-pwm-vibrator";
+	#pwm-cells = <3>;
+
+	vcc-supply = <&pm8941_l19>;
+
+	clocks = <&mmcc CAMSS_GP1_CLK>;
+	clock-names = "pwm";
+
+	enable-gpios = <&msmgpio 60 GPIO_ACTIVE_HIGH>;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&vibrator_pin>;
+};
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/3 pwm: msm-vibrator: new driver for the vibrator found on various MSM SOCs

In reply to Brian Masney

This patch adds a new PWM vibrator driver that supports various Qualcomm MSM SOCs. It is intended to be wired into the pwm-vibra driver in the input/misc/ subsystem via device tree. Driver was tested on a LG Nexus 5 (hammerhead) phone.

---
 drivers/pwm/Kconfig            |   9 ++
 drivers/pwm/Makefile           |   1 +
 drivers/pwm/pwm-msm-vibrator.c | 227 +++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
 create mode 100644 drivers/pwm/pwm-msm-vibrator.c
drivers/pwm/Kconfig +9 -0
index 504d252716f2..49dbcfd60f50 100644
@@ -273,6 +273,15 @@ config PWM_MESON
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-meson.
 
+config PWM_MSM_VIBRATOR
+	tristate "Qualcomm MSM vibrator PWM driver"
+	help
+	  PWM support for the vibrator that is found on various Qualcomm
+          MSM SOCs.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-msm-vibrator.
+
 config PWM_MTK_DISP
 	tristate "MediaTek display PWM driver"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/pwm/Makefile +1 -0
index 9c676a0dadf5..60fd9f9b0fbb 100644
@@ -27,6 +27,7 @@ obj-$(CONFIG_PWM_LPSS_PCI)	+= pwm-lpss-pci.o
 obj-$(CONFIG_PWM_LPSS_PLATFORM)	+= pwm-lpss-platform.o
 obj-$(CONFIG_PWM_MESON)		+= pwm-meson.o
 obj-$(CONFIG_PWM_MEDIATEK)	+= pwm-mediatek.o
+obj-$(CONFIG_PWM_MSM_VIBRATOR)	+= pwm-msm-vibrator.o
 obj-$(CONFIG_PWM_MTK_DISP)	+= pwm-mtk-disp.o
 obj-$(CONFIG_PWM_MXS)		+= pwm-mxs.o
 obj-$(CONFIG_PWM_OMAP_DMTIMER)	+= pwm-omap-dmtimer.o
drivers/pwm/pwm-msm-vibrator.c new file +227 -0

227 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw

PATCH 3/3 ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for vibrator

In reply to Brian Masney

This patch adds device device tree bindings for the vibrator found on the LG Nexus 5 (hammerhead) phone.

---
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +39 -0
index ed8f064d0895..e738a472cb99 100644
@@ -5,6 +5,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
+#include <dt-bindings/clock/qcom,mmcc-msm8974.h>
 
 / {
 	model = "LGE MSM 8974 HAMMERHEAD";
@@ -268,6 +269,44 @@
 				input-enable;
 			};
 		};
+
+		vibrator_pin: vibrator {
+			pwm {
+				pins = "gpio27";
+				function = "gp1_clk";
+
+				drive-strength = <6>;
+				bias-disable;
+			};
+
+			enable {
+				pins = "gpio60";
+				function = "gpio";
+			};
+		};
+	};
+
+	msm_pwm_vibrator_enable: msm_pwm_vibrator@fd8c3450 {
+		compatible = "qcom,msm8974-pwm-vibrator";
+		reg = <0xfd8c3450 0x400>;
+		#pwm-cells = <3>;
+
+		vcc-supply = <&pm8941_l19>;
+
+		clocks = <&mmcc CAMSS_GP1_CLK>;
+		clock-names = "pwm";
+
+		enable-gpios = <&msmgpio 60 GPIO_ACTIVE_HIGH>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&vibrator_pin>;
+	};
+
+	vibrator {
+		compatible = "pwm-vibrator";
+
+		pwms = <&msm_pwm_vibrator_enable 0 1000000000 0>;
+		pwm-names = "enable";
 	};
 
 	sdhci@f9824900 {
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver

In reply to Brian Masney
Quoted 2 lines · Brian Masney

This patch adds the device tree bindings for the pwm-msm-vibrator.c driver that supports the vibrator found on various Qualcomm MSM SOCs.

Bindings are for h/w, not some driver.

Quoted 13 lines
---
 .../bindings/pwm/pwm-msm-vibrator.txt         | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +0 -0
new file mode 100644
index 000000000000..4638a25345f9

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 1

Quoted 1 line
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +1 -0
@@ -0,0 +1,38 @@
+* PWM driver for the vibrator found on various MSM SOCs.

driver?

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 7

Quoted 6 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +6 -0
+
+Required properties:
+
+  - compatible: Should be one of
+		"qcom,msm8226-pwm-vibrator"
+		"qcom,msm8974-pwm-vibrator"

The block only works for a vibrator?

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 16

Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +9 -0
+  - reg: the base address and length of the IO memory for the registers.
+  - #pwm-cells: set to 3.
+  - pinctrl-names: set to default.
+  - pinctrl-0: phandles pointing to pin configuration nodes. See
+               Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+  - clock-names: set to pwm
+  - clocks: phandle of the clock used by the PWM module. See
+            Documentation/devicetree/bindings/clock/clock-bindings.txt
+  - enable-gpios: GPIO that enables the vibrator.

Shouldn't this go in the vibrator node as it is connected to the vibrator.

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 24

Quoted 8 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +8 -0
+
+Optional properties:
+
+  - vcc-supply: phandle to the regulator that provides power to the sensor.
+
+Example from a LG Nexus 5 (hammerhead) phone:
+
+msm_pwm_vibrator_enable: msm_pwm_vibrator@fd8c3450 {

pwm@...

Quoted 17 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +14 -0
+	reg = <0xfd8c3450 0x400>;
+	compatible = "qcom,msm8974-pwm-vibrator";
+	#pwm-cells = <3>;
+
+	vcc-supply = <&pm8941_l19>;
+
+	clocks = <&mmcc CAMSS_GP1_CLK>;
+	clock-names = "pwm";
+
+	enable-gpios = <&msmgpio 60 GPIO_ACTIVE_HIGH>;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&vibrator_pin>;
+};
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver

Hi Rob,

Quoted 5 lines · Rob Herring
Quoted 2 lines · Brian Masney

This patch adds the device tree bindings for the pwm-msm-vibrator.c driver that supports the vibrator found on various Qualcomm MSM SOCs.

Bindings are for h/w, not some driver.

OK, I will fix this and the other references in v2.

Quoted 7 lines

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 7

Quoted 5 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +5 -0
+Required properties:
+
+  - compatible: Should be one of
+		"qcom,msm8226-pwm-vibrator"
+		"qcom,msm8974-pwm-vibrator"

The block only works for a vibrator?

Yes.

I cannot find a publicly-available datasheet for the MSM8974 to see if there are other uses for this particular PWM available. The only thing that I have to work with right now is the downstream Android sources at
https://android.googlesource.com/kernel/msm/+/android-msm-lenok-3.10-lollipop-wear-release/drivers/misc/msm_pwm_vibrator.c.

Quoted 10 lines

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 16

Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +9 -0
+  - reg: the base address and length of the IO memory for the registers.
+  - #pwm-cells: set to 3.
+  - pinctrl-names: set to default.
+  - pinctrl-0: phandles pointing to pin configuration nodes. See
+               Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+  - clock-names: set to pwm
+  - clocks: phandle of the clock used by the PWM module. See
+            Documentation/devicetree/bindings/clock/clock-bindings.txt
+  - enable-gpios: GPIO that enables the vibrator.
Quoted 2 lines

Shouldn't this go in the vibrator node as it is connected to the vibrator.

This should be labeled "GPIO that enables the PWM".

Brian

Quoted 28 lines

Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt line 24

Quoted 8 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +8 -0
+
+Optional properties:
+
+  - vcc-supply: phandle to the regulator that provides power to the sensor.
+
+Example from a LG Nexus 5 (hammerhead) phone:
+
+msm_pwm_vibrator_enable: msm_pwm_vibrator@fd8c3450 {

pwm@...

Quoted 17 lines
Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt new file +14 -0
+	reg = <0xfd8c3450 0x400>;
+	compatible = "qcom,msm8974-pwm-vibrator";
+	#pwm-cells = <3>;
+
+	vcc-supply = <&pm8941_l19>;
+
+	clocks = <&mmcc CAMSS_GP1_CLK>;
+	clock-names = "pwm";
+
+	enable-gpios = <&msmgpio 60 GPIO_ACTIVE_HIGH>;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&vibrator_pin>;
+};
Signature · 1 line
2.17.1