linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/2] input: introduce support for Qualcomm SPMI haptics
@ 2022-10-15 17:30 Caleb Connolly
  2022-10-15 17:30 ` [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver Caleb Connolly
  0 siblings, 1 reply; 5+ messages in thread
From: Caleb Connolly @ 2022-10-15 17:30 UTC (permalink / raw)
  To: caleb
  Cc: krzysztof.kozlowski, phone-devel, ~postmarketos/upstreaming,
	Andy Gross, Bjorn Andersson, devicetree, Dmitry Torokhov,
	Jeff LaBundy, Konrad Dybcio, Krzysztof Kozlowski, linux-arm-msm,
	linux-input, linux-kernel, llvm, Nathan Chancellor,
	Nick Desaulniers, Rob Herring, Tom Rix

This series introduces a driver for the SPMI haptics hardware block
found in Qualcomm PMICs. SPMI haptics support LRA (Linear Resonant
Actuator) style haptics, as well as ERM (Eccentric Rotating Mass).
It also supports several modes of driving the haptics, e.g. by loading
the pattern to play into an internal buffer, or using PWM.

More information about the hardware can be found here:
        https://gitlab.com/sdm845-mainline/linux/-/wikis/PMI8998-QPNP-Haptics

This driver has been written based on downstream sources as no public
documentation is available. It includes initial support for LRA haptics
in buffer mode, this combination seems to be the most common and will
enable haptics on the OnePlus 6 and 6T, PocoPhone F1, OnePlus 5 and
several other Qualcomm devices with mainline kernel support.

The driver is implemented using the ff-memless (forcefeedback) input
framework and makes an attempt to control the strength of vibration relative
to the magnitude set from userspace.

Changes since v6:
 - Apply Krzysztof's dt-bindings suggestions
 - Rename qcom,wave-play-rate-us to qcom,wave-play-duration-us and
   add a comment explaining the name change compared to downstream.
 - Add COMPILE_TEST to kconfig

Changes since v5:
 - Fix dt schema errors
 - Fix typo (thanks Vincent)

Changes since v4:
 - Significant rewrite and cleanup
 - switch to dev_err_probe()
 - Run through clang-format

Changes since v3:
 - Adjust example DTS to avoid creating new warnings in dt_binding_check
 - Address warnings from kernel test robot.

Changes since v2:
 - Addressed Rob's comments on dt-bindings (I'm not sure what to do
   about the pmic compatible?)
 - Fixed some typos

Changes since v1:
 - Replace old QPNP naming with SPMI
 - Address Bjorn's comments on the driver, various style and code cleanups
 - Address Bjorn's comments on the DT bindings and DTS
 - Pickup patches from Joel and Jami to enable haptics on the OnePlus 5
   and Poco F1.

Caleb Connolly (2):
  dt-bindings: input: document Qualcomm PMI8998 haptics driver
  input: add Qualcomm SPMI haptics driver

 .../bindings/input/qcom,pmi8998-haptics.yaml  |  73 ++
 drivers/input/misc/Kconfig                    |  15 +
 drivers/input/misc/Makefile                   |   1 +
 drivers/input/misc/qcom-pmi8998-haptics.c     | 690 ++++++++++++++++++
 4 files changed, 779 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
 create mode 100644 drivers/input/misc/qcom-pmi8998-haptics.c

--
2.38.0



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

* [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver
  2022-10-15 17:30 [PATCH v7 0/2] input: introduce support for Qualcomm SPMI haptics Caleb Connolly
@ 2022-10-15 17:30 ` Caleb Connolly
  2022-10-16 14:53   ` Krzysztof Kozlowski
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Caleb Connolly @ 2022-10-15 17:30 UTC (permalink / raw)
  To: caleb
  Cc: krzysztof.kozlowski, phone-devel, ~postmarketos/upstreaming,
	Andy Gross, Bjorn Andersson, devicetree, Dmitry Torokhov,
	Jeff LaBundy, Konrad Dybcio, Krzysztof Kozlowski, linux-arm-msm,
	linux-input, linux-kernel, llvm, Nathan Chancellor,
	Nick Desaulniers, Rob Herring, Tom Rix

Add bindings for qcom PMIC PMI8998 haptics driver.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
---
 .../bindings/input/qcom,pmi8998-haptics.yaml  | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml

diff --git a/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml b/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
new file mode 100644
index 000000000000..d43324cceb89
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2020 Unisoc Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/qcom,pmi8998-haptics.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm PMI8998/PM660 Haptics
+
+maintainers:
+  - Caleb Connolly <caleb@connolly.tech>
+
+description: |
+  Qualcomm SPMI haptics is a peripheral on some QTI PMICs. It supports linear resonant
+  actuators and eccentric rotating mass type haptics commonly found in mobile devices.
+  It supports multiple sources of wave data such as an internal buffer, direct play
+  (from kernel or userspace) as well as an audio output mode.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - qcom,pmi8998-haptics
+          - qcom,pm660-charger
+          - qcom,pmi8996-haptics
+          - qcom,pmi8941-haptics
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 2
+
+  interrupt-names:
+    items:
+      - const: short
+      - const: play
+
+  qcom,wave-play-duration-us:
+    description: |
+      Wave sample duration in microseconds, 1/f where f
+      is the resonant frequency of the actuator.
+      This property is named qcom,wave-play-rate-us in
+      downstream kernels.
+    minimum: 0
+    maximum: 20475
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - qcom,wave-play-rate-us
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    spmi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      pmi8998_haptics: haptics@c000 {
+        compatible = "qcom,pmi8998-haptics";
+        reg = <0xc000>;
+
+        interrupts = <0x3 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
+                     <0x3 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
+        interrupt-names = "short", "play";
+
+        qcom,wave-play-rate-us = <4255>;
+      };
+    };
--
2.38.0



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

* Re: [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver
  2022-10-15 17:30 ` [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver Caleb Connolly
@ 2022-10-16 14:53   ` Krzysztof Kozlowski
  2022-10-16 22:58   ` Rob Herring
  2022-10-18 18:29   ` Caleb Connolly
  2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-10-16 14:53 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: phone-devel, ~postmarketos/upstreaming, Andy Gross,
	Bjorn Andersson, devicetree, Dmitry Torokhov, Jeff LaBundy,
	Konrad Dybcio, Krzysztof Kozlowski, linux-arm-msm, linux-input,
	linux-kernel, llvm, Nathan Chancellor, Nick Desaulniers,
	Rob Herring, Tom Rix

On 15/10/2022 13:30, Caleb Connolly wrote:
> Add bindings for qcom PMIC PMI8998 haptics driver.
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


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

* Re: [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver
  2022-10-15 17:30 ` [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver Caleb Connolly
  2022-10-16 14:53   ` Krzysztof Kozlowski
@ 2022-10-16 22:58   ` Rob Herring
  2022-10-18 18:29   ` Caleb Connolly
  2 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-10-16 22:58 UTC (permalink / raw)
  To: Caleb Connolly
  Cc: linux-kernel, phone-devel, krzysztof.kozlowski, devicetree,
	Tom Rix, linux-input, Andy Gross, Jeff LaBundy,
	~postmarketos/upstreaming, linux-arm-msm, Rob Herring,
	Nathan Chancellor, Krzysztof Kozlowski, llvm, Bjorn Andersson,
	Dmitry Torokhov, Nick Desaulniers, Konrad Dybcio

On Sat, 15 Oct 2022 17:30:35 +0000, Caleb Connolly wrote:
> Add bindings for qcom PMIC PMI8998 haptics driver.
> 
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>  .../bindings/input/qcom,pmi8998-haptics.yaml  | 73 +++++++++++++++++++
>  1 file changed, 73 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.example.dtb: haptics@c000: 'qcom,wave-play-rate-us' does not match any of the regexes: 'pinctrl-[0-9]+'
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.


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

* Re: [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver
  2022-10-15 17:30 ` [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver Caleb Connolly
  2022-10-16 14:53   ` Krzysztof Kozlowski
  2022-10-16 22:58   ` Rob Herring
@ 2022-10-18 18:29   ` Caleb Connolly
  2 siblings, 0 replies; 5+ messages in thread
From: Caleb Connolly @ 2022-10-18 18:29 UTC (permalink / raw)
  Cc: krzysztof.kozlowski, phone-devel, ~postmarketos/upstreaming,
	Andy Gross, Bjorn Andersson, devicetree, Dmitry Torokhov,
	Jeff LaBundy, Konrad Dybcio, Krzysztof Kozlowski, linux-arm-msm,
	linux-input, linux-kernel, llvm, Nathan Chancellor,
	Nick Desaulniers, Rob Herring, Tom Rix



On 15/10/2022 18:30, Caleb Connolly wrote:
> Add bindings for qcom PMIC PMI8998 haptics driver.
>
> Signed-off-by: Caleb Connolly <caleb@connolly.tech>
> ---
>   .../bindings/input/qcom,pmi8998-haptics.yaml  | 73 +++++++++++++++++++
>   1 file changed, 73 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
>
> diff --git a/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml b/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
> new file mode 100644
> index 000000000000..d43324cceb89
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/qcom,pmi8998-haptics.yaml
> @@ -0,0 +1,73 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +# Copyright 2020 Unisoc Inc.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/qcom,pmi8998-haptics.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm PMI8998/PM660 Haptics
> +
> +maintainers:
> +  - Caleb Connolly <caleb@connolly.tech>
> +
> +description: |
> +  Qualcomm SPMI haptics is a peripheral on some QTI PMICs. It supports linear resonant
> +  actuators and eccentric rotating mass type haptics commonly found in mobile devices.
> +  It supports multiple sources of wave data such as an internal buffer, direct play
> +  (from kernel or userspace) as well as an audio output mode.
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - qcom,pmi8998-haptics
> +          - qcom,pm660-charger

I've just noticed this typo! Will respin and fix...

> +          - qcom,pmi8996-haptics
> +          - qcom,pmi8941-haptics
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 2
> +
> +  interrupt-names:
> +    items:
> +      - const: short
> +      - const: play
> +
> +  qcom,wave-play-duration-us:
> +    description: |
> +      Wave sample duration in microseconds, 1/f where f
> +      is the resonant frequency of the actuator.
> +      This property is named qcom,wave-play-rate-us in
> +      downstream kernels.
> +    minimum: 0
> +    maximum: 20475
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - qcom,wave-play-rate-us
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    spmi {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +      pmi8998_haptics: haptics@c000 {
> +        compatible = "qcom,pmi8998-haptics";
> +        reg = <0xc000>;
> +
> +        interrupts = <0x3 0xc0 0x0 IRQ_TYPE_EDGE_BOTH>,
> +                     <0x3 0xc0 0x1 IRQ_TYPE_EDGE_BOTH>;
> +        interrupt-names = "short", "play";
> +
> +        qcom,wave-play-rate-us = <4255>;
> +      };
> +    };
> --
> 2.38.0
>

--
Kind Regards,
Caleb


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

end of thread, other threads:[~2022-10-18 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-15 17:30 [PATCH v7 0/2] input: introduce support for Qualcomm SPMI haptics Caleb Connolly
2022-10-15 17:30 ` [PATCH v7 1/2] dt-bindings: input: document Qualcomm PMI8998 haptics driver Caleb Connolly
2022-10-16 14:53   ` Krzysztof Kozlowski
2022-10-16 22:58   ` Rob Herring
2022-10-18 18:29   ` Caleb Connolly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).