[linux-sunxi] [PATCH] ARM: dts: sun4i: Fix incorrect clocks for displays

2018-04-20 Thread Pascal Roeleven
Some displays on SUN4i devices wouldn't properly stay on unless 
'clk_ignore_unused' is used.

Change the duplicate clocks to the probably intended ones.

Signed-off-by: Pascal Roeleven <d...@pascalroeleven.nl>
---
 arch/arm/boot/dts/sun4i-a10.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index 77e8436b..3a1c6b45 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -76,7 +76,7 @@
allwinner,pipeline = "de_fe0-de_be0-lcd0-hdmi";
clocks = < CLK_AHB_LCD0>, < CLK_AHB_HDMI0>,
 < CLK_AHB_DE_BE0>, < CLK_AHB_DE_FE0>,
-< CLK_DE_BE0>, < CLK_AHB_DE_FE0>,
+< CLK_DE_BE0>, < CLK_DE_FE0>,
 < CLK_TCON0_CH1>, < CLK_HDMI>,
 < CLK_DRAM_DE_FE0>, < CLK_DRAM_DE_BE0>;
status = "disabled";
@@ -88,7 +88,7 @@
allwinner,pipeline = "de_fe0-de_be0-lcd0";
clocks = < CLK_AHB_LCD0>, < CLK_AHB_DE_BE0>,
 < CLK_AHB_DE_FE0>, < CLK_DE_BE0>,
-< CLK_AHB_DE_FE0>, < CLK_TCON0_CH0>,
+< CLK_DE_FE0>, < CLK_TCON0_CH0>,
 < CLK_DRAM_DE_FE0>, < CLK_DRAM_DE_BE0>;
status = "disabled";
};
@@ -99,7 +99,7 @@
allwinner,pipeline = "de_fe0-de_be0-lcd0-tve0";
clocks = < CLK_AHB_TVE0>, < CLK_AHB_LCD0>,
 < CLK_AHB_DE_BE0>, < CLK_AHB_DE_FE0>,
-< CLK_DE_BE0>, < CLK_AHB_DE_FE0>,
+< CLK_DE_BE0>, < CLK_DE_FE0>,
 < CLK_TCON0_CH1>, < CLK_DRAM_TVE0>,
 < CLK_DRAM_DE_FE0>, < CLK_DRAM_DE_BE0>;
status = "disabled";
-- 
2.14.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [linux-sunxi] Re: [PATCH] ARM: dts: sun4i: Fix incorrect clocks for displays

2018-04-23 Thread Pascal Roeleven

On 2018-04-23 09:14, Maxime Ripard wrote:

On Fri, Apr 20, 2018 at 12:21:12PM +0200, Pascal Roeleven wrote:

Some displays on SUN4i devices wouldn't properly stay on unless
'clk_ignore_unused' is used.

Change the duplicate clocks to the probably intended ones.

Signed-off-by: Pascal Roeleven <d...@pascalroeleven.nl>


What was the difference with the first patch you sent?

Anyway, I've applied it, thanks

Maxime

--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


I'm sorry there isn't any.
It's the first patch I have ever send so had some git-send-email issues 
and

didn't know the correct procedure to resend a patch.

--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] pwm: sun4i: pwm-backlight not working since 5.6-rc1

2020-03-12 Thread Pascal Roeleven

Hi all,

I am working on adding an old A10 device to mainline and noticed an 
issue when testing on 5.5.8 vs master.


Since 5.6-rc1, I can't control the brightness of my LCD backlight 
anymore. The backlight stays on full brightness instead. I am 
controlling the brightness value via sysfs for testing.


I am not sure if this is a general pwm-sun4i issue or if it is related 
to the backlight. However I narrowed it down to one commit for 
pwm-sun4i:


fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5

If I use pwm-sun4i.c from 5b090b430d750961305030232314b6acdb0102aa on 
master, the backlight works fine. Unfortunately, due to my lack of 
kernel experience, I can't see how the commit above broke it.


Not sure if it helps, but the binding for the backlight is as follows:

backlight: backlight {
compatible = "pwm-backlight";
pwms = < 0 10 PWM_POLARITY_INVERTED>;
power-supply = <_vbat>;
enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
brightness-levels = <0 30 40 50 60 70 80 90 100>;
default-brightness-level = <8>;
};

Please let me know if there is anything else which might be helpful to 
know or anything I can test.


Regards,
Pascal

--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/6185b5540ca082d887d7d13330c9d938%40pascalroeleven.nl.


Re: [linux-sunxi] [PATCH 2/2] ARM: dts: sun4i: Add support for Topwise A721 tablet

2020-03-11 Thread Pascal Roeleven

On 2020-03-10 15:02, Ondřej Jirman wrote:

Hello Pascal,

On Tue, Mar 10, 2020 at 11:27:24AM +0100, Pascal Roeleven wrote:

The Topwise A721/LY-F1 tablet is a tablet sold around 2012 under
different brands. The mainboard mentions A721 clearly, so this tablet
is best known under this name.

Signed-off-by: Pascal Roeleven 
---
 arch/arm/boot/dts/Makefile   |   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts | 302 
+++

 2 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 78f144e33..6e6141e00 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1040,7 +1040,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-olinuxino-lime.dtb \
sun4i-a10-pcduino.dtb \
sun4i-a10-pcduino2.dtb \
-   sun4i-a10-pov-protab2-ips9.dtb
+   sun4i-a10-pov-protab2-ips9.dtb \
+   sun4i-a10-topwise-a721.dtb
 dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a10s-auxtek-t003.dtb \
sun5i-a10s-auxtek-t004.dtb \
diff --git a/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts 
b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

new file mode 100644
index 0..ff43c9c12
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
@@ -0,0 +1,302 @@
+/*
+ * Copyright 2020 Pascal Roeleven 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of 
the

+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the 
Software.

+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
WARRANTIES

+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */


You should use SPDX license identifier instead of boilerplate license
text.


+/dts-v1/;
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Topwise A721";
+   compatible = "topwise,a721", "allwinner,sun4i-a10";


topwise is not in vendor-prefixes.yaml


