linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support
       [not found] <20230717062547.2086869-1-quic_fenglinw@quicinc.com>
@ 2023-07-17  6:25 ` Fenglin Wu
  2023-07-17 19:59   ` Krzysztof Kozlowski
  2023-07-17  6:25 ` [PATCH v1 2/2] Input: pm8xxx-vib - Add support for more PMICs Fenglin Wu
  1 sibling, 1 reply; 5+ messages in thread
From: Fenglin Wu @ 2023-07-17  6:25 UTC (permalink / raw)
  To: linux-arm-msm, linux-kernel, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski,
	linux-input, devicetree
  Cc: quic_collinsd, quic_subbaram, quic_fenglinw, quic_kamalw, jestar

Add support for vibrator module inside Qualcomm PMI632, PM7250B, PM7325B
and PM7550BA PMICs.

Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
---
 Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
index c8832cd0d7da..642408e2b35f 100644
--- a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
+++ b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
@@ -15,6 +15,10 @@ properties:
       - qcom,pm8058-vib
       - qcom,pm8916-vib
       - qcom,pm8921-vib
+      - qcom,pmi632-vib
+      - qcom,pm7250b-vib
+      - qcom,pm7325b-vib
+      - qcom,pm7550ba-vib
 
   reg:
     maxItems: 1
-- 
2.25.1


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

* [PATCH v1 2/2] Input: pm8xxx-vib - Add support for more PMICs
       [not found] <20230717062547.2086869-1-quic_fenglinw@quicinc.com>
  2023-07-17  6:25 ` [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support Fenglin Wu
@ 2023-07-17  6:25 ` Fenglin Wu
  1 sibling, 0 replies; 5+ messages in thread
From: Fenglin Wu @ 2023-07-17  6:25 UTC (permalink / raw)
  To: linux-arm-msm, linux-kernel, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Dmitry Torokhov, linux-input
  Cc: quic_collinsd, quic_subbaram, quic_fenglinw, quic_kamalw, jestar

Add support for vibrator module inside PMI632, PM7250B, PM7325B and
PM7550BA. It is very similar to vibrator inside PM8xxx but just the
drive amplitude is controlled through 2 bytes registers.

Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
---
 drivers/input/misc/pm8xxx-vibrator.c | 49 ++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
index 04cb87efd799..c8185514e711 100644
--- a/drivers/input/misc/pm8xxx-vibrator.c
+++ b/drivers/input/misc/pm8xxx-vibrator.c
@@ -25,6 +25,9 @@ struct pm8xxx_regs {
 	unsigned int drv_addr;
 	unsigned int drv_mask;
 	unsigned int drv_shift;
+	unsigned int drv_addr2;
+	unsigned int drv_mask2;
+	unsigned int drv_shift2;
 	unsigned int drv_en_manual_mask;
 };
 
@@ -44,6 +47,42 @@ static struct pm8xxx_regs pm8916_regs = {
 	.drv_en_manual_mask = 0,
 };
 
+static struct pm8xxx_regs pmi632_regs = {
+	.enable_addr = 0x5746,
+	.enable_mask = BIT(7),
+	.drv_addr = 0x5740,
+	.drv_mask = 0xff,
+	.drv_shift = 0,
+	.drv_addr2 = 0x5741,
+	.drv_mask2 = 0x0f,
+	.drv_shift2 = 8,
+	.drv_en_manual_mask = 0,
+};
+
+static struct pm8xxx_regs pm7250b_regs = {
+	.enable_addr = 0x5346,
+	.enable_mask = BIT(7),
+	.drv_addr = 0x5340,
+	.drv_mask = 0xff,
+	.drv_shift = 0,
+	.drv_addr2 = 0x5341,
+	.drv_mask2 = 0x0f,
+	.drv_shift2 = 8,
+	.drv_en_manual_mask = 0,
+};
+
+static struct pm8xxx_regs pm7325b_regs = {
+	.enable_addr = 0xdf46,
+	.enable_mask = BIT(7),
+	.drv_addr = 0xdf40,
+	.drv_mask = 0xff,
+	.drv_shift = 0,
+	.drv_addr2 = 0xdf41,
+	.drv_mask2 = 0x0f,
+	.drv_shift2 = 8,
+	.drv_en_manual_mask = 0,
+};
+
 /**
  * struct pm8xxx_vib - structure to hold vibrator data
  * @vib_input_dev: input device supporting force feedback
@@ -87,6 +126,12 @@ static int pm8xxx_vib_set(struct pm8xxx_vib *vib, bool on)
 		return rc;
 
 	vib->reg_vib_drv = val;
+	if (regs->drv_addr2 != 0 && on) {
+		val = (vib->level << regs->drv_shift2) & regs->drv_mask2;
+		rc = regmap_write(vib->regmap, regs->drv_addr2, val);
+		if (rc < 0)
+			return rc;
+	}
 
 	if (regs->enable_mask)
 		rc = regmap_update_bits(vib->regmap, regs->enable_addr,
@@ -242,6 +287,10 @@ static const struct of_device_id pm8xxx_vib_id_table[] = {
 	{ .compatible = "qcom,pm8058-vib", .data = &pm8058_regs },
 	{ .compatible = "qcom,pm8921-vib", .data = &pm8058_regs },
 	{ .compatible = "qcom,pm8916-vib", .data = &pm8916_regs },
+	{ .compatible = "qcom,pmi632-vib", .data = &pmi632_regs },
+	{ .compatible = "qcom,pm7250b-vib", .data = &pm7250b_regs },
+	{ .compatible = "qcom,pm7325b-vib", .data = &pm7325b_regs },
+	{ .compatible = "qcom,pm7550ba-vib", .data = &pm7325b_regs },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, pm8xxx_vib_id_table);
-- 
2.25.1


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

* Re: [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support
  2023-07-17  6:25 ` [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support Fenglin Wu
@ 2023-07-17 19:59   ` Krzysztof Kozlowski
  2023-07-18  2:37     ` Fenglin Wu
  0 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-17 19:59 UTC (permalink / raw)
  To: Fenglin Wu, linux-arm-msm, linux-kernel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, linux-input, devicetree
  Cc: quic_collinsd, quic_subbaram, quic_kamalw, jestar

On 17/07/2023 08:25, Fenglin Wu wrote:
> Add support for vibrator module inside Qualcomm PMI632, PM7250B, PM7325B
> and PM7550BA PMICs.
> 
> Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
> ---
>  Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
> index c8832cd0d7da..642408e2b35f 100644
> --- a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
> +++ b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
> @@ -15,6 +15,10 @@ properties:
>        - qcom,pm8058-vib
>        - qcom,pm8916-vib
>        - qcom,pm8921-vib
> +      - qcom,pmi632-vib
> +      - qcom,pm7250b-vib
> +      - qcom,pm7325b-vib
> +      - qcom,pm7550ba-vib

Aren't the last two compatible?

Best regards,
Krzysztof


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

* Re: [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support
  2023-07-17 19:59   ` Krzysztof Kozlowski
@ 2023-07-18  2:37     ` Fenglin Wu
  2023-07-18  6:11       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 5+ messages in thread
From: Fenglin Wu @ 2023-07-18  2:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-arm-msm, linux-kernel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, linux-input, devicetree
  Cc: quic_collinsd, quic_subbaram, quic_kamalw, jestar



On 7/18/2023 3:59 AM, Krzysztof Kozlowski wrote:
> On 17/07/2023 08:25, Fenglin Wu wrote:
>> Add support for vibrator module inside Qualcomm PMI632, PM7250B, PM7325B
>> and PM7550BA PMICs.
>>
>> Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
>> ---
>>   Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
>> index c8832cd0d7da..642408e2b35f 100644
>> --- a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
>> +++ b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
>> @@ -15,6 +15,10 @@ properties:
>>         - qcom,pm8058-vib
>>         - qcom,pm8916-vib
>>         - qcom,pm8921-vib
>> +      - qcom,pmi632-vib
>> +      - qcom,pm7250b-vib
>> +      - qcom,pm7325b-vib
>> +      - qcom,pm7550ba-vib
> 
> Aren't the last two compatible?

There are still every different PMICs even though the vibrator module in 
PM7325B and PM7550BA are the same and they share the same register base 
address as well.

> 
> Best regards,
> Krzysztof
> 

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

* Re: [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support
  2023-07-18  2:37     ` Fenglin Wu
@ 2023-07-18  6:11       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2023-07-18  6:11 UTC (permalink / raw)
  To: Fenglin Wu, linux-arm-msm, linux-kernel, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Dmitry Torokhov, Rob Herring,
	Krzysztof Kozlowski, linux-input, devicetree
  Cc: quic_collinsd, quic_subbaram, quic_kamalw, jestar

On 18/07/2023 04:37, Fenglin Wu wrote:
> 
> 
> On 7/18/2023 3:59 AM, Krzysztof Kozlowski wrote:
>> On 17/07/2023 08:25, Fenglin Wu wrote:
>>> Add support for vibrator module inside Qualcomm PMI632, PM7250B, PM7325B
>>> and PM7550BA PMICs.
>>>
>>> Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
>>> ---
>>>   Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
>>> index c8832cd0d7da..642408e2b35f 100644
>>> --- a/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
>>> +++ b/Documentation/devicetree/bindings/input/qcom,pm8xxx-vib.yaml
>>> @@ -15,6 +15,10 @@ properties:
>>>         - qcom,pm8058-vib
>>>         - qcom,pm8916-vib
>>>         - qcom,pm8921-vib
>>> +      - qcom,pmi632-vib
>>> +      - qcom,pm7250b-vib
>>> +      - qcom,pm7325b-vib
>>> +      - qcom,pm7550ba-vib
>>
>> Aren't the last two compatible?
> 
> There are still every different PMICs even though the vibrator module in 
> PM7325B and PM7550BA are the same and they share the same register base 
> address as well.

So the vibrator modules are compatible? Then I propose to make them
compatible.

Best regards,
Krzysztof


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

end of thread, other threads:[~2023-07-18  6:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230717062547.2086869-1-quic_fenglinw@quicinc.com>
2023-07-17  6:25 ` [PATCH v1 1/2] dt-bindings: input: qcom,pm8xxx-vib: add more PMIC support Fenglin Wu
2023-07-17 19:59   ` Krzysztof Kozlowski
2023-07-18  2:37     ` Fenglin Wu
2023-07-18  6:11       ` Krzysztof Kozlowski
2023-07-17  6:25 ` [PATCH v1 2/2] Input: pm8xxx-vib - Add support for more PMICs Fenglin Wu

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