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

2020-07-27 Thread Vasily Khoruzhick
On Sun, Jul 26, 2020 at 11:05 PM Faruk KILAVUZ  wrote:
>
> I upgraded to 20.0.2-devel.

Don't drop mailing list from CC.

Updating to 20.0.2 won't help, we don't backport any lima patches into
stable branches since we don't have enough man power. All development
is going on git master. 20.0 is way to old.

You need at least 20.1 or better git master (it has some optimizations
for PP compiler)

>
> Vasily Khoruzhick , 24 Tem 2020 Cum, 22:05 tarihinde şunu 
> yazdı:
>>
>> On Thu, Jul 23, 2020 at 4:34 AM Faruk KILAVUZ  
>> wrote:
>>
>> Hi
>>
>> > OpenGL version string: 2.1 Mesa 20.0.8
>>
>> Mesa 20.0 is way too old for lima and doesn't have important fixes and
>> optimizations. Update to at least 20.1 or better use mesa from git
>> master.
>>
>> Contact your distro maintainers for instructions on how to update mesa.
>>
>> Regards,
>> Vasily

-- 
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/CA%2BE%3DqVdJ%3Ddd0OTnSumyt_ByDG_i8F-jZDraQpbbWCLC6xh_18w%40mail.gmail.com.


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

2020-07-24 Thread Vasily Khoruzhick
On Fri, Jul 24, 2020 at 1:22 AM Icenowy Zheng  wrote:
> What desktop environment do you use? Have you enabled composition?
>
> When doing composition, the graphics will go through the GPU twice, and
> Mali-400 is very weak.

Actually glamor is smoother when compositing is enabled since for
non-compositing case it hit a fallback that uses CPU to copying data
to root window.

-- 
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/CA%2BE%3DqVfbkOex78_E7GoNyhb2hdHi6-GqaKHRvu6irapYcoAD%3Dg%40mail.gmail.com.


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

2020-07-24 Thread Vasily Khoruzhick
On Thu, Jul 23, 2020 at 4:34 AM Faruk KILAVUZ  wrote:

Hi

> OpenGL version string: 2.1 Mesa 20.0.8

Mesa 20.0 is way too old for lima and doesn't have important fixes and
optimizations. Update to at least 20.1 or better use mesa from git
master.

Contact your distro maintainers for instructions on how to update mesa.

Regards,
Vasily

-- 
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/CA%2BE%3DqVdM7Mwo9kinQmxbQ2MWghRsAJZvAkm6S96eeRSu%2BYVA7w%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 3/9] arm64: dts: allwinner: pinebook: Remove unused AXP803 regulators

2020-01-24 Thread Vasily Khoruzhick
On Fri, Jan 24, 2020 at 8:36 AM Maxime Ripard  wrote:
>
> On Tue, Jan 21, 2020 at 09:14:02PM -0600, Samuel Holland wrote:
> > On 1/21/20 3:05 AM, Maxime Ripard wrote:
> > > On Sun, Jan 19, 2020 at 10:30:58AM -0600, Samuel Holland wrote:
> > >> The Pinebook does not use the CSI bus on the A64. In fact it does not
> > >> use GPIO port E for anything at all. Thus the following regulators are
> > >> not used and do not need voltages set:
> > >>
> > >>  - ALDO1: Connected to VCC-PE only
> > >>  - DLDO3: Not connected
> > >>  - ELDO3: Not connected
> > >>
> > >> Signed-off-by: Samuel Holland 
> > >> ---
> > >>  .../boot/dts/allwinner/sun50i-a64-pinebook.dts   | 16 +---
> > >>  1 file changed, 1 insertion(+), 15 deletions(-)
> > >>
> > >> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 
> > >> b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > >> index ff32ca1a495e..8e7ce6ad28dd 100644
> > >> --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > >> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > >> @@ -202,9 +202,7 @@
> > >>  };
> > >>
> > >>  _aldo1 {
> > >> -  regulator-min-microvolt = <280>;
> > >> -  regulator-max-microvolt = <280>;
> > >> -  regulator-name = "vcc-csi";
> > >> +  regulator-name = "vcc-pe";
> > >>  };
> > >
> > > If it's connected to PE, I'd expect the voltage to be at 3.3v?
> >
> > If we provide voltage constraints, the regulator core will enable the 
> > regulator
> > and set its voltage at boot. That seems like a bit of a waste.
>
> I'm not sure the regulator core enables them if there's neither
> regulator-boot-on nor regulator-always-on.
>
> > I don't think the voltage really matters, since nothing is plugged in to the
> > port. ALDO1 can't go over 3.3V anyway, so even if it does get turned on for 
> > some
> > reason, nothing will get damaged.
>
> Looking at the schematics, it looks like the PE pins are connected to
> the front-facing camera?

The only camera on Pinebook is UVC

>
> Maxime
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
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/CA%2BE%3DqVf0wcds7SzLOQT5BS2fVXT5w6-e9yhTK4%3DBXBm%3D%3DP3Kzg%40mail.gmail.com.


[linux-sunxi] Re: [PATCH 3/9] arm64: dts: allwinner: pinebook: Remove unused AXP803 regulators

2020-01-21 Thread Vasily Khoruzhick
On Tue, Jan 21, 2020 at 1:05 AM Maxime Ripard  wrote:
>
> On Sun, Jan 19, 2020 at 10:30:58AM -0600, Samuel Holland wrote:
> > The Pinebook does not use the CSI bus on the A64. In fact it does not
> > use GPIO port E for anything at all. Thus the following regulators are
> > not used and do not need voltages set:
> >
> >  - ALDO1: Connected to VCC-PE only
> >  - DLDO3: Not connected
> >  - ELDO3: Not connected
> >
> > Signed-off-by: Samuel Holland 
> > ---
> >  .../boot/dts/allwinner/sun50i-a64-pinebook.dts   | 16 +---
> >  1 file changed, 1 insertion(+), 15 deletions(-)
> >
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 
> > b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > index ff32ca1a495e..8e7ce6ad28dd 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
> > @@ -202,9 +202,7 @@
> >  };
> >
> >  _aldo1 {
> > - regulator-min-microvolt = <280>;
> > - regulator-max-microvolt = <280>;
> > - regulator-name = "vcc-csi";
> > + regulator-name = "vcc-pe";
> >  };
>
> If it's connected to PE, I'd expect the voltage to be at 3.3v?

Commit message says that PE is not used, so we don't need to set it at all.

> Maxime
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
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/CA%2BE%3DqVcdza_E17_%3Dr%2B0eZ2UexCYah35jt8%3Dv%2BuFTLHx3%2BBvHSg%40mail.gmail.com.


Re: [linux-sunxi] [PATCH 5/5] arm64: dts: allwinner: a64: add support for PineTab

2020-01-10 Thread Vasily Khoruzhick
On Fri, Jan 10, 2020 at 7:54 AM Icenowy Zheng  wrote:
>
> PineTab is a 10.1" tablet by Pine64 with Allwinner A64 inside.
>
> It includes the following peripherals:
>
> USB:
> - A microUSB Type-B port connected to the OTG-capable USB PHY of
> Allwinner A64. The ID pin is connected to a GPIO of the A64 SoC, and the
> Vbus is connected to the Vbus of AXP803 PMIC. These enables OTG
> functionality on this port.
> - A USB Type-A port is connected to the internal hub attached to the
> non-OTG USB PHY of Allwinner A64.
> - There are reserved pins for an external keyboard connected to the
> internal hub.
>
> Power:
> - The microUSB port has its Vbus connected to AXP803, mentioned above.
> - A DC jack (of a strange size, 2.5mm outer diameter) is connected to
> the ACIN of AXP803.
> - A Li-Polymer battery is connected to the battery pins of AXP803.
>
> Storage:
> - An tradition Pine64 eMMC slot is on the board, mounted with an eMMC
> module by factory.
> - An external microSD slot is hidden under a protect case.
>
> Display:
> - A MIPI-DSI LCD panel (800x1280) is connected to the DSI port of A64 SoC.
> - A mini HDMI port.
>
> Input:
> - A touch panel attached to a Goodix GT9271 touch controller.
> - Volume keys connected to the LRADC of the A64 SoC.
>
> Camera:
> - An OV5640 CMOS camera is at rear, connected to the CSI bus of A64 SoC.
> - A GC2145 CMOS camera is at front, shares the same CSI bus with OV5640.
>
> Audio:
> - A headphone jack is conencted to the SoC's internal codec.
> - A speaker connected is to the Line Out port of SoC's internal codec, via
> an amplifier.
>
> Misc:
> - Debug UART is muxed with the headphone jack, with the switch next to
> the microSD slot.
> - A bosch BMA223 accelerometer is connected to the I2C bus of A64 SoC.
> - Wi-Fi and Bluetooth are available via a RTL8723CS chip, similar to the
> one in Pinebook.
>
> This commit adds a basically usable device tree for it, implementing
> most of the features mentioned above. HDMI is not supported now because
> bad LCD-HDMI coexistence situation of mainline A64 display driver, and
> the front camera currently lacks a driver and a facility to share the
> bus with the rear one.
>
> Signed-off-by: Icenowy Zheng 
> ---
>  arch/arm64/boot/dts/allwinner/Makefile|   1 +
>  .../boot/dts/allwinner/sun50i-a64-pinetab.dts | 461 ++
>  2 files changed, 462 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
>
> diff --git a/arch/arm64/boot/dts/allwinner/Makefile 
> b/arch/arm64/boot/dts/allwinner/Makefile
> index cf4f78617c3f..6dad63881cd3 100644
> --- a/arch/arm64/boot/dts/allwinner/Makefile
> +++ b/arch/arm64/boot/dts/allwinner/Makefile
> @@ -9,6 +9,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-orangepi-win.dtb
>  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-lts.dtb
>  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pine64-plus.dtb sun50i-a64-pine64.dtb
>  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinebook.dtb
> +dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinetab.dtb
>  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-sopine-baseboard.dtb
>  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-teres-i.dtb
>  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-bananapi-m2-plus.dtb
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts 
> b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
> new file mode 100644
> index ..1dfa3668636e
> --- /dev/null
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinetab.dts
> @@ -0,0 +1,461 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (C) 2019 Icenowy Zheng 
> + *
> + */
> +
> +/dts-v1/;
> +
> +#include "sun50i-a64.dtsi"

You may want to include dtsi with OPP for A64 here if you want to enable DVFS

> +
> +#include 
> +#include 
> +#include 
> +
> +/ {
> +   model = "PineTab";
> +   compatible = "pine64,pinetab", "allwinner,sun50i-a64";
> +
> +   aliases {
> +   serial0 = 
> +   ethernet0 = 
> +   };
> +
> +   backlight: backlight {
> +   compatible = "pwm-backlight";
> +   pwms = < 0 5 PWM_POLARITY_INVERTED>;
> +   brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
> +   default-brightness-level = <8>;
> +   enable-gpios = < 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
> +   power-supply = <_bl>;
> +   };
> +
> +   chosen {
> +   stdout-path = "serial0:115200n8";
> +   };
> +
> +   i2c-csi {
> +   compatible = "i2c-gpio";
> +   sda-gpios = < 4 13 GPIO_ACTIVE_HIGH>; /* PE13 */
> +   scl-gpios = < 4 12 GPIO_ACTIVE_HIGH>; /* PE12 */
> +   i2c-gpio,delay-us = <5>;
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +
> +   /* Rear camera */
> +   ov5640: camera@3c {
> +   compatible = "ovti,ov5640";
> +   reg = <0x3c>;
> +   pinctrl-names = "default";
> +   

Re: [linux-sunxi] backlight lcd crash [ Pine64 ]

2020-01-08 Thread Vasily Khoruzhick
The issue is that sun4i_pwm_apply() calls sun4i_pwm_calculate() which
calls clk_get_rate() while holding a spinlock and clk_get_rate() may
sleep.

It's a bug in pwm-sun4i driver.

On Wed, Jan 8, 2020 at 4:19 PM @lex  wrote:
>
> I am doing some experiments with LCD7" with the kernel 5.4.8 and occasionally 
> i get this crash.
> Can someone explain or give some directions on how to find the offending 
> error based on the crash log?  Any idea what could be causing this?
>
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.681388] BUG: scheduling while 
> atomic: gsd-backlight-h/3978/0x0002
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688221] Modules linked in: fuse 
> rfkill dw_hdmi_i2s_audio snd_soc_hdmi_codec panel_feiyang_fy07024di26a30d 
> sunxi_cedrus(C) v4l2_mem2mem crct10dif_ce sun8i_drm_hdmi videobuf2_dma_contig 
> snd_soc_spdif_tx dw_hdmi videobuf2_memops axp20x_adc cec videobuf2_v4l2 
> snd_soc_simple_card sunxi_cir axp20x_usb_power axp20x_ac_power 
> snd_soc_simple_card_utils pinctrl_axp209 axp20x_battery phy_sun6i_mipi_dphy 
> rc_core videobuf2_common mali(O) sun6i_mipi_dsi sun50i_codec_analog videodev 
> sun8i_adda_pr_regmap crc_ccitt goodix sun8i_codec sun4i_i2s mc sun4i_drm 
> sun4i_frontend sun4i_tcon sun8i_mixer sun8i_tcon_top pwm_bl ip_tables 
> x_tables ipv6 nf_defrag_ipv6
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688331] CPU: 3 PID: 3978 Comm: 
> gsd-backlight-h Tainted: G C O  5.4.8 #1
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688334] Hardware name: Pine64+ (DT)
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688339] Call trace:
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688357]  dump_backtrace+0x0/0x150
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688364]  show_stack+0x14/0x20
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688374]  dump_stack+0xb4/0xd8
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688384]  __schedule_bug+0x50/0x70
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688392]  __schedule+0x4bc/0x510
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688397]  schedule+0x40/0xd0
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688403]  
> schedule_preempt_disabled+0x20/0x38
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688410]  
> __mutex_lock.isra.10+0x150/0x568
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688416]  
> __mutex_lock_slowpath+0x10/0x18
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688422]  mutex_lock+0x38/0x40
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688430]  clk_prepare_lock+0x40/0xa0
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688437]  clk_get_rate+0x1c/0x70
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688446]  sun4i_pwm_apply+0xb4/0x450
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688453]  pwm_apply_state+0x64/0x1e8
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688464]  
> pwm_backlight_update_status+0xb8/0x198 [pwm_bl]
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688473]  
> backlight_device_set_brightness+0x64/0xb8
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688480]  brightness_store+0x78/0x90
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688488]  dev_attr_store+0x14/0x28
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688496]  sysfs_kf_write+0x3c/0x50
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688501]  
> kernfs_fop_write+0x144/0x230
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688511]  __vfs_write+0x18/0x38
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688517]  vfs_write+0xb4/0x1e0
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688524]  ksys_write+0x68/0xf8
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688530]  
> __arm64_sys_write+0x18/0x20
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688540]  
> el0_svc_common.constprop.2+0x64/0x160
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688547]  el0_svc_handler+0x20/0x80
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688552]  el0_svc+0x8/0xc
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.688694] BUG: scheduling while 
> atomic: gsd-backlight-h/3978/0x
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.695480] Modules linked in: fuse 
> rfkill dw_hdmi_i2s_audio snd_soc_hdmi_codec panel_feiyang_fy07024di26a30d 
> sunxi_cedrus(C) v4l2_mem2mem crct10dif_ce sun8i_drm_hdmi videobuf2_dma_contig 
> snd_soc_spdif_tx dw_hdmi videobuf2_memops axp20x_adc cec videobuf2_v4l2 
> snd_soc_simple_card sunxi_cir axp20x_usb_power axp20x_ac_power 
> snd_soc_simple_card_utils pinctrl_axp209 axp20x_battery phy_sun6i_mipi_dphy 
> rc_core videobuf2_common mali(O) sun6i_mipi_dsi sun50i_codec_analog videodev 
> sun8i_adda_pr_regmap crc_ccitt goodix sun8i_codec sun4i_i2s mc sun4i_drm 
> sun4i_frontend sun4i_tcon sun8i_mixer sun8i_tcon_top pwm_bl ip_tables 
> x_tables ipv6 nf_defrag_ipv6
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.695558] CPU: 3 PID: 3978 Comm: 
> gsd-backlight-h Tainted: GWC O  5.4.8 #1
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.695561] Hardware name: Pine64+ (DT)
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.695564] Call trace:
> Jan  8 23:49:43 pine64-plus kernel: [ 5144.695579]  dump_backtrace+0x0/0x150
> Jan  8 

Re: [linux-sunxi] Re: [PATCH v3 1/2] arm64: arch_timer: Workaround for Allwinner A64 timer instability

2019-12-04 Thread Vasily Khoruzhick
On Wed, Dec 4, 2019 at 4:21 AM Marc Zyngier  wrote:
>
> [please note that my email address has changed]
>
> On 2019-12-04 04:18, Vasily Khoruzhick wrote:
>
> [...]
>
> > Unfortunately this patch doesn't completely eliminate the jumps.
> > There
> > have been reports from users who still saw 95y jump even with the
> > patch applied.
> >
> > Personally I've seen it once or twice on my Pine64-LTS.
> >
> > Looks like we need bigger hammer. Does anyone have any idea what it
> > could be?
>
> Which kernel version did you see this happening on?

I've seen it on 5.3

>  M.
> --
> Jazz is not dead. It just smells funny...

-- 
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/CA%2BE%3DqVc-BA_W8O1qpkKgg5pDax-Jbvmpc-TB7gWB7CfYAxXCXQ%40mail.gmail.com.


Re: [linux-sunxi] Re: [PATCH v3 1/2] arm64: arch_timer: Workaround for Allwinner A64 timer instability

2019-12-03 Thread Vasily Khoruzhick
On Mon, Jan 14, 2019 at 1:25 AM Marc Zyngier  wrote:
>
> Hi Samuel,

Hi Samuel,

> On 13/01/2019 02:17, Samuel Holland wrote:
> > The Allwinner A64 SoC is known[1] to have an unstable architectural
> > timer, which manifests itself most obviously in the time jumping forward
> > a multiple of 95 years[2][3]. This coincides with 2^56 cycles at a
> > timer frequency of 24 MHz, implying that the time went slightly backward
> > (and this was interpreted by the kernel as it jumping forward and
> > wrapping around past the epoch).
> >
> > Investigation revealed instability in the low bits of CNTVCT at the
> > point a high bit rolls over. This leads to power-of-two cycle forward
> > and backward jumps. (Testing shows that forward jumps are about twice as
> > likely as backward jumps.) Since the counter value returns to normal
> > after an indeterminate read, each "jump" really consists of both a
> > forward and backward jump from the software perspective.
> >
> > Unless the kernel is trapping CNTVCT reads, a userspace program is able
> > to read the register in a loop faster than it changes. A test program
> > running on all 4 CPU cores that reported jumps larger than 100 ms was
> > run for 13.6 hours and reported the following:
> >
> >  Count | Event
> > ---+---
> >   9940 | jumped backward  699ms
> >268 | jumped backward 1398ms
> >  1 | jumped backward 2097ms
> >  16020 | jumped forward   175ms
> >   6443 | jumped forward   699ms
> >   2976 | jumped forward  1398ms
> >  9 | jumped forward356516ms
> >  9 | jumped forward357215ms
> >  4 | jumped forward714430ms
> >  1 | jumped forward   3578440ms
> >
> > This works out to a jump larger than 100 ms about every 5.5 seconds on
> > each CPU core.
> >
> > The largest jump (almost an hour!) was the following sequence of reads:
> > 0x007f → 0x0093feff → 0x0080
> >
> > Note that the middle bits don't necessarily all read as all zeroes or
> > all ones during the anomalous behavior; however the low 10 bits checked
> > by the function in this patch have never been observed with any other
> > value.
> >
> > Also note that smaller jumps are much more common, with backward jumps
> > of 2048 (2^11) cycles observed over 400 times per second on each core.
> > (Of course, this is partially explained by lower bits rolling over more
> > frequently.) Any one of these could have caused the 95 year time skip.
> >
> > Similar anomalies were observed while reading CNTPCT (after patching the
> > kernel to allow reads from userspace). However, the CNTPCT jumps are
> > much less frequent, and only small jumps were observed. The same program
> > as before (except now reading CNTPCT) observed after 72 hours:
> >
> >  Count | Event
> > ---+---
> > 17 | jumped backward  699ms
> > 52 | jumped forward   175ms
> >   2831 | jumped forward   699ms
> >  5 | jumped forward  1398ms
> >
> > Further investigation showed that the instability in CNTPCT/CNTVCT also
> > affected the respective timer's TVAL register. The following values were
> > observed immediately after writing CNVT_TVAL to 0x1000:
> >
> >  CNTVCT | CNTV_TVAL  | CNTV_CVAL  | CNTV_TVAL Error
> > +++-
> >  0x00d4a2d8bfff | 0x10003fff | 0x00d4b2d8bfff | +0x4000
> >  0x00d4a2d94000 | 0x0fff | 0x00d4b2d97fff | -0x4000
> >  0x00d4a2d97fff | 0x10003fff | 0x00d4b2d97fff | +0x4000
> >  0x00d4a2d9c000 | 0x0fff | 0x00d4b2d9 | -0x4000
> >
> > The pattern of errors in CNTV_TVAL seemed to depend on exactly which
> > value was written to it. For example, after writing 0x10101010:
> >
> >  CNTVCT | CNTV_TVAL  | CNTV_CVAL  | CNTV_TVAL Error
> > +++-
> >  0x01ac3eff | 0x1110100f | 0x01ac4f10100f | +0x100
> >  0x01ac4000 | 0x1010100f | 0x01ac5110100f | -0x100
> >  0x01ac58ff | 0x1110100f | 0x01ac6910100f | +0x100
> >  0x01ac6600 | 0x1010100f | 0x01ac7710100f | -0x100
> >  0x01ac6aff | 0x1110100f | 0x01ac7b10100f | +0x100
> >  0x01ac6e00 | 0x1010100f | 0x01ac7f10100f | -0x100
> >
> > I was also twice able to reproduce the issue covered by Allwinner's
> > workaround[4], that writing to TVAL sometimes fails, and both CVAL and
> > TVAL are left with entirely bogus values. One was the following values:
> >
> >  CNTVCT | CNTV_TVAL  | CNTV_CVAL
> > ++--
> >  0x00d4a2d6014c | 0x8fbd5721 | 0x00d132935fff (615s in the past)
> >
> > 
> >
> > Because the CPU can read the CNTPCT/CNTVCT registers faster than 