+   aliases {
+   serial0 = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 10 PWM_POLARITY_INVERTED>;
+   power-supply = <_vbat>;
+   enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+   brightness-levels = <0 30 40 50 60 70 80 90 100>;
+   default-brightness-level = <8>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel: panel {
+   compatible = "starry,kr070pe2t";
+   backlight = <>;
+   power-supply = <_lcd_power>;
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reg_lcd_power: reg-lcd-power {
+   compatible = "regulator-fixed";
+   pinctrl-names = "default";
+   pinctrl-0 = <_power_pin>;
+   regulator-name = "reg-lcd-power"

[linux-sunxi] Re: [PATCH 1/2] drm/panel: Add Starry KR070PE2T

2020-03-11 Thread Pascal Roeleven

On 2020-03-10 19:54, Sam Ravnborg wrote:

A few things to improve.

The binding should be a separate patch.
subject - shall start with dt-bindings:
Shall be sent to deveicetree mailing list.


Hi Sam,

Thank you very much for your review.
I did consider this. The reason I combined the patches, is that the 
binding depends on the display so I thought they were related in some 
way. Didn't know the correct procedure to handle this. I will split them 
apart in v2.



---
 .../display/panel/starry,kr070pe2t.txt|  7 +
 drivers/gpu/drm/panel/panel-simple.c  | 26 
+++

 2 files changed, 33 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt


diff --git 
a/Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt 
b/Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt

new file mode 100644
index 0..699ad5eb2
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt

@@ -0,0 +1,7 @@
+Starry 7" (800x480 pixels) LCD panel
+
+Required properties:
+- compatible: should be "starry,kr070pe2t"
+
+This binding is compatible with the simple-panel binding, which is 
specified

+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c

index e14c14ac6..027a2612b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2842,6 +2842,29 @@ static const struct panel_desc 
shelly_sca07010_bfn_lnn = {

.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };

+static const struct drm_display_mode starry_kr070pe2t_mode = {
+   .clock = 33000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 209,
+   .hsync_end = 800 + 209 + 1,
+   .htotal = 800 + 209 + 1 + 45,
+   .vdisplay = 480,
+   .vsync_start = 480 + 22,
+   .vsync_end = 480 + 22 + 1,
+   .vtotal = 480 + 22 + 1 + 22,
+   .vrefresh = 60,
+};


Please adjust so:
vrefresh * htotal * vtotal == clock.
I cannot say what needs to be adjusted.
But we are moving away from specifying vrefresh and want the
data to be OK.


Just like Ville Syrjälä, I ran the numbers and vrefresh indeed 
calculates to 59.58.


--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/280a128711458950b55b070dbf6f07a1%40pascalroeleven.nl.


[linux-sunxi] Re: pwm: sun4i: pwm-backlight not working since 5.6-rc1

2020-03-12 Thread Pascal Roeleven

On 2020-03-12 14:29, Uwe Kleine-König wrote:

On Thu, Mar 12, 2020 at 01:22:13PM +0100, Pascal Roeleven wrote:

Hi all,

I am working on adding an old A10 device to mainline and noticed an 
issue

when testing on 5.5.8 vs master.

Since 5.6-rc1, I can't control the brightness of my LCD backlight 
anymore.

The backlight stays on full brightness instead. I am controlling the
brightness value via sysfs for testing.

I am not sure if this is a general pwm-sun4i issue or if it is related 
to

the backlight. However I narrowed it down to one commit for pwm-sun4i:

fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5

If I use pwm-sun4i.c from 5b090b430d750961305030232314b6acdb0102aa on
master, the backlight works fine. Unfortunately, due to my lack of 
kernel

experience, I can't see how the commit above broke it.


Hmm, I cannot see how fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5 breaks
this. Looking at the output of

git show -b fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5

(i.e. ignoring whitespace changes) I don't see how the behaviour you're
reporting can be explained.

Are you sure that fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5 is the bad
commit?

Can you install a tool to inspect register values and check how the
affected registers change if you switch kernel versions and/or pwm
settings?

(e.g.
memtool md 0x1c20e00+0xc
)

Best regards
Uwe


Thanks for your response.

Yes I am sure that is the commit. If I am on master, and replace 
pwm-sun4i.c with the one from 5b090b43, everything works. If I then 
apply fa4d8178, it stops working.


And strangely the output of the registers is exactly the same before and 
after fa4d8178:


01c20e00: 0050 00130014  (full brightness)
01c20e00: 0050 00130006  (min brightness)

Even when I'm on 5b090b43 and cherry-pick fa4d8178 can I reproduce the 
issue.


--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/6e995c4c22c4e6c93acb1f491e5aa109%40pascalroeleven.nl.


[linux-sunxi] [PATCH 0/2] Add support for Topwise A721 tablet

2020-03-10 Thread Pascal Roeleven
This series add support for the Topwise A721 tablet and it's display.
It is an old tablet (around 2012) but it might be useful as reference
as the devicetree is pretty complete.

Pascal Roeleven (2):
  drm/panel: Add Starry KR070PE2T
  ARM: dts: sun4i: Add support for Topwise A721 tablet

 .../display/panel/starry,kr070pe2t.txt|   7 +
 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts  | 302 ++
 drivers/gpu/drm/panel/panel-simple.c  |  26 ++
 4 files changed, 337 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200310102725.14591-1-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH 1/2] drm/panel: Add Starry KR070PE2T

2020-03-10 Thread Pascal Roeleven
The KR070PE2T is a 7" panel with a resolution of 800x480.

KR070PE2T is the marking present on the ribbon cable. As this panel is
probably available under different brands, this marking will catch
most devices.

Signed-off-by: Pascal Roeleven 
---
 .../display/panel/starry,kr070pe2t.txt|  7 +
 drivers/gpu/drm/panel/panel-simple.c  | 26 +++
 2 files changed, 33 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt 
b/Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt
new file mode 100644
index 0..699ad5eb2
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/starry,kr070pe2t.txt
@@ -0,0 +1,7 @@
+Starry 7" (800x480 pixels) LCD panel
+
+Required properties:
+- compatible: should be "starry,kr070pe2t"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index e14c14ac6..027a2612b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2842,6 +2842,29 @@ static const struct panel_desc shelly_sca07010_bfn_lnn = 
{
.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };
 
+static const struct drm_display_mode starry_kr070pe2t_mode = {
+   .clock = 33000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 209,
+   .hsync_end = 800 + 209 + 1,
+   .htotal = 800 + 209 + 1 + 45,
+   .vdisplay = 480,
+   .vsync_start = 480 + 22,
+   .vsync_end = 480 + 22 + 1,
+   .vtotal = 480 + 22 + 1 + 22,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc starry_kr070pe2t = {
+   .modes = _kr070pe2t_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 152,
+   .height = 86,
+   },
+};
+
 static const struct drm_display_mode starry_kr122ea0sra_mode = {
.clock = 147000,
.hdisplay = 1920,
@@ -3474,6 +3497,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "shelly,sca07010-bfn-lnn",
.data = _sca07010_bfn_lnn,
+   }, {
+   .compatible = "starry,kr070pe2t",
+   .data = _kr070pe2t,
}, {
.compatible = "starry,kr122ea0sra",
.data = _kr122ea0sra,
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200310102725.14591-2-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH 2/2] ARM: dts: sun4i: Add support for Topwise A721 tablet

2020-03-10 Thread Pascal Roeleven
The Topwise A721/LY-F1 tablet is a tablet sold around 2012 under
different brands. The mainboard mentions A721 clearly, so this tablet
is best known under this name.

Signed-off-by: Pascal Roeleven 
---
 arch/arm/boot/dts/Makefile   |   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts | 302 +++
 2 files changed, 304 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 78f144e33..6e6141e00 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1040,7 +1040,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-olinuxino-lime.dtb \
sun4i-a10-pcduino.dtb \
sun4i-a10-pcduino2.dtb \
-   sun4i-a10-pov-protab2-ips9.dtb
+   sun4i-a10-pov-protab2-ips9.dtb \
+   sun4i-a10-topwise-a721.dtb
 dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a10s-auxtek-t003.dtb \
sun5i-a10s-auxtek-t004.dtb \
diff --git a/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts 
b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
new file mode 100644
index 0..ff43c9c12
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
@@ -0,0 +1,302 @@
+/*
+ * Copyright 2020 Pascal Roeleven 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Topwise A721";
+   compatible = "topwise,a721", "allwinner,sun4i-a10";
+
+   aliases {
+   serial0 = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 10 PWM_POLARITY_INVERTED>;
+   power-supply = <_vbat>;
+   enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+   brightness-levels = <0 30 40 50 60 70 80 90 100>;
+   default-brightness-level = <8>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel: panel {
+   compatible = "starry,kr070pe2t";
+   backlight = <>;
+   power-supply = <_lcd_power>;
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reg_lcd_power: reg-lcd-power {
+   compatible = "regulator-fixed";
+   pinctrl-names = "default";
+   pinctrl-0 = <_power_pin>;
+   regulator-name = "reg-lcd-power";
+   gpio = < 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+   enable-active-high;
+   };
+
+   reg_vbat: reg-vbat {
+   compatible = "regulator-fixed";
+   regulator-name = "vbat";
+   r

Re: [linux-sunxi] [RFC PATCH 4/4] pwm: sun4i: Delay after writing the period

2020-04-22 Thread Pascal Roeleven

On 2020-04-22 05:43, Samuel Holland wrote:

Hello Pascal,

On 3/17/20 10:59 AM, Pascal Roeleven wrote:

When disabling, ensure the period write is complete before continuing.
This fixes an issue on some devices when the write isn't complete 
before

the panel is turned off but the clock gate is still on.

Signed-off-by: Pascal Roeleven 
---
 drivers/pwm/pwm-sun4i.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index a11d00f96..75250fd4c 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -299,6 +299,10 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, 
struct pwm_device *pwm,

sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm));
next_period = jiffies + usecs_to_jiffies(cstate.period / 1000 + 1);

+   /* When disabling, make sure the period register is written first */
+   if (!state->enabled && cstate.enabled)
+   sun4i_pwm_wait(next_period);
+


It is not visible from the context of this patch, but this call to
sun4i_pwm_wait() ends up calling msleep() inside a spinlock, which 
isn't
allowed. The spinlock should probably be converted to a mutex, 
considering that

sun4i_pwm_apply() already sleeps and takes mutexes.

Regards,
Samuel



Yes you're right. A different implementation of this patch series is 
being worked on, in which I'll take this into account. Unfortunately I 
have other things to work on at the moment, so it might take a while.


Regards,
Pascal

--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/fd36eddb87b529498e0429afe3521da7%40pascalroeleven.nl.


[linux-sunxi] [RFC PATCH 4/4] pwm: sun4i: Delay after writing the period

2020-03-17 Thread Pascal Roeleven
When disabling, ensure the period write is complete before continuing.
This fixes an issue on some devices when the write isn't complete before
the panel is turned off but the clock gate is still on.

Signed-off-by: Pascal Roeleven 
---
 drivers/pwm/pwm-sun4i.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index a11d00f96..75250fd4c 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -299,6 +299,10 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm));
next_period = jiffies + usecs_to_jiffies(cstate.period / 1000 + 1);
 
+   /* When disabling, make sure the period register is written first */
+   if (!state->enabled && cstate.enabled)
+   sun4i_pwm_wait(next_period);
+
if (state->polarity != PWM_POLARITY_NORMAL)
ctrl &= ~BIT_CH(PWM_ACT_STATE, pwm->hwpwm);
else
@@ -320,6 +324,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
return 0;
 
/* We need a full period to elapse before disabling the channel. */
+   next_period = jiffies + usecs_to_jiffies(cstate.period / 1000 + 1);
sun4i_pwm_wait(next_period);
 
spin_lock(_pwm->ctrl_lock);
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200317155906.31288-5-dev%40pascalroeleven.nl.


[linux-sunxi] [RFC PATCH 3/4] pwm: sun4i: Move delay to function

2020-03-17 Thread Pascal Roeleven
Move the delay to a function so we can reuse it.

Signed-off-by: Pascal Roeleven 
---
 drivers/pwm/pwm-sun4i.c | 32 ++--
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 56942036b..a11d00f96 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -89,7 +89,6 @@ struct sun4i_pwm_chip {
void __iomem *base;
spinlock_t ctrl_lock;
const struct sun4i_pwm_data *data;
-   unsigned long next_period[2];
 };
 
 static inline struct sun4i_pwm_chip *to_sun4i_pwm_chip(struct pwm_chip *chip)
@@ -228,6 +227,20 @@ static int sun4i_pwm_calculate(struct sun4i_pwm_chip 
*sun4i_pwm,
return 0;
 }
 
+static void sun4i_pwm_wait(unsigned long next_period) {
+   unsigned int delay_us;
+   unsigned long now;
+
+   now = jiffies;
+   if (time_before(now, next_period)) {
+   delay_us = jiffies_to_usecs(next_period - now);
+   if ((delay_us / 500) > MAX_UDELAY_MS)
+   msleep(delay_us / 1000 + 1);
+   else
+   usleep_range(delay_us, delay_us * 2);
+   }
+}
+
 static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
   const struct pwm_state *state)
 {
@@ -235,8 +248,8 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
struct pwm_state cstate;
u32 ctrl, duty = 0, period = 0, val;
int ret;
-   unsigned int delay_us, prescaler = 0;
-   unsigned long now;
+   unsigned int prescaler = 0;
+   unsigned long next_period;
bool bypass;
 
pwm_get_state(pwm, );
@@ -284,8 +297,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
 
val = (duty & PWM_DTY_MASK) | PWM_PRD(period);
sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm));
-   sun4i_pwm->next_period[pwm->hwpwm] = jiffies +
-   usecs_to_jiffies(cstate.period / 1000 + 1);
+   next_period = jiffies + usecs_to_jiffies(cstate.period / 1000 + 1);
 
if (state->polarity != PWM_POLARITY_NORMAL)
ctrl &= ~BIT_CH(PWM_ACT_STATE, pwm->hwpwm);
@@ -308,15 +320,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
return 0;
 
/* We need a full period to elapse before disabling the channel. */
-   now = jiffies;
-   if (time_before(now, sun4i_pwm->next_period[pwm->hwpwm])) {
-   delay_us = jiffies_to_usecs(sun4i_pwm->next_period[pwm->hwpwm] -
-  now);
-   if ((delay_us / 500) > MAX_UDELAY_MS)
-   msleep(delay_us / 1000 + 1);
-   else
-   usleep_range(delay_us, delay_us * 2);
-   }
+   sun4i_pwm_wait(next_period);
 
spin_lock(_pwm->ctrl_lock);
ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG);
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200317155906.31288-4-dev%40pascalroeleven.nl.


[linux-sunxi] [RFC PATCH 0/4] pwm: sun4i: Properly turn pwm off and fix stuck output state

2020-03-17 Thread Pascal Roeleven
Hi all,

For the last few days I've been debugging a lot to get pwm working again since
recent changes in 5.6-rc1 broke it for me.

Testing shows the pwm controller crashes (or the output gets stuck) when the
period register is written when the channel is disabled while the clock gate is
still on. Usually after multiple writes, but one write can also lead to
unpredictable behaviour. Patch 3 and 4 fix this.

Patch 2 contains a fix which wouldn't completely turn off the pwm if the
output is disabled. The clock gate needs to stay on for at least one more
period to ensure the output is properly disabled. This issue has been around
for a long time but has probably stayed unnoticed because if the duty_cycle is
also changed to 0, you can't tell the difference.

Patch 1 removes some leftovers which aren't needed anymore.

Obviously these patches work for my device, but I'd like to hear your opinion
if any of these changes make sense. After days, this one is a bit blurry for me.

Thanks to Uwe for some help with debugging.

Pascal.

Pascal Roeleven (4):
  pwm: sun4i: Remove redundant needs_delay
  pwm: sun4i: Disable pwm before turning off clock gate
  pwm: sun4i: Move delay to function
  pwm: sun4i: Delay after writing the period

 drivers/pwm/pwm-sun4i.c | 53 -
 1 file changed, 26 insertions(+), 27 deletions(-)

-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200317155906.31288-1-dev%40pascalroeleven.nl.


[linux-sunxi] [RFC PATCH 2/4] pwm: sun4i: Disable pwm before turning off clock gate

2020-03-17 Thread Pascal Roeleven
The clock gate must stay on when disabling to ensure proper turning off.
After one period it will still be disabled anyway.

Signed-off-by: Pascal Roeleven 
---
 drivers/pwm/pwm-sun4i.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 5c677c563..56942036b 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -292,13 +292,12 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
else
ctrl |= BIT_CH(PWM_ACT_STATE, pwm->hwpwm);
 
-   ctrl |= BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
-
if (state->enabled) {
ctrl |= BIT_CH(PWM_EN, pwm->hwpwm);
+   ctrl |= BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
} else {
+   /* Turn gate off after delay to ensure proper turning off */
ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm);
-   ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
}
 
sun4i_pwm_writel(sun4i_pwm, ctrl, PWM_CTRL_REG);
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200317155906.31288-3-dev%40pascalroeleven.nl.


[linux-sunxi] [RFC PATCH 1/4] pwm: sun4i: Remove redundant needs_delay

2020-03-17 Thread Pascal Roeleven
'needs_delay' does now always evaluate to true, so remove all
occurrences.

Signed-off-by: Pascal Roeleven 
---
 drivers/pwm/pwm-sun4i.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 3e3efa6c7..5c677c563 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -90,7 +90,6 @@ struct sun4i_pwm_chip {
spinlock_t ctrl_lock;
const struct sun4i_pwm_data *data;
unsigned long next_period[2];
-   bool needs_delay[2];
 };
 
 static inline struct sun4i_pwm_chip *to_sun4i_pwm_chip(struct pwm_chip *chip)
@@ -287,7 +286,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
sun4i_pwm_writel(sun4i_pwm, val, PWM_CH_PRD(pwm->hwpwm));
sun4i_pwm->next_period[pwm->hwpwm] = jiffies +
usecs_to_jiffies(cstate.period / 1000 + 1);
-   sun4i_pwm->needs_delay[pwm->hwpwm] = true;
 
if (state->polarity != PWM_POLARITY_NORMAL)
ctrl &= ~BIT_CH(PWM_ACT_STATE, pwm->hwpwm);
@@ -298,7 +296,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
 
if (state->enabled) {
ctrl |= BIT_CH(PWM_EN, pwm->hwpwm);
-   } else if (!sun4i_pwm->needs_delay[pwm->hwpwm]) {
+   } else {
ctrl &= ~BIT_CH(PWM_EN, pwm->hwpwm);
ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
}
@@ -310,15 +308,9 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
if (state->enabled)
return 0;
 
-   if (!sun4i_pwm->needs_delay[pwm->hwpwm]) {
-   clk_disable_unprepare(sun4i_pwm->clk);
-   return 0;
-   }
-
/* We need a full period to elapse before disabling the channel. */
now = jiffies;
-   if (sun4i_pwm->needs_delay[pwm->hwpwm] &&
-   time_before(now, sun4i_pwm->next_period[pwm->hwpwm])) {
+   if (time_before(now, sun4i_pwm->next_period[pwm->hwpwm])) {
delay_us = jiffies_to_usecs(sun4i_pwm->next_period[pwm->hwpwm] -
   now);
if ((delay_us / 500) > MAX_UDELAY_MS)
@@ -326,7 +318,6 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct 
pwm_device *pwm,
else
usleep_range(delay_us, delay_us * 2);
}
-   sun4i_pwm->needs_delay[pwm->hwpwm] = false;
 
spin_lock(_pwm->ctrl_lock);
ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG);
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200317155906.31288-2-dev%40pascalroeleven.nl.


[linux-sunxi] Re: pwm: sun4i: pwm-backlight not working since 5.6-rc1

2020-03-17 Thread Pascal Roeleven

On 2020-03-17 18:32, Uwe Kleine-König wrote:

Hello Pascal,

On Mon, Mar 16, 2020 at 08:26:13AM +0100, Uwe Kleine-König wrote:

On Thu, Mar 12, 2020 at 04:06:07PM +0100, Pascal Roeleven wrote:
> On 2020-03-12 14:29, Uwe Kleine-König wrote:
> > On Thu, Mar 12, 2020 at 01:22:13PM +0100, Pascal Roeleven wrote:
> > > Hi all,
> > >
> > > I am working on adding an old A10 device to mainline and noticed an
> > > issue
> > > when testing on 5.5.8 vs master.
> > >
> > > Since 5.6-rc1, I can't control the brightness of my LCD backlight
> > > anymore.
> > > The backlight stays on full brightness instead. I am controlling the
> > > brightness value via sysfs for testing.
> > >
> > > I am not sure if this is a general pwm-sun4i issue or if it is
> > > related to
> > > the backlight. However I narrowed it down to one commit for pwm-sun4i:
> > >
> > > fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5
> > >
> > > If I use pwm-sun4i.c from 5b090b430d750961305030232314b6acdb0102aa on
> > > master, the backlight works fine. Unfortunately, due to my lack of
> > > kernel
> > > experience, I can't see how the commit above broke it.
> >
> > Hmm, I cannot see how fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5 breaks
> > this. Looking at the output of
> >
> >   git show -b fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5
> >
> > (i.e. ignoring whitespace changes) I don't see how the behaviour you're
> > reporting can be explained.
> >
> > Are you sure that fa4d81784681a26bcf7d2a43c6ac5cf991ef28f5 is the bad
> > commit?
> >
> > Can you install a tool to inspect register values and check how the
> > affected registers change if you switch kernel versions and/or pwm
> > settings?
> >
> > (e.g.
> >   memtool md 0x1c20e00+0xc
> > )
> >
> > Best regards
> > Uwe
>
> Thanks for your response.
>
> Yes I am sure that is the commit. If I am on master, and replace pwm-sun4i.c
> with the one from 5b090b43, everything works. If I then apply fa4d8178, it
> stops working.
>
> And strangely the output of the registers is exactly the same before and
> after fa4d8178:
>
> 01c20e00: 0050 00130014  (full brightness)
> 01c20e00: 0050 00130006  (min brightness)
>
> Even when I'm on 5b090b43 and cherry-pick fa4d8178 can I reproduce the
> issue.

Very strange. I'm out of sensible ideas. The remaining ones are:

- enable tracing in the kernel and boot with

trace_event=pwm

  And then check after the problem occurred in
  /sys/kernel/debug/tracing/trace if something sticks out.

- Try modifying the registers using memtool. E.g.

memtool mw 0x01c20e04 0x00130012

- Do you have equipment to check the actual output of the PWM 
hardware?

  If so, what do you see?


I assume the sun4i-series you sent earlier today resolves the problems
you reported here?

Best regards
Uwe


Hi Uwe,

Yes it does, but as Emil mentioned it's probably not complete. It's just 
an RFC for now to make sure it doesn't cause a regression. Turns out the 
Allwinner PWM controller is even more pickier than I thought.


Again, thank you for your help.

--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/ddd9b9c5b3d28a30c888fdcfc1ac6d64%40pascalroeleven.nl.


[linux-sunxi] Re: [RFC PATCH 0/4] pwm: sun4i: Properly turn pwm off and fix stuck output state

2020-03-17 Thread Pascal Roeleven

On 2020-03-17 17:45, Emil Lenngren wrote:

Hi all,

Den tis 17 mars 2020 kl 17:00 skrev Pascal Roeleven 
:


Hi all,

For the last few days I've been debugging a lot to get pwm working 
again since

recent changes in 5.6-rc1 broke it for me.

Testing shows the pwm controller crashes (or the output gets stuck) 
when the
period register is written when the channel is disabled while the 
clock gate is
still on. Usually after multiple writes, but one write can also lead 
to

unpredictable behaviour. Patch 3 and 4 fix this.

Patch 2 contains a fix which wouldn't completely turn off the pwm if 
the
output is disabled. The clock gate needs to stay on for at least one 
more
period to ensure the output is properly disabled. This issue has been 
around
for a long time but has probably stayed unnoticed because if the 
duty_cycle is

also changed to 0, you can't tell the difference.

Patch 1 removes some leftovers which aren't needed anymore.

Obviously these patches work for my device, but I'd like to hear your 
opinion
if any of these changes make sense. After days, this one is a bit 
blurry for me.


Thanks to Uwe for some help with debugging.

Pascal.

Pascal Roeleven (4):
  pwm: sun4i: Remove redundant needs_delay
  pwm: sun4i: Disable pwm before turning off clock gate
  pwm: sun4i: Move delay to function
  pwm: sun4i: Delay after writing the period

 drivers/pwm/pwm-sun4i.c | 53 
-

 1 file changed, 26 insertions(+), 27 deletions(-)

--
2.20.1



I also worked on sun4i-pwm some time ago, fixing a bunch of issues.
One was that disabling the pwm sometimes didn't turn off the signal,
because the gate and enable bit were modified in the same clock cycle.
Another was that the current code used an unnecessary sleep of a whole
period length (or more?) in case of an update to the period, which
could be very time-consuming if it's a very long interval, like 2
seconds.

Note that the behaviour is not unpredictable, if you know how it works 
;)

I fiddled around a long time with devmem2, an oscilloscope and the
prescaler set to max to figure out how works internally.

Please try my version I just posted at https://pastebin.com/GWrhWzPJ.
It is based on this version from May 28, 2019:
https://github.com/torvalds/linux/blob/f50a7f3d9225dd374455f28138f79ae3074a7a3d/drivers/pwm/pwm-sun4i.c.
Sorry for not posting it inline, but GMail would break the formatting.
It contains quite many comments about how it works internally. I also
wrote a section at http://linux-sunxi.org/PWM_Controller, but it might
be a bit old (two years), so please rather look at the code and the
comments.

/Emil


Hi Emil,

Thank you very much, this is helpful. Ah it was your note on the wiki. 
That is indeed where I took the idea of keeping the gate on and 
disabling the panel from. As a scope is still on my wishlist, the rest 
was just trial-and-error. Judging from your code, there are more edge 
cases which might occur. I will test your code and try to integrate it. 
If it's okay with you, I can post it on your behalf?


If you ask me, it's really unfortunate Allwinner didn't provide a timing 
diagram for such a picky controller.


--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/f96002831730bf262ee61df38642e042%40pascalroeleven.nl.


[linux-sunxi] [PATCH v2 5/5] ARM: dts: sun4i: Add support for Topwise A721 tablet

2020-03-20 Thread Pascal Roeleven
The Topwise A721/LY-F1 tablet is a tablet sold around 2012 under
different brands. The mainboard mentions A721 clearly, so this tablet
is best known under this name.

Signed-off-by: Pascal Roeleven 
---
 arch/arm/boot/dts/Makefile   |   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts | 242 +++
 2 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 78f144e33..6e6141e00 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1040,7 +1040,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-olinuxino-lime.dtb \
sun4i-a10-pcduino.dtb \
sun4i-a10-pcduino2.dtb \
-   sun4i-a10-pov-protab2-ips9.dtb
+   sun4i-a10-pov-protab2-ips9.dtb \
+   sun4i-a10-topwise-a721.dtb
 dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a10s-auxtek-t003.dtb \
sun5i-a10s-auxtek-t004.dtb \
diff --git a/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts 
b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
new file mode 100644
index 0..936171d30
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
@@ -0,0 +1,242 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Pascal Roeleven 
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Topwise A721";
+   compatible = "topwise,a721", "allwinner,sun4i-a10";
+
+   aliases {
+   serial0 = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 10 PWM_POLARITY_INVERTED>;
+   power-supply = <_vbat>;
+   enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+   brightness-levels = <0 30 40 50 60 70 80 90 100>;
+   default-brightness-level = <8>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel: panel {
+   compatible = "starry,kr070pe2t";
+   backlight = <>;
+   power-supply = <_lcd_power>;
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reg_lcd_power: reg-lcd-power {
+   compatible = "regulator-fixed";
+   regulator-name = "reg-lcd-power";
+   gpio = < 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+   enable-active-high;
+   };
+
+   reg_vbat: reg-vbat {
+   compatible = "regulator-fixed";
+   regulator-name = "vbat";
+   regulator-min-microvolt = <370>;
+   regulator-max-microvolt = <370>;
+   };
+
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupts = <0>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_power_supply {
+   status = "okay";
+};
+
+_power_supply {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   mma7660: accelerometer@4c {
+   compatible = "fsl,mma7660";
+   reg = <0x4c>;
+   };
+};
+
+ {
+   status = "okay";
+
+   ft5406ee8: touchscreen@38 {
+   compatible = "edt,edt-ft5406";
+   reg = <0x38>;
+   interrupt-parent = <>;
+   interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
+   touchscreen-size-x = <800>;
+   touchscreen-size-y = <480>;
+   vcc-supply = <_vcc3v3>;
+   };
+};
+
+ {
+   vref-supply = <_ldo2>;
+   status = "okay";
+
+   button-vol-down {
+   label = "Volume Down";
+   linux,code = ;
+   channel = <0>;
+   voltage = <761904>;
+   };
+
+   button-vol-up {
+   label = "Volume Up";
+   linux,code = ;
+   channel = <0>;
+   voltage = <571428>;
+   };
+};
+
+ {
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 1 GPIO_ACTIVE_LOW>; /* PH01 */
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+_sram {
+   sta

[linux-sunxi] [PATCH v2 3/5] dt-bindings: vendor-prefixes: Add Topwise

2020-03-20 Thread Pascal Roeleven
Topwise Communication Co,. Ltd. is a company based in Shenzhen. They
manufacture all kind of products but seem to be focusing on POS nowadays.

Signed-off-by: Pascal Roeleven 
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml 
b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 9e67944be..3c08370b7 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -982,6 +982,8 @@ patternProperties:
   "^toppoly,.*":
 description: TPO (deprecated, use tpo)
 deprecated: true
+  "^topwise,.*":
+description: Topwise Communication Co., Ltd.
   "^toradex,.*":
 description: Toradex AG
   "^toshiba,.*":
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200320112205.7100-4-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v2 2/5] drm: panel: Add Starry KR070PE2T

2020-03-20 Thread Pascal Roeleven
The KR070PE2T is a 7" panel with a resolution of 800x480.

KR070PE2T is the marking present on the ribbon cable. As this panel is
probably available under different brands, this marking will catch
most devices.

As I can't find a datasheet for this panel, the bus_flags are instead
from trial-and-error. The flags seem to be common for these kind of
panels as well.

Signed-off-by: Pascal Roeleven 
---
 drivers/gpu/drm/panel/panel-simple.c | 29 
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index e14c14ac6..b3d257257 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2842,6 +2842,32 @@ static const struct panel_desc shelly_sca07010_bfn_lnn = 
{
.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };
 
+static const struct drm_display_mode starry_kr070pe2t_mode = {
+   .clock = 33000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 209,
+   .hsync_end = 800 + 209 + 1,
+   .htotal = 800 + 209 + 1 + 45,
+   .vdisplay = 480,
+   .vsync_start = 480 + 22,
+   .vsync_end = 480 + 22 + 1,
+   .vtotal = 480 + 22 + 1 + 22,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc starry_kr070pe2t = {
+   .modes = _kr070pe2t_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 152,
+   .height = 86,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+   .connector_type = DRM_MODE_CONNECTOR_LVDS,
+};
+
 static const struct drm_display_mode starry_kr122ea0sra_mode = {
.clock = 147000,
.hdisplay = 1920,
@@ -3474,6 +3500,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "shelly,sca07010-bfn-lnn",
.data = _sca07010_bfn_lnn,
+   }, {
+   .compatible = "starry,kr070pe2t",
+   .data = _kr070pe2t,
}, {
.compatible = "starry,kr122ea0sra",
.data = _kr122ea0sra,
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200320112205.7100-3-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v2 1/5] dt-bindings: panel: Add binding for Starry KR070PE2T

2020-03-20 Thread Pascal Roeleven
Add the devicetree binding for Starry KR070PE2T

Signed-off-by: Pascal Roeleven 
---
 .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 8fe60ee25..7cbace360 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -43,6 +43,8 @@ properties:
   - satoz,sat050at40h12r2
 # Sharp LS020B1DD01D 2.0" HQVGA TFT LCD panel
   - sharp,ls020b1dd01d
+# Starry KR070PE2T 7" WVGA TFT LCD panel
+  - starry,kr070pe2t
 
   backlight: true
   enable-gpios: true
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200320112205.7100-2-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v2 0/5] Add support for Topwise A721 tablet

2020-03-20 Thread Pascal Roeleven
This series add support for the Topwise A721 tablet and it's display.
It is an old tablet (around 2012) but it might be useful as reference
as the devicetree is pretty complete.

Changes from v1:
* Split into multiple patches
* dt-binding: use yaml instead of txt
* dt-binding: add Topwise A721 to sunxi.yaml
* dt-binding: add Topwise to vendor-prefixes
* drm: Add bus_format, bus_flags and connector_type
* dts: Use SPDX license identifier instead of boilerplate license text
* dts: Remove pinctrl leftovers

Pascal Roeleven (5):
  dt-bindings: panel: Add binding for Starry KR070PE2T
  drm: panel: Add Starry KR070PE2T
  dt-bindings: vendor-prefixes: Add Topwise
  dt-bindings: arm: Add Topwise A721
  ARM: dts: sun4i: Add support for Topwise A721 tablet

 .../devicetree/bindings/arm/sunxi.yaml|   5 +
 .../bindings/display/panel/panel-simple.yaml  |   2 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts  | 242 ++
 drivers/gpu/drm/panel/panel-simple.c  |  29 +++
 6 files changed, 282 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20200320112205.7100-1-dev%40pascalroeleven.nl.


Re: [linux-sunxi] Re: [PATCH v2 2/5] drm: panel: Add Starry KR070PE2T

2020-06-29 Thread Pascal Roeleven

Hi Laurent,

Good catch. It's actually the connector type which is wrong. The 
connector_type should be DRM_MODE_CONNECTOR_DPI. If you would include 
this in your patch series, you can have my acked-by.


Regards,
Pascal

On 2020-06-28 09:28, Laurent Pinchart wrote:

Hi Pascal,

On Fri, Mar 20, 2020 at 12:21:33PM +0100, Pascal Roeleven wrote:

The KR070PE2T is a 7" panel with a resolution of 800x480.

KR070PE2T is the marking present on the ribbon cable. As this panel is
probably available under different brands, this marking will catch
most devices.

As I can't find a datasheet for this panel, the bus_flags are instead
from trial-and-error. The flags seem to be common for these kind of
panels as well.

Signed-off-by: Pascal Roeleven 
---
 drivers/gpu/drm/panel/panel-simple.c | 29 


 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c

index e14c14ac6..b3d257257 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2842,6 +2842,32 @@ static const struct panel_desc 
shelly_sca07010_bfn_lnn = {

.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };

+static const struct drm_display_mode starry_kr070pe2t_mode = {
+   .clock = 33000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 209,
+   .hsync_end = 800 + 209 + 1,
+   .htotal = 800 + 209 + 1 + 45,
+   .vdisplay = 480,
+   .vsync_start = 480 + 22,
+   .vsync_end = 480 + 22 + 1,
+   .vtotal = 480 + 22 + 1 + 22,
+   .vrefresh = 60,
+};
+
+static const struct panel_desc starry_kr070pe2t = {
+   .modes = _kr070pe2t_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 152,
+   .height = 86,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+	.bus_flags = DRM_BUS_FLAG_DE_HIGH | 
DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,

+   .connector_type = DRM_MODE_CONNECTOR_LVDS,


I'm trying to fix inconsistencies in the panel-simple driver, and this
caught my eyes. MEDIA_BUS_FMT_RGB888_1X24 isn't a correct format for
LVDS panels. MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
MEDIA_BUS_FMT_RGB888_1X7X4_SPWG or MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA
should be used instead. As I couldn't find documentation for the panel,
I can't tell which format is correct. Could you please help ?


+};
+
 static const struct drm_display_mode starry_kr122ea0sra_mode = {
.clock = 147000,
.hdisplay = 1920,
@@ -3474,6 +3500,9 @@ static const struct of_device_id 
platform_of_match[] = {

}, {
.compatible = "shelly,sca07010-bfn-lnn",
.data = _sca07010_bfn_lnn,
+   }, {
+   .compatible = "starry,kr070pe2t",
+   .data = _kr070pe2t,
}, {
.compatible = "starry,kr122ea0sra",
.data = _kr122ea0sra,


--
Regards,

Laurent Pinchart


--
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/d43b324fa26638c179650e3c52adbf32%40pascalroeleven.nl.


Re: [linux-sunxi] Lima with glxgears Allwinner A64

2020-07-23 Thread Pascal Roeleven

On 2020-07-23 10:49, Faruk KILAVUZ wrote:

Hello

 I am using
Armbian_20.05.4_Lime-a64_focal_current_5.4.45_desktop.img.xz and I try
run glxgears on Olinuxino-A64 with Lima. When I running glxgears I see
117 frames in 5.0 second = 23.313FPS. Also mouse response so slow on
desktop. It is understood from here Olinuxino-A64 doing software
render. Please correct me if I am wrong. I am new at this job and I
have difficulty in fully understanding the problem. Is there a way I
can get high FPS in glxgears using Lima? What exactly is problem here?
Sorry if I ask silly question. Thanks. Below are some outputs for the
board I use.

dmesg greg | "lima" output:

__

[ 8.579828] lima 1c4.gpu: IRQ ppmmu2 not found
[ 8.584705] lima 1c4.gpu: IRQ ppmmu3 not found
[ 8.589554] lima 1c4.gpu: gp - mali400 version major 1 minor 1
[ 8.589626] lima 1c4.gpu: pp0 - mali400 version major 1 minor 1
[ 8.589670] lima 1c4.gpu: pp1 - mali400 version major 1 minor 1
[ 8.589694] lima 1c4.gpu: IRQ pp2 not found
[ 8.594298] lima 1c4.gpu: IRQ pp3 not found
[ 8.598869] lima 1c4.gpu: l2 cache 64K, 4-way, 64byte cache line,
64bit external bus
[ 8.606923] lima 1c4.gpu: bus rate = 2
[ 8.606932] lima 1c4.gpu: mod rate = 29700
[ 8.607264] [drm] Initialized lima 1.0.0 20190217 for 1c4.gpu on
minor 0

gpu node on sun50i-a64-olinuxoni.dts:

gpu@1c4 {
 compatible = "allwinner,sun50i-a64-mali", "arm,mali-400";
 reg = <0x1c4 0x1>;
 interrupts = <0x0 0x61 0x4 0x0 0x62 0x4 0x0 0x63 0x4 0x0 0x64 0x4 0x0
0x66 0x4 0x0 0x67 0x4 0x0 0x65 0x4>;
 interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1", "ppmmu1",
"pmu";
 clocks = <0x2 0x35 0x2 0x72>;
 clock-names = "bus", "core";
 resets = <0x2 0x1f>;
 phandle = <0x83>;
 };

glxinfo:

name of display: :0

display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
 GLX_ARB_context_flush_control, GLX_ARB_create_context,
 GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
 GLX_ARB_fbconfig_float, GLX_ARB_framebuffer_sRGB,
GLX_ARB_multisample,
 GLX_EXT_create_context_es2_profile,
GLX_EXT_create_context_es_profile,
 GLX_EXT_fbconfig_packed_float, GLX_EXT_framebuffer_sRGB,
 GLX_EXT_import_context, GLX_EXT_libglvnd, GLX_EXT_no_config_context,
 GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
GLX_EXT_visual_rating,
 GLX_MESA_copy_sub_buffer, GLX_OML_swap_method, GLX_SGIS_multisample,
 GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,
 GLX_SGI_make_current_read
client glx vendor string: Mesa Project and SGI
client glx version string: 1.4
client glx extensions:
 GLX_ARB_context_flush_control, GLX_ARB_create_context,
 GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile,
 GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
 GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address,
GLX_ARB_multisample,
 GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile,
 GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float,
 GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context,
 GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
GLX_EXT_visual_rating,
 GLX_INTEL_swap_event, GLX_MESA_copy_sub_buffer,
 GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer,
 GLX_MESA_swap_control, GLX_OML_swap_method, GLX_OML_sync_control,
 GLX_SGIS_multisample, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
 GLX_SGIX_visual_select_group, GLX_SGI_make_current_read,
 GLX_SGI_swap_control, GLX_SGI_video_sync
GLX version: 1.4
GLX extensions:
 GLX_ARB_create_context, GLX_ARB_create_context_no_error,
 GLX_ARB_create_context_profile, GLX_ARB_fbconfig_float,
 GLX_ARB_framebuffer_sRGB, GLX_ARB_get_proc_address,
GLX_ARB_multisample,
 GLX_EXT_buffer_age, GLX_EXT_create_context_es2_profile,
 GLX_EXT_create_context_es_profile, GLX_EXT_fbconfig_packed_float,
 GLX_EXT_framebuffer_sRGB, GLX_EXT_import_context,
 GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info,
GLX_EXT_visual_rating,
 GLX_MESA_copy_sub_buffer, GLX_MESA_query_renderer,
GLX_MESA_swap_control,
 GLX_OML_swap_method, GLX_OML_sync_control, GLX_SGIS_multisample,
 GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,
 GLX_SGI_make_current_read, GLX_SGI_video_sync
Extended renderer info (GLX_MESA_query_renderer):
 Vendor: lima (0x13b5)
 Device: Mali400 (0x)
 Version: 20.0.8
 Accelerated: yes
 Video memory: 0MB
 Unified memory: yes
 Preferred profile: compat (0x2)
 Max core profile version: 0.0
 Max compat profile version: 2.1
 Max GLES1 profile version: 1.1
 Max GLES[23] profile version: 2.0
OpenGL vendor string: lima
OpenGL renderer string: Mali400
OpenGL version string: 2.1 Mesa 20.0.8
OpenGL shading language version string: 1.20
OpenGL extensions:
 GL_AMD_shader_trinary_minmax, GL_APPLE_packed_pixels,
 GL_ARB_ES2_compatibility, GL_ARB_clear_buffer_object,
 GL_ARB_compressed_texture_pixel_storage, GL_ARB_copy_buffer,
 GL_ARB_debug_output, GL_ARB_depth_texture, GL_ARB_draw_buffers,
 

[linux-sunxi] Re: [PATCH 6/6] pwm: sun4i: don't delay if the PWM is already off

2021-06-10 Thread Pascal Roeleven
On 2021-05-31 06:46, Roman Beranek wrote:
> Signed-off-by: Roman Beranek 
> ---
>  drivers/pwm/pwm-sun4i.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 6ab06b9749d0..88bd90498d1f 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -304,7 +304,7 @@ static int sun4i_pwm_apply(struct pwm_chip *chip,
> struct pwm_device *pwm,
>  
>   sun4i_pwm_writel(sun4i_pwm, ctrl, PWM_CTRL_REG);
>  
> - if (state->enabled) {
> + if (state->enabled || !cstate.enabled) {
>   mutex_unlock(_pwm->ctrl_lock);
>   return 0;
>   }

Btw, this now leaves the gate open if the controller is currently
disabled and we are only changing the period register and staying
disabled. This becomes an issue because we always expect the gate to be
disabled when the controller is disabled.

Regards,
Pascal

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/f590094496dfbb711e363c36e8573687%40pascalroeleven.nl.


[linux-sunxi] Re: [PATCH 0/6] pwm: sun4i: only wait 2 cycles prior to disabling

2021-06-08 Thread Pascal Roeleven
On 2021-05-31 21:07, Pascal Roeleven wrote:
> On 2021-05-31 06:46, Roman Beranek wrote:
>> As Emil Lenngren has previously shown [1], actually only 1-2 cycles of
>> the prescaler-divided clock are necessary to pass before the PWM turns
>> off, not a full period.
>>
>> To avoid having the PWM re-enabled from another thread while asleep,
>> ctrl_lock spinlock was converted to a mutex so that it can be released
>> only after the clock gate has finally been turned on.
>>
>> [1] https://linux-sunxi.org/PWM_Controller_Register_Guide
>>
>> Roman Beranek (6):
>>   pwm: sun4i: enable clk prior to getting its rate
>>   pwm: sun4i: disable EN bit prior to the delay
>>   pwm: sun4i: replace spinlock with a mutex
>>   pwm: sun4i: simplify calculation of the delay time
>>   pwm: sun4i: shorten the delay to 2 cycles
>>   pwm: sun4i: don't delay if the PWM is already off
>>
>>  drivers/pwm/pwm-sun4i.c | 56 +++--
>>  1 file changed, 26 insertions(+), 30 deletions(-)
> 
> Hi Roman,
> 
> Thanks for your attempt to fix this.
> 
> Unfortunately on my A10 device (Topwise A721), the controller still gets
> stuck in an unrecoverable state after disabling and re-enabling the PWM
> when it was already on (set in U-Boot), or when enabling it when it was
> off. In this state, any changes to the period register (using devmem)
> don't seem to have any effect. It seems to be stuck in the state it was
> before disabling. The only thing which still works is enabling and
> disabling.
> 
> I can't reproduce this behavior manually so I'm not sure what is causing
> this.
> 
> Regarding the amount of cycles of sleep; Using a prescaler of 72000 the
> PWM clock is 3 ms. Although timing tests using devmem seem unreliable
> (too much overhead?), in U-Boot I need to 'sleep' for at least 7 ms
> between the commands to make sure the output doesn't sometimes get stuck
> in the enabled state. So in my case it seems to be at least 3 cycles. I
> am not sure how reliable this method is. However even if I can get it
> stuck in the enabled state using a shorter time, it doesn't cause the
> behavior I mentioned before. I was always able to recover it manually.
> Increasing the number of cycles to sleep therefore also doesn't solve my
> problem. Until we can solve that I cannot confirm nor deny if 2 cycles
> is enough.
> 
> Regards,
> Pascal

Turns out, what I'm referring to here is actually a different issue not
related to this patch series. A different series might be sent later to
address that. 

So no objections from my side for this one.

Regards,
Pascal

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/8c3dd01c9a0b292771a3a557c247c087%40pascalroeleven.nl.


[linux-sunxi] Re: [PATCH 0/6] pwm: sun4i: only wait 2 cycles prior to disabling

2021-05-31 Thread Pascal Roeleven
On 2021-05-31 06:46, Roman Beranek wrote:
> As Emil Lenngren has previously shown [1], actually only 1-2 cycles of
> the prescaler-divided clock are necessary to pass before the PWM turns
> off, not a full period.
> 
> To avoid having the PWM re-enabled from another thread while asleep,
> ctrl_lock spinlock was converted to a mutex so that it can be released
> only after the clock gate has finally been turned on.
> 
> [1] https://linux-sunxi.org/PWM_Controller_Register_Guide
> 
> Roman Beranek (6):
>   pwm: sun4i: enable clk prior to getting its rate
>   pwm: sun4i: disable EN bit prior to the delay
>   pwm: sun4i: replace spinlock with a mutex
>   pwm: sun4i: simplify calculation of the delay time
>   pwm: sun4i: shorten the delay to 2 cycles
>   pwm: sun4i: don't delay if the PWM is already off
> 
>  drivers/pwm/pwm-sun4i.c | 56 +++--
>  1 file changed, 26 insertions(+), 30 deletions(-)

Hi Roman,

Thanks for your attempt to fix this.

Unfortunately on my A10 device (Topwise A721), the controller still gets
stuck in an unrecoverable state after disabling and re-enabling the PWM
when it was already on (set in U-Boot), or when enabling it when it was
off. In this state, any changes to the period register (using devmem)
don't seem to have any effect. It seems to be stuck in the state it was
before disabling. The only thing which still works is enabling and
disabling.

I can't reproduce this behavior manually so I'm not sure what is causing
this.

Regarding the amount of cycles of sleep; Using a prescaler of 72000 the
PWM clock is 3 ms. Although timing tests using devmem seem unreliable
(too much overhead?), in U-Boot I need to 'sleep' for at least 7 ms
between the commands to make sure the output doesn't sometimes get stuck
in the enabled state. So in my case it seems to be at least 3 cycles. I
am not sure how reliable this method is. However even if I can get it
stuck in the enabled state using a shorter time, it doesn't cause the
behavior I mentioned before. I was always able to recover it manually.
Increasing the number of cycles to sleep therefore also doesn't solve my
problem. Until we can solve that I cannot confirm nor deny if 2 cycles
is enough.

Regards,
Pascal

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/e63e2b31c63bb9e227ed9ec04a8af54e%40pascalroeleven.nl.


[linux-sunxi] Re: [PATCH 0/6] pwm: sun4i: only wait 2 cycles prior to disabling

2021-05-31 Thread Pascal Roeleven
On 2021-05-31 22:01, Emil Lenngren wrote:
> You could look at the devmem source code, and in C write a script that
> writes to pwm register to disable the pwm, insert a usleep, then
> disable the gating. This can be done for various sleep values, then
> retrying with same sleep value multiple times. Assuming the overhead
> is low (you can check the overhead by checking the current timestamp
> at the beginning and at the end of the program, take the diff and then
> subtract the sleep time), you will get one range where it never works,
> one range where it works sometimes, and one range where it always
> works. The uncertain range's condition for succeeding will depend on
> when in the cycle you run the code.
> Assuming we believe 3 cycles are enough on A10 and prescaler is 72000,
> the thresholds for these ranges are 0-6 ms, 6-9 ms and 9+ ms.

Thank you I will give this a shot if there is still an uncertainty about
the cycles in the end. I performed my tests with a Busybox rootfs, so I
assumed the overhead was low as well.

> About "being stuck", I'm not sure exactly what you mean but it's
> expected that writes to the period register won't be visible (if you
> read it after a write) when the clock gating is disabled. Three full
> cycles (with the gating is on) must take place before the change is
> visible (i.e. need to wait four cycles to be sure). At least on >=A13.
> I documented that here:
> https://linux-sunxi.org/PWM_Controller_Register_Guide.

By being stuck, I mean being in an state from which it can't recover.
The controller will keep outputting seemingly the same signal regardless
what you write to the period register. You can read the values back, but
they aren't effecting the output anymore. No matter in what order or
with what delay I try to re-enable and disable the gate or enable bit,
it'll keep outputting the same signal until you reset the device.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/3626bda2eb9cd93744eca6f19c189feb%40pascalroeleven.nl.


[linux-sunxi] [PATCH v5 1/2] dt-bindings: arm: Add Topwise A721

2021-02-24 Thread Pascal Roeleven
Add the bindings for Topwise A721 tablet

Signed-off-by: Pascal Roeleven 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/arm/sunxi.yaml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/sunxi.yaml 
b/Documentation/devicetree/bindings/arm/sunxi.yaml
index 08607c7ec1..ac750025a2 100644
--- a/Documentation/devicetree/bindings/arm/sunxi.yaml
+++ b/Documentation/devicetree/bindings/arm/sunxi.yaml
@@ -802,6 +802,11 @@ properties:
   - const: tbs-biometrics,a711
   - const: allwinner,sun8i-a83t
 
+  - description: Topwise A721 Tablet
+items:
+  - const: topwise,a721
+  - const: allwinner,sun4i-a10
+
   - description: Utoo P66
 items:
   - const: utoo,p66
-- 
2.27.0


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210224105240.47754-2-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v5 0/2] Add support for Topwise A721 tablet

2021-02-24 Thread Pascal Roeleven
On request I'm resending the last two patches from the Topwise A721 tablet
series from a year ago as they weren't picked up. The other patches are
already merged, so I didn't resend them.

Changes from v4:
* Reorder nodes alphabetically

Changes from v3:
* Fix DT validation warnings
* Remove leftover labels

Changes from v2:
* Collected acked-by.

Original cover letter:

This series add support for the Topwise A721 tablet and it's display.
It is an old tablet (around 2012) but it might be useful as reference
as the devicetree is pretty complete.

Changes from v1:
* Split into multiple patches
* dt-binding: use yaml instead of txt
* dt-binding: add Topwise A721 to sunxi.yaml
* dt-binding: add Topwise to vendor-prefixes
* drm: Add bus_format, bus_flags and connector_type
* dts: Use SPDX license identifier instead of boilerplate license text
* dts: Remove pinctrl leftovers

Pascal Roeleven (2):
  dt-bindings: arm: Add Topwise A721
  ARM: dts: sun4i: Add support for Topwise A721 tablet

 .../devicetree/bindings/arm/sunxi.yaml|   5 +
 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts  | 242 ++
 3 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

-- 
2.27.0


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210224105240.47754-1-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v5 2/2] ARM: dts: sun4i: Add support for Topwise A721 tablet

2021-02-24 Thread Pascal Roeleven
The Topwise A721/LY-F1 tablet is a tablet sold around 2012 under
different brands. The mainboard mentions A721 clearly, so this tablet
is best known under this name.

Signed-off-by: Pascal Roeleven 
---
 arch/arm/boot/dts/Makefile   |   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts | 242 +++
 2 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 8e5d4ab4e7..53b6e06bf1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1105,7 +1105,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-olinuxino-lime.dtb \
sun4i-a10-pcduino.dtb \
sun4i-a10-pcduino2.dtb \
-   sun4i-a10-pov-protab2-ips9.dtb
+   sun4i-a10-pov-protab2-ips9.dtb \
+   sun4i-a10-topwise-a721.dtb
 dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a10s-auxtek-t003.dtb \
sun5i-a10s-auxtek-t004.dtb \
diff --git a/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts 
b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
new file mode 100644
index 00..3628f12d25
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
@@ -0,0 +1,242 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Pascal Roeleven 
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Topwise A721";
+   compatible = "topwise,a721", "allwinner,sun4i-a10";
+
+   aliases {
+   serial0 = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 10 PWM_POLARITY_INVERTED>;
+   power-supply = <_vbat>;
+   enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+   brightness-levels = <0 30 40 50 60 70 80 90 100>;
+   default-brightness-level = <8>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel {
+   compatible = "starry,kr070pe2t";
+   backlight = <>;
+   power-supply = <_lcd_power>;
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reg_lcd_power: reg-lcd-power {
+   compatible = "regulator-fixed";
+   regulator-name = "reg-lcd-power";
+   gpio = < 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+   enable-active-high;
+   };
+
+   reg_vbat: reg-vbat {
+   compatible = "regulator-fixed";
+   regulator-name = "vbat";
+   regulator-min-microvolt = <370>;
+   regulator-max-microvolt = <370>;
+   };
+
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupts = <0>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_power_supply {
+   status = "okay";
+};
+
+_power_supply {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   accelerometer@4c {
+   compatible = "fsl,mma7660";
+   reg = <0x4c>;
+   };
+};
+
+ {
+   status = "okay";
+
+   touchscreen@38 {
+   compatible = "edt,edt-ft5406";
+   reg = <0x38>;
+   interrupt-parent = <>;
+   interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
+   touchscreen-size-x = <800>;
+   touchscreen-size-y = <480>;
+   vcc-supply = <_vcc3v3>;
+   };
+};
+
+ {
+   vref-supply = <_ldo2>;
+   status = "okay";
+
+   button-571 {
+   label = "Volume Up";
+   linux,code = ;
+   channel = <0>;
+   voltage = <571428>;
+   };
+
+   button-761 {
+   label = "Volume Down";
+   linux,code = ;
+   channel = <0>;
+   voltage = <761904>;
+   };
+};
+
+ {
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 1 GPIO_ACTIVE_LOW>; /* PH01 */
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+_sram {
+   status = "okay";
+};
+
+ {
+

[linux-sunxi] [PATCH RESEND v3 2/2] ARM: dts: sun4i: Add support for Topwise A721 tablet

2021-02-16 Thread Pascal Roeleven
The Topwise A721/LY-F1 tablet is a tablet sold around 2012 under
different brands. The mainboard mentions A721 clearly, so this tablet
is best known under this name.

Signed-off-by: Pascal Roeleven 
---
 arch/arm/boot/dts/Makefile   |   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts | 242 +++
 2 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 3d1ea0b251..ba25b4235a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1103,7 +1103,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-olinuxino-lime.dtb \
sun4i-a10-pcduino.dtb \
sun4i-a10-pcduino2.dtb \
-   sun4i-a10-pov-protab2-ips9.dtb
+   sun4i-a10-pov-protab2-ips9.dtb \
+   sun4i-a10-topwise-a721.dtb
 dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a10s-auxtek-t003.dtb \
sun5i-a10s-auxtek-t004.dtb \
diff --git a/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts 
b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
new file mode 100644
index 00..936171d30b
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
@@ -0,0 +1,242 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Pascal Roeleven 
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Topwise A721";
+   compatible = "topwise,a721", "allwinner,sun4i-a10";
+
+   aliases {
+   serial0 = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 10 PWM_POLARITY_INVERTED>;
+   power-supply = <_vbat>;
+   enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+   brightness-levels = <0 30 40 50 60 70 80 90 100>;
+   default-brightness-level = <8>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel: panel {
+   compatible = "starry,kr070pe2t";
+   backlight = <>;
+   power-supply = <_lcd_power>;
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reg_lcd_power: reg-lcd-power {
+   compatible = "regulator-fixed";
+   regulator-name = "reg-lcd-power";
+   gpio = < 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+   enable-active-high;
+   };
+
+   reg_vbat: reg-vbat {
+   compatible = "regulator-fixed";
+   regulator-name = "vbat";
+   regulator-min-microvolt = <370>;
+   regulator-max-microvolt = <370>;
+   };
+
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupts = <0>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_power_supply {
+   status = "okay";
+};
+
+_power_supply {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   mma7660: accelerometer@4c {
+   compatible = "fsl,mma7660";
+   reg = <0x4c>;
+   };
+};
+
+ {
+   status = "okay";
+
+   ft5406ee8: touchscreen@38 {
+   compatible = "edt,edt-ft5406";
+   reg = <0x38>;
+   interrupt-parent = <>;
+   interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
+   touchscreen-size-x = <800>;
+   touchscreen-size-y = <480>;
+   vcc-supply = <_vcc3v3>;
+   };
+};
+
+ {
+   vref-supply = <_ldo2>;
+   status = "okay";
+
+   button-vol-down {
+   label = "Volume Down";
+   linux,code = ;
+   channel = <0>;
+   voltage = <761904>;
+   };
+
+   button-vol-up {
+   label = "Volume Up";
+   linux,code = ;
+   channel = <0>;
+   voltage = <571428>;
+   };
+};
+
+ {
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 1 GPIO_ACTIVE_LOW>; /* PH01 */
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+_sram {
+   sta

[linux-sunxi] [PATCH RESEND v3 0/2] Add support for Topwise A721 tablet

2021-02-16 Thread Pascal Roeleven
On request I'm resending the last two patches from the Topwise A721 tablet
series from a year ago as they weren't picked up. The other patches are
already merged, so I didn't resend them. They still apply as-is, so no changes
are made.

Changes from v2:
* Collected acked-by.

Original cover letter:

This series add support for the Topwise A721 tablet and it's display.
It is an old tablet (around 2012) but it might be useful as reference
as the devicetree is pretty complete.

Changes from v1:
* Split into multiple patches
* dt-binding: use yaml instead of txt
* dt-binding: add Topwise A721 to sunxi.yaml
* dt-binding: add Topwise to vendor-prefixes
* drm: Add bus_format, bus_flags and connector_type
* dts: Use SPDX license identifier instead of boilerplate license text
* dts: Remove pinctrl leftovers

Pascal Roeleven (2):
  dt-bindings: arm: Add Topwise A721
  ARM: dts: sun4i: Add support for Topwise A721 tablet

 .../devicetree/bindings/arm/sunxi.yaml|   5 +
 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts  | 242 ++
 3 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

-- 
2.27.0


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210216165954.43135-1-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH RESEND v3 1/2] dt-bindings: arm: Add Topwise A721

2021-02-16 Thread Pascal Roeleven
Add the bindings for Topwise A721 tablet

Signed-off-by: Pascal Roeleven 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/arm/sunxi.yaml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/sunxi.yaml 
b/Documentation/devicetree/bindings/arm/sunxi.yaml
index 6db32fbf81..8833a9c925 100644
--- a/Documentation/devicetree/bindings/arm/sunxi.yaml
+++ b/Documentation/devicetree/bindings/arm/sunxi.yaml
@@ -787,6 +787,11 @@ properties:
   - const: tbs-biometrics,a711
   - const: allwinner,sun8i-a83t
 
+  - description: Topwise A721 Tablet
+items:
+  - const: topwise,a721
+  - const: allwinner,sun4i-a10
+
   - description: Utoo P66
 items:
   - const: utoo,p66
-- 
2.27.0


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210216165954.43135-2-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v4 2/2] ARM: dts: sun4i: Add support for Topwise A721 tablet

2021-02-22 Thread Pascal Roeleven
The Topwise A721/LY-F1 tablet is a tablet sold around 2012 under
different brands. The mainboard mentions A721 clearly, so this tablet
is best known under this name.

Signed-off-by: Pascal Roeleven 
---
 arch/arm/boot/dts/Makefile   |   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts | 242 +++
 2 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 3d1ea0b251..ba25b4235a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1103,7 +1103,8 @@ dtb-$(CONFIG_MACH_SUN4I) += \
sun4i-a10-olinuxino-lime.dtb \
sun4i-a10-pcduino.dtb \
sun4i-a10-pcduino2.dtb \
-   sun4i-a10-pov-protab2-ips9.dtb
+   sun4i-a10-pov-protab2-ips9.dtb \
+   sun4i-a10-topwise-a721.dtb
 dtb-$(CONFIG_MACH_SUN5I) += \
sun5i-a10s-auxtek-t003.dtb \
sun5i-a10s-auxtek-t004.dtb \
diff --git a/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts 
b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
new file mode 100644
index 00..2c417c408b
--- /dev/null
+++ b/arch/arm/boot/dts/sun4i-a10-topwise-a721.dts
@@ -0,0 +1,242 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2020 Pascal Roeleven 
+ */
+
+/dts-v1/;
+#include "sun4i-a10.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Topwise A721";
+   compatible = "topwise,a721", "allwinner,sun4i-a10";
+
+   aliases {
+   serial0 = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 10 PWM_POLARITY_INVERTED>;
+   power-supply = <_vbat>;
+   enable-gpios = < 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
+   brightness-levels = <0 30 40 50 60 70 80 90 100>;
+   default-brightness-level = <8>;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   panel {
+   compatible = "starry,kr070pe2t";
+   backlight = <>;
+   power-supply = <_lcd_power>;
+
+   port {
+   panel_input: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+   reg_lcd_power: reg-lcd-power {
+   compatible = "regulator-fixed";
+   regulator-name = "reg-lcd-power";
+   gpio = < 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
+   enable-active-high;
+   };
+
+   reg_vbat: reg-vbat {
+   compatible = "regulator-fixed";
+   regulator-name = "vbat";
+   regulator-min-microvolt = <370>;
+   regulator-max-microvolt = <370>;
+   };
+
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   cpu-supply = <_dcdc2>;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   axp209: pmic@34 {
+   reg = <0x34>;
+   interrupts = <0>;
+   };
+};
+
+#include "axp209.dtsi"
+
+_power_supply {
+   status = "okay";
+};
+
+_power_supply {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   accelerometer@4c {
+   compatible = "fsl,mma7660";
+   reg = <0x4c>;
+   };
+};
+
+ {
+   status = "okay";
+
+   touchscreen@38 {
+   compatible = "edt,edt-ft5406";
+   reg = <0x38>;
+   interrupt-parent = <>;
+   interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
+   touchscreen-size-x = <800>;
+   touchscreen-size-y = <480>;
+   vcc-supply = <_vcc3v3>;
+   };
+};
+
+ {
+   vref-supply = <_ldo2>;
+   status = "okay";
+
+   button-761 {
+   label = "Volume Down";
+   linux,code = ;
+   channel = <0>;
+   voltage = <761904>;
+   };
+
+   button-571 {
+   label = "Volume Up";
+   linux,code = ;
+   channel = <0>;
+   voltage = <571428>;
+   };
+};
+
+ {
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 7 1 GPIO_ACTIVE_LOW>; /* PH01 */
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+_sram {
+   status = "okay";
+};
+
+ {
+

[linux-sunxi] [PATCH v4 0/2] Add support for Topwise A721 tablet

2021-02-22 Thread Pascal Roeleven
On request I'm resending the last two patches from the Topwise A721 tablet
series from a year ago as they weren't picked up. The other patches are
already merged, so I didn't resend them.

Changes from v3:
* Fix DT validation warnings
* Remove leftover labels

Changes from v2:
* Collected acked-by.

Original cover letter:

This series add support for the Topwise A721 tablet and it's display.
It is an old tablet (around 2012) but it might be useful as reference
as the devicetree is pretty complete.

Changes from v1:
* Split into multiple patches
* dt-binding: use yaml instead of txt
* dt-binding: add Topwise A721 to sunxi.yaml
* dt-binding: add Topwise to vendor-prefixes
* drm: Add bus_format, bus_flags and connector_type
* dts: Use SPDX license identifier instead of boilerplate license text
* dts: Remove pinctrl leftovers

Pascal Roeleven (2):
  dt-bindings: arm: Add Topwise A721
  ARM: dts: sun4i: Add support for Topwise A721 tablet

 .../devicetree/bindings/arm/sunxi.yaml|   5 +
 arch/arm/boot/dts/Makefile|   3 +-
 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts  | 242 ++
 3 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun4i-a10-topwise-a721.dts

-- 
2.27.0


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210222100826.12478-1-dev%40pascalroeleven.nl.


[linux-sunxi] [PATCH v4 1/2] dt-bindings: arm: Add Topwise A721

2021-02-22 Thread Pascal Roeleven
Add the bindings for Topwise A721 tablet

Signed-off-by: Pascal Roeleven 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/arm/sunxi.yaml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/sunxi.yaml 
b/Documentation/devicetree/bindings/arm/sunxi.yaml
index 6db32fbf81..8833a9c925 100644
--- a/Documentation/devicetree/bindings/arm/sunxi.yaml
+++ b/Documentation/devicetree/bindings/arm/sunxi.yaml
@@ -787,6 +787,11 @@ properties:
   - const: tbs-biometrics,a711
   - const: allwinner,sun8i-a83t
 
+  - description: Topwise A721 Tablet
+items:
+  - const: topwise,a721
+  - const: allwinner,sun4i-a10
+
   - description: Utoo P66
 items:
   - const: utoo,p66
-- 
2.27.0


-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/linux-sunxi/20210222100826.12478-2-dev%40pascalroeleven.nl.