All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
@ 2016-10-26  9:23 ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2016-10-26  9:23 UTC (permalink / raw)
  To: linux-arm-kernel, linux-arm-msm, Andy Gross
  Cc: Stephen Boyd, Bjorn Andersson, David Brown, Linus Walleij

This adds the MPU-3050 gyroscope and the KXSD9 accelerometer to
the Qualcomm APQ8060 Dragonboard. The KXSD9 is mounted beyond the
MPU-3050 and appear as a subdevice beyond it. We set up the
required GPIO and interrupt lines to make the devices work.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Should be fine to apply now: all bindings and requirements are
  merged.
ChangeLog v1->v2:
- Use the new I2C mux gate bindings from Peter Rosin (merged to
  the I2C subsystem)
---
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 53 ++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
index 6c0038398ef2..1d76b7415f08 100644
--- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
@@ -167,6 +167,14 @@
 					bias-pull-up;
 				};
 			};
+
+			/* Interrupt line for the KXSD9 accelerometer */
+			dragon_kxsd9_gpios: kxsd9 {
+				irq {
+					pins = "gpio57"; /* IRQ line */
+					bias-pull-up;
+				};
+			};
 		};
 
 		qcom,ssbi@500000 {
@@ -210,6 +218,15 @@
 							power-source = <PM8058_GPIO_S3>;
 						};
 					};
+					dragon_mpu3050_gpios: mpu3050-gpios {
+						pinconf {
+							pins = "gpio17";
+							function = "normal";
+							input-enable;
+							bias-disable;
+							power-source = <PM8058_GPIO_S3>;
+						};
+					};
 					dragon_sdcc3_gpios: sdcc3-gpios {
 						pinconf {
 							pins = "gpio22";
@@ -319,6 +336,42 @@
 					vddd-supply = <&pm8058_lvs0>; // 1.8V
 					vdda-supply = <&pm8058_l14>; // 2.85V
 				};
+				mpu3050@68 {
+					compatible = "invensense,mpu3050";
+					reg = <0x68>;
+					/*
+					 * GPIO17 has interrupt 208 on the
+					 * PM8058, it is pulled high by a 10k
+					 * resistor to VLOGIC so needs to be
+					 * active low/falling edge.
+					 */
+					interrupt-parent = <&pm8058_gpio>;
+					interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
+					pinctrl-names = "default";
+					pinctrl-0 = <&dragon_mpu3050_gpios>;
+					vlogic-supply = <&pm8058_lvs0>; // 1.8V
+					vdd-supply = <&pm8058_l14>; // 2.85V
+
+					/*
+					 * The MPU-3050 acts as a hub for the
+					 * accelerometer.
+					 */
+					i2c-gate {
+						#address-cells = <1>;
+						#size-cells = <0>;
+
+						kxsd9@18 {
+							compatible = "kionix,kxsd9";
+							reg = <0x18>;
+							interrupt-parent = <&tlmm>;
+							interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
+							pinctrl-names = "default";
+							pinctrl-0 = <&dragon_kxsd9_gpios>;
+							iovdd-supply = <&pm8058_lvs0>; // 1.8V
+							vdd-supply = <&pm8058_l14>; // 2.85V
+						};
+					};
+				};
 			};
 		};
 
-- 
2.7.4

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

* [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
@ 2016-10-26  9:23 ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2016-10-26  9:23 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the MPU-3050 gyroscope and the KXSD9 accelerometer to
the Qualcomm APQ8060 Dragonboard. The KXSD9 is mounted beyond the
MPU-3050 and appear as a subdevice beyond it. We set up the
required GPIO and interrupt lines to make the devices work.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Should be fine to apply now: all bindings and requirements are
  merged.
ChangeLog v1->v2:
- Use the new I2C mux gate bindings from Peter Rosin (merged to
  the I2C subsystem)
---
 arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 53 ++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
index 6c0038398ef2..1d76b7415f08 100644
--- a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
+++ b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
@@ -167,6 +167,14 @@
 					bias-pull-up;
 				};
 			};
+
+			/* Interrupt line for the KXSD9 accelerometer */
+			dragon_kxsd9_gpios: kxsd9 {
+				irq {
+					pins = "gpio57"; /* IRQ line */
+					bias-pull-up;
+				};
+			};
 		};
 
 		qcom,ssbi at 500000 {
@@ -210,6 +218,15 @@
 							power-source = <PM8058_GPIO_S3>;
 						};
 					};
+					dragon_mpu3050_gpios: mpu3050-gpios {
+						pinconf {
+							pins = "gpio17";
+							function = "normal";
+							input-enable;
+							bias-disable;
+							power-source = <PM8058_GPIO_S3>;
+						};
+					};
 					dragon_sdcc3_gpios: sdcc3-gpios {
 						pinconf {
 							pins = "gpio22";
@@ -319,6 +336,42 @@
 					vddd-supply = <&pm8058_lvs0>; // 1.8V
 					vdda-supply = <&pm8058_l14>; // 2.85V
 				};
+				mpu3050 at 68 {
+					compatible = "invensense,mpu3050";
+					reg = <0x68>;
+					/*
+					 * GPIO17 has interrupt 208 on the
+					 * PM8058, it is pulled high by a 10k
+					 * resistor to VLOGIC so needs to be
+					 * active low/falling edge.
+					 */
+					interrupt-parent = <&pm8058_gpio>;
+					interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
+					pinctrl-names = "default";
+					pinctrl-0 = <&dragon_mpu3050_gpios>;
+					vlogic-supply = <&pm8058_lvs0>; // 1.8V
+					vdd-supply = <&pm8058_l14>; // 2.85V
+
+					/*
+					 * The MPU-3050 acts as a hub for the
+					 * accelerometer.
+					 */
+					i2c-gate {
+						#address-cells = <1>;
+						#size-cells = <0>;
+
+						kxsd9 at 18 {
+							compatible = "kionix,kxsd9";
+							reg = <0x18>;
+							interrupt-parent = <&tlmm>;
+							interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
+							pinctrl-names = "default";
+							pinctrl-0 = <&dragon_kxsd9_gpios>;
+							iovdd-supply = <&pm8058_lvs0>; // 1.8V
+							vdd-supply = <&pm8058_l14>; // 2.85V
+						};
+					};
+				};
 			};
 		};
 
-- 
2.7.4

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

* Re: [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
  2016-10-26  9:23 ` Linus Walleij
@ 2016-10-31 22:20   ` Bjorn Andersson
  -1 siblings, 0 replies; 10+ messages in thread
From: Bjorn Andersson @ 2016-10-31 22:20 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, linux-arm-msm, Andy Gross, Stephen Boyd, David Brown

On Wed 26 Oct 02:23 PDT 2016, Linus Walleij wrote:

> This adds the MPU-3050 gyroscope and the KXSD9 accelerometer to
> the Qualcomm APQ8060 Dragonboard. The KXSD9 is mounted beyond the
> MPU-3050 and appear as a subdevice beyond it. We set up the
> required GPIO and interrupt lines to make the devices work.
> 

I'm concerned about the interrupt below, but apart from that

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v2->v3:
> - Should be fine to apply now: all bindings and requirements are
>   merged.
> ChangeLog v1->v2:
> - Use the new I2C mux gate bindings from Peter Rosin (merged to
>   the I2C subsystem)
> ---
>  arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 53 ++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
[..]
> +				mpu3050@68 {
> +					compatible = "invensense,mpu3050";
> +					reg = <0x68>;
> +					/*
> +					 * GPIO17 has interrupt 208 on the
> +					 * PM8058, it is pulled high by a 10k
> +					 * resistor to VLOGIC so needs to be
> +					 * active low/falling edge.
> +					 */
> +					interrupt-parent = <&pm8058_gpio>;
> +					interrupts = <208 IRQ_TYPE_EDGE_FALLING>;

To remove the need of resetting the interrupt-parent in each child you
can use the following form:

    interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;



But, if we correct the ssbi gpio driver then this would no longer be
interrupt 208 in this parent, right?. I believe that if you say
<&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
after we correct the gpio translation.

(Which probably means we need to get that redesigned, before we
introduce to many of these)

> +					pinctrl-names = "default";
> +					pinctrl-0 = <&dragon_mpu3050_gpios>;
> +					vlogic-supply = <&pm8058_lvs0>; // 1.8V
> +					vdd-supply = <&pm8058_l14>; // 2.85V
> +
> +					/*
> +					 * The MPU-3050 acts as a hub for the
> +					 * accelerometer.
> +					 */
> +					i2c-gate {
> +						#address-cells = <1>;
> +						#size-cells = <0>;
> +
> +						kxsd9@18 {
> +							compatible = "kionix,kxsd9";
> +							reg = <0x18>;
> +							interrupt-parent = <&tlmm>;
> +							interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
> +							pinctrl-names = "default";
> +							pinctrl-0 = <&dragon_kxsd9_gpios>;
> +							iovdd-supply = <&pm8058_lvs0>; // 1.8V
> +							vdd-supply = <&pm8058_l14>; // 2.85V
> +						};
> +					};
> +				};

Regards,
Bjorn

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

* [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
@ 2016-10-31 22:20   ` Bjorn Andersson
  0 siblings, 0 replies; 10+ messages in thread
From: Bjorn Andersson @ 2016-10-31 22:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed 26 Oct 02:23 PDT 2016, Linus Walleij wrote:

> This adds the MPU-3050 gyroscope and the KXSD9 accelerometer to
> the Qualcomm APQ8060 Dragonboard. The KXSD9 is mounted beyond the
> MPU-3050 and appear as a subdevice beyond it. We set up the
> required GPIO and interrupt lines to make the devices work.
> 

I'm concerned about the interrupt below, but apart from that

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v2->v3:
> - Should be fine to apply now: all bindings and requirements are
>   merged.
> ChangeLog v1->v2:
> - Use the new I2C mux gate bindings from Peter Rosin (merged to
>   the I2C subsystem)
> ---
>  arch/arm/boot/dts/qcom-apq8060-dragonboard.dts | 53 ++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts b/arch/arm/boot/dts/qcom-apq8060-dragonboard.dts
[..]
> +				mpu3050 at 68 {
> +					compatible = "invensense,mpu3050";
> +					reg = <0x68>;
> +					/*
> +					 * GPIO17 has interrupt 208 on the
> +					 * PM8058, it is pulled high by a 10k
> +					 * resistor to VLOGIC so needs to be
> +					 * active low/falling edge.
> +					 */
> +					interrupt-parent = <&pm8058_gpio>;
> +					interrupts = <208 IRQ_TYPE_EDGE_FALLING>;

To remove the need of resetting the interrupt-parent in each child you
can use the following form:

    interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;



But, if we correct the ssbi gpio driver then this would no longer be
interrupt 208 in this parent, right?. I believe that if you say
<&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
after we correct the gpio translation.

(Which probably means we need to get that redesigned, before we
introduce to many of these)

> +					pinctrl-names = "default";
> +					pinctrl-0 = <&dragon_mpu3050_gpios>;
> +					vlogic-supply = <&pm8058_lvs0>; // 1.8V
> +					vdd-supply = <&pm8058_l14>; // 2.85V
> +
> +					/*
> +					 * The MPU-3050 acts as a hub for the
> +					 * accelerometer.
> +					 */
> +					i2c-gate {
> +						#address-cells = <1>;
> +						#size-cells = <0>;
> +
> +						kxsd9 at 18 {
> +							compatible = "kionix,kxsd9";
> +							reg = <0x18>;
> +							interrupt-parent = <&tlmm>;
> +							interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
> +							pinctrl-names = "default";
> +							pinctrl-0 = <&dragon_kxsd9_gpios>;
> +							iovdd-supply = <&pm8058_lvs0>; // 1.8V
> +							vdd-supply = <&pm8058_l14>; // 2.85V
> +						};
> +					};
> +				};

Regards,
Bjorn

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

* Re: [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
  2016-10-31 22:20   ` Bjorn Andersson
@ 2016-11-01 11:31     ` Linus Walleij
  -1 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2016-11-01 11:31 UTC (permalink / raw)
  To: Bjorn Andersson, iivanov.xz
  Cc: linux-arm-kernel, linux-arm-msm, Andy Gross, Stephen Boyd, David Brown

On Mon, Oct 31, 2016 at 11:20 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

>> +                                     interrupt-parent = <&pm8058_gpio>;
>> +                                     interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
>
> To remove the need of resetting the interrupt-parent in each child you
> can use the following form:
>
>     interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;
>
> But, if we correct the ssbi gpio driver then this would no longer be
> interrupt 208 in this parent, right?. I believe that if you say
> <&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
> after we correct the gpio translation.

Yes. It should be fixed everywhere but is not related to this
patch. But I can do a two-patch series first fixing this and then
adding the gyro+accelerometer on top referencing the MFD
pmicintc as parent.

> (Which probably means we need to get that redesigned, before we
> introduce to many of these)

What needs to happen is for the SSBI and SPMI GPIO to use a
hierarchical irqdomain so their GPIO local line offset and hwirq
are the same. Then we can reference the GPIO IRQ lines directly
in a correct manner.

You are not alone with this mess. A lot of hierarchical GPIOs
are wrong. My fail as GPIO maintainer I guess, ouch.

Yours,
Linus Walleij

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

* [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
@ 2016-11-01 11:31     ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2016-11-01 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 31, 2016 at 11:20 PM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

>> +                                     interrupt-parent = <&pm8058_gpio>;
>> +                                     interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
>
> To remove the need of resetting the interrupt-parent in each child you
> can use the following form:
>
>     interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;
>
> But, if we correct the ssbi gpio driver then this would no longer be
> interrupt 208 in this parent, right?. I believe that if you say
> <&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
> after we correct the gpio translation.

Yes. It should be fixed everywhere but is not related to this
patch. But I can do a two-patch series first fixing this and then
adding the gyro+accelerometer on top referencing the MFD
pmicintc as parent.

> (Which probably means we need to get that redesigned, before we
> introduce to many of these)

What needs to happen is for the SSBI and SPMI GPIO to use a
hierarchical irqdomain so their GPIO local line offset and hwirq
are the same. Then we can reference the GPIO IRQ lines directly
in a correct manner.

You are not alone with this mess. A lot of hierarchical GPIOs
are wrong. My fail as GPIO maintainer I guess, ouch.

Yours,
Linus Walleij

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

* Re: [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
  2016-11-01 11:31     ` Linus Walleij
@ 2016-11-01 23:17       ` Bjorn Andersson
  -1 siblings, 0 replies; 10+ messages in thread
From: Bjorn Andersson @ 2016-11-01 23:17 UTC (permalink / raw)
  To: Linus Walleij
  Cc: iivanov.xz, Andy Gross, linux-arm-msm, Stephen Boyd,
	linux-arm-kernel, David Brown

On Tue 01 Nov 04:31 PDT 2016, Linus Walleij wrote:

> On Mon, Oct 31, 2016 at 11:20 PM, Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> 
> >> +                                     interrupt-parent = <&pm8058_gpio>;
> >> +                                     interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
> >
> > To remove the need of resetting the interrupt-parent in each child you
> > can use the following form:
> >
> >     interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;
> >
> > But, if we correct the ssbi gpio driver then this would no longer be
> > interrupt 208 in this parent, right?. I believe that if you say
> > <&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
> > after we correct the gpio translation.
> 
> Yes. It should be fixed everywhere but is not related to this
> patch. But I can do a two-patch series first fixing this and then
> adding the gyro+accelerometer on top referencing the MFD
> pmicintc as parent.
> 

Sorry, I'm not sure I'm following.

What I tried to say was that before the correction of the GPIO block's
window this particular IRQ would be #208 in &pmicintc and #208 in
&pm8058_gpio. After the correction of the window the IRQ is #208 in
&pmicintc and #17 in &pm8058_gpio.

As such, using #208 from &pmicintc would make this work through the
correction of the GPIO driver. Perhaps I'm wrong about this?


Either way, it's no big deal. I'm fine with either path.

> > (Which probably means we need to get that redesigned, before we
> > introduce to many of these)
> 
> What needs to happen is for the SSBI and SPMI GPIO to use a
> hierarchical irqdomain so their GPIO local line offset and hwirq
> are the same. Then we can reference the GPIO IRQ lines directly
> in a correct manner.
> 

Right. Do you have any example of drivers getting this right? I did take
a quick look but didn't find one.

Regards,
Bjorn

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

* [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
@ 2016-11-01 23:17       ` Bjorn Andersson
  0 siblings, 0 replies; 10+ messages in thread
From: Bjorn Andersson @ 2016-11-01 23:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue 01 Nov 04:31 PDT 2016, Linus Walleij wrote:

> On Mon, Oct 31, 2016 at 11:20 PM, Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> 
> >> +                                     interrupt-parent = <&pm8058_gpio>;
> >> +                                     interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
> >
> > To remove the need of resetting the interrupt-parent in each child you
> > can use the following form:
> >
> >     interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;
> >
> > But, if we correct the ssbi gpio driver then this would no longer be
> > interrupt 208 in this parent, right?. I believe that if you say
> > <&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
> > after we correct the gpio translation.
> 
> Yes. It should be fixed everywhere but is not related to this
> patch. But I can do a two-patch series first fixing this and then
> adding the gyro+accelerometer on top referencing the MFD
> pmicintc as parent.
> 

Sorry, I'm not sure I'm following.

What I tried to say was that before the correction of the GPIO block's
window this particular IRQ would be #208 in &pmicintc and #208 in
&pm8058_gpio. After the correction of the window the IRQ is #208 in
&pmicintc and #17 in &pm8058_gpio.

As such, using #208 from &pmicintc would make this work through the
correction of the GPIO driver. Perhaps I'm wrong about this?


Either way, it's no big deal. I'm fine with either path.

> > (Which probably means we need to get that redesigned, before we
> > introduce to many of these)
> 
> What needs to happen is for the SSBI and SPMI GPIO to use a
> hierarchical irqdomain so their GPIO local line offset and hwirq
> are the same. Then we can reference the GPIO IRQ lines directly
> in a correct manner.
> 

Right. Do you have any example of drivers getting this right? I did take
a quick look but didn't find one.

Regards,
Bjorn

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

* Re: [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
  2016-11-01 23:17       ` Bjorn Andersson
@ 2016-11-03  8:46         ` Linus Walleij
  -1 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2016-11-03  8:46 UTC (permalink / raw)
  To: Bjorn Andersson, Quan Nguyen
  Cc: Ivan Ivanov, Andy Gross, linux-arm-msm, Stephen Boyd,
	linux-arm-kernel, David Brown

[CC Quan who made a nice hierarchical domain]

On Wed, Nov 2, 2016 at 12:17 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Tue 01 Nov 04:31 PDT 2016, Linus Walleij wrote:
>
>> On Mon, Oct 31, 2016 at 11:20 PM, Bjorn Andersson
>> <bjorn.andersson@linaro.org> wrote:
>>
>> >> +                                     interrupt-parent = <&pm8058_gpio>;
>> >> +                                     interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
>> >
>> > To remove the need of resetting the interrupt-parent in each child you
>> > can use the following form:
>> >
>> >     interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;
>> >
>> > But, if we correct the ssbi gpio driver then this would no longer be
>> > interrupt 208 in this parent, right?. I believe that if you say
>> > <&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
>> > after we correct the gpio translation.
>>
>> Yes. It should be fixed everywhere but is not related to this
>> patch. But I can do a two-patch series first fixing this and then
>> adding the gyro+accelerometer on top referencing the MFD
>> pmicintc as parent.
>>
>
> Sorry, I'm not sure I'm following.
>
> What I tried to say was that before the correction of the GPIO block's
> window this particular IRQ would be #208 in &pmicintc and #208 in
> &pm8058_gpio. After the correction of the window the IRQ is #208 in
> &pmicintc and #17 in &pm8058_gpio.
>
> As such, using #208 from &pmicintc would make this work through the
> correction of the GPIO driver. Perhaps I'm wrong about this?

No that is exactly what I mean. I just mean I should not use
the pm8058_gpio as interrupt parent at all for now.

(You will see in my patch set, cooking it.)

>> What needs to happen is for the SSBI and SPMI GPIO to use a
>> hierarchical irqdomain so their GPIO local line offset and hwirq
>> are the same. Then we can reference the GPIO IRQ lines directly
>> in a correct manner.
>
> Right. Do you have any example of drivers getting this right? I did take
> a quick look but didn't find one.

It seems drivers/gpio/gpio-xgene-sb.c is doing something like
what we want. See for example how it picks out the parent domain
and hangs a new domain off it.

If possible, I would like to add infrastructure for this to gpiolib,
if it can be made generic and make sense.

Yours,
Linus Walleij

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

* [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard
@ 2016-11-03  8:46         ` Linus Walleij
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2016-11-03  8:46 UTC (permalink / raw)
  To: linux-arm-kernel

[CC Quan who made a nice hierarchical domain]

On Wed, Nov 2, 2016 at 12:17 AM, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
> On Tue 01 Nov 04:31 PDT 2016, Linus Walleij wrote:
>
>> On Mon, Oct 31, 2016 at 11:20 PM, Bjorn Andersson
>> <bjorn.andersson@linaro.org> wrote:
>>
>> >> +                                     interrupt-parent = <&pm8058_gpio>;
>> >> +                                     interrupts = <208 IRQ_TYPE_EDGE_FALLING>;
>> >
>> > To remove the need of resetting the interrupt-parent in each child you
>> > can use the following form:
>> >
>> >     interrupts-extended = <&pm8058_gpio 208 IRQ_TYPE_EDGE_FALLING>;
>> >
>> > But, if we correct the ssbi gpio driver then this would no longer be
>> > interrupt 208 in this parent, right?. I believe that if you say
>> > <&pmicintc 208 IRQ_TYPE_EDGE_FALLING> instead, which should work even
>> > after we correct the gpio translation.
>>
>> Yes. It should be fixed everywhere but is not related to this
>> patch. But I can do a two-patch series first fixing this and then
>> adding the gyro+accelerometer on top referencing the MFD
>> pmicintc as parent.
>>
>
> Sorry, I'm not sure I'm following.
>
> What I tried to say was that before the correction of the GPIO block's
> window this particular IRQ would be #208 in &pmicintc and #208 in
> &pm8058_gpio. After the correction of the window the IRQ is #208 in
> &pmicintc and #17 in &pm8058_gpio.
>
> As such, using #208 from &pmicintc would make this work through the
> correction of the GPIO driver. Perhaps I'm wrong about this?

No that is exactly what I mean. I just mean I should not use
the pm8058_gpio as interrupt parent at all for now.

(You will see in my patch set, cooking it.)

>> What needs to happen is for the SSBI and SPMI GPIO to use a
>> hierarchical irqdomain so their GPIO local line offset and hwirq
>> are the same. Then we can reference the GPIO IRQ lines directly
>> in a correct manner.
>
> Right. Do you have any example of drivers getting this right? I did take
> a quick look but didn't find one.

It seems drivers/gpio/gpio-xgene-sb.c is doing something like
what we want. See for example how it picks out the parent domain
and hangs a new domain off it.

If possible, I would like to add infrastructure for this to gpiolib,
if it can be made generic and make sense.

Yours,
Linus Walleij

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

end of thread, other threads:[~2016-11-03  8:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-26  9:23 [PATCH v3] ARM: dts: Add gyro and accel to APQ8060 Dragonboard Linus Walleij
2016-10-26  9:23 ` Linus Walleij
2016-10-31 22:20 ` Bjorn Andersson
2016-10-31 22:20   ` Bjorn Andersson
2016-11-01 11:31   ` Linus Walleij
2016-11-01 11:31     ` Linus Walleij
2016-11-01 23:17     ` Bjorn Andersson
2016-11-01 23:17       ` Bjorn Andersson
2016-11-03  8:46       ` Linus Walleij
2016-11-03  8:46         ` Linus Walleij

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.