Re: [linux-sunxi] is there any plan to enable cursor plane for sun4i-drm?

2019-09-03 Thread Vasily Khoruzhick
On Tue, Sep 3, 2019 at 1:49 AM 张宁  wrote:
>
> Hi, Maxime, Icenowy and other developers
>
> In https://linux-sunxi.org/Xorg, it says legacy display engine driver 
> supports HW cursor, but there is no code actually creates a cursor plane in 
> mainline linux, this is also said in: 
> https://groups.google.com/forum/#!searchin/linux-sunxi/subject$3A$20cursor|sort:date/linux-sunxi/6dZVBtNgh5Q/dpBDfvEjBgAJ
>
> currently,  lima usespace driver in mesa already has the basic function for 
> desktop, if lima is enabled, cursor rendering will possibly go GPU, this will 
> be less efficient than HW cursor.
>
> do you have plan to enable cursor plane?

That's up to X11 developers. sun4i-drm exposes UI and VI planes on
SoCs with DE2, and there's no dedicated cursor plane in hardware.
Basically sun4i-drm exposes what's available in hardware. But
xf86-video-modesetting doesn't use VI plane for anything while it
could use it for cursor.

> --
> 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/8d091584-8e01-431d-b9b0-93dd7e0f0cec%40googlegroups.com.

-- 
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/CA%2BE%3DqVfSUGfr_CQFrATirZQahVVUqB%2B9%2BK%2Bjr3yYq5i%2BoZcCZA%40mail.gmail.com.


Re: [linux-sunxi] Re: [PATCH 1/1] nvmem: sunxi_sid: fix A64 SID controller support

2019-07-31 Thread Vasily Khoruzhick
On Wed, Jul 31, 2019 at 1:43 AM Chen-Yu Tsai  wrote:
>
> On Wed, Jul 31, 2019 at 3:15 PM Stefan Mavrodiev  wrote:
> >
> > Like in H3, A64 SID controller doesn't return correct data
> > when using direct access. It appears that on A64, SID needs
> > 8 bytes of word_size.
> >
> > Workaround is to enable read by registers.

I came up with identical patch while adding A64 support into
sun8i-thermal driver, so:

> >
> > Signed-off-by: Stefan Mavrodiev 
>
> Acked-by: Chen-Yu Tsai 

Tested-by: Vasily Khoruzhick 

>
> And for single patches, you don't need to write a separate cover letter.
> Just put whatever you need to add after the "---" separator.
>
> > ---
> >  drivers/nvmem/sunxi_sid.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c
> > index a079a80ddf2c..e26ef1bbf198 100644
> > --- a/drivers/nvmem/sunxi_sid.c
> > +++ b/drivers/nvmem/sunxi_sid.c
> > @@ -186,6 +186,7 @@ static const struct sunxi_sid_cfg sun8i_h3_cfg = {
> >  static const struct sunxi_sid_cfg sun50i_a64_cfg = {
> > .value_offset = 0x200,
> > .size = 0x100,
> > +   .need_register_readout = true,
> >  };
> >
> >  static const struct sunxi_sid_cfg sun50i_h6_cfg = {
> > --
> > 2.17.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/CAGb2v64tzMypnB5Ho2A-gWPk2yYsmH9tNn%2BOKfb51c%2Bd6pK%3Dkw%40mail.gmail.com.

-- 
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/CA%2BE%3DqVcY2PE3zg3CRNGD4vLbLTdov6wgioUrbijp-W6km9SCaA%40mail.gmail.com.


Re: [linux-sunxi] [PATCH 0/2] sunxi: A64: enable first USB port on Pine64 boards

2019-05-17 Thread Vasily Khoruzhick
On Wed, May 15, 2019 at 5:46 PM Andre Przywara  wrote:
>
> Since the beginning the upper USB port on Pine64 boards (Pine64+, SoPine
> baseboard, Pine64-LTS, Pinebook) was not working under U-Boot.
> This is due to the PHY for those pins being shared with the OTG
> controller, which we didn't even enable for those boards. Also the PHY
> code was always connecting the port pins to the OTG controller.
>
> These two patches fix this, so the upper USB port on said boards can
> be used within U-Boot. This allows to use an USB keyboard alongside
> an USB flash drive, for instance to install operating systems using
> UEFI.

Can you also add Pinebook here? It has the same issue.

> Cheers,
> Andre.
>
> Andre Przywara (2):
>   sunxi: USB PHY: Support shared PHY 0
>   sunxi: Pine64: DTS: enable USB PHY 0 for HCI0
>
>  arch/arm/dts/sun50i-a64-pine64.dts   | 5 -
>  arch/arm/dts/sun50i-a64-sopine-baseboard.dts | 5 -
>  drivers/phy/allwinner/phy-sun4i-usb.c| 8 +++-
>  3 files changed, 15 insertions(+), 3 deletions(-)
>
> --
> 2.14.5
>
> --
> 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/20190516004609.25304-1-andre.przywara%40arm.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/CA%2BE%3DqVfqAy_UbK%2BcwuuzyC%3DXA8ts%3DXmB9gOZS1ZumO_OBUQ2Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v3 10/11] drm/panel: simple: Add NewEast Optoelectronics CO., LTD WJFH116008A panel support

2019-03-06 Thread Vasily Khoruzhick
On Fri, Feb 22, 2019 at 10:37 AM Rob Herring  wrote:

> There is not any simple panel binding really. This originated I think
> from a 'simple-panel' compatible that was originally attempted. What we
> have is a collection of common properties for panels which panel
> bindings can use. And we have some common panel docs too. I've been
> meaning to clean-up and unify all this.

I'm afraid I'm not right person to clean it up. My understanding of
what different kind of panels and connectors need is pretty limited.
Moreover I'm doing pinebook hacking in my spare time which is few
hours a week and major panel/connector bindings clean up is not
something I want to invest my time in.

Since it seems to be a blocker I'll wait for someone to clean up
panel/connector bindings and then respin the series. Meanwhile it'll
live in my github.

Thanks for review and sharing your ideas.

Regards,
Vasily

-- 
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] Re: [PATCH v3 06/11] drm/sun4i: rgb: Add DT property to disable strict clock rate check

2019-02-20 Thread Vasily Khoruzhick
On Tue, Feb 19, 2019 at 12:56 AM Maxime Ripard
 wrote:
>
> On Mon, Feb 18, 2019 at 11:33:05AM -0800, Vasily Khoruzhick wrote:
> > On Mon, Feb 18, 2019 at 10:26 AM Rob Herring  wrote:
> > >
> > > On Thu, Feb 14, 2019 at 09:09:52PM -0800, Vasily Khoruzhick wrote:
> > > > Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
> > > > Validate the clock rate") prevents some panel and bridges from working 
> > > > with
> > > > sun4i driver.
> > >
> > > Sounds lile a regression that should be reverted. The fix is not a
> > > backwards compatible change either.
> >
> > anx6345 driver isn't mainlined yet and I'm not sure if this change
> > breaks any mainlined boards. So likely there's not enough
> > justification to revert it.
> >
> > > > Unfortunately, dotclock frequency for some modes are not achievable on
> > > > sunxi hardware, and there's a slight deviation in rate returned by
> > > > clk_round_rate(), so they fail this check.
> > > >
> > > > Experiments show that panels and bridges work fine with this slight
> > > > deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
> > > > requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works 
> > > > just
> > > > fine.
> > > >
> > > > This patch adds DT property to disable strict clock rate check
> > > >
> > > > Signed-off-by: Vasily Khoruzhick 
> > > > ---
> > > >  .../devicetree/bindings/display/sunxi/sun4i-drm.txt  | 2 ++
> > > >  drivers/gpu/drm/sun4i/sun4i_rgb.c| 5 +
> > > >  drivers/gpu/drm/sun4i/sun4i_tcon.c   | 3 +++
> > > >  drivers/gpu/drm/sun4i/sun4i_tcon.h   | 1 +
> > > >  4 files changed, 11 insertions(+)
> > > >
> > > > diff --git 
> > > > a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt 
> > > > b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > > > index f426bdb42f18..18c8b053a28d 100644
> > > > --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > > > +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > > > @@ -63,6 +63,8 @@ Required properties:
> > > >  Documentation/devicetree/bindings/media/video-interfaces.txt. The
> > > >  first port should be the input endpoint. The second should be the
> > > >  output, usually to an HDMI connector.
> > > > +  - no-strict-clock-check: don't reject timings if exact dot clock 
> > > > can't be
> > > > +reached.
> > >
> > > This should be the default IMO. Most panels are a single timing, so if
> > > we reject it the fallback no display?
> >
> > As far as I remember the change was introduced to reject some modes
> > for which dotclock can't be reached when driver is used with VGA
> > bridge. So if we make it default it'll break boards with VGA bridge
> > and old DT.
> >
> > > I thought we had some mechanism already to allow some range of
> > > frequencies. I think the chromeos guys needed something IIRC.
> >
> > You can specify frequency range for panels, but there's nothing for
> > bridges. In my case EDID doesn't specify clock tolerance.
>
> I gave it some more though, and came up with the following patch. The
> basic idea is to leave the boundary check for the bridges that will
> have EDID and we need to filter out the modes that have no chance of
> being supported. The tolerancy used is the one defined in VESA specs,
> but I added a module parameter if you wanted to tune that.
>
> And finally, since most of our panels are single timings without any
> tolerancy, we just try our best in this case and that's it, while
> leaving the door open to support display_timings and being able to do
> more once we have an idea of what the tolerancies are.
>
> If that works for you, I'll submit it.
>
> Maxime
>
> --- >8 ---
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
> b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index f4a22689eb54..0460146aab75 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -43,6 +43,25 @@ drm_encoder_to_sun4i_rgb(struct drm_encoder *encoder)
> encoder);
>  }
>
> +static inline struct drm_connector *
> +sun4i_rgb_get_connector_from_encoder(const struct drm_encoder *encoder)
> +{
> +   struct d

[linux-sunxi] Re: [PATCH v3 06/11] drm/sun4i: rgb: Add DT property to disable strict clock rate check

2019-02-20 Thread Vasily Khoruzhick
On Wed, Feb 20, 2019 at 2:33 AM Maxime Ripard  wrote:
>
> On Tue, Feb 19, 2019 at 07:44:56AM -0800, Vasily Khoruzhick wrote:
> > On Tue, Feb 19, 2019 at 12:56 AM Maxime Ripard

> > Maxime, thanks for your patch but  it doesn't work for me. Pinebook
> > needs 1% tolerance. Having it as a module parameter means that no
> > distro will be able to boot on Pinebook out of the box.
>
> I don't really know what to tell you, the VESA spec defines everywhere
> that tolerance, and if we're not able to provide that, then we're not
> compliant and I don't want us to not be compliant just because one
> panel needed to be a bit more flexible, and especially since what
> could work on one panel might fail on another one.
>
> If you want alternate solutions, then please answer to:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/630441.html
>
> or provide the EDID blob.

Uh, I spoke to early, my bad. I made a mistake when I calculated rate
deviation for 768p last time - I took 73MHz as dotclock, but actual
requested rate 72.3 MHz and it gets 72.296296 MHz, so it's within 0.5%
tolerance. 1080p pinebook needs 138.5 MHz and gets 138.461538 MHz -
also within 0.5%.

However your patch has an issue, I'll respond to your previous email.

> Maxime
>
> --
> Maxime Ripard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

-- 
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] Re: [PATCH v3 10/11] drm/panel: simple: Add NewEast Optoelectronics CO., LTD WJFH116008A panel support

2019-02-19 Thread Vasily Khoruzhick
On Tue, Feb 19, 2019 at 6:54 AM Rob Herring  wrote:

> > I believe using eDP connector binding wouldn't help much in my case
> > and it won't improve accuracy of hardware description while adding
> > unnecessary code duplication (edp-connector will be pretty much
> > simple-panel).
> >
> > Since currently there're no standalone connector drivers, implementing
> > one requires significant refactoring of the code that I'm not
> > familiar.
>
> I'm not talking about drivers. I'm talking about bindings. Those are
> not necessarily 1-1. There's no reason the simple panel driver can't
> have an 'edp-connector' entry.

These aren't independent things. Bindings are useless without drivers.

Also how are you going to address mainlined platforms that have eDP
and use panel bindings? E.g. rk3399 supports eDP and uses panel
binding - see rk3399-gru-kevin.dts as example.

> Also, since you have EDID, you should be using that for timing data
> IMO, and the binding needs to have enough information to support that.
> It may if DP-aux comes from the bridge chip or it may not if you need
> to describe that connection. Again, this is independent from what
> Linux chooses to do. If Linux chooses to have its own timing
> information that's its choice. Another OS may choose to use EDID.

I see nothing wrong here - anx6345 driver reads EDID (over AUX) and
uses timing from it, if reading EDID failed it fallback to timings
defined in panel driver.

> Rob

-- 
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] Re: [PATCH v3 06/11] drm/sun4i: rgb: Add DT property to disable strict clock rate check

2019-02-19 Thread Vasily Khoruzhick
On Tue, Feb 19, 2019 at 12:56 AM Maxime Ripard
 wrote:
>
> On Mon, Feb 18, 2019 at 11:33:05AM -0800, Vasily Khoruzhick wrote:
> > On Mon, Feb 18, 2019 at 10:26 AM Rob Herring  wrote:
> > >
> > > On Thu, Feb 14, 2019 at 09:09:52PM -0800, Vasily Khoruzhick wrote:
> > > > Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
> > > > Validate the clock rate") prevents some panel and bridges from working 
> > > > with
> > > > sun4i driver.
> > >
> > > Sounds lile a regression that should be reverted. The fix is not a
> > > backwards compatible change either.
> >
> > anx6345 driver isn't mainlined yet and I'm not sure if this change
> > breaks any mainlined boards. So likely there's not enough
> > justification to revert it.
> >
> > > > Unfortunately, dotclock frequency for some modes are not achievable on
> > > > sunxi hardware, and there's a slight deviation in rate returned by
> > > > clk_round_rate(), so they fail this check.
> > > >
> > > > Experiments show that panels and bridges work fine with this slight
> > > > deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
> > > > requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works 
> > > > just
> > > > fine.
> > > >
> > > > This patch adds DT property to disable strict clock rate check
> > > >
> > > > Signed-off-by: Vasily Khoruzhick 
> > > > ---
> > > >  .../devicetree/bindings/display/sunxi/sun4i-drm.txt  | 2 ++
> > > >  drivers/gpu/drm/sun4i/sun4i_rgb.c| 5 +
> > > >  drivers/gpu/drm/sun4i/sun4i_tcon.c   | 3 +++
> > > >  drivers/gpu/drm/sun4i/sun4i_tcon.h   | 1 +
> > > >  4 files changed, 11 insertions(+)
> > > >
> > > > diff --git 
> > > > a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt 
> > > > b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > > > index f426bdb42f18..18c8b053a28d 100644
> > > > --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > > > +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > > > @@ -63,6 +63,8 @@ Required properties:
> > > >  Documentation/devicetree/bindings/media/video-interfaces.txt. The
> > > >  first port should be the input endpoint. The second should be the
> > > >  output, usually to an HDMI connector.
> > > > +  - no-strict-clock-check: don't reject timings if exact dot clock 
> > > > can't be
> > > > +reached.
> > >
> > > This should be the default IMO. Most panels are a single timing, so if
> > > we reject it the fallback no display?
> >
> > As far as I remember the change was introduced to reject some modes
> > for which dotclock can't be reached when driver is used with VGA
> > bridge. So if we make it default it'll break boards with VGA bridge
> > and old DT.
> >
> > > I thought we had some mechanism already to allow some range of
> > > frequencies. I think the chromeos guys needed something IIRC.
> >
> > You can specify frequency range for panels, but there's nothing for
> > bridges. In my case EDID doesn't specify clock tolerance.
>
> I gave it some more though, and came up with the following patch. The
> basic idea is to leave the boundary check for the bridges that will
> have EDID and we need to filter out the modes that have no chance of
> being supported. The tolerancy used is the one defined in VESA specs,
> but I added a module parameter if you wanted to tune that.
>
> And finally, since most of our panels are single timings without any
> tolerancy, we just try our best in this case and that's it, while
> leaving the door open to support display_timings and being able to do
> more once we have an idea of what the tolerancies are.
>
> If that works for you, I'll submit it.

Maxime, thanks for your patch but  it doesn't work for me. Pinebook
needs 1% tolerance. Having it as a module parameter means that no
distro will be able to boot on Pinebook out of the box.

> Maxime
>
> --- >8 ---
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
> b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index f4a22689eb54..0460146aab75 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -43,6 +43,25 @@ drm_encoder_to_sun4i_rgb(struct drm_encoder *encoder)
>

[linux-sunxi] Re: [PATCH v3 06/11] drm/sun4i: rgb: Add DT property to disable strict clock rate check

2019-02-18 Thread Vasily Khoruzhick
On Mon, Feb 18, 2019 at 10:26 AM Rob Herring  wrote:
>
> On Thu, Feb 14, 2019 at 09:09:52PM -0800, Vasily Khoruzhick wrote:
> > Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
> > Validate the clock rate") prevents some panel and bridges from working with
> > sun4i driver.
>
> Sounds lile a regression that should be reverted. The fix is not a
> backwards compatible change either.

anx6345 driver isn't mainlined yet and I'm not sure if this change
breaks any mainlined boards. So likely there's not enough
justification to revert it.

> > Unfortunately, dotclock frequency for some modes are not achievable on
> > sunxi hardware, and there's a slight deviation in rate returned by
> > clk_round_rate(), so they fail this check.
> >
> > Experiments show that panels and bridges work fine with this slight
> > deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
> > requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works just
> > fine.
> >
> > This patch adds DT property to disable strict clock rate check
> >
> > Signed-off-by: Vasily Khoruzhick 
> > ---
> >  .../devicetree/bindings/display/sunxi/sun4i-drm.txt  | 2 ++
> >  drivers/gpu/drm/sun4i/sun4i_rgb.c| 5 +
> >  drivers/gpu/drm/sun4i/sun4i_tcon.c   | 3 +++
> >  drivers/gpu/drm/sun4i/sun4i_tcon.h   | 1 +
> >  4 files changed, 11 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt 
> > b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > index f426bdb42f18..18c8b053a28d 100644
> > --- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > +++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
> > @@ -63,6 +63,8 @@ Required properties:
> >  Documentation/devicetree/bindings/media/video-interfaces.txt. The
> >  first port should be the input endpoint. The second should be the
> >  output, usually to an HDMI connector.
> > +  - no-strict-clock-check: don't reject timings if exact dot clock can't be
> > +reached.
>
> This should be the default IMO. Most panels are a single timing, so if
> we reject it the fallback no display?

As far as I remember the change was introduced to reject some modes
for which dotclock can't be reached when driver is used with VGA
bridge. So if we make it default it'll break boards with VGA bridge
and old DT.

> I thought we had some mechanism already to allow some range of
> frequencies. I think the chromeos guys needed something IIRC.

You can specify frequency range for panels, but there's nothing for
bridges. In my case EDID doesn't specify clock tolerance.

>
> Rob

-- 
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] Re: [PATCH v3 10/11] drm/panel: simple: Add NewEast Optoelectronics CO., LTD WJFH116008A panel support

2019-02-18 Thread Vasily Khoruzhick
On Mon, Feb 18, 2019 at 10:33 AM Rob Herring  wrote:
>
> On Thu, Feb 14, 2019 at 09:09:56PM -0800, Vasily Khoruzhick wrote:
> > This commit adds support for the NewEast Optoelectronics CO., LTD
> > WJFH116008A 11.6" 1920x1080 TFT LCD panel.
> >
> > Signed-off-by: Vasily Khoruzhick 
> > ---
> >  .../display/panel/neweast,wjfh116008a.txt |  7 
> >  drivers/gpu/drm/panel/panel-simple.c  | 39 +++
> >  2 files changed, 46 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt 
> > b/Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt
> > new file mode 100644
> > index ..d76579f9f55e
> > --- /dev/null
> > +++ 
> > b/Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt
> > @@ -0,0 +1,7 @@
> > +NewEast Optoelectronics CO., LTD WJFH116008A 11.6" 1920x1080 TFT LCD panel
> > +
> > +Required properties:
> > +- compatible: should be "neweast,wjfh116008a"
> > +
> > +This binding is compatible with the simple-panel binding, which is 
> > specified
> > +in simple-panel.txt in this directory.
>
> We already established that this goes thru a standard eDP connector. We
> should describe that and everything associated with it.

I believe using eDP connector binding wouldn't help much in my case
and it won't improve accuracy of hardware description while adding
unnecessary code duplication (edp-connector will be pretty much
simple-panel).

Since currently there're no standalone connector drivers, implementing
one requires significant refactoring of the code that I'm not
familiar.

> Rob

-- 
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] Re: [PATCH v3 08/11] drm/panel: simple: Add BOE HB140WX1-501 panel support

2019-02-16 Thread Vasily Khoruzhick
On Sat, Feb 16, 2019 at 12:43 PM Sam Ravnborg  wrote:
>
> Hi Vasily.

Hi Sam,

> On Thu, Feb 14, 2019 at 09:09:54PM -0800, Vasily Khoruzhick via dri-devel 
> wrote:
> > This commit adds support for the BOE HB140WX1-501 14" WXGA TFT LCD
> > panel.
> >
> > Signed-off-by: Vasily Khoruzhick 
> > ---
> >  .../display/panel/boe,hb140wx1-501.txt|  7 +
> >  drivers/gpu/drm/panel/panel-simple.c  | 26 +++
> >  2 files changed, 33 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt
> >
> > diff --git 
> > a/Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt 
> > b/Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt
> > new file mode 100644
> > index ..fc6f085eb8d1
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt
> > @@ -0,0 +1,7 @@
> > +BOE HB140WX1-501 14" WXGA (1366x768) TFT LCD panel
> > +
> > +Required properties:
> > +- compatible: should be "boe,hb140wx1-501"
> > +
> > +This binding is compatible with the simple-panel binding, which is 
> > specified
> > +in simple-panel.txt in this directory.
>
> boe must be added to vendor-prefixes.txt
> (It is not present in the file I checked, but I may have been added later)

It's been there for quite a while, it's added in 27d23b30a561b which
was included
in 4.5.

> It is usual practice to split the patch in a dt-bindings: patch and a driver 
> patch.
> And for the dt-bindings patch follow the submission rules laid out
> in Documentation/devicetree/bindings/submitting-patches.txt

I checked git log for drivers/gpu/drm/panel/panel-simple.c and looks
like recent commits
for this file added binding and timings in a single commit. I can
split it into separate file
if maintainers insist though.

> > diff --git a/drivers/gpu/drm/panel/panel-simple.c 
> > b/drivers/gpu/drm/panel/panel-simple.c
> > index 9c69e739a524..9a4c9dd02c6c 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -828,6 +828,29 @@ static const struct panel_desc bananapi_s070wv20_ct16 
> > = {
> >   },
> >  };
> >
> > +static const struct drm_display_mode boe_hb140wx1_mode = {
> > + .clock = 72300,
> > + .hdisplay = 1366,
> > + .hsync_start = 1366 + 48,
> > + .hsync_end = 1366 + 48 + 32,
> > + .htotal = 1366 + 48 + 32 + 80,
> > + .vdisplay = 768,
> > + .vsync_start = 768 + 3,
> > + .vsync_end = 768 + 3 + 6,
> > + .vtotal = 768 + 3 + 6 + 13,
> > + .vrefresh = 60,
> > + .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
>
> +1 for specifying .flags.
>
> > +};
> > +
> > +static const struct panel_desc boe_hb140wx1 = {
> > + .modes = _hb140wx1_mode,
> > + .num_modes = 1,
> > + .size = {
> > + .width = 310,
> > + .height = 170,
> > + },
> > +};
> No .bus_format and no .bus_flags specified.
> Are they not used by this panel or are you lucky and the default works?

This is eDP panel, it doesn't need bus_format or bus_flags.

> > +
> >  static const struct drm_display_mode boe_hv070wsa_mode = {
> >   .clock = 42105,
> >   .hdisplay = 1024,
> > @@ -2541,6 +2564,9 @@ static const struct of_device_id platform_of_match[] 
> > = {
> >   }, {
> >   .compatible = "bananapi,s070wv20-ct16",
> >   .data = _s070wv20_ct16,
> > + }, {
> > + .compatible = "boe,hb140wx1-501",
> > + .data = _hb140wx1
> It is common practice to end the line with a "," so one do not need to modify
> this line if an extra line is required.

OK, will do.

>
> With the comments addressed you can add my:
> Reviewed-by: Sam Ravnborg 
>

-- 
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] Re: [PATCH v3 05/11] drm/bridge: Add Analogix anx6345 support

2019-02-15 Thread Vasily Khoruzhick
On Fri, Feb 15, 2019 at 1:13 AM Andrzej Hajda  wrote:

Hi Andrzej,

Thanks for review!

> > +#include 
> Do you need this header?

I'll drop it.

> > +#include 
>
> drmP.h is/should be deprecated.

Same here

> > +struct anx6345_platform_data {
> > + struct regulator *dvdd12;
> > + struct regulator *dvdd25;
> > + struct gpio_desc *gpiod_reset;
> > +};
>
> Why do you need this struct, why just do not embed it's fields directly
> into struct anx6345 ?

OK, I'll embed it into struct anx6345

> > + if (WARN_ON(anx6345->powered))
> > + return;
>
> It should not happen, you can remove this warn.

OK

> > + if (pdata->dvdd12) {
>
> If regulators are required this will be never null.

Right, and regulator subsystem will return dummy regulator if it's
missing in dts.
I'll remove redundant checks.

> > +
> > + if (pdata->dvdd25) {
>
> ditto

OK

> > +
> > + if (anx6345->panel)
> > + drm_panel_prepare(anx6345->panel);
>
> again, here and below: panel is never null, check can be removed.

That's not true, panel is optional. It can be DP connector, not a panel.

> > +
> > + gpiod_set_value_cansleep(pdata->gpiod_reset, 0);
> > + usleep_range(1000, 2000);
> > +
> > + gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
>
>
> Start/stop sequence seems odd regarding reset gpio:
>
> 1. In probe reset is set to low, in poweroff to high - incosistent.
>
> 2. If in case of disabled device reset should be 0, there is no point to
> set it again to 0 three lines above.
>
> 3. I suspect in dts reset gpio should be declared as active_low, and the
> logic in the driver should be reverted, in power off it should be set to
> high, in power on it should be lowered (logically).

OK, I'll look into it.

> > +err_poweroff:
> > + DRM_ERROR("Failed DisplayPort transmitter initialization: %d\n", err);
>
> redundant message

OK, will drop.

> > + DRM_ERROR("Get sink count failed %d\n", err);
>
> The rule of thumb I heard is that if you start message capitalized you
> should end with dot. Since I do not know if it is enforced in kernel I
> leave the decision up to you.

I grepped DRM_ERROR in driver/gpu/drm and they do exactly the same as here.
So I'll just keep it as is for consistency.

> > +static bool anx6345_bridge_mode_fixup(struct drm_bridge *bridge,
> > +   const struct drm_display_mode *mode,
> > +   struct drm_display_mode *adjusted_mode)
> > +{
> > + if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> > + return false;
> > +
> > + /* Max 1200p at 5.4 Ghz, one lane */
> > + if (mode->clock > 154000)
> > + return false;
>
> These checks should be in mode_valid callback.

OK

> > + /* Map slave addresses of ANX6345 */
> > + for (i = 0; i < I2C_NUM_ADDRESSES; i++) {
> > + if (anx6345_i2c_addresses[i] >> 1 != client->addr)
> > + anx6345->i2c_clients[i] = 
> > i2c_new_dummy(client->adapter,
> > + anx6345_i2c_addresses[i] >> 
> > 1);
> > + else
> > + anx6345->i2c_clients[i] = client;
>
>
> I see this contredanse is copy/pasted from anx78*, but it looks quite
> complicated. As I understand there are two i2c addresses, why we cannot
> assume one address is for control interfaces and another  is dummy? It would
> simplify the code here and in other places.

Sorry, I don't get you, could you elaborate? Note that anx6345 uses
both addresses,
i2c_new_dummy() just registers new i2c device bound to a dummy driver and it's
supposed to be used for devices that consume more than one i2c address.

> > + if (!found) {
> > + DRM_ERROR("ANX%x (ver. %d) not supported by this driver\n",
> > +   anx6345->chipid, version);
> > + err = -ENODEV;
> > + goto err_poweroff;
> > + }
>
>
> As I see chip becomes powered forever, is it OK? Usually it should be
> powered only when pipeline starts, and powered-off after pipeline stops.

I'll look into how hard it would be to implement but personally I
think it's OK for now.
We can add more sophisticated power management once this driver is merged.

-- 
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] [PATCH v3 05/11] drm/bridge: Add Analogix anx6345 support

2019-02-15 Thread Vasily Khoruzhick
On Fri, Feb 15, 2019 at 12:23 AM Priit Laes  wrote:

> > + err = anx6345_tx_initialization(anx6345);
> > + if (err) {
> > + DRM_ERROR("Failed transmitter initialization: %d\n", err);
> > + goto err_poweroff;
>
> You can move the whole err_poweroff section from below here and drop the goto.

Thanks, will do.

-- 
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] [PATCH v3 04/11] dt-bindings: Add ANX6345 DP/eDP transmitter binding

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPort/eDP transmitter designed
for portable devices.

Add a binding document for it.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../bindings/display/bridge/anx6345.txt   | 56 +++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/anx6345.txt 
b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
new file mode 100644
index ..e79a11348d11
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
@@ -0,0 +1,56 @@
+Analogix ANX6345 eDP Transmitter
+
+
+The ANX6345 is an ultra-low power Full-HD eDP transmitter designed for
+portable devices.
+
+Required properties:
+
+ - compatible  : "analogix,anx6345"
+ - reg : I2C address of the device
+ - reset-gpios : Which GPIO to use for reset
+
+Optional properties:
+
+ - dvdd12-supply   : Regulator for 1.2V digital core power.
+ - dvdd25-supply   : Regulator for 2.5V digital core power.
+ - Video ports for RGB input and eDP output using the DT bindings
+   defined in [1]
+
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+
+anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_fldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+};
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 05/11] drm/bridge: Add Analogix anx6345 support

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPower/eDP transmitter designed
for portable devices. This driver adds initial support for RGB to eDP
mode, without HPD and interrupts.

This is a configuration usually seen in eDP applications.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/bridge/analogix/Kconfig   |  11 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
 .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.c   |   2 +-
 .../drm/bridge/analogix/analogix-i2c-dptx.h   |   8 +
 .../bridge/analogix/analogix-i2c-txcommon.h   |   3 +
 6 files changed, 869 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index ed2d05c12546..3c6ec535d361 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,3 +1,14 @@
+config DRM_ANALOGIX_ANX6345
+   tristate "Analogix ANX6345 bridge"
+   select DRM_ANALOGIX_DP_I2C
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX6345 is an ultra-low Full-HD DisplayPort/eDP
+ transmitter designed for portable devices. The
+ ANX6345 transforms the LVTTL RGB output of an
+ application processor to eDP or DisplayPort.
+
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
select DRM_ANALOGIX_DP_I2C
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index 2d523b67487d..12fed7b04e1e 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,5 +1,6 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
 analogix_dp_i2c-objs := analogix-i2c-dptx.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
 obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
new file mode 100644
index ..6098e245e074
--- /dev/null
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -0,0 +1,845 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright(c) Icenowy Zheng 
+ * Based on analogix-anx6345.c, which is:
+ *   Copyright(c) 2016, Analogix Semiconductor.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define I2C_NUM_ADDRESSES  2
+#define I2C_IDX_DPTX   0
+#define I2C_IDX_TXCOM  1
+
+#define XTAL_CLK   270 /* 27M */
+
+#define POLL_DELAY 5 /* us */
+#define POLL_TIMEOUT   500 /* us */
+
+static const u8 anx6345_i2c_addresses[] = {
+   [I2C_IDX_DPTX]  = ANALOGIX_I2C_DPTX,
+   [I2C_IDX_TXCOM] = ANALOGIX_I2C_TXCOMMON,
+};
+
+struct anx6345_platform_data {
+   struct regulator *dvdd12;
+   struct regulator *dvdd25;
+   struct gpio_desc *gpiod_reset;
+};
+
+struct anx6345 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct drm_panel *panel;
+   struct anx6345_platform_data pdata;
+   struct mutex lock;
+
+   /*
+* I2C Slave addresses of ANX6345 are mapped as DPTX and SYS
+*/
+   struct i2c_client *i2c_clients[I2C_NUM_ADDRESSES];
+   struct regmap *map[I2C_NUM_ADDRESSES];
+
+   u16 chipid;
+   u8 dpcd[DP_RECEIVER_CAP_SIZE];
+
+   bool powered;
+};
+
+static inline struct anx6345 *connector_to_anx6345(struct drm_connector *c)
+{
+   return container_of(c, struct anx6345, connector);
+}
+
+static inline struct anx6345 *bridge_to_anx6345(struct drm_bridge *bridge)
+{
+   return container_of(bridge, struct anx6345, bridge);
+}
+
+static int anx6345_set_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, mask);
+}
+
+static int anx6345_clear_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, 0);
+}
+
+static ssize_t anx6345_aux_transfer(struct drm_dp_aux *aux,
+   struct drm_dp_aux_msg *msg)
+{
+   struct anx6345 *anx6345 = container_of(aux, struct anx6345, aux);
+
+   return anx_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
+}
+
+static int anx6345_dp_link_training(struct anx6345 *anx6345)
+{
+   unsigned int value;
+   u8 dp_bw;
+   int err;

[linux-sunxi] [PATCH v3 00/11] Analogix ANX6345 RGB-(e)DP bridge support

2019-02-14 Thread Vasily Khoruzhick
This patchset brings support for Analogix ANX6345 RGB-(e)DP bridge, which
is used by some Allwinner A64 laptops, such as Pinebook and Olimex
TERES-I.

It reuses some definitions from ANX78xx driver that already exists in the
kernel tree, but the driver code itself is rewritten due to significant
difference between ANX6345 and ANX78xx.

This patchset also adds support for LCD panels used in Pinebook, dt
property to disable strict dot clock check in sun4i drm driver and adds
nodes necessary for LCD support into Pinebook dts.

v2: - sort Kconfig and Makefile entries alphabetically
- remove panel supply from anx6345
- add support for panels into anx6345 driver
- add compatible and binding for generic eDP panel
- replace patch that adds 5% tolerance for dotclock check in sun4i
  driver for panel and bridges with patch that adds 1% tolerance
  in case if bridge is connected.
v3: - replace 1% tolerance patch with patch that adds dt property to
  disable strict dot clock check
- add support for LCD panels used in Pinebook
- drop generic eDP panel driver
- drop Teres-I changes, I don't have hardware to test them anyway.

Icenowy Zheng (7):
  drm/bridge: move ANA78xx driver to analogix subdirectory
  drm/bridge: split some definitions of ANX78xx to dedicated headers
  drm/bridge: extract some Analogix I2C DP common code
  dt-bindings: Add ANX6345 DP/eDP transmitter binding
  drm/bridge: Add Analogix anx6345 support
  arm64: allwinner: a64: add pinmux for RGB666 LCD
  arm64: allwinner: a64: enable LCD-related hardware for Pinebook

Vasily Khoruzhick (4):
  drm/sun4i: rgb: Add DT property to disable strict clock rate check
  drm/panel: simple: Add BOE HB140WX1-501 panel support
  dt-bindings: Add Guangdong Neweast Optoelectronics CO. LTD vendor
prefix
  drm/panel: simple: Add NewEast Optoelectronics CO., LTD WJFH116008A
panel support

 .../bindings/display/bridge/anx6345.txt   |  56 ++
 .../display/panel/boe,hb140wx1-501.txt|   7 +
 .../display/panel/neweast,wjfh116008a.txt |   7 +
 .../bindings/display/sunxi/sun4i-drm.txt  |   2 +
 .../devicetree/bindings/vendor-prefixes.txt   |   1 +
 .../dts/allwinner/sun50i-a64-pinebook.dts |  76 ++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |   9 +
 drivers/gpu/drm/bridge/Kconfig|  10 -
 drivers/gpu/drm/bridge/Makefile   |   4 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.h | 719 ---
 drivers/gpu/drm/bridge/analogix/Kconfig   |  25 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   4 +
 .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
 .../bridge/{ => analogix}/analogix-anx78xx.c  | 146 +--
 .../drm/bridge/analogix/analogix-anx78xx.h| 265 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 
 .../drm/bridge/analogix/analogix-i2c-dptx.h   | 258 ++
 .../bridge/analogix/analogix-i2c-txcommon.h   | 240 +
 drivers/gpu/drm/panel/panel-simple.c  |  65 ++
 drivers/gpu/drm/sun4i/sun4i_rgb.c |   5 +
 drivers/gpu/drm/sun4i/sun4i_tcon.c|   3 +
 drivers/gpu/drm/sun4i/sun4i_tcon.h|   1 +
 22 files changed, 2041 insertions(+), 876 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt
 delete mode 100644 drivers/gpu/drm/bridge/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (90%)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 11/11] arm64: allwinner: a64: enable LCD-related hardware for Pinebook

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Pinebook has an ANX6345 bridge connected to the RGB666 LCD output and
eDP panel input. The bridge is controlled via I2C that's connected to
R_I2C bus.

There're pinebooks with 3 different panels in the wild, all 3 with
different timings. Add all the compatibles to panel node and hope that
we can get correct timings from EDID. If reading EDID fails it's up to
firmware to fixup compatible string.

Enable all this hardware in device tree.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../dts/allwinner/sun50i-a64-pinebook.dts | 76 +++
 1 file changed, 76 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index d22736a62481..0d9280bafc12 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -63,6 +63,19 @@
};
};
 
+   edp_panel: edp-panel {
+   compatible = "boe,hb140wx1-501", "innolux,n116bge",
+"neweast,wjfh116008a", "simple-panel";
+   backlight = <>;
+   power-supply = <_dc1sw>;
+
+   port {
+   panel_in_edp: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
@@ -102,6 +115,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
phys = < 0>;
phy-names = "usb";
@@ -112,6 +129,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
@@ -163,6 +184,46 @@
status = "okay";
 };
 
+_i2c {
+   pinctrl-names = "default";
+   pinctrl-0 = <_i2c_pins_a>;
+   status = "okay";
+
+   anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_fldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+   };
+};
+
 _rsb {
status = "okay";
 
@@ -334,6 +395,21 @@
"MIC2", "Internal Microphone Right";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgb666_pins>;
+   no-strict-clock-check;
+
+   status = "okay";
+};
+
+_out {
+   tcon0_out_anx6345: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_tcon0>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 02/11] drm/bridge: split some definitions of ANX78xx to dedicated headers

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Some definitions currently in analogix-anx78xx.h are not restricted to
the ANX78xx series, but also applicable to other DisplayPort
transmitters by Analogix.

Split out them to dedicated headers, and make analogix-anx78xx.h include
them.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../drm/bridge/analogix/analogix-anx78xx.h| 464 +-
 .../drm/bridge/analogix/analogix-i2c-dptx.h   | 248 ++
 .../bridge/analogix/analogix-i2c-txcommon.h   | 237 +
 3 files changed, 490 insertions(+), 459 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
index 38753c870137..8aa1eca306d3 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
@@ -15,9 +15,12 @@
 #ifndef __ANX78xx_H
 #define __ANX78xx_H
 
-#define TX_P0  0x70
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define TX_P0  ANALOGIX_I2C_DPTX
 #define TX_P1  0x7a
-#define TX_P2  0x72
+#define TX_P2  ANALOGIX_I2C_TXCOMMON
 
 #define RX_P0  0x7e
 #define RX_P1  0x80
@@ -225,463 +228,6 @@
 #define SP_CLEAR_AVMUTEBIT(4)
 #define SP_SET_AVMUTE  BIT(0)
 
-/***/
-/* Register definition of device address 0x70  */
-/***/
-
-/* HDCP Status Register */
-#define SP_TX_HDCP_STATUS_REG  0x00
-#define SP_AUTH_FAIL   BIT(5)
-#define SP_AUTHEN_PASS BIT(1)
-
-/* HDCP Control Register 0 */
-#define SP_HDCP_CTRL0_REG  0x01
-#define SP_RX_REPEATER BIT(6)
-#define SP_RE_AUTH BIT(5)
-#define SP_SW_AUTH_OK  BIT(4)
-#define SP_HARD_AUTH_ENBIT(3)
-#define SP_HDCP_ENC_EN BIT(2)
-#define SP_BKSV_SRM_PASS   BIT(1)
-#define SP_KSVLIST_VLD BIT(0)
-/* HDCP Function Enabled */
-#define SP_HDCP_FUNCTION_ENABLED   (BIT(0) | BIT(1) | BIT(2) | BIT(3))
-
-/* HDCP Receiver BSTATUS Register 0 */
-#defineSP_HDCP_RX_BSTATUS0_REG 0x1b
-/* HDCP Receiver BSTATUS Register 1 */
-#defineSP_HDCP_RX_BSTATUS1_REG 0x1c
-
-/* HDCP Embedded "Blue Screen" Content Registers */
-#define SP_HDCP_VID0_BLUE_SCREEN_REG   0x2c
-#define SP_HDCP_VID1_BLUE_SCREEN_REG   0x2d
-#define SP_HDCP_VID2_BLUE_SCREEN_REG   0x2e
-
-/* HDCP Wait R0 Timing Register */
-#define SP_HDCP_WAIT_R0_TIME_REG   0x40
-
-/* HDCP Link Integrity Check Timer Register */
-#define SP_HDCP_LINK_CHECK_TIMER_REG   0x41
-
-/* HDCP Repeater Ready Wait Timer Register */
-#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42
-
-/* HDCP Auto Timer Register */
-#define SP_HDCP_AUTO_TIMER_REG 0x51
-
-/* HDCP Key Status Register */
-#define SP_HDCP_KEY_STATUS_REG 0x5e
-
-/* HDCP Key Command Register */
-#define SP_HDCP_KEY_COMMAND_REG0x5f
-#define SP_DISABLE_SYNC_HDCP   BIT(2)
-
-/* OTP Memory Key Protection Registers */
-#define SP_OTP_KEY_PROTECT1_REG0x60
-#define SP_OTP_KEY_PROTECT2_REG0x61
-#define SP_OTP_KEY_PROTECT3_REG0x62
-#define SP_OTP_PSW10xa2
-#define SP_OTP_PSW20x7e
-#define SP_OTP_PSW30xc6
-
-/* DP System Control Registers */
-#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1)
-/* Bits for DP System Control Register 2 */
-#define SP_CHA_STA BIT(2)
-/* Bits for DP System Control Register 3 */
-#define SP_HPD_STATUS  BIT(6)
-#define SP_STRM_VALID  BIT(2)
-/* Bits for DP System Control Register 4 */
-#define SP_ENHANCED_MODE   BIT(3)
-
-/* DP Video Control Register */
-#define SP_DP_VIDEO_CTRL_REG   0x84
-#define SP_COLOR_F_MASK0x06
-#define SP_COLOR_F_SHIFT   1
-#define SP_BPC_MASK0xe0
-#define SP_BPC_SHIFT   5
-#  define SP_BPC_6BITS 0x00
-#  define SP_BPC_8BITS 0x01
-#  define SP_BPC_10BITS0x02
-#  define SP_BPC_12BITS0x03
-
-/* DP Audio Control Register */
-#define SP_DP_AUDIO_CTRL_REG   0x87
-#define SP_AUD_EN  BIT(0)
-
-/* 10us Pulse Generate Timer Registers */
-#define SP_I2C_GEN_10US_TIMER0_REG 0x88
-#define SP_I2C_GEN_10US_TIMER1_REG 0x89
-
-/* Packet Send Control Register */
-#

[linux-sunxi] [PATCH v3 03/11] drm/bridge: extract some Analogix I2C DP common code

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Some code can be shared within different DP bridges by Analogix.

Extract them to a new module.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/bridge/analogix/Kconfig   |   4 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   2 +
 .../drm/bridge/analogix/analogix-anx78xx.c| 146 +--
 .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.h   |   2 +
 5 files changed, 178 insertions(+), 145 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index c4d343a2f04d..ed2d05c12546 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,5 +1,6 @@
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
+   select DRM_ANALOGIX_DP_I2C
select DRM_KMS_HELPER
select REGMAP_I2C
help
@@ -11,3 +12,6 @@ config DRM_ANALOGIX_ANX78XX
 config DRM_ANALOGIX_DP
tristate
depends on DRM
+
+config DRM_ANALOGIX_DP_I2C
+   tristate
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index ce1687e60975..2d523b67487d 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,3 +1,5 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+analogix_dp_i2c-objs := analogix-i2c-dptx.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
+obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index f8433c93f463..bf8291d0ddd0 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -45,8 +45,6 @@
 #define I2C_IDX_RX_P1  4
 
 #define XTAL_CLK   270 /* 27M */
-#define AUX_CH_BUFFER_SIZE 16
-#define AUX_WAIT_TIMEOUT_MS15
 
 static const u8 anx78xx_i2c_addresses[] = {
[I2C_IDX_TX_P0] = TX_P0,
@@ -109,153 +107,11 @@ static int anx78xx_clear_bits(struct regmap *map, u8 
reg, u8 mask)
return regmap_update_bits(map, reg, mask, 0);
 }
 
-static bool anx78xx_aux_op_finished(struct anx78xx *anx78xx)
-{
-   unsigned int value;
-   int err;
-
-   err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_DP_AUX_CH_CTRL2_REG,
- );
-   if (err < 0)
-   return false;
-
-   return (value & SP_AUX_EN) == 0;
-}
-
-static int anx78xx_aux_wait(struct anx78xx *anx78xx)
-{
-   unsigned long timeout;
-   unsigned int status;
-   int err;
-
-   timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
-
-   while (!anx78xx_aux_op_finished(anx78xx)) {
-   if (time_after(jiffies, timeout)) {
-   if (!anx78xx_aux_op_finished(anx78xx)) {
-   DRM_ERROR("Timed out waiting AUX to finish\n");
-   return -ETIMEDOUT;
-   }
-
-   break;
-   }
-
-   usleep_range(1000, 2000);
-   }
-
-   /* Read the AUX channel access status */
-   err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_CH_STATUS_REG,
- );
-   if (err < 0) {
-   DRM_ERROR("Failed to read from AUX channel: %d\n", err);
-   return err;
-   }
-
-   if (status & SP_AUX_STATUS) {
-   DRM_ERROR("Failed to wait for AUX channel (status: %02x)\n",
- status);
-   return -ETIMEDOUT;
-   }
-
-   return 0;
-}
-
-static int anx78xx_aux_address(struct anx78xx *anx78xx, unsigned int addr)
-{
-   int err;
-
-   err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_7_0_REG,
-  addr & 0xff);
-   if (err)
-   return err;
-
-   err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_15_8_REG,
-  (addr & 0xff00) >> 8);
-   if (err)
-   return err;
-
-   /*
-* DP AUX CH Address Register #2, only update bits[3:0]
-* [7:4] RESERVED
-* [3:0] AUX_ADDR[19:16], Register control AUX CH address.
-*/
-   err = regmap_update_bits(anx78xx->map[I2C_IDX_TX_P0],
-SP_AUX_ADDR_19_16_REG,
-SP_AUX_ADDR_19_16_MASK,
-(addr & 0xf) >> 16);
-
-   if (err)
-   return err;
-
-   return 0;
-}
-
 static ssize_t anx78xx_aux_transfer(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg)

[linux-sunxi] [PATCH v3 10/11] drm/panel: simple: Add NewEast Optoelectronics CO., LTD WJFH116008A panel support

2019-02-14 Thread Vasily Khoruzhick
This commit adds support for the NewEast Optoelectronics CO., LTD
WJFH116008A 11.6" 1920x1080 TFT LCD panel.

Signed-off-by: Vasily Khoruzhick 
---
 .../display/panel/neweast,wjfh116008a.txt |  7 
 drivers/gpu/drm/panel/panel-simple.c  | 39 +++
 2 files changed, 46 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt 
b/Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt
new file mode 100644
index ..d76579f9f55e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/neweast,wjfh116008a.txt
@@ -0,0 +1,7 @@
+NewEast Optoelectronics CO., LTD WJFH116008A 11.6" 1920x1080 TFT LCD panel
+
+Required properties:
+- compatible: should be "neweast,wjfh116008a"
+
+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 9a4c9dd02c6c..3edc77e49d8f 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -1843,6 +1843,42 @@ static const struct panel_desc netron_dy_e231732 = {
.bus_format = MEDIA_BUS_FMT_RGB666_1X18,
 };
 
+static const struct drm_display_mode neweast_wjfh116008a_modes[] = {
+{
+   .clock = 138500,
+   .hdisplay = 1920,
+   .hsync_start = 1920 + 48,
+   .hsync_end = 1920 + 48 + 32,
+   .htotal = 1920 + 48 + 32 + 80,
+   .vdisplay = 1080,
+   .vsync_start = 1080 + 3,
+   .vsync_end = 1080 + 3 + 5,
+   .vtotal = 1080 + 3 + 5 + 23,
+   .vrefresh = 60,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+}, {
+   .clock = 110920,
+   .hdisplay = 1920,
+   .hsync_start = 1920 + 48,
+   .hsync_end = 1920 + 48 + 32,
+   .htotal = 1920 + 48 + 32 + 80,
+   .vdisplay = 1080,
+   .vsync_start = 1080 + 3,
+   .vsync_end = 1080 + 3 + 5,
+   .vtotal = 1080 + 3 + 5 + 23,
+   .vrefresh = 48,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+} };
+
+static const struct panel_desc neweast_wjfh116008a = {
+   .modes = neweast_wjfh116008a_modes,
+   .num_modes = 2,
+   .size = {
+   .width = 260,
+   .height = 150,
+   },
+};
+
 static const struct drm_display_mode newhaven_nhd_43_480272ef_atxl_mode = {
.clock = 9000,
.hdisplay = 480,
@@ -2690,6 +2726,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "netron-dy,e231732",
.data = _dy_e231732,
+   }, {
+   .compatible = "neweast,wjfh116008a",
+   .data = _wjfh116008a,
}, {
.compatible = "newhaven,nhd-4.3-480272ef-atxl",
.data = _nhd_43_480272ef_atxl,
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 08/11] drm/panel: simple: Add BOE HB140WX1-501 panel support

2019-02-14 Thread Vasily Khoruzhick
This commit adds support for the BOE HB140WX1-501 14" WXGA TFT LCD
panel.

Signed-off-by: Vasily Khoruzhick 
---
 .../display/panel/boe,hb140wx1-501.txt|  7 +
 drivers/gpu/drm/panel/panel-simple.c  | 26 +++
 2 files changed, 33 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt 
b/Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt
new file mode 100644
index ..fc6f085eb8d1
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/boe,hb140wx1-501.txt
@@ -0,0 +1,7 @@
+BOE HB140WX1-501 14" WXGA (1366x768) TFT LCD panel
+
+Required properties:
+- compatible: should be "boe,hb140wx1-501"
+
+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 9c69e739a524..9a4c9dd02c6c 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -828,6 +828,29 @@ static const struct panel_desc bananapi_s070wv20_ct16 = {
},
 };
 
+static const struct drm_display_mode boe_hb140wx1_mode = {
+   .clock = 72300,
+   .hdisplay = 1366,
+   .hsync_start = 1366 + 48,
+   .hsync_end = 1366 + 48 + 32,
+   .htotal = 1366 + 48 + 32 + 80,
+   .vdisplay = 768,
+   .vsync_start = 768 + 3,
+   .vsync_end = 768 + 3 + 6,
+   .vtotal = 768 + 3 + 6 + 13,
+   .vrefresh = 60,
+   .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
+};
+
+static const struct panel_desc boe_hb140wx1 = {
+   .modes = _hb140wx1_mode,
+   .num_modes = 1,
+   .size = {
+   .width = 310,
+   .height = 170,
+   },
+};
+
 static const struct drm_display_mode boe_hv070wsa_mode = {
.clock = 42105,
.hdisplay = 1024,
@@ -2541,6 +2564,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "bananapi,s070wv20-ct16",
.data = _s070wv20_ct16,
+   }, {
+   .compatible = "boe,hb140wx1-501",
+   .data = _hb140wx1
}, {
.compatible = "boe,hv070wsa-100",
.data = _hv070wsa
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 09/11] dt-bindings: Add Guangdong Neweast Optoelectronics CO. LTD vendor prefix

2019-02-14 Thread Vasily Khoruzhick
Add vendor prefix for Guangdong Neweast Optoelectronics CO. LTD

Signed-off-by: Vasily Khoruzhick 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 389508584f48..15cfc265b644 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -267,6 +267,7 @@ netron-dy   Netron DY
 netxeonShenzhen Netxeon Technology CO., LTD
 nexbox Nexbox
 nextthing  Next Thing Co.
+neweastGuangdong Neweast Optoelectronics CO., LTD
 newhaven   Newhaven Display International
 ni National Instruments
 nintendo   Nintendo
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 01/11] drm/bridge: move ANA78xx driver to analogix subdirectory

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

As ANA78xx chips are designed and produced by Analogix Semiconductor,
Inc, move their driver codes into analogix subdirectory.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/Kconfig | 10 --
 drivers/gpu/drm/bridge/Makefile|  4 ++--
 drivers/gpu/drm/bridge/analogix/Kconfig| 10 ++
 drivers/gpu/drm/bridge/analogix/Makefile   |  1 +
 .../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c   |  0
 .../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h   |  0
 6 files changed, 13 insertions(+), 12 deletions(-)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (100%)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h (100%)

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 2fee47b0d50b..4922c1ceffef 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -15,16 +15,6 @@ config DRM_PANEL_BRIDGE
 menu "Display Interface Bridges"
depends on DRM && DRM_BRIDGE
 
-config DRM_ANALOGIX_ANX78XX
-   tristate "Analogix ANX78XX bridge"
-   select DRM_KMS_HELPER
-   select REGMAP_I2C
-   ---help---
- ANX78XX is an ultra-low Full-HD SlimPort transmitter
- designed for portable devices. The ANX78XX transforms
- the HDMI output of an application processor to MyDP
- or DisplayPort.
-
 config DRM_CDNS_DSI
tristate "Cadence DPI/DSI bridge"
select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf5a6f8..a6c7dd7727ea 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
@@ -12,8 +11,9 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o
 obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
-obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
+
+obj-y += analogix/
 obj-y += synopsys/
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index 80f286fa3a69..c4d343a2f04d 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,3 +1,13 @@
+config DRM_ANALOGIX_ANX78XX
+   tristate "Analogix ANX78XX bridge"
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX78XX is an ultra-low Full-HD SlimPort transmitter
+ designed for portable devices. The ANX78XX transforms
+ the HDMI output of an application processor to MyDP
+ or DisplayPort.
+
 config DRM_ANALOGIX_DP
tristate
depends on DRM
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index cd4010ba6890..ce1687e60975 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,2 +1,3 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.c
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.h
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 07/11] arm64: allwinner: a64: add pinmux for RGB666 LCD

2019-02-14 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Allwinner A64's TCON0 can output RGB666 LCD signal.

Add its pinmux.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 2abb335145a6..a8bbee84e7da 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -559,6 +559,15 @@
function = "i2c1";
};
 
+   lcd_rgb666_pins: lcd-rgb666 {
+   pins = "PD0", "PD1", "PD2", "PD3", "PD4",
+  "PD5", "PD6", "PD7", "PD8", "PD9",
+  "PD10", "PD11", "PD12", "PD13",
+  "PD14", "PD15", "PD16", "PD17",
+  "PD18", "PD19", "PD20", "PD21";
+   function = "lcd0";
+   };
+
mmc0_pins: mmc0-pins {
pins = "PF0", "PF1", "PF2", "PF3",
   "PF4", "PF5";
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v3 06/11] drm/sun4i: rgb: Add DT property to disable strict clock rate check

2019-02-14 Thread Vasily Khoruzhick
Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
Validate the clock rate") prevents some panel and bridges from working with
sun4i driver.

Unfortunately, dotclock frequency for some modes are not achievable on
sunxi hardware, and there's a slight deviation in rate returned by
clk_round_rate(), so they fail this check.

Experiments show that panels and bridges work fine with this slight
deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works just
fine.

This patch adds DT property to disable strict clock rate check

Signed-off-by: Vasily Khoruzhick 
---
 .../devicetree/bindings/display/sunxi/sun4i-drm.txt  | 2 ++
 drivers/gpu/drm/sun4i/sun4i_rgb.c| 5 +
 drivers/gpu/drm/sun4i/sun4i_tcon.c   | 3 +++
 drivers/gpu/drm/sun4i/sun4i_tcon.h   | 1 +
 4 files changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt 
b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
index f426bdb42f18..18c8b053a28d 100644
--- a/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+++ b/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
@@ -63,6 +63,8 @@ Required properties:
 Documentation/devicetree/bindings/media/video-interfaces.txt. The
 first port should be the input endpoint. The second should be the
 output, usually to an HDMI connector.
+  - no-strict-clock-check: don't reject timings if exact dot clock can't be
+reached.
 
 DWC HDMI TX Encoder
 ---
diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index f4a22689eb54..b392d4b1ebd3 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -94,7 +94,12 @@ static enum drm_mode_status sun4i_rgb_mode_valid(struct 
drm_encoder *crtc,
 
tcon->dclk_min_div = 6;
tcon->dclk_max_div = 127;
+
+   if (tcon->no_strict_clock_check)
+   return MODE_OK;
+
rounded_rate = clk_round_rate(tcon->dclk, rate);
+
if (rounded_rate < rate)
return MODE_CLOCK_LOW;
 
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index cf45d0f940f9..f5f7f479332b 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -1108,6 +1108,9 @@ static int sun4i_tcon_bind(struct device *dev, struct 
device *master,
tcon->id = engine->id;
tcon->quirks = of_device_get_match_data(dev);
 
+   tcon->no_strict_clock_check = of_property_read_bool(dev->of_node,
+   "no-strict-clock-check");
+
tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
if (IS_ERR(tcon->lcd_rst)) {
dev_err(dev, "Couldn't get our reset line\n");
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h 
b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index b5214d71610f..ab510b80004a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -258,6 +258,7 @@ struct sun4i_tcon {
struct reset_control*lvds_rst;
 
struct drm_panel*panel;
+   boolno_strict_clock_check;
 
/* Platform adjustments */
const struct sun4i_tcon_quirks  *quirks;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-14 Thread Vasily Khoruzhick
On Thu, Feb 14, 2019 at 12:38 PM Rob Herring  wrote:
>
> On Thu, Feb 14, 2019 at 2:04 PM Vasily Khoruzhick  wrote:
> >
> > On Tue, Feb 5, 2019 at 2:24 AM Thierry Reding  
> > wrote:
> > >
> > > On Tue, Feb 05, 2019 at 09:57:37AM +0100, Daniel Vetter wrote:
> > > > On Mon, Feb 04, 2019 at 05:22:58PM +0100, Thierry Reding wrote:
> > > > > On Mon, Feb 04, 2019 at 04:59:09PM +0100, Daniel Vetter wrote:
> > > > > > On Mon, Feb 04, 2019 at 12:22:18PM +0100, Thierry Reding wrote:
> > > > > > > On Mon, Feb 04, 2019 at 10:40:12AM +0100, Daniel Vetter wrote:
> > > > > > > > On Mon, Feb 04, 2019 at 09:23:59AM +0100, Thierry Reding wrote:
> > > > > > > > > On Mon, Feb 04, 2019 at 12:13:55AM -0800, Vasily Khoruzhick 
> > > > > > > > > wrote:
> > > > > > > > > > On Sun, Feb 3, 2019 at 11:43 PM Thierry Reding 
> > > > > > > > > >  wrote:
> > > > > > > > > > >
> > > > > > > > > > > On Sun, Feb 03, 2019 at 10:54:57AM -0800, Vasily 
> > > > > > > > > > > Khoruzhick wrote:
> > > > > > > > > > > > eDP panels usually have EDID EEPROM, so there's no need 
> > > > > > > > > > > > to define panel
> > > > > > > > > > > > width/height or any modes/timings in dts. But this 
> > > > > > > > > > > > panel still may have
> > > > > > > > > > > > regulator and/or backlight.
> > > > > > > > > > > >
> > > > > > > > > > > > Signed-off-by: Vasily Khoruzhick 
> > > > > > > > > > > > ---
> > > > > > > > > > > >  .../devicetree/bindings/display/panel/panel-edp.txt
> > > > > > > > > > > > | 7 +++
> > > > > > > > > > > >  1 file changed, 7 insertions(+)
> > > > > > > > > > > >  create mode 100644 
> > > > > > > > > > > > Documentation/devicetree/bindings/display/panel/panel-edp.txt
> > > > > > > > > > >
> > > > > > > > > > > Please don't try to make panels look more generic than 
> > > > > > > > > > > they really are.
> > > > > > > > > > > You're going to have to provide a compatible string for 
> > > > > > > > > > > your device that
> > > > > > > > > > > is more specific than "panel-edp". You claim that you 
> > > > > > > > > > > don't need any
> > > > > > > > > > > extra information that is panel specific, but you don't 
> > > > > > > > > > > know that now.
> > > > > > > > > > > We have in the past thought that we didn't need things 
> > > > > > > > > > > like prepare
> > > > > > > > > > > delay, but then we ran into situations where we did need 
> > > > > > > > > > > them.
> > > > > > > > > > >
> > > > > > > > > > > Just do what everybody else does. Provide a specific 
> > > > > > > > > > > compatible string
> > > > > > > > > > > and match on that in the panel-simple driver. Even if you 
> > > > > > > > > > > can read all
> > > > > > > > > > > the video timings from an EDID EEPROM, you can still 
> > > > > > > > > > > provide a mode in
> > > > > > > > > > > the panel descriptor to serve as a fallback if for 
> > > > > > > > > > > example the EEPROM
> > > > > > > > > > > is faulty on some device.
> > > > > > > > > >
> > > > > > > > > > Pinebook used several 768p panels that have slightly 
> > > > > > > > > > different timings
> > > > > > > > > > and recent batch uses 1080p panel.
> > > > > > > > > >
> > > > > > > > > > What panel descriptor should I use as fallback?
> > > > > > &

[linux-sunxi] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-14 Thread Vasily Khoruzhick
On Tue, Feb 5, 2019 at 2:24 AM Thierry Reding  wrote:
>
> On Tue, Feb 05, 2019 at 09:57:37AM +0100, Daniel Vetter wrote:
> > On Mon, Feb 04, 2019 at 05:22:58PM +0100, Thierry Reding wrote:
> > > On Mon, Feb 04, 2019 at 04:59:09PM +0100, Daniel Vetter wrote:
> > > > On Mon, Feb 04, 2019 at 12:22:18PM +0100, Thierry Reding wrote:
> > > > > On Mon, Feb 04, 2019 at 10:40:12AM +0100, Daniel Vetter wrote:
> > > > > > On Mon, Feb 04, 2019 at 09:23:59AM +0100, Thierry Reding wrote:
> > > > > > > On Mon, Feb 04, 2019 at 12:13:55AM -0800, Vasily Khoruzhick wrote:
> > > > > > > > On Sun, Feb 3, 2019 at 11:43 PM Thierry Reding 
> > > > > > > >  wrote:
> > > > > > > > >
> > > > > > > > > On Sun, Feb 03, 2019 at 10:54:57AM -0800, Vasily Khoruzhick 
> > > > > > > > > wrote:
> > > > > > > > > > eDP panels usually have EDID EEPROM, so there's no need to 
> > > > > > > > > > define panel
> > > > > > > > > > width/height or any modes/timings in dts. But this panel 
> > > > > > > > > > still may have
> > > > > > > > > > regulator and/or backlight.
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Vasily Khoruzhick 
> > > > > > > > > > ---
> > > > > > > > > >  .../devicetree/bindings/display/panel/panel-edp.txt
> > > > > > > > > > | 7 +++
> > > > > > > > > >  1 file changed, 7 insertions(+)
> > > > > > > > > >  create mode 100644 
> > > > > > > > > > Documentation/devicetree/bindings/display/panel/panel-edp.txt
> > > > > > > > >
> > > > > > > > > Please don't try to make panels look more generic than they 
> > > > > > > > > really are.
> > > > > > > > > You're going to have to provide a compatible string for your 
> > > > > > > > > device that
> > > > > > > > > is more specific than "panel-edp". You claim that you don't 
> > > > > > > > > need any
> > > > > > > > > extra information that is panel specific, but you don't know 
> > > > > > > > > that now.
> > > > > > > > > We have in the past thought that we didn't need things like 
> > > > > > > > > prepare
> > > > > > > > > delay, but then we ran into situations where we did need them.
> > > > > > > > >
> > > > > > > > > Just do what everybody else does. Provide a specific 
> > > > > > > > > compatible string
> > > > > > > > > and match on that in the panel-simple driver. Even if you can 
> > > > > > > > > read all
> > > > > > > > > the video timings from an EDID EEPROM, you can still provide 
> > > > > > > > > a mode in
> > > > > > > > > the panel descriptor to serve as a fallback if for example 
> > > > > > > > > the EEPROM
> > > > > > > > > is faulty on some device.
> > > > > > > >
> > > > > > > > Pinebook used several 768p panels that have slightly different 
> > > > > > > > timings
> > > > > > > > and recent batch uses 1080p panel.
> > > > > > > >
> > > > > > > > What panel descriptor should I use as fallback?
> > > > > > >
> > > > > > > You don't use panel descriptors as fallback. The simple-panel 
> > > > > > > driver
> > > > > > > will bind to a panel device and use the corresponding descriptor. 
> > > > > > > If
> > > > > > > your device tree contains the correct information, the descriptor 
> > > > > > > is
> > > > > > > correct for the panel you have.
> > > > > > >
> > > > > > > In other words you need to ensure that you have the correct panel 
> > > > > > > in
> > > > > > > device tree for the board that you're using. This is exactly the 
> > > > > >

[linux-sunxi] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-14 Thread Vasily Khoruzhick
On Tue, Feb 5, 2019 at 8:36 AM Daniel Vetter  wrote:
>
> On Tue, Feb 05, 2019 at 11:24:19AM +0100, Thierry Reding wrote:
> > On Tue, Feb 05, 2019 at 09:57:37AM +0100, Daniel Vetter wrote:
> > > On Mon, Feb 04, 2019 at 05:22:58PM +0100, Thierry Reding wrote:
> > > > On Mon, Feb 04, 2019 at 04:59:09PM +0100, Daniel Vetter wrote:
> > > > > On Mon, Feb 04, 2019 at 12:22:18PM +0100, Thierry Reding wrote:
> > > > > > On Mon, Feb 04, 2019 at 10:40:12AM +0100, Daniel Vetter wrote:
> > > > > > > On Mon, Feb 04, 2019 at 09:23:59AM +0100, Thierry Reding wrote:
> > > > > > > > On Mon, Feb 04, 2019 at 12:13:55AM -0800, Vasily Khoruzhick 
> > > > > > > > wrote:
> > > > > > > > > On Sun, Feb 3, 2019 at 11:43 PM Thierry Reding 
> > > > > > > > >  wrote:
> > > > > > > > > >
> > > > > > > > > > On Sun, Feb 03, 2019 at 10:54:57AM -0800, Vasily Khoruzhick 
> > > > > > > > > > wrote:
> > > > > > > > > > > eDP panels usually have EDID EEPROM, so there's no need 
> > > > > > > > > > > to define panel
> > > > > > > > > > > width/height or any modes/timings in dts. But this panel 
> > > > > > > > > > > still may have
> > > > > > > > > > > regulator and/or backlight.
> > > > > > > > > > >
> > > > > > > > > > > Signed-off-by: Vasily Khoruzhick 
> > > > > > > > > > > ---
> > > > > > > > > > >  .../devicetree/bindings/display/panel/panel-edp.txt  
> > > > > > > > > > >   | 7 +++
> > > > > > > > > > >  1 file changed, 7 insertions(+)
> > > > > > > > > > >  create mode 100644 
> > > > > > > > > > > Documentation/devicetree/bindings/display/panel/panel-edp.txt
> > > > > > > > > >
> > > > > > > > > > Please don't try to make panels look more generic than they 
> > > > > > > > > > really are.
> > > > > > > > > > You're going to have to provide a compatible string for 
> > > > > > > > > > your device that
> > > > > > > > > > is more specific than "panel-edp". You claim that you don't 
> > > > > > > > > > need any
> > > > > > > > > > extra information that is panel specific, but you don't 
> > > > > > > > > > know that now.
> > > > > > > > > > We have in the past thought that we didn't need things like 
> > > > > > > > > > prepare
> > > > > > > > > > delay, but then we ran into situations where we did need 
> > > > > > > > > > them.
> > > > > > > > > >
> > > > > > > > > > Just do what everybody else does. Provide a specific 
> > > > > > > > > > compatible string
> > > > > > > > > > and match on that in the panel-simple driver. Even if you 
> > > > > > > > > > can read all
> > > > > > > > > > the video timings from an EDID EEPROM, you can still 
> > > > > > > > > > provide a mode in
> > > > > > > > > > the panel descriptor to serve as a fallback if for example 
> > > > > > > > > > the EEPROM
> > > > > > > > > > is faulty on some device.
> > > > > > > > >
> > > > > > > > > Pinebook used several 768p panels that have slightly 
> > > > > > > > > different timings
> > > > > > > > > and recent batch uses 1080p panel.
> > > > > > > > >
> > > > > > > > > What panel descriptor should I use as fallback?
> > > > > > > >
> > > > > > > > You don't use panel descriptors as fallback. The simple-panel 
> > > > > > > > driver
> > > > > > > > will bind to a panel device and use the corresponding 
> > > > > > > > descriptor. If
> > > > > > > > your device tree cont

Re: [linux-sunxi] Re: [PATCH RESEND v2 06/12] drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge is connected

2019-02-05 Thread Vasily Khoruzhick
On Tue, Feb 5, 2019 at 7:42 AM Maxime Ripard  wrote:
>
> On Mon, Feb 04, 2019 at 10:50:17AM -0800, Vasily Khoruzhick wrote:
> > On Mon, Feb 4, 2019 at 8:29 AM Icenowy Zheng  wrote:
> > > >> IIRC, from the previous discussion, HDMI had a tolerancy requirement
> > > >> in the standard. Do you know if there's such a thing for eDP? That
> > > >> would solve the issue for all the eDP displays at once.
> > > >
> > > >I don't have access to eDP standard - vesa.org says it's available to
> > > >members only.
> > >
> > > Try out to grab an old version?
> > >
> > > I remember 1.0 is open.
> >
> > I can't find anything regarding dot clock tolerance in DisplayPort
> > specification.
>
> I guess since the DP is a VESA spec, it's probably .5%, just like on
> the EDID (well, CVT).

Unfortunately that's not enough for Pinebook. It needs 1% for 768p panel.

>
> Maxime
>
> --
> Maxime Ripard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

-- 
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] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 12:23 PM Rob Herring  wrote:

> > simple-panel would probably work if you stuck in some mostly compatible
> > string and provided a ddc-i2c-bus property in the device tree node. The
> > generic-ish fallback case could be implemented by providing a fallback
> > compatible string (we used to have "simple-panel", which I think would
> > still be adequate for this I suppose) and adding a dummy descriptor in
> > the driver, perhaps one with pre-defined delays that could be adjusted
> > to work for all cases, or they could just be 0. At least that way we'd
> > be explicitly documenting that we support this as a fallback.
>
> I'd like something more specific than 'simple-panel' that at least
> implies it has EDID and whatever else we think it should imply.
>
> Looking into this a bit more, why don't we just do a connector here?
> eDP has a standard connector (with power). It's just like other
> connectors, but with power and no hotplug. If someone does their own
> interface, then they should do their own connector or panel binding.

Where do we put backlight in this case?

> > I'm not sure how you'd want to enforce that people provide the right
> > compatible strings that way. Currently there's no way to make your panel
> > work without adding a panel driver, so people are forced to write the
> > DT bindings and a driver, or add support to an existing one. If we open
> > this backdoor, I suspect many people will just take the easy route and
> > rely on the fallback. And then what do we do when we get bug reports
> > about panels not working, or requiring some quirks. How do we go and
> > find out what the right compatible strings are for each board, or how to
> > fix things for something we don't have access to.
>
> We'll simply reject anything that should be implied by compatible. And
> now we can enforce with schema that DTs aren't populated with
> fallbacks alone. Of course, we can't make anyone pass all schema
> checks before shipping a dtb.
>
> Rob

-- 
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] Re: [PATCH 0/9] Analogix ANX6345 RGB-(e)DP bridge support

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 4:22 AM Torsten Duwe  wrote:
>
> On Thu, Oct 18, 2018 at 03:33:18PM +0800, Icenowy Zheng wrote:
> > This patchset brings the support for Analogix ANX6345 RGB-(e)DP bridge,
> > which is used by some Allwinner A64 laptops, such as Pinebook and Olimex
> > TERES-I.
> >
>
> So what's the status here? I'm working on the Teres-I and I find myself
> recreating the chunks in this patchset almost verbatim (only DT so far),
> one by one, so there must be something right about them ;-)
>
> Whose turn is it?

I've sent v2 yesterday, however I tested it only on Pinebook.

>
> Torsten
>
>
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
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 RESEND v2 06/12] drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge is connected

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 8:29 AM Icenowy Zheng  wrote:
> >> IIRC, from the previous discussion, HDMI had a tolerancy requirement
> >> in the standard. Do you know if there's such a thing for eDP? That
> >> would solve the issue for all the eDP displays at once.
> >
> >I don't have access to eDP standard - vesa.org says it's available to
> >members only.
>
> Try out to grab an old version?
>
> I remember 1.0 is open.

I can't find anything regarding dot clock tolerance in DisplayPort
specification.

-- 
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] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 8:56 AM Thierry Reding  wrote:

> > I think it is perfectly fine to have a generic-ish fallback as long as
> > it is just that, a fallback. If the panel has quirks, then you'd
> > better make sure the firmware is stuffing in the right compatibles or
> > that you can update the firmware.
>
> simple-panel would probably work if you stuck in some mostly compatible
> string and provided a ddc-i2c-bus property in the device tree node. The
> generic-ish fallback case could be implemented by providing a fallback
> compatible string (we used to have "simple-panel", which I think would
> still be adequate for this I suppose) and adding a dummy descriptor in
> the driver, perhaps one with pre-defined delays that could be adjusted
> to work for all cases, or they could just be 0. At least that way we'd
> be explicitly documenting that we support this as a fallback.
>
> I'm not sure how you'd want to enforce that people provide the right
> compatible strings that way. Currently there's no way to make your panel
> work without adding a panel driver, so people are forced to write the
> DT bindings and a driver, or add support to an existing one. If we open
> this backdoor, I suspect many people will just take the easy route and
> rely on the fallback. And then what do we do when we get bug reports
> about panels not working, or requiring some quirks. How do we go and
> find out what the right compatible strings are for each board, or how to
> fix things for something we don't have access to.
>
> This all sounds like a Pandora's box to me.

OK, just give me an option that will work on this platform with a
single software image (keep in mind that u-boot aka "firmware" is part
of this image) and that is acceptable for upstream and I'll try to
implement it.

> Thierry

-- 
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 RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 8:39 AM Rob Herring  wrote:
>
> On Mon, Feb 4, 2019 at 10:11 AM Vasily Khoruzhick  wrote:
> >
> > On Mon, Feb 4, 2019 at 12:24 AM Thierry Reding  
> > wrote:
> > > >
> > > > Pinebook used several 768p panels that have slightly different timings
> > > > and recent batch uses 1080p panel.
> > > >
> > > > What panel descriptor should I use as fallback?
> > >
> > > You don't use panel descriptors as fallback. The simple-panel driver
> > > will bind to a panel device and use the corresponding descriptor. If
> > > your device tree contains the correct information, the descriptor is
> > > correct for the panel you have.
> > >
> > > In other words you need to ensure that you have the correct panel in
> > > device tree for the board that you're using. This is exactly the same
> > > thing as for other devices.
> > >
> > > One way to to this is to have separate device trees for each variant
> > > of the board that you want to support. Another variant may be to have
> > > a common device tree and then have some early firmware update the DTB
> > > with the correct panel information.
> >
> > That defeats the purpose of using eDP panels. Panel can identify
> > itself and report what timings it supports.
>
> If you are confident that this works for all panels, then the firmware
> can identify the right panel and update the DTB with the correct
> information. If this doesn't work in the firmware, then it is not
> going to work in the kernel either and you are SOL without specific
> panel information in the DT.

"firmware" is u-boot and on this platform it sits on the same physical
media as OS (it's either microsd or eMMC).

I guess u-boot can fill in timings for kernel, but I don't see much
point in it. If u-boot can't read EDID then same is true
for kernel.

> > If we use separate DTBs then users will have to figure out what panel
> > is installed in their hardware and use appropriate software image -
> > that's something I'd like to avoid.
>
> I think Thierry meant either way this is a firmware problem. If you
> have a SKU per device and panel type, then the firmware just picks a
> dtb among a set.

Unfortunately it's one SKU per multiple panels.

> Rob

-- 
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] Re: [PATCH RESEND v2 06/12] drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge is connected

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 6:20 AM Maxime Ripard  wrote:
>
> Hi,
>
> On Sun, Feb 03, 2019 at 10:54:55AM -0800, Vasily Khoruzhick wrote:
> > Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
> > Validate the clock rate") prevents some panel and bridges from working with
> > sun4i driver.
> >
> > Unfortunately, dotclock frequency for some modes are not achievable on
> > sunxi hardware, and there's a slight deviation in rate returned by
> > clk_round_rate(), so they fail this check.
> >
> > Experiments show that panels and bridges work fine with this slight
> > deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
> > requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works just
> > fine.
> >
> > This patch adds a 1% tolerence to the dot clock check when bridge is
> > connected.
> >
> > Signed-off-by: Vasily Khoruzhick 
>
> I'm not sure we want to make exceptions for all the hardware
> combination we face, but we should go for something more generic (and
> easier to maintain instead).
>
> IIRC, from the previous discussion, HDMI had a tolerancy requirement
> in the standard. Do you know if there's such a thing for eDP? That
> would solve the issue for all the eDP displays at once.

I don't have access to eDP standard - vesa.org says it's available to
members only.

> Maxime
>
> --
> Maxime Ripard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com

-- 
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] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-04 Thread Vasily Khoruzhick
On Mon, Feb 4, 2019 at 12:24 AM Thierry Reding  wrote:
> >
> > Pinebook used several 768p panels that have slightly different timings
> > and recent batch uses 1080p panel.
> >
> > What panel descriptor should I use as fallback?
>
> You don't use panel descriptors as fallback. The simple-panel driver
> will bind to a panel device and use the corresponding descriptor. If
> your device tree contains the correct information, the descriptor is
> correct for the panel you have.
>
> In other words you need to ensure that you have the correct panel in
> device tree for the board that you're using. This is exactly the same
> thing as for other devices.
>
> One way to to this is to have separate device trees for each variant
> of the board that you want to support. Another variant may be to have
> a common device tree and then have some early firmware update the DTB
> with the correct panel information.

That defeats the purpose of using eDP panels. Panel can identify
itself and report what timings it supports.

If we use separate DTBs then users will have to figure out what panel
is installed in their hardware and use appropriate software image -
that's something I'd like to avoid.

I can add a descriptor for something like "pinebook eDP panel" if it
works for you, but it won't have any display timings in it.

-- 
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] Re: [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-04 Thread Vasily Khoruzhick
On Sun, Feb 3, 2019 at 11:43 PM Thierry Reding  wrote:
>
> On Sun, Feb 03, 2019 at 10:54:57AM -0800, Vasily Khoruzhick wrote:
> > eDP panels usually have EDID EEPROM, so there's no need to define panel
> > width/height or any modes/timings in dts. But this panel still may have
> > regulator and/or backlight.
> >
> > Signed-off-by: Vasily Khoruzhick 
> > ---
> >  .../devicetree/bindings/display/panel/panel-edp.txt| 7 +++
> >  1 file changed, 7 insertions(+)
> >  create mode 100644 
> > Documentation/devicetree/bindings/display/panel/panel-edp.txt
>
> Please don't try to make panels look more generic than they really are.
> You're going to have to provide a compatible string for your device that
> is more specific than "panel-edp". You claim that you don't need any
> extra information that is panel specific, but you don't know that now.
> We have in the past thought that we didn't need things like prepare
> delay, but then we ran into situations where we did need them.
>
> Just do what everybody else does. Provide a specific compatible string
> and match on that in the panel-simple driver. Even if you can read all
> the video timings from an EDID EEPROM, you can still provide a mode in
> the panel descriptor to serve as a fallback if for example the EEPROM
> is faulty on some device.

Pinebook used several 768p panels that have slightly different timings
and recent batch uses 1080p panel.

What panel descriptor should I use as fallback?

> Thierry

-- 
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] [PATCH RESEND v2 06/12] drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge is connected

2019-02-03 Thread Vasily Khoruzhick
Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
Validate the clock rate") prevents some panel and bridges from working with
sun4i driver.

Unfortunately, dotclock frequency for some modes are not achievable on
sunxi hardware, and there's a slight deviation in rate returned by
clk_round_rate(), so they fail this check.

Experiments show that panels and bridges work fine with this slight
deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works just
fine.

This patch adds a 1% tolerence to the dot clock check when bridge is
connected.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c  | 16 ++--
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  1 +
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index f4a22689eb54..3f04446120f6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -61,6 +61,7 @@ static enum drm_mode_status sun4i_rgb_mode_valid(struct 
drm_encoder *crtc,
u32 vsync = mode->vsync_end - mode->vsync_start;
unsigned long rate = mode->clock * 1000;
long rounded_rate;
+   long tolerance = 0;
 
DRM_DEBUG_DRIVER("Validating modes...\n");
 
@@ -95,10 +96,14 @@ static enum drm_mode_status sun4i_rgb_mode_valid(struct 
drm_encoder *crtc,
tcon->dclk_min_div = 6;
tcon->dclk_max_div = 127;
rounded_rate = clk_round_rate(tcon->dclk, rate);
-   if (rounded_rate < rate)
+   if (tcon->bridge)
+   /* Check against a 1% tolerance for the dot clock for bridge */
+   tolerance = rate / 100;
+
+   if (rounded_rate < (rate - tolerance))
return MODE_CLOCK_LOW;
 
-   if (rounded_rate > rate)
+   if (rounded_rate > (rate + tolerance))
return MODE_CLOCK_HIGH;
 
DRM_DEBUG_DRIVER("Clock rate OK\n");
@@ -172,7 +177,6 @@ static struct drm_encoder_funcs sun4i_rgb_enc_funcs = {
 int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 {
struct drm_encoder *encoder;
-   struct drm_bridge *bridge;
struct sun4i_rgb *rgb;
int ret;
 
@@ -183,7 +187,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct 
sun4i_tcon *tcon)
encoder = >encoder;
 
ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
- >panel, );
+ >panel, >bridge);
if (ret) {
dev_info(drm->dev, "No panel or bridge found... RGB output 
disabled\n");
return 0;
@@ -225,8 +229,8 @@ int sun4i_rgb_init(struct drm_device *drm, struct 
sun4i_tcon *tcon)
}
}
 
-   if (bridge) {
-   ret = drm_bridge_attach(encoder, bridge, NULL);
+   if (tcon->bridge) {
+   ret = drm_bridge_attach(encoder, tcon->bridge, NULL);
if (ret) {
dev_err(drm->dev, "Couldn't attach our bridge\n");
goto err_cleanup_connector;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h 
b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index b5214d71610f..487cb070b25c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -258,6 +258,7 @@ struct sun4i_tcon {
struct reset_control*lvds_rst;
 
struct drm_panel*panel;
+   struct drm_bridge   *bridge;
 
/* Platform adjustments */
const struct sun4i_tcon_quirks  *quirks;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 02/12] drm/bridge: split some definitions of ANX78xx to dedicated headers

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Some definitions currently in analogix-anx78xx.h are not restricted to
the ANX78xx series, but also applicable to other DisplayPort
transmitters by Analogix.

Split out them to dedicated headers, and make analogix-anx78xx.h include
them.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../drm/bridge/analogix/analogix-anx78xx.h| 464 +-
 .../drm/bridge/analogix/analogix-i2c-dptx.h   | 248 ++
 .../bridge/analogix/analogix-i2c-txcommon.h   | 237 +
 3 files changed, 490 insertions(+), 459 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
index 38753c870137..8aa1eca306d3 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
@@ -15,9 +15,12 @@
 #ifndef __ANX78xx_H
 #define __ANX78xx_H
 
-#define TX_P0  0x70
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define TX_P0  ANALOGIX_I2C_DPTX
 #define TX_P1  0x7a
-#define TX_P2  0x72
+#define TX_P2  ANALOGIX_I2C_TXCOMMON
 
 #define RX_P0  0x7e
 #define RX_P1  0x80
@@ -225,463 +228,6 @@
 #define SP_CLEAR_AVMUTEBIT(4)
 #define SP_SET_AVMUTE  BIT(0)
 
-/***/
-/* Register definition of device address 0x70  */
-/***/
-
-/* HDCP Status Register */
-#define SP_TX_HDCP_STATUS_REG  0x00
-#define SP_AUTH_FAIL   BIT(5)
-#define SP_AUTHEN_PASS BIT(1)
-
-/* HDCP Control Register 0 */
-#define SP_HDCP_CTRL0_REG  0x01
-#define SP_RX_REPEATER BIT(6)
-#define SP_RE_AUTH BIT(5)
-#define SP_SW_AUTH_OK  BIT(4)
-#define SP_HARD_AUTH_ENBIT(3)
-#define SP_HDCP_ENC_EN BIT(2)
-#define SP_BKSV_SRM_PASS   BIT(1)
-#define SP_KSVLIST_VLD BIT(0)
-/* HDCP Function Enabled */
-#define SP_HDCP_FUNCTION_ENABLED   (BIT(0) | BIT(1) | BIT(2) | BIT(3))
-
-/* HDCP Receiver BSTATUS Register 0 */
-#defineSP_HDCP_RX_BSTATUS0_REG 0x1b
-/* HDCP Receiver BSTATUS Register 1 */
-#defineSP_HDCP_RX_BSTATUS1_REG 0x1c
-
-/* HDCP Embedded "Blue Screen" Content Registers */
-#define SP_HDCP_VID0_BLUE_SCREEN_REG   0x2c
-#define SP_HDCP_VID1_BLUE_SCREEN_REG   0x2d
-#define SP_HDCP_VID2_BLUE_SCREEN_REG   0x2e
-
-/* HDCP Wait R0 Timing Register */
-#define SP_HDCP_WAIT_R0_TIME_REG   0x40
-
-/* HDCP Link Integrity Check Timer Register */
-#define SP_HDCP_LINK_CHECK_TIMER_REG   0x41
-
-/* HDCP Repeater Ready Wait Timer Register */
-#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42
-
-/* HDCP Auto Timer Register */
-#define SP_HDCP_AUTO_TIMER_REG 0x51
-
-/* HDCP Key Status Register */
-#define SP_HDCP_KEY_STATUS_REG 0x5e
-
-/* HDCP Key Command Register */
-#define SP_HDCP_KEY_COMMAND_REG0x5f
-#define SP_DISABLE_SYNC_HDCP   BIT(2)
-
-/* OTP Memory Key Protection Registers */
-#define SP_OTP_KEY_PROTECT1_REG0x60
-#define SP_OTP_KEY_PROTECT2_REG0x61
-#define SP_OTP_KEY_PROTECT3_REG0x62
-#define SP_OTP_PSW10xa2
-#define SP_OTP_PSW20x7e
-#define SP_OTP_PSW30xc6
-
-/* DP System Control Registers */
-#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1)
-/* Bits for DP System Control Register 2 */
-#define SP_CHA_STA BIT(2)
-/* Bits for DP System Control Register 3 */
-#define SP_HPD_STATUS  BIT(6)
-#define SP_STRM_VALID  BIT(2)
-/* Bits for DP System Control Register 4 */
-#define SP_ENHANCED_MODE   BIT(3)
-
-/* DP Video Control Register */
-#define SP_DP_VIDEO_CTRL_REG   0x84
-#define SP_COLOR_F_MASK0x06
-#define SP_COLOR_F_SHIFT   1
-#define SP_BPC_MASK0xe0
-#define SP_BPC_SHIFT   5
-#  define SP_BPC_6BITS 0x00
-#  define SP_BPC_8BITS 0x01
-#  define SP_BPC_10BITS0x02
-#  define SP_BPC_12BITS0x03
-
-/* DP Audio Control Register */
-#define SP_DP_AUDIO_CTRL_REG   0x87
-#define SP_AUD_EN  BIT(0)
-
-/* 10us Pulse Generate Timer Registers */
-#define SP_I2C_GEN_10US_TIMER0_REG 0x88
-#define SP_I2C_GEN_10US_TIMER1_REG 0x89
-
-/* Packet Send Control Register */
-#

[linux-sunxi] [PATCH RESEND v2 09/12] drm/panel: simple: add generic eDP panel

2019-02-03 Thread Vasily Khoruzhick
eDP panels usually have EDID EEPROM, so there's no need to define panel
width/height or any modes/timings in dts. But this panel still has
regulator and backlight.

Add compatible for generic eDP panel so such kind of panel can be
defined in dts.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/panel/panel-simple.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 2f2cb2d81f2b..9698f5819930 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2759,6 +2759,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "winstar,wf35ltiacd",
.data = _wf35ltiacd,
+   }, {
+   .compatible = "panel-edp",
+   .data = NULL,
}, {
/* sentinel */
}
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 04/12] dt-bindings: Add ANX6345 DP/eDP transmitter binding

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPort/eDP transmitter designed
for portable devices.

Add a binding document for it.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../bindings/display/bridge/anx6345.txt   | 56 +++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/anx6345.txt 
b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
new file mode 100644
index ..e79a11348d11
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
@@ -0,0 +1,56 @@
+Analogix ANX6345 eDP Transmitter
+
+
+The ANX6345 is an ultra-low power Full-HD eDP transmitter designed for
+portable devices.
+
+Required properties:
+
+ - compatible  : "analogix,anx6345"
+ - reg : I2C address of the device
+ - reset-gpios : Which GPIO to use for reset
+
+Optional properties:
+
+ - dvdd12-supply   : Regulator for 1.2V digital core power.
+ - dvdd25-supply   : Regulator for 2.5V digital core power.
+ - Video ports for RGB input and eDP output using the DT bindings
+   defined in [1]
+
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+
+anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_fldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+};
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 01/12] drm/bridge: move ANA78xx driver to analogix subdirectory

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

As ANA78xx chips are designed and produced by Analogix Semiconductor,
Inc, move their driver codes into analogix subdirectory.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/Kconfig | 10 --
 drivers/gpu/drm/bridge/Makefile|  4 ++--
 drivers/gpu/drm/bridge/analogix/Kconfig| 10 ++
 drivers/gpu/drm/bridge/analogix/Makefile   |  1 +
 .../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c   |  0
 .../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h   |  0
 6 files changed, 13 insertions(+), 12 deletions(-)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (100%)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h (100%)

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 2fee47b0d50b..4922c1ceffef 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -15,16 +15,6 @@ config DRM_PANEL_BRIDGE
 menu "Display Interface Bridges"
depends on DRM && DRM_BRIDGE
 
-config DRM_ANALOGIX_ANX78XX
-   tristate "Analogix ANX78XX bridge"
-   select DRM_KMS_HELPER
-   select REGMAP_I2C
-   ---help---
- ANX78XX is an ultra-low Full-HD SlimPort transmitter
- designed for portable devices. The ANX78XX transforms
- the HDMI output of an application processor to MyDP
- or DisplayPort.
-
 config DRM_CDNS_DSI
tristate "Cadence DPI/DSI bridge"
select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf5a6f8..a6c7dd7727ea 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
@@ -12,8 +11,9 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o
 obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
-obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
+
+obj-y += analogix/
 obj-y += synopsys/
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index 80f286fa3a69..c4d343a2f04d 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,3 +1,13 @@
+config DRM_ANALOGIX_ANX78XX
+   tristate "Analogix ANX78XX bridge"
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX78XX is an ultra-low Full-HD SlimPort transmitter
+ designed for portable devices. The ANX78XX transforms
+ the HDMI output of an application processor to MyDP
+ or DisplayPort.
+
 config DRM_ANALOGIX_DP
tristate
depends on DRM
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index cd4010ba6890..ce1687e60975 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,2 +1,3 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.c
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.h
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 12/12] arm64: allwinner: a64: enable LCD-related hardware for TERES-I

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

TERES-I has an ANX6345 bridge connected to the RGB666 LCD output and
eDP panel input. The bridge is controlled via I2C that's connected to
I2C0 bus.

Enable all this hardware in device tree.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts | 71 +--
 1 file changed, 67 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
index c455b24dd079..6c4090f59bed 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
@@ -56,6 +56,17 @@
};
};
 
+   edp_panel: edp-panel {
+   compatible = "panel-edp", "simple-panel";
+
+   port {
+   panel_in_edp: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+
reg_usb1_vbus: usb1-vbus {
compatible = "regulator-fixed";
regulator-name = "usb1-vbus";
@@ -72,20 +83,58 @@
};
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
 
 
-/* The ANX6345 eDP-bridge is on i2c0. There is no linux (mainline)
- * driver for this chip at the moment, the bootloader initializes it.
- * However it can be accessed with the i2c-dev driver from user space.
- */
  {
clock-frequency = <10>;
pinctrl-names = "default";
pinctrl-0 = <_pins>;
status = "okay";
+
+   anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_dldo3>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
@@ -258,6 +307,20 @@
vcc-hdmi-supply = <_dldo1>;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgb666_pins>;
+
+   status = "okay";
+};
+
+_out {
+   tcon0_out_anx6345: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_tcon0>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 00/12] Analogix ANX6345 RGB-(e)DP bridge support

2019-02-03 Thread Vasily Khoruzhick
This patchset brings support for Analogix ANX6345 RGB-(e)DP bridge, which
is used by some Allwinner A64 laptops, such as Pinebook and Olimex
TERES-I.

It reuses some definitions from ANX78xx driver that already exists in the
kernel tree, but the driver code itself is rewritten due to significant
difference between ANX6345 and ANX78xx.

This patchset also enables the bridge on Pinebook and TERES-I and adds 1%
tolerance into dotclock check in sun4i driver in case if bridge is
connected

v2: - sort Kconfig and Makefile entries alphabetically
- remove panel supply from anx6345
- add support for panels into anx6345 driver
- add compatible and binding for generic eDP panel
- replace patch that adds 5% tolerance for dotclock check in sun4i
  driver for panel and bridges with patch that adds 1% tolerance
  in case if bridge is connected.

Icenowy Zheng (8):
  drm/bridge: move ANA78xx driver to analogix subdirectory
  drm/bridge: split some definitions of ANX78xx to dedicated headers
  drm/bridge: extract some Analogix I2C DP common code
  dt-bindings: Add ANX6345 DP/eDP transmitter binding
  drm/bridge: Add Analogix anx6345 support
  arm64: allwinner: a64: add pinmux for RGB666 LCD
  arm64: allwinner: a64: enable LCD-related hardware for Pinebook
  arm64: allwinner: a64: enable LCD-related hardware for TERES-I

Vasily Khoruzhick (4):
  drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge
is connected
  drm/panel: simple: don't fail if we don't have panel desc
  dt-bindings: add binding for generic eDP panel
  drm/panel: simple: add generic eDP panel

 .../bindings/display/bridge/anx6345.txt   |  56 ++
 .../bindings/display/panel/panel-edp.txt  |   7 +
 .../dts/allwinner/sun50i-a64-pinebook.dts |  74 ++
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts |  71 +-
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |   9 +
 drivers/gpu/drm/bridge/Kconfig|  10 -
 drivers/gpu/drm/bridge/Makefile   |   4 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.h | 719 ---
 drivers/gpu/drm/bridge/analogix/Kconfig   |  25 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   4 +
 .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
 .../bridge/{ => analogix}/analogix-anx78xx.c  | 146 +--
 .../drm/bridge/analogix/analogix-anx78xx.h| 265 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 
 .../drm/bridge/analogix/analogix-i2c-dptx.h   | 258 ++
 .../bridge/analogix/analogix-i2c-txcommon.h   | 240 +
 drivers/gpu/drm/panel/panel-simple.c  |  24 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c |  16 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.h|   1 +
 19 files changed, 2049 insertions(+), 894 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-edp.txt
 delete mode 100644 drivers/gpu/drm/bridge/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (90%)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-03 Thread Vasily Khoruzhick
eDP panels usually have EDID EEPROM, so there's no need to define panel
width/height or any modes/timings in dts. But this panel still may have
regulator and/or backlight.

Signed-off-by: Vasily Khoruzhick 
---
 .../devicetree/bindings/display/panel/panel-edp.txt| 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-edp.txt

diff --git a/Documentation/devicetree/bindings/display/panel/panel-edp.txt 
b/Documentation/devicetree/bindings/display/panel/panel-edp.txt
new file mode 100644
index ..fc7a0868048e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-edp.txt
@@ -0,0 +1,7 @@
+Generic eDP Display Panel
+
+Required properties:
+  - compatible: "panel-edp"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 05/12] drm/bridge: Add Analogix anx6345 support

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPower/eDP transmitter designed
for portable devices. This driver adds initial support for RGB to eDP
mode, without HPD and interrupts.

This is a configuration usually seen in eDP applications.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/bridge/analogix/Kconfig   |  11 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
 .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.c   |   2 +-
 .../drm/bridge/analogix/analogix-i2c-dptx.h   |   8 +
 .../bridge/analogix/analogix-i2c-txcommon.h   |   3 +
 6 files changed, 869 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index ed2d05c12546..3c6ec535d361 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,3 +1,14 @@
+config DRM_ANALOGIX_ANX6345
+   tristate "Analogix ANX6345 bridge"
+   select DRM_ANALOGIX_DP_I2C
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX6345 is an ultra-low Full-HD DisplayPort/eDP
+ transmitter designed for portable devices. The
+ ANX6345 transforms the LVTTL RGB output of an
+ application processor to eDP or DisplayPort.
+
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
select DRM_ANALOGIX_DP_I2C
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index 2d523b67487d..12fed7b04e1e 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,5 +1,6 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
 analogix_dp_i2c-objs := analogix-i2c-dptx.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
 obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
new file mode 100644
index ..e275f5c9e8c4
--- /dev/null
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -0,0 +1,845 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright(c) Icenowy Zheng 
+ * Based on analogix-anx6345.c, which is:
+ *   Copyright(c) 2016, Analogix Semiconductor.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define I2C_NUM_ADDRESSES  2
+#define I2C_IDX_DPTX   0
+#define I2C_IDX_TXCOM  1
+
+#define XTAL_CLK   270 /* 27M */
+
+#define POLL_DELAY 5 /* us */
+#define POLL_TIMEOUT   500 /* us */
+
+static const u8 anx6345_i2c_addresses[] = {
+   [I2C_IDX_DPTX]  = ANALOGIX_I2C_DPTX,
+   [I2C_IDX_TXCOM] = ANALOGIX_I2C_TXCOMMON,
+};
+
+struct anx6345_platform_data {
+   struct regulator *dvdd12;
+   struct regulator *dvdd25;
+   struct gpio_desc *gpiod_reset;
+};
+
+struct anx6345 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct drm_panel *panel;
+   struct anx6345_platform_data pdata;
+   struct mutex lock;
+
+   /*
+* I2C Slave addresses of ANX6345 are mapped as DPTX and SYS
+*/
+   struct i2c_client *i2c_clients[I2C_NUM_ADDRESSES];
+   struct regmap *map[I2C_NUM_ADDRESSES];
+
+   u16 chipid;
+   u8 dpcd[DP_RECEIVER_CAP_SIZE];
+
+   bool powered;
+};
+
+static inline struct anx6345 *connector_to_anx6345(struct drm_connector *c)
+{
+   return container_of(c, struct anx6345, connector);
+}
+
+static inline struct anx6345 *bridge_to_anx6345(struct drm_bridge *bridge)
+{
+   return container_of(bridge, struct anx6345, bridge);
+}
+
+static int anx6345_set_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, mask);
+}
+
+static int anx6345_clear_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, 0);
+}
+
+static ssize_t anx6345_aux_transfer(struct drm_dp_aux *aux,
+   struct drm_dp_aux_msg *msg)
+{
+   struct anx6345 *anx6345 = container_of(aux, struct anx6345, aux);
+
+   return anx_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
+}
+
+static int anx6345_dp_link_training(struct anx6345 *anx6345)
+{
+   unsigned int value;
+   u8 dp_bw;
+   int err;

[linux-sunxi] [PATCH RESEND v2 10/12] arm64: allwinner: a64: add pinmux for RGB666 LCD

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Allwinner A64's TCON0 can output RGB666 LCD signal.

Add its pinmux.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 837a03dee875..4fc3ca5fa53e 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -559,6 +559,15 @@
function = "i2c1";
};
 
+   lcd_rgb666_pins: lcd-rgb666 {
+   pins = "PD0", "PD1", "PD2", "PD3", "PD4",
+  "PD5", "PD6", "PD7", "PD8", "PD9",
+  "PD10", "PD11", "PD12", "PD13",
+  "PD14", "PD15", "PD16", "PD17",
+  "PD18", "PD19", "PD20", "PD21";
+   function = "lcd0";
+   };
+
mmc0_pins: mmc0-pins {
pins = "PF0", "PF1", "PF2", "PF3",
   "PF4", "PF5";
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 03/12] drm/bridge: extract some Analogix I2C DP common code

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Some code can be shared within different DP bridges by Analogix.

Extract them to a new module.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/bridge/analogix/Kconfig   |   4 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   2 +
 .../drm/bridge/analogix/analogix-anx78xx.c| 146 +--
 .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.h   |   2 +
 5 files changed, 178 insertions(+), 145 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index c4d343a2f04d..ed2d05c12546 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,5 +1,6 @@
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
+   select DRM_ANALOGIX_DP_I2C
select DRM_KMS_HELPER
select REGMAP_I2C
help
@@ -11,3 +12,6 @@ config DRM_ANALOGIX_ANX78XX
 config DRM_ANALOGIX_DP
tristate
depends on DRM
+
+config DRM_ANALOGIX_DP_I2C
+   tristate
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index ce1687e60975..2d523b67487d 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,3 +1,5 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+analogix_dp_i2c-objs := analogix-i2c-dptx.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
+obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index f8433c93f463..bf8291d0ddd0 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -45,8 +45,6 @@
 #define I2C_IDX_RX_P1  4
 
 #define XTAL_CLK   270 /* 27M */
-#define AUX_CH_BUFFER_SIZE 16
-#define AUX_WAIT_TIMEOUT_MS15
 
 static const u8 anx78xx_i2c_addresses[] = {
[I2C_IDX_TX_P0] = TX_P0,
@@ -109,153 +107,11 @@ static int anx78xx_clear_bits(struct regmap *map, u8 
reg, u8 mask)
return regmap_update_bits(map, reg, mask, 0);
 }
 
-static bool anx78xx_aux_op_finished(struct anx78xx *anx78xx)
-{
-   unsigned int value;
-   int err;
-
-   err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_DP_AUX_CH_CTRL2_REG,
- );
-   if (err < 0)
-   return false;
-
-   return (value & SP_AUX_EN) == 0;
-}
-
-static int anx78xx_aux_wait(struct anx78xx *anx78xx)
-{
-   unsigned long timeout;
-   unsigned int status;
-   int err;
-
-   timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
-
-   while (!anx78xx_aux_op_finished(anx78xx)) {
-   if (time_after(jiffies, timeout)) {
-   if (!anx78xx_aux_op_finished(anx78xx)) {
-   DRM_ERROR("Timed out waiting AUX to finish\n");
-   return -ETIMEDOUT;
-   }
-
-   break;
-   }
-
-   usleep_range(1000, 2000);
-   }
-
-   /* Read the AUX channel access status */
-   err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_CH_STATUS_REG,
- );
-   if (err < 0) {
-   DRM_ERROR("Failed to read from AUX channel: %d\n", err);
-   return err;
-   }
-
-   if (status & SP_AUX_STATUS) {
-   DRM_ERROR("Failed to wait for AUX channel (status: %02x)\n",
- status);
-   return -ETIMEDOUT;
-   }
-
-   return 0;
-}
-
-static int anx78xx_aux_address(struct anx78xx *anx78xx, unsigned int addr)
-{
-   int err;
-
-   err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_7_0_REG,
-  addr & 0xff);
-   if (err)
-   return err;
-
-   err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_15_8_REG,
-  (addr & 0xff00) >> 8);
-   if (err)
-   return err;
-
-   /*
-* DP AUX CH Address Register #2, only update bits[3:0]
-* [7:4] RESERVED
-* [3:0] AUX_ADDR[19:16], Register control AUX CH address.
-*/
-   err = regmap_update_bits(anx78xx->map[I2C_IDX_TX_P0],
-SP_AUX_ADDR_19_16_REG,
-SP_AUX_ADDR_19_16_MASK,
-(addr & 0xf) >> 16);
-
-   if (err)
-   return err;
-
-   return 0;
-}
-
 static ssize_t anx78xx_aux_transfer(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg)

[linux-sunxi] [PATCH RESEND v2 11/12] arm64: allwinner: a64: enable LCD-related hardware for Pinebook

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Pinebook has an ANX6345 bridge connected to the RGB666 LCD output and
eDP panel input. The bridge is controlled via I2C that's connected to
R_I2C bus.

Enable all this hardware in device tree.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../dts/allwinner/sun50i-a64-pinebook.dts | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index d22736a62481..49f5d4b0c7f4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -63,6 +63,18 @@
};
};
 
+   edp_panel: edp-panel {
+   compatible = "panel-edp", "simple-panel";
+   backlight = <>;
+   power-supply = <_dc1sw>;
+
+   port {
+   panel_in_edp: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
@@ -102,6 +114,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
phys = < 0>;
phy-names = "usb";
@@ -112,6 +128,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
@@ -163,6 +183,46 @@
status = "okay";
 };
 
+_i2c {
+   pinctrl-names = "default";
+   pinctrl-0 = <_i2c_pins_a>;
+   status = "okay";
+
+   anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_fldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+   };
+};
+
 _rsb {
status = "okay";
 
@@ -334,6 +394,20 @@
"MIC2", "Internal Microphone Right";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgb666_pins>;
+
+   status = "okay";
+};
+
+_out {
+   tcon0_out_anx6345: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_tcon0>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH RESEND v2 07/12] drm/panel: simple: don't fail if we don't have panel desc

2019-02-03 Thread Vasily Khoruzhick
This is preparation for addition of generic eDP panel that
doesn't have any modes or delays defined.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/panel/panel-simple.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 9c69e739a524..2f2cb2d81f2b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -176,7 +176,7 @@ static int panel_simple_disable(struct drm_panel *panel)
backlight_update_status(p->backlight);
}
 
-   if (p->desc->delay.disable)
+   if (p->desc && p->desc->delay.disable)
msleep(p->desc->delay.disable);
 
p->enabled = false;
@@ -195,7 +195,7 @@ static int panel_simple_unprepare(struct drm_panel *panel)
 
regulator_disable(p->supply);
 
-   if (p->desc->delay.unprepare)
+   if (p->desc && p->desc->delay.unprepare)
msleep(p->desc->delay.unprepare);
 
p->prepared = false;
@@ -220,11 +220,13 @@ static int panel_simple_prepare(struct drm_panel *panel)
 
gpiod_set_value_cansleep(p->enable_gpio, 1);
 
-   delay = p->desc->delay.prepare;
-   if (p->no_hpd)
-   delay += p->desc->delay.hpd_absent_delay;
-   if (delay)
-   msleep(delay);
+   if (p->desc) {
+   delay = p->desc->delay.prepare;
+   if (p->no_hpd)
+   delay += p->desc->delay.hpd_absent_delay;
+   if (delay)
+   msleep(delay);
+   }
 
p->prepared = true;
 
@@ -238,7 +240,7 @@ static int panel_simple_enable(struct drm_panel *panel)
if (p->enabled)
return 0;
 
-   if (p->desc->delay.enable)
+   if (p->desc && p->desc->delay.enable)
msleep(p->desc->delay.enable);
 
if (p->backlight) {
@@ -280,6 +282,9 @@ static int panel_simple_get_timings(struct drm_panel *panel,
struct panel_simple *p = to_panel_simple(panel);
unsigned int i;
 
+   if (!p->desc)
+   return 0;
+
if (p->desc->num_timings < num_timings)
num_timings = p->desc->num_timings;
 
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v2 00/12] Analogix ANX6345 RGB-(e)DP bridge support

2019-02-03 Thread Vasily Khoruzhick
Oops, looks like I screwed up with recipients list.I'll resend the series.

On Sun, Feb 3, 2019 at 10:44 AM Vasily Khoruzhick  wrote:
>
> This patchset brings support for Analogix ANX6345 RGB-(e)DP bridge, which
> is used by some Allwinner A64 laptops, such as Pinebook and Olimex
> TERES-I.
>
> It reuses some definitions from ANX78xx driver that already exists in the
> kernel tree, but the driver code itself is rewritten due to significant
> difference between ANX6345 and ANX78xx.
>
> This patchset also enables the bridge on Pinebook and TERES-I and adds 1%
> tolerance into dotclock check in sun4i driver in case if bridge is
> connected
>
> v2: - sort Kconfig and Makefile entries alphabetically
> - remove panel supply from anx6345
> - add support for panels into anx6345 driver
> - add compatible and binding for generic eDP panel
> - replace patch that adds 5% tolerance for dotclock check in sun4i
>   driver for panel and bridges with patch that adds 1% tolerance
>   in case if bridge is connected.
>
> Icenowy Zheng (8):
>   drm/bridge: move ANA78xx driver to analogix subdirectory
>   drm/bridge: split some definitions of ANX78xx to dedicated headers
>   drm/bridge: extract some Analogix I2C DP common code
>   dt-bindings: Add ANX6345 DP/eDP transmitter binding
>   drm/bridge: Add Analogix anx6345 support
>   arm64: allwinner: a64: add pinmux for RGB666 LCD
>   arm64: allwinner: a64: enable LCD-related hardware for Pinebook
>   arm64: allwinner: a64: enable LCD-related hardware for TERES-I
>
> Vasily Khoruzhick (4):
>   drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge
> is connected
>   drm/panel: simple: don't fail if we don't have panel desc
>   dt-bindings: add binding for generic eDP panel
>   drm/panel: simple: add generic eDP panel
>
>  .../bindings/display/bridge/anx6345.txt   |  56 ++
>  .../bindings/display/panel/panel-edp.txt  |   7 +
>  .../dts/allwinner/sun50i-a64-pinebook.dts |  74 ++
>  .../boot/dts/allwinner/sun50i-a64-teres-i.dts |  71 +-
>  arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |   9 +
>  drivers/gpu/drm/bridge/Kconfig|  10 -
>  drivers/gpu/drm/bridge/Makefile   |   4 +-
>  drivers/gpu/drm/bridge/analogix-anx78xx.h | 719 ---
>  drivers/gpu/drm/bridge/analogix/Kconfig   |  25 +
>  drivers/gpu/drm/bridge/analogix/Makefile  |   4 +
>  .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
>  .../bridge/{ => analogix}/analogix-anx78xx.c  | 146 +--
>  .../drm/bridge/analogix/analogix-anx78xx.h| 265 ++
>  .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 
>  .../drm/bridge/analogix/analogix-i2c-dptx.h   | 258 ++
>  .../bridge/analogix/analogix-i2c-txcommon.h   | 240 +
>  drivers/gpu/drm/panel/panel-simple.c  |  24 +-
>  drivers/gpu/drm/sun4i/sun4i_rgb.c |  16 +-
>  drivers/gpu/drm/sun4i/sun4i_tcon.h|   1 +
>  19 files changed, 2049 insertions(+), 894 deletions(-)
>  create mode 100644 
> Documentation/devicetree/bindings/display/bridge/anx6345.txt
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/panel-edp.txt
>  delete mode 100644 drivers/gpu/drm/bridge/analogix-anx78xx.h
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
>  rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (90%)
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
>
> --
> 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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 12/12] arm64: allwinner: a64: enable LCD-related hardware for TERES-I

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

TERES-I has an ANX6345 bridge connected to the RGB666 LCD output and
eDP panel input. The bridge is controlled via I2C that's connected to
I2C0 bus.

Enable all this hardware in device tree.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts | 71 +--
 1 file changed, 67 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
index c455b24dd079..6c4090f59bed 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
@@ -56,6 +56,17 @@
};
};
 
+   edp_panel: edp-panel {
+   compatible = "panel-edp", "simple-panel";
+
+   port {
+   panel_in_edp: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
+
reg_usb1_vbus: usb1-vbus {
compatible = "regulator-fixed";
regulator-name = "usb1-vbus";
@@ -72,20 +83,58 @@
};
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
 
 
-/* The ANX6345 eDP-bridge is on i2c0. There is no linux (mainline)
- * driver for this chip at the moment, the bootloader initializes it.
- * However it can be accessed with the i2c-dev driver from user space.
- */
  {
clock-frequency = <10>;
pinctrl-names = "default";
pinctrl-0 = <_pins>;
status = "okay";
+
+   anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_dldo3>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
 };
 
  {
@@ -258,6 +307,20 @@
vcc-hdmi-supply = <_dldo1>;
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgb666_pins>;
+
+   status = "okay";
+};
+
+_out {
+   tcon0_out_anx6345: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_tcon0>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 01/12] drm/bridge: move ANA78xx driver to analogix subdirectory

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

As ANA78xx chips are designed and produced by Analogix Semiconductor,
Inc, move their driver codes into analogix subdirectory.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
Reviewed-by: Laurent Pinchart 
---
 drivers/gpu/drm/bridge/Kconfig | 10 --
 drivers/gpu/drm/bridge/Makefile|  4 ++--
 drivers/gpu/drm/bridge/analogix/Kconfig| 10 ++
 drivers/gpu/drm/bridge/analogix/Makefile   |  1 +
 .../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c   |  0
 .../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h   |  0
 6 files changed, 13 insertions(+), 12 deletions(-)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (100%)
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h (100%)

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 2fee47b0d50b..4922c1ceffef 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -15,16 +15,6 @@ config DRM_PANEL_BRIDGE
 menu "Display Interface Bridges"
depends on DRM && DRM_BRIDGE
 
-config DRM_ANALOGIX_ANX78XX
-   tristate "Analogix ANX78XX bridge"
-   select DRM_KMS_HELPER
-   select REGMAP_I2C
-   ---help---
- ANX78XX is an ultra-low Full-HD SlimPort transmitter
- designed for portable devices. The ANX78XX transforms
- the HDMI output of an application processor to MyDP
- or DisplayPort.
-
 config DRM_CDNS_DSI
tristate "Cadence DPI/DSI bridge"
select DRM_KMS_HELPER
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 4934fcf5a6f8..a6c7dd7727ea 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -1,5 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
 obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
@@ -12,8 +11,9 @@ obj-$(CONFIG_DRM_SII9234) += sii9234.o
 obj-$(CONFIG_DRM_THINE_THC63LVD1024) += thc63lvd1024.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358764) += tc358764.o
 obj-$(CONFIG_DRM_TOSHIBA_TC358767) += tc358767.o
-obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
 obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
 obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
 obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
+
+obj-y += analogix/
 obj-y += synopsys/
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index 80f286fa3a69..c4d343a2f04d 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,3 +1,13 @@
+config DRM_ANALOGIX_ANX78XX
+   tristate "Analogix ANX78XX bridge"
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX78XX is an ultra-low Full-HD SlimPort transmitter
+ designed for portable devices. The ANX78XX transforms
+ the HDMI output of an application processor to MyDP
+ or DisplayPort.
+
 config DRM_ANALOGIX_DP
tristate
depends on DRM
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index cd4010ba6890..ce1687e60975 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,2 +1,3 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.c
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
similarity index 100%
rename from drivers/gpu/drm/bridge/analogix-anx78xx.h
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 09/12] drm/panel: simple: add generic eDP panel

2019-02-03 Thread Vasily Khoruzhick
eDP panels usually have EDID EEPROM, so there's no need to define panel
width/height or any modes/timings in dts. But this panel still has
regulator and backlight.

Add compatible for generic eDP panel so such kind of panel can be
defined in dts.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/panel/panel-simple.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 2f2cb2d81f2b..9698f5819930 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2759,6 +2759,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "winstar,wf35ltiacd",
.data = _wf35ltiacd,
+   }, {
+   .compatible = "panel-edp",
+   .data = NULL,
}, {
/* sentinel */
}
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 11/12] arm64: allwinner: a64: enable LCD-related hardware for Pinebook

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Pinebook has an ANX6345 bridge connected to the RGB666 LCD output and
eDP panel input. The bridge is controlled via I2C that's connected to
R_I2C bus.

Enable all this hardware in device tree.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../dts/allwinner/sun50i-a64-pinebook.dts | 74 +++
 1 file changed, 74 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts 
b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
index d22736a62481..49f5d4b0c7f4 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
@@ -63,6 +63,18 @@
};
};
 
+   edp_panel: edp-panel {
+   compatible = "panel-edp", "simple-panel";
+   backlight = <>;
+   power-supply = <_dc1sw>;
+
+   port {
+   panel_in_edp: endpoint {
+   remote-endpoint = <_out_panel>;
+   };
+   };
+   };
+
reg_vcc3v3: vcc3v3 {
compatible = "regulator-fixed";
regulator-name = "vcc3v3";
@@ -102,6 +114,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
phys = < 0>;
phy-names = "usb";
@@ -112,6 +128,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pins>;
@@ -163,6 +183,46 @@
status = "okay";
 };
 
+_i2c {
+   pinctrl-names = "default";
+   pinctrl-0 = <_i2c_pins_a>;
+   status = "okay";
+
+   anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_fldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+   };
+};
+
 _rsb {
status = "okay";
 
@@ -334,6 +394,20 @@
"MIC2", "Internal Microphone Right";
 };
 
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgb666_pins>;
+
+   status = "okay";
+};
+
+_out {
+   tcon0_out_anx6345: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_tcon0>;
+   };
+};
+
  {
pinctrl-names = "default";
pinctrl-0 = <_pb_pins>;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 08/12] dt-bindings: add binding for generic eDP panel

2019-02-03 Thread Vasily Khoruzhick
eDP panels usually have EDID EEPROM, so there's no need to define panel
width/height or any modes/timings in dts. But this panel still may have
regulator and/or backlight.

Signed-off-by: Vasily Khoruzhick 
---
 .../devicetree/bindings/display/panel/panel-edp.txt| 7 +++
 1 file changed, 7 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-edp.txt

diff --git a/Documentation/devicetree/bindings/display/panel/panel-edp.txt 
b/Documentation/devicetree/bindings/display/panel/panel-edp.txt
new file mode 100644
index ..fc7a0868048e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-edp.txt
@@ -0,0 +1,7 @@
+Generic eDP Display Panel
+
+Required properties:
+  - compatible: "panel-edp"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 04/12] dt-bindings: Add ANX6345 DP/eDP transmitter binding

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPort/eDP transmitter designed
for portable devices.

Add a binding document for it.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../bindings/display/bridge/anx6345.txt   | 56 +++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/anx6345.txt 
b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
new file mode 100644
index ..e79a11348d11
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
@@ -0,0 +1,56 @@
+Analogix ANX6345 eDP Transmitter
+
+
+The ANX6345 is an ultra-low power Full-HD eDP transmitter designed for
+portable devices.
+
+Required properties:
+
+ - compatible  : "analogix,anx6345"
+ - reg : I2C address of the device
+ - reset-gpios : Which GPIO to use for reset
+
+Optional properties:
+
+ - dvdd12-supply   : Regulator for 1.2V digital core power.
+ - dvdd25-supply   : Regulator for 2.5V digital core power.
+ - Video ports for RGB input and eDP output using the DT bindings
+   defined in [1]
+
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+
+Example:
+
+anx6345: anx6345@38 {
+   compatible = "analogix,anx6345";
+   reg = <0x38>;
+   reset-gpios = < 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
+   dvdd25-supply = <_dldo2>;
+   dvdd12-supply = <_fldo1>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   anx6345_in: port@0 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <0>;
+   anx6345_in_tcon0: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_out_anx6345>;
+   };
+   };
+
+   anx6345_out: port@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   anx6345_out_panel: endpoint@0 {
+   reg = <0>;
+   remote-endpoint = <_in_edp>;
+   };
+   };
+   };
+};
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 10/12] arm64: allwinner: a64: add pinmux for RGB666 LCD

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Allwinner A64's TCON0 can output RGB666 LCD signal.

Add its pinmux.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi 
b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
index 837a03dee875..4fc3ca5fa53e 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
@@ -559,6 +559,15 @@
function = "i2c1";
};
 
+   lcd_rgb666_pins: lcd-rgb666 {
+   pins = "PD0", "PD1", "PD2", "PD3", "PD4",
+  "PD5", "PD6", "PD7", "PD8", "PD9",
+  "PD10", "PD11", "PD12", "PD13",
+  "PD14", "PD15", "PD16", "PD17",
+  "PD18", "PD19", "PD20", "PD21";
+   function = "lcd0";
+   };
+
mmc0_pins: mmc0-pins {
pins = "PF0", "PF1", "PF2", "PF3",
   "PF4", "PF5";
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 05/12] drm/bridge: Add Analogix anx6345 support

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

The ANX6345 is an ultra-low power DisplayPower/eDP transmitter designed
for portable devices. This driver adds initial support for RGB to eDP
mode, without HPD and interrupts.

This is a configuration usually seen in eDP applications.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/bridge/analogix/Kconfig   |  11 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
 .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.c   |   2 +-
 .../drm/bridge/analogix/analogix-i2c-dptx.h   |   8 +
 .../bridge/analogix/analogix-i2c-txcommon.h   |   3 +
 6 files changed, 869 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index ed2d05c12546..3c6ec535d361 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,3 +1,14 @@
+config DRM_ANALOGIX_ANX6345
+   tristate "Analogix ANX6345 bridge"
+   select DRM_ANALOGIX_DP_I2C
+   select DRM_KMS_HELPER
+   select REGMAP_I2C
+   help
+ ANX6345 is an ultra-low Full-HD DisplayPort/eDP
+ transmitter designed for portable devices. The
+ ANX6345 transforms the LVTTL RGB output of an
+ application processor to eDP or DisplayPort.
+
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
select DRM_ANALOGIX_DP_I2C
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index 2d523b67487d..12fed7b04e1e 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,5 +1,6 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
 analogix_dp_i2c-objs := analogix-i2c-dptx.o
+obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
 obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
new file mode 100644
index ..e275f5c9e8c4
--- /dev/null
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -0,0 +1,845 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright(c) Icenowy Zheng 
+ * Based on analogix-anx6345.c, which is:
+ *   Copyright(c) 2016, Analogix Semiconductor.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define I2C_NUM_ADDRESSES  2
+#define I2C_IDX_DPTX   0
+#define I2C_IDX_TXCOM  1
+
+#define XTAL_CLK   270 /* 27M */
+
+#define POLL_DELAY 5 /* us */
+#define POLL_TIMEOUT   500 /* us */
+
+static const u8 anx6345_i2c_addresses[] = {
+   [I2C_IDX_DPTX]  = ANALOGIX_I2C_DPTX,
+   [I2C_IDX_TXCOM] = ANALOGIX_I2C_TXCOMMON,
+};
+
+struct anx6345_platform_data {
+   struct regulator *dvdd12;
+   struct regulator *dvdd25;
+   struct gpio_desc *gpiod_reset;
+};
+
+struct anx6345 {
+   struct drm_dp_aux aux;
+   struct drm_bridge bridge;
+   struct i2c_client *client;
+   struct edid *edid;
+   struct drm_connector connector;
+   struct drm_dp_link link;
+   struct drm_panel *panel;
+   struct anx6345_platform_data pdata;
+   struct mutex lock;
+
+   /*
+* I2C Slave addresses of ANX6345 are mapped as DPTX and SYS
+*/
+   struct i2c_client *i2c_clients[I2C_NUM_ADDRESSES];
+   struct regmap *map[I2C_NUM_ADDRESSES];
+
+   u16 chipid;
+   u8 dpcd[DP_RECEIVER_CAP_SIZE];
+
+   bool powered;
+};
+
+static inline struct anx6345 *connector_to_anx6345(struct drm_connector *c)
+{
+   return container_of(c, struct anx6345, connector);
+}
+
+static inline struct anx6345 *bridge_to_anx6345(struct drm_bridge *bridge)
+{
+   return container_of(bridge, struct anx6345, bridge);
+}
+
+static int anx6345_set_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, mask);
+}
+
+static int anx6345_clear_bits(struct regmap *map, u8 reg, u8 mask)
+{
+   return regmap_update_bits(map, reg, mask, 0);
+}
+
+static ssize_t anx6345_aux_transfer(struct drm_dp_aux *aux,
+   struct drm_dp_aux_msg *msg)
+{
+   struct anx6345 *anx6345 = container_of(aux, struct anx6345, aux);
+
+   return anx_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
+}
+
+static int anx6345_dp_link_training(struct anx6345 *anx6345)
+{
+   unsigned int value;
+   u8 dp_bw;
+   int err;

[linux-sunxi] [PATCH v2 00/12] Analogix ANX6345 RGB-(e)DP bridge support

2019-02-03 Thread Vasily Khoruzhick
This patchset brings support for Analogix ANX6345 RGB-(e)DP bridge, which
is used by some Allwinner A64 laptops, such as Pinebook and Olimex
TERES-I.

It reuses some definitions from ANX78xx driver that already exists in the
kernel tree, but the driver code itself is rewritten due to significant
difference between ANX6345 and ANX78xx.

This patchset also enables the bridge on Pinebook and TERES-I and adds 1%
tolerance into dotclock check in sun4i driver in case if bridge is
connected

v2: - sort Kconfig and Makefile entries alphabetically
- remove panel supply from anx6345
- add support for panels into anx6345 driver
- add compatible and binding for generic eDP panel
- replace patch that adds 5% tolerance for dotclock check in sun4i
  driver for panel and bridges with patch that adds 1% tolerance
  in case if bridge is connected.

Icenowy Zheng (8):
  drm/bridge: move ANA78xx driver to analogix subdirectory
  drm/bridge: split some definitions of ANX78xx to dedicated headers
  drm/bridge: extract some Analogix I2C DP common code
  dt-bindings: Add ANX6345 DP/eDP transmitter binding
  drm/bridge: Add Analogix anx6345 support
  arm64: allwinner: a64: add pinmux for RGB666 LCD
  arm64: allwinner: a64: enable LCD-related hardware for Pinebook
  arm64: allwinner: a64: enable LCD-related hardware for TERES-I

Vasily Khoruzhick (4):
  drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge
is connected
  drm/panel: simple: don't fail if we don't have panel desc
  dt-bindings: add binding for generic eDP panel
  drm/panel: simple: add generic eDP panel

 .../bindings/display/bridge/anx6345.txt   |  56 ++
 .../bindings/display/panel/panel-edp.txt  |   7 +
 .../dts/allwinner/sun50i-a64-pinebook.dts |  74 ++
 .../boot/dts/allwinner/sun50i-a64-teres-i.dts |  71 +-
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |   9 +
 drivers/gpu/drm/bridge/Kconfig|  10 -
 drivers/gpu/drm/bridge/Makefile   |   4 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.h | 719 ---
 drivers/gpu/drm/bridge/analogix/Kconfig   |  25 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   4 +
 .../drm/bridge/analogix/analogix-anx6345.c| 845 ++
 .../bridge/{ => analogix}/analogix-anx78xx.c  | 146 +--
 .../drm/bridge/analogix/analogix-anx78xx.h| 265 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 
 .../drm/bridge/analogix/analogix-i2c-dptx.h   | 258 ++
 .../bridge/analogix/analogix-i2c-txcommon.h   | 240 +
 drivers/gpu/drm/panel/panel-simple.c  |  24 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c |  16 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.h|   1 +
 19 files changed, 2049 insertions(+), 894 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-edp.txt
 delete mode 100644 drivers/gpu/drm/bridge/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
 rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (90%)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 02/12] drm/bridge: split some definitions of ANX78xx to dedicated headers

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Some definitions currently in analogix-anx78xx.h are not restricted to
the ANX78xx series, but also applicable to other DisplayPort
transmitters by Analogix.

Split out them to dedicated headers, and make analogix-anx78xx.h include
them.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 .../drm/bridge/analogix/analogix-anx78xx.h| 464 +-
 .../drm/bridge/analogix/analogix-i2c-dptx.h   | 248 ++
 .../bridge/analogix/analogix-i2c-txcommon.h   | 237 +
 3 files changed, 490 insertions(+), 459 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
index 38753c870137..8aa1eca306d3 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
@@ -15,9 +15,12 @@
 #ifndef __ANX78xx_H
 #define __ANX78xx_H
 
-#define TX_P0  0x70
+#include "analogix-i2c-dptx.h"
+#include "analogix-i2c-txcommon.h"
+
+#define TX_P0  ANALOGIX_I2C_DPTX
 #define TX_P1  0x7a
-#define TX_P2  0x72
+#define TX_P2  ANALOGIX_I2C_TXCOMMON
 
 #define RX_P0  0x7e
 #define RX_P1  0x80
@@ -225,463 +228,6 @@
 #define SP_CLEAR_AVMUTEBIT(4)
 #define SP_SET_AVMUTE  BIT(0)
 
-/***/
-/* Register definition of device address 0x70  */
-/***/
-
-/* HDCP Status Register */
-#define SP_TX_HDCP_STATUS_REG  0x00
-#define SP_AUTH_FAIL   BIT(5)
-#define SP_AUTHEN_PASS BIT(1)
-
-/* HDCP Control Register 0 */
-#define SP_HDCP_CTRL0_REG  0x01
-#define SP_RX_REPEATER BIT(6)
-#define SP_RE_AUTH BIT(5)
-#define SP_SW_AUTH_OK  BIT(4)
-#define SP_HARD_AUTH_ENBIT(3)
-#define SP_HDCP_ENC_EN BIT(2)
-#define SP_BKSV_SRM_PASS   BIT(1)
-#define SP_KSVLIST_VLD BIT(0)
-/* HDCP Function Enabled */
-#define SP_HDCP_FUNCTION_ENABLED   (BIT(0) | BIT(1) | BIT(2) | BIT(3))
-
-/* HDCP Receiver BSTATUS Register 0 */
-#defineSP_HDCP_RX_BSTATUS0_REG 0x1b
-/* HDCP Receiver BSTATUS Register 1 */
-#defineSP_HDCP_RX_BSTATUS1_REG 0x1c
-
-/* HDCP Embedded "Blue Screen" Content Registers */
-#define SP_HDCP_VID0_BLUE_SCREEN_REG   0x2c
-#define SP_HDCP_VID1_BLUE_SCREEN_REG   0x2d
-#define SP_HDCP_VID2_BLUE_SCREEN_REG   0x2e
-
-/* HDCP Wait R0 Timing Register */
-#define SP_HDCP_WAIT_R0_TIME_REG   0x40
-
-/* HDCP Link Integrity Check Timer Register */
-#define SP_HDCP_LINK_CHECK_TIMER_REG   0x41
-
-/* HDCP Repeater Ready Wait Timer Register */
-#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42
-
-/* HDCP Auto Timer Register */
-#define SP_HDCP_AUTO_TIMER_REG 0x51
-
-/* HDCP Key Status Register */
-#define SP_HDCP_KEY_STATUS_REG 0x5e
-
-/* HDCP Key Command Register */
-#define SP_HDCP_KEY_COMMAND_REG0x5f
-#define SP_DISABLE_SYNC_HDCP   BIT(2)
-
-/* OTP Memory Key Protection Registers */
-#define SP_OTP_KEY_PROTECT1_REG0x60
-#define SP_OTP_KEY_PROTECT2_REG0x61
-#define SP_OTP_KEY_PROTECT3_REG0x62
-#define SP_OTP_PSW10xa2
-#define SP_OTP_PSW20x7e
-#define SP_OTP_PSW30xc6
-
-/* DP System Control Registers */
-#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1)
-/* Bits for DP System Control Register 2 */
-#define SP_CHA_STA BIT(2)
-/* Bits for DP System Control Register 3 */
-#define SP_HPD_STATUS  BIT(6)
-#define SP_STRM_VALID  BIT(2)
-/* Bits for DP System Control Register 4 */
-#define SP_ENHANCED_MODE   BIT(3)
-
-/* DP Video Control Register */
-#define SP_DP_VIDEO_CTRL_REG   0x84
-#define SP_COLOR_F_MASK0x06
-#define SP_COLOR_F_SHIFT   1
-#define SP_BPC_MASK0xe0
-#define SP_BPC_SHIFT   5
-#  define SP_BPC_6BITS 0x00
-#  define SP_BPC_8BITS 0x01
-#  define SP_BPC_10BITS0x02
-#  define SP_BPC_12BITS0x03
-
-/* DP Audio Control Register */
-#define SP_DP_AUDIO_CTRL_REG   0x87
-#define SP_AUD_EN  BIT(0)
-
-/* 10us Pulse Generate Timer Registers */
-#define SP_I2C_GEN_10US_TIMER0_REG 0x88
-#define SP_I2C_GEN_10US_TIMER1_REG 0x89
-
-/* Packet Send Control Register */
-#

[linux-sunxi] [PATCH v2 06/12] drm/sun4i: rgb: Add 1% tolerance to dclk frequency check when bridge is connected

2019-02-03 Thread Vasily Khoruzhick
Clock rate check that was added in commit bb43d40d7c83 ("drm/sun4i: rgb:
Validate the clock rate") prevents some panel and bridges from working with
sun4i driver.

Unfortunately, dotclock frequency for some modes are not achievable on
sunxi hardware, and there's a slight deviation in rate returned by
clk_round_rate(), so they fail this check.

Experiments show that panels and bridges work fine with this slight
deviation, e.g. Pinebook that uses ANX6345 bridge with 768p eDP panel
requests 73 MHz, gets 72.296MHz instead (0.96% difference) and works just
fine.

This patch adds a 1% tolerence to the dot clock check when bridge is
connected.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/sun4i/sun4i_rgb.c  | 16 ++--
 drivers/gpu/drm/sun4i/sun4i_tcon.h |  1 +
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
b/drivers/gpu/drm/sun4i/sun4i_rgb.c
index f4a22689eb54..3f04446120f6 100644
--- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
+++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
@@ -61,6 +61,7 @@ static enum drm_mode_status sun4i_rgb_mode_valid(struct 
drm_encoder *crtc,
u32 vsync = mode->vsync_end - mode->vsync_start;
unsigned long rate = mode->clock * 1000;
long rounded_rate;
+   long tolerance = 0;
 
DRM_DEBUG_DRIVER("Validating modes...\n");
 
@@ -95,10 +96,14 @@ static enum drm_mode_status sun4i_rgb_mode_valid(struct 
drm_encoder *crtc,
tcon->dclk_min_div = 6;
tcon->dclk_max_div = 127;
rounded_rate = clk_round_rate(tcon->dclk, rate);
-   if (rounded_rate < rate)
+   if (tcon->bridge)
+   /* Check against a 1% tolerance for the dot clock for bridge */
+   tolerance = rate / 100;
+
+   if (rounded_rate < (rate - tolerance))
return MODE_CLOCK_LOW;
 
-   if (rounded_rate > rate)
+   if (rounded_rate > (rate + tolerance))
return MODE_CLOCK_HIGH;
 
DRM_DEBUG_DRIVER("Clock rate OK\n");
@@ -172,7 +177,6 @@ static struct drm_encoder_funcs sun4i_rgb_enc_funcs = {
 int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon)
 {
struct drm_encoder *encoder;
-   struct drm_bridge *bridge;
struct sun4i_rgb *rgb;
int ret;
 
@@ -183,7 +187,7 @@ int sun4i_rgb_init(struct drm_device *drm, struct 
sun4i_tcon *tcon)
encoder = >encoder;
 
ret = drm_of_find_panel_or_bridge(tcon->dev->of_node, 1, 0,
- >panel, );
+ >panel, >bridge);
if (ret) {
dev_info(drm->dev, "No panel or bridge found... RGB output 
disabled\n");
return 0;
@@ -225,8 +229,8 @@ int sun4i_rgb_init(struct drm_device *drm, struct 
sun4i_tcon *tcon)
}
}
 
-   if (bridge) {
-   ret = drm_bridge_attach(encoder, bridge, NULL);
+   if (tcon->bridge) {
+   ret = drm_bridge_attach(encoder, tcon->bridge, NULL);
if (ret) {
dev_err(drm->dev, "Couldn't attach our bridge\n");
goto err_cleanup_connector;
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h 
b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index b5214d71610f..487cb070b25c 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -258,6 +258,7 @@ struct sun4i_tcon {
struct reset_control*lvds_rst;
 
struct drm_panel*panel;
+   struct drm_bridge   *bridge;
 
/* Platform adjustments */
const struct sun4i_tcon_quirks  *quirks;
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 07/12] drm/panel: simple: don't fail if we don't have panel desc

2019-02-03 Thread Vasily Khoruzhick
This is preparation for addition of generic eDP panel that
doesn't have any modes or delays defined.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/panel/panel-simple.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 9c69e739a524..2f2cb2d81f2b 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -176,7 +176,7 @@ static int panel_simple_disable(struct drm_panel *panel)
backlight_update_status(p->backlight);
}
 
-   if (p->desc->delay.disable)
+   if (p->desc && p->desc->delay.disable)
msleep(p->desc->delay.disable);
 
p->enabled = false;
@@ -195,7 +195,7 @@ static int panel_simple_unprepare(struct drm_panel *panel)
 
regulator_disable(p->supply);
 
-   if (p->desc->delay.unprepare)
+   if (p->desc && p->desc->delay.unprepare)
msleep(p->desc->delay.unprepare);
 
p->prepared = false;
@@ -220,11 +220,13 @@ static int panel_simple_prepare(struct drm_panel *panel)
 
gpiod_set_value_cansleep(p->enable_gpio, 1);
 
-   delay = p->desc->delay.prepare;
-   if (p->no_hpd)
-   delay += p->desc->delay.hpd_absent_delay;
-   if (delay)
-   msleep(delay);
+   if (p->desc) {
+   delay = p->desc->delay.prepare;
+   if (p->no_hpd)
+   delay += p->desc->delay.hpd_absent_delay;
+   if (delay)
+   msleep(delay);
+   }
 
p->prepared = true;
 
@@ -238,7 +240,7 @@ static int panel_simple_enable(struct drm_panel *panel)
if (p->enabled)
return 0;
 
-   if (p->desc->delay.enable)
+   if (p->desc && p->desc->delay.enable)
msleep(p->desc->delay.enable);
 
if (p->backlight) {
@@ -280,6 +282,9 @@ static int panel_simple_get_timings(struct drm_panel *panel,
struct panel_simple *p = to_panel_simple(panel);
unsigned int i;
 
+   if (!p->desc)
+   return 0;
+
if (p->desc->num_timings < num_timings)
num_timings = p->desc->num_timings;
 
-- 
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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] [PATCH v2 03/12] drm/bridge: extract some Analogix I2C DP common code

2019-02-03 Thread Vasily Khoruzhick
From: Icenowy Zheng 

Some code can be shared within different DP bridges by Analogix.

Extract them to a new module.

Signed-off-by: Icenowy Zheng 
Signed-off-by: Vasily Khoruzhick 
---
 drivers/gpu/drm/bridge/analogix/Kconfig   |   4 +
 drivers/gpu/drm/bridge/analogix/Makefile  |   2 +
 .../drm/bridge/analogix/analogix-anx78xx.c| 146 +--
 .../drm/bridge/analogix/analogix-i2c-dptx.c   | 169 ++
 .../drm/bridge/analogix/analogix-i2c-dptx.h   |   2 +
 5 files changed, 178 insertions(+), 145 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c

diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
b/drivers/gpu/drm/bridge/analogix/Kconfig
index c4d343a2f04d..ed2d05c12546 100644
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
@@ -1,5 +1,6 @@
 config DRM_ANALOGIX_ANX78XX
tristate "Analogix ANX78XX bridge"
+   select DRM_ANALOGIX_DP_I2C
select DRM_KMS_HELPER
select REGMAP_I2C
help
@@ -11,3 +12,6 @@ config DRM_ANALOGIX_ANX78XX
 config DRM_ANALOGIX_DP
tristate
depends on DRM
+
+config DRM_ANALOGIX_DP_I2C
+   tristate
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
b/drivers/gpu/drm/bridge/analogix/Makefile
index ce1687e60975..2d523b67487d 100644
--- a/drivers/gpu/drm/bridge/analogix/Makefile
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
@@ -1,3 +1,5 @@
 analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
+analogix_dp_i2c-objs := analogix-i2c-dptx.o
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
+obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c 
b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index f8433c93f463..bf8291d0ddd0 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -45,8 +45,6 @@
 #define I2C_IDX_RX_P1  4
 
 #define XTAL_CLK   270 /* 27M */
-#define AUX_CH_BUFFER_SIZE 16
-#define AUX_WAIT_TIMEOUT_MS15
 
 static const u8 anx78xx_i2c_addresses[] = {
[I2C_IDX_TX_P0] = TX_P0,
@@ -109,153 +107,11 @@ static int anx78xx_clear_bits(struct regmap *map, u8 
reg, u8 mask)
return regmap_update_bits(map, reg, mask, 0);
 }
 
-static bool anx78xx_aux_op_finished(struct anx78xx *anx78xx)
-{
-   unsigned int value;
-   int err;
-
-   err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_DP_AUX_CH_CTRL2_REG,
- );
-   if (err < 0)
-   return false;
-
-   return (value & SP_AUX_EN) == 0;
-}
-
-static int anx78xx_aux_wait(struct anx78xx *anx78xx)
-{
-   unsigned long timeout;
-   unsigned int status;
-   int err;
-
-   timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
-
-   while (!anx78xx_aux_op_finished(anx78xx)) {
-   if (time_after(jiffies, timeout)) {
-   if (!anx78xx_aux_op_finished(anx78xx)) {
-   DRM_ERROR("Timed out waiting AUX to finish\n");
-   return -ETIMEDOUT;
-   }
-
-   break;
-   }
-
-   usleep_range(1000, 2000);
-   }
-
-   /* Read the AUX channel access status */
-   err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_CH_STATUS_REG,
- );
-   if (err < 0) {
-   DRM_ERROR("Failed to read from AUX channel: %d\n", err);
-   return err;
-   }
-
-   if (status & SP_AUX_STATUS) {
-   DRM_ERROR("Failed to wait for AUX channel (status: %02x)\n",
- status);
-   return -ETIMEDOUT;
-   }
-
-   return 0;
-}
-
-static int anx78xx_aux_address(struct anx78xx *anx78xx, unsigned int addr)
-{
-   int err;
-
-   err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_7_0_REG,
-  addr & 0xff);
-   if (err)
-   return err;
-
-   err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_15_8_REG,
-  (addr & 0xff00) >> 8);
-   if (err)
-   return err;
-
-   /*
-* DP AUX CH Address Register #2, only update bits[3:0]
-* [7:4] RESERVED
-* [3:0] AUX_ADDR[19:16], Register control AUX CH address.
-*/
-   err = regmap_update_bits(anx78xx->map[I2C_IDX_TX_P0],
-SP_AUX_ADDR_19_16_REG,
-SP_AUX_ADDR_19_16_MASK,
-(addr & 0xf) >> 16);
-
-   if (err)
-   return err;
-
-   return 0;
-}
-
 static ssize_t anx78xx_aux_transfer(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg)

[linux-sunxi] Re: [PATCH 9/9] [DO NOT MERGE] drm/sun4i: rgb: Add 5% tolerance to dot clock frequency check

2019-02-02 Thread Vasily Khoruzhick
On Thu, Oct 18, 2018 at 4:31 AM Laurent Pinchart
 wrote:

> Given that the tolerance is a property of the panel or bridge, I agree with
> Daniel that it should be implemented there, or at least in cooperation with
> drm_panel and drm_bridge.

Clock tolerance is not specified in ANX6345 datasheet.

> Semi-related information, I think the CEA and VESA standards allow a 0.5%
> clock tolerance. What is the maximum clock frequency deviation required for
> this platform ?

This particular platform requires ~1% deviation.

E.g. on Pinebook with 768p panel: requested clock: 73.0 MHz, real
clock: 72.296296 MHz (0.96%)
on Pinebook with 1080p panel: requested clock: 138.5 MHz, real clock:
138.461538 MHz (0.03%)

So unfortunately 0.5% is not enough.

Regards,
Vasily

-- 
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] Re: [PATCH v3 9/9] arm: dts: sunxi: Enumerate MMC2 as MMC1

2019-01-21 Thread Vasily Khoruzhick
On Mon, Jan 21, 2019 at 8:24 PM Vasily Khoruzhick  wrote:
>
> For me it shows:
>
> => mmc list
> mmc@1c0f000: 0 (SD)
> mmc@1c1: 1
> mmc@1c11000: 2
>
> I'm testing this patches applied onto u-boot-sunxi/master on Pinebook.
> I tried 'distclean', and it doesn't help.

Looks like eMMC is here but it doesn't get renumbered:

=> mmc dev 2
switch to partitions #0, OK
mmc2(part 0) is current device
=> mmc info
Device: mmc@1c11000
Manufacturer ID: 15
OEM: 100
Name: AJTD4
Bus Speed: 5200
Mode : MMC High Speed (52MHz)
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 14.6 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 14.6 GiB WRREL
Boot Capacity: 4 MiB ENH
RPMB Capacity: 4 MiB ENH
=> mmc list
mmc@1c0f000: 0
mmc@1c1: 1
mmc@1c11000: 2 (eMMC)

-- 
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] Re: [PATCH v3 9/9] arm: dts: sunxi: Enumerate MMC2 as MMC1

2019-01-21 Thread Vasily Khoruzhick
On Mon, Jan 21, 2019 at 7:46 AM Jagan Teki  wrote:
>
> On Mon, Jan 21, 2019 at 9:08 PM Vasily Khoruzhick  wrote:
>scanning usb for storage devices... 0 Storage Device(s) found
> Hit any key to stop autoboot:  0
> =>
> =>
> => mmc list
> mmc@1c0f000: 0
> mmc@1c1: 2
> mmc@1c11000: 1 (eMMC)
> => mmc dev 0
> switch to partitions #0, OK
> mmc0 is current device
> => mmc list
> mmc@1c0f000: 0 (SD)
> mmc@1c1: 2
> mmc@1c11000: 1 (eMMC)

For me it shows:

=> mmc list
mmc@1c0f000: 0 (SD)
mmc@1c1: 1
mmc@1c11000: 2

I'm testing this patches applied onto u-boot-sunxi/master on Pinebook.
I tried 'distclean', and it doesn't 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.
For more options, visit https://groups.google.com/d/optout.


[linux-sunxi] Re: [PATCH v3 9/9] arm: dts: sunxi: Enumerate MMC2 as MMC1

2019-01-21 Thread Vasily Khoruzhick
On Mon, Jan 21, 2019 at 2:32 AM Jagan Teki  wrote:
>
> Environment and fastboot MMC devices are configured based number
> of mmc slots defined on particular board in sunxi platform.
>
> If number of slots are not more than 1, it assigns 0 which usually mmc
> device on SD slot. With DM_MMC it is detected as 0 since mmc0 node always
> be an mmc device.
>
> If number of slots are more than 1, it assigns 1 which assumes 0 is mmc
> device and 1 is emmc device. But with DM_MMC there is chance of detecting
> emmc as device 2 since mmc1 is SDIO as per devicetree definition.
>
> So override mmc2 to mmc1 in sunxi dtsi, this will eventually detect mmc2
> as mmc 1 device even if the board dts has mmc0, mmc1, mmc2.

It doesn't work on Pinebook - where we have mmc0 (SD card), mmc1
(SDIO), mmc2 (eMMC). It still enumerates mmc2 as mmc2.

> Some platforms like A20 has mmc0...mmc3, but there is no usecases now for
> enabling all mmc controllers in any of A20 board dts files.
>
> Signed-off-by: Jagan Teki 
> ---
>  arch/arm/dts/sunxi-u-boot.dtsi | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
> index 8a9f2a6417..fdd4c80aa4 100644
> --- a/arch/arm/dts/sunxi-u-boot.dtsi
> +++ b/arch/arm/dts/sunxi-u-boot.dtsi
> @@ -1,6 +1,10 @@
>  #include 
>
>  / {
> +   aliases {
> +   mmc1 = 
> +   };
> +
> binman {
> filename = "u-boot-sunxi-with-spl.bin";
> pad-byte = <0xff>;
> --
> 2.18.0.321.gffc6fa0e3
>

-- 
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] Re: [PATCH 0/9] sunxi: enable DM_MMC

2019-01-19 Thread Vasily Khoruzhick
On Sat, Jan 19, 2019 at 12:35 PM André Przywara  wrote:

> Thanks for the report! So is this with this U-Boot on an SD card or on
> the eMMC?

This is with u-boot on eMMC and no SD card present in the slot.

> Can you try to add the mmc1 =  alias that Jagan suggested:
> https://lists.denx.de/pipermail/u-boot/2019-January/354367.html

It didn't help.

> Thanks,
> Andre.
>
> > Regards,
> > Vasily
> >
> >> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> >> driver model compliant way, borrowing two patches from him.
> >>
> >> Cheers,
> >> Andre.
> >>
> >> Andre Przywara (7):
> >>   sunxi: clk: add MMC gates/resets
> >>   sunxi: clk: A80: add MMC clock support
> >>   mmc: sunxi: Add DM clk and reset support
> >>   mmc: sunxi: Add H6 support
> >>   mmc: sunxi: Add A80 support
> >>   mmc: sunxi: Honour non-removable property in DT
> >>   mmc: sunxi: Mark end of DM_MMC #ifdefs
> >>
> >> Jagan Teki (2):
> >>   mmc: sunxi: Add missing compatible strings
> >>   arm: sunxi: Enable DM_MMC
> >>
> >>  arch/arm/Kconfig  |  1 +
> >>  arch/arm/mach-sunxi/Kconfig   |  1 -
> >>  configs/Linksprite_pcDuino3_defconfig |  1 -
> >>  drivers/clk/sunxi/clk_a10.c   |  4 +++
> >>  drivers/clk/sunxi/clk_a10s.c  |  3 ++
> >>  drivers/clk/sunxi/clk_a23.c   |  6 
> >>  drivers/clk/sunxi/clk_a31.c   |  8 +
> >>  drivers/clk/sunxi/clk_a64.c   |  6 
> >>  drivers/clk/sunxi/clk_a80.c   | 28 -
> >>  drivers/clk/sunxi/clk_a83t.c  |  6 
> >>  drivers/clk/sunxi/clk_h3.c|  6 
> >>  drivers/clk/sunxi/clk_h6.c|  6 
> >>  drivers/clk/sunxi/clk_r40.c   |  8 +
> >>  drivers/mmc/sunxi_mmc.c   | 59 
> >> +--
> >>  14 files changed, 131 insertions(+), 12 deletions(-)
> >>
> >> --
> >> 2.14.5
> >>
>

-- 
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] Re: [PATCH 0/9] sunxi: enable DM_MMC

2019-01-19 Thread Vasily Khoruzhick
On Fri, Jan 18, 2019 at 5:32 PM Andre Przywara  wrote:
>
> This series enables the Allwinner MMC driver to drive all SoCs with its
> DM_MMC variant. We use the gates clock and reset support from the new
> clock driver, but keep the actual mod clock in its somewhat hackish
> state. Properly supporting this via the clock driver is a bit more work.
> The per-compatible variant struct for now only holds the mod clock
> address (which will go away), but we will need the struct later again
> for the various timing modes.
>
> This allows us to eventually enable DM_MMC for all SoCs, and get rid of
> the nasty deprecation warning.
>
> The first patch adds the MMC clock gates and resets to the clock driver.
> Patch 2/9 adds support for the A80 MMC config clock, which is a bit
> special. I can't test this, so please give this a try if you have a board.
>
> Patch 3 uses the new clocks in the MMC driver, the following three patches
> add the remaining compatible strings along with their required mod clock
> addresses.
>
> Patch 7 fixes the Pine64-LTS board, while patch 8 eventually enables
> everything. Patch 9 is some comment fix to make it easier to reason
> about what part of the driver is for DM_MMC and which is not.
>
> I successfully compiled the HEAD for all 142 Allwinner boards, also
> compiled all patches for selected boards.
>
> This was briefly tested on Pine-H64 (H6), Pine64-LTS (A64), OrangePi PC 2
> (H5), OrangePi Zero (H2+) and BananaPi-M1 (A20).
>
> Please run it on every board that you can get hold of to give this series
> a good shake.
>
> This goes on top of current sunxi/master (543049ab5906) and is available
> on https://github.com/apritzel/u-boot/commits/sunxi-dm.

It breaks autoboot for eMMC on Pinebook.

It complains:

Card did not respond to voltage select!
MMC: no card present

Card itself is present, i.e. if I do these command I see card info:

mmc dev 2
mmc info

Regards,
Vasily

> This replaces Jagan's v2 series "mmc: sunxi: Enable DM_MMC" in a more
> driver model compliant way, borrowing two patches from him.
>
> Cheers,
> Andre.
>
> Andre Przywara (7):
>   sunxi: clk: add MMC gates/resets
>   sunxi: clk: A80: add MMC clock support
>   mmc: sunxi: Add DM clk and reset support
>   mmc: sunxi: Add H6 support
>   mmc: sunxi: Add A80 support
>   mmc: sunxi: Honour non-removable property in DT
>   mmc: sunxi: Mark end of DM_MMC #ifdefs
>
> Jagan Teki (2):
>   mmc: sunxi: Add missing compatible strings
>   arm: sunxi: Enable DM_MMC
>
>  arch/arm/Kconfig  |  1 +
>  arch/arm/mach-sunxi/Kconfig   |  1 -
>  configs/Linksprite_pcDuino3_defconfig |  1 -
>  drivers/clk/sunxi/clk_a10.c   |  4 +++
>  drivers/clk/sunxi/clk_a10s.c  |  3 ++
>  drivers/clk/sunxi/clk_a23.c   |  6 
>  drivers/clk/sunxi/clk_a31.c   |  8 +
>  drivers/clk/sunxi/clk_a64.c   |  6 
>  drivers/clk/sunxi/clk_a80.c   | 28 -
>  drivers/clk/sunxi/clk_a83t.c  |  6 
>  drivers/clk/sunxi/clk_h3.c|  6 
>  drivers/clk/sunxi/clk_h6.c|  6 
>  drivers/clk/sunxi/clk_r40.c   |  8 +
>  drivers/mmc/sunxi_mmc.c   | 59 
> +--
>  14 files changed, 131 insertions(+), 12 deletions(-)
>
> --
> 2.14.5
>

-- 
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.