Skip to contentSkip to conversation

ARM: dts: sun4i: gemei-g9: Devicetree improvements

PATCH New Priit Laes 4 participants 12 messages Nov 6, 2015 – Nov 20, 2015

Subsystems (2)
lore
Share & tools
lore

Priit Laes

author
#0 lore raw

v3 cover ARM: dts: sun4i: gemei-g9: Devicetree improvements

Improvements to devicetree setup:
- Converted to use axp209 regulator nodes
- Fix invalid regulator for LRADC keys
- Enable audio codec node

Changes sinve v2:
- Dropped applied "Added IRQ configuration for bma250 accelerometer" patch

Changes since v1:
- Dropped NAND patch because driver is not yet ready
- Dropped applied KEYBOARD_SUN4I_LRADC patch
- Added sun4i audio codec patch

Priit Laes (3):
ARM: dts: sun4i: gemei-g9: Convert to use axp209 regulator nodes
ARM: dts: sun4i: gemei-g9: Use reg_ldo2 instead of reg_vcc3v0
ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 42 +++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 6 deletions(-)
Signature · 1 line
2.6.3
author
#1 lore raw

PATCH v3 1/3 ARM: dts: sun4i: gemei-g9: Convert to use axp209 regulator nodes

Add regulator nodes for axp209 using the axp209.dtsi include.

---
Changes in v3:
- Drop the ohci0 node. It's not needed.

Changes in v2:
- Add the ohci0 node.

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 35 ++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +31 -4
index 3f0aeb8..6b4c29d 100644
@@ -72,6 +72,10 @@
  *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
  */
 
+&cpu0 {
+	cpu-supply = <&reg_dcdc2>;
+};
+
 &ehci0 {
 	status = "okay";
 };
@@ -86,15 +90,13 @@
 	status = "okay";
 
 	axp209: pmic at 34 {
-		compatible = "x-powers,axp209";
 		reg = <0x34>;
 		interrupts = <0>;
-
-		interrupt-controller;
-		#interrupt-cells = <1>;
 	};
 };
 
+#include "axp209.dtsi"
+
 &i2c1 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c1_pins_a>;
@@ -146,6 +148,31 @@
 	status = "okay";
 };
 
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1250000>;
+	regulator-max-microvolt = <1250000>;
+	regulator-name = "vdd-int-dll";
+};
+
+&reg_ldo1 {
+	regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "avcc";
+};
+
 &reg_usb1_vbus {
 	status = "okay";
 };
Signature · 1 line
2.6.3
#2 lore raw

PATCH v3 1/3 ARM: dts: sun4i: gemei-g9: Convert to use axp209 regulator nodes

Hi,

Quoted 54 lines · Priit Laes

Add regulator nodes for axp209 using the axp209.dtsi include.

---
Changes in v3:
- Drop the ohci0 node. It's not needed.

Changes in v2:
- Add the ohci0 node.

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 35 ++++++++++++++++++++++++++++----
 1 file changed, 31 insertions(+), 4 deletions(-)
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +9 -4
index 3f0aeb8..6b4c29d 100644
@@ -72,6 +72,10 @@
  *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
  */
 
+&cpu0 {
+       cpu-supply = <&reg_dcdc2>;
+};
+
 &ehci0 {
        status = "okay";
 };
@@ -86,15 +90,13 @@
        status = "okay";
 
        axp209: pmic at 34 {
-               compatible = "x-powers,axp209";
                reg = <0x34>;
                interrupts = <0>;
-
-               interrupt-controller;
-               #interrupt-cells = <1>;
        };
 };
 
+#include "axp209.dtsi"
+
 &i2c1 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c1_pins_a>;
@@ -146,6 +148,31 @@
        status = "okay";
 };
 
+&reg_dcdc2 {
+       regulator-always-on;
+       regulator-min-microvolt = <1000000>;

arch/arm/boot/dts/sun4i-a10-gemei-g9.dts line 163

Quoted 10 lines
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +10 -0
+       regulator-max-microvolt = <1400000>;
+       regulator-name = "vdd-cpu";
+};
+
+&reg_dcdc3 {
+       regulator-always-on;
+       regulator-min-microvolt = <1250000>;
+       regulator-max-microvolt = <1250000>;
+       regulator-name = "vdd-int-dll";
+};

The latest consensus for these system critical regulators is to use the recommended range from the datasheet. The voltage is set by the bootloader and never touched by Linux, thus avoiding any mismatch issues.

arch/arm/boot/dts/sun4i-a10-gemei-g9.dts line 173

Quoted 10 lines
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +10 -0
+
+&reg_ldo1 {
+       regulator-name = "vdd-rtc";
+};
+
+&reg_ldo2 {
+       regulator-always-on;
+       regulator-min-microvolt = <3000000>;
+       regulator-max-microvolt = <3000000>;
+       regulator-name = "avcc";

That goes for this one as well.

Regards
ChenYu

Quoted 8 lines
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +2 -1
+};
+
 &reg_usb1_vbus {
        status = "okay";
 };
--

2.6.3

author
#3 lore raw

PATCH v3 2/3 ARM: dts: sun4i: gemei-g9: Use reg_ldo2 instead of reg_vcc3v0

In reply to Priit Laes

ADC seems to be using ldo2 for reference voltage.

---
 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +1 -1
index 6b4c29d..16c1a67 100644
@@ -112,7 +112,7 @@
 };
 
 &lradc {
-	vref-supply = <&reg_vcc3v0>;
+	vref-supply = <&reg_ldo2>;
 
 	status = "okay";
 
Signature · 1 line
2.6.3
#4 lore raw

PATCH v3 2/3 ARM: dts: sun4i: gemei-g9: Use reg_ldo2 instead of reg_vcc3v0

Quoted 3 lines · Priit Laes

ADC seems to be using ldo2 for reference voltage.

I assume this is from some reference design and there is no way to actually confirm it without exact schematics? There's no mention of it in the FEX file. If so you should probably expand the commit message to include the source of such an assumption.

Quoted 3 lines
---
 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#5 lore raw

PATCH v3 3/3 ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

In reply to Priit Laes

Gemei G9 has internal speakers and headphone jack. Audio switching from internal speakers to headphones is automatically handled by extra FT2012Q audio amplifier chip that works out of the box.

---
Changes since v2:
- Dropped routing property.

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +4 -1
index 16c1a67..1d73a98 100644
@@ -65,12 +65,15 @@
 /*
  * TODO:
  *   2x cameras via CSI
- *   audio
+ *   audio input
  *   AXP battery management
  *   NAND
  *   OTG
  *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
  */
+&codec {
+	status = "okay";
+};
 
 &cpu0 {
 	cpu-supply = <&reg_dcdc2>;
Signature · 1 line
2.6.3
#6 lore raw

PATCH v3 3/3 ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

Quoted 3 lines · Priit Laes

Gemei G9 has internal speakers and headphone jack. Audio switching from internal speakers to headphones is automatically handled by extra FT2012Q audio amplifier chip that works out of the box.

Nice that it works out of the box. The FEX file does mention:

audio_pa_ctrl = port:PH15<1><default><default><0>

So either it is floating or pulled up by default? Since it works now I don't see any reason to block it. On the other hand once that binding is introduced it would be nice to add it for power management reasons.

Quoted 32 lines

---
Changes since v2:
- Dropped routing property.

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +4 -2
index 16c1a67..1d73a98 100644
@@ -65,12 +65,15 @@
 /*
  * TODO:
  *   2x cameras via CSI
- *   audio
+ *   audio input
  *   AXP battery management
  *   NAND
  *   OTG
  *   Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48
  */
+&codec {
+       status = "okay";
+};
 
 &cpu0 {
        cpu-supply = <&reg_dcdc2>;
--

2.6.3

author
#7 lore raw

[linux-sunxi] Re: [PATCH v3 3/3] ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

Quoted 8 lines · Chen-Yu Tsai
Quoted 3 lines · Priit Laes

Gemei G9 has internal speakers and headphone jack. Audio switching from internal speakers to headphones is automatically handled by extra FT2012Q audio amplifier chip that works out of the box.

Nice that it works out of the box. The FEX file does mention:

audio_pa_ctrl???= port:PH15<1><default><default><0>

Nice catch.

Setting it low mutes audio, and setting it back high unmutes.

Quoted 4 lines

So either it is floating or pulled up by default? Since it works now I don't see any reason to block it. On the other hand once that binding is introduced it would be nice to add it for power management reasons.

Should I just add comment about it or do something like this:

&codec {
? status = "okay";
? /*
? ?* TODO: Add codec_ext_pwr_pin to turn off external audio AMP ? ?&pio {
? ? ?codec_ext_pwr_pin:?codec_ext_pwr_pin at 0?{
? ? ? ?allwinner,pins = "PH15";
? ? ? ?allwinner,function = "gpio_out";
? ? ? ?allwinner,drive = <SUN4I_PINCTRL_10_MA>;
? ? ? ?allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
? ? ?}
? ?}
? ?*/
}

Quoted 37 lines
Quoted 33 lines

---
Changes since v2:
?- Dropped routing property.

?arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 5 ++++- ?1 file changed, 4 insertions(+), 1 deletion(-)

arch/arm/boot/dts/sun4i-a10-gemei-g9.dts +0 -0
index 16c1a67..1d73a98 100644
@@ -65,12 +65,15 @@

?/*
? * TODO:
? *???2x cameras via CSI
- *???audio
+ *???audio input
? *???AXP battery management
? *???NAND
? *???OTG
? *???Touchscreen - gt801_2plus1 @ i2c adapter 2 @ 0x48 ? */
+&codec {
+???????status = "okay";
+};

?&cpu0 {
????????cpu-supply = <&reg_dcdc2>;
--
2.6.3

#8 lore raw

[linux-sunxi] Re: [PATCH v3 3/3] ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

Hi,

Quoted 6 lines · Priit Laes
Quoted 5 lines · Chen-Yu Tsai
Quoted 3 lines · Priit Laes

Gemei G9 has internal speakers and headphone jack. Audio switching from internal speakers to headphones is automatically handled by extra FT2012Q audio amplifier chip that works out of the box.

Quoted 7 lines
Quoted 3 lines

Nice that it works out of the box. The FEX file does mention:

audio_pa_ctrl???= port:PH15<1><default><default><0>

Nice catch.

Setting it low mutes audio, and setting it back high unmutes.

Then you just volunteered yourself to fix the FIXME in the driver ;)

Quoted 7 lines
Quoted 4 lines

So either it is floating or pulled up by default? Since it works now I don't see any reason to block it. On the other hand once that binding is introduced it would be nice to add it for power management reasons.

Should I just add comment about it or do something like this:

Quoted 14 lines

&codec {
? status = "okay";
? /*
? ?* TODO: Add codec_ext_pwr_pin to turn off external audio AMP ? ?&pio {
? ? ?codec_ext_pwr_pin:?codec_ext_pwr_pin at 0?{
? ? ? ?allwinner,pins = "PH15";
? ? ? ?allwinner,function = "gpio_out";
? ? ? ?allwinner,drive = <SUN4I_PINCTRL_10_MA>;
? ? ? ?allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
? ? ?}
? ?}
? ?*/
}

More like

&pio {
	codec_ext_pwr_pin: codec_ext_pwr_pin at 0 {
		allwinner,pins = "PH15";
		allwinner,function = "gpio_out";
		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
	};
};
&codec {
	/* This pin is used to turn off the GPIO amp pin */
	pinctrl-names = "default";
	pinctrl-0 <&codec_ext_pwr_pin>;
	status = "okay";
};

Of course, that's a temporary measure, and you should actually use that GPIO to enable / disable the Amplifier when you are playing sound. It shouldn't be that hard with ASoC.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151119/0b76ebe7/attachment.sig>
#9 lore raw

[linux-sunxi] Re: [PATCH v3 3/3] ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

Quoted 11 lines · Maxime Ripard

Hi,

Quoted 8 lines · Priit Laes
Quoted 7 lines · Chen-Yu Tsai
Quoted 3 lines · Priit Laes

Gemei G9 has internal speakers and headphone jack. Audio switching from internal speakers to headphones is automatically handled by extra FT2012Q audio amplifier chip that works out of the box.

Nice that it works out of the box. The FEX file does mention:

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

audio_pa_ctrl = port:PH15<1><default><default><0>

Nice catch.

Setting it low mutes audio, and setting it back high unmutes.

Then you just volunteered yourself to fix the FIXME in the driver ;)

Hans seems to have a patch for this in his sunxi-wip branch. I haven't looked at it though.

ChenYu

Quoted 50 lines
Quoted 18 lines
Quoted 4 lines

So either it is floating or pulled up by default? Since it works now I don't see any reason to block it. On the other hand once that binding is introduced it would be nice to add it for power management reasons.

Should I just add comment about it or do something like this:

&codec {
status = "okay";
/*
* TODO: Add codec_ext_pwr_pin to turn off external audio AMP

   &pio {
     codec_ext_pwr_pin: codec_ext_pwr_pin at 0 {
       allwinner,pins = "PH15";
       allwinner,function = "gpio_out";
       allwinner,drive = <SUN4I_PINCTRL_10_MA>;
       allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
     }
Quoted 3 lines

}
*/
}

More like

&pio {
        codec_ext_pwr_pin: codec_ext_pwr_pin at 0 {
                allwinner,pins = "PH15";
                allwinner,function = "gpio_out";
                allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
        };
};
&codec {
        /* This pin is used to turn off the GPIO amp pin */
        pinctrl-names = "default";
        pinctrl-0 <&codec_ext_pwr_pin>;
        status = "okay";
};

Of course, that's a temporary measure, and you should actually use that GPIO to enable / disable the Amplifier when you are playing sound. It shouldn't be that hard with ASoC.

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

#10 lore raw

[linux-sunxi] Re: [PATCH v3 3/3] ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

Hi,

Quoted 17 lines · Chen-Yu Tsai
Quoted 15 lines · Maxime Ripard

Hi,

Quoted 12 lines · Priit Laes
Quoted 8 lines · Chen-Yu Tsai
Quoted 3 lines · Priit Laes

Gemei G9 has internal speakers and headphone jack. Audio switching from internal speakers to headphones is automatically handled by extra FT2012Q audio amplifier chip that works out of the box.

Nice that it works out of the box. The FEX file does mention:

audio_pa_ctrl = port:PH15<1><default><default><0>

Nice catch.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Setting it low mutes audio, and setting it back high unmutes.

Then you just volunteered yourself to fix the FIXME in the driver ;)

Hans seems to have a patch for this in his sunxi-wip branch. I haven't looked at it though.

Right, I needed support for the pa pin on one of my own tablets, and there things just did not work without it.

Note this patch is ready for upstream submission, I just did not get around to submitting it yet (I wrote it Tuesday evening).

Regards,

Hans

Quoted 53 lines

ChenYu

Quoted 50 lines
Quoted 7 lines
Quoted 4 lines

So either it is floating or pulled up by default? Since it works now I don't see any reason to block it. On the other hand once that binding is introduced it would be nice to add it for power management reasons.

Should I just add comment about it or do something like this:

Quoted 14 lines
&codec {
   status = "okay";
   /*
    * TODO: Add codec_ext_pwr_pin to turn off external audio AMP
    &pio {
      codec_ext_pwr_pin: codec_ext_pwr_pin at 0 {
        allwinner,pins = "PH15";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
      }
    }
    */
}

More like

&pio {
         codec_ext_pwr_pin: codec_ext_pwr_pin at 0 {
                 allwinner,pins = "PH15";
                 allwinner,function = "gpio_out";
                 allwinner,drive = <SUN4I_PINCTRL_10_MA>;
                 allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
         };
};
&codec {
         /* This pin is used to turn off the GPIO amp pin */
         pinctrl-names = "default";
         pinctrl-0 <&codec_ext_pwr_pin>;
         status = "okay";
};

Of course, that's a temporary measure, and you should actually use that GPIO to enable / disable the Amplifier when you are playing sound. It shouldn't be that hard with ASoC.

Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

#11 lore raw

v3 cover ARM: dts: sun4i: gemei-g9: Devicetree improvements

In reply to Priit Laes
Quoted 14 lines · Priit Laes

Improvements to devicetree setup:
- Converted to use axp209 regulator nodes
- Fix invalid regulator for LRADC keys
- Enable audio codec node

Changes sinve v2:
- Dropped applied "Added IRQ configuration for bma250 accelerometer" patch

Changes since v1:
- Dropped NAND patch because driver is not yet ready
- Dropped applied KEYBOARD_SUN4I_LRADC patch
- Added sun4i audio codec patch

Quoted 7 lines

Priit Laes (3):
ARM: dts: sun4i: gemei-g9: Convert to use axp209 regulator nodes
ARM: dts: sun4i: gemei-g9: Use reg_ldo2 instead of reg_vcc3v0
ARM: dts: sun4i: gemei-g9: Enable sun4i audio codec support

 arch/arm/boot/dts/sun4i-a10-gemei-g9.dts | 42 +++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 6 deletions(-)

Applied, thanks !

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151108/71789b29/attachment.sig>