LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH V5 0/2] Add Vol+ support for sc7280-idp
@ 2021-09-16 13:21 Satya Priya
2021-09-16 13:21 ` [PATCH V5 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation Satya Priya
2021-09-16 13:21 ` [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp Satya Priya
0 siblings, 2 replies; 7+ messages in thread
From: Satya Priya @ 2021-09-16 13:21 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Andy Gross, Bjorn Andersson
Cc: swboyd, David Collins, kgunda, linux-gpio, linux-kernel,
devicetree, linux-arm-msm, Satya Priya
David Collins (1):
pinctrl: qcom: spmi-gpio: correct parent irqspec translation
satya priya (1):
arm64: dts: sc7280: Add volume up support for sc7280-idp
arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 31 ++++++++++++++++++++++++++
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 37 +++++++++++++++++++++++++++++---
2 files changed, 65 insertions(+), 3 deletions(-)
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V5 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation
2021-09-16 13:21 [PATCH V5 0/2] Add Vol+ support for sc7280-idp Satya Priya
@ 2021-09-16 13:21 ` Satya Priya
2021-09-16 23:08 ` Linus Walleij
2021-09-16 13:21 ` [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp Satya Priya
1 sibling, 1 reply; 7+ messages in thread
From: Satya Priya @ 2021-09-16 13:21 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Andy Gross, Bjorn Andersson
Cc: swboyd, David Collins, kgunda, linux-gpio, linux-kernel,
devicetree, linux-arm-msm, satya priya
From: David Collins <collinsd@codeaurora.org>
pmic_gpio_child_to_parent_hwirq() and
gpiochip_populate_parent_fwspec_fourcell() translate a pinctrl-
spmi-gpio irqspec to an SPMI controller irqspec. When they do
this, they use a fixed SPMI slave ID of 0 and a fixed GPIO
peripheral offset of 0xC0 (corresponding to SPMI address 0xC000).
This translation results in an incorrect irqspec for secondary
PMICs that don't have a slave ID of 0 as well as for PMIC chips
which have GPIO peripherals located at a base address other than
0xC000.
Correct this issue by passing the slave ID of the pinctrl-spmi-
gpio device's parent in the SPMI controller irqspec and by
calculating the peripheral ID base from the device tree 'reg'
property of the pinctrl-spmi-gpio device.
Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: satya priya <skakit@codeaurora.org>
Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip")
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
Changes in V2:
- Added a fixes tag.
Changes in V3:
- Removed "fwspec->param[2] = 0" from pmic_gpio_populate_parent_fwspec,
as it is already set to zero, and must be left that way.
Changes in V4:
- No changes.
Changes in V5:
- No changes.
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 37 +++++++++++++++++++++++++++++---
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index 98bf0e2..b2562e8 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014, 2016-2021 The Linux Foundation. All rights reserved.
*/
#include <linux/gpio/driver.h>
@@ -14,6 +14,7 @@
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
+#include <linux/spmi.h>
#include <linux/types.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
@@ -171,6 +172,8 @@ struct pmic_gpio_state {
struct pinctrl_dev *ctrl;
struct gpio_chip chip;
struct irq_chip irq;
+ u8 usid;
+ u8 pid_base;
};
static const struct pinconf_generic_params pmic_gpio_bindings[] = {
@@ -949,12 +952,36 @@ static int pmic_gpio_child_to_parent_hwirq(struct gpio_chip *chip,
unsigned int *parent_hwirq,
unsigned int *parent_type)
{
- *parent_hwirq = child_hwirq + 0xc0;
+ struct pmic_gpio_state *state = gpiochip_get_data(chip);
+
+ *parent_hwirq = child_hwirq + state->pid_base;
*parent_type = child_type;
return 0;
}
+static void *pmic_gpio_populate_parent_fwspec(struct gpio_chip *chip,
+ unsigned int parent_hwirq,
+ unsigned int parent_type)
+{
+ struct pmic_gpio_state *state = gpiochip_get_data(chip);
+ struct irq_fwspec *fwspec;
+
+ fwspec = kzalloc(sizeof(*fwspec), GFP_KERNEL);
+ if (!fwspec)
+ return NULL;
+
+ fwspec->fwnode = chip->irq.parent_domain->fwnode;
+
+ fwspec->param_count = 4;
+ fwspec->param[0] = state->usid;
+ fwspec->param[1] = parent_hwirq;
+ /* param[2] must be left as 0 */
+ fwspec->param[3] = parent_type;
+
+ return fwspec;
+}
+
static int pmic_gpio_probe(struct platform_device *pdev)
{
struct irq_domain *parent_domain;
@@ -965,6 +992,7 @@ static int pmic_gpio_probe(struct platform_device *pdev)
struct pmic_gpio_pad *pad, *pads;
struct pmic_gpio_state *state;
struct gpio_irq_chip *girq;
+ const struct spmi_device *parent_spmi_dev;
int ret, npins, i;
u32 reg;
@@ -984,6 +1012,9 @@ static int pmic_gpio_probe(struct platform_device *pdev)
state->dev = &pdev->dev;
state->map = dev_get_regmap(dev->parent, NULL);
+ parent_spmi_dev = to_spmi_device(dev->parent);
+ state->usid = parent_spmi_dev->usid;
+ state->pid_base = reg >> 8;
pindesc = devm_kcalloc(dev, npins, sizeof(*pindesc), GFP_KERNEL);
if (!pindesc)
@@ -1059,7 +1090,7 @@ static int pmic_gpio_probe(struct platform_device *pdev)
girq->fwnode = of_node_to_fwnode(state->dev->of_node);
girq->parent_domain = parent_domain;
girq->child_to_parent_hwirq = pmic_gpio_child_to_parent_hwirq;
- girq->populate_parent_alloc_arg = gpiochip_populate_parent_fwspec_fourcell;
+ girq->populate_parent_alloc_arg = pmic_gpio_populate_parent_fwspec;
girq->child_offset_to_irq = pmic_gpio_child_offset_to_irq;
girq->child_irq_domain_ops.translate = pmic_gpio_domain_translate;
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp
2021-09-16 13:21 [PATCH V5 0/2] Add Vol+ support for sc7280-idp Satya Priya
2021-09-16 13:21 ` [PATCH V5 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation Satya Priya
@ 2021-09-16 13:21 ` Satya Priya
2021-09-16 19:02 ` Stephen Boyd
1 sibling, 1 reply; 7+ messages in thread
From: Satya Priya @ 2021-09-16 13:21 UTC (permalink / raw)
To: Linus Walleij, Rob Herring, Andy Gross, Bjorn Andersson
Cc: swboyd, David Collins, kgunda, linux-gpio, linux-kernel,
devicetree, linux-arm-msm, satya priya
From: satya priya <skakit@codeaurora.org>
Add pm7325 PMIC gpio support for vol+ on sc7280-idp.
Signed-off-by: satya priya <skakit@codeaurora.org>
---
Changes in V2:
- No changes.
Changes in V3:
- Sorted the nodes alphabetically.
Changes in V4:
- Updated the node names to replace underscores with hipens
Changes in V5:
- Moved the gpio-keys node under root node.
arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
index 371a2a9..cbbb0ee 100644
--- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
@@ -12,6 +12,26 @@
#include "pm8350c.dtsi"
#include "pmk8350.dtsi"
+/ {
+ gpio-keys {
+ compatible = "gpio-keys";
+ label = "gpio-keys";
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&key_vol_up_default>;
+
+ volume-up {
+ label = "volume_up";
+ gpios = <&pm7325_gpios 6 GPIO_ACTIVE_LOW>;
+ linux,input-type = <1>;
+ linux,code = <KEY_VOLUMEUP>;
+ gpio-key,wakeup;
+ debounce-interval = <15>;
+ linux,can-disable;
+ };
+ };
+};
+
&apps_rsc {
pm7325-regulators {
compatible = "qcom,pm7325-rpmh-regulators";
@@ -284,6 +304,17 @@
/* PINCTRL - additions to nodes defined in sc7280.dtsi */
+&pm7325_gpios {
+ key_vol_up_default: key-vol-up-default {
+ pins = "gpio6";
+ function = "normal";
+ input-enable;
+ bias-pull-up;
+ power-source = <0>;
+ qcom,drive-strength = <3>;
+ };
+};
+
&qup_uart5_default {
tx {
pins = "gpio46";
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp
2021-09-16 13:21 ` [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp Satya Priya
@ 2021-09-16 19:02 ` Stephen Boyd
2021-09-17 4:08 ` skakit
0 siblings, 1 reply; 7+ messages in thread
From: Stephen Boyd @ 2021-09-16 19:02 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Linus Walleij, Rob Herring, Satya Priya
Cc: David Collins, kgunda, linux-gpio, linux-kernel, devicetree,
linux-arm-msm
Quoting Satya Priya (2021-09-16 06:21:38)
> diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> index 371a2a9..cbbb0ee 100644
> --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> @@ -12,6 +12,26 @@
> #include "pm8350c.dtsi"
> #include "pmk8350.dtsi"
>
> +/ {
> + gpio-keys {
> + compatible = "gpio-keys";
> + label = "gpio-keys";
> +
> + pinctrl-names = "default";
> + pinctrl-0 = <&key_vol_up_default>;
> +
> + volume-up {
> + label = "volume_up";
> + gpios = <&pm7325_gpios 6 GPIO_ACTIVE_LOW>;
> + linux,input-type = <1>;
> + linux,code = <KEY_VOLUMEUP>;
Is there an include for this define? Looks like
<dt-bindings/input/input.h> should be added as well? Did you try
compiling?
> + gpio-key,wakeup;
> + debounce-interval = <15>;
> + linux,can-disable;
> + };
> + };
> +};
> +
> &apps_rsc {
> pm7325-regulators {
> compatible = "qcom,pm7325-rpmh-regulators";
> @@ -284,6 +304,17 @@
>
> /* PINCTRL - additions to nodes defined in sc7280.dtsi */
>
> +&pm7325_gpios {
> + key_vol_up_default: key-vol-up-default {
> + pins = "gpio6";
> + function = "normal";
> + input-enable;
> + bias-pull-up;
> + power-source = <0>;
> + qcom,drive-strength = <3>;
> + };
> +};
> +
> &qup_uart5_default {
> tx {
> pins = "gpio46";
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V5 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation
2021-09-16 13:21 ` [PATCH V5 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation Satya Priya
@ 2021-09-16 23:08 ` Linus Walleij
0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2021-09-16 23:08 UTC (permalink / raw)
To: Satya Priya
Cc: Rob Herring, Andy Gross, Bjorn Andersson, Stephen Boyd,
David Collins, Kiran Gunda, open list:GPIO SUBSYSTEM,
linux-kernel,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, MSM
On Thu, Sep 16, 2021 at 3:22 PM Satya Priya <skakit@codeaurora.org> wrote:
> From: David Collins <collinsd@codeaurora.org>
>
> pmic_gpio_child_to_parent_hwirq() and
> gpiochip_populate_parent_fwspec_fourcell() translate a pinctrl-
> spmi-gpio irqspec to an SPMI controller irqspec. When they do
> this, they use a fixed SPMI slave ID of 0 and a fixed GPIO
> peripheral offset of 0xC0 (corresponding to SPMI address 0xC000).
> This translation results in an incorrect irqspec for secondary
> PMICs that don't have a slave ID of 0 as well as for PMIC chips
> which have GPIO peripherals located at a base address other than
> 0xC000.
>
> Correct this issue by passing the slave ID of the pinctrl-spmi-
> gpio device's parent in the SPMI controller irqspec and by
> calculating the peripheral ID base from the device tree 'reg'
> property of the pinctrl-spmi-gpio device.
>
> Signed-off-by: David Collins <collinsd@codeaurora.org>
> Signed-off-by: satya priya <skakit@codeaurora.org>
> Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip")
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Patch applied for fixes.
Is a similar patch needed for
drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
?
Notice ssbi rather than sbmi...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp
2021-09-16 19:02 ` Stephen Boyd
@ 2021-09-17 4:08 ` skakit
2021-09-17 6:07 ` Stephen Boyd
0 siblings, 1 reply; 7+ messages in thread
From: skakit @ 2021-09-17 4:08 UTC (permalink / raw)
To: Stephen Boyd
Cc: Andy Gross, Bjorn Andersson, Linus Walleij, Rob Herring,
David Collins, kgunda, linux-gpio, linux-kernel, devicetree,
linux-arm-msm
On 2021-09-17 00:32, Stephen Boyd wrote:
> Quoting Satya Priya (2021-09-16 06:21:38)
>> diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
>> b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
>> index 371a2a9..cbbb0ee 100644
>> --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
>> +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
>> @@ -12,6 +12,26 @@
>> #include "pm8350c.dtsi"
>> #include "pmk8350.dtsi"
>>
>> +/ {
>> + gpio-keys {
>> + compatible = "gpio-keys";
>> + label = "gpio-keys";
>> +
>> + pinctrl-names = "default";
>> + pinctrl-0 = <&key_vol_up_default>;
>> +
>> + volume-up {
>> + label = "volume_up";
>> + gpios = <&pm7325_gpios 6 GPIO_ACTIVE_LOW>;
>> + linux,input-type = <1>;
>> + linux,code = <KEY_VOLUMEUP>;
>
> Is there an include for this define? Looks like
> <dt-bindings/input/input.h> should be added as well? Did you try
> compiling?
>
Yeah, it needs <dt-bindings/input/linux-event-codes.h> to be included.
This header was included in pmk8350.dtsi which is added in this file.
>> + gpio-key,wakeup;
>> + debounce-interval = <15>;
>> + linux,can-disable;
>> + };
>> + };
>> +};
>> +
>> &apps_rsc {
>> pm7325-regulators {
>> compatible = "qcom,pm7325-rpmh-regulators";
>> @@ -284,6 +304,17 @@
>>
>> /* PINCTRL - additions to nodes defined in sc7280.dtsi */
>>
>> +&pm7325_gpios {
>> + key_vol_up_default: key-vol-up-default {
>> + pins = "gpio6";
>> + function = "normal";
>> + input-enable;
>> + bias-pull-up;
>> + power-source = <0>;
>> + qcom,drive-strength = <3>;
>> + };
>> +};
>> +
>> &qup_uart5_default {
>> tx {
>> pins = "gpio46";
>> --
>> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
>> member
>> of Code Aurora Forum, hosted by The Linux Foundation
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp
2021-09-17 4:08 ` skakit
@ 2021-09-17 6:07 ` Stephen Boyd
0 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2021-09-17 6:07 UTC (permalink / raw)
To: skakit
Cc: Andy Gross, Bjorn Andersson, Linus Walleij, Rob Herring,
David Collins, kgunda, linux-gpio, linux-kernel, devicetree,
linux-arm-msm
Quoting skakit@codeaurora.org (2021-09-16 21:08:11)
> On 2021-09-17 00:32, Stephen Boyd wrote:
> > Quoting Satya Priya (2021-09-16 06:21:38)
> >> diff --git a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> >> b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> >> index 371a2a9..cbbb0ee 100644
> >> --- a/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> >> +++ b/arch/arm64/boot/dts/qcom/sc7280-idp.dtsi
> >> @@ -12,6 +12,26 @@
> >> #include "pm8350c.dtsi"
> >> #include "pmk8350.dtsi"
> >>
> >> +/ {
> >> + gpio-keys {
> >> + compatible = "gpio-keys";
> >> + label = "gpio-keys";
> >> +
> >> + pinctrl-names = "default";
> >> + pinctrl-0 = <&key_vol_up_default>;
> >> +
> >> + volume-up {
> >> + label = "volume_up";
> >> + gpios = <&pm7325_gpios 6 GPIO_ACTIVE_LOW>;
> >> + linux,input-type = <1>;
> >> + linux,code = <KEY_VOLUMEUP>;
> >
> > Is there an include for this define? Looks like
> > <dt-bindings/input/input.h> should be added as well? Did you try
> > compiling?
> >
>
> Yeah, it needs <dt-bindings/input/linux-event-codes.h> to be included.
> This header was included in pmk8350.dtsi which is added in this file.
Alright, got it. If you can include this header in this dts file it
would be better so we don't rely on implicit includes from other files
to get macros. With that change you can add my
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-17 6:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 13:21 [PATCH V5 0/2] Add Vol+ support for sc7280-idp Satya Priya
2021-09-16 13:21 ` [PATCH V5 1/2] pinctrl: qcom: spmi-gpio: correct parent irqspec translation Satya Priya
2021-09-16 23:08 ` Linus Walleij
2021-09-16 13:21 ` [PATCH V5 2/2] arm64: dts: sc7280: Add volume up support for sc7280-idp Satya Priya
2021-09-16 19:02 ` Stephen Boyd
2021-09-17 4:08 ` skakit
2021-09-17 6:07 ` Stephen Boyd
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).