drm bridge control from another driver

2019-02-11 Thread Vinay Simha B N
hi,

is it possible to control the drm bridge from another driver in irq
handler(enable/disable the bridge)?

is there a way to control the "dpms force off" and "dpms force on" in the
interrupt handler?

-- 
regards,
vinaysimha
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH -next] drivers/video/fbdev: remove set but not used variable 'size'

2019-02-11 Thread Michael Ellerman
Bartlomiej Zolnierkiewicz  writes:
> On 10/17/2018 01:52 AM, Michael Ellerman wrote:
>> YueHaibing  writes:
>> 
>>> Fixes gcc '-Wunused-but-set-variable' warning:
>>>
>>> drivers/video/fbdev/chipsfb.c: In function 'chipsfb_pci_init':
>>> drivers/video/fbdev/chipsfb.c:352:22: warning:
>>>  variable 'size' set but not used [-Wunused-but-set-variable]
>>>
>>> It not used any more after commit
>>> 8c8709334cec ("[PATCH] ppc32: Remove CONFIG_PMAC_PBOOK")
>>>
>>> Signed-off-by: YueHaibing 
>>> ---
>>>  drivers/video/fbdev/chipsfb.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> Looks good, thanks.
>> 
>> Should I merge this? Or otherwise:
>> 
>> Acked-by: Michael Ellerman 
>
> I've queued the patch to fbdev tree for v5.1 w/ slightly modified patch
> summary ("fbdev: chipsfb: ...") add patch description (use Fixes: tag),
> thanks.

Thanks.

cheers
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH RESEND] drm: panel-orientation-quirks: Add quirk for Lenovo Ideapad D330

2019-02-11 Thread David Santamaría Rogado
Lenovo Ideapad D330 Pentium CPU version has 1920x1200 LCD. Console
ouput gets rotated at boot as Miix 310.

Signed-off-by: David Santamaría Rogado 
---
 drivers/gpu/drm/drm_panel_orientation_quirks.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c
b/drivers/gpu/drm/drm_panel_orientation_quirks.c
index 52e445bb1aa58..521aff99b08a6 100644
--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -80,6 +80,12 @@ static const struct drm_dmi_panel_orientation_data
lcd800x1280_rightside_up = {
  .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
 };

+static const struct drm_dmi_panel_orientation_data
lcd1200x1920_rightside_up = {
+ .width = 1200,
+ .height = 1920,
+ .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
+};
+
 static const struct dmi_system_id orientation_data[] = {
  { /* Acer One 10 (S1003) */
  .matches = {
@@ -148,6 +154,13 @@ static const struct dmi_system_id orientation_data[] = {
   DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
  },
  .driver_data = (void *)&lcd800x1280_rightside_up,
+ }, { /* Lenovo Ideapad D330 */
+ .matches = {
+  DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+  DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "81H3"),
+  DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"),
+ },
+ .driver_data = (void *)&lcd1200x1920_rightside_up,
  }, { /* VIOS LTH17 */
  .matches = {
   DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v8 3/7] mm, devm_memremap_pages: Fix shutdown handling

2019-02-11 Thread Krzysztof Grygiencz

Dear Sir,

I'm using ArchLinux distribution. After kernel upgrade form 4.19.14 to 
4.19.15 my X environment stopped working. I have AMD HD3300 (RS780D) 
graphics card. I have bisected kernel and found a failing commit:


https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v4.19.20&id=ec5471c92fb29ad848c81875840478be201eeb3f

I'm attaching Xorg.0.log file

Best Regards
Krzysztof Grygiencz
[22.027] 
X.Org X Server 1.20.3
X Protocol Version 11, Revision 0
[22.027] Build Operating System: Linux Arch Linux
[22.027] Current Operating System: Linux h4xxx 4.19.15-1-lts #1 SMP Sun Jan 13 13:53:52 CET 2019 x86_64
[22.027] Kernel command line: BOOT_IMAGE=../vmlinuz-linux-lts root=UUID=a6e22cbe-f0cd-4efc-b9c2-c9fe90e829d3 rw quiet loglevel=3 rd.systemd.show_status=auto rd.udev.log-priority=3 vt.global_cursor_default=0 net.ifnames=0 initrd=../initramfs-linux-lts.img
[22.027] Build Date: 25 October 2018  04:42:32PM
[22.027]  
[22.027] Current version of pixman: 0.36.0
[22.027] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[22.027] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[22.027] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Jan 15 17:37:23 2019
[22.027] (==) Using config directory: "/etc/X11/xorg.conf.d"
[22.027] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[22.028] (==) No Layout section.  Using the first Screen section.
[22.028] (==) No screen section available. Using defaults.
[22.028] (**) |-->Screen "Default Screen Section" (0)
[22.028] (**) |   |-->Monitor ""
[22.028] (==) No monitor specified for screen "Default Screen Section".
	Using a default monitor configuration.
[22.028] (==) Automatically adding devices
[22.028] (==) Automatically enabling devices
[22.028] (==) Automatically adding GPU devices
[22.028] (==) Automatically binding GPU devices
[22.028] (==) Max clients allowed: 256, resource mask: 0x1f
[22.028] (==) FontPath set to:
	/usr/share/fonts/misc,
	/usr/share/fonts/TTF,
	/usr/share/fonts/OTF,
	/usr/share/fonts/Type1,
	/usr/share/fonts/100dpi,
	/usr/share/fonts/75dpi
[22.028] (==) ModulePath set to "/usr/lib/xorg/modules"
[22.028] (II) The server relies on udev to provide the list of input devices.
	If no devices become available, reconfigure udev or disable AutoAddDevices.
[22.028] (II) Module ABI versions:
[22.028] 	X.Org ANSI C Emulation: 0.4
[22.028] 	X.Org Video Driver: 24.0
[22.028] 	X.Org XInput driver : 24.1
[22.028] 	X.Org Server Extension : 10.0
[22.029] (++) using VT number 7

[22.029] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[22.031] (--) PCI:*(1@0:5:0) 1002:9614:1043:834d rev 0, Mem @ 0xd000/268435456, 0xfe0f/65536, 0xfdf0/1048576, I/O @ 0xc000/256, BIOS @ 0x/131072
[22.032] (II) Open ACPI successful (/var/run/acpid.socket)
[22.032] (II) LoadModule: "glx"
[22.032] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[22.034] (II) Module glx: vendor="X.Org Foundation"
[22.034] 	compiled for 1.20.3, module version = 1.0.0
[22.034] 	ABI class: X.Org Server Extension, version 10.0
[22.034] (==) Matched ati as autoconfigured driver 0
[22.034] (==) Matched modesetting as autoconfigured driver 1
[22.034] (==) Matched fbdev as autoconfigured driver 2
[22.034] (==) Matched vesa as autoconfigured driver 3
[22.034] (==) Assigned the driver to the xf86ConfigLayout
[22.034] (II) LoadModule: "ati"
[22.034] (II) Loading /usr/lib/xorg/modules/drivers/ati_drv.so
[22.034] (II) Module ati: vendor="X.Org Foundation"
[22.034] 	compiled for 1.20.1, module version = 18.1.0
[22.034] 	Module class: X.Org Video Driver
[22.034] 	ABI class: X.Org Video Driver, version 24.0
[22.034] (II) LoadModule: "radeon"
[22.034] (II) Loading /usr/lib/xorg/modules/drivers/radeon_drv.so
[22.035] (II) Module radeon: vendor="X.Org Foundation"
[22.035] 	compiled for 1.20.1, module version = 18.1.0
[22.035] 	Module class: X.Org Video Driver
[22.035] 	ABI class: X.Org Video Driver, version 24.0
[22.035] (II) LoadModule: "modesetting"
[22.035] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[22.035] (II) Module modesetting: vendor="X.Org Foundation"
[22.035] 	compiled for 1.20.3, module version = 1.20.3
[22.035] 	Module class: X.Org Video Driver
[22.035] 	ABI class: X.Org Video Driver, version 24.0
[22.035] (II) LoadModule: "fbdev"
[22.035] (WW) Warning, couldn't open module fbdev
[22.035] (EE) Failed to load module "fbdev" (module does not exist, 0)
[22.035] (II) LoadModule: "vesa"
[22.035] (WW) Warning, couldn

Re: [PATCH v2 2/2] drm/drv: drm_dev_unplug(): Move out drm_dev_put() call

2019-02-11 Thread Daniel Vetter
On Fri, Feb 08, 2019 at 03:01:03PM +0100, Noralf Trønnes wrote:
> This makes it possible to use drm_dev_unplug() with the upcoming
> devm_drm_dev_init() which will do drm_dev_put() in its release callback.
> 
> Cc: Alex Deucher 
> Cc: Christian König 
> Cc: David (ChunMing) Zhou 
> Cc: Dave Airlie 
> Cc: Sean Paul 
> Cc: Oleksandr Andrushchenko 
> Cc: Daniel Vetter 
> Signed-off-by: Noralf Trønnes 

Reviewed-by: Daniel Vetter 

> ---
> 
> I will take this through drm-misc-next.
> 
> Noralf.
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 +
>  drivers/gpu/drm/drm_drv.c   | 1 -
>  drivers/gpu/drm/udl/udl_drv.c   | 1 +
>  drivers/gpu/drm/xen/xen_drm_front.c | 1 +
>  4 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index a1bb3773087b..d1f37ba3c118 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -971,6 +971,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)
>  
>   DRM_ERROR("Device removal is currently not supported outside of 
> fbcon\n");
>   drm_dev_unplug(dev);
> + drm_dev_put(dev);
>   pci_disable_device(pdev);
>   pci_set_drvdata(pdev, NULL);
>  }
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 05bbc2b622fc..b04982101fcb 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -376,7 +376,6 @@ void drm_dev_unplug(struct drm_device *dev)
>   synchronize_srcu(&drm_unplug_srcu);
>  
>   drm_dev_unregister(dev);
> - drm_dev_put(dev);
>  }
>  EXPORT_SYMBOL(drm_dev_unplug);
>  
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index 22cd2d13e272..53b7b8c04bc6 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -107,6 +107,7 @@ static void udl_usb_disconnect(struct usb_interface 
> *interface)
>   udl_fbdev_unplug(dev);
>   udl_drop_usb(dev);
>   drm_dev_unplug(dev);
> + drm_dev_put(dev);
>  }
>  
>  /*
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c 
> b/drivers/gpu/drm/xen/xen_drm_front.c
> index 3e78a832d7f9..84aa4d61dc42 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -582,6 +582,7 @@ static void xen_drm_drv_fini(struct xen_drm_front_info 
> *front_info)
>  
>   drm_kms_helper_poll_fini(dev);
>   drm_dev_unplug(dev);
> + drm_dev_put(dev);
>  
>   front_info->drm_info = NULL;
>  
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/doc: Remove solved KMS cleanup task

2019-02-11 Thread Daniel Vetter
On Fri, Feb 08, 2019 at 05:53:12PM -0200, Shayenne Moura wrote:
> Remove KMS cleanup task from documentation solved by patchset
> https://patchwork.freedesktop.org/series/54310/
> 
> Signed-off-by: Shayenne Moura 

Thanks for your patch, applied to drm-misc-next.
-Daniel

> ---
>  Documentation/gpu/todo.rst | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
> index cda4a37a02f0..159a4aba49e6 100644
> --- a/Documentation/gpu/todo.rst
> +++ b/Documentation/gpu/todo.rst
> @@ -398,10 +398,6 @@ KMS cleanups
>  
>  Some of these date from the very introduction of KMS in 2008 ...
>  
> -- drm_display_mode doesn't need to be derived from drm_mode_object. That's
> -  leftovers from older (never merged into upstream) KMS designs where modes
> -  where set using their ID, including support to add/remove modes.
> -
>  - Make ->funcs and ->helper_private vtables optional. There's a bunch of 
> empty
>function tables in drivers, but before we can remove them we need to make 
> sure
>that all the users in helpers and drivers do correctly check for a NULL
> -- 
> 2.17.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v12 01/38] drm/doc: document recommended component helper usage

2019-02-11 Thread Daniel Vetter
On Sat, Feb 09, 2019 at 12:42:30PM +0530, Ramalingam C wrote:
> From: Daniel Vetter 
> 
> Now that component has docs it's worth spending a few words and
> hyperlinks on recommended best practices in drm.
> 
> Cc: Russell King - ARM Linux admin 
> Signed-off-by: Daniel Vetter 

Just a quick reminder: When sending out other people's patches, you need
to add your own s-o-b line per https://developercertificate.org/

Cheers, Daniel

> ---
>  Documentation/driver-api/component.rst |  2 ++
>  Documentation/gpu/drm-internals.rst|  5 +
>  drivers/gpu/drm/drm_drv.c  | 14 ++
>  3 files changed, 21 insertions(+)
> 
> diff --git a/Documentation/driver-api/component.rst 
> b/Documentation/driver-api/component.rst
> index 2da4a8f20607..57e37590733f 100644
> --- a/Documentation/driver-api/component.rst
> +++ b/Documentation/driver-api/component.rst
> @@ -1,3 +1,5 @@
> +.. _component:
> +
>  ==
>  Component Helper for Aggregate Drivers
>  ==
> diff --git a/Documentation/gpu/drm-internals.rst 
> b/Documentation/gpu/drm-internals.rst
> index 3ae23a5454ac..966bd2d9f0cc 100644
> --- a/Documentation/gpu/drm-internals.rst
> +++ b/Documentation/gpu/drm-internals.rst
> @@ -93,6 +93,11 @@ Device Instance and Driver Handling
>  Driver Load
>  ---
>  
> +Component Helper Usage
> +~~
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_drv.c
> +   :doc: component helper usage recommendations
>  
>  IRQ Helper Library
>  ~~
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 381581b01d48..aae413003705 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -457,6 +457,20 @@ static void drm_fs_inode_free(struct inode *inode)
>  }
>  
>  /**
> + * DOC: component helper usage recommendations
> + *
> + * DRM drivers that drive hardware where a logical device consists of a pile 
> of
> + * independent hardware blocks are recommended to use the :ref:`component 
> helper
> + * library`. The entire device initialization procedure should be 
> run
> + * from the &component_master_ops.master_bind callback, starting with
> + * drm_dev_init(), then binding all components with component_bind_all() and
> + * finishing with drm_dev_register(). For consistency and easier sharing of
> + * components across drivers the opaque pointer passed to all components 
> through
> + * component_bind_all() should point at &struct drm_device of the device
> + * instance, not some driver specific private structure.
> + */
> +
> +/**
>   * drm_dev_init - Initialise new DRM device
>   * @dev: DRM device
>   * @driver: DRM driver
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: drm bridge control from another driver

2019-02-11 Thread Andrzej Hajda
On 11.02.2019 07:52, Vinay Simha B N wrote:
> hi,
>
> is it possible to control the drm bridge from another driver in irq
> handler(enable/disable the bridge)?


If you mean 'in irq context' the answer is no, usually enable/disable
callbacks can sleep, so cannot be called from atomic context.


>
> is there a way to control the "dpms force off" and "dpms force on" in
> the interrupt handler?


Could you elaborate more on both subjects.


Regards

Andrzej


>
> -- 
> regards,
> vinaysimha
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm: Add basic helper to allow precise pageflip timestamps in vrr.

2019-02-11 Thread Daniel Vetter
On Mon, Feb 11, 2019 at 04:22:24AM +0100, Mario Kleiner wrote:
> The pageflip completion timestamps transmitted to userspace
> via pageflip completion events are supposed to describe the
> time at which the first pixel of the new post-pageflip scanout
> buffer leaves the video output of the gpu. This time is
> identical to end of vblank, when active scanout starts.
> 
> For a crtc in standard fixed refresh rate, the end of vblank
> is identical to the vblank timestamps calculated by
> drm_update_vblank_count() at each vblank interrupt, or each
> vblank dis-/enable. Therefore pageflip events just carry
> that vblank timestamp as their pageflip timestamp.
> 
> For a crtc switched to variable refresh rate mode (vrr), the
> pageflip completion timestamps are identical to the vblank
> timestamps iff the pageflip was executed early in vblank,
> before the minimum vblank duration elapsed. In this case
> the time of display onset is identical to when the crtc
> is running in fixed refresh rate.
> 
> However, if a pageflip completes later in the vblank, inside
> the "extended front porch" in vrr mode, then the vblank will
> terminate at a fixed (back porch) duration after flip, so
> the display onset time is delayed correspondingly. In this
> case the vblank timestamp computed at vblank irq time would
> be too early, and we need a way to calculate an estimated
> pageflip timestamp that will be later than the vblank timestamp.
> 
> How a driver determines such a "late flip" timestamp is hw
> and driver specific, but this patch adds a new helper function
> that allows the driver to propose such an alternate "late flip"
> timestamp for use in pageflip events:
> 
> drm_crtc_set_vrr_pageflip_timestamp(crtc, flip_timestamp);
> 
> When sending out pageflip events, we now compare that proposed
> flip_timestamp against the vblank timestamp of the current
> vblank of flip completion and choose to send out the greater/
> later timestamp as flip completion timestamp.
> 
> The most simple way for a kms driver to supply a suitable
> flip_timestamp in vrr mode would be to simply take a timestamp
> at start of the pageflip completion handler, e.g., pageflip
> irq handler: flip_timestamp = ktime_get(); and then set that
> as proposed "late" alternative timestamp via ...
> drm_crtc_set_vrr_pageflip_timestamp(crtc, flip_timestamp);
> 
> More clever approaches could try to add some corrective offset
> for fixed back porch duration, or ideally use hardware features
> like hw timestamps to calculate the exact end time of vblank.
> 
> Signed-off-by: Mario Kleiner 
> Cc: Nicholas Kazlauskas 
> Cc: Harry Wentland 
> Cc: Alex Deucher 

Uh, this looks like a pretty bad hack. Can't we fix amdgpu to only give us
the right timestampe, once? With this I guess if you do a vblank query in
between the wrong and the right vblank you'll get the bogus value. Not
really great for userspace.
-Daniel

> ---
>  drivers/gpu/drm/drm_vblank.c | 49 +++-
>  include/drm/drm_vblank.h |  8 ++
>  2 files changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 98e091175921..4b3a4c38fabe 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -814,10 +814,21 @@ static void send_vblank_event(struct drm_device *dev,
>   u64 seq, ktime_t now)
>  {
>   struct timespec64 tv;
> + ktime_t alt_flip_time;
>  
>   switch (e->event.base.type) {
> - case DRM_EVENT_VBLANK:
>   case DRM_EVENT_FLIP_COMPLETE:
> + /*
> +  * For flip completion events, override "now" time
> +  * with alt_flip_time provided by the driver via
> +  * drm_crtc_set_vrr_pageflip_timestamp() in VRR mode
> +  * if that time is later than given "now" vblank time.
> +  */
> + alt_flip_time = dev->vblank[e->pipe].alt_flip_time;
> + if (alt_flip_time > now)
> + now = alt_flip_time;
> + /* Fallthrough */
> + case DRM_EVENT_VBLANK:
>   tv = ktime_to_timespec64(now);
>   e->event.vbl.sequence = seq;
>   /*
> @@ -916,11 +927,47 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
>  
>   now = ktime_get();
>   }
> +
>   e->pipe = pipe;
>   send_vblank_event(dev, e, seq, now);
>  }
>  EXPORT_SYMBOL(drm_crtc_send_vblank_event);
>  
> +/**
> + * drm_crtc_set_vrr_pageflip_timestamp - helper to set alternate pageflip 
> time
> + * @crtc: the source CRTC of the pageflip completion event
> + * @flip_time: The alternate pageflip completion timestamp in VRR mode
> + *
> + * In variable refresh rate mode (VRR), a pageflip completion timestamp 
> carried
> + * by the pageflip event can never be earlier than the vblank timestamp of 
> the
> + * vblank of flip completion, as that vblank timestamp defines the end of the
> + * shortest possible vblank duration. In cas

Re: drm bridge control from another driver

2019-02-11 Thread Daniel Vetter
On Mon, Feb 11, 2019 at 09:32:54AM +0100, Andrzej Hajda wrote:
> On 11.02.2019 07:52, Vinay Simha B N wrote:
> > hi,
> >
> > is it possible to control the drm bridge from another driver in irq
> > handler(enable/disable the bridge)?
> 
> 
> If you mean 'in irq context' the answer is no, usually enable/disable
> callbacks can sleep, so cannot be called from atomic context.
> 
> 
> >
> > is there a way to control the "dpms force off" and "dpms force on" in
> > the interrupt handler?
> 
> 
> Could you elaborate more on both subjects.

Yeah, please explain what you want to use this for. dpms on/off is
controlled by userspace, the kernel should not change that state behind
usersapce's back. If this is for some manuel refresh display, then that's
a bit a different story ofc, but for that you don't want to do a real dpms
force off/on.
-Daniel
> 
> 
> Regards
> 
> Andrzej
> 
> 
> >
> > -- 
> > regards,
> > vinaysimha
> >
> > ___
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 202555] New: nouveau: KMS is broken on last kernels (9700M GT)

2019-02-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=202555

Bug ID: 202555
   Summary: nouveau: KMS is broken on last kernels (9700M GT)
   Product: Drivers
   Version: 2.5
Kernel Version: 4.11-4.20
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Video(DRI - non Intel)
  Assignee: drivers_video-...@kernel-bugs.osdl.org
  Reporter: kurnev...@gmail.com
Regression: No

Created attachment 281097
  --> https://bugzilla.kernel.org/attachment.cgi?id=281097&action=edit
dmesg logs from different kernels

I have KMS broken on my laptop Acer Aspire 8930G after upgrading from 4.10.13
to 4.11.2 kernel (also checked 4.11.9, the last version 4.20.7 and some
versions between). With kernel parameter 'nouveau.modeset=0' it boots fine.
Here is a picture how it looks on the screen after modeset:
https://imgur.com/a/kr3rbFJ

Laptops's lspci:

00:00.0 Host bridge: Intel Corporation Mobile 4 Series Chipset Memory
Controller Hub (rev 07)
00:01.0 PCI bridge: Intel Corporation Mobile 4 Series Chipset PCI Express
Graphics Port (rev 07)
00:1a.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #5 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI
Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio
Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1
(rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2
(rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4
(rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5
(rev 03)
00:1d.0 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #2 (rev 03)
00:1d.2 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #3 (rev 03)
00:1d.3 USB controller: Intel Corporation 82801I (ICH9 Family) USB UHCI
Controller #6 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI
Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev 93)
00:1f.0 ISA bridge: Intel Corporation ICH9M LPC Interface Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801IBM/IEM (ICH9M/ICH9M-E) 4 port
SATA Controller [AHCI mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 03)
00:1f.6 Signal processing controller: Intel Corporation 82801I (ICH9 Family)
Thermal Subsystem (rev 03)
01:00.0 VGA compatible controller: NVIDIA Corporation G96M [GeForce 9700M GT]
(rev a1)
02:00.0 Ethernet controller: Qualcomm Atheros AR8121/AR8113/AR8114 Gigabit or
Fast Ethernet (rev b0)
05:00.0 Network controller: Intel Corporation WiFi Link 5100

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 45/49] drm/omap: Add support for drm_bridge

2019-02-11 Thread Tomi Valkeinen
On 08/02/2019 17:20, Laurent Pinchart wrote:
> Hi Tomi,
> 
> On Fri, Jan 18, 2019 at 12:33:03PM +0200, Tomi Valkeinen wrote:
>> On 11/01/19 05:51, Laurent Pinchart wrote:
>>> Hook up drm_bridge support in the omapdrm driver. Despite the recent
>>> extensive preparation work, this is a rather intrusive change, as the
>>> management of outputs needs to be adapted through the driver to handle
>>> both omap_dss_device and drm_bridge.
>>>
>>> Connector creation is skipped when using a drm_bridge, as the bridge
>>> creates the connector internally. This creates issues with systems that
>>> split connector operations (such as modes retrieval and hot-plug
>>> detection) across different bridges. These systems can't be supported
>>> using drm_bridge for now (their support through the omap_dss_device
>>> infrastructure is not affected), this will be fixed in subsequent
>>> changes.
>>>
>>> Signed-off-by: Laurent Pinchart 
>>> Reviewed-by: Sebastian Reichel 
>>
>> 
>>
>>> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
>>> b/drivers/gpu/drm/omapdrm/dss/output.c
>>> index f25ecfd26534..2a53025c2fde 100644
>>> --- a/drivers/gpu/drm/omapdrm/dss/output.c
>>> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
>>> @@ -20,25 +20,34 @@
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>>  
>>>  #include "dss.h"
>>>  #include "omapdss.h"
>>>  
>>>  int omapdss_device_init_output(struct omap_dss_device *out)
>>>  {
>>> -   out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
>>> -   if (IS_ERR(out->next)) {
>>> -   if (PTR_ERR(out->next) != -EPROBE_DEFER)
>>> -   dev_err(out->dev, "failed to find video sink\n");
>>> -   return PTR_ERR(out->next);
>>> +   struct device_node *remote_node;
>>> +
>>> +   remote_node = of_graph_get_remote_node(out->dev->of_node, 0, 0);
>>> +   if (!remote_node) {
>>> +   dev_dbg(out->dev, "failed to find video sink\n");
>>> +   return 0;
>>> }
>>
>> This breaks boards that have displays/bridges connected to ports above
>> 0. For example, DPI output has 3 ports on some SoCs.
> 
> Does it break them, or are they already broken ?

Good point. It's very well possible it was already broken. It worked in
4.14, that I know =). That didn't have
omapdss_of_find_connected_device() yet. So possibly it's
27d624527d99265c2df999af3615ff71c29d06f4 that breaks it.

I think we don't have many boards that use non-0 port for DPI. The one I
have, DRA71 EVM, doesn't have mainline support, and I have only ran it
on 4.14 before this.

And OMAP3 SDI uses port 1, but it handles this one specifically.

>> I made a quick fix like so:
>>
>> +   port_num = __ffs(out->of_ports);
>> +
>> +   remote_node = of_graph_get_remote_node(out->dev->of_node,
>> port_num, 0);
>>
>> Which I think works for all our outputs as we only set a single bit in
>> of_ports for outputs. But I don't think that's quite correct. Should we
>> have another field which tells which port is to be used? Then again,
>> maybe __ffs() is good enough here, as we can guarantee that there's ever
>> a single port in of_ports.
> 
> Down the road I think it would make sense to replace of_ports with
> of_port. I thought we can't do so right now as we have three encoder
> drivers that set two bits in of_ports, but now that I've double-checked,
> of_ports isn't used. We could thus replace it, and only set it for the
> internal DSS devices.

Yes, this would clean up the code a bit.

> If my analysis is correct and the problem isn't introduced by this
> patch, could it be fixed on top of the series ?

Yes, that sounds fine.

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 1/1] drm/komeda: fix build with drm_modeset_helper.h update

2019-02-11 Thread Maxime Ripard
On Fri, Feb 08, 2019 at 11:13:24PM +0100, Sam Ravnborg wrote:
> With drmP.h removed from drm_modeset_helper.h the build of
> komeda filed as reported by linux-next
> 
> Add missing include files to fix build.
> For the files touched group include files and sort them.
> 
> The fix was tested on a tree with drm-misc-next merged.
> And the patch was also tested to work without drm-misc-next merged.
> 
> Build tested on arm + x86.
> 
> Signed-off-by: Sam Ravnborg 
> Reported-by: Stephen Rothwell  [linux-next]
> Cc: Stephen Rothwell 
> Cc: James Wang 
> Cc: Liviu Dudau 
> Cc: Brian Starkey 
> Cc: David Airlie 
> Cc: Daniel Vetter 

I've applied it to drm-misc-next (after a drm-next backmerge), thanks!
Maxime

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


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 00/50] omapdrm: drm_bridge and drm_panel support

2019-02-11 Thread Laurent Pinchart
Hello,

This patch series consolidates the three pending series for the omapdrm and
tfp410 drivers that all together implement drm_bridge and drm_panel support
for omapdrm.

Compared to v2, patch 50/50 has been added, the series has been rebased
on drm-next, review comments have been incorporated and review tags
collected. Please see individual patches for changelogs. The whole series
is available from

git://linuxtv.org/pinchartl/media.git omapdrm/bridge/next

Laurent Pinchart (46):
  drm/atomic: Constify mode argument to mode_valid_path()
  drm/omap: Remove declaration of nonexisting function
  drm/omap: Remove unused kobj field from struct omap_dss_device
  drm/omap: venc: Remove wss_data field from venc_device structure
  drm/omap: Use atomic suspend/resume helpers
  drm/omap: Move common display enable/disable code to encoder
  drm/omap: Remove connection checks from internal encoders .enable()
  drm/omap: Remove connection checks from display .enable() and
.remove()
  drm/omap: Remove enable checks from display .enable() and .remove()
  drm/omap: Reverse direction of the DSS device enable/disable
operations
  drm/omap: Remove omap_dss_device dst field
  drm/omap: Factor out common init/cleanup code for output devices
  drm/omap: Expose DRM modes instead of timings in display devices
  drm/omap: Merge display .get_modes() and .get_size() operations
  drm/omap: Add a dss device operation flag for .get_modes()
  drm/omap: venc: List both PAL and NTSC modes
  drm/omap: Don't pass display pointer to encoder init function
  drm/omap: Move display alias ID to omap_drm_pipeline
  drm/omap: Don't store display pointer in omap_connector structure
  drm/omap: panel-dsi-cm: Store source pointer internally
  drm/omap: Notify all devices in the pipeline of output disconnection
  drm/omap: Remove src field from omap_dss_device structure
  drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation
  drm/omap: venc: Simplify mode setting by caching configuration
  drm/omap: Factor out common mode validation code
  drm/omap: Pass drm_display_mode to .check_timings() and .set_timings()
  drm/omap: venc: Use drm_display_mode natively
  drm/omap: Store pixel clock instead of full mode in DPI and SDI
encoders
  drm/omap: Simplify OF lookup of DSS devices
  drm/omap: Refactor initialization sequence
  drm/omap: Merge omap_dss_device type and output_type fields
  drm: Clarify definition of the DRM_BUS_FLAG_(PIXDATA|SYNC)_* macros
  drm: Use new DRM_BUS_FLAG_*_(DRIVE|SAMPLE)_(POS|NEG)EDGE flags
  dt-bindings: display: tfp410: Add bus parameters properties
  drm/bridge: ti-tfp410: Set connector type based on DT connector node
  drm/bridge: ti-tfp410: Add support for the powerdown GPIO
  drm/bridge: ti-tfp410: Report input bus config through bridge timings
  dt-bindings: Add vendor prefix for OSD Displays
  dt-bindings: display: Add OSD Displays OSD070T1718-19TS panel binding
  drm/panel: simple: Add OSD070T1718-19TS panel support
  drm/omap: Add support for drm_bridge
  drm/omap: Add support for drm_panel
  drm/omap: Whitelist DT nodes to fixup with omapdss, prefix
  drm/omap: Remove TFP410 and DVI connector drivers
  drm/omap: Remove panel-dpi driver
  drm: Turn bus flags macros into an enum

Stefan Agner (1):
  drm/bridge: use bus flags in bridge timings

Tomi Valkeinen (3):
  drm/omap: dsi: Fix crash in DSI debug dumps
  drm/omap: dsi: Fix OF platform depopulate
  drm/omap: dsi: Hack-fix DSI bus flags

 .../bindings/display/bridge/ti,tfp410.txt |  24 +-
 .../panel/osddisplays,osd070t1718-19ts.txt|  12 +
 .../devicetree/bindings/vendor-prefixes.txt   |   1 +
 drivers/gpu/drm/bridge/dumb-vga-dac.c |   6 +-
 drivers/gpu/drm/bridge/ti-tfp410.c| 109 +-
 drivers/gpu/drm/drm_atomic_helper.c   |   4 +-
 drivers/gpu/drm/drm_modes.c   |  12 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c|   2 +-
 drivers/gpu/drm/imx/ipuv3-crtc.c  |   2 +-
 drivers/gpu/drm/mxsfb/mxsfb_crtc.c|   6 +-
 drivers/gpu/drm/omapdrm/displays/Kconfig  |  17 -
 drivers/gpu/drm/omapdrm/displays/Makefile |   3 -
 .../omapdrm/displays/connector-analog-tv.c|  45 +--
 .../gpu/drm/omapdrm/displays/connector-dvi.c  | 330 --
 .../gpu/drm/omapdrm/displays/connector-hdmi.c |  45 +--
 .../gpu/drm/omapdrm/displays/encoder-opa362.c |  39 +--
 .../gpu/drm/omapdrm/displays/encoder-tfp410.c | 170 -
 .../drm/omapdrm/displays/encoder-tpd12s015.c  |  40 ---
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  | 221 
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 140 +++-
 .../displays/panel-lgphilips-lb035q02.c   |  41 +--
 .../omapdrm/displays/panel-nec-nl8048hl11.c   |  41 +--
 .../displays/panel-sharp-ls037v7dw01.c|  61 ++--
 .../omapdrm/displays/panel-sony-acx565akm.c   |  55 +--
 .../omapdrm/displays/panel-tpo-td028ttec1.c   |  52 +--
 .../omapdrm/displays/panel-tpo-td043mtea1.c   |  48 +--
 drivers/gpu/drm

[PATCH v3 01/50] drm/atomic: Constify mode argument to mode_valid_path()

2019-02-11 Thread Laurent Pinchart
The mode_valid_path() function validates the mode it receives without
ever modifying it. Constify the mode pointer argument to make that
explicit.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Ville Syrjälä 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 6fe2303fccd9..3a746a9a16fb 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -488,7 +488,7 @@ mode_fixup(struct drm_atomic_state *state)
 static enum drm_mode_status mode_valid_path(struct drm_connector *connector,
struct drm_encoder *encoder,
struct drm_crtc *crtc,
-   struct drm_display_mode *mode)
+   const struct drm_display_mode *mode)
 {
enum drm_mode_status ret;
 
@@ -527,7 +527,7 @@ mode_valid(struct drm_atomic_state *state)
struct drm_crtc *crtc = conn_state->crtc;
struct drm_crtc_state *crtc_state;
enum drm_mode_status mode_status;
-   struct drm_display_mode *mode;
+   const struct drm_display_mode *mode;
 
if (!crtc || !encoder)
continue;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 04/50] drm/omap: dsi: Hack-fix DSI bus flags

2019-02-11 Thread Laurent Pinchart
From: Tomi Valkeinen 

Since commit b4935e3a3cfa ("drm/omap: Store bus flags in the
omap_dss_device structure") video mode flags are managed by the omapdss
(and later omapdrm) core based on bus flags stored in omap_dss_device.
This works fine for all devices whose video modes are set by the omapdss
and omapdrm core, but breaks DSI operation as the DSI still uses legacy
code paths and sets the DISPC timings manually.

To fix the problem properly we should move the DSI encoder to the new
encoder model. This will however require a considerable amount of work.
Restore DSI operation by adding back video mode flags handling in the
DSI encoder driver as a hack in the meantime.

Fixes: b4935e3a3cfa ("drm/omap: Store bus flags in the omap_dss_device 
structure")
Signed-off-by: Tomi Valkeinen 
Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index b5685018d830..64fb788b6647 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -4751,6 +4751,17 @@ static int dsi_set_config(struct omap_dss_device *dssdev,
dsi->vm.flags |= DISPLAY_FLAGS_HSYNC_HIGH;
dsi->vm.flags &= ~DISPLAY_FLAGS_VSYNC_LOW;
dsi->vm.flags |= DISPLAY_FLAGS_VSYNC_HIGH;
+   /*
+* HACK: These flags should be handled through the omap_dss_device bus
+* flags, but this will only be possible when the DSI encoder will be
+* converted to the omapdrm-managed encoder model.
+*/
+   dsi->vm.flags &= ~DISPLAY_FLAGS_PIXDATA_NEGEDGE;
+   dsi->vm.flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE;
+   dsi->vm.flags &= ~DISPLAY_FLAGS_DE_LOW;
+   dsi->vm.flags |= DISPLAY_FLAGS_DE_HIGH;
+   dsi->vm.flags &= ~DISPLAY_FLAGS_SYNC_POSEDGE;
+   dsi->vm.flags |= DISPLAY_FLAGS_SYNC_NEGEDGE;
 
dss_mgr_set_timings(&dsi->output, &dsi->vm);
 
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 06/50] drm/omap: Remove unused kobj field from struct omap_dss_device

2019-02-11 Thread Laurent Pinchart
The kobj field from struct omap_dss_device is not used. Remove it.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 33e15cb77efa..3b4bf5c47173 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -19,7 +19,6 @@
 #define __OMAP_DRM_DSS_H
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -404,7 +403,6 @@ enum omap_dss_device_type {
 };
 
 struct omap_dss_device {
-   struct kobject kobj;
struct device *dev;
 
struct module *owner;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 02/50] drm/omap: dsi: Fix crash in DSI debug dumps

2019-02-11 Thread Laurent Pinchart
From: Tomi Valkeinen 

Reading any of the DSI debugfs files results in a crash, as wrong
pointer is passed to the dump functions, and the dump functions use a
wrong pointer. This patch fixes DSI debug dumps.

Fixes: f3ed97f9ae7d ("drm/omap: dsi: Simplify debugfs implementation")
Signed-off-by: Tomi Valkeinen 
Reviewed-by: Laurent Pinchart 
Signed-off-by: Laurent Pinchart 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 00a9c2ab9e6c..277f9dd2ec8c 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -1406,7 +1406,7 @@ static void dsi_pll_disable(struct dss_pll *pll)
 
 static int dsi_dump_dsi_clocks(struct seq_file *s, void *p)
 {
-   struct dsi_data *dsi = p;
+   struct dsi_data *dsi = s->private;
struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo;
enum dss_clk_source dispc_clk_src, dsi_clk_src;
int dsi_module = dsi->module_id;
@@ -1467,7 +1467,7 @@ static int dsi_dump_dsi_clocks(struct seq_file *s, void 
*p)
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
 static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
 {
-   struct dsi_data *dsi = p;
+   struct dsi_data *dsi = s->private;
unsigned long flags;
struct dsi_irq_stats stats;
 
@@ -1558,7 +1558,7 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
 
 static int dsi_dump_dsi_regs(struct seq_file *s, void *p)
 {
-   struct dsi_data *dsi = p;
+   struct dsi_data *dsi = s->private;
 
if (dsi_runtime_get(dsi))
return 0;
@@ -5083,15 +5083,15 @@ static int dsi_bind(struct device *dev, struct device 
*master, void *data)
 
snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1);
dsi->debugfs.regs = dss_debugfs_create_file(dss, name,
-   dsi_dump_dsi_regs, &dsi);
+   dsi_dump_dsi_regs, dsi);
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1);
dsi->debugfs.irqs = dss_debugfs_create_file(dss, name,
-   dsi_dump_dsi_irqs, &dsi);
+   dsi_dump_dsi_irqs, dsi);
 #endif
snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1);
dsi->debugfs.clks = dss_debugfs_create_file(dss, name,
-   dsi_dump_dsi_clocks, &dsi);
+   dsi_dump_dsi_clocks, dsi);
 
return 0;
 }
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 29/50] drm/omap: Pass drm_display_mode to .check_timings() and .set_timings()

2019-02-11 Thread Laurent Pinchart
The omap_dss_device .check_timings() and .set_timings() operations
operate on struct videomode, while the DRM API operates on struct
drm_display_mode. This forces conversion from to videomode in the
callers. While that's not a problem per se, it creates a difference with
the drm_bridge API.

Replace the videomode parameter to the .check_timings() and
.set_timings() operations with a drm_display_mode. This pushed the
conversion to videomode down to the DSS devices in some cases. If needed
they will be converted to operate on drm_display_mode natively.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 +++---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 16 +--
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   |  6 ++--
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   |  6 ++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 +--
 drivers/gpu/drm/omapdrm/dss/sdi.c | 17 +--
 drivers/gpu/drm/omapdrm/dss/venc.c| 28 +--
 drivers/gpu/drm/omapdrm/omap_connector.c  |  7 ++---
 drivers/gpu/drm/omapdrm/omap_encoder.c|  2 +-
 9 files changed, 46 insertions(+), 48 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ce812094177c..d9f10f41ddfb 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -1127,20 +1127,20 @@ static int dsicm_get_modes(struct omap_dss_device 
*dssdev,
 }
 
 static int dsicm_check_timings(struct omap_dss_device *dssdev,
-  struct videomode *vm)
+  struct drm_display_mode *mode)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
int ret = 0;
 
-   if (vm->hactive != ddata->vm.hactive)
+   if (mode->hdisplay != ddata->vm.hactive)
ret = -EINVAL;
 
-   if (vm->vactive != ddata->vm.vactive)
+   if (mode->vdisplay != ddata->vm.vactive)
ret = -EINVAL;
 
if (ret) {
dev_warn(dssdev->dev, "wrong resolution: %d x %d",
-vm->hactive, vm->vactive);
+mode->hdisplay, mode->vdisplay);
dev_warn(dssdev->dev, "panel resolution: %d x %d",
 ddata->vm.hactive, ddata->vm.vactive);
}
diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 0db01cadf09f..0cb3cb72f15f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -459,7 +459,7 @@ static void dpi_display_disable(struct omap_dss_device 
*dssdev)
 }
 
 static void dpi_set_timings(struct omap_dss_device *dssdev,
-   const struct videomode *vm)
+   const struct drm_display_mode *mode)
 {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
 
@@ -467,13 +467,13 @@ static void dpi_set_timings(struct omap_dss_device 
*dssdev,
 
mutex_lock(&dpi->lock);
 
-   dpi->vm = *vm;
+   drm_display_mode_to_videomode(mode, &dpi->vm);
 
mutex_unlock(&dpi->lock);
 }
 
 static int dpi_check_timings(struct omap_dss_device *dssdev,
-struct videomode *vm)
+struct drm_display_mode *mode)
 {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
int lck_div, pck_div;
@@ -482,20 +482,20 @@ static int dpi_check_timings(struct omap_dss_device 
*dssdev,
struct dpi_clk_calc_ctx ctx;
bool ok;
 
-   if (vm->hactive % 8 != 0)
+   if (mode->hdisplay % 8 != 0)
return -EINVAL;
 
-   if (vm->pixelclock == 0)
+   if (mode->clock == 0)
return -EINVAL;
 
if (dpi->pll) {
-   ok = dpi_pll_clk_calc(dpi, vm->pixelclock, &ctx);
+   ok = dpi_pll_clk_calc(dpi, mode->clock * 1000, &ctx);
if (!ok)
return -EINVAL;
 
fck = ctx.pll_cinfo.clkout[ctx.clkout_idx];
} else {
-   ok = dpi_dss_clk_calc(dpi, vm->pixelclock, &ctx);
+   ok = dpi_dss_clk_calc(dpi, mode->clock * 1000, &ctx);
if (!ok)
return -EINVAL;
 
@@ -507,7 +507,7 @@ static int dpi_check_timings(struct omap_dss_device *dssdev,
 
pck = fck / lck_div / pck_div;
 
-   vm->pixelclock = pck;
+   mode->clock = pck / 1000;
 
return 0;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 60792981a33f..4337380b1bf7 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -249,15 +249,15 @@ static void hdmi_power_off_full(struct omap_hdmi *hdmi)
 }
 
 static void hdmi_display_set_timings(struct omap_dss_device *dssdev,
-const struct videomod

[PATCH v3 12/50] drm/omap: Remove enable checks from display .enable() and .remove()

2019-02-11 Thread Laurent Pinchart
The displays (connectors, panels and encoders) bail out from their
.enable() and .disable() handlers if the dss device is already enabled
or disabled. Those safety checks are not needed when the functions are
called through the omapdss_device_ops, as the .enable() and .disable()
handlers are called from the DRM atomic helpers that already guarantee
that no double enabling or disabling can occur.

However, the handlers are also called directly from the .remove()
handler. While this shouldn't be needed either as the modules can't be
removed as long as the device is in use, it's still a good practice to
disable the device explicitly. There is currently a safety check in
.remove() in some drivers but not all of them.

Remove the safety checks from the .enable() and .disable() handlers, and
add missing ones in the .remove() handler.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/connector-analog-tv.c|  6 ++
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c  |  6 ++
 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c |  6 ++
 drivers/gpu/drm/omapdrm/displays/encoder-opa362.c |  6 --
 drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c |  6 --
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  |  6 ++
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 +--
 .../drm/omapdrm/displays/panel-lgphilips-lb035q02.c   |  6 ++
 .../gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c   |  6 ++
 .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c|  6 ++
 .../gpu/drm/omapdrm/displays/panel-sony-acx565akm.c   |  6 ++
 .../gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c   |  6 ++
 .../gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c   |  6 ++
 drivers/gpu/drm/omapdrm/omap_encoder.c|  6 --
 14 files changed, 25 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index 910a5b9c036a..2b5b77627cfb 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -46,9 +46,6 @@ static void tvc_disable(struct omap_dss_device *dssdev)
 {
struct omap_dss_device *src = dssdev->src;
 
-   if (!omapdss_device_is_enabled(dssdev))
-   return;
-
src->ops->disable(src);
 }
 
@@ -92,7 +89,8 @@ static int __exit tvc_remove(struct platform_device *pdev)
 
omapdss_device_unregister(&ddata->dssdev);
 
-   tvc_disable(dssdev);
+   if (omapdss_device_is_enabled(dssdev))
+   tvc_disable(dssdev);
 
return 0;
 }
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index 1e0925791c3d..a1784e263835 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -57,9 +57,6 @@ static void dvic_disable(struct omap_dss_device *dssdev)
 {
struct omap_dss_device *src = dssdev->src;
 
-   if (!omapdss_device_is_enabled(dssdev))
-   return;
-
src->ops->disable(src);
 }
 
@@ -282,7 +279,8 @@ static int __exit dvic_remove(struct platform_device *pdev)
 
omapdss_device_unregister(&ddata->dssdev);
 
-   dvic_disable(dssdev);
+   if (omapdss_device_is_enabled(dssdev))
+   dvic_disable(dssdev);
 
i2c_put_adapter(ddata->i2c_adapter);
 
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 649364e04edd..05cd503c4d29 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -52,9 +52,6 @@ static void hdmic_disable(struct omap_dss_device *dssdev)
 {
struct omap_dss_device *src = dssdev->src;
 
-   if (!omapdss_device_is_enabled(dssdev))
-   return;
-
src->ops->disable(src);
 }
 
@@ -179,7 +176,8 @@ static int __exit hdmic_remove(struct platform_device *pdev)
 
omapdss_device_unregister(&ddata->dssdev);
 
-   hdmic_disable(dssdev);
+   if (omapdss_device_is_enabled(dssdev))
+   hdmic_disable(dssdev);
 
return 0;
 }
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index 0b1032625e42..ce116c28479f 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -49,9 +49,6 @@ static int opa362_enable(struct omap_dss_device *dssdev)
 
dev_dbg(dssdev->dev, "enable\n");
 
-   if (omapdss_device_is_enabled(dssdev))
-   return 0;
-
r = src->ops->enable(src);
if (r)
return r;
@@ -71,9 +68,6 @@ static void opa362_disable(struct omap_dss_device *dssdev)
 
dev_dbg(dssdev->dev, "disable\n");
 
-   i

[PATCH v3 21/50] drm/omap: Move display alias ID to omap_drm_pipeline

2019-02-11 Thread Laurent Pinchart
The DT bindings for the OMAP DSS allow assigning numerical IDs to
display outputs through display entries in the alias node. The driver
uses this information to sort pipelines according to the order specified
in DT, making it possible for a system to give a priority order to
outputs.

Retrieval of the alias ID is done when initializing display dss devices.
That code will be removed when moving to drm_bridge and drm_panel. Move
retrieval of the alias ID to display pipeline connection time and store
it in the pipeline structure instead to keep the feature.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/display.c | 2 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
 drivers/gpu/drm/omapdrm/omap_drv.c| 9 +++--
 drivers/gpu/drm/omapdrm/omap_drv.h| 1 +
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
b/drivers/gpu/drm/omapdrm/dss/display.c
index 398964358386..e93f61a567a8 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -42,8 +42,6 @@ void omapdss_display_init(struct omap_dss_device *dssdev)
if (id < 0)
id = disp_num_counter++;
 
-   dssdev->alias_id = id;
-
/* Use 'label' property for name, if it exists */
of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 01da7e94b974..dd93c2121a35 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -414,8 +414,6 @@ struct omap_dss_device {
 
struct list_head list;
 
-   unsigned int alias_id;
-
enum omap_display_type type;
/*
 * DSS output type that this device generates (for DSS internal devices)
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 3b8f0fdf24a8..008eec6356fd 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -155,9 +155,9 @@ static int omap_compare_pipes(const void *a, const void *b)
const struct omap_drm_pipeline *pipe1 = a;
const struct omap_drm_pipeline *pipe2 = b;
 
-   if (pipe1->display->alias_id > pipe2->display->alias_id)
+   if (pipe1->alias_id > pipe2->alias_id)
return 1;
-   else if (pipe1->display->alias_id < pipe2->display->alias_id)
+   else if (pipe1->alias_id < pipe2->alias_id)
return -1;
return 0;
 }
@@ -182,11 +182,16 @@ static int omap_connect_pipelines(struct drm_device *ddev)
 output->name);
} else {
struct omap_drm_pipeline *pipe;
+   int id;
 
pipe = &priv->pipes[priv->num_pipes++];
pipe->output = omapdss_device_get(output);
pipe->display = omapdss_display_get(output);
 
+   id = of_alias_get_id(pipe->display->dev->of_node,
+"display");
+   pipe->alias_id = id >= 0 ? id : priv->num_pipes - 1;
+
if (priv->num_pipes == ARRAY_SIZE(priv->pipes)) {
/* To balance the 'for_each_dss_output' loop */
omapdss_device_put(output);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h 
b/drivers/gpu/drm/omapdrm/omap_drv.h
index 0c57d2814c51..ebff86595167 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -50,6 +50,7 @@ struct omap_drm_pipeline {
struct drm_connector *connector;
struct omap_dss_device *output;
struct omap_dss_device *display;
+   unsigned int alias_id;
 };
 
 struct omap_drm_private {
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 27/50] drm/omap: venc: Simplify mode setting by caching configuration

2019-02-11 Thread Laurent Pinchart
The mode setting handler of the VENC stores the video mode internally,
to then convert it to a configuration when programming the hardware. The
stored mode is otherwise unused. Cache the configuration directly
instead.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/venc.c | 68 +++---
 1 file changed, 34 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index 638cfd69ccf6..6cb708e1944e 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -301,24 +301,6 @@ static const struct videomode omap_dss_ntsc_vm = {
  DISPLAY_FLAGS_SYNC_NEGEDGE,
 };
 
-static enum venc_videomode venc_get_videomode(const struct videomode *vm)
-{
-   if (!(vm->flags & DISPLAY_FLAGS_INTERLACED))
-   return VENC_MODE_UNKNOWN;
-
-   if (vm->pixelclock == omap_dss_pal_vm.pixelclock &&
-   vm->hactive == omap_dss_pal_vm.hactive &&
-   vm->vactive == omap_dss_pal_vm.vactive)
-   return VENC_MODE_PAL;
-
-   if (vm->pixelclock == omap_dss_ntsc_vm.pixelclock &&
-   vm->hactive == omap_dss_ntsc_vm.hactive &&
-   vm->vactive == omap_dss_ntsc_vm.vactive)
-   return VENC_MODE_NTSC;
-
-   return VENC_MODE_UNKNOWN;
-}
-
 struct venc_device {
struct platform_device *pdev;
void __iomem *base;
@@ -330,7 +312,7 @@ struct venc_device {
 
struct clk  *tv_dac_clk;
 
-   struct videomode vm;
+   const struct venc_config *config;
enum omap_dss_venc_type type;
bool invert_polarity;
bool requires_tv_dac_clk;
@@ -450,18 +432,6 @@ static void venc_runtime_put(struct venc_device *venc)
WARN_ON(r < 0 && r != -ENOSYS);
 }
 
-static const struct venc_config *venc_timings_to_config(const struct videomode 
*vm)
-{
-   switch (venc_get_videomode(vm)) {
-   default:
-   WARN_ON_ONCE(1);
-   case VENC_MODE_PAL:
-   return &venc_config_pal_trm;
-   case VENC_MODE_NTSC:
-   return &venc_config_ntsc_trm;
-   }
-}
-
 static int venc_power_on(struct venc_device *venc)
 {
u32 l;
@@ -472,7 +442,7 @@ static int venc_power_on(struct venc_device *venc)
goto err0;
 
venc_reset(venc);
-   venc_write_config(venc, venc_timings_to_config(&venc->vm));
+   venc_write_config(venc, venc->config);
 
dss_set_venc_output(venc->dss, venc->type);
dss_set_dac_pwrdn_bgz(venc->dss, 1);
@@ -574,16 +544,46 @@ static int venc_get_modes(struct omap_dss_device *dssdev,
return ARRAY_SIZE(modes);
 }
 
+static enum venc_videomode venc_get_videomode(const struct videomode *vm)
+{
+   if (!(vm->flags & DISPLAY_FLAGS_INTERLACED))
+   return VENC_MODE_UNKNOWN;
+
+   if (vm->pixelclock == omap_dss_pal_vm.pixelclock &&
+   vm->hactive == omap_dss_pal_vm.hactive &&
+   vm->vactive == omap_dss_pal_vm.vactive)
+   return VENC_MODE_PAL;
+
+   if (vm->pixelclock == omap_dss_ntsc_vm.pixelclock &&
+   vm->hactive == omap_dss_ntsc_vm.hactive &&
+   vm->vactive == omap_dss_ntsc_vm.vactive)
+   return VENC_MODE_NTSC;
+
+   return VENC_MODE_UNKNOWN;
+}
+
 static void venc_set_timings(struct omap_dss_device *dssdev,
 const struct videomode *vm)
 {
struct venc_device *venc = dssdev_to_venc(dssdev);
+   enum venc_videomode venc_mode = venc_get_videomode(vm);
 
DSSDBG("venc_set_timings\n");
 
mutex_lock(&venc->venc_lock);
 
-   venc->vm = *vm;
+   switch (venc_mode) {
+   default:
+   WARN_ON_ONCE(1);
+   /* Fall-through */
+   case VENC_MODE_PAL:
+   venc->config = &venc_config_pal_trm;
+   break;
+
+   case VENC_MODE_NTSC:
+   venc->config = &venc_config_ntsc_trm;
+   break;
+   }
 
dispc_set_tv_pclk(venc->dss->dispc, 1350);
 
@@ -854,7 +854,7 @@ static int venc_probe(struct platform_device *pdev)
 
mutex_init(&venc->venc_lock);
 
-   venc->vm = omap_dss_pal_vm;
+   venc->config = &venc_config_pal_trm;
 
venc_mem = platform_get_resource(venc->pdev, IORESOURCE_MEM, 0);
venc->base = devm_ioremap_resource(&pdev->dev, venc_mem);
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 16/50] drm/omap: Expose DRM modes instead of timings in display devices

2019-02-11 Thread Laurent Pinchart
omap_dss_device operations expose fixed video timings through a
.get_timings() operation that return a single timing for the device. To
prepare for the move to drm_bridge, modify the API to instead add DRM
modes directly to the connector.

As this puts more burden on display devices, we also create a helper
function for panels to add a single DRM mode from the panel video
timings.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  |  8 ++---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 10 +++---
 .../displays/panel-lgphilips-lb035q02.c   |  8 ++---
 .../omapdrm/displays/panel-nec-nl8048hl11.c   |  8 ++---
 .../displays/panel-sharp-ls037v7dw01.c|  8 ++---
 .../omapdrm/displays/panel-sony-acx565akm.c   |  8 ++---
 .../omapdrm/displays/panel-tpo-td028ttec1.c   |  8 ++---
 .../omapdrm/displays/panel-tpo-td043mtea1.c   |  8 ++---
 drivers/gpu/drm/omapdrm/dss/display.c | 22 +
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  8 +++--
 drivers/gpu/drm/omapdrm/dss/venc.c| 12 ---
 drivers/gpu/drm/omapdrm/omap_connector.c  | 33 ++-
 12 files changed, 80 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index eee44d9ea0c3..d6a584292e91 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -68,12 +68,12 @@ static void panel_dpi_disable(struct omap_dss_device 
*dssdev)
regulator_disable(ddata->vcc_supply);
 }
 
-static void panel_dpi_get_timings(struct omap_dss_device *dssdev,
- struct videomode *vm)
+static int panel_dpi_get_modes(struct omap_dss_device *dssdev,
+  struct drm_connector *connector)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
 
-   *vm = ddata->vm;
+   return omapdss_display_get_modes(connector, &ddata->vm);
 }
 
 static const struct omap_dss_device_ops panel_dpi_ops = {
@@ -83,7 +83,7 @@ static const struct omap_dss_device_ops panel_dpi_ops = {
.enable = panel_dpi_enable,
.disable= panel_dpi_disable,
 
-   .get_timings= panel_dpi_get_timings,
+   .get_modes  = panel_dpi_get_modes,
 };
 
 static int panel_dpi_probe_of(struct platform_device *pdev)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index ffbf20e6ebe9..9cd9ab487a24 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -1110,12 +1112,12 @@ static void dsicm_ulps_work(struct work_struct *work)
mutex_unlock(&ddata->lock);
 }
 
-static void dsicm_get_timings(struct omap_dss_device *dssdev,
- struct videomode *vm)
+static int dsicm_get_modes(struct omap_dss_device *dssdev,
+  struct drm_connector *connector)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
 
-   *vm = ddata->vm;
+   return omapdss_display_get_modes(connector, &ddata->vm);
 }
 
 static int dsicm_check_timings(struct omap_dss_device *dssdev,
@@ -1156,7 +1158,7 @@ static const struct omap_dss_device_ops dsicm_ops = {
.enable = dsicm_enable,
.disable= dsicm_disable,
 
-   .get_timings= dsicm_get_timings,
+   .get_modes  = dsicm_get_modes,
.check_timings  = dsicm_check_timings,
 };
 
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index e043cab0a0c9..e05b7f80416e 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -139,12 +139,12 @@ static void lb035q02_disable(struct omap_dss_device 
*dssdev)
gpiod_set_value_cansleep(ddata->enable_gpio, 0);
 }
 
-static void lb035q02_get_timings(struct omap_dss_device *dssdev,
-struct videomode *vm)
+static int lb035q02_get_modes(struct omap_dss_device *dssdev,
+ struct drm_connector *connector)
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
 
-   *vm = ddata->vm;
+   return omapdss_display_get_modes(connector, &ddata->vm);
 }
 
 static const struct omap_dss_device_ops lb035q02_ops = {
@@ -154,7 +154,7 @@ static const struct omap_dss_device_ops lb035q02_ops = {
.enable = lb035q02_enable,
.disable= lb035q02_disable,
 
-   .get_timings= lb035q02_get_timings,
+   .get_modes  = lb035q02_get_modes,
 };
 
 static int lb035q02_probe_of(struct spi_device *spi)
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c 
b/drivers/gpu/drm/

[PATCH v3 03/50] drm/omap: dsi: Fix OF platform depopulate

2019-02-11 Thread Laurent Pinchart
From: Tomi Valkeinen 

Commit edb715dffdee ("drm/omap: dss: dsi: Move initialization code from
bind to probe") moved the of_platform_populate() call from dsi_bind() to
dsi_probe(), but failed to move the corresponding
of_platform_depopulate() from dsi_unbind() to dsi_remove(). This results
in OF child devices being potentially removed multiple times. Fix it by
placing the of_platform_depopulate() call where it belongs.

Fixes: edb715dffdee ("drm/omap: dss: dsi: Move initialization code from bind to 
probe")
Signed-off-by: Tomi Valkeinen 
Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 277f9dd2ec8c..b5685018d830 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5104,8 +5104,6 @@ static void dsi_unbind(struct device *dev, struct device 
*master, void *data)
dss_debugfs_remove_file(dsi->debugfs.irqs);
dss_debugfs_remove_file(dsi->debugfs.regs);
 
-   of_platform_depopulate(dev);
-
WARN_ON(dsi->scp_clk_refcount > 0);
 
dss_pll_unregister(&dsi->pll);
@@ -5457,6 +5455,8 @@ static int dsi_remove(struct platform_device *pdev)
 
dsi_uninit_output(dsi);
 
+   of_platform_depopulate(&pdev->dev);
+
pm_runtime_disable(&pdev->dev);
 
if (dsi->vdds_dsi_reg != NULL && dsi->vdds_dsi_enabled) {
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 18/50] drm/omap: Add a dss device operation flag for .get_modes()

2019-02-11 Thread Laurent Pinchart
Instead of manually iterating over the dss devices in the pipeline to
find the first one that implements the .get_modes() operation, add a new
operation flag for .get_modes() and use the omap_connector_find_device()
helper function to locate the right dss device.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  | 1 +
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 1 +
 .../gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c   | 1 +
 drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c   | 1 +
 .../gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c| 1 +
 drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c   | 1 +
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c   | 1 +
 drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c   | 1 +
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 4 +++-
 drivers/gpu/drm/omapdrm/dss/venc.c| 1 +
 drivers/gpu/drm/omapdrm/omap_connector.c  | 8 
 11 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index d6a584292e91..897b8820e000 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -152,6 +152,7 @@ static int panel_dpi_probe(struct platform_device *pdev)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
+   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
drm_bus_flags_from_videomode(&ddata->vm, &dssdev->bus_flags);
 
omapdss_display_init(dssdev);
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index c5f570106a17..fe9d9f847d2e 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -1271,6 +1271,7 @@ static int dsicm_probe(struct platform_device *pdev)
dssdev->type = OMAP_DISPLAY_TYPE_DSI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
+   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index e05b7f80416e..f37931bf1c5f 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -199,6 +199,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
+   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
/*
 * Note: According to the panel documentation:
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c 
b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index cf2127837e67..8f2fb3d0492f 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -194,6 +194,7 @@ static int nec_8048_probe(struct spi_device *spi)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
+   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_POSEDGE
  | DRM_BUS_FLAG_PIXDATA_POSEDGE;
 
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c 
b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
index 30320cee1e56..8d5d7f775b55 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
@@ -209,6 +209,7 @@ static int sharp_ls_probe(struct platform_device *pdev)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
+   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
 
/*
 * Note: According to the panel documentation:
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
index 8debe77f92ff..b8360cef3754 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
@@ -708,6 +708,7 @@ static int acx565akm_probe(struct spi_device *spi)
dssdev->type = OMAP_DISPLAY_TYPE_SDI;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
+   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
dssdev->bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_SYNC_NEGEDGE
  | DRM_BUS_FLAG_PIXDATA_POSEDGE;
 
diff --git a/drivers/gpu/drm/omapdrm/displ

[PATCH v3 19/50] drm/omap: venc: List both PAL and NTSC modes

2019-02-11 Thread Laurent Pinchart
The TV encoder supports both PAL and NTSC modes, but when queried for
the list of modes it supports, only the currently selected mode is
reported. Fix it and report the two modes unconditionally.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/venc.c | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index f1abb4195a76..638cfd69ccf6 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -551,14 +551,27 @@ static void venc_display_disable(struct omap_dss_device 
*dssdev)
 static int venc_get_modes(struct omap_dss_device *dssdev,
  struct drm_connector *connector)
 {
-   struct venc_device *venc = dssdev_to_venc(dssdev);
-   int r;
+   static const struct videomode *modes[] = {
+   &omap_dss_pal_vm,
+   &omap_dss_ntsc_vm,
+   };
+   unsigned int i;
 
-   mutex_lock(&venc->venc_lock);
-   r = omapdss_display_get_modes(connector, &venc->vm);
-   mutex_unlock(&venc->venc_lock);
+   for (i = 0; i < ARRAY_SIZE(modes); ++i) {
+   struct drm_display_mode *mode;
 
-   return r;
+   mode = drm_mode_create(connector->dev);
+   if (!mode)
+   return i;
+
+   drm_display_mode_from_videomode(modes[i], mode);
+
+   mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+   drm_mode_set_name(mode);
+   drm_mode_probed_add(connector, mode);
+   }
+
+   return ARRAY_SIZE(modes);
 }
 
 static void venc_set_timings(struct omap_dss_device *dssdev,
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 15/50] drm/omap: Factor out common init/cleanup code for output devices

2019-02-11 Thread Laurent Pinchart
All the internal encoders share common init and cleanup code. Factor it
out to separate functions.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 17 +++--
 drivers/gpu/drm/omapdrm/dss/dsi.c | 17 +++--
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 17 +++--
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 17 +++--
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ++-
 drivers/gpu/drm/omapdrm/dss/output.c  | 18 --
 drivers/gpu/drm/omapdrm/dss/sdi.c | 17 +++--
 drivers/gpu/drm/omapdrm/dss/venc.c| 17 +++--
 8 files changed, 36 insertions(+), 87 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 74e841a2b4eb..0db01cadf09f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -641,19 +641,9 @@ static int dpi_init_output_port(struct dpi_data *dpi, 
struct device_node *port)
out->ops = &dpi_ops;
out->owner = THIS_MODULE;
 
-   out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
-   if (IS_ERR(out->next)) {
-   if (PTR_ERR(out->next) != -EPROBE_DEFER)
-   dev_err(out->dev, "failed to find video sink\n");
-   return PTR_ERR(out->next);
-   }
-
-   r = omapdss_output_validate(out);
-   if (r) {
-   omapdss_device_put(out->next);
-   out->next = NULL;
+   r = omapdss_device_init_output(out);
+   if (r < 0)
return r;
-   }
 
omapdss_device_register(out);
 
@@ -665,9 +655,8 @@ static void dpi_uninit_output_port(struct device_node *port)
struct dpi_data *dpi = port->data;
struct omap_dss_device *out = &dpi->output;
 
-   if (out->next)
-   omapdss_device_put(out->next);
omapdss_device_unregister(out);
+   omapdss_device_cleanup_output(out);
 }
 
 static const struct soc_device_attribute dpi_soc_devices[] = {
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 4dad2bf6b551..4ac325e664b5 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -5131,19 +5131,9 @@ static int dsi_init_output(struct dsi_data *dsi)
   | DRM_BUS_FLAG_DE_HIGH
   | DRM_BUS_FLAG_SYNC_NEGEDGE;
 
-   out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
-   if (IS_ERR(out->next)) {
-   if (PTR_ERR(out->next) != -EPROBE_DEFER)
-   dev_err(out->dev, "failed to find video sink\n");
-   return PTR_ERR(out->next);
-   }
-
-   r = omapdss_output_validate(out);
-   if (r) {
-   omapdss_device_put(out->next);
-   out->next = NULL;
+   r = omapdss_device_init_output(out);
+   if (r < 0)
return r;
-   }
 
omapdss_device_register(out);
 
@@ -5154,9 +5144,8 @@ static void dsi_uninit_output(struct dsi_data *dsi)
 {
struct omap_dss_device *out = &dsi->output;
 
-   if (out->next)
-   omapdss_device_put(out->next);
omapdss_device_unregister(out);
+   omapdss_device_cleanup_output(out);
 }
 
 static int dsi_probe_of(struct dsi_data *dsi)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 6f88fb4d6344..60792981a33f 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -687,19 +687,9 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
out->of_ports = BIT(0);
out->ops_flags = OMAP_DSS_DEVICE_OP_EDID;
 
-   out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
-   if (IS_ERR(out->next)) {
-   if (PTR_ERR(out->next) != -EPROBE_DEFER)
-   dev_err(out->dev, "failed to find video sink\n");
-   return PTR_ERR(out->next);
-   }
-
-   r = omapdss_output_validate(out);
-   if (r) {
-   omapdss_device_put(out->next);
-   out->next = NULL;
+   r = omapdss_device_init_output(out);
+   if (r < 0)
return r;
-   }
 
omapdss_device_register(out);
 
@@ -710,9 +700,8 @@ static void hdmi4_uninit_output(struct omap_hdmi *hdmi)
 {
struct omap_dss_device *out = &hdmi->output;
 
-   if (out->next)
-   omapdss_device_put(out->next);
omapdss_device_unregister(out);
+   omapdss_device_cleanup_output(out);
 }
 
 static int hdmi4_probe_of(struct omap_hdmi *hdmi)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 28cf1c32b158..d7d33b4d2bed 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -671,19 +671,9 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
out->of_ports = BIT(0);
out->ops

[PATCH v3 05/50] drm/omap: Remove declaration of nonexisting function

2019-02-11 Thread Laurent Pinchart
The omap_connector_attached_encoder() doesn't exist anymore, remove its
declaration from omap_connector.h.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/omap_connector.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h 
b/drivers/gpu/drm/omapdrm/omap_connector.h
index 854099801649..4a1dcd0f031b 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.h
+++ b/drivers/gpu/drm/omapdrm/omap_connector.h
@@ -31,8 +31,6 @@ struct drm_connector *omap_connector_init(struct drm_device 
*dev,
  struct omap_dss_device *output,
  struct omap_dss_device *display,
  struct drm_encoder *encoder);
-struct drm_encoder *omap_connector_attached_encoder(
-   struct drm_connector *connector);
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
 void omap_connector_enable_hpd(struct drm_connector *connector);
 void omap_connector_disable_hpd(struct drm_connector *connector);
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 26/50] drm/omap: Move DISPC timing checks to CRTC .mode_valid() operation

2019-02-11 Thread Laurent Pinchart
The DISPC timings checks relate to the CRTC, but they're performed in
the encoder and connector .atomic_check() and .mode_valid() operations.
Move them to the CRTC .mode_valid() operation.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 6 --
 drivers/gpu/drm/omapdrm/omap_crtc.c  | 9 +
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 6 --
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
index e01e4cf61ae1..99ca5b3eaebb 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -245,8 +245,6 @@ static int omap_connector_mode_valid(struct drm_connector 
*connector,
 struct drm_display_mode *mode)
 {
struct omap_connector *omap_connector = to_omap_connector(connector);
-   enum omap_channel channel = omap_connector->output->dispc_channel;
-   struct omap_drm_private *priv = connector->dev->dev_private;
struct omap_dss_device *dssdev;
struct videomode vm = {0};
struct drm_device *dev = connector->dev;
@@ -256,10 +254,6 @@ static int omap_connector_mode_valid(struct drm_connector 
*connector,
drm_display_mode_to_videomode(mode, &vm);
mode->vrefresh = drm_mode_vrefresh(mode);
 
-   r = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, &vm);
-   if (r)
-   goto done;
-
for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
if (!dssdev->ops->check_timings)
continue;
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index d99e24dcc0bf..ae399435346b 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -390,6 +390,15 @@ static enum drm_mode_status omap_crtc_mode_valid(struct 
drm_crtc *crtc,
const struct drm_display_mode *mode)
 {
struct omap_drm_private *priv = crtc->dev->dev_private;
+   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
+   struct videomode vm = {0};
+   int r;
+
+   drm_display_mode_to_videomode(mode, &vm);
+   r = priv->dispc_ops->mgr_check_timings(priv->dispc, omap_crtc->channel,
+  &vm);
+   if (r)
+   return r;
 
/* Check for bandwidth limit */
if (priv->max_bandwidth) {
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 1f4172f653b9..623154bc44bb 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -206,19 +206,13 @@ static int omap_encoder_atomic_check(struct drm_encoder 
*encoder,
 struct drm_connector_state *conn_state)
 {
struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
-   enum omap_channel channel = omap_encoder->output->dispc_channel;
struct drm_device *dev = encoder->dev;
-   struct omap_drm_private *priv = dev->dev_private;
struct omap_dss_device *dssdev;
struct videomode vm = { 0 };
int ret;
 
drm_display_mode_to_videomode(&crtc_state->mode, &vm);
 
-   ret = priv->dispc_ops->mgr_check_timings(priv->dispc, channel, &vm);
-   if (ret)
-   goto done;
-
for (dssdev = omap_encoder->output; dssdev; dssdev = dssdev->next) {
if (!dssdev->ops->check_timings)
continue;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 09/50] drm/omap: Move common display enable/disable code to encoder

2019-02-11 Thread Laurent Pinchart
All .enable() and .disable() handlers for panels and connectors share
common code that validates and updates the device's state. Move it to
common locations in the omap_encoder_enable() and omap_encoder_disable()
handlers.

The enabled check in the .disable() handler is left untouched, it will
be addressed separately.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 .../omapdrm/displays/connector-analog-tv.c| 23 +-
 .../gpu/drm/omapdrm/displays/connector-dvi.c  | 17 +--
 .../gpu/drm/omapdrm/displays/connector-hdmi.c | 23 +-
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  | 10 ---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 18 ---
 .../displays/panel-lgphilips-lb035q02.c   | 10 ---
 .../omapdrm/displays/panel-nec-nl8048hl11.c   | 10 ---
 .../displays/panel-sharp-ls037v7dw01.c| 10 ---
 .../omapdrm/displays/panel-sony-acx565akm.c   | 18 +--
 .../omapdrm/displays/panel-tpo-td028ttec1.c   | 14 +
 .../omapdrm/displays/panel-tpo-td043mtea1.c   | 10 ---
 drivers/gpu/drm/omapdrm/omap_encoder.c| 30 +--
 12 files changed, 32 insertions(+), 161 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index 28a3ce8f88d2..910a5b9c036a 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -37,40 +37,19 @@ static void tvc_disconnect(struct omap_dss_device *src,
 
 static int tvc_enable(struct omap_dss_device *dssdev)
 {
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
-   int r;
 
-   dev_dbg(ddata->dev, "enable\n");
-
-   if (!omapdss_device_is_connected(dssdev))
-   return -ENODEV;
-
-   if (omapdss_device_is_enabled(dssdev))
-   return 0;
-
-   r = src->ops->enable(src);
-   if (r)
-   return r;
-
-   dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-
-   return r;
+   return src->ops->enable(src);
 }
 
 static void tvc_disable(struct omap_dss_device *dssdev)
 {
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
 
-   dev_dbg(ddata->dev, "disable\n");
-
if (!omapdss_device_is_enabled(dssdev))
return;
 
src->ops->disable(src);
-
-   dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
 }
 
 static const struct omap_dss_device_ops tvc_ops = {
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index 24b14f44248e..1e0925791c3d 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -49,21 +49,8 @@ static void dvic_disconnect(struct omap_dss_device *src,
 static int dvic_enable(struct omap_dss_device *dssdev)
 {
struct omap_dss_device *src = dssdev->src;
-   int r;
 
-   if (!omapdss_device_is_connected(dssdev))
-   return -ENODEV;
-
-   if (omapdss_device_is_enabled(dssdev))
-   return 0;
-
-   r = src->ops->enable(src);
-   if (r)
-   return r;
-
-   dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-
-   return 0;
+   return src->ops->enable(src);
 }
 
 static void dvic_disable(struct omap_dss_device *dssdev)
@@ -74,8 +61,6 @@ static void dvic_disable(struct omap_dss_device *dssdev)
return;
 
src->ops->disable(src);
-
-   dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
 }
 
 static int dvic_ddc_read(struct i2c_adapter *adapter,
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index e602fa4a50a4..649364e04edd 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -43,40 +43,19 @@ static void hdmic_disconnect(struct omap_dss_device *src,
 
 static int hdmic_enable(struct omap_dss_device *dssdev)
 {
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
-   int r;
 
-   dev_dbg(ddata->dev, "enable\n");
-
-   if (!omapdss_device_is_connected(dssdev))
-   return -ENODEV;
-
-   if (omapdss_device_is_enabled(dssdev))
-   return 0;
-
-   r = src->ops->enable(src);
-   if (r)
-   return r;
-
-   dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
-
-   return r;
+   return src->ops->enable(src);
 }
 
 static void hdmic_disable(struct omap_dss_device *dssdev)
 {
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
struct omap_dss_device *src = dssdev->src;
 
-   dev_dbg(ddata->dev, "disable\n");
-
if (!omapdss_device_is_enabled(dssdev))
return;
 
src->ops->disable(src);
-
-  

[PATCH v3 32/50] drm/omap: Simplify OF lookup of DSS devices

2019-02-11 Thread Laurent Pinchart
Now that the direction of OF graph walk has been reversed, there's no
need to lookup devices by port as we have no sink device connected
through multiple sink ports. Simplify OF lookup of the DSS devices to
look them up by node only.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c|  5 +--
 drivers/gpu/drm/omapdrm/dss/dss-of.c  | 60 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 +-
 3 files changed, 10 insertions(+), 58 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 62ccbeb99a84..d14abde3c5f0 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -112,13 +112,12 @@ void omapdss_device_put(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL(omapdss_device_put);
 
-struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
-   unsigned int port)
+struct omap_dss_device *omapdss_find_device_by_node(struct device_node *node)
 {
struct omap_dss_device *dssdev;
 
list_for_each_entry(dssdev, &omapdss_devices_list, list) {
-   if (dssdev->dev->of_node == src && dssdev->of_ports & BIT(port))
+   if (dssdev->dev->of_node == node)
return omapdss_device_get(dssdev);
}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c 
b/drivers/gpu/drm/omapdrm/dss/dss-of.c
index 0422597ac6b0..b2094055c5fc 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss-of.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c
@@ -12,71 +12,25 @@
  * more details.
  */
 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
 
 #include "omapdss.h"
 
-static struct device_node *
-dss_of_port_get_parent_device(struct device_node *port)
-{
-   struct device_node *np;
-   int i;
-
-   if (!port)
-   return NULL;
-
-   np = of_get_parent(port);
-
-   for (i = 0; i < 2 && np; ++i) {
-   struct property *prop;
-
-   prop = of_find_property(np, "compatible", NULL);
-
-   if (prop)
-   return np;
-
-   np = of_get_next_parent(np);
-   }
-
-   return NULL;
-}
-
 struct omap_dss_device *
 omapdss_of_find_connected_device(struct device_node *node, unsigned int port)
 {
-   struct device_node *src_node;
-   struct device_node *src_port;
-   struct device_node *ep;
-   struct omap_dss_device *src;
-   u32 port_number = 0;
+   struct device_node *remote_node;
+   struct omap_dss_device *dssdev;
 
-   /* Get the endpoint... */
-   ep = of_graph_get_endpoint_by_regs(node, port, 0);
-   if (!ep)
+   remote_node = of_graph_get_remote_node(node, port, 0);
+   if (!remote_node)
return NULL;
 
-   /* ... and its remote port... */
-   src_port = of_graph_get_remote_port(ep);
-   of_node_put(ep);
-   if (!src_port)
-   return NULL;
-
-   /* ... and the remote port's number and parent... */
-   of_property_read_u32(src_port, "reg", &port_number);
-   src_node = dss_of_port_get_parent_device(src_port);
-   of_node_put(src_port);
-   if (!src_node)
-   return ERR_PTR(-EINVAL);
-
-   /* ... and finally the connected device. */
-   src = omapdss_find_device_by_port(src_node, port_number);
-   of_node_put(src_node);
+   dssdev = omapdss_find_device_by_node(remote_node);
+   of_node_put(remote_node);
 
-   return src ? src : ERR_PTR(-EPROBE_DEFER);
+   return dssdev ? dssdev : ERR_PTR(-EPROBE_DEFER);
 }
 EXPORT_SYMBOL_GPL(omapdss_of_find_connected_device);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index a63b1d4b7a8a..d13a6b5774e8 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -474,8 +474,7 @@ void omapdss_device_register(struct omap_dss_device 
*dssdev);
 void omapdss_device_unregister(struct omap_dss_device *dssdev);
 struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);
 void omapdss_device_put(struct omap_dss_device *dssdev);
-struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
-   unsigned int port);
+struct omap_dss_device *omapdss_find_device_by_node(struct device_node *node);
 int omapdss_device_connect(struct dss_device *dss,
   struct omap_dss_device *src,
   struct omap_dss_device *dst);
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 13/50] drm/omap: Reverse direction of the DSS device enable/disable operations

2019-02-11 Thread Laurent Pinchart
The omapdrm and omapdss drivers are architectured based on display
pipelines made of multiple components handled from sink (display) to
source (DSS output). This is incompatible with the DRM bridge and panel
APIs that handle components from source to sink.

Reconcile the omapdrm and omapdss drivers with the DRM bridge and panel
model by reversing the direction of the DSS device .enable() and
.disable() operations. This completes the move to the DRM bridge model,
with the notable exception of the DSI pipelines that will require more
work.

We also adapt the omapdss shutdown handler dss_shutdown() to shut down
all active pipelines starting from the pipeline output device instead of
the display device.

As a consequence the for_each_dss_display() macro isn't used and can be
removed, and the omapdss_device_get_next() function underlying the macro
can be simplified to search for output devices only.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
Changes since v1:

- Shutdown pipelines starting at the output device
---
 .../omapdrm/displays/connector-analog-tv.c| 21 --
 .../gpu/drm/omapdrm/displays/connector-dvi.c  | 21 --
 .../gpu/drm/omapdrm/displays/connector-hdmi.c | 21 --
 .../gpu/drm/omapdrm/displays/encoder-opa362.c | 25 +--
 .../gpu/drm/omapdrm/displays/encoder-tfp410.c | 21 +-
 .../drm/omapdrm/displays/encoder-tpd12s015.c  | 35 -
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  | 18 +
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 22 ++
 .../displays/panel-lgphilips-lb035q02.c   | 16 +---
 .../omapdrm/displays/panel-nec-nl8048hl11.c   | 16 +---
 .../displays/panel-sharp-ls037v7dw01.c| 32 
 .../omapdrm/displays/panel-sony-acx565akm.c   | 18 +
 .../omapdrm/displays/panel-tpo-td028ttec1.c   | 25 ++-
 .../omapdrm/displays/panel-tpo-td043mtea1.c   | 17 +
 drivers/gpu/drm/omapdrm/dss/base.c| 73 +++
 drivers/gpu/drm/omapdrm/dss/dpi.c |  5 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c |  7 +-
 drivers/gpu/drm/omapdrm/dss/dss.c |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 12 +--
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 12 +--
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 +++--
 drivers/gpu/drm/omapdrm/dss/sdi.c |  8 +-
 drivers/gpu/drm/omapdrm/dss/venc.c| 12 +--
 drivers/gpu/drm/omapdrm/omap_encoder.c| 49 ++---
 24 files changed, 171 insertions(+), 337 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index 2b5b77627cfb..1503563117f3 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -35,26 +35,9 @@ static void tvc_disconnect(struct omap_dss_device *src,
 {
 }
 
-static int tvc_enable(struct omap_dss_device *dssdev)
-{
-   struct omap_dss_device *src = dssdev->src;
-
-   return src->ops->enable(src);
-}
-
-static void tvc_disable(struct omap_dss_device *dssdev)
-{
-   struct omap_dss_device *src = dssdev->src;
-
-   src->ops->disable(src);
-}
-
 static const struct omap_dss_device_ops tvc_ops = {
.connect= tvc_connect,
.disconnect = tvc_disconnect,
-
-   .enable = tvc_enable,
-   .disable= tvc_disable,
 };
 
 static int tvc_probe(struct platform_device *pdev)
@@ -85,13 +68,9 @@ static int tvc_probe(struct platform_device *pdev)
 static int __exit tvc_remove(struct platform_device *pdev)
 {
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct omap_dss_device *dssdev = &ddata->dssdev;
 
omapdss_device_unregister(&ddata->dssdev);
 
-   if (omapdss_device_is_enabled(dssdev))
-   tvc_disable(dssdev);
-
return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index a1784e263835..bf5ee50ce5fe 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -46,20 +46,6 @@ static void dvic_disconnect(struct omap_dss_device *src,
 {
 }
 
-static int dvic_enable(struct omap_dss_device *dssdev)
-{
-   struct omap_dss_device *src = dssdev->src;
-
-   return src->ops->enable(src);
-}
-
-static void dvic_disable(struct omap_dss_device *dssdev)
-{
-   struct omap_dss_device *src = dssdev->src;
-
-   src->ops->disable(src);
-}
-
 static int dvic_ddc_read(struct i2c_adapter *adapter,
unsigned char *buf, u16 count, u8 offset)
 {
@@ -163,9 +149,6 @@ static const struct omap_dss_device_ops dvic_ops = {
.connect= dvic_connect,
.disconnect = dvic_disconnect,
 
-   .enable = dvic_enable,
-   .disable= dvic_disable,
-
.read_edid  = dvic_read_edid,
 

[PATCH v3 08/50] drm/omap: Use atomic suspend/resume helpers

2019-02-11 Thread Laurent Pinchart
Instead of rolling out custom suspend/resume implementations based on
state information stored in the driver's data structures, use the atomic
suspend/resume helpers that rely on a DRM atomic state object.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
Reviewed-by: Tomi Valkeinen 
---
Changes since v1:

- Use drm_mode_config_helper_suspend()
---
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 --
 drivers/gpu/drm/omapdrm/omap_drv.c| 50 ++-
 2 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 3b4bf5c47173..7b2f2c8bf893 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -432,9 +432,6 @@ struct omap_dss_device {
unsigned long ops_flags;
u32 bus_flags;
 
-   /* helper variable for driver suspend/resume */
-   bool activate_after_resume;
-
enum omap_display_caps caps;
 
enum omap_dss_display_state state;
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index f8292278f57d..bddd4c1c43ae 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -685,54 +685,12 @@ static int pdev_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int omap_drm_suspend_all_displays(struct drm_device *ddev)
-{
-   struct omap_drm_private *priv = ddev->dev_private;
-   int i;
-
-   for (i = 0; i < priv->num_pipes; i++) {
-   struct omap_dss_device *display = priv->pipes[i].display;
-
-   if (display->state == OMAP_DSS_DISPLAY_ACTIVE) {
-   display->ops->disable(display);
-   display->activate_after_resume = true;
-   } else {
-   display->activate_after_resume = false;
-   }
-   }
-
-   return 0;
-}
-
-static int omap_drm_resume_all_displays(struct drm_device *ddev)
-{
-   struct omap_drm_private *priv = ddev->dev_private;
-   int i;
-
-   for (i = 0; i < priv->num_pipes; i++) {
-   struct omap_dss_device *display = priv->pipes[i].display;
-
-   if (display->activate_after_resume) {
-   display->ops->enable(display);
-   display->activate_after_resume = false;
-   }
-   }
-
-   return 0;
-}
-
 static int omap_drm_suspend(struct device *dev)
 {
struct omap_drm_private *priv = dev_get_drvdata(dev);
struct drm_device *drm_dev = priv->ddev;
 
-   drm_kms_helper_poll_disable(drm_dev);
-
-   drm_modeset_lock_all(drm_dev);
-   omap_drm_suspend_all_displays(drm_dev);
-   drm_modeset_unlock_all(drm_dev);
-
-   return 0;
+   return drm_mode_config_helper_suspend(drm_dev);
 }
 
 static int omap_drm_resume(struct device *dev)
@@ -740,11 +698,7 @@ static int omap_drm_resume(struct device *dev)
struct omap_drm_private *priv = dev_get_drvdata(dev);
struct drm_device *drm_dev = priv->ddev;
 
-   drm_modeset_lock_all(drm_dev);
-   omap_drm_resume_all_displays(drm_dev);
-   drm_modeset_unlock_all(drm_dev);
-
-   drm_kms_helper_poll_enable(drm_dev);
+   drm_mode_config_helper_resume(drm_dev);
 
return omap_gem_resume(drm_dev);
 }
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 07/50] drm/omap: venc: Remove wss_data field from venc_device structure

2019-02-11 Thread Laurent Pinchart
The venc_device structure wss_data field is set to 0 and never otherwise
modified, remove it.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
Reviewed-by: Tomi Valkeinen 
---
 drivers/gpu/drm/omapdrm/dss/venc.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index b5f52727f8b1..fbe9d42dbdb6 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -323,7 +323,6 @@ struct venc_device {
struct platform_device *pdev;
void __iomem *base;
struct mutex venc_lock;
-   u32 wss_data;
struct regulator *vdda_dac_reg;
struct dss_device *dss;
 
@@ -367,8 +366,7 @@ static void venc_write_config(struct venc_device *venc,
venc_write_reg(venc, VENC_BLACK_LEVEL, config->black_level);
venc_write_reg(venc, VENC_BLANK_LEVEL, config->blank_level);
venc_write_reg(venc, VENC_M_CONTROL, config->m_control);
-   venc_write_reg(venc, VENC_BSTAMP_WSS_DATA, config->bstamp_wss_data |
-  venc->wss_data);
+   venc_write_reg(venc, VENC_BSTAMP_WSS_DATA, config->bstamp_wss_data);
venc_write_reg(venc, VENC_S_CARR, config->s_carr);
venc_write_reg(venc, VENC_L21__WC_CTL, config->l21__wc_ctl);
venc_write_reg(venc, VENC_SAVID__EAVID, config->savid__eavid);
@@ -543,8 +541,6 @@ static int venc_display_enable(struct omap_dss_device 
*dssdev)
if (r)
goto err0;
 
-   venc->wss_data = 0;
-
mutex_unlock(&venc->venc_lock);
 
return 0;
@@ -585,10 +581,6 @@ static void venc_set_timings(struct omap_dss_device 
*dssdev,
 
mutex_lock(&venc->venc_lock);
 
-   /* Reset WSS data when the TV standard changes. */
-   if (memcmp(&venc->vm, vm, sizeof(*vm)))
-   venc->wss_data = 0;
-
venc->vm = *vm;
 
dispc_set_tv_pclk(venc->dss->dispc, 1350);
@@ -878,7 +870,6 @@ static int venc_probe(struct platform_device *pdev)
 
mutex_init(&venc->venc_lock);
 
-   venc->wss_data = 0;
venc->vm = omap_dss_pal_vm;
 
venc_mem = platform_get_resource(venc->pdev, IORESOURCE_MEM, 0);
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 17/50] drm/omap: Merge display .get_modes() and .get_size() operations

2019-02-11 Thread Laurent Pinchart
Now that the .get_modes() operations takes a drm_connector and fills it
with modes, it becomes easy to fill display information in the same
operation without requiring a separate .get_size() opearation.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 14 +++---
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  3 ---
 drivers/gpu/drm/omapdrm/omap_connector.c| 15 ++-
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 9cd9ab487a24..c5f570106a17 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -1117,6 +1117,9 @@ static int dsicm_get_modes(struct omap_dss_device *dssdev,
 {
struct panel_drv_data *ddata = to_panel_data(dssdev);
 
+   connector->display_info.width_mm = ddata->width_mm;
+   connector->display_info.height_mm = ddata->height_mm;
+
return omapdss_display_get_modes(connector, &ddata->vm);
 }
 
@@ -1142,15 +1145,6 @@ static int dsicm_check_timings(struct omap_dss_device 
*dssdev,
return ret;
 }
 
-static void dsicm_get_size(struct omap_dss_device *dssdev,
- unsigned int *width, unsigned int *height)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-
-   *width = ddata->width_mm;
-   *height = ddata->height_mm;
-}
-
 static const struct omap_dss_device_ops dsicm_ops = {
.connect= dsicm_connect,
.disconnect = dsicm_disconnect,
@@ -1166,8 +1160,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
.update = dsicm_update,
.sync   = dsicm_sync,
 
-   .get_size   = dsicm_get_size,
-
.enable_te  = dsicm_enable_te,
.get_te = dsicm_get_te,
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 88fa61ddc959..7637fc041b71 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -457,9 +457,6 @@ struct omap_dss_driver {
int (*memory_read)(struct omap_dss_device *dssdev,
void *buf, size_t size,
u16 x, u16 y, u16 w, u16 h);
-
-   void (*get_size)(struct omap_dss_device *dssdev,
-unsigned int *width, unsigned int *height);
 };
 
 struct dss_device *omapdss_get_dss(void);
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
index 8d9197eebb53..c0157554c12f 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -225,19 +225,8 @@ static int omap_connector_get_modes(struct drm_connector 
*connector)
return omap_connector_get_modes_edid(connector, dssdev);
 
/*
-* Otherwise we have either a fixed resolution panel or an output that
-* doesn't support modes discovery (e.g. DVI or VGA with the DDC bus
-* unconnected, or analog TV). Start by querying the size.
-*/
-   dssdev = omap_connector->display;
-   if (dssdev->driver && dssdev->driver->get_size)
-   dssdev->driver->get_size(dssdev,
-&connector->display_info.width_mm,
-&connector->display_info.height_mm);
-
-   /*
-* If the display pipeline reports modes (e.g. with a fixed resolution
-* panel or an analog TV output), query it.
+* Otherwise if the display pipeline reports modes (e.g. with a fixed
+* resolution panel or an analog TV output), query it.
 */
for (dssdev = omap_connector->display; dssdev; dssdev = dssdev->src) {
if (dssdev->ops->get_modes)
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 38/50] dt-bindings: display: tfp410: Add bus parameters properties

2019-02-11 Thread Laurent Pinchart
The TFP410 supports configuration of several input bus parameters
through either the I2C port or chip pins. In the latter case, we need to
specify those parameters in DT.

Two new properties are added, ti,deskew to specify the data de-skew
configuration (as set through the DK[3:1] pins), and pclk-sample to
specify the pixel clock sampling edge (as set through the EDGE pin).

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Rob Herring 
Tested-by: Sebastian Reichel 
---
 .../bindings/display/bridge/ti,tfp410.txt | 24 ++-
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt 
b/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
index 54d7e31525ec..3f903af93949 100644
--- a/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
+++ b/Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
@@ -6,15 +6,25 @@ Required properties:
 
 Optional properties:
 - powerdown-gpios: power-down gpio
-- reg: I2C address. If and only if present the device node
-   should be placed into the i2c controller node where the
-   tfp410 i2c is connected to.
+- reg: I2C address. If and only if present the device node should be placed
+  into the I2C controller node where the TFP410 I2C is connected to.
+- ti,deskew: data de-skew in 350ps increments, from -4 to +3, as configured
+  through th DK[3:1] pins. This property shall be present only if the TFP410
+  is not connected through I2C.
 
 Required nodes:
-- Video port 0 for DPI input [1].
-- Video port 1 for DVI output [1].
 
-[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
+This device has two video ports. Their connections are modeled using the OF
+graph bindings specified in [1]. Each port node shall have a single endpoint.
+
+- Port 0 is the DPI input port. Its endpoint subnode shall contain a
+  pclk-sample property and a remote-endpoint property as specified in [1].
+
+- Port 1 is the DVI output port. Its endpoint subnode shall contain a
+  remote-endpoint property is specified in [1].
+
+[1] Documentation/devicetree/bindings/media/video-interfaces.txt
+
 
 Example
 ---
@@ -22,6 +32,7 @@ Example
 tfp410: encoder@0 {
compatible = "ti,tfp410";
powerdown-gpios = <&twl_gpio 2 GPIO_ACTIVE_LOW>;
+   ti,deskew = <4>;
 
ports {
#address-cells = <1>;
@@ -31,6 +42,7 @@ tfp410: encoder@0 {
reg = <0>;
 
tfp410_in: endpoint@0 {
+   pclk-sample = <1>;
remote-endpoint = <&dpi_out>;
};
};
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 31/50] drm/omap: Store pixel clock instead of full mode in DPI and SDI encoders

2019-02-11 Thread Laurent Pinchart
The DPI and SDI encoders store the full videomode upon mode set, to only
use the value of the pixel clock when enabling the encoder. This wastes
memory. Store the pixel clock value only.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 9 -
 drivers/gpu/drm/omapdrm/dss/sdi.c | 6 +++---
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
b/drivers/gpu/drm/omapdrm/dss/dpi.c
index 0cb3cb72f15f..295bc3eeea80 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -47,8 +47,8 @@ struct dpi_data {
 
struct mutex lock;
 
-   struct videomode vm;
struct dss_lcd_mgr_config mgr_config;
+   unsigned long pixelclock;
int data_lines;
 
struct omap_dss_device output;
@@ -347,16 +347,15 @@ static int dpi_set_dispc_clk(struct dpi_data *dpi, 
unsigned long pck_req,
 
 static int dpi_set_mode(struct dpi_data *dpi)
 {
-   const struct videomode *vm = &dpi->vm;
int lck_div = 0, pck_div = 0;
unsigned long fck = 0;
int r = 0;
 
if (dpi->pll)
r = dpi_set_pll_clk(dpi, dpi->output.dispc_channel,
-   vm->pixelclock, &fck, &lck_div, &pck_div);
+   dpi->pixelclock, &fck, &lck_div, &pck_div);
else
-   r = dpi_set_dispc_clk(dpi, vm->pixelclock, &fck,
+   r = dpi_set_dispc_clk(dpi, dpi->pixelclock, &fck,
&lck_div, &pck_div);
if (r)
return r;
@@ -467,7 +466,7 @@ static void dpi_set_timings(struct omap_dss_device *dssdev,
 
mutex_lock(&dpi->lock);
 
-   drm_display_mode_to_videomode(mode, &dpi->vm);
+   dpi->pixelclock = mode->clock * 1000;
 
mutex_unlock(&dpi->lock);
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c 
b/drivers/gpu/drm/omapdrm/dss/sdi.c
index f096a7f77e5f..38b0bf19538d 100644
--- a/drivers/gpu/drm/omapdrm/dss/sdi.c
+++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
@@ -37,7 +37,7 @@ struct sdi_device {
struct regulator *vdds_sdi_reg;
 
struct dss_lcd_mgr_config mgr_config;
-   struct videomode vm;
+   unsigned long pixelclock;
int datapairs;
 
struct omap_dss_device output;
@@ -144,7 +144,7 @@ static void sdi_display_enable(struct omap_dss_device 
*dssdev)
if (r)
goto err_get_dispc;
 
-   r = sdi_calc_clock_div(sdi, sdi->vm.pixelclock, &fck, &dispc_cinfo);
+   r = sdi_calc_clock_div(sdi, sdi->pixelclock, &fck, &dispc_cinfo);
if (r)
goto err_calc_clock_div;
 
@@ -210,7 +210,7 @@ static void sdi_set_timings(struct omap_dss_device *dssdev,
 {
struct sdi_device *sdi = dssdev_to_sdi(dssdev);
 
-   drm_display_mode_to_videomode(mode, &sdi->vm);
+   sdi->pixelclock = mode->clock * 1000;
 }
 
 static int sdi_check_timings(struct omap_dss_device *dssdev,
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 23/50] drm/omap: panel-dsi-cm: Store source pointer internally

2019-02-11 Thread Laurent Pinchart
The source pointer will be removed to the omap_dss_device structure.
Store it internally in the DSI panel driver data.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 55 ++-
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index fe9d9f847d2e..ce812094177c 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -43,6 +43,7 @@
 
 struct panel_drv_data {
struct omap_dss_device dssdev;
+   struct omap_dss_device *src;
 
struct videomode vm;
 
@@ -143,7 +144,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
 
 static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 *data)
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
int r;
u8 buf[1];
 
@@ -159,14 +160,14 @@ static int dsicm_dcs_read_1(struct panel_drv_data *ddata, 
u8 dcs_cmd, u8 *data)
 
 static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
 
return src->ops->dsi.dcs_write(src, ddata->channel, &dcs_cmd, 1);
 }
 
 static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
param)
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
u8 buf[2] = { dcs_cmd, param };
 
return src->ops->dsi.dcs_write(src, ddata->channel, buf, 2);
@@ -175,7 +176,7 @@ static int dsicm_dcs_write_1(struct panel_drv_data *ddata, 
u8 dcs_cmd, u8 param)
 static int dsicm_sleep_in(struct panel_drv_data *ddata)
 
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
u8 cmd;
int r;
 
@@ -230,7 +231,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
*id1, u8 *id2, u8 *id3)
 static int dsicm_set_update_window(struct panel_drv_data *ddata,
u16 x, u16 y, u16 w, u16 h)
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
int r;
u16 x1 = x;
u16 x2 = x + w - 1;
@@ -277,7 +278,7 @@ static void dsicm_cancel_ulps_work(struct panel_drv_data 
*ddata)
 
 static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
int r;
 
if (ddata->ulps_enabled)
@@ -311,7 +312,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
 
 static int dsicm_exit_ulps(struct panel_drv_data *ddata)
 {
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
int r;
 
if (!ddata->ulps_enabled)
@@ -363,7 +364,7 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
 static int dsicm_bl_update_status(struct backlight_device *dev)
 {
struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
int r = 0;
int level;
 
@@ -411,7 +412,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
 {
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
u8 errors = 0;
int r;
 
@@ -443,7 +444,7 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
 {
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
u8 id1, id2, id3;
int r;
 
@@ -475,7 +476,7 @@ static ssize_t dsicm_store_ulps(struct device *dev,
 {
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
unsigned long t;
int r;
 
@@ -525,7 +526,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device *dev,
 {
struct platform_device *pdev = to_platform_device(dev);
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct omap_dss_device *src = ddata->dssdev.src;
+   struct omap_dss_device *src = ddata->src;
unsigned long t;
int r;
 
@@ -600,7 +601,7 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
 
 static int dsicm_power_on(struct panel_drv_data *ddata)
 {
-   struct omap_dss_device *src 

[PATCH v3 14/50] drm/omap: Remove omap_dss_device dst field

2019-02-11 Thread Laurent Pinchart
The field is only used in a safety check during device
connection/disconnection, where the src field can be easily used
instead. Remove it and use src.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c| 6 ++
 drivers/gpu/drm/omapdrm/dss/omapdss.h | 1 -
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 916225d62cc2..76470ba45660 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -199,9 +199,8 @@ int omapdss_device_connect(struct dss_device *dss,
}
 
if (src) {
-   WARN_ON(src->dst);
+   WARN_ON(dst->src);
dst->src = src;
-   src->dst = dst;
}
 
return 0;
@@ -219,11 +218,10 @@ void omapdss_device_disconnect(struct omap_dss_device 
*src,
}
 
if (src) {
-   if (WARN_ON(dst != src->dst))
+   if (WARN_ON(dst->src != src))
return;
 
dst->src = NULL;
-   src->dst = NULL;
}
 
WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index 4cd3874228a5..fc82b8f545ae 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -406,7 +406,6 @@ struct omap_dss_device {
 
struct dss_device *dss;
struct omap_dss_device *src;
-   struct omap_dss_device *dst;
struct omap_dss_device *next;
 
struct list_head list;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 11/50] drm/omap: Remove connection checks from display .enable() and .remove()

2019-02-11 Thread Laurent Pinchart
The displays (connectors, panels and encoders) return an error from
their .enable() handler when the dss device is not connected. They also
disconnect the dss device explicitly from their .remove() handler if it
is still connected.

Those safety checks are not needed:

- The .enable() handler is called from code paths that access the dss
  devices chain from the display device, which is set to NULL when the
  device isn't connected.

- The .remove() handler can only be called when unloading the module as
  the driver has the suppress_bind_attrs attribute set, and a reference
  to the module is taken when constructing the dss devices chain, so the
  module can only be unloaded when the dss device is disconnected.

Remove the safety checks.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/encoder-opa362.c   |  7 ---
 .../gpu/drm/omapdrm/displays/encoder-tfp410.c   |  7 ---
 .../drm/omapdrm/displays/encoder-tpd12s015.c|  4 
 drivers/gpu/drm/omapdrm/dss/base.c  |  5 +
 drivers/gpu/drm/omapdrm/dss/omapdss.h   |  5 -
 drivers/gpu/drm/omapdrm/omap_encoder.c  | 17 +
 6 files changed, 10 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index 4fefd80f53bb..0b1032625e42 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -49,9 +49,6 @@ static int opa362_enable(struct omap_dss_device *dssdev)
 
dev_dbg(dssdev->dev, "enable\n");
 
-   if (!omapdss_device_is_connected(dssdev))
-   return -ENODEV;
-
if (omapdss_device_is_enabled(dssdev))
return 0;
 
@@ -145,10 +142,6 @@ static int __exit opa362_remove(struct platform_device 
*pdev)
if (omapdss_device_is_enabled(dssdev))
opa362_disable(dssdev);
 
-   WARN_ON(omapdss_device_is_connected(dssdev));
-   if (omapdss_device_is_connected(dssdev))
-   omapdss_device_disconnect(NULL, dssdev);
-
return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index f1a748353279..fcc2dc5188a2 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -42,9 +42,6 @@ static int tfp410_enable(struct omap_dss_device *dssdev)
struct omap_dss_device *src = dssdev->src;
int r;
 
-   if (!omapdss_device_is_connected(dssdev))
-   return -ENODEV;
-
if (omapdss_device_is_enabled(dssdev))
return 0;
 
@@ -139,10 +136,6 @@ static int __exit tfp410_remove(struct platform_device 
*pdev)
if (omapdss_device_is_enabled(dssdev))
tfp410_disable(dssdev);
 
-   WARN_ON(omapdss_device_is_connected(dssdev));
-   if (omapdss_device_is_connected(dssdev))
-   omapdss_device_disconnect(NULL, dssdev);
-
return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
index 94de55fd8884..1a2bc59bf104 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
@@ -229,10 +229,6 @@ static int __exit tpd_remove(struct platform_device *pdev)
if (omapdss_device_is_enabled(dssdev))
tpd_disable(dssdev);
 
-   WARN_ON(omapdss_device_is_connected(dssdev));
-   if (omapdss_device_is_connected(dssdev))
-   omapdss_device_disconnect(NULL, dssdev);
-
return 0;
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 472f56e3de70..787157b00694 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -185,6 +185,11 @@ struct omap_dss_device *omapdss_device_get_next(struct 
omap_dss_device *from,
 }
 EXPORT_SYMBOL(omapdss_device_get_next);
 
+static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
+{
+   return dssdev->src;
+}
+
 int omapdss_device_connect(struct dss_device *dss,
   struct omap_dss_device *src,
   struct omap_dss_device *dst)
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index de0520a8eb4e..698155dd7941 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -505,11 +505,6 @@ int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void 
*arg, u32 mask);
 int omapdss_compat_init(void);
 void omapdss_compat_uninit(void);
 
-static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
-{
-   return dssdev->src;
-}
-
 static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
 {
return dssdev->state == OMAP_DSS_DISPLAY

[PATCH v3 10/50] drm/omap: Remove connection checks from internal encoders .enable()

2019-02-11 Thread Laurent Pinchart
The internal encoders return an error from their .enable() handler when
their are not connected to a dss manager. As the flag used is set and
cleared in the connect and disconnect handlers, this effectively checks
whether the omap_dss_device is connected.

The .enable() handler is called from code paths that access the dss
devices chain from the display device, which is set to NULL when the
device isn't connected, making it impossible to access the device in
that case.

The safety check is thus not needed, remove it.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/dpi.c | 17 +
 drivers/gpu/drm/omapdrm/dss/dsi.c | 20 ++--
 drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 17 +
 drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 17 +
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  1 -
 drivers/gpu/drm/omapdrm/dss/sdi.c | 16 +---
 drivers/gpu/drm/omapdrm/dss/venc.c| 17 +
 7 files changed, 7 insertions(+), 98 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
b/drivers/gpu/drm/omapdrm/dss/dpi.c
index ca4f3c4c6318..0cf3b220e35f 100644
--- a/drivers/gpu/drm/omapdrm/dss/dpi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
@@ -386,12 +386,6 @@ static int dpi_display_enable(struct omap_dss_device 
*dssdev)
 
mutex_lock(&dpi->lock);
 
-   if (!out->dispc_channel_connected) {
-   DSSERR("failed to enable display: no output/manager\n");
-   r = -ENODEV;
-   goto err_no_out_mgr;
-   }
-
if (dpi->vdds_dsi_reg) {
r = regulator_enable(dpi->vdds_dsi_reg);
if (r)
@@ -439,7 +433,6 @@ static int dpi_display_enable(struct omap_dss_device 
*dssdev)
if (dpi->vdds_dsi_reg)
regulator_disable(dpi->vdds_dsi_reg);
 err_reg_enable:
-err_no_out_mgr:
mutex_unlock(&dpi->lock);
return r;
 }
@@ -596,23 +589,15 @@ static int dpi_connect(struct omap_dss_device *src,
   struct omap_dss_device *dst)
 {
struct dpi_data *dpi = dpi_get_data_from_dssdev(dst);
-   int r;
 
dpi_init_pll(dpi);
 
-   r = omapdss_device_connect(dst->dss, dst, dst->next);
-   if (r)
-   return r;
-
-   dst->dispc_channel_connected = true;
-   return 0;
+   return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void dpi_disconnect(struct omap_dss_device *src,
   struct omap_dss_device *dst)
 {
-   dst->dispc_channel_connected = false;
-
omapdss_device_disconnect(dst, dst->next);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 64fb788b6647..c14f8fb2a99b 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -3753,19 +3753,13 @@ static int dsi_enable_video_output(struct 
omap_dss_device *dssdev, int channel)
 {
struct dsi_data *dsi = to_dsi_data(dssdev);
int bpp = dsi_get_pixel_size(dsi->pix_fmt);
-   struct omap_dss_device *out = &dsi->output;
u8 data_type;
u16 word_count;
int r;
 
-   if (!out->dispc_channel_connected) {
-   DSSERR("failed to enable display: no output/manager\n");
-   return -ENODEV;
-   }
-
r = dsi_display_init_dispc(dsi);
if (r)
-   goto err_init_dispc;
+   return r;
 
if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
switch (dsi->pix_fmt) {
@@ -3814,7 +3808,6 @@ static int dsi_enable_video_output(struct omap_dss_device 
*dssdev, int channel)
}
 err_pix_fmt:
dsi_display_uninit_dispc(dsi);
-err_init_dispc:
return r;
 }
 
@@ -4888,21 +4881,12 @@ static int dsi_get_clocks(struct dsi_data *dsi)
 static int dsi_connect(struct omap_dss_device *src,
   struct omap_dss_device *dst)
 {
-   int r;
-
-   r = omapdss_device_connect(dst->dss, dst, dst->next);
-   if (r)
-   return r;
-
-   dst->dispc_channel_connected = true;
-   return 0;
+   return omapdss_device_connect(dst->dss, dst, dst->next);
 }
 
 static void dsi_disconnect(struct omap_dss_device *src,
   struct omap_dss_device *dst)
 {
-   dst->dispc_channel_connected = false;
-
omapdss_device_disconnect(dst, dst->next);
 }
 
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index aabdda394c9c..b6b44f07c74e 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -322,12 +322,6 @@ static int hdmi_display_enable(struct omap_dss_device 
*dssdev)
 
mutex_lock(&hdmi->lock);
 
-   if (!dssdev->dispc_channel_connected) {
-   DSSERR("failed to enable display: no output/manager\n");
-   r = -ENODEV;
-   goto err0;
-   }
-
r = hdmi_power_on_ful

[PATCH v3 45/50] drm/omap: Add support for drm_bridge

2019-02-11 Thread Laurent Pinchart
Hook up drm_bridge support in the omapdrm driver. Despite the recent
extensive preparation work, this is a rather intrusive change, as the
management of outputs needs to be adapted through the driver to handle
both omap_dss_device and drm_bridge.

Connector creation is skipped when using a drm_bridge, as the bridge
creates the connector internally. This creates issues with systems that
split connector operations (such as modes retrieval and hot-plug
detection) across different bridges. These systems can't be supported
using drm_bridge for now (their support through the omap_dss_device
infrastructure is not affected), this will be fixed in subsequent
changes.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
Changes since v2:

- Remove struct omap_drm_pipeline display field

Changes since v1:

- Fix typo in function name (updata -> update)
---
 drivers/gpu/drm/omapdrm/dss/base.c   | 27 --
 drivers/gpu/drm/omapdrm/dss/omapdss.h|  1 +
 drivers/gpu/drm/omapdrm/dss/output.c | 21 +---
 drivers/gpu/drm/omapdrm/omap_connector.c | 16 --
 drivers/gpu/drm/omapdrm/omap_connector.h |  1 -
 drivers/gpu/drm/omapdrm/omap_crtc.c  |  2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c   | 69 +---
 drivers/gpu/drm/omapdrm/omap_drv.h   |  1 -
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 67 ++-
 9 files changed, 144 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 81ea0f55cd75..09c9f2971aa2 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dss.h"
 #include "omapdss.h"
@@ -156,7 +157,7 @@ struct omap_dss_device *omapdss_device_next_output(struct 
omap_dss_device *from)
goto done;
}
 
-   if (dssdev->id && dssdev->next)
+   if (dssdev->id && (dssdev->next || dssdev->bridge))
goto done;
}
 
@@ -184,7 +185,18 @@ int omapdss_device_connect(struct dss_device *dss,
 {
int ret;
 
-   dev_dbg(dst->dev, "connect\n");
+   dev_dbg(&dss->pdev->dev, "connect(%s, %s)\n",
+   src ? dev_name(src->dev) : "NULL",
+   dst ? dev_name(dst->dev) : "NULL");
+
+   if (!dst) {
+   /*
+* The destination is NULL when the source is connected to a
+* bridge instead of a DSS device. Stop here, we will attach the
+* bridge later when we will have a DRM encoder.
+*/
+   return src && src->bridge ? 0 : -EINVAL;
+   }
 
if (omapdss_device_is_connected(dst))
return -EBUSY;
@@ -204,7 +216,16 @@ EXPORT_SYMBOL_GPL(omapdss_device_connect);
 void omapdss_device_disconnect(struct omap_dss_device *src,
   struct omap_dss_device *dst)
 {
-   dev_dbg(dst->dev, "disconnect\n");
+   struct dss_device *dss = src ? src->dss : dst->dss;
+
+   dev_dbg(&dss->pdev->dev, "disconnect(%s, %s)\n",
+   src ? dev_name(src->dev) : "NULL",
+   dst ? dev_name(dst->dev) : "NULL");
+
+   if (!dst) {
+   WARN_ON(!src->bridge);
+   return;
+   }
 
if (!dst->id && !omapdss_device_is_connected(dst)) {
WARN_ON(!dst->display);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index ab5467a1e92c..f47e9b94288f 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -410,6 +410,7 @@ struct omap_dss_device {
 
struct dss_device *dss;
struct omap_dss_device *next;
+   struct drm_bridge *bridge;
 
struct list_head list;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index f25ecfd26534..2a53025c2fde 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -20,25 +20,34 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "dss.h"
 #include "omapdss.h"
 
 int omapdss_device_init_output(struct omap_dss_device *out)
 {
-   out->next = omapdss_of_find_connected_device(out->dev->of_node, 0);
-   if (IS_ERR(out->next)) {
-   if (PTR_ERR(out->next) != -EPROBE_DEFER)
-   dev_err(out->dev, "failed to find video sink\n");
-   return PTR_ERR(out->next);
+   struct device_node *remote_node;
+
+   remote_node = of_graph_get_remote_node(out->dev->of_node, 0, 0);
+   if (!remote_node) {
+   dev_dbg(out->dev, "failed to find video sink\n");
+   return 0;
}
 
+   out->next = omapdss_find_device_by_node(remote_node);
+   out->bridge = of_drm_find_bridge(remote_node);
+
+   of_node_put(remote_node);
+
if (out->next && out->type != out->next

[PATCH v3 30/50] drm/omap: venc: Use drm_display_mode natively

2019-02-11 Thread Laurent Pinchart
Replace internal usage of struct videomode with struct drm_display_mode
in order to avoid converting needlessly between the data structures.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
Changes since v1:

- Set mode.crtc_* fields and mode name in venc_check_timings()
---
 drivers/gpu/drm/omapdrm/dss/venc.c | 86 +++---
 1 file changed, 42 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
b/drivers/gpu/drm/omapdrm/dss/venc.c
index 7bce5898654a..f2cbecfd05b5 100644
--- a/drivers/gpu/drm/omapdrm/dss/venc.c
+++ b/drivers/gpu/drm/omapdrm/dss/venc.c
@@ -267,38 +267,34 @@ enum venc_videomode {
VENC_MODE_NTSC,
 };
 
-static const struct videomode omap_dss_pal_vm = {
-   .hactive= 720,
-   .vactive= 574,
-   .pixelclock = 1350,
-   .hsync_len  = 64,
-   .hfront_porch   = 12,
-   .hback_porch= 68,
-   .vsync_len  = 5,
-   .vfront_porch   = 5,
-   .vback_porch= 41,
+static const struct drm_display_mode omap_dss_pal_mode = {
+   .hdisplay   = 720,
+   .hsync_start= 732,
+   .hsync_end  = 796,
+   .htotal = 864,
+   .vdisplay   = 574,
+   .vsync_start= 579,
+   .vsync_end  = 584,
+   .vtotal = 625,
+   .clock  = 13500,
 
-   .flags  = DISPLAY_FLAGS_INTERLACED | DISPLAY_FLAGS_HSYNC_LOW |
- DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_DE_HIGH |
- DISPLAY_FLAGS_PIXDATA_POSEDGE |
- DISPLAY_FLAGS_SYNC_NEGEDGE,
+   .flags  = DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_NHSYNC |
+ DRM_MODE_FLAG_NVSYNC,
 };
 
-static const struct videomode omap_dss_ntsc_vm = {
-   .hactive= 720,
-   .vactive= 482,
-   .pixelclock = 1350,
-   .hsync_len  = 64,
-   .hfront_porch   = 16,
-   .hback_porch= 58,
-   .vsync_len  = 6,
-   .vfront_porch   = 6,
-   .vback_porch= 31,
+static const struct drm_display_mode omap_dss_ntsc_mode = {
+   .hdisplay   = 720,
+   .hsync_start= 736,
+   .hsync_end  = 800,
+   .htotal = 858,
+   .vdisplay   = 482,
+   .vsync_start= 488,
+   .vsync_end  = 494,
+   .vtotal = 525,
+   .clock  = 13500,
 
-   .flags  = DISPLAY_FLAGS_INTERLACED | DISPLAY_FLAGS_HSYNC_LOW |
- DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_DE_HIGH |
- DISPLAY_FLAGS_PIXDATA_POSEDGE |
- DISPLAY_FLAGS_SYNC_NEGEDGE,
+   .flags  = DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_NHSYNC |
+ DRM_MODE_FLAG_NVSYNC,
 };
 
 struct venc_device {
@@ -521,21 +517,19 @@ static void venc_display_disable(struct omap_dss_device 
*dssdev)
 static int venc_get_modes(struct omap_dss_device *dssdev,
  struct drm_connector *connector)
 {
-   static const struct videomode *modes[] = {
-   &omap_dss_pal_vm,
-   &omap_dss_ntsc_vm,
+   static const struct drm_display_mode *modes[] = {
+   &omap_dss_pal_mode,
+   &omap_dss_ntsc_mode,
};
unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(modes); ++i) {
struct drm_display_mode *mode;
 
-   mode = drm_mode_create(connector->dev);
+   mode = drm_mode_duplicate(connector->dev, modes[i]);
if (!mode)
return i;
 
-   drm_display_mode_from_videomode(modes[i], mode);
-
mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_set_name(mode);
drm_mode_probed_add(connector, mode);
@@ -549,14 +543,14 @@ static enum venc_videomode venc_get_videomode(const 
struct drm_display_mode *mod
if (!(mode->flags & DRM_MODE_FLAG_INTERLACE))
return VENC_MODE_UNKNOWN;
 
-   if (mode->clock == omap_dss_pal_vm.pixelclock / 1000 &&
-   mode->hdisplay == omap_dss_pal_vm.hactive &&
-   mode->vdisplay == omap_dss_pal_vm.vactive)
+   if (mode->clock == omap_dss_pal_mode.clock &&
+   mode->hdisplay == omap_dss_pal_mode.hdisplay &&
+   mode->vdisplay == omap_dss_pal_mode.vdisplay)
return VENC_MODE_PAL;
 
-   if (mode->clock == omap_dss_ntsc_vm.pixelclock / 1000 &&
-   mode->hdisplay == omap_dss_ntsc_vm.hactive &&
-   mode->vdisplay == omap_dss_ntsc_vm.vactive)
+   if (mode->clock == omap_dss_ntsc_mode.clock &&
+   mode->hdisplay == omap_dss_ntsc_mode.hdisplay &&
+   mode->vdisplay == omap_dss_ntsc_mode.vdisplay)
return VENC_MODE_NTSC;
 
return VENC_MODE_UNKNOWN;
@@ -597,16 +591,20 @@ static int venc_check_timings(struct omap_dss_

[PATCH v3 22/50] drm/omap: Don't store display pointer in omap_connector structure

2019-02-11 Thread Laurent Pinchart
Display pipelines based on drm_bridge are handled from the bridge
closest to the CRTC. To move to that model we thus need to transition
away from walking pipelines in the other direction, and from accessing
the device at the end of the pipeline when possible.

Remove most accesses to the display device from the omap_connector
implementation, and don't store it in the omap_connector structure.

- For debug messages we can simply use the connector name instead.
- For type checks we can use the drm_connector type.
- For operation lookup we can start at the other end of the pipeline and
  locate the last matching device.

The display device is still passed to the connector init function in
order to find its type, which requires access to the end of the
pipeline.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 31 ++--
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
index dc4533c8cbb4..6f219f61a783 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -30,7 +30,6 @@
 struct omap_connector {
struct drm_connector base;
struct omap_dss_device *output;
-   struct omap_dss_device *display;
struct omap_dss_device *hpd;
bool hdmi_mode;
 };
@@ -103,20 +102,20 @@ omap_connector_find_device(struct drm_connector 
*connector,
   enum omap_dss_device_ops_flag op)
 {
struct omap_connector *omap_connector = to_omap_connector(connector);
-   struct omap_dss_device *dssdev;
+   struct omap_dss_device *dssdev = NULL;
+   struct omap_dss_device *d;
 
-   for (dssdev = omap_connector->display; dssdev; dssdev = dssdev->src) {
-   if (dssdev->ops_flags & op)
-   return dssdev;
+   for (d = omap_connector->output; d; d = d->next) {
+   if (d->ops_flags & op)
+   dssdev = d;
}
 
-   return NULL;
+   return dssdev;
 }
 
 static enum drm_connector_status omap_connector_detect(
struct drm_connector *connector, bool force)
 {
-   struct omap_connector *omap_connector = to_omap_connector(connector);
struct omap_dss_device *dssdev;
enum drm_connector_status status;
 
@@ -130,11 +129,10 @@ static enum drm_connector_status omap_connector_detect(
 
omap_connector_hpd_notify(connector, dssdev->src, status);
} else {
-   switch (omap_connector->display->type) {
-   case OMAP_DISPLAY_TYPE_DPI:
-   case OMAP_DISPLAY_TYPE_DBI:
-   case OMAP_DISPLAY_TYPE_SDI:
-   case OMAP_DISPLAY_TYPE_DSI:
+   switch (connector->connector_type) {
+   case DRM_MODE_CONNECTOR_DPI:
+   case DRM_MODE_CONNECTOR_LVDS:
+   case DRM_MODE_CONNECTOR_DSI:
status = connector_status_connected;
break;
default:
@@ -143,7 +141,7 @@ static enum drm_connector_status omap_connector_detect(
}
}
 
-   VERB("%s: %d (force=%d)", omap_connector->display->name, status, force);
+   VERB("%s: %d (force=%d)", connector->name, status, force);
 
return status;
 }
@@ -152,7 +150,7 @@ static void omap_connector_destroy(struct drm_connector 
*connector)
 {
struct omap_connector *omap_connector = to_omap_connector(connector);
 
-   DBG("%s", omap_connector->display->name);
+   DBG("%s", connector->name);
 
if (omap_connector->hpd) {
struct omap_dss_device *hpd = omap_connector->hpd;
@@ -166,7 +164,6 @@ static void omap_connector_destroy(struct drm_connector 
*connector)
drm_connector_cleanup(connector);
 
omapdss_device_put(omap_connector->output);
-   omapdss_device_put(omap_connector->display);
 
kfree(omap_connector);
 }
@@ -210,10 +207,9 @@ static int omap_connector_get_modes_edid(struct 
drm_connector *connector,
 
 static int omap_connector_get_modes(struct drm_connector *connector)
 {
-   struct omap_connector *omap_connector = to_omap_connector(connector);
struct omap_dss_device *dssdev;
 
-   DBG("%s", omap_connector->display->name);
+   DBG("%s", connector->name);
 
/*
 * If display exposes EDID, then we parse that in the normal way to
@@ -341,7 +337,6 @@ struct drm_connector *omap_connector_init(struct drm_device 
*dev,
goto fail;
 
omap_connector->output = omapdss_device_get(output);
-   omap_connector->display = omapdss_device_get(display);
 
connector = &omap_connector->base;
connector->interlace_allowed = 1;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http

[PATCH v3 41/50] drm/bridge: ti-tfp410: Report input bus config through bridge timings

2019-02-11 Thread Laurent Pinchart
The TFP410 supports configurable pixel clock sampling edge and data
de-skew adjustments. The configuration can be set through I2C or
dedicated chip pins.

Report the configuration through the drm_bridge timings. As the
ti-tftp410 driver doesn't support configuring the chip through I2C, we
simply use the default configuration in that case. When the chip is
configured through dedicated pins, we parse the configuration from DT.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Jyri Sarha 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/bridge/ti-tfp410.c | 77 --
 1 file changed, 74 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c 
b/drivers/gpu/drm/bridge/ti-tfp410.c
index b0213d573434..285be4a0f4bd 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -34,6 +34,8 @@ struct tfp410 {
struct delayed_work hpd_work;
struct gpio_desc*powerdown;
 
+   struct drm_bridge_timings timings;
+
struct device *dev;
 };
 
@@ -180,6 +182,70 @@ static irqreturn_t tfp410_hpd_irq_thread(int irq, void 
*arg)
return IRQ_HANDLED;
 }
 
+static const struct drm_bridge_timings tfp410_default_timings = {
+   .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE
+| DRM_BUS_FLAG_DE_HIGH,
+   .setup_time_ps = 1200,
+   .hold_time_ps = 1300,
+};
+
+static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
+{
+   struct drm_bridge_timings *timings = &dvi->timings;
+   struct device_node *ep;
+   u32 pclk_sample = 0;
+   s32 deskew = 0;
+
+   /* Start with defaults. */
+   *timings = tfp410_default_timings;
+
+   if (i2c)
+   /*
+* In I2C mode timings are configured through the I2C interface.
+* As the driver doesn't support I2C configuration yet, we just
+* go with the defaults (BSEL=1, DSEL=1, DKEN=0, EDGE=1).
+*/
+   return 0;
+
+   /*
+* In non-I2C mode, timings are configured through the BSEL, DSEL, DKEN
+* and EDGE pins. They are specified in DT through endpoint properties
+* and vendor-specific properties.
+*/
+   ep = of_graph_get_endpoint_by_regs(dvi->dev->of_node, 0, 0);
+   if (!ep)
+   return -EINVAL;
+
+   /* Get the sampling edge from the endpoint. */
+   of_property_read_u32(ep, "pclk-sample", &pclk_sample);
+   of_node_put(ep);
+
+   timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH;
+
+   switch (pclk_sample) {
+   case 0:
+   timings->input_bus_flags |= DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE
+|  DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE;
+   break;
+   case 1:
+   timings->input_bus_flags |= DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE
+|  DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   /* Get the setup and hold time from vendor-specific properties. */
+   of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew);
+   if (deskew < -4 || deskew > 3)
+   return -EINVAL;
+
+   timings->setup_time_ps = min(0, 1200 - 350 * deskew);
+   timings->hold_time_ps = min(0, 1300 + 350 * deskew);
+
+   return 0;
+}
+
 static int tfp410_get_connector_properties(struct tfp410 *dvi)
 {
struct device_node *connector_node, *ddc_phandle;
@@ -223,7 +289,7 @@ static int tfp410_get_connector_properties(struct tfp410 
*dvi)
return ret;
 }
 
-static int tfp410_init(struct device *dev)
+static int tfp410_init(struct device *dev, bool i2c)
 {
struct tfp410 *dvi;
int ret;
@@ -240,8 +306,13 @@ static int tfp410_init(struct device *dev)
 
dvi->bridge.funcs = &tfp410_bridge_funcs;
dvi->bridge.of_node = dev->of_node;
+   dvi->bridge.timings = &dvi->timings;
dvi->dev = dev;
 
+   ret = tfp410_parse_timings(dvi, i2c);
+   if (ret)
+   goto fail;
+
ret = tfp410_get_connector_properties(dvi);
if (ret)
goto fail;
@@ -294,7 +365,7 @@ static int tfp410_fini(struct device *dev)
 
 static int tfp410_probe(struct platform_device *pdev)
 {
-   return tfp410_init(&pdev->dev);
+   return tfp410_init(&pdev->dev, false);
 }
 
 static int tfp410_remove(struct platform_device *pdev)
@@ -331,7 +402,7 @@ static int tfp410_i2c_probe(struct i2c_client *client,
return -ENXIO;
}
 
-   return tfp410_init(&client->dev);
+   return tfp410_init(&client->dev, true);
 }
 
 static int tfp410_i2c_remove(struct i2c_client *client)
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 28/50] drm/omap: Factor out common mode validation code

2019-02-11 Thread Laurent Pinchart
The encoder .atomic_check() and connector .mode_valid() operations both
walk through the dss devices in the pipeline to validate the mode.
Factor out the common code in a new omap_drm_connector_mode_fixup()
function.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
Changes since v1:

- Remove unneeded NULL check for adjusted_mode in
  omap_connector_mode_fixup()
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 56 +---
 drivers/gpu/drm/omapdrm/omap_connector.h |  5 +++
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 28 
 3 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
index 99ca5b3eaebb..6fceb020e86c 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -241,45 +241,51 @@ static int omap_connector_get_modes(struct drm_connector 
*connector)
return 0;
 }
 
-static int omap_connector_mode_valid(struct drm_connector *connector,
-struct drm_display_mode *mode)
+enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
+   const struct drm_display_mode *mode,
+   struct drm_display_mode *adjusted_mode)
 {
-   struct omap_connector *omap_connector = to_omap_connector(connector);
-   struct omap_dss_device *dssdev;
-   struct videomode vm = {0};
-   struct drm_device *dev = connector->dev;
-   struct drm_display_mode *new_mode;
-   int r, ret = MODE_BAD;
+   struct videomode vm = { 0 };
+   int ret;
 
drm_display_mode_to_videomode(mode, &vm);
-   mode->vrefresh = drm_mode_vrefresh(mode);
 
-   for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
+   for (; dssdev; dssdev = dssdev->next) {
if (!dssdev->ops->check_timings)
continue;
 
-   r = dssdev->ops->check_timings(dssdev, &vm);
-   if (r)
-   goto done;
+   ret = dssdev->ops->check_timings(dssdev, &vm);
+   if (ret)
+   return MODE_BAD;
}
 
-   /* check if vrefresh is still valid */
-   new_mode = drm_mode_duplicate(dev, mode);
-   if (!new_mode)
-   return MODE_BAD;
-
-   new_mode->clock = vm.pixelclock / 1000;
-   new_mode->vrefresh = 0;
-   if (mode->vrefresh == drm_mode_vrefresh(new_mode))
-   ret = MODE_OK;
-   drm_mode_destroy(dev, new_mode);
+   drm_display_mode_from_videomode(&vm, adjusted_mode);
+
+   return MODE_OK;
+}
+
+static enum drm_mode_status omap_connector_mode_valid(struct drm_connector 
*connector,
+struct drm_display_mode *mode)
+{
+   struct omap_connector *omap_connector = to_omap_connector(connector);
+   struct drm_display_mode new_mode = { { 0 } };
+   enum drm_mode_status status;
+
+   status = omap_connector_mode_fixup(omap_connector->output, mode,
+  &new_mode);
+   if (status != MODE_OK)
+   goto done;
+
+   /* Check if vrefresh is still valid. */
+   if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(&new_mode))
+   status = MODE_NOCLOCK;
 
 done:
DBG("connector: mode %s: " DRM_MODE_FMT,
-   (ret == MODE_OK) ? "valid" : "invalid",
+   (status == MODE_OK) ? "valid" : "invalid",
DRM_MODE_ARG(mode));
 
-   return ret;
+   return status;
 }
 
 static const struct drm_connector_funcs omap_connector_funcs = {
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.h 
b/drivers/gpu/drm/omapdrm/omap_connector.h
index 4a1dcd0f031b..6b7d4d95e32b 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.h
+++ b/drivers/gpu/drm/omapdrm/omap_connector.h
@@ -22,6 +22,8 @@
 
 #include 
 
+enum drm_mode_status;
+
 struct drm_connector;
 struct drm_device;
 struct drm_encoder;
@@ -34,5 +36,8 @@ struct drm_connector *omap_connector_init(struct drm_device 
*dev,
 bool omap_connector_get_hdmi_mode(struct drm_connector *connector);
 void omap_connector_enable_hpd(struct drm_connector *connector);
 void omap_connector_disable_hpd(struct drm_connector *connector);
+enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device *dssdev,
+   const struct drm_display_mode *mode,
+   struct drm_display_mode *adjusted_mode);
 
 #endif /* __OMAPDRM_CONNECTOR_H__ */
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
b/drivers/gpu/drm/omapdrm/omap_encoder.c
index 623154bc44bb..3a7cca01888e 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -206,29 +206,17 @@ static int omap_encoder_atomic_check(struct drm_encoder 
*encoder,

[PATCH v3 20/50] drm/omap: Don't pass display pointer to encoder init function

2019-02-11 Thread Laurent Pinchart
The display isn't used by the encoder implementation, don't pass it to
the initialization function and store it internally needlessly.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c | 5 +
 drivers/gpu/drm/omapdrm/omap_encoder.h | 3 +--
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index bddd4c1c43ae..3b8f0fdf24a8 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -296,7 +296,7 @@ static int omap_modeset_init(struct drm_device *dev)
struct drm_encoder *encoder;
struct drm_crtc *crtc;
 
-   encoder = omap_encoder_init(dev, pipe->output, display);
+   encoder = omap_encoder_init(dev, pipe->output);
if (!encoder)
return -ENOMEM;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
b/drivers/gpu/drm/omapdrm/omap_encoder.c
index acdfd2176423..1f4172f653b9 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.c
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
@@ -37,7 +37,6 @@
 struct omap_encoder {
struct drm_encoder base;
struct omap_dss_device *output;
-   struct omap_dss_device *display;
 };
 
 static void omap_encoder_destroy(struct drm_encoder *encoder)
@@ -247,8 +246,7 @@ static const struct drm_encoder_helper_funcs 
omap_encoder_helper_funcs = {
 
 /* initialize encoder */
 struct drm_encoder *omap_encoder_init(struct drm_device *dev,
- struct omap_dss_device *output,
- struct omap_dss_device *display)
+ struct omap_dss_device *output)
 {
struct drm_encoder *encoder = NULL;
struct omap_encoder *omap_encoder;
@@ -258,7 +256,6 @@ struct drm_encoder *omap_encoder_init(struct drm_device 
*dev,
goto fail;
 
omap_encoder->output = output;
-   omap_encoder->display = display;
 
encoder = &omap_encoder->base;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.h 
b/drivers/gpu/drm/omapdrm/omap_encoder.h
index a7b5dde63ecb..4aefb3142886 100644
--- a/drivers/gpu/drm/omapdrm/omap_encoder.h
+++ b/drivers/gpu/drm/omapdrm/omap_encoder.h
@@ -25,7 +25,6 @@ struct drm_encoder;
 struct omap_dss_device;
 
 struct drm_encoder *omap_encoder_init(struct drm_device *dev,
- struct omap_dss_device *output,
- struct omap_dss_device *display);
+ struct omap_dss_device *output);
 
 #endif /* __OMAPDRM_ENCODER_H__ */
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 37/50] drm/bridge: use bus flags in bridge timings

2019-02-11 Thread Laurent Pinchart
From: Stefan Agner 

The DRM bus flags convey additional information on pixel data on
the bus. All current available bus flags might be of interest for
a bridge. Remove the sampling_edge field and use bus_flags.

In the case at hand a dumb VGA bridge needs a specific data enable
polarity (DRM_BUS_FLAG_DE_LOW).

Signed-off-by: Stefan Agner 
Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Tested-by: Sebastian Reichel 
---
Changes since v1:

- Renamed bus_flags to input_bus_flags
---
 drivers/gpu/drm/bridge/dumb-vga-dac.c |  6 +++---
 include/drm/drm_bridge.h  | 12 +---
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c 
b/drivers/gpu/drm/bridge/dumb-vga-dac.c
index 94ed450e308d..e64736c39a9f 100644
--- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
+++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
@@ -234,7 +234,7 @@ static int dumb_vga_remove(struct platform_device *pdev)
  */
 static const struct drm_bridge_timings default_dac_timings = {
/* Timing specifications, datasheet page 7 */
-   .sampling_edge = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
+   .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
.setup_time_ps = 500,
.hold_time_ps = 1500,
 };
@@ -245,7 +245,7 @@ static const struct drm_bridge_timings default_dac_timings 
= {
  */
 static const struct drm_bridge_timings ti_ths8134_dac_timings = {
/* From timing diagram, datasheet page 9 */
-   .sampling_edge = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
+   .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
/* From datasheet, page 12 */
.setup_time_ps = 3000,
/* I guess this means latched input */
@@ -258,7 +258,7 @@ static const struct drm_bridge_timings 
ti_ths8134_dac_timings = {
  */
 static const struct drm_bridge_timings ti_ths8135_dac_timings = {
/* From timing diagram, datasheet page 14 */
-   .sampling_edge = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
+   .input_bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
/* From datasheet, page 16 */
.setup_time_ps = 2000,
.hold_time_ps = 500,
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 5e5129206f40..d4428913a4e1 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -244,15 +244,13 @@ struct drm_bridge_funcs {
  */
 struct drm_bridge_timings {
/**
-* @sampling_edge:
+* @input_bus_flags:
 *
-* Tells whether the bridge samples the digital input signals from the
-* display engine on the positive or negative edge of the clock. This
-* should use the DRM_BUS_FLAG_PIXDATA_SAMPLE_[POS|NEG]EDGE and
-* DRM_BUS_FLAG_SYNC_SAMPLE_[POS|NEG]EDGE bitwise flags from the DRM
-* connector (bit 2, 3, 6 and 7 valid).
+* Tells what additional settings for the pixel data on the bus
+* this bridge requires (like pixel signal polarity). See also
+* &drm_display_info->bus_flags.
 */
-   u32 sampling_edge;
+   u32 input_bus_flags;
/**
 * @setup_time_ps:
 *
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 36/50] drm: Use new DRM_BUS_FLAG_*_(DRIVE|SAMPLE)_(POS|NEG)EDGE flags

2019-02-11 Thread Laurent Pinchart
From: Laurent Pinchart 

The DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE and
DRM_BUS_FLAG_SYNC_(POS|NEG)EDGE flags are deprecated in favour of the
new DRM_BUS_FLAG_PIXDATA_(DRIVE|SAMPLE)_(POS|NEG)EDGE and
new DRM_BUS_FLAG_SYNC_(DRIVE|SAMPLE)_(POS|NEG)EDGE flags. Replace them
through the code.

This effectively changes the value of the .sampling_edge bridge timings
field in the dumb-vga-dac driver. This is safe to do as no driver
consumes these values yet.

Signed-off-by: Laurent Pinchart 
Acked-by: Linus Walleij 
Reviewed-by: Stefan Agner 
Tested-by: Sebastian Reichel 
---
Changes since v1:

- Clarify commit message
- Address the DRM_BUS_FLAG_SYNC_* flags
- Rebase on top of drm-next
---
 drivers/gpu/drm/bridge/dumb-vga-dac.c |  6 ++---
 drivers/gpu/drm/drm_modes.c   | 12 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c|  2 +-
 drivers/gpu/drm/imx/ipuv3-crtc.c  |  2 +-
 drivers/gpu/drm/mxsfb/mxsfb_crtc.c|  6 ++---
 .../gpu/drm/omapdrm/displays/encoder-tfp410.c |  5 ++--
 .../displays/panel-lgphilips-lb035q02.c   |  5 ++--
 .../omapdrm/displays/panel-nec-nl8048hl11.c   |  5 ++--
 .../displays/panel-sharp-ls037v7dw01.c|  5 ++--
 .../omapdrm/displays/panel-sony-acx565akm.c   |  5 ++--
 .../omapdrm/displays/panel-tpo-td028ttec1.c   |  5 ++--
 .../omapdrm/displays/panel-tpo-td043mtea1.c   |  5 ++--
 drivers/gpu/drm/omapdrm/dss/dsi.c |  4 ++--
 drivers/gpu/drm/omapdrm/dss/sdi.c |  4 ++--
 drivers/gpu/drm/omapdrm/omap_encoder.c|  8 +++
 drivers/gpu/drm/panel/panel-arm-versatile.c   |  4 ++--
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c  |  4 ++--
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c   |  2 +-
 drivers/gpu/drm/panel/panel-simple.c  | 24 +--
 drivers/gpu/drm/pl111/pl111_display.c |  2 +-
 drivers/gpu/drm/sun4i/sun4i_tcon.c|  4 ++--
 drivers/gpu/drm/tve200/tve200_display.c   |  3 ++-
 include/drm/drm_bridge.h  |  9 +++
 23 files changed, 70 insertions(+), 61 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dumb-vga-dac.c 
b/drivers/gpu/drm/bridge/dumb-vga-dac.c
index 0805801f4e94..94ed450e308d 100644
--- a/drivers/gpu/drm/bridge/dumb-vga-dac.c
+++ b/drivers/gpu/drm/bridge/dumb-vga-dac.c
@@ -234,7 +234,7 @@ static int dumb_vga_remove(struct platform_device *pdev)
  */
 static const struct drm_bridge_timings default_dac_timings = {
/* Timing specifications, datasheet page 7 */
-   .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+   .sampling_edge = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
.setup_time_ps = 500,
.hold_time_ps = 1500,
 };
@@ -245,7 +245,7 @@ static const struct drm_bridge_timings default_dac_timings 
= {
  */
 static const struct drm_bridge_timings ti_ths8134_dac_timings = {
/* From timing diagram, datasheet page 9 */
-   .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+   .sampling_edge = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
/* From datasheet, page 12 */
.setup_time_ps = 3000,
/* I guess this means latched input */
@@ -258,7 +258,7 @@ static const struct drm_bridge_timings 
ti_ths8134_dac_timings = {
  */
 static const struct drm_bridge_timings ti_ths8135_dac_timings = {
/* From timing diagram, datasheet page 14 */
-   .sampling_edge = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+   .sampling_edge = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
/* From datasheet, page 16 */
.setup_time_ps = 2000,
.hold_time_ps = 500,
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index adce9a26bac9..fc0d345dc424 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -655,22 +655,22 @@ EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode);
  * @bus_flags: information about pixelclk, sync and DE polarity will be stored
  * here
  *
- * Sets DRM_BUS_FLAG_DE_(LOW|HIGH),  DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE and
- * DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE in @bus_flags according to DISPLAY_FLAGS
+ * Sets DRM_BUS_FLAG_DE_(LOW|HIGH),  DRM_BUS_FLAG_PIXDATA_DRIVE_(POS|NEG)EDGE
+ * and DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE in @bus_flags according to 
DISPLAY_FLAGS
  * found in @vm
  */
 void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags)
 {
*bus_flags = 0;
if (vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
-   *bus_flags |= DRM_BUS_FLAG_PIXDATA_POSEDGE;
+   *bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE;
if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
-   *bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
+   *bus_flags |= DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE;
 
if (vm->flags & DISPLAY_FLAGS_SYNC_POSEDGE)
-   *bus_flags |= DRM_BUS_FLAG_SYNC_POSEDGE;
+   *bus_flags |= DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
if (vm->flags & DISPLAY_FLAGS_SYNC_NEGEDGE)
-   *bus_flags |= DRM_BUS_FLAG_SYNC_NEGEDGE;
+   *bus_fla

[PATCH v3 24/50] drm/omap: Notify all devices in the pipeline of output disconnection

2019-02-11 Thread Laurent Pinchart
For HDMI pipelines, when the output gets disconnected the device
handling CEC needs to be notified. Instead of guessing which device that
would be (and sometimes getting it wrong), notify all devices in the
pipeline.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_connector.c | 28 ++--
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
index 6f219f61a783..e01e4cf61ae1 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -35,18 +35,22 @@ struct omap_connector {
 };
 
 static void omap_connector_hpd_notify(struct drm_connector *connector,
- struct omap_dss_device *src,
  enum drm_connector_status status)
 {
-   if (status == connector_status_disconnected) {
-   /*
-* If the source is an HDMI encoder, notify it of disconnection.
-* This is required to let the HDMI encoder reset any internal
-* state related to connection status, such as the CEC address.
-*/
-   if (src && src->type == OMAP_DISPLAY_TYPE_HDMI &&
-   src->ops->hdmi.lost_hotplug)
-   src->ops->hdmi.lost_hotplug(src);
+   struct omap_connector *omap_connector = to_omap_connector(connector);
+   struct omap_dss_device *dssdev;
+
+   if (status != connector_status_disconnected)
+   return;
+
+   /*
+* Notify all devics in the pipeline of disconnection. This is required
+* to let the HDMI encoders reset their internal state related to
+* connection status, such as the CEC address.
+*/
+   for (dssdev = omap_connector->output; dssdev; dssdev = dssdev->next) {
+   if (dssdev->ops && dssdev->ops->hdmi.lost_hotplug)
+   dssdev->ops->hdmi.lost_hotplug(dssdev);
}
 }
 
@@ -66,7 +70,7 @@ static void omap_connector_hpd_cb(void *cb_data,
if (old_status == status)
return;
 
-   omap_connector_hpd_notify(connector, omap_connector->hpd, status);
+   omap_connector_hpd_notify(connector, status);
 
drm_kms_helper_hotplug_event(dev);
 }
@@ -127,7 +131,7 @@ static enum drm_connector_status omap_connector_detect(
   ? connector_status_connected
   : connector_status_disconnected;
 
-   omap_connector_hpd_notify(connector, dssdev->src, status);
+   omap_connector_hpd_notify(connector, status);
} else {
switch (connector->connector_type) {
case DRM_MODE_CONNECTOR_DPI:
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 44/50] drm/panel: simple: Add OSD070T1718-19TS panel support

2019-02-11 Thread Laurent Pinchart
Add support for the OSD070T1718-19TS 7" 800x480 panel from One Stop
Displays to the panel-simple driver.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Reviewed-by: Tomi Valkeinen 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/panel/panel-simple.c | 29 
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 64516f23a957..8fee7a8b29d9 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2032,6 +2032,32 @@ static const struct panel_desc ortustech_com43h4m85ulc = 
{
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
 };
 
+static const struct drm_display_mode osddisplays_osd070t1718_19ts_mode  = {
+   .clock = 33000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 210,
+   .hsync_end = 800 + 210 + 30,
+   .htotal = 800 + 210 + 30 + 16,
+   .vdisplay = 480,
+   .vsync_start = 480 + 22,
+   .vsync_end = 480 + 22 + 13,
+   .vtotal = 480 + 22 + 13 + 10,
+   .vrefresh = 60,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+};
+
+static const struct panel_desc osddisplays_osd070t1718_19ts = {
+   .modes = &osddisplays_osd070t1718_19ts_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 152,
+   .height = 91,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+   .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
+};
+
 static const struct drm_display_mode pda_91_00156_a0_mode = {
.clock = 33300,
.hdisplay = 800,
@@ -2736,6 +2762,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "ortustech,com43h4m85ulc",
.data = &ortustech_com43h4m85ulc,
+   }, {
+   .compatible = "osddisplays,osd070t1718-19ts",
+   .data = &osddisplays_osd070t1718_19ts,
}, {
.compatible = "pda,91-00156-a0",
.data = &pda_91_00156_a0,
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 40/50] drm/bridge: ti-tfp410: Add support for the powerdown GPIO

2019-02-11 Thread Laurent Pinchart
The TFP410 has a powerdown pin that can be connected to a GPIO to
control power saving. The DT bindings define a corresponding property,
but the driver doesn't implement support for it. Fix that.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Jyri Sarha 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/bridge/ti-tfp410.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c 
b/drivers/gpu/drm/bridge/ti-tfp410.c
index daf0967e00ba..b0213d573434 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -32,6 +32,7 @@ struct tfp410 {
struct i2c_adapter  *ddc;
struct gpio_desc*hpd;
struct delayed_work hpd_work;
+   struct gpio_desc*powerdown;
 
struct device *dev;
 };
@@ -139,8 +140,24 @@ static int tfp410_attach(struct drm_bridge *bridge)
return 0;
 }
 
+static void tfp410_enable(struct drm_bridge *bridge)
+{
+   struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
+
+   gpiod_set_value_cansleep(dvi->powerdown, 0);
+}
+
+static void tfp410_disable(struct drm_bridge *bridge)
+{
+   struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
+
+   gpiod_set_value_cansleep(dvi->powerdown, 1);
+}
+
 static const struct drm_bridge_funcs tfp410_bridge_funcs = {
.attach = tfp410_attach,
+   .enable = tfp410_enable,
+   .disable= tfp410_disable,
 };
 
 static void tfp410_hpd_work_func(struct work_struct *work)
@@ -229,6 +246,13 @@ static int tfp410_init(struct device *dev)
if (ret)
goto fail;
 
+   dvi->powerdown = devm_gpiod_get_optional(dev, "powerdown",
+GPIOD_OUT_HIGH);
+   if (IS_ERR(dvi->powerdown)) {
+   dev_err(dev, "failed to parse powerdown gpio\n");
+   return PTR_ERR(dvi->powerdown);
+   }
+
if (dvi->hpd) {
INIT_DELAYED_WORK(&dvi->hpd_work, tfp410_hpd_work_func);
 
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 34/50] drm/omap: Merge omap_dss_device type and output_type fields

2019-02-11 Thread Laurent Pinchart
The omap_dss_device type and output_type fields differ mostly for
historical reasons. The output_type field is required for all devices
but the display at the end of the pipeline, and must be set to
OMAP_DISPLAY_TYPE_NONE for the latter. The type field is required for
all devices but the internal encoder, for which it is ignored.

The only reason why the output_type field must be set to
OMAP_DISPLAY_TYPE_NONE for the display at the end of the pipeline is to
identify omap_dss_device instances corresponding to displays. This is
not documented and confusing.

Clean the code by adding a new display field to the omap_dss_device
structure to identify displays, and merge the type and output_type
fields.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 .../gpu/drm/omapdrm/displays/connector-analog-tv.c |  1 +
 drivers/gpu/drm/omapdrm/displays/connector-dvi.c   |  1 +
 drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |  1 +
 drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |  1 -
 drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |  1 -
 .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   |  1 -
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |  1 +
 drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c|  1 +
 .../omapdrm/displays/panel-lgphilips-lb035q02.c|  1 +
 .../drm/omapdrm/displays/panel-nec-nl8048hl11.c|  1 +
 .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |  1 +
 .../drm/omapdrm/displays/panel-sony-acx565akm.c|  1 +
 .../drm/omapdrm/displays/panel-tpo-td028ttec1.c|  1 +
 .../drm/omapdrm/displays/panel-tpo-td043mtea1.c|  1 +
 drivers/gpu/drm/omapdrm/dss/base.c |  2 +-
 drivers/gpu/drm/omapdrm/dss/dpi.c  |  2 +-
 drivers/gpu/drm/omapdrm/dss/dsi.c  |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi4.c|  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi5.c|  2 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h  | 14 +-
 drivers/gpu/drm/omapdrm/dss/output.c   |  2 +-
 drivers/gpu/drm/omapdrm/dss/sdi.c  |  2 +-
 drivers/gpu/drm/omapdrm/dss/venc.c |  2 +-
 drivers/gpu/drm/omapdrm/omap_crtc.c|  2 +-
 drivers/gpu/drm/omapdrm/omap_encoder.c |  6 +++---
 25 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
index 1503563117f3..6c0561101874 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
@@ -56,6 +56,7 @@ static int tvc_probe(struct platform_device *pdev)
dssdev->ops = &tvc_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
+   dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
 
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
index bf5ee50ce5fe..fa3a69bf8a04 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
@@ -239,6 +239,7 @@ static int dvic_probe(struct platform_device *pdev)
dssdev->ops = &dvic_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_DVI;
+   dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
 
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 797da4a3f22e..68d6f6e44b03 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -140,6 +140,7 @@ static int hdmic_probe(struct platform_device *pdev)
dssdev->ops = &hdmic_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
+   dssdev->display = true;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(0);
dssdev->ops_flags = ddata->hpd_gpio
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index fc5e0c47054d..29a5a130ebd1 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -88,7 +88,6 @@ static int opa362_probe(struct platform_device *pdev)
dssdev->ops = &opa362_ops;
dssdev->dev = &pdev->dev;
dssdev->type = OMAP_DISPLAY_TYPE_VENC;
-   dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
dssdev->owner = THIS_MODULE;
dssdev->of_ports = BIT(1) | BIT(0);
 
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index 82035078377a..fb88537de1cc 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -84,7 +84,6 @@ static int tfp410_probe

[PATCH v3 43/50] dt-bindings: display: Add OSD Displays OSD070T1718-19TS panel binding

2019-02-11 Thread Laurent Pinchart
The OSD Displays OSD070T1718-19TS is a 7" WVGA (800x480) 24bit RGB panel
and is compatible with the simple-panel bindings.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Tested-by: Sebastian Reichel 
---
Changes since v2:

- Specify which of the simple-panel properties are valid
---
 .../display/panel/osddisplays,osd070t1718-19ts.txt   | 12 
 1 file changed, 12 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/panel/osddisplays,osd070t1718-19ts.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/osddisplays,osd070t1718-19ts.txt
 
b/Documentation/devicetree/bindings/display/panel/osddisplays,osd070t1718-19ts.txt
new file mode 100644
index ..e57883ccdf2f
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/display/panel/osddisplays,osd070t1718-19ts.txt
@@ -0,0 +1,12 @@
+OSD Displays OSD070T1718-19TS 7" WVGA TFT LCD panel
+
+Required properties:
+- compatible: shall be "osddisplays,osd070t1718-19ts"
+- power-supply: see simple-panel.txt
+
+Optional properties:
+- backlight: see simple-panel.txt
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory. No other simple-panel properties than
+the ones specified herein are valid.
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 42/50] dt-bindings: Add vendor prefix for OSD Displays

2019-02-11 Thread Laurent Pinchart
OSD Displays is a panel manufacturer. It has been acquired by New Vision
Displays in 2015 but continues to operate under its own brand name.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Rob Herring 
Tested-by: Sebastian Reichel 
---
 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 4f225ce815d8..675669cc6901 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -294,6 +294,7 @@ oranth  Shenzhen Oranth Technology Co., Ltd.
 ORCL   Oracle Corporation
 orisetech  Orise Technology
 ortustech  Ortus Technology Co., Ltd.
+osddisplaysOSD Displays
 ovti   OmniVision Technologies
 oxsemi Oxford Semiconductor, Ltd.
 panasonic  Panasonic Corporation
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 48/50] drm/omap: Remove TFP410 and DVI connector drivers

2019-02-11 Thread Laurent Pinchart
Those components are supported by the drm_bridge infrastructure, remove
the omapdrm-specific driver.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/Kconfig  |  11 -
 drivers/gpu/drm/omapdrm/displays/Makefile |   2 -
 .../gpu/drm/omapdrm/displays/connector-dvi.c  | 293 --
 .../gpu/drm/omapdrm/displays/encoder-tfp410.c | 140 -
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   2 -
 5 files changed, 448 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/connector-dvi.c
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c

diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig 
b/drivers/gpu/drm/omapdrm/displays/Kconfig
index a349cb61961e..38d066ac966e 100644
--- a/drivers/gpu/drm/omapdrm/displays/Kconfig
+++ b/drivers/gpu/drm/omapdrm/displays/Kconfig
@@ -6,23 +6,12 @@ config DRM_OMAP_ENCODER_OPA362
  Driver for OPA362 external analog TV amplifier controlled
  through a GPIO.
 
-config DRM_OMAP_ENCODER_TFP410
-tristate "TFP410 DPI to DVI Encoder"
-   help
- Driver for TFP410 DPI to DVI encoder.
-
 config DRM_OMAP_ENCODER_TPD12S015
 tristate "TPD12S015 HDMI ESD protection and level shifter"
help
  Driver for TPD12S015, which offers HDMI ESD protection and level
  shifting.
 
-config DRM_OMAP_CONNECTOR_DVI
-tristate "DVI Connector"
-   depends on I2C
-   help
- Driver for a generic DVI connector.
-
 config DRM_OMAP_CONNECTOR_HDMI
 tristate "HDMI Connector"
help
diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile 
b/drivers/gpu/drm/omapdrm/displays/Makefile
index d99659e1381b..da1d5321ef50 100644
--- a/drivers/gpu/drm/omapdrm/displays/Makefile
+++ b/drivers/gpu/drm/omapdrm/displays/Makefile
@@ -1,8 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_DRM_OMAP_ENCODER_OPA362) += encoder-opa362.o
-obj-$(CONFIG_DRM_OMAP_ENCODER_TFP410) += encoder-tfp410.o
 obj-$(CONFIG_DRM_OMAP_ENCODER_TPD12S015) += encoder-tpd12s015.o
-obj-$(CONFIG_DRM_OMAP_CONNECTOR_DVI) += connector-dvi.o
 obj-$(CONFIG_DRM_OMAP_CONNECTOR_HDMI) += connector-hdmi.o
 obj-$(CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV) += connector-analog-tv.o
 obj-$(CONFIG_DRM_OMAP_PANEL_DPI) += panel-dpi.o
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
deleted file mode 100644
index fa3a69bf8a04..
--- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Generic DVI Connector driver
- *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Tomi Valkeinen 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "../dss/omapdss.h"
-
-struct panel_drv_data {
-   struct omap_dss_device dssdev;
-
-   struct i2c_adapter *i2c_adapter;
-
-   struct gpio_desc *hpd_gpio;
-
-   void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
-   void *hpd_cb_data;
-   bool hpd_enabled;
-   /* mutex for hpd fields above */
-   struct mutex hpd_lock;
-};
-
-#define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
-
-static int dvic_connect(struct omap_dss_device *src,
-   struct omap_dss_device *dst)
-{
-   return 0;
-}
-
-static void dvic_disconnect(struct omap_dss_device *src,
-   struct omap_dss_device *dst)
-{
-}
-
-static int dvic_ddc_read(struct i2c_adapter *adapter,
-   unsigned char *buf, u16 count, u8 offset)
-{
-   int r, retries;
-
-   for (retries = 3; retries > 0; retries--) {
-   struct i2c_msg msgs[] = {
-   {
-   .addr   = DDC_ADDR,
-   .flags  = 0,
-   .len= 1,
-   .buf= &offset,
-   }, {
-   .addr   = DDC_ADDR,
-   .flags  = I2C_M_RD,
-   .len= count,
-   .buf= buf,
-   }
-   };
-
-   r = i2c_transfer(adapter, msgs, 2);
-   if (r == 2)
-   return 0;
-
-   if (r != -EAGAIN)
-   break;
-   }
-
-   return r < 0 ? r : -EIO;
-}
-
-static int dvic_read_edid(struct omap_dss_device *dssdev,
-   u8 *edid, int len)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   int r, l, bytes_read;
-
-   l = min(EDID_LENGTH, len);
-   r = dvic_ddc_read(ddata->i2c_adapter, edid, l, 0);
-   if (r)
-

[PATCH v3 46/50] drm/omap: Add support for drm_panel

2019-02-11 Thread Laurent Pinchart
Hook up drm_panel support in the omapdrm driver. The change is
relatively simply as the way has been paved by drm_bridge support
already. In addition to looking up, attaching to and detaching from the
panel, we only need to add panel support in the connector .get_modes()
handler, take connector bus flags (set by the panel) into account, and
enable/disable the panel in the encoder enable/disable operations
handlers.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c   | 12 ---
 drivers/gpu/drm/omapdrm/dss/omapdss.h|  1 +
 drivers/gpu/drm/omapdrm/dss/output.c |  7 +++-
 drivers/gpu/drm/omapdrm/omap_connector.c |  9 ++
 drivers/gpu/drm/omapdrm/omap_drv.c   | 15 -
 drivers/gpu/drm/omapdrm/omap_encoder.c   | 41 
 6 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 09c9f2971aa2..3c088cd2ceab 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -157,7 +157,8 @@ struct omap_dss_device *omapdss_device_next_output(struct 
omap_dss_device *from)
goto done;
}
 
-   if (dssdev->id && (dssdev->next || dssdev->bridge))
+   if (dssdev->id &&
+   (dssdev->next || dssdev->bridge || dssdev->panel))
goto done;
}
 
@@ -192,10 +193,11 @@ int omapdss_device_connect(struct dss_device *dss,
if (!dst) {
/*
 * The destination is NULL when the source is connected to a
-* bridge instead of a DSS device. Stop here, we will attach the
-* bridge later when we will have a DRM encoder.
+* bridge or panel instead of a DSS device. Stop here, we will
+* attach the bridge or panel later when we will have a DRM
+* encoder.
 */
-   return src && src->bridge ? 0 : -EINVAL;
+   return src && (src->bridge || src->panel) ? 0 : -EINVAL;
}
 
if (omapdss_device_is_connected(dst))
@@ -223,7 +225,7 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
dst ? dev_name(dst->dev) : "NULL");
 
if (!dst) {
-   WARN_ON(!src->bridge);
+   WARN_ON(!src->bridge && !src->panel);
return;
}
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index f47e9b94288f..0c734d1f89e1 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -411,6 +411,7 @@ struct omap_dss_device {
struct dss_device *dss;
struct omap_dss_device *next;
struct drm_bridge *bridge;
+   struct drm_panel *panel;
 
struct list_head list;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index 2a53025c2fde..10a9ee5cdc61 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -22,6 +22,8 @@
 #include 
 #include 
 
+#include 
+
 #include "dss.h"
 #include "omapdss.h"
 
@@ -37,6 +39,9 @@ int omapdss_device_init_output(struct omap_dss_device *out)
 
out->next = omapdss_find_device_by_node(remote_node);
out->bridge = of_drm_find_bridge(remote_node);
+   out->panel = of_drm_find_panel(remote_node);
+   if (IS_ERR(out->panel))
+   out->panel = NULL;
 
of_node_put(remote_node);
 
@@ -47,7 +52,7 @@ int omapdss_device_init_output(struct omap_dss_device *out)
return -EINVAL;
}
 
-   return out->next || out->bridge ? 0 : -EPROBE_DEFER;
+   return out->next || out->bridge || out->panel ? 0 : -EPROBE_DEFER;
 }
 EXPORT_SYMBOL(omapdss_device_init_output);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
b/drivers/gpu/drm/omapdrm/omap_connector.c
index f711a267e2b6..5967283934e1 100644
--- a/drivers/gpu/drm/omapdrm/omap_connector.c
+++ b/drivers/gpu/drm/omapdrm/omap_connector.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "omap_drv.h"
@@ -211,6 +212,7 @@ static int omap_connector_get_modes_edid(struct 
drm_connector *connector,
 
 static int omap_connector_get_modes(struct drm_connector *connector)
 {
+   struct omap_connector *omap_connector = to_omap_connector(connector);
struct omap_dss_device *dssdev;
 
DBG("%s", connector->name);
@@ -233,6 +235,13 @@ static int omap_connector_get_modes(struct drm_connector 
*connector)
if (dssdev)
return dssdev->ops->get_modes(dssdev, connector);
 
+   /*
+* Otherwise if the display pipeline uses a drm_panel, we delegate the
+* operation to the panel API.
+*/
+   if (omap_connector->output->panel)
+   return drm_panel_get_modes(omap_connector->output->pane

[PATCH v3 39/50] drm/bridge: ti-tfp410: Set connector type based on DT connector node

2019-02-11 Thread Laurent Pinchart
The TI TFP410 is a DVI encoder, not a full HDMI encoder. Its output can
be routed to a DVI-D connector, even if in many cases embedded systems
will use an HDMI connector to carry the DVI signals.

Instead of hardcoding the connector type to HDMI, retrieve the connector
type from its DT node.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Tomi Valkeinen 
Reviewed-by: Jyri Sarha 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/bridge/ti-tfp410.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c 
b/drivers/gpu/drm/bridge/ti-tfp410.c
index 7bfb4f338813..daf0967e00ba 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -27,6 +27,7 @@
 struct tfp410 {
struct drm_bridge   bridge;
struct drm_connectorconnector;
+   unsigned intconnector_type;
 
struct i2c_adapter  *ddc;
struct gpio_desc*hpd;
@@ -126,7 +127,7 @@ static int tfp410_attach(struct drm_bridge *bridge)
drm_connector_helper_add(&dvi->connector,
 &tfp410_con_helper_funcs);
ret = drm_connector_init(bridge->dev, &dvi->connector,
-&tfp410_con_funcs, DRM_MODE_CONNECTOR_HDMIA);
+&tfp410_con_funcs, dvi->connector_type);
if (ret) {
dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret);
return ret;
@@ -172,6 +173,11 @@ static int tfp410_get_connector_properties(struct tfp410 
*dvi)
if (!connector_node)
return -ENODEV;
 
+   if (of_device_is_compatible(connector_node, "hdmi-connector"))
+   dvi->connector_type = DRM_MODE_CONNECTOR_HDMIA;
+   else
+   dvi->connector_type = DRM_MODE_CONNECTOR_DVID;
+
dvi->hpd = fwnode_get_named_gpiod(&connector_node->fwnode,
"hpd-gpios", 0, GPIOD_IN, "hpd");
if (IS_ERR(dvi->hpd)) {
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 25/50] drm/omap: Remove src field from omap_dss_device structure

2019-02-11 Thread Laurent Pinchart
The field is only used to check whether the device is connected, and we
can do so by checking the dss field instead. Remove the src field.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c| 14 +-
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  1 -
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 76470ba45660..62ccbeb99a84 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -176,7 +176,7 @@ EXPORT_SYMBOL(omapdss_device_next_output);
 
 static bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
 {
-   return dssdev->src;
+   return dssdev->dss;
 }
 
 int omapdss_device_connect(struct dss_device *dss,
@@ -198,11 +198,6 @@ int omapdss_device_connect(struct dss_device *dss,
return ret;
}
 
-   if (src) {
-   WARN_ON(dst->src);
-   dst->src = src;
-   }
-
return 0;
 }
 EXPORT_SYMBOL_GPL(omapdss_device_connect);
@@ -217,13 +212,6 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
return;
}
 
-   if (src) {
-   if (WARN_ON(dst->src != src))
-   return;
-
-   dst->src = NULL;
-   }
-
WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
 
dst->ops->disconnect(src, dst);
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index dd93c2121a35..015b2dd9fb99 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -409,7 +409,6 @@ struct omap_dss_device {
struct module *owner;
 
struct dss_device *dss;
-   struct omap_dss_device *src;
struct omap_dss_device *next;
 
struct list_head list;
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 50/50] drm: Turn bus flags macros into an enum

2019-02-11 Thread Laurent Pinchart
This allows nicer kerneldoc with an easy way to reference the enum and
the values.

Signed-off-by: Laurent Pinchart 
---
 include/drm/drm_connector.h | 108 +---
 1 file changed, 64 insertions(+), 44 deletions(-)

diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index fa6b8af611b3..8dbdadfa002e 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -253,6 +253,68 @@ enum drm_panel_orientation {
DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
 };
 
+/**
+ * enum drm_bus_flags - bus_flags info for &drm_display_info
+ *
+ * This enum defines signal polarities and clock edge information for signals 
on
+ * a bus as bitmask flags.
+ *
+ * The clock edge information is conveyed by two sets of symbols,
+ * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is
+ * used to describe a bus from the point of view of the transmitter, the
+ * \*_DRIVE_\* flags should be used. When used from the point of view of the
+ * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and
+ * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and
+ * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE
+ * respectively. This simplifies code as signals are usually sampled on the
+ * opposite edge of the driving edge. Transmitters and receivers may however
+ * need to take other signal timings into account to convert between driving
+ * and sample edges.
+ *
+ * @DRM_BUS_FLAG_DE_LOW:   The Data Enable signal is active low
+ * @DRM_BUS_FLAG_DE_HIGH:  The Data Enable signal is active high
+ * @DRM_BUS_FLAG_PIXDATA_POSEDGE:  Legacy value, do not use
+ * @DRM_BUS_FLAG_PIXDATA_NEGEDGE:  Legacy value, do not use
+ * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:Data is driven on the rising 
edge of
+ * the pixel clock
+ * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:Data is driven on the falling 
edge of
+ * the pixel clock
+ * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE: Data is sampled on the rising edge of
+ * the pixel clock
+ * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE: Data is sampled on the falling edge of
+ * the pixel clock
+ * @DRM_BUS_FLAG_DATA_MSB_TO_LSB:  Data is transmitted MSB to LSB on the 
bus
+ * @DRM_BUS_FLAG_DATA_LSB_TO_MSB:  Data is transmitted LSB to MSB on the 
bus
+ * @DRM_BUS_FLAG_SYNC_POSEDGE: Legacy value, do not use
+ * @DRM_BUS_FLAG_SYNC_NEGEDGE: Legacy value, do not use
+ * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:   Sync signals are driven on the rising
+ * edge of the pixel clock
+ * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:   Sync signals are driven on the falling
+ * edge of the pixel clock
+ * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:  Sync signals are sampled on the rising
+ * edge of the pixel clock
+ * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:  Sync signals are sampled on the falling
+ * edge of the pixel clock
+ */
+enum drm_bus_flags {
+   DRM_BUS_FLAG_DE_LOW = BIT(0),
+   DRM_BUS_FLAG_DE_HIGH = BIT(1),
+   DRM_BUS_FLAG_PIXDATA_POSEDGE = BIT(2),
+   DRM_BUS_FLAG_PIXDATA_NEGEDGE = BIT(3),
+   DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+   DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+   DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_NEGEDGE,
+   DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_POSEDGE,
+   DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),
+   DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),
+   DRM_BUS_FLAG_SYNC_POSEDGE = BIT(6),
+   DRM_BUS_FLAG_SYNC_NEGEDGE = BIT(7),
+   DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = DRM_BUS_FLAG_SYNC_POSEDGE,
+   DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE,
+   DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_NEGEDGE,
+   DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_POSEDGE,
+};
+
 /**
  * struct drm_display_info - runtime data about the connected sink
  *
@@ -328,52 +390,10 @@ struct drm_display_info {
 */
unsigned int num_bus_formats;
 
-#define DRM_BUS_FLAG_DE_LOW(1<<0)
-#define DRM_BUS_FLAG_DE_HIGH   (1<<1)
-
-/*
- * Don't use those two flags directly, use the DRM_BUS_FLAG_PIXDATA_DRIVE_*
- * and DRM_BUS_FLAG_PIXDATA_SAMPLE_* variants to qualify the flags explicitly.
- * The DRM_BUS_FLAG_PIXDATA_SAMPLE_* flags are defined as the opposite of the
- * DRM_BUS_FLAG_PIXDATA_DRIVE_* flags to make code simpler, as signals are
- * usually to be sampled on the opposite edge of the driving edge.
- */
-#define DRM_BUS_FLAG_PIXDATA_POSEDGE   (1<<2)
-#define DRM_BUS_FLAG_PIXDATA_NEGEDGE   (1<<3)
-
-/* Drive data on rising edge */
-#define DRM_BUS_FLAG_PIXDATA_DRIVE_PO

[PATCH v3 33/50] drm/omap: Refactor initialization sequence

2019-02-11 Thread Laurent Pinchart
The omapdrm driver initialization procedure starts by connecting all
available pipelines, gathering related information (such as output and
display DSS devices, and DT aliases), sorting them by alias, and finally
creates all the DRM/KMS objects.

When using DRM bridges instead of DSS devices, we will need to attach to
the bridges before getting the aliases. As attaching to bridges requires
an encoder object, we have to reorganize the initialization sequence to
create encoders before getting aliases and sorting the pipelines.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 123 +
 1 file changed, 56 insertions(+), 67 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
b/drivers/gpu/drm/omapdrm/omap_drv.c
index 008eec6356fd..33f79c490011 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -150,48 +150,27 @@ static void omap_disconnect_pipelines(struct drm_device 
*ddev)
priv->num_pipes = 0;
 }
 
-static int omap_compare_pipes(const void *a, const void *b)
-{
-   const struct omap_drm_pipeline *pipe1 = a;
-   const struct omap_drm_pipeline *pipe2 = b;
-
-   if (pipe1->alias_id > pipe2->alias_id)
-   return 1;
-   else if (pipe1->alias_id < pipe2->alias_id)
-   return -1;
-   return 0;
-}
-
 static int omap_connect_pipelines(struct drm_device *ddev)
 {
struct omap_drm_private *priv = ddev->dev_private;
struct omap_dss_device *output = NULL;
-   unsigned int i;
int r;
 
-   if (!omapdss_stack_is_ready())
-   return -EPROBE_DEFER;
-
for_each_dss_output(output) {
r = omapdss_device_connect(priv->dss, NULL, output);
if (r == -EPROBE_DEFER) {
omapdss_device_put(output);
-   goto cleanup;
+   return r;
} else if (r) {
dev_warn(output->dev, "could not connect output %s\n",
 output->name);
} else {
struct omap_drm_pipeline *pipe;
-   int id;
 
pipe = &priv->pipes[priv->num_pipes++];
pipe->output = omapdss_device_get(output);
pipe->display = omapdss_display_get(output);
 
-   id = of_alias_get_id(pipe->display->dev->of_node,
-"display");
-   pipe->alias_id = id >= 0 ? id : priv->num_pipes - 1;
-
if (priv->num_pipes == ARRAY_SIZE(priv->pipes)) {
/* To balance the 'for_each_dss_output' loop */
omapdss_device_put(output);
@@ -200,36 +179,19 @@ static int omap_connect_pipelines(struct drm_device *ddev)
}
}
 
-   /* Sort the list by DT aliases */
-   sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]),
-omap_compare_pipes, NULL);
-
-   /*
-* Populate the pipeline lookup table by DISPC channel. Only one display
-* is allowed per channel.
-*/
-   for (i = 0; i < priv->num_pipes; ++i) {
-   struct omap_drm_pipeline *pipe = &priv->pipes[i];
-   enum omap_channel channel = pipe->output->dispc_channel;
-
-   if (WARN_ON(priv->channels[channel] != NULL)) {
-   r = -EINVAL;
-   goto cleanup;
-   }
-
-   priv->channels[channel] = pipe;
-   }
-
return 0;
+}
 
-cleanup:
-   /*
-* if we are deferring probe, we disconnect the devices we previously
-* connected
-*/
-   omap_disconnect_pipelines(ddev);
+static int omap_compare_pipelines(const void *a, const void *b)
+{
+   const struct omap_drm_pipeline *pipe1 = a;
+   const struct omap_drm_pipeline *pipe2 = b;
 
-   return r;
+   if (pipe1->alias_id > pipe2->alias_id)
+   return 1;
+   else if (pipe1->alias_id < pipe2->alias_id)
+   return -1;
+   return 0;
 }
 
 static int omap_modeset_init_properties(struct drm_device *dev)
@@ -254,6 +216,9 @@ static int omap_modeset_init(struct drm_device *dev)
int ret;
u32 plane_crtc_mask;
 
+   if (!omapdss_stack_is_ready())
+   return -EPROBE_DEFER;
+
drm_mode_config_init(dev);
 
ret = omap_modeset_init_properties(dev);
@@ -268,6 +233,10 @@ static int omap_modeset_init(struct drm_device *dev)
 * configuration does not match the expectations or exceeds
 * the available resources, the configuration is rejected.
 */
+   ret = omap_connect_pipelines(dev);
+   if (ret < 0)
+   return ret;
+
if (priv->num_pipes > num_mgrs || priv->num_pipes > num_ovls) {
   

[PATCH v3 47/50] drm/omap: Whitelist DT nodes to fixup with omapdss, prefix

2019-02-11 Thread Laurent Pinchart
The omapdss driver patches DT at runtime to prepend an "omapdss," prefix
to the compatible string of all encoders, panels and connectors. This
mechanism ensures they get bound to the omapdss-specific drivers instead
of generic drivers.

Now that we have drm_bridge support in omapdrm, we need to selectively
disable this mechanism. Add a whitelist of compatible strings to patch,
and fill it with all the devices we support. They will be removed one by
one once corresponding drm_bridge drivers become available and get
successfully tested with omapdrm.

The omapdss components load check code is updated accordingly to ignore
devices managed by external bridge drivers.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/dss/base.c| 20 +++---
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 21 ++-
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
b/drivers/gpu/drm/omapdrm/dss/base.c
index 3c088cd2ceab..f8dad99013e8 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -303,6 +303,7 @@ struct omapdss_comp_node {
struct list_head list;
struct device_node *node;
bool dss_core_component;
+   const char *compat;
 };
 
 static bool omapdss_list_contains(const struct device_node *node)
@@ -320,13 +321,20 @@ static bool omapdss_list_contains(const struct 
device_node *node)
 static void omapdss_walk_device(struct device *dev, struct device_node *node,
bool dss_core)
 {
+   struct omapdss_comp_node *comp;
struct device_node *n;
-   struct omapdss_comp_node *comp = devm_kzalloc(dev, sizeof(*comp),
- GFP_KERNEL);
+   const char *compat;
+   int ret;
 
+   ret = of_property_read_string(node, "compatible", &compat);
+   if (ret < 0)
+   return;
+
+   comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
if (comp) {
comp->node = node;
comp->dss_core_component = dss_core;
+   comp->compat = compat;
list_add(&comp->list, &omapdss_comp_list);
}
 
@@ -366,12 +374,8 @@ void omapdss_gather_components(struct device *dev)
 
omapdss_walk_device(dev, dev->of_node, true);
 
-   for_each_available_child_of_node(dev->of_node, child) {
-   if (!of_find_property(child, "compatible", NULL))
-   continue;
-
+   for_each_available_child_of_node(dev->of_node, child)
omapdss_walk_device(dev, child, true);
-   }
 }
 EXPORT_SYMBOL(omapdss_gather_components);
 
@@ -379,6 +383,8 @@ static bool omapdss_component_is_loaded(struct 
omapdss_comp_node *comp)
 {
if (comp->dss_core_component)
return true;
+   if (!strstarts(comp->compat, "omapdss,"))
+   return true;
if (omapdss_device_is_registered(comp->node))
return true;
 
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
index 3bfb95d230e0..309b7b453e98 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
@@ -184,6 +184,25 @@ static const struct of_device_id omapdss_of_match[] 
__initconst = {
{},
 };
 
+static const struct of_device_id omapdss_of_fixups_whitelist[] __initconst = {
+   { .compatible = "composite-video-connector" },
+   { .compatible = "dvi-connector" },
+   { .compatible = "hdmi-connector" },
+   { .compatible = "lgphilips,lb035q02" },
+   { .compatible = "nec,nl8048hl11" },
+   { .compatible = "panel-dpi" },
+   { .compatible = "panel-dsi-cm" },
+   { .compatible = "sharp,ls037v7dw01" },
+   { .compatible = "sony,acx565akm" },
+   { .compatible = "svideo-connector" },
+   { .compatible = "ti,opa362" },
+   { .compatible = "ti,tfp410" },
+   { .compatible = "ti,tpd12s015" },
+   { .compatible = "toppoly,td028ttec1" },
+   { .compatible = "tpo,td028ttec1" },
+   { .compatible = "tpo,td043mtea1" },
+};
+
 static int __init omapdss_boot_init(void)
 {
struct device_node *dss, *child;
@@ -210,7 +229,7 @@ static int __init omapdss_boot_init(void)
n = list_first_entry(&dss_conv_list, struct dss_conv_node,
list);
 
-   if (!n->root)
+   if (of_match_node(omapdss_of_fixups_whitelist, n->node))
omapdss_omapify_node(n->node);
 
list_del(&n->list);
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 35/50] drm: Clarify definition of the DRM_BUS_FLAG_(PIXDATA|SYNC)_* macros

2019-02-11 Thread Laurent Pinchart
From: Laurent Pinchart 

The DRM_BUS_FLAG_PIXDATA_POSEDGE and DRM_BUS_FLAG_PIXDATA_NEGEDGE macros
and their DRM_BUS_FLAG_SYNC_* counterparts define on which pixel clock
edge data and sync signals are driven. They are however used in some
drivers to define on which pixel clock edge data and sync signals are
sampled, which should usually (but not always) be the opposite edge of
the driving edge. This creates confusion.

Create four new macros for both PIXDATA and SYNC that explicitly state
the driving and sampling edge in their name to remove the confusion. The
driving macros are defined as the opposite of the sampling macros to
made code simpler based on the assumption that the driving and sampling
edges are opposite.

Signed-off-by: Laurent Pinchart 
Acked-by: Linus Walleij 
Reviewed-by: Stefan Agner 
Tested-by: Sebastian Reichel 
---
Changes since v1:

- Address the DRM_BUS_FLAG_SYNC_* flags
- Rebase on top of drm-next
---
 include/drm/drm_connector.h | 36 
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 994161374a49..fa6b8af611b3 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -330,19 +330,47 @@ struct drm_display_info {
 
 #define DRM_BUS_FLAG_DE_LOW(1<<0)
 #define DRM_BUS_FLAG_DE_HIGH   (1<<1)
-/* drive data on pos. edge */
+
+/*
+ * Don't use those two flags directly, use the DRM_BUS_FLAG_PIXDATA_DRIVE_*
+ * and DRM_BUS_FLAG_PIXDATA_SAMPLE_* variants to qualify the flags explicitly.
+ * The DRM_BUS_FLAG_PIXDATA_SAMPLE_* flags are defined as the opposite of the
+ * DRM_BUS_FLAG_PIXDATA_DRIVE_* flags to make code simpler, as signals are
+ * usually to be sampled on the opposite edge of the driving edge.
+ */
 #define DRM_BUS_FLAG_PIXDATA_POSEDGE   (1<<2)
-/* drive data on neg. edge */
 #define DRM_BUS_FLAG_PIXDATA_NEGEDGE   (1<<3)
+
+/* Drive data on rising edge */
+#define DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE DRM_BUS_FLAG_PIXDATA_POSEDGE
+/* Drive data on falling edge */
+#define DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE DRM_BUS_FLAG_PIXDATA_NEGEDGE
+/* Sample data on rising edge */
+#define DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGEDRM_BUS_FLAG_PIXDATA_NEGEDGE
+/* Sample data on falling edge */
+#define DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGEDRM_BUS_FLAG_PIXDATA_POSEDGE
+
 /* data is transmitted MSB to LSB on the bus */
 #define DRM_BUS_FLAG_DATA_MSB_TO_LSB   (1<<4)
 /* data is transmitted LSB to MSB on the bus */
 #define DRM_BUS_FLAG_DATA_LSB_TO_MSB   (1<<5)
-/* drive sync on pos. edge */
+
+/*
+ * Similarly to the DRM_BUS_FLAG_PIXDATA_* flags, don't use these two flags
+ * directly, use one of the DRM_BUS_FLAG_SYNC_(DRIVE|SAMPLE)_* instead.
+ */
 #define DRM_BUS_FLAG_SYNC_POSEDGE  (1<<6)
-/* drive sync on neg. edge */
 #define DRM_BUS_FLAG_SYNC_NEGEDGE  (1<<7)
 
+/* Drive sync on rising edge */
+#define DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE
DRM_BUS_FLAG_SYNC_POSEDGE
+/* Drive sync on falling edge */
+#define DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE
DRM_BUS_FLAG_SYNC_NEGEDGE
+/* Sample sync on rising edge */
+#define DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE   DRM_BUS_FLAG_SYNC_NEGEDGE
+/* Sample sync on falling edge */
+#define DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE   DRM_BUS_FLAG_SYNC_POSEDGE
+
/**
 * @bus_flags: Additional information (like pixel signal polarity) for
 * the pixel data on the bus, using DRM_BUS_FLAGS\_ defines.
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 49/50] drm/omap: Remove panel-dpi driver

2019-02-11 Thread Laurent Pinchart
Panels are now supported through the drm_panel infrastructure, remove
the omapdrm-specific driver.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Sebastian Reichel 
Tested-by: Sebastian Reichel 
---
 drivers/gpu/drm/omapdrm/displays/Kconfig  |   6 -
 drivers/gpu/drm/omapdrm/displays/Makefile |   1 -
 drivers/gpu/drm/omapdrm/displays/panel-dpi.c  | 199 --
 .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
 4 files changed, 207 deletions(-)
 delete mode 100644 drivers/gpu/drm/omapdrm/displays/panel-dpi.c

diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig 
b/drivers/gpu/drm/omapdrm/displays/Kconfig
index 38d066ac966e..7b0bcb494b5c 100644
--- a/drivers/gpu/drm/omapdrm/displays/Kconfig
+++ b/drivers/gpu/drm/omapdrm/displays/Kconfig
@@ -22,12 +22,6 @@ config DRM_OMAP_CONNECTOR_ANALOG_TV
help
  Driver for a generic analog TV connector.
 
-config DRM_OMAP_PANEL_DPI
-   tristate "Generic DPI panel"
-   depends on BACKLIGHT_CLASS_DEVICE
-   help
- Driver for generic DPI panels.
-
 config DRM_OMAP_PANEL_DSI_CM
tristate "Generic DSI Command Mode Panel"
depends on BACKLIGHT_CLASS_DEVICE
diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile 
b/drivers/gpu/drm/omapdrm/displays/Makefile
index da1d5321ef50..1db34d4fed64 100644
--- a/drivers/gpu/drm/omapdrm/displays/Makefile
+++ b/drivers/gpu/drm/omapdrm/displays/Makefile
@@ -3,7 +3,6 @@ obj-$(CONFIG_DRM_OMAP_ENCODER_OPA362) += encoder-opa362.o
 obj-$(CONFIG_DRM_OMAP_ENCODER_TPD12S015) += encoder-tpd12s015.o
 obj-$(CONFIG_DRM_OMAP_CONNECTOR_HDMI) += connector-hdmi.o
 obj-$(CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV) += connector-analog-tv.o
-obj-$(CONFIG_DRM_OMAP_PANEL_DPI) += panel-dpi.o
 obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
 obj-$(CONFIG_DRM_OMAP_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o
 obj-$(CONFIG_DRM_OMAP_PANEL_LGPHILIPS_LB035Q02) += panel-lgphilips-lb035q02.o
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
deleted file mode 100644
index 389ae2821222..
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Generic MIPI DPI Panel Driver
- *
- * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
- * Author: Tomi Valkeinen 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "../dss/omapdss.h"
-
-struct panel_drv_data {
-   struct omap_dss_device dssdev;
-
-   struct videomode vm;
-
-   struct backlight_device *backlight;
-
-   struct gpio_desc *enable_gpio;
-   struct regulator *vcc_supply;
-};
-
-#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
-
-static int panel_dpi_connect(struct omap_dss_device *src,
-struct omap_dss_device *dst)
-{
-   return 0;
-}
-
-static void panel_dpi_disconnect(struct omap_dss_device *src,
-struct omap_dss_device *dst)
-{
-}
-
-static void panel_dpi_enable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-   int r;
-
-   r = regulator_enable(ddata->vcc_supply);
-   if (r)
-   return;
-
-   gpiod_set_value_cansleep(ddata->enable_gpio, 1);
-   backlight_enable(ddata->backlight);
-}
-
-static void panel_dpi_disable(struct omap_dss_device *dssdev)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-
-   backlight_disable(ddata->backlight);
-
-   gpiod_set_value_cansleep(ddata->enable_gpio, 0);
-   regulator_disable(ddata->vcc_supply);
-}
-
-static int panel_dpi_get_modes(struct omap_dss_device *dssdev,
-  struct drm_connector *connector)
-{
-   struct panel_drv_data *ddata = to_panel_data(dssdev);
-
-   return omapdss_display_get_modes(connector, &ddata->vm);
-}
-
-static const struct omap_dss_device_ops panel_dpi_ops = {
-   .connect= panel_dpi_connect,
-   .disconnect = panel_dpi_disconnect,
-
-   .enable = panel_dpi_enable,
-   .disable= panel_dpi_disable,
-
-   .get_modes  = panel_dpi_get_modes,
-};
-
-static int panel_dpi_probe_of(struct platform_device *pdev)
-{
-   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
-   struct device_node *node = pdev->dev.of_node;
-   int r;
-   struct display_timing timing;
-   struct gpio_desc *gpio;
-
-   gpio = devm_gpiod_get_optional(&pdev->dev, "enable", GPIOD_OUT_LOW);
-   if (IS_ERR(gpio))
-   return PTR_ERR(gpio);
-
-   ddata->enable_gpio = gpio;
-
-   /*
-* Many different panels are supported by this driver and there are
-* probably very different needs for th

Re: [PATCH v2 2/2] video: lcd: Remove useless BACKLIGHT_CLASS_DEVICE dependencies

2019-02-11 Thread Daniel Thompson
On Fri, Feb 08, 2019 at 06:20:14PM +0100, Bartlomiej Zolnierkiewicz wrote:
> 
> On 01/17/2019 02:33 PM, Alexander Shiyan wrote:
> > This patch removes dependencies on BACKLIGHT_CLASS_DEVICE for items
> > that are already placed under #if BACKLIGHT_CLASS_DEVICE.
> > 
> > Signed-off-by: Alexander Shiyan 
> 
> Acked-by: Bartlomiej Zolnierkiewicz 

Sorry... looks like I sent neither an ack nor a nitpick about the #if
(#if is no more part of Kconfig syntax than #ifdef was).

However patch is perfectly clear so:
Acked-by: Daniel Thompson 


Daniel.


> 
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 202537] amdgpu/DC failed to reserve new abo buffer before flip

2019-02-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=202537

Michel Dänzer (mic...@daenzer.net) changed:

   What|Removed |Added

 CC||harry.wentl...@amd.com,
   ||nicholas.kazlaus...@amd.com

--- Comment #2 from Michel Dänzer (mic...@daenzer.net) ---
Yeah, looks like a memory leak.

Please bisect and/or provide kmemleak output, otherwise it might be difficult
to make progress on this issue.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC v3 14/19] Documentation: kunit: add documentation for KUnit

2019-02-11 Thread Kieran Bingham
Hi Brendan,

On 09/02/2019 00:56, Brendan Higgins wrote:
> On Thu, Dec 6, 2018 at 4:16 AM Kieran Bingham
>  wrote:
>>
>> Hi Brendan,
>>
>> On 03/12/2018 23:53, Brendan Higgins wrote:
>>> On Thu, Nov 29, 2018 at 7:45 PM Luis Chamberlain  wrote:

 On Thu, Nov 29, 2018 at 01:56:37PM +, Kieran Bingham wrote:
> Hi Brendan,
>
> Please excuse the top posting, but I'm replying here as I'm following
> the section "Creating a kunitconfig" in Documentation/kunit/start.rst.
>
> Could the three line kunitconfig file live under say
>arch/um/configs/kunit_defconfig?
>>
>>
>> Further consideration to this topic - I mentioned putting it in
>>   arch/um/configs
>>
>> - but I think this is wrong.
>>
>> We now have a location for config-fragments, which is essentially what
>> this is, under kernel/configs
>>
>> So perhaps an addition as :
>>
>>  kernel/configs/kunit.config
>>
>> Would be more appropriate - and less (UM) architecture specific.
> 
> Sorry for the long radio silence.
> 
> I just got around to doing this and I found that there are some
> configs that are desirable to have when running KUnit under x86 in a
> VM, but not UML. 

Should this behaviour you mention be handled by the KCONFIG depends flags?

depends on (KUMIT & UML)
or
depends on (KUNIT & !UML)

or such?

An example of which configs you are referring to would help to
understand the issue perhaps.


> So should we have one that goes in with
> config-fragments and others that go into architectures? Another idea,
> it would be nice to have a KUnit config that runs all known tests

This might also be a config option added to the tests directly like
COMPILE_TEST perhaps?

(Not sure what that would be called though ... KUNIT_RUNTIME_TEST?)

I think that might be more maintainable as otherwise each new test would
have to modify the {min,def}{config,fragment} ...


> (this probably won't work in practice once we start testing mutually
> exclusive things or things with lots of ifdeffery, but it probably
> something we should try to maintain as best as we can?); this probably
> shouldn't go in with the fragments, right?

Sounds like we agree there :)

> 
> I will be sending another revision out soon, but I figured I might be
> able to catch you before I did so.

Thanks for thinking of me.
I hope I managed to reply in time to help and not hinder your progress.

-- 
Regards
--
Kieran
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 109607] [CI][DRMTIP] Time is passing at a different rate between IGT machines and the controller

2019-02-11 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=109607

Bug ID: 109607
   Summary: [CI][DRMTIP] Time is passing at a different rate
between IGT machines and the controller
   Product: DRI
   Version: DRI git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: IGT
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: martin.pe...@free.fr

This leads to bug like this:

[78/80] (157s left) kms_flip (2x-flip-vs-modeset-vs-hang)
Build timed out (after 20 minutes). Marking the build as aborted.

https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_206/fi-icl-u3/igt@kms_f...@2x-flip-vs-modeset-vs-hang.html

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 109607] [CI][DRMTIP] Time is passing at a different rate between IGT machines and the controller

2019-02-11 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=109607

--- Comment #1 from CI Bug Log  ---
The CI Bug Log issue associated to this bug has been updated.

### New filters associated

* fi-icl-u3: random tests - incomplete
  -
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_212/fi-icl-u3/igt@kms_plane_scal...@pipe-b-scaler-with-clipping-clamping.html
  -
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_214/fi-icl-u3/igt@kms_plane_scal...@pipe-b-scaler-with-clipping-clamping.html
  -
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_215/fi-icl-u3/igt@kms_plane_scal...@pipe-b-scaler-with-clipping-clamping.html
  -
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_205/fi-icl-u3/igt@kms_f...@2x-flip-vs-modeset-vs-hang.html
  -
https://intel-gfx-ci.01.org/tree/drm-tip/drmtip_206/fi-icl-u3/igt@kms_f...@2x-flip-vs-modeset-vs-hang.html

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 4/7] of: address: Add support for the dma-parent property

2019-02-11 Thread Maxime Ripard
On Wed, Feb 06, 2019 at 02:57:51PM -0600, Rob Herring wrote:
> On Wed, Feb 6, 2019 at 1:42 PM Maxime Ripard  
> wrote:
> >
> > Some SoCs have devices that are using a separate bus from the main bus to
> > perform DMA.
> >
> > These buses might have some restrictions and/or different mapping than from
> > the CPU side, so we'd need to express those using the usual dma-ranges, but
> > using a different DT node than the node's parent.
> >
> > Add support for a dma-parent property that links to the DMA bus used by the
> > device in such a case.
> 
> ?? dma-parent is gone now, right? And I see #dma-parent-cells?

Urgh, right... I forgot to update the commit log, I'll resend it.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6 11/22] clk: sunxi-ng: a64: Add minimum rate for PLL_MIPI

2019-02-11 Thread Jagan Teki
Hi Maxime,

On Fri, Feb 1, 2019 at 8:01 PM Maxime Ripard  wrote:
>
> On Tue, Jan 29, 2019 at 11:01:31PM +0530, Jagan Teki wrote:
> > On Tue, Jan 29, 2019 at 8:43 PM Maxime Ripard  
> > wrote:
> > >
> > > On Mon, Jan 28, 2019 at 03:06:10PM +0530, Jagan Teki wrote:
> > > > On Sat, Jan 26, 2019 at 2:54 AM Maxime Ripard 
> > > >  wrote:
> > > > >
> > > > > On Fri, Jan 25, 2019 at 01:28:49AM +0530, Jagan Teki wrote:
> > > > > > Minimum PLL used for MIPI is 500MHz, as per manual, but
> > > > > > lowering the min rate by 300MHz can result proper working
> > > > > > nkms divider with the help of desired dclock rate from
> > > > > > panel driver.
> > > > > >
> > > > > > Signed-off-by: Jagan Teki 
> > > > > > Acked-by: Stephen Boyd 
> > > > >
> > > > > Going 200MHz below the minimum doesn't seem really reasonable. What
> > > > > is the issue that you are trying to fix here?
> > > > >
> > > > > It looks like it's picking bad dividers, but if that's the case, this
> > > > > isn't the proper fix.
> > > >
> > > > As I stated in earlier patches, the whole idea is pick the desired
> > > > dclk divider based dclk rate. So the dotclock, sun4i_dclk_round_rate
> > > > is unable to get the proper dclk divider at the end, so it eventually
> > > > picking up wrong divider value and fired vblank timeout.
> > > >
> > > > So, we come-up with optimal and working min_rate 300MHz in pll-mipi to
> > > > get the desired clock something like below.
> > > > [2.415773] [drm] No driver support for vblank timestamp query.
> > > > [2.424116] sun4i_dclk_round_rate: min_div = 4 max_div = 127, rate = 
> > > > 5500
> > > > [2.424172] ideal = 22000, rounded = 0
> > > > [2.424176] ideal = 27500, rounded = 0
> > > > [2.424194] ccu_nkm_round_rate: rate = 33000
> > > > [2.424197] ideal = 33000, rounded = 33000
> > > > [2.424201] sun4i_dclk_round_rate: div = 6 rate = 5500
> > > > [2.424205] sun4i_dclk_round_rate: min_div = 4 max_div = 127, rate = 
> > > > 5500
> > > > [2.424209] ideal = 22000, rounded = 0
> > > > [2.424213] ideal = 27500, rounded = 0
> > > > [2.424230] ccu_nkm_round_rate: rate = 33000
> > > > [2.424233] ideal = 33000, rounded = 33000
> > > > [2.424236] sun4i_dclk_round_rate: div = 6 rate = 5500
> > > > [2.424253] ccu_nkm_round_rate: rate = 33000
> > > > [2.424270] ccu_nkm_round_rate: rate = 33000
> > > > [2.424278] sun4i_dclk_recalc_rate: val = 1, rate = 33000
> > > > [2.424281] sun4i_dclk_recalc_rate: val = 1, rate = 33000
> > > > [2.424306] ccu_nkm_set_rate: rate = 33000, parent_rate = 
> > > > 29700
> > > > [2.424309] ccu_nkm_set_rate: _nkm.n = 5
> > > > [2.424311] ccu_nkm_set_rate: _nkm.k = 2
> > > > [2.424313] ccu_nkm_set_rate: _nkm.m = 9
> > > > [2.424661] sun4i_dclk_set_rate div 6
> > > > [2.424668] sun4i_dclk_recalc_rate: val = 6, rate = 5500
> > > >
> > > > But look like this wouldn't valid for all other dclock rates, say BPI
> > > > panel has 30MHz clock that would failed with this logic.
> > > >
> > > > On the other side Allwinner BSP calculating dclk divider based on the
> > > > SoC's. for A33 [1] it is fixed dclk divider of 4 and for A64 is is
> > > > calculated based on the bpp/lanes.
> > >
> > > It looks like the A64 has the same divider of 4:
> > > https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L12
> > >
> > > I think you're confusing it with the ratio between the pixel clock and
> > > the dotclock, called dsi_div:
> > > https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L198
> >
> > Ahh.. I thought this initially but as far as DSI clock computation is
> > concern, the L12 tcon_div is local variable which is used for edge0
> > computation in burst mode and not for the dsi clock computation. Since
> > the BSP is unable to get the tcon_div during edge0 computation, they
> > defined it locally I think.
> >
> > You can see the lcd_clk_config() code [2], where we can see DSI clock
> > computation using dsi_div value.
> >
> > Here is dump after the in Line 792 which is after computation[3]
> > [   10.800737] lcd_clk_config: dsi_div = 6, tcon_div = 4, lcd_div = 1
> > [   10.800743] lcd_clk_config: lcd_dclk_freq = 55, dclk_rate = 5500
> > [   10.800749] lcd_clk_config: lcd_rate = 33000, pll_rate = 33000
> >
> > The above dump the lcd_rate 330MHz is computed with panel clock, 55MHz
> > into dsi_div 6. So this can be our actual divider values dclk_min_div,
> > dclk_max_div in sun4i_dclk_round_rate (from
> > drivers/gpu/drm/sun4i/sun4i_dotclock.c)
>
> I wish it was in your commit log in the first place, instead of having
> to exchange multiple mails over this.
>
> However, I don't think that's quite true, and it might be a bug in
> Allwinner's implementation (or rather something quite con

Re: [PATCH] drm/amd/display: Use vrr friendly pageflip throttling in DC.

2019-02-11 Thread Kazlauskas, Nicholas
On 2/9/19 1:52 AM, Mario Kleiner wrote:
> In VRR mode, keep track of the vblank count of the last
> completed pageflip in amdgpu_crtc->last_flip_vblank, as
> recorded in the pageflip completion handler after each
> completed flip.
> 
> Use that count to prevent mmio programming a new pageflip
> within the same vblank in which the last pageflip completed,
> iow. to throttle pageflips to at most one flip per video
> frame, while at the same time allowing to request a flip
> not only before start of vblank, but also anywhere within
> vblank.
> 
> The old logic did the same, and made sense for regular fixed
> refresh rate flipping, but in vrr mode it prevents requesting
> a flip anywhere inside the possibly huge vblank, thereby
> reducing framerate in vrr mode instead of improving it, by
> delaying a slightly delayed flip requests up to a maximum
> vblank duration + 1 scanout duration. This would limit VRR
> usefulness to only help applications with a very high GPU
> demand, which can submit the flip request before start of
> vblank, but then have to wait long for fences to complete.
> 
> With this method a flip can be both requested and - after
> fences have completed - executed, ie. it doesn't matter if
> the request (amdgpu_dm_do_flip()) gets delayed until deep
> into the extended vblank due to cpu execution delays. This
> also allows clients which want to regulate framerate within
> the vrr range a much more fine-grained control of flip timing,
> a feature that might be useful for video playback, and is
> very useful for neuroscience/vision research applications.
> 
> In regular non-VRR mode, retain the old flip submission
> behavior. This to keep flip scheduling for fullscreen X11/GLX
> OpenGL clients intact, if they use the GLX_OML_sync_control
> extensions glXSwapBufferMscOML(, ..., target_msc,...) function
> with a specific target_msc target vblank count.
> 
> glXSwapBuffersMscOML() or DRI3/Present PresentPixmap() will
> not flip at the proper target_msc for a non-zero target_msc
> if VRR mode is active with this patch. They'd often flip one
> frame too early. However, this limitation should not matter
> much in VRR mode, as scheduling based on vblank counts is
> pretty futile/unusable under variable refresh duration
> anyway, so no real extra harm is done.
> 
> According to some testing already done with this patch by
> Nicholas on top of my tests, IGT tests didn't report any
> problems. If fixes stuttering and flickering when flipping
> at rates below the minimum vrr refresh rate.
> 
> Fixes: bb47de736661 ("drm/amdgpu: Set FreeSync state using drm VRR
> properties")
> Signed-off-by: Mario Kleiner 
> Cc: 
> Cc: Nicholas Kazlauskas 
> Cc: Harry Wentland 
> Cc: Alex Deucher 
> Cc: Michel Dänzer 

Reviewed-by: Nicholas Kazlauskas 

I can confirm I've tested this a bit as well and it looks reasonable to 
me. This patch really helps avoid large or frequent changes in timeout 
duration in the case where we take too long from the last and flip and 
we're already in the next vblank interval by the time we get into commit 
tail.

It's unfortunate that this changes the behavior of how waiting for the 
next vblank interval works when VRR is active but I can't really think 
of a case where we would want anything else but this.

For applications where timing and scheduling like this really matters I 
think we'd need to look into adding the target presentation timestamp to 
have full control over this kind of behavior from userspace in the first 
place. Along with some sort of control over async page-flipping in the 
atomic commit IOCTL as well.

Nicholas Kazlauskas

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h  |  1 +
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 33 ---
>   2 files changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> index bfa394ffd6d2..87ca5746f861 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
> @@ -411,6 +411,7 @@ struct amdgpu_crtc {
>   struct amdgpu_flip_work *pflip_works;
>   enum amdgpu_flip_status pflip_status;
>   int deferred_flip_completion;
> + u64 last_flip_vblank;
>   /* pll sharing */
>   struct amdgpu_atom_ss ss;
>   bool ss_enabled;
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index d59bafc84475..d4da331aa349 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -303,12 +303,11 @@ static void dm_pflip_high_irq(void *interrupt_params)
>   return;
>   }
>   
> + /* Update to correct count(s) if racing with vblank irq */
> + amdgpu_crtc->last_flip_vblank = 
> drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);
>   
>   /* wake up userspace */
>   if (amdgpu_crtc->event) {
> - /* Up

Re: [PATCH v2 9/9] drm/panel: Add Ronbo RB070D30 panel

2019-02-11 Thread Maxime Ripard
hi,

On Fri, Feb 08, 2019 at 03:24:12PM +0300, Konstantin Sudakov wrote:
> Hello, Maxime!
> 
> >+mode = drm_mode_duplicate(panel->drm, &default_mode);
> >+if (!mode) {
> >+DRM_DEV_ERROR(&ctx->dsi->dev,
> >+  "Failed to add mode " DRM_MODE_FMT "\n",
> >+  DRM_MODE_ARG(mode));
> >+return -EINVAL;
> >+}
> 
> Just small fix: DRM_MODE_ARG(mode) -> DRM_MODE_ARG(&default_mode).
> The "mode" variable is NULL, it leads to the UB.

Good catch, thanks!
Maxime

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


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 3/8] drm/sun4i: dsi: Enforce boundaries on the start delay

2019-02-11 Thread Maxime Ripard
The Allwinner BSP makes sure that we don't end up with a null start delay
or with a delay larger than vtotal.

The former condition is likely to happen now with the reworked start delay,
so make sure we enforce the same boundaries.

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 9471fa695ec7..506f2e8cf454 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -358,8 +358,12 @@ static u16 sun6i_dsi_get_video_start_delay(struct 
sun6i_dsi *dsi,
   struct drm_display_mode *mode)
 {
u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
+   u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
 
-   return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
+   if (delay > mode->vtotal)
+   delay = delay % mode->vtotal;
+
+   return max_t(u16, delay, 1);
 }
 
 static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 0/8] drm/sun4i: dsi: Add burst mode support

2019-02-11 Thread Maxime Ripard
Hi,

Here is a series implementing the burst mode support for DSI.

It's been tested on an A33 board with the panel supported on the last
patch, which should remove all quirks due to a different SoC from the
equation.

Let me know what you think,
Maxime

Changes from v3:
  - Fixed error in Ronbo panel error path

Changes from v2:
  - Change the start delay calculation according to the legacy driver in
Allwinner's BSP
  - Fixed the edge calculation to add the same parentheses around the
factors
  - Added a bunch of fixes to timings
  - Added a patch to make hblk computation more accurate, and added a
comment
  - Renamed the panel to Ronbo and fixed a bunch of things
  - Added the Reviewed-By

Konstantin Sudakov (2):
  drm/sun4i: dsi: Add burst support
  drm/panel: Add Ronbo RB070D30 panel

Maxime Ripard (6):
  drm/sun4i: dsi: Restrict DSI tcon clock divider
  drm/sun4i: dsi: Change the start delay calculation
  drm/sun4i: dsi: Enforce boundaries on the start delay
  drm/sun4i: dsi: Fix front vs back porch calculation
  drm/sun4i: dsi: Fix DRQ calculation
  drm/sun4i: dsi: Rework a bit the hblk calculation

 drivers/gpu/drm/panel/Kconfig|   9 +-
 drivers/gpu/drm/panel/Makefile   |   1 +-
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 262 -
 drivers/gpu/drm/sun4i/sun4i_tcon.c   |   4 +-
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c   | 183 ++
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h   |   2 +-
 6 files changed, 419 insertions(+), 42 deletions(-)
 create mode 100644 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

base-commit: 7e571a7f2fc622f81f8be4a4d8725551490378b2
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 1/8] drm/sun4i: dsi: Restrict DSI tcon clock divider

2019-02-11 Thread Maxime Ripard
The current code allows the TCON clock divider to have a range between 4
and 127 when feeding the DSI controller.

The only display supported so far had a display clock rate that ended up
using a divider of 4, but testing with other displays show that only 4
seems to be functional.

This also aligns with what Allwinner is doing in their BSP, so let's just
hardcode that we want a divider of 4 when using the DSI output.

Reviewed-by: Paul Kocialkowski 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++--
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c 
b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 0420f5c978b9..bee73ead732a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -341,8 +341,8 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon 
*tcon,
u32 block_space, start_delay;
u32 tcon_div;
 
-   tcon->dclk_min_div = 4;
-   tcon->dclk_max_div = 127;
+   tcon->dclk_min_div = SUN6I_DSI_TCON_DIV;
+   tcon->dclk_max_div = SUN6I_DSI_TCON_DIV;
 
sun4i_tcon0_mode_set_common(tcon, mode);
 
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
index dbbc5b3ecbda..6d4a3c0fd9b5 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h
@@ -13,6 +13,8 @@
 #include 
 #include 
 
+#define SUN6I_DSI_TCON_DIV 4
+
 struct sun6i_dphy {
struct clk  *bus_clk;
struct clk  *mod_clk;
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 2/8] drm/sun4i: dsi: Change the start delay calculation

2019-02-11 Thread Maxime Ripard
The current calculation for the video start delay in the current DSI driver
is that it is the total vertical size, minus the front porch and sync length,
plus 1. This equals to the active vertical size plus the back porch plus 1.

That 1 is coming in the Allwinner BSP from an variable that is set to 1.
However, if we look at the Allwinner BSP more closely, and especially in
the "legacy" code for the display (in drivers/video/sunxi/legacy/), we can
see that this variable is actually computed from the porches and the sync
minus 10, clamped between 8 and 100.

This fixes the start delay symptom we've seen on some panels (vblank
timeouts with vertical white stripes at the bottom of the panel).

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 380fc527a707..9471fa695ec7 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -357,7 +357,9 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
 static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
   struct drm_display_mode *mode)
 {
-   return mode->vtotal - (mode->vsync_end - mode->vdisplay) + 1;
+   u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100);
+
+   return mode->vtotal - (mode->vsync_end - mode->vdisplay) + start;
 }
 
 static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 6/8] drm/sun4i: dsi: Rework a bit the hblk calculation

2019-02-11 Thread Maxime Ripard
It turns out that the hblk calculation actually follows a similar pattern
than the other packets. Rework a bit the calculation and add a comment.

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 8e6392831e9d..e0288e7dc64e 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -488,9 +488,13 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
  (mode->hsync_start - mode->hdisplay) * Bpp - 
HFP_PACKET_OVERHEAD);
 
/*
-* hblk seems to be the line + porches length.
+* The blanking is set using a sync event (4 bytes) and a
+* blanking packet (4 bytes + payload + 2 bytes). Its minimal
+* size is therefore 10 bytes.
 */
-   hblk = mode->htotal * Bpp - hsa;
+#define HBLK_PACKET_OVERHEAD   10
+   hblk = max((unsigned int)HBLK_PACKET_OVERHEAD,
+  (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp 
- HBLK_PACKET_OVERHEAD);
 
/*
 * And I'm not entirely sure what vblk is about. The driver in
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 8/8] drm/panel: Add Ronbo RB070D30 panel

2019-02-11 Thread Maxime Ripard
From: Konstantin Sudakov 

The Ronbo RB070D30 panel is a MIPI-DSI panel based on a Fitipower EK79007
controller and a 1024x600 panel.

Reviewed-by: Sam Ravnborg 
Signed-off-by: Konstantin Sudakov 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/panel/Kconfig|   9 +-
 drivers/gpu/drm/panel/Makefile   |   1 +-
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 262 -
 3 files changed, 272 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 3f3537719beb..870dcdbf2601 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -138,6 +138,15 @@ config DRM_PANEL_RAYDIUM_RM68200
  Say Y here if you want to enable support for Raydium RM68200
  720x1280 DSI video mode panel.
 
+config DRM_PANEL_RONBO_RB070D30
+   tristate "Ronbo Electronics RB070D30 panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for Ronbo Electronics
+ RB070D30 1024x600 DSI panel.
+
 config DRM_PANEL_SAMSUNG_S6D16D0
tristate "Samsung S6D16D0 DSI video mode panel"
depends on OF
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 4396658a7996..4a103d346809 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_DRM_PANEL_ORISETECH_OTM8009A) += 
panel-orisetech-otm8009a.o
 obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += 
panel-panasonic-vvx10f034n00.o
 obj-$(CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN) += 
panel-raspberrypi-touchscreen.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
+obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c 
b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
new file mode 100644
index ..cb4f99252aa0
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -0,0 +1,262 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018-2019, Bridge Systems BV
+ * Copyright (C) 2018-2019, Bootlin
+ * Copyright (C) 2017, Free Electrons
+ *
+ * This file based on panel-ilitek-ili9881c.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+struct rb070d30_panel {
+   struct drm_panel panel;
+   struct mipi_dsi_device *dsi;
+   struct backlight_device *backlight;
+   struct regulator *supply;
+
+   struct {
+   struct gpio_desc *power;
+   struct gpio_desc *reset;
+   struct gpio_desc *updn;
+   struct gpio_desc *shlr;
+   } gpios;
+};
+
+static inline struct rb070d30_panel *panel_to_rb070d30_panel(struct drm_panel 
*panel)
+{
+   return container_of(panel, struct rb070d30_panel, panel);
+}
+
+static int rb070d30_panel_prepare(struct drm_panel *panel)
+{
+   struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
+   int ret;
+
+   ret = regulator_enable(ctx->supply);
+   if (ret < 0) {
+   DRM_DEV_ERROR(&ctx->dsi->dev, "Failed to enable supply: %d\n", 
ret);
+   return ret;
+   }
+
+   /* Reset */
+   msleep(20);
+   gpiod_set_value(ctx->gpios.power, 1);
+   msleep(20);
+   gpiod_set_value(ctx->gpios.reset, 1);
+   msleep(20);
+   return 0;
+}
+
+static int rb070d30_panel_unprepare(struct drm_panel *panel)
+{
+   struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
+
+   gpiod_set_value(ctx->gpios.reset, 0);
+   gpiod_set_value(ctx->gpios.power, 0);
+   regulator_disable(ctx->supply);
+
+   return 0;
+}
+
+static int rb070d30_panel_enable(struct drm_panel *panel)
+{
+   struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
+   int ret;
+
+   ret = mipi_dsi_dcs_exit_sleep_mode(ctx->dsi);
+   if (ret)
+   return ret;
+
+   ret = backlight_enable(ctx->backlight);
+   if (ret)
+   goto out;
+
+   return 0;
+
+out:
+   mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
+   return ret;
+}
+
+static int rb070d30_panel_disable(struct drm_panel *panel)
+{
+   struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
+
+   backlight_disable(ctx->backlight);
+   return mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
+}
+
+/* Default timings */
+static const struct drm_display_mode default_mode = {
+   .clock  = 51206,
+   .hdisplay   = 1024,
+   .hsync_start= 1024 + 160,
+   .hsync

[PATCH v3 4/8] drm/sun4i: dsi: Fix front vs back porch calculation

2019-02-11 Thread Maxime Ripard
Since I always confuse the back and front porches, a few miscalculation
slipped through. Fix them.

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 506f2e8cf454..2518a0d7567c 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -477,7 +477,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
 */
 #define HBP_PACKET_OVERHEAD6
hbp = max((unsigned int)HBP_PACKET_OVERHEAD,
- (mode->hsync_start - mode->hdisplay) * Bpp - 
HBP_PACKET_OVERHEAD);
+ (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD);
 
/*
 * The frontporch is set using a blanking packet (4 bytes +
@@ -485,7 +485,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
 */
 #define HFP_PACKET_OVERHEAD6
hfp = max((unsigned int)HFP_PACKET_OVERHEAD,
- (mode->htotal - mode->hsync_end) * Bpp - HFP_PACKET_OVERHEAD);
+ (mode->hsync_start - mode->hdisplay) * Bpp - 
HFP_PACKET_OVERHEAD);
 
/*
 * hblk seems to be the line + porches length.
@@ -531,8 +531,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE0_REG,
 SUN6I_DSI_BASIC_SIZE0_VSA(mode->vsync_end -
   mode->vsync_start) |
-SUN6I_DSI_BASIC_SIZE0_VBP(mode->vsync_start -
-  mode->vdisplay));
+SUN6I_DSI_BASIC_SIZE0_VBP(mode->vtotal -
+  mode->vsync_end));
 
regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE1_REG,
 SUN6I_DSI_BASIC_SIZE1_VACT(mode->vdisplay) |
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 7/8] drm/sun4i: dsi: Add burst support

2019-02-11 Thread Maxime Ripard
From: Konstantin Sudakov 

The current driver doesn't support the DSI burst operation mode.

Let's add the needed quirks to make it work.

Signed-off-by: Konstantin Sudakov 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 171 --
 1 file changed, 132 insertions(+), 39 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index e0288e7dc64e..4cb715dc9100 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -23,7 +23,9 @@
 #include 
 #include 
 
+#include "sun4i_crtc.h"
 #include "sun4i_drv.h"
+#include "sun4i_tcon.h"
 #include "sun6i_mipi_dsi.h"
 
 #include 
@@ -32,6 +34,8 @@
 #define SUN6I_DSI_CTL_EN   BIT(0)
 
 #define SUN6I_DSI_BASIC_CTL_REG0x00c
+#define SUN6I_DSI_BASIC_CTL_TRAIL_INV(n)   (((n) & 0xf) << 4)
+#define SUN6I_DSI_BASIC_CTL_TRAIL_FILL BIT(3)
 #define SUN6I_DSI_BASIC_CTL_HBP_DISBIT(2)
 #define SUN6I_DSI_BASIC_CTL_HSA_HSE_DISBIT(1)
 #define SUN6I_DSI_BASIC_CTL_VIDEO_BURSTBIT(0)
@@ -152,6 +156,8 @@
 
 #define SUN6I_DSI_CMD_TX_REG(n)(0x300 + (n) * 0x04)
 
+#define SUN6I_DSI_SYNC_POINT   40
+
 enum sun6i_dsi_start_inst {
DSI_START_LPRX,
DSI_START_LPTX,
@@ -366,13 +372,70 @@ static u16 sun6i_dsi_get_video_start_delay(struct 
sun6i_dsi *dsi,
return max_t(u16, delay, 1);
 }
 
+static u16 sun6i_dsi_get_line_num(struct sun6i_dsi *dsi,
+ struct drm_display_mode *mode)
+{
+   struct mipi_dsi_device *device = dsi->device;
+   unsigned Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8;
+
+   return mode->htotal * Bpp / device->lanes;
+}
+
+static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi,
+  struct drm_display_mode *mode,
+  u16 line_num, u16 edge1)
+{
+   u16 edge0 = edge1;
+
+   edge0 += (mode->hdisplay + 40) * SUN6I_DSI_TCON_DIV / 8;
+
+   if (edge0 > line_num)
+   return edge0 - line_num;
+
+   return 1;
+}
+
+static u16 sun6i_dsi_get_drq_edge1(struct sun6i_dsi *dsi,
+  struct drm_display_mode *mode,
+  u16 line_num)
+{
+   struct mipi_dsi_device *device = dsi->device;
+   unsigned Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8;
+   unsigned hbp = mode->htotal - mode->hsync_end;
+   u16 edge1;
+
+   edge1 = SUN6I_DSI_SYNC_POINT;
+   edge1 += (mode->hdisplay + hbp + 20) * Bpp / device->lanes;
+
+   if (edge1 > line_num)
+   return line_num;
+
+   return edge1;
+}
+
 static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
  struct drm_display_mode *mode)
 {
struct mipi_dsi_device *device = dsi->device;
u32 val = 0;
 
-   if ((mode->hsync_start - mode->hdisplay) > 20) {
+   if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
+   u16 line_num = sun6i_dsi_get_line_num(dsi, mode);
+   u16 edge0, edge1;
+
+   edge1 = sun6i_dsi_get_drq_edge1(dsi, mode, line_num);
+   edge0 = sun6i_dsi_get_drq_edge0(dsi, mode, line_num, edge1);
+
+   regmap_write(dsi->regs, SUN6I_DSI_BURST_DRQ_REG,
+SUN6I_DSI_BURST_DRQ_EDGE0(edge0) |
+SUN6I_DSI_BURST_DRQ_EDGE1(edge1));
+
+   regmap_write(dsi->regs, SUN6I_DSI_BURST_LINE_REG,
+SUN6I_DSI_BURST_LINE_NUM(line_num) |
+
SUN6I_DSI_BURST_LINE_SYNC_POINT(SUN6I_DSI_SYNC_POINT));
+
+   val = SUN6I_DSI_TCON_DRQ_ENABLE_MODE;
+   } else if ((mode->hsync_start - mode->hdisplay) > 20) {
/* Maagic */
u16 drq = (mode->hsync_start - mode->hdisplay) - 20;
 
@@ -389,8 +452,19 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
 static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi,
  struct drm_display_mode *mode)
 {
+   struct mipi_dsi_device *device = dsi->device;
u16 delay = 50 - 1;
 
+   if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) {
+   delay = (mode->htotal - mode->hdisplay) * 150;
+   delay /= (mode->clock / 1000) * 8;
+   delay -= 50;
+   }
+
+   regmap_write(dsi->regs, SUN6I_DSI_INST_LOOP_SEL_REG,
+2 << (4 * DSI_INST_ID_LP11) |
+3 << (4 * DSI_INST_ID_DLY));
+
regmap_write(dsi->regs, SUN6I_DSI_INST_LOOP_NUM_REG(0),
 SUN6I_DSI_INST_LOOP_NUM_N0(50 - 1) |
 SUN6I_DSI_INST_LOOP_NUM_N1(delay));
@@ -457,52 +531,71 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
struct mipi_dsi_device *device = dsi->device;
unsigned 

[PATCH v3 5/8] drm/sun4i: dsi: Fix DRQ calculation

2019-02-11 Thread Maxime Ripard
The DRQ calculation code in the Allwinner BSP uses the vertical front
porch value as the condition, but we're using the video back porch.

Since I always confuse the two, and I'm the original author of that code, I
guess I deserved a brown paper bag.

Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
index 2518a0d7567c..8e6392831e9d 100644
--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
+++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
@@ -372,9 +372,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
struct mipi_dsi_device *device = dsi->device;
u32 val = 0;
 
-   if ((mode->hsync_end - mode->hdisplay) > 20) {
+   if ((mode->hsync_start - mode->hdisplay) > 20) {
/* Maagic */
-   u16 drq = (mode->hsync_end - mode->hdisplay) - 20;
+   u16 drq = (mode->hsync_start - mode->hdisplay) - 20;
 
drq *= mipi_dsi_pixel_format_to_bpp(device->format);
drq /= 32;
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 7/7] ARM: dts: sun5i: Add the MBUS controller

2019-02-11 Thread Maxime Ripard
The MBUS (and its associated controller) is the bus in the Allwinner SoCs
that DMA devices use in the system to access the memory.

Among other things (and depending on the SoC generation), it can also
enforce priorities or report bandwidth usages on a per-master basis.

One of the most notable thing is that instead of having the same mapping
for the RAM than the CPU, it maps it at address 0, which means we'll have
to do address translation thanks to the dma-ranges property.

Signed-off-by: Maxime Ripard 
---
 arch/arm/boot/dts/sun5i.dtsi | 13 +
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi
index 5497d985c54a..a29203b7661d 100644
--- a/arch/arm/boot/dts/sun5i.dtsi
+++ b/arch/arm/boot/dts/sun5i.dtsi
@@ -127,6 +127,7 @@
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
+   dma-ranges;
ranges;
 
system-control@1c0 {
@@ -181,6 +182,14 @@
};
};
 
+   mbus: dram-controller@1c01000 {
+   compatible = "allwinner,sun5i-a13-mbus";
+   reg = <0x01c01000 0x1000>;
+   clocks = <&ccu CLK_MBUS>;
+   dma-ranges = <0x 0x4000 0x2000>;
+   #interconnect-cells = <1>;
+   };
+
dma: dma-controller@1c02000 {
compatible = "allwinner,sun4i-a10-dma";
reg = <0x01c02000 0x1000>;
@@ -727,6 +736,8 @@
clock-names = "ahb", "mod",
  "ram";
resets = <&ccu RST_DE_FE>;
+   interconnects = <&mbus 19>;
+   interconnect-names = "dma";
status = "disabled";
 
ports {
@@ -755,6 +766,8 @@
clock-names = "ahb", "mod",
  "ram";
resets = <&ccu RST_DE_BE>;
+   interconnects = <&mbus 18>;
+   interconnect-names = "dma";
status = "disabled";
 
assigned-clocks = <&ccu CLK_DE_BE>;
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 1/7] dt-bindings: interconnect: Add a dma interconnect name

2019-02-11 Thread Maxime Ripard
The current DT bindings assume that the DMA will be performed by the
devices through their parent DT node, and rely on that assumption for the
address translation using dma-ranges.

However, some SoCs have devices that will perform DMA through another bus,
with separate address translation rules. We therefore need to express that
relationship, through the special interconnect name "dma".

Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/interconnect/interconnect.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/interconnect/interconnect.txt 
b/Documentation/devicetree/bindings/interconnect/interconnect.txt
index 5a3c575b387a..e69fc2d992c3 100644
--- a/Documentation/devicetree/bindings/interconnect/interconnect.txt
+++ b/Documentation/devicetree/bindings/interconnect/interconnect.txt
@@ -51,6 +51,9 @@ interconnect-names : List of interconnect path name strings 
sorted in the same
 interconnect-names to match interconnect paths with 
interconnect
 specifier pairs.
 
+ Reserved interconnect names:
+ * dma: Path from the device to the main memory of the 
system
+
 Example:
 
sdhci@7864000 {
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: 2019 X.Org Board of Directors Elections Nomination period is NOW

2019-02-11 Thread Wentland, Harry
So far we've received a couple of nominations for four open spots. The official 
nomination period ends this Thursday. Please let us know if you'd like to 
nominate someone including yourself.

Harry

On 2019-01-31 5:08 p.m., Wentland, Harry wrote:
> We are seeking nominations for candidates for election to the X.Org 
> Foundation Board of Directors. All X.Org Foundation members are eligible for 
> election to the board.
> 
> Nominations for the 2019 election are now open and will remain open until 
> 23:59 UTC on 14 February 2019.
> 
> The Board consists of directors elected from the membership. Each year, an 
> election is held to bring the total number of directors to eight. The four 
> members receiving the highest vote totals will serve as directors for two 
> year terms.
> 
> The directors who received two year terms starting in 2018 were Keith 
> Packard, Bryce Harrington, Eric Anholt, and Harry Wentland. They will 
> continue to serve until their term ends in 2020. Current directors whose term 
> expires in 2019 are Rob Clark, Martin Peres, Taylor Campbell and Daniel 
> Vetter.
> 
> A director is expected to participate in the fortnightly IRC meeting to 
> discuss current business and to attend the annual meeting of the X.Org 
> Foundation, which will be held at a location determined in advance by the 
> Board of Directors.
> 
> A member may nominate themselves or any other member they feel is qualified. 
> Nominations should be sent to the Election Committee at elections at x.org.
> 
> Nominees shall be required to be current members of the X.Org Foundation, and 
> submit a personal statement of up to 200 words that will be provided to 
> prospective voters. The collected statements, along with the statement of 
> contribution to the X.Org Foundation in the member's account page on 
> http://members.x.org, will be made available to all voters to help them make 
> their voting decisions.
> 
> Nominations, membership applications or renewals and completed personal 
> statements must be received no later than 23:59 UTC on 14 February 2019.
> 
> The slate of candidates will be published 21 February 2019 and candidate Q&A 
> will begin then. The deadline for Xorg membership applications and renewals 
> is 21 February 2019.
> 
> Cheers, Harry Wentland, on behalf of the X.Org BoD
> 
> 
> 
> 
> ___
> memb...@foundation.x.org: X.Org Foundation Members
> Archives: https://foundation.x.org/cgi-bin/mailman/private/members
> Info: https://foundation.x.org/cgi-bin/mailman/listinfo/members
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 2/7] dt-bindings: bus: Add binding for the Allwinner MBUS controller

2019-02-11 Thread Maxime Ripard
The MBUS controller drives the MBUS that other devices in the SoC will
use to perform DMA. It also has a register interface that allows to
monitor and control the bandwidth and priorities for masters on that
bus.

Signed-off-by: Maxime Ripard 
---
 Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt | 36 +++-
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt

diff --git a/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt 
b/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt
new file mode 100644
index ..e72b7ac9e359
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt
@@ -0,0 +1,36 @@
+Allwinner Memory Bus (MBUS) controller
+
+The MBUS controller drives the MBUS that other devices in the SoC will
+use to perform DMA. It also has a register interface that allows to
+monitor and control the bandwidth and priorities for masters on that
+bus.
+
+Required properties:
+ - compatible: Must be one of:
+   - allwinner,sun5i-a13-mbus
+ - reg: Offset and length of the register set for the controller
+ - clocks: phandle to the clock driving the controller
+ - dma-ranges: see booting-without-of.txt
+ - #interconnect-cells: Must be one, with the argument being the MBUS
+   port ID
+
+Each device having to perform their DMA through the MBUS must have the
+interconnects and interconnect-names properties set to the MBUS
+controller and with "dma" as the interconnect name.
+
+Example:
+
+mbus: dram-controller@1c01000 {
+   compatible = "allwinner,sun5i-a13-mbus";
+   reg = <0x01c01000 0x1000>;
+   clocks = <&ccu CLK_MBUS>;
+   dma-ranges = <0x 0x4000 0x2000>;
+   #interconnect-cells = <1>;
+};
+
+fe0: display-frontend@1e0 {
+   compatible = "allwinner,sun5i-a13-display-frontend";
+   ...
+   interconnects = <&mbus 19>;
+   interconnect-names = "dma";
+};
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 109608] Regression from llvm-6: llvm-7 replaces 'undef' with 'NaN', and generates NaN at the assembler level - This issue generates black screen on some fragment shaders.

2019-02-11 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=109608

Bug ID: 109608
   Summary: Regression from llvm-6: llvm-7 replaces 'undef' with
'NaN', and generates NaN at the assembler level - This
issue generates black screen on some fragment shaders.
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: patrick9...@free.fr
QA Contact: dri-devel@lists.freedesktop.org

The issue is not related to mesa itself but at the LLVM optimization stage:
LLVMRunPassManager(). This bug report is mostly for tracking purposes.

Here are two fragment shaders affected: https://www.shadertoy.com/view/ltl3WS
and https://www.shadertoy.com/view/MdVcRd

Here is the LLVM bug report: https://bugs.llvm.org/show_bug.cgi?id=40690

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 4/7] of: address: Add support for the parent DMA bus

2019-02-11 Thread Maxime Ripard
Some SoCs have devices that are using a separate bus from the main bus to
perform DMA.

These buses might have some restrictions and/or different mapping than from
the CPU side, so we'd need to express those using the usual dma-ranges, but
using a different DT node than the node's parent.

Now that the generic interconnect bindings are available, we can model an
interconnect with the reserved name "dma" for those use-cases.

Signed-off-by: Maxime Ripard 
---
 drivers/of/address.c | 34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 4c5dc21c71ca..0e9d87a664f5 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -583,8 +583,8 @@ static u64 __of_translate_address(struct device_node *dev,
/* Increase refcount at current level */
of_node_get(dev);
 
+   *host = NULL;
if (!parent) {
-   *host = NULL;
/* Get parent & match bus type */
parent = of_get_parent(dev);
if (parent == NULL)
@@ -678,12 +678,34 @@ u64 of_translate_address(struct device_node *dev, const 
__be32 *in_addr)
 }
 EXPORT_SYMBOL(of_translate_address);
 
+static struct device_node *__of_get_dma_parent(struct device_node *np)
+{
+   struct of_phandle_args args;
+   unsigned int index;
+   int ret;
+
+   ret = of_property_match_string(np, "interconnect-names", "dma");
+   if (ret < 0)
+   return of_get_parent(np);
+
+   ret = of_parse_phandle_with_args(np, "interconnects",
+"#interconnect-cells",
+index, &args);
+   if (ret < 0)
+   return of_get_parent(np);
+
+   return of_node_get(args.np);
+}
+
 u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
 {
+   struct device_node *parent;
struct device_node *host;
u64 ret;
 
-   ret = __of_translate_address(dev, NULL, in_addr, "dma-ranges", &host);
+   parent = __of_get_dma_parent(dev);
+   ret = __of_translate_address(dev, parent, in_addr, "dma-ranges", &host);
+   of_node_put(parent);
 
if (host) {
of_node_put(host);
@@ -911,9 +933,15 @@ int of_dma_get_range(struct device_node *np, u64 
*dma_addr, u64 *paddr, u64 *siz
return -EINVAL;
 
while (1) {
+   struct device_node *parent;
+
naddr = of_n_addr_cells(node);
nsize = of_n_size_cells(node);
-   node = of_get_next_parent(node);
+
+   parent = __of_get_dma_parent(node);
+   of_node_put(node);
+
+   node = parent;
if (!node)
break;
 
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 2/2] drm/panel: Add driver for Samsung S6E63M0 panel

2019-02-11 Thread Andrzej Hajda
On 02.02.2019 15:27, Paweł Chmiel wrote:
> This patch adds Samsung S6E63M0 AMOLED LCD panel driver, connected over
> spi. It's based on already removed, non dt s6e63m0 driver and
> panel-samsung-ld9040. It can be found for example in some of Samsung
> Aries based phones.
>
> Signed-off-by: Paweł Chmiel 
> Reviewed-by: Sam Ravnborg 
> ---
> Changes from v2:
>   - VIDEOMODE_HELPERS is not needed in Kconfig
>   - Added help text to Kconfig
>   - Remove unneeded videomode includes/fields
>   - Add sentinel comment in s6e63m0_of_match struct
>   - Handle errors during registration of backlight device. We shouldn't
> register panel if we fail to register backlight device
>   - Added Reviewed-by
>
> Changes from v1:
>   - Correct order of Kconfig/Makefile entry
>   - Fix SPDX tag, so it matches value of MODULE_LICENSE
>   - Remove inclusion of drmP.h
>   - Fix code formatting
>   - Use DRM_DEV_ERROR/DEBUG
>   - Extract hardcoded values
>   - Remove possibility to change gamma through sysfs, leaving only one
> gamma table values
>   - Fix reset_gpio handling, so it'll be asserted in power_on and
> deasserted in power_off. Also do it before turning voltage on.
>   - Disable backlight and enter sleep mode in disable callback.
> Previously it was done in unprepare
>   - Enable display and backlight in enable callback. Previously it was
> done in prepare
>   - Hardcode display timings and delays. Previously they were readed
> from device tree
>   - We're using SPDX, so we don't need to have license body
>   - Use MIPI_DCS_EXIT_SLEEP_MODE and MIPI_DCS_SET_DISPLAY_ON
>   - Rename MAX_GAMMA_LEVEL to NUM_GAMMA_LEVELS
>   - Ommit get_brightness callback
>   - Use backlight_enable/disable API, like it's done in other panel
> drivers (for example panel-simple)
>   - Make set_brightness called only from backlight api, like it's done
> in other panel drivers (for example panel-simple).
>   - Reset gpio should be set to GPIOD_OUT_HIGH. It's declared as active
> low in device tree
>   - Don't call power_off in remove callback
> ---
>  drivers/gpu/drm/panel/Kconfig |   9 +
>  drivers/gpu/drm/panel/Makefile|   1 +
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 517 ++
>  3 files changed, 527 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 3f3537719beb..45e9ab4b7857 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -158,6 +158,15 @@ config DRM_PANEL_SAMSUNG_S6E63J0X03
>   depends on BACKLIGHT_CLASS_DEVICE
>   select VIDEOMODE_HELPERS
>  
> +config DRM_PANEL_SAMSUNG_S6E63M0
> + tristate "Samsung S6E63M0 RGB/SPI panel"
> + depends on OF
> + depends on SPI
> + depends on BACKLIGHT_CLASS_DEVICE
> + help
> +   Say Y here if you want to enable support for Samsung s6e63m0
> +   AMOLED LCD panel.
> +
>  config DRM_PANEL_SAMSUNG_S6E8AA0
>   tristate "Samsung S6E8AA0 DSI video mode panel"
>   depends on OF
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 4396658a7996..4507a2d253ac 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += 
> panel-samsung-ld9040.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6D16D0) += panel-samsung-s6d16d0.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o
> +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63M0) += panel-samsung-s6e63m0.o
>  obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
>  obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o
>  obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c 
> b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> new file mode 100644
> index ..4312aa3e4386
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -0,0 +1,517 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * S6E63M0 AMOLED LCD drm_panel driver.
> + *
> + * Copyright (C) 2019 Paweł Chmiel 
> + * Derived from drivers/gpu/drm/panel-samsung-ld9040.c
> + *
> + * Andrzej Hajda 
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +/* Manufacturer Command Set */
> +#define MCS_ELVSS_ON0xb1
> +#define MCS_ACL_CTRL0xc0
> +#define MCS_DISPLAY_CONDITION   0xf2
> +#define MCS_ETC_CONDITION   0xf6
> +#define MCS_PANEL_CONDITION 0xF8
> +#define MCS_GAMMA_CTRL  0xfa
> +
> +#define NUM_GAMMA_LEVELS 11
> +#define GAMMA_TABLE_COUNT   23
> +
> +#define DATA_MASK   0x100
> +
> +#define MAX_BR

Re: [PATCH 2/3] drm: Add basic helper to allow precise pageflip timestamps in vrr.

2019-02-11 Thread Kazlauskas, Nicholas
On 2/11/19 3:35 AM, Daniel Vetter wrote:
> On Mon, Feb 11, 2019 at 04:22:24AM +0100, Mario Kleiner wrote:
>> The pageflip completion timestamps transmitted to userspace
>> via pageflip completion events are supposed to describe the
>> time at which the first pixel of the new post-pageflip scanout
>> buffer leaves the video output of the gpu. This time is
>> identical to end of vblank, when active scanout starts.
>>
>> For a crtc in standard fixed refresh rate, the end of vblank
>> is identical to the vblank timestamps calculated by
>> drm_update_vblank_count() at each vblank interrupt, or each
>> vblank dis-/enable. Therefore pageflip events just carry
>> that vblank timestamp as their pageflip timestamp.
>>
>> For a crtc switched to variable refresh rate mode (vrr), the
>> pageflip completion timestamps are identical to the vblank
>> timestamps iff the pageflip was executed early in vblank,
>> before the minimum vblank duration elapsed. In this case
>> the time of display onset is identical to when the crtc
>> is running in fixed refresh rate.
>>
>> However, if a pageflip completes later in the vblank, inside
>> the "extended front porch" in vrr mode, then the vblank will
>> terminate at a fixed (back porch) duration after flip, so
>> the display onset time is delayed correspondingly. In this
>> case the vblank timestamp computed at vblank irq time would
>> be too early, and we need a way to calculate an estimated
>> pageflip timestamp that will be later than the vblank timestamp.
>>
>> How a driver determines such a "late flip" timestamp is hw
>> and driver specific, but this patch adds a new helper function
>> that allows the driver to propose such an alternate "late flip"
>> timestamp for use in pageflip events:
>>
>> drm_crtc_set_vrr_pageflip_timestamp(crtc, flip_timestamp);
>>
>> When sending out pageflip events, we now compare that proposed
>> flip_timestamp against the vblank timestamp of the current
>> vblank of flip completion and choose to send out the greater/
>> later timestamp as flip completion timestamp.
>>
>> The most simple way for a kms driver to supply a suitable
>> flip_timestamp in vrr mode would be to simply take a timestamp
>> at start of the pageflip completion handler, e.g., pageflip
>> irq handler: flip_timestamp = ktime_get(); and then set that
>> as proposed "late" alternative timestamp via ...
>> drm_crtc_set_vrr_pageflip_timestamp(crtc, flip_timestamp);
>>
>> More clever approaches could try to add some corrective offset
>> for fixed back porch duration, or ideally use hardware features
>> like hw timestamps to calculate the exact end time of vblank.
>>
>> Signed-off-by: Mario Kleiner 
>> Cc: Nicholas Kazlauskas 
>> Cc: Harry Wentland 
>> Cc: Alex Deucher 
> 
> Uh, this looks like a pretty bad hack. Can't we fix amdgpu to only give us
> the right timestampe, once? With this I guess if you do a vblank query in
> between the wrong and the right vblank you'll get the bogus value. Not
> really great for userspace.
> -Daniel

I think we calculate the timestamp and send the vblank event both within 
the pageflip IRQ handler so calculating the right pageflip timestamp 
once could probably be done. I'm not sure if it's easier than proposing 
a later flip time with an API like this though.

The actual scanout time should be known from the page-flip handler so 
the semantics for VRR on/off remain the same. This is because the 
page-flip triggers entering the back porch if we're in the extended 
front porch.

But scanout time from vblank events for something like 
DRM_IOCTL_WAIT_VBLANK are going to be wrong in most cases and are only 
treated as estimates. If we're in the regular front porch then the 
timing to scanout is based on the fixed duration front porch for the 
current mode. If we're in the extended back porch then it's technically 
driver defined but the most reasonable guess is to assume that the front 
porch is going to end at any moment, so just return the length of the 
back porch for getting the scanout time.

Proposing the late timestamp shouldn't affect vblank event in the 
DRM_IOCTL_WAIT_VBLANK case and should only be used in the page-flip 
event case. I'm not sure if that's what's guaranteed to happen with this 
patch though. There doesn't seem to be any locking on either 
dev->vblank_time_lock or the vblank->seqlock so while it's likely to get 
the same vblank event back as the one just stored I don't think it's 
guaranteed.

Nicholas Kazlauskas

> 
>> ---
>>   drivers/gpu/drm/drm_vblank.c | 49 +++-
>>   include/drm/drm_vblank.h |  8 ++
>>   2 files changed, 56 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
>> index 98e091175921..4b3a4c38fabe 100644
>> --- a/drivers/gpu/drm/drm_vblank.c
>> +++ b/drivers/gpu/drm/drm_vblank.c
>> @@ -814,10 +814,21 @@ static void send_vblank_event(struct drm_device *dev,
>>  u64 seq, ktime_t now)
>>   {
>>  struct timespe

Re: [PATCH] drm/amd/display: Use vrr friendly pageflip throttling in DC.

2019-02-11 Thread Michel Dänzer
On 2019-02-09 7:52 a.m., Mario Kleiner wrote:
> In VRR mode, keep track of the vblank count of the last
> completed pageflip in amdgpu_crtc->last_flip_vblank, as
> recorded in the pageflip completion handler after each
> completed flip.
> 
> Use that count to prevent mmio programming a new pageflip
> within the same vblank in which the last pageflip completed,
> iow. to throttle pageflips to at most one flip per video
> frame, while at the same time allowing to request a flip
> not only before start of vblank, but also anywhere within
> vblank.
> 
> The old logic did the same, and made sense for regular fixed
> refresh rate flipping, but in vrr mode it prevents requesting
> a flip anywhere inside the possibly huge vblank, thereby
> reducing framerate in vrr mode instead of improving it, by
> delaying a slightly delayed flip requests up to a maximum
> vblank duration + 1 scanout duration. This would limit VRR
> usefulness to only help applications with a very high GPU
> demand, which can submit the flip request before start of
> vblank, but then have to wait long for fences to complete.
> 
> With this method a flip can be both requested and - after
> fences have completed - executed, ie. it doesn't matter if
> the request (amdgpu_dm_do_flip()) gets delayed until deep
> into the extended vblank due to cpu execution delays. This
> also allows clients which want to regulate framerate within
> the vrr range a much more fine-grained control of flip timing,
> a feature that might be useful for video playback, and is
> very useful for neuroscience/vision research applications.
> 
> In regular non-VRR mode, retain the old flip submission
> behavior. This to keep flip scheduling for fullscreen X11/GLX
> OpenGL clients intact, if they use the GLX_OML_sync_control
> extensions glXSwapBufferMscOML(, ..., target_msc,...) function
> with a specific target_msc target vblank count.
> 
> glXSwapBuffersMscOML() or DRI3/Present PresentPixmap() will
> not flip at the proper target_msc for a non-zero target_msc
> if VRR mode is active with this patch. They'd often flip one
> frame too early. However, this limitation should not matter
> much in VRR mode, as scheduling based on vblank counts is
> pretty futile/unusable under variable refresh duration
> anyway, so no real extra harm is done.
> 
> According to some testing already done with this patch by
> Nicholas on top of my tests, IGT tests didn't report any
> problems. If fixes stuttering and flickering when flipping
> at rates below the minimum vrr refresh rate.
> 
> Fixes: bb47de736661 ("drm/amdgpu: Set FreeSync state using drm VRR
> properties")
> Signed-off-by: Mario Kleiner 
> Cc: 
> Cc: Nicholas Kazlauskas 
> Cc: Harry Wentland 
> Cc: Alex Deucher 
> Cc: Michel Dänzer 

I wonder if this couldn't be solved in a simpler / cleaner way by making
use of the target MSC passed to the page_flip_target hook.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 3/7] of: address: Add parent pointer to the __of_translate_address args

2019-02-11 Thread Maxime Ripard
The __of_translate_address function is used to translate the device tree
addresses to physical addresses using the various ranges property to create
the offset.

However, it's shared between the CPU addresses (based on the ranges
property) and the DMA addresses (based on dma-ranges). Since we're going to
add support for a DMA parent node that is not the DT parent node, we need
to change the logic a bit to have an optional parent node that we should
use.

Signed-off-by: Maxime Ripard 
---
 drivers/of/address.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index 2270373b30ab..4c5dc21c71ca 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -569,10 +569,10 @@ static int of_translate_one(struct device_node *parent, 
struct of_bus *bus,
  * relative to that node.
  */
 static u64 __of_translate_address(struct device_node *dev,
+ struct device_node *parent,
  const __be32 *in_addr, const char *rprop,
  struct device_node **host)
 {
-   struct device_node *parent = NULL;
struct of_bus *bus, *pbus;
__be32 addr[OF_MAX_ADDR_CELLS];
int na, ns, pna, pns;
@@ -583,11 +583,14 @@ static u64 __of_translate_address(struct device_node *dev,
/* Increase refcount at current level */
of_node_get(dev);
 
-   *host = NULL;
-   /* Get parent & match bus type */
-   parent = of_get_parent(dev);
-   if (parent == NULL)
-   goto bail;
+   if (!parent) {
+   *host = NULL;
+   /* Get parent & match bus type */
+   parent = of_get_parent(dev);
+   if (parent == NULL)
+   goto bail;
+   }
+
bus = of_match_bus(parent);
 
/* Count address cells & copy address locally */
@@ -665,7 +668,7 @@ u64 of_translate_address(struct device_node *dev, const 
__be32 *in_addr)
struct device_node *host;
u64 ret;
 
-   ret = __of_translate_address(dev, in_addr, "ranges", &host);
+   ret = __of_translate_address(dev, NULL, in_addr, "ranges", &host);
if (host) {
of_node_put(host);
return OF_BAD_ADDR;
@@ -680,7 +683,7 @@ u64 of_translate_dma_address(struct device_node *dev, const 
__be32 *in_addr)
struct device_node *host;
u64 ret;
 
-   ret = __of_translate_address(dev, in_addr, "dma-ranges", &host);
+   ret = __of_translate_address(dev, NULL, in_addr, "dma-ranges", &host);
 
if (host) {
of_node_put(host);
@@ -736,7 +739,7 @@ static u64 of_translate_ioport(struct device_node *dev, 
const __be32 *in_addr,
unsigned long port;
struct device_node *host;
 
-   taddr = __of_translate_address(dev, in_addr, "ranges", &host);
+   taddr = __of_translate_address(dev, NULL, in_addr, "ranges", &host);
if (host) {
/* host-specific port access */
port = logic_pio_trans_hwaddr(&host->fwnode, taddr, size);
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 0/7] sunxi: Add DT representation for the MBUS controller

2019-02-11 Thread Maxime Ripard
Hi,

We've had for quite some time to hack around in our drivers to take into
account the fact that our DMA accesses are not done through the parent
node, but through another bus with a different mapping than the CPU for the
RAM (0 instead of 0x4000 for most SoCs).

After some discussion after the submission of a camera device suffering of
the same hacks, I've decided to put together a serie that introduce a
special interconnect name called "dma" that that allows to express the DMA
relationship between a master and its bus, even if they are not direct
parents in the DT.

Let me know what you think,
Maxime

Changes from v2:
  - Rewrite commit logs still mentionning dma-parent
  - Removed dma-parent-cells left over in the binding example
  - Removed dma-parent still being mentionned in comments

Changes from v1:
  - Change to use the now merged interconnect bindings
  - Move the DMA parent retrieval logic to its own function
  - Rebase on top of 5.0

Maxime Ripard (7):
  dt-bindings: interconnect: Add a dma interconnect name
  dt-bindings: bus: Add binding for the Allwinner MBUS controller
  of: address: Add parent pointer to the __of_translate_address args
  of: address: Add support for the parent DMA bus
  drm/sun4i: Rely on dma interconnect for our RAM offset
  clk: sunxi-ng: sun5i: Export the MBUS clock
  ARM: dts: sun5i: Add the MBUS controller

 Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt  | 36 +-
 Documentation/devicetree/bindings/interconnect/interconnect.txt |  3 +-
 arch/arm/boot/dts/sun5i.dtsi| 13 ++-
 drivers/clk/sunxi-ng/ccu-sun5i.h|  4 +-
 drivers/gpu/drm/sun4i/sun4i_backend.c   | 28 +++-
 drivers/of/address.c| 49 +--
 include/dt-bindings/clock/sun5i-ccu.h   |  2 +-
 7 files changed, 114 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt

base-commit: 87e87c7b0eeb3c9e08cdfe28fd540247bdf31ef5
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 5/7] drm/sun4i: Rely on dma interconnect for our RAM offset

2019-02-11 Thread Maxime Ripard
Now that we can express our DMA topology, rely on those property instead of
hardcoding an offset from the dma_addr_t which wasn't really great.

We still need to add some code to deal with the old DT that would lack that
property, but we move the offset to the DRM device dma_pfn_offset to be
able to rely on just the dma_addr_t associated to the GEM object.

Acked-by: Daniel Vetter 
Signed-off-by: Maxime Ripard 
---
 drivers/gpu/drm/sun4i/sun4i_backend.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c 
b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 9e9255ee59cd..1846a1b30fea 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -383,13 +383,6 @@ int sun4i_backend_update_layer_buffer(struct sun4i_backend 
*backend,
paddr = drm_fb_cma_get_gem_addr(fb, state, 0);
DRM_DEBUG_DRIVER("Setting buffer address to %pad\n", &paddr);
 
-   /*
-* backend DMA accesses DRAM directly, bypassing the system
-* bus. As such, the address range is different and the buffer
-* address needs to be corrected.
-*/
-   paddr -= PHYS_OFFSET;
-
if (fb->format->is_yuv)
return sun4i_backend_update_yuv_buffer(backend, fb, paddr);
 
@@ -835,6 +828,27 @@ static int sun4i_backend_bind(struct device *dev, struct 
device *master,
dev_set_drvdata(dev, backend);
spin_lock_init(&backend->frontend_lock);
 
+   if (of_find_property(dev->of_node, "interconnects", NULL)) {
+   /*
+* This assume we have the same DMA constraints for all our the
+* devices in our pipeline (all the backends, but also the
+* frontends). This sounds bad, but it has always been the case
+* for us, and DRM doesn't do per-device allocation either, so
+* we would need to fix DRM first...
+*/
+   ret = of_dma_configure(drm->dev, dev->of_node, true);
+   if (ret)
+   return ret;
+   } else {
+   /*
+* If we don't have the interconnect property, most likely
+* because of an old DT, we need to set the DMA offset by hand
+* on our device since the RAM mapping is at 0 for the DMA bus,
+* unlike the CPU.
+*/
+   drm->dev->dma_pfn_offset = PHYS_PFN_OFFSET;
+   }
+
backend->engine.node = dev->of_node;
backend->engine.ops = &sun4i_backend_engine_ops;
backend->engine.id = sun4i_backend_of_get_id(dev->of_node);
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PULL] topic/component-typed

2019-02-11 Thread Daniel Vetter
Hi all,

Here's the typed component topic branch.

drm-intel maintainers: Please pull, I need this for the mei hdcp work from Ram.

drm-misc maintainers: Please pull, there's a drm doc patch follow-up
that I want to stuff into drm-misc-next.

Greg: The drm side missed our feature cutoff, so will only land in 5.2.
Probably good if you pull this into drivers-core so it lands a bit
quicker. You&Arnd will also get a topic pull later on with the MEI bits
for char-misc tree, which needs to be based on top of this tree here.

Takashi: Since the drm side only lands in 5.2 might be good if you
pull this in too to avoid conflicts.

Cheers, Daniel

topic/component-typed-2019-02-11:
typed componented support + i915/snd-hda changes

This is needed by the new MEI-HDCP support in i915, so will need to go
in through drm and drivers-misc trees at least.

Cheers, Daniel

The following changes since commit 8834f5600cf3c8db365e18a3d5cac2c2780c81e5:

  Linux 5.0-rc5 (2019-02-03 13:48:04 -0800)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel
tags/topic/component-typed-2019-02-11

for you to fetch changes up to 8857c7d065e900a0b3829c97634c99501b606541:

  i915/snd_hdac: I915 subcomponent for the snd_hdac (2019-02-08 16:58:59 +0100)


typed componented support + i915/snd-hda changes

This is needed by the new MEI-HDCP support in i915, so will need to go
in through drm and drivers-misc trees at least.


Daniel Vetter (3):
  component: Add documentation
  components: multiple components for a device
  i915/snd_hdac: I915 subcomponent for the snd_hdac

 Documentation/driver-api/component.rst   |  17 +++
 Documentation/driver-api/device_link.rst |   3 +
 Documentation/driver-api/index.rst   |   1 +
 drivers/base/component.c | 206 +--
 drivers/gpu/drm/i915/intel_audio.c   |   4 +-
 include/drm/i915_component.h |   4 +
 include/linux/component.h|  76 
 include/sound/hda_component.h|   5 +-
 sound/hda/hdac_component.c   |   4 +-
 sound/hda/hdac_i915.c|   6 +-
 10 files changed, 308 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/driver-api/component.rst

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/3] drm: Add basic helper to allow precise pageflip timestamps in vrr.

2019-02-11 Thread Daniel Vetter
On Mon, Feb 11, 2019 at 4:01 PM Kazlauskas, Nicholas
 wrote:
>
> On 2/11/19 3:35 AM, Daniel Vetter wrote:
> > On Mon, Feb 11, 2019 at 04:22:24AM +0100, Mario Kleiner wrote:
> >> The pageflip completion timestamps transmitted to userspace
> >> via pageflip completion events are supposed to describe the
> >> time at which the first pixel of the new post-pageflip scanout
> >> buffer leaves the video output of the gpu. This time is
> >> identical to end of vblank, when active scanout starts.
> >>
> >> For a crtc in standard fixed refresh rate, the end of vblank
> >> is identical to the vblank timestamps calculated by
> >> drm_update_vblank_count() at each vblank interrupt, or each
> >> vblank dis-/enable. Therefore pageflip events just carry
> >> that vblank timestamp as their pageflip timestamp.
> >>
> >> For a crtc switched to variable refresh rate mode (vrr), the
> >> pageflip completion timestamps are identical to the vblank
> >> timestamps iff the pageflip was executed early in vblank,
> >> before the minimum vblank duration elapsed. In this case
> >> the time of display onset is identical to when the crtc
> >> is running in fixed refresh rate.
> >>
> >> However, if a pageflip completes later in the vblank, inside
> >> the "extended front porch" in vrr mode, then the vblank will
> >> terminate at a fixed (back porch) duration after flip, so
> >> the display onset time is delayed correspondingly. In this
> >> case the vblank timestamp computed at vblank irq time would
> >> be too early, and we need a way to calculate an estimated
> >> pageflip timestamp that will be later than the vblank timestamp.
> >>
> >> How a driver determines such a "late flip" timestamp is hw
> >> and driver specific, but this patch adds a new helper function
> >> that allows the driver to propose such an alternate "late flip"
> >> timestamp for use in pageflip events:
> >>
> >> drm_crtc_set_vrr_pageflip_timestamp(crtc, flip_timestamp);
> >>
> >> When sending out pageflip events, we now compare that proposed
> >> flip_timestamp against the vblank timestamp of the current
> >> vblank of flip completion and choose to send out the greater/
> >> later timestamp as flip completion timestamp.
> >>
> >> The most simple way for a kms driver to supply a suitable
> >> flip_timestamp in vrr mode would be to simply take a timestamp
> >> at start of the pageflip completion handler, e.g., pageflip
> >> irq handler: flip_timestamp = ktime_get(); and then set that
> >> as proposed "late" alternative timestamp via ...
> >> drm_crtc_set_vrr_pageflip_timestamp(crtc, flip_timestamp);
> >>
> >> More clever approaches could try to add some corrective offset
> >> for fixed back porch duration, or ideally use hardware features
> >> like hw timestamps to calculate the exact end time of vblank.
> >>
> >> Signed-off-by: Mario Kleiner 
> >> Cc: Nicholas Kazlauskas 
> >> Cc: Harry Wentland 
> >> Cc: Alex Deucher 
> >
> > Uh, this looks like a pretty bad hack. Can't we fix amdgpu to only give us
> > the right timestampe, once? With this I guess if you do a vblank query in
> > between the wrong and the right vblank you'll get the bogus value. Not
> > really great for userspace.
> > -Daniel
>
> I think we calculate the timestamp and send the vblank event both within
> the pageflip IRQ handler so calculating the right pageflip timestamp
> once could probably be done. I'm not sure if it's easier than proposing
> a later flip time with an API like this though.
>
> The actual scanout time should be known from the page-flip handler so
> the semantics for VRR on/off remain the same. This is because the
> page-flip triggers entering the back porch if we're in the extended
> front porch.
>
> But scanout time from vblank events for something like
> DRM_IOCTL_WAIT_VBLANK are going to be wrong in most cases and are only
> treated as estimates. If we're in the regular front porch then the
> timing to scanout is based on the fixed duration front porch for the
> current mode. If we're in the extended back porch then it's technically
> driver defined but the most reasonable guess is to assume that the front
> porch is going to end at any moment, so just return the length of the
> back porch for getting the scanout time.
>
> Proposing the late timestamp shouldn't affect vblank event in the
> DRM_IOCTL_WAIT_VBLANK case and should only be used in the page-flip
> event case. I'm not sure if that's what's guaranteed to happen with this
> patch though. There doesn't seem to be any locking on either
> dev->vblank_time_lock or the vblank->seqlock so while it's likely to get
> the same vblank event back as the one just stored I don't think it's
> guaranteed.

That's the inconsistency I mean to highlight - the timestamp for the
same frame as observed through flip complete and through the
wait_vblank ioctl can differ. Which they really shouldn't.

Now added complication is that amdgpu sends out vblank events really
early, which is used by userspace to do frontbuffer rendering in the
vblank

Re: [PATCH v3 8/8] drm/panel: Add Ronbo RB070D30 panel

2019-02-11 Thread Sam Ravnborg
Hi Maxime.

Looks good, but spotted two small issues.

> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 


> +#include 
> +#include 
These are no longer used as far as I can see.


> +
> + /* Reset */

/* Enable power and de-assert reset */?

> + msleep(20);
> + gpiod_set_value(ctx->gpios.power, 1);
> + msleep(20);
> + gpiod_set_value(ctx->gpios.reset, 1);
> + msleep(20);


Sam

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 202537] amdgpu/DC failed to reserve new abo buffer before flip

2019-02-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=202537

--- Comment #3 from Bernd Steinhauser (li...@bernd-steinhauser.de) ---
Sure, I can try to bisect it, but it would help if I could narrow the amount of
commits down, because usually the problem doesn't come right away, so it would
take some time to find out.
e.g. restricting to commits made in drivers/gpu/drm/amd would result in about 8
steps instead of 13.
It would really help if I could narrow it even down further, like a subset of
files?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 109587] "xf86drm: Add drmIsMaster()" commit breaks X server builds

2019-02-11 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=109587

Eero Tamminen  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Eero Tamminen  ---
Fixed by:
-
commit eba6609b7bee5a56fa5334992b1e6f3aef8d244a
Author: Eric Engestrom 
Date:   Fri Feb 8 14:46:07 2019 +

xf86drm: fix return type for drmIsMaster()

Xserver has struct members named `bool`, which means the last commit
breaks its build with errors like this:

  error: two or more data types in declaration specifiers
  Bool bool;
   ^

Fix this by making it return a 0/1 integer, with the same semantic as
the boolean it was before.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=109587
Fixes: 17dfe3ac93217b43f93b "xf86drm: Add drmIsMaster()"
Cc: Christopher James Halse Rogers 
Signed-off-by: Eric Engestrom 
Reviewed-by: Emil Velikov 
-

I hope somebody fixes also those X server xf86Opt.h & winconfig.h headers soon
as even some of X server code itself is using stdbool.h:
-
$ git grep stdbool.h
hw/xquartz/GL/capabilities.h:#include 
hw/xquartz/mach-startup/bundle-main.c:#include 
hw/xwin/winmultiwindowicons.c:#include 
test/damage/primitives.c:#include 
test/simple-xinit.c:#include 
-

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3 6/7] clk: sunxi-ng: sun5i: Export the MBUS clock

2019-02-11 Thread Maxime Ripard
The MBUS clock is used by the MBUS controller, so let's export it so that
we can use it in our DT node.

Reviewed-by: Rob Herring 
Signed-off-by: Maxime Ripard 
---
 drivers/clk/sunxi-ng/ccu-sun5i.h  | 4 
 include/dt-bindings/clock/sun5i-ccu.h | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun5i.h b/drivers/clk/sunxi-ng/ccu-sun5i.h
index 93a275fbd9a9..b66abd4fd0bf 100644
--- a/drivers/clk/sunxi-ng/ccu-sun5i.h
+++ b/drivers/clk/sunxi-ng/ccu-sun5i.h
@@ -60,10 +60,6 @@
 
 /* The rest of the module clocks are exported */
 
-#define CLK_MBUS   99
-
-/* And finally the IEP clock */
-
 #define CLK_NUMBER (CLK_IEP + 1)
 
 #endif /* _CCU_SUN5I_H_ */
diff --git a/include/dt-bindings/clock/sun5i-ccu.h 
b/include/dt-bindings/clock/sun5i-ccu.h
index 81f34d477aeb..2e6b9ddcc24e 100644
--- a/include/dt-bindings/clock/sun5i-ccu.h
+++ b/include/dt-bindings/clock/sun5i-ccu.h
@@ -100,7 +100,7 @@
 #define CLK_AVS96
 #define CLK_HDMI   97
 #define CLK_GPU98
-
+#define CLK_MBUS   99
 #define CLK_IEP100
 
 #endif /* _DT_BINDINGS_CLK_SUN5I_H_ */
-- 
git-series 0.9.1
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >