Hi everyone,
This series enables more peripherals for Allwinner A13-based Q8 devices. The peripherals include the WiFi, the PMIC's micro-usb power supply (driver), audio codec (headphone and speaker), and full display support with the new DRM KMS driver. The series is based on parts of Maxime's "drm: Add Support for Passive RGB to VGA bridges" series, specifically the clk and drm fixes, and common DTS bits.
Hans, since you have a collection of q8 tablets, I'm hoping you could test these bits and provide some feedback.
Patch 1 is a small fix for part of the init failure path.
Patch 2 disables ldo5 on the axp209 by default. This regulator output is muxed with a gpio, and the regulator on/off settings override the gpio.
Patch 3 enables the USB WiFi module found.
Patch 4 enables the USB/VBUS power supply of the PMIC.
Patch 5 enables the audio codec, with support for the speaker amp.
Patch 6 enables the LCD panel with the display pipeline.
Regards ChenYu
Chen-Yu Tsai (6): drm: sun4i: do cleanup if RGB output init fails ARM: dts: axp209: Disable ldo5 by default ARM: dts: sun5i: q8-common: Enable USB-based WiFi ARM: dts: sun5i: q8-common: Enable USB power supply ARM: dts: sun5i: q8-common: Enable audio codec ARM: dts: sun5i: q8-common: Enable display pipeline and LCD display
arch/arm/boot/dts/axp209.dtsi | 1 + arch/arm/boot/dts/sun5i-q8-common.dtsi | 62 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun4i_tcon.c | 6 +++- 3 files changed, 68 insertions(+), 1 deletion(-)
sun4i_rgb_init() can fail, which results in TCON failing to bind. In this case we need to do cleanup, specificly unregistering the dotclock, which is regmap based, and the regmap is registered as part of the sun4i_tcon_bind().
Failing to do so results in a NULL pointer reference when the CCF tries to turn off unused clocks.
Fixes: 29e57fab97fc ("drm: sun4i: Add RGB output") Signed-off-by: Chen-Yu Tsai wens@csie.org --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 9f19b0e08560..dea673275356 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -490,7 +490,11 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master, return 0; }
- return sun4i_rgb_init(drm); + ret = sun4i_rgb_init(drm); + if (ret < 0) + goto err_free_clocks; + + return 0;
err_free_clocks: sun4i_tcon_free_clocks(tcon);
On Tue, May 17, 2016 at 11:56:06PM +0800, Chen-Yu Tsai wrote:
sun4i_rgb_init() can fail, which results in TCON failing to bind. In this case we need to do cleanup, specificly unregistering the dotclock, which is regmap based, and the regmap is registered as part of the sun4i_tcon_bind().
Failing to do so results in a NULL pointer reference when the CCF tries to turn off unused clocks.
Fixes: 29e57fab97fc ("drm: sun4i: Add RGB output") Signed-off-by: Chen-Yu Tsai wens@csie.org
Applied, thanks! Maxime
The output pin of LDO is also a GPIO pin, and the on/off settings of the regulator are actually pinmux settings.
Disable it by default so it doesn't conflict with GPIO usage.
Signed-off-by: Chen-Yu Tsai wens@csie.org --- arch/arm/boot/dts/axp209.dtsi | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index 051ab3ba9a65..afbe89c01df5 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -87,6 +87,7 @@
reg_ldo5: ldo5 { regulator-name = "ldo5"; + status = "disabled"; }; };
On Tue, May 17, 2016 at 11:56:07PM +0800, Chen-Yu Tsai wrote:
The output pin of LDO is also a GPIO pin, and the on/off settings of the regulator are actually pinmux settings.
Disable it by default so it doesn't conflict with GPIO usage.
Signed-off-by: Chen-Yu Tsai wens@csie.org
Applied, thanks!
Maxime
The early A13 Q8 tablets all use a Realtek WiFi module connected to USB1. The module is powered by AXP209's LDO3 at 3.3V.
Signed-off-by: Chen-Yu Tsai wens@csie.org --- arch/arm/boot/dts/sun5i-q8-common.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-q8-common.dtsi b/arch/arm/boot/dts/sun5i-q8-common.dtsi index a78e189f6653..dcaaa085ac77 100644 --- a/arch/arm/boot/dts/sun5i-q8-common.dtsi +++ b/arch/arm/boot/dts/sun5i-q8-common.dtsi @@ -154,6 +154,12 @@ regulator-name = "avcc"; };
+®_ldo3 { + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-wifi"; +}; + ®_usb0_vbus { gpio = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ status = "okay"; @@ -176,5 +182,6 @@ usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */ usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */ usb0_vbus-supply = <®_usb0_vbus>; + usb1_vbus-supply = <®_ldo3>; status = "okay"; };
On the A13 Q8 tablets, the PMIC's USB power supply (VBUS) is connected to the external OTG port. This can be used to provide power and OTG VBUS sensing.
Signed-off-by: Chen-Yu Tsai wens@csie.org --- arch/arm/boot/dts/sun5i-q8-common.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-q8-common.dtsi b/arch/arm/boot/dts/sun5i-q8-common.dtsi index dcaaa085ac77..8fc1b6110fb8 100644 --- a/arch/arm/boot/dts/sun5i-q8-common.dtsi +++ b/arch/arm/boot/dts/sun5i-q8-common.dtsi @@ -176,11 +176,16 @@ status = "okay"; };
+&usb_power_supply { + status = "okay"; +}; + &usbphy { pinctrl-names = "default"; pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>; usb0_id_det-gpio = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */ usb0_vbus_det-gpio = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */ + usb0_vbus_power-supply = <&usb_power_supply>; usb0_vbus-supply = <®_usb0_vbus>; usb1_vbus-supply = <®_ldo3>; status = "okay";
On Tue, May 17, 2016 at 11:56:09PM +0800, Chen-Yu Tsai wrote:
On the A13 Q8 tablets, the PMIC's USB power supply (VBUS) is connected to the external OTG port. This can be used to provide power and OTG VBUS sensing.
Signed-off-by: Chen-Yu Tsai wens@csie.org
Applied, thanks! Maxime
The Q8 tablets use the audio codec to provide audio output via a headphone jack or a small mono speaker. A GPIO output is used to control speaker amp.
The tablets may or may not have an internal microphone.
Signed-off-by: Chen-Yu Tsai wens@csie.org --- arch/arm/boot/dts/sun5i-q8-common.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-q8-common.dtsi b/arch/arm/boot/dts/sun5i-q8-common.dtsi index 8fc1b6110fb8..5b065fd542f0 100644 --- a/arch/arm/boot/dts/sun5i-q8-common.dtsi +++ b/arch/arm/boot/dts/sun5i-q8-common.dtsi @@ -61,6 +61,13 @@ }; };
+&codec { + pinctrl-names = "default"; + pinctrl-0 = <&codec_pa_pin>; + allwinner,pa-gpios = <&pio 6 10 GPIO_ACTIVE_HIGH>; /* PG10 */ + status = "okay"; +}; + &cpu0 { cpu-supply = <®_dcdc2>; }; @@ -100,6 +107,13 @@ };
&pio { + codec_pa_pin: codec_pa_pin@0 { + allwinner,pins = "PG10"; + allwinner,function = "gpio_out"; + allwinner,drive = <SUN4I_PINCTRL_10_MA>; + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>; + }; + mmc0_cd_pin_q8: mmc0_cd_pin@0 { allwinner,pins = "PG0"; allwinner,function = "gpio_in";
On Tue, May 17, 2016 at 11:56:10PM +0800, Chen-Yu Tsai wrote:
The Q8 tablets use the audio codec to provide audio output via a headphone jack or a small mono speaker. A GPIO output is used to control speaker amp.
The tablets may or may not have an internal microphone.
Signed-off-by: Chen-Yu Tsai wens@csie.org
Applied, thanks! Maxime
Q8 form factor A13 tablets have a 7" LCD panel. Unfortunately we don't know the exact model of the panel. Just pick a panel with display timings close to what we know.
Signed-off-by: Chen-Yu Tsai wens@csie.org --- arch/arm/boot/dts/sun5i-q8-common.dtsi | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-q8-common.dtsi b/arch/arm/boot/dts/sun5i-q8-common.dtsi index 5b065fd542f0..a5de28d12b16 100644 --- a/arch/arm/boot/dts/sun5i-q8-common.dtsi +++ b/arch/arm/boot/dts/sun5i-q8-common.dtsi @@ -59,6 +59,29 @@ chosen { stdout-path = "serial0:115200n8"; }; + + panel: panel { + compatible = "urt,umsh-8596md-t", "simple-panel"; + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + /* TODO: lcd panel uses axp gpio0 as enable pin */ + backlight = <&backlight>; + #address-cells = <1>; + #size-cells = <0>; + + panel_input: endpoint@0 { + reg = <0>; + remote-endpoint = <&tcon0_out_lcd>; + }; + }; + }; +}; + +&be0 { + status = "okay"; };
&codec { @@ -179,6 +202,19 @@ status = "okay"; };
+&tcon0 { + pinctrl-names = "default"; + pinctrl-0 = <&lcd_rgb666_pins>; + status = "okay"; +}; + +&tcon0_out { + tcon0_out_lcd: endpoint@0 { + reg = <0>; + remote-endpoint = <&panel_input>; + }; +}; + &uart1 { pinctrl-names = "default"; pinctrl-0 = <&uart1_pins_b>;
On Tue, May 17, 2016 at 11:56:11PM +0800, Chen-Yu Tsai wrote:
Q8 form factor A13 tablets have a 7" LCD panel. Unfortunately we don't know the exact model of the panel. Just pick a panel with display timings close to what we know.
Signed-off-by: Chen-Yu Tsai wens@csie.org
Applied, thanks! Maxime
Hi Chen-Yu,
On 17-05-16 17:56, Chen-Yu Tsai wrote:
Hi everyone,
This series enables more peripherals for Allwinner A13-based Q8 devices. The peripherals include the WiFi, the PMIC's micro-usb power supply (driver), audio codec (headphone and speaker), and full display support with the new DRM KMS driver. The series is based on parts of Maxime's "drm: Add Support for Passive RGB to VGA bridges" series, specifically the clk and drm fixes, and common DTS bits.
Hans, since you have a collection of q8 tablets, I'm hoping you could test these bits and provide some feedback.
I've not run any tests, just looked at the patches, the stuff in patch 3 is already present in arch/arm/boot/dts/sun5i-a13-q8-tablet.dts I put it there because I saw some .fex files which don't use ldo3 for wifi I'm fine with moving it to -common though, I believe that you're right that it makes more sense there, having it in 2 places is not really useful though.
The other patches look good.
Thanks & Regards,
Hans
Patch 1 is a small fix for part of the init failure path.
Patch 2 disables ldo5 on the axp209 by default. This regulator output is muxed with a gpio, and the regulator on/off settings override the gpio.
Patch 3 enables the USB WiFi module found.
Patch 4 enables the USB/VBUS power supply of the PMIC.
Patch 5 enables the audio codec, with support for the speaker amp.
Patch 6 enables the LCD panel with the display pipeline.
Regards ChenYu
Chen-Yu Tsai (6): drm: sun4i: do cleanup if RGB output init fails ARM: dts: axp209: Disable ldo5 by default ARM: dts: sun5i: q8-common: Enable USB-based WiFi ARM: dts: sun5i: q8-common: Enable USB power supply ARM: dts: sun5i: q8-common: Enable audio codec ARM: dts: sun5i: q8-common: Enable display pipeline and LCD display
arch/arm/boot/dts/axp209.dtsi | 1 + arch/arm/boot/dts/sun5i-q8-common.dtsi | 62 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/sun4i/sun4i_tcon.c | 6 +++- 3 files changed, 68 insertions(+), 1 deletion(-)
Hi Hans,
On Wed, May 18, 2016 at 10:13:52AM +0200, Hans de Goede wrote:
Hi Chen-Yu,
On 17-05-16 17:56, Chen-Yu Tsai wrote:
Hi everyone,
This series enables more peripherals for Allwinner A13-based Q8 devices. The peripherals include the WiFi, the PMIC's micro-usb power supply (driver), audio codec (headphone and speaker), and full display support with the new DRM KMS driver. The series is based on parts of Maxime's "drm: Add Support for Passive RGB to VGA bridges" series, specifically the clk and drm fixes, and common DTS bits.
Hans, since you have a collection of q8 tablets, I'm hoping you could test these bits and provide some feedback.
I've not run any tests, just looked at the patches, the stuff in patch 3 is already present in arch/arm/boot/dts/sun5i-a13-q8-tablet.dts I put it there because I saw some .fex files which don't use ldo3 for wifi I'm fine with moving it to -common though, I believe that you're right that it makes more sense there, having it in 2 places is not really useful though.
I'm not quite sure what you mean, do you want Chen-Yu to send a second version, or are you ok with this patch?
Thanks, Maxime
dri-devel@lists.freedesktop.org