treewide: add vibrator support for various MSM SOCs
Subsystems (3)
v2 cover treewide: add vibrator support for various MSM SOCs
This patch set adds support for the vibrator found on various Qualcomm MSM SOCs. 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 on a LG Nexus 5 (hammerhead) phone using rumble-test:
https://git.collabora.com/cgit/user/sre/rumble-test.git/plain/rumble-test.c
Changes since v1
- Update device tree binding document based on feedback from Rob Herring.
- Changed the driver description to: Qualcomm PWM driver for the MSM vibrator.
Brian Masney (3):
dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator PWM
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
PATCH v2 1/3 dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator PWM
This patch adds the device tree bindings for the vibrator PWM 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
@@ -0,0 +1,38 @@ +* Device tree bindings for the vibrator PWM 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 PWM. + +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: pwm@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
PATCH v2 2/3 pwm: msm-vibrator: new driver for the vibrator found on various MSM SOCs
In reply to Brian MasneyThis 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
@@ -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 PWM driver for the MSM vibrator" + 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
@@ -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
PATCH v2 3/3 ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for vibrator
In reply to Brian MasneyThis 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
@@ -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: pwm@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
Quoted 6 lines · Brian Masney
This patch set adds support for the vibrator found on various Qualcomm MSM SOCs. 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
Quoted 6 lines
Jongrak Kwon and Devin Kim from
msm_pwm_vibrator.cin 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.cDriver was tested on a LG Nexus 5 (hammerhead) phone using rumble-test:
https://git.collabora.com/cgit/user/sre/rumble-test.git/plain/rumble-test.c
Looking at all of this it seems like this would be more appropriately implemented as a force-feedback input device directly. The only reason you seem to be making this a PWM driver is so that it can be used in conjunction with pwm-vibrator. The device itself doesn't seem to be a generic PWM in the way that the PWM framework expects it.
Thierry
Quoting Brian Masney (2018-09-26 16:51:09)
Quoted 2 lines
This patch set adds support for the vibrator found on various Qualcomm MSM SOCs. This is based on work from:
Can you please stop adding 'treewide:' to your cover letters? It is very confusing while reading over subject summaries to see something that isn't actually treewide end up being qcom specific.