All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] treewide: add vibrator support for various MSM SOCs
@ 2018-09-19 15:09 Brian Masney
  2018-09-19 15:09 ` [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver Brian Masney
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Brian Masney @ 2018-09-19 15:09 UTC (permalink / raw)
  To: thierry.reding, linux-pwm, andy.gross, david.brown, robh+dt,
	mark.rutland, linux-arm-msm, linux-soc, devicetree, linux-kernel
  Cc: sebastian.reichel, masneyb

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

-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver
  2018-09-19 15:09 [PATCH 0/3] treewide: add vibrator support for various MSM SOCs Brian Masney
@ 2018-09-19 15:09 ` Brian Masney
  2018-09-24 22:01   ` Rob Herring
  2018-09-19 15:09 ` [PATCH 2/3] pwm: msm-vibrator: new driver for the vibrator found on various MSM SOCs Brian Masney
  2018-09-19 15:09 ` [PATCH 3/3] ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for vibrator Brian Masney
  2 siblings, 1 reply; 6+ messages in thread
From: Brian Masney @ 2018-09-19 15:09 UTC (permalink / raw)
  To: thierry.reding, linux-pwm, andy.gross, david.brown, robh+dt,
	mark.rutland, linux-arm-msm, linux-soc, devicetree, linux-kernel
  Cc: sebastian.reichel, masneyb

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

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 .../bindings/pwm/pwm-msm-vibrator.txt         | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt

diff --git a/Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt b/Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
new file mode 100644
index 000000000000..4638a25345f9
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
@@ -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>;
+};
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] pwm: msm-vibrator: new driver for the vibrator found on various MSM SOCs
  2018-09-19 15:09 [PATCH 0/3] treewide: add vibrator support for various MSM SOCs Brian Masney
  2018-09-19 15:09 ` [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver Brian Masney
@ 2018-09-19 15:09 ` Brian Masney
  2018-09-19 15:09 ` [PATCH 3/3] ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for vibrator Brian Masney
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Masney @ 2018-09-19 15:09 UTC (permalink / raw)
  To: thierry.reding, linux-pwm, andy.gross, david.brown, robh+dt,
	mark.rutland, linux-arm-msm, linux-soc, devicetree, linux-kernel
  Cc: sebastian.reichel, masneyb

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.

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 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

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 504d252716f2..49dbcfd60f50 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -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
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 9c676a0dadf5..60fd9f9b0fbb 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -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
diff --git a/drivers/pwm/pwm-msm-vibrator.c b/drivers/pwm/pwm-msm-vibrator.c
new file mode 100644
index 000000000000..00ec40885eb4
--- /dev/null
+++ b/drivers/pwm/pwm-msm-vibrator.c
@@ -0,0 +1,227 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * PWM driver for the vibrator found on various MSM SOCs.
+ *
+ * Copyright (c) 2018 Brian Masney <masneyb@onstation.org>
+ *
+ * Based on qcom,pwm-vibrator.c from:
+ * Copyright (c) 2018 Jonathan Marek <jonathan@marek.ca>
+ *
+ * Based on msm_pwm_vibrator.c from downstream Android sources:
+ * Copyright (C) 2009-2014 LGE, Inc.
+ */
+
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/pwm.h>
+#include <linux/regulator/consumer.h>
+
+#define REG_CMD_RCGR		0x00
+#define REG_CFG_RCGR		0x04
+#define REG_M			0x08
+#define REG_N			0x0C
+#define REG_D			0x10
+#define REG_CBCR		0x24
+#define MMSS_CC_M_DEFAULT	1
+
+struct msm_vibra_pwm {
+	struct pwm_chip chip;
+	struct device *dev;
+	void __iomem *base;
+	struct regulator *vcc;
+	struct clk *clk;
+	struct gpio_desc *enable_gpio;
+	bool enabled;
+};
+
+#define to_msm_vibra_pwm(pwm_chip) \
+	container_of(pwm_chip, struct msm_vibra_pwm, chip)
+
+#define msm_vibra_pwm_write(msm_pwm, offset, value) \
+	writel((value), (void __iomem *)((msm_pwm)->base + (offset)))
+
+static int msm_vibra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
+				int duty_ns, int period_ns)
+{
+	struct msm_vibra_pwm *msm_pwm = to_msm_vibra_pwm(chip);
+	int d_reg_val;
+
+	d_reg_val = 127 - (((duty_ns / 1000) * 126) / (period_ns / 1000));
+
+	msm_vibra_pwm_write(msm_pwm, REG_CFG_RCGR,
+			    (2 << 12) | /* dual edge mode */
+			    (0 << 8) |  /* cxo */
+			    (7 << 0));
+	msm_vibra_pwm_write(msm_pwm, REG_M, 1);
+	msm_vibra_pwm_write(msm_pwm, REG_N, 128);
+	msm_vibra_pwm_write(msm_pwm, REG_D, d_reg_val);
+	msm_vibra_pwm_write(msm_pwm, REG_CMD_RCGR, 1);
+	msm_vibra_pwm_write(msm_pwm, REG_CBCR, 1);
+
+	return 0;
+}
+
+static int msm_vibra_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+	struct msm_vibra_pwm *msm_pwm = to_msm_vibra_pwm(chip);
+	int ret;
+
+	ret = clk_set_rate(msm_pwm->clk, 24000);
+	if (ret) {
+		dev_err(msm_pwm->dev, "Failed to set clock rate: %d\n", ret);
+		return ret;
+	}
+
+	ret = clk_prepare_enable(msm_pwm->clk);
+	if (ret) {
+		dev_err(msm_pwm->dev, "Failed to enable clock: %d\n", ret);
+		return ret;
+	}
+
+	ret = regulator_enable(msm_pwm->vcc);
+	if (ret) {
+		dev_err(msm_pwm->dev, "Failed to enable regulator: %d\n", ret);
+		return ret;
+	}
+
+	gpiod_set_value_cansleep(msm_pwm->enable_gpio, 1);
+	msm_pwm->enabled = true;
+
+	return 0;
+}
+
+static void msm_vibra_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+	struct msm_vibra_pwm *msm_pwm = to_msm_vibra_pwm(chip);
+
+	gpiod_set_value_cansleep(msm_pwm->enable_gpio, 0);
+	regulator_disable(msm_pwm->vcc);
+	clk_disable_unprepare(msm_pwm->clk);
+	msm_pwm->enabled = false;
+}
+
+static const struct pwm_ops msm_vibra_pwm_ops = {
+	.config = msm_vibra_pwm_config,
+	.enable = msm_vibra_pwm_enable,
+	.disable = msm_vibra_pwm_disable,
+	.owner = THIS_MODULE,
+};
+
+static int msm_vibra_pwm_probe(struct platform_device *pdev)
+{
+	struct msm_vibra_pwm *msm_pwm;
+	struct resource *res;
+
+	msm_pwm = devm_kzalloc(&pdev->dev, sizeof(*msm_pwm), GFP_KERNEL);
+	if (!msm_pwm)
+		return -ENOMEM;
+
+	msm_pwm->dev = &pdev->dev;
+
+	msm_pwm->vcc = devm_regulator_get(&pdev->dev, "vcc");
+	if (IS_ERR(msm_pwm->vcc)) {
+		if (PTR_ERR(msm_pwm->vcc) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Failed to get regulator: %ld\n",
+				PTR_ERR(msm_pwm->vcc));
+		return PTR_ERR(msm_pwm->vcc);
+	}
+
+	msm_pwm->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
+						       GPIOD_OUT_LOW);
+	if (IS_ERR(msm_pwm->enable_gpio)) {
+		dev_err(&pdev->dev, "Failed to get enable gpio: %ld\n",
+			PTR_ERR(msm_pwm->enable_gpio));
+		return PTR_ERR(msm_pwm->enable_gpio);
+	}
+
+	msm_pwm->clk = devm_clk_get(&pdev->dev, "pwm");
+	if (IS_ERR(msm_pwm->clk)) {
+		dev_err(&pdev->dev, "Failed to lookup pwm clock: %ld\n",
+			PTR_ERR(msm_pwm->clk));
+		return PTR_ERR(msm_pwm->clk);
+	}
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "Failed to get platform resource\n");
+		return -ENODEV;
+	}
+
+	msm_pwm->base = devm_ioremap(&pdev->dev, res->start,
+				     resource_size(res));
+	if (IS_ERR(msm_pwm->base)) {
+		dev_err(&pdev->dev, "Failed to iomap resource: %ld\n",
+			PTR_ERR(msm_pwm->base));
+		return PTR_ERR(msm_pwm->base);
+	}
+
+	msm_pwm->chip.dev = &pdev->dev;
+	msm_pwm->chip.ops = &msm_vibra_pwm_ops;
+	msm_pwm->enabled = false;
+	msm_pwm->chip.npwm = 1;
+	msm_pwm->chip.of_xlate = of_pwm_xlate_with_flags;
+	msm_pwm->chip.of_pwm_n_cells = 3;
+
+	platform_set_drvdata(pdev, msm_pwm);
+
+	return pwmchip_add(&msm_pwm->chip);
+}
+
+static __maybe_unused int msm_vibra_pwm_suspend(struct device *dev)
+{
+	struct msm_vibra_pwm *msm_pwm = dev_get_drvdata(dev);
+	struct pwm_device *pwm = msm_pwm->chip.pwms;
+
+	if (msm_pwm->enabled)
+		msm_vibra_pwm_disable(&msm_pwm->chip, pwm);
+
+	return 0;
+}
+
+static __maybe_unused int msm_vibra_pwm_resume(struct device *dev)
+{
+	return 0;
+}
+
+static int msm_vibra_pwm_remove(struct platform_device *pdev)
+{
+	struct msm_vibra_pwm *msm_pwm = platform_get_drvdata(pdev);
+	struct pwm_device *pwm = msm_pwm->chip.pwms;
+
+	if (msm_pwm->enabled)
+		msm_vibra_pwm_disable(&msm_pwm->chip, pwm);
+
+	return pwmchip_remove(&msm_pwm->chip);
+}
+
+static const struct of_device_id msm_vibra_pwm_of_match[] = {
+	{ .compatible = "qcom,msm8226-pwm-vibrator" },
+	{ .compatible = "qcom,msm8974-pwm-vibrator" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, msm_vibra_pwm_of_match);
+
+static const struct dev_pm_ops msm_vibra_pwm_pm_ops = {
+	.suspend = msm_vibra_pwm_suspend,
+	.resume  = msm_vibra_pwm_resume,
+};
+
+static struct platform_driver msm_vibra_pwm_driver = {
+	.driver = {
+		.name = "pwm-msm-vibrator",
+		.of_match_table = msm_vibra_pwm_of_match,
+		.pm = &msm_vibra_pwm_pm_ops,
+	},
+	.probe = msm_vibra_pwm_probe,
+	.remove = msm_vibra_pwm_remove,
+};
+module_platform_driver(msm_vibra_pwm_driver);
+
+MODULE_AUTHOR("Brian Masney <masneyb@onstation.org>");
+MODULE_DESCRIPTION("PWM driver for the vibrator found on various MSM SOCs.");
+MODULE_LICENSE("GPL");
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for vibrator
  2018-09-19 15:09 [PATCH 0/3] treewide: add vibrator support for various MSM SOCs Brian Masney
  2018-09-19 15:09 ` [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver Brian Masney
  2018-09-19 15:09 ` [PATCH 2/3] pwm: msm-vibrator: new driver for the vibrator found on various MSM SOCs Brian Masney
@ 2018-09-19 15:09 ` Brian Masney
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Masney @ 2018-09-19 15:09 UTC (permalink / raw)
  To: thierry.reding, linux-pwm, andy.gross, david.brown, robh+dt,
	mark.rutland, linux-arm-msm, linux-soc, devicetree, linux-kernel
  Cc: sebastian.reichel, masneyb

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

Signed-off-by: Brian Masney <masneyb@onstation.org>
---
 .../qcom-msm8974-lge-nexus5-hammerhead.dts    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
index ed8f064d0895..e738a472cb99 100644
--- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
+++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts
@@ -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 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver
  2018-09-19 15:09 ` [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver Brian Masney
@ 2018-09-24 22:01   ` Rob Herring
  2018-09-25 20:40     ` Brian Masney
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2018-09-24 22:01 UTC (permalink / raw)
  To: Brian Masney
  Cc: thierry.reding, linux-pwm, andy.gross, david.brown, mark.rutland,
	linux-arm-msm, linux-soc, devicetree, linux-kernel,
	sebastian.reichel

On Wed, Sep 19, 2018 at 11:09:10AM -0400, Brian Masney wrote:
> 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.

> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
> ---
>  .../bindings/pwm/pwm-msm-vibrator.txt         | 38 +++++++++++++++++++
>  1 file changed, 38 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
> 
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt b/Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
> new file mode 100644
> index 000000000000..4638a25345f9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pwm-msm-vibrator.txt
> @@ -0,0 +1,38 @@
> +* PWM driver for the vibrator found on various MSM SOCs.

driver?

> +
> +Required properties:
> +
> +  - compatible: Should be one of
> +		"qcom,msm8226-pwm-vibrator"
> +		"qcom,msm8974-pwm-vibrator"

The block only works for a 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.

Shouldn't this go in the vibrator node as it is connected to 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 {

pwm@...

> +	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>;
> +};
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver
  2018-09-24 22:01   ` Rob Herring
@ 2018-09-25 20:40     ` Brian Masney
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Masney @ 2018-09-25 20:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: thierry.reding, linux-pwm, andy.gross, david.brown, mark.rutland,
	linux-arm-msm, linux-soc, devicetree, linux-kernel,
	sebastian.reichel

Hi Rob,

On Mon, Sep 24, 2018 at 03:01:11PM -0700, Rob Herring wrote:
> On Wed, Sep 19, 2018 at 11:09:10AM -0400, Brian Masney wrote:
> > 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.

> > +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.

> > +  - 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.

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

Brian


> > +
> > +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@...
> 
> > +	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>;
> > +};
> > -- 
> > 2.17.1
> > 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-25 20:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 15:09 [PATCH 0/3] treewide: add vibrator support for various MSM SOCs Brian Masney
2018-09-19 15:09 ` [PATCH 1/3] dt-bindings: pwm: msm-vibrator: new bindings for MSM vibrator driver Brian Masney
2018-09-24 22:01   ` Rob Herring
2018-09-25 20:40     ` Brian Masney
2018-09-19 15:09 ` [PATCH 2/3] pwm: msm-vibrator: new driver for the vibrator found on various MSM SOCs Brian Masney
2018-09-19 15:09 ` [PATCH 3/3] ARM: dts: qcom: msm8974-hammerhead: add device tree bindings for vibrator Brian Masney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.