[PATCH v2 7/7] arm64: dts: exynos: configure TV path clocks for Ultra HD modes

2017-01-22 Thread Andrzej Hajda
Ultra HD modes requires clock ticking at increased rate.

Signed-off-by: Andrzej Hajda 
---
 arch/arm64/boot/dts/exynos/exynos5433.dtsi | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/exynos/exynos5433.dtsi 
b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
index f120d99..4d28e93 100644
--- a/arch/arm64/boot/dts/exynos/exynos5433.dtsi
+++ b/arch/arm64/boot/dts/exynos/exynos5433.dtsi
@@ -764,6 +764,17 @@
clock-names = "pclk", "aclk_decon", "aclk_smmu_decon0x",
  "aclk_xiu_decon0x", "pclk_smmu_decon0x",
  "sclk_decon_vclk", "sclk_decon_eclk";
+   assigned-clocks =
+   <_mif CLK_MOUT_SCLK_DECON_TV_ECLK_A>,
+   <_mif CLK_DIV_SCLK_DECON_TV_ECLK>,
+   <_disp CLK_MOUT_SCLK_DECON_TV_ECLK_USER>,
+   <_disp CLK_MOUT_SCLK_DECON_TV_ECLK>;
+   assigned-clock-parents =
+   <_mif CLK_MOUT_BUS_PLL_DIV2>,
+   <0>,
+   <_mif CLK_SCLK_DECON_TV_ECLK_DISP>,
+   <_disp CLK_MOUT_SCLK_DECON_TV_ECLK_USER>;
+   assigned-clock-rates = <0>, <4>;
samsung,disp-sysreg = <_disp>;
interrupt-names = "fifo", "vsync", "lcd_sys";
interrupts = ,
-- 
2.7.4

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


Re: [Intel-gfx] [RESEND PATCH v14 2/2] drm/i915: Put "cooked" vlank counters in frame CRC lines

2017-01-22 Thread Daniel Vetter
On Mon, Jan 16, 2017 at 10:12:36AM +0100, Tomeu Vizoso wrote:
> On 10 January 2017 at 17:31, Daniel Vetter  wrote:
> > On Tue, Jan 10, 2017 at 05:54:57PM +0200, Ville Syrjälä wrote:
> >> On Tue, Jan 10, 2017 at 02:43:05PM +0100, Tomeu Vizoso wrote:
> >> > Use drm_accurate_vblank_count so we have the full 32 bit to represent
> >> > the frame counter and userspace has a simpler way of knowing when the
> >> > counter wraps around.
> >> >
> >> > Signed-off-by: Tomeu Vizoso 
> >> > Reviewed-by: Emil Velikov 
> >> > Reviewed-by: Robert Foss 
> >> > ---
> >> >
> >> >  drivers/gpu/drm/i915/i915_irq.c | 6 +++---
> >> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >> >
> >> > diff --git a/drivers/gpu/drm/i915/i915_irq.c 
> >> > b/drivers/gpu/drm/i915/i915_irq.c
> >> > index b9beb5955dae..75fb1f66cc0c 100644
> >> > --- a/drivers/gpu/drm/i915/i915_irq.c
> >> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> >> > @@ -1557,7 +1557,6 @@ static void display_pipe_crc_irq_handler(struct 
> >> > drm_i915_private *dev_priv,
> >> > struct drm_driver *driver = dev_priv->drm.driver;
> >> > uint32_t crcs[5];
> >> > int head, tail;
> >> > -   u32 frame;
> >> >
> >> > spin_lock(_crc->lock);
> >> > if (pipe_crc->source) {
> >> > @@ -1612,8 +1611,9 @@ static void display_pipe_crc_irq_handler(struct 
> >> > drm_i915_private *dev_priv,
> >> > crcs[2] = crc2;
> >> > crcs[3] = crc3;
> >> > crcs[4] = crc4;
> >> > -   frame = driver->get_vblank_counter(_priv->drm, pipe);
> >> > -   drm_crtc_add_crc_entry(>base, true, frame, crcs);
> >> > +   drm_crtc_add_crc_entry(>base, true,
> >> > +  
> >> > drm_accurate_vblank_count(>base),
> >>
> >> My assumption would be that this gets called after the vblank irq
> >> handler, so using the _accurate version seems a bit overkill.
> >
> > Since we're at like v15 of this I figured I'll pull this in, and we can
> > polish this a bit more later. Tomeu, can you pls do that follow-up patch
> > and get Ville to review+merge it.
> 
> At least on the SKL and SNB I have here, the -sequence subtests in
> kms_pipe_crc_basic fail if I replace the call to
> drm_accurate_vblank_count with drm_crtc_vblank_count.
> 
> Any ideas on why this could be?

No idea at all, on a quick check things seem ordered correctly. Can you
pls paste how the test falls over?
-Daniel
-- 
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 v4 1/3] DRM: add help to get ELD speaker allocation

2017-01-22 Thread Daniel Vetter
On Thu, Jan 19, 2017 at 10:29:01AM +, Mark Brown wrote:
> On Wed, Jan 18, 2017 at 07:38:53AM +1100, Eric Anholt wrote:
> > Mark Brown  writes:
> 
> > > You don't appear to have sent this to any of the DRM maintainers - it
> > > does need review from them.
> 
> > It was sent to dri-devel.  That's us.  And the patch already has a r-b
> > From DRM on it.
> 
> I see.  For most subsystems you need to actually copy a human to make
> sure that things are seen - just the list isn't enough.  In terms of it
> being reviewed one of the problems with DRM not listing the reviwers in
> the MAINTAINERS file or anything is that it's very hard for anyone to
> tell if something is considered a good enough review or if it's just a
> review from someone who happens to contribute to DRM sometimes.

Jani is now officially listed as drm-misc maintainer in MAINTAINERS. We
also have official entries for other major areas (like bridge drivers or
similar). Where do you see a gap?

Note that before KS this was indeed not there, because of the committer
model hanging in the air a bit ...
-Daniel
-- 
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: [Intel-gfx] [PATCH 2/4] drm/i915: Fix POWER_DOMAIN_AUDIO refcounting.

2017-01-22 Thread Daniel Vetter
On Mon, Jan 16, 2017 at 12:00:46PM +0100, Maarten Lankhorst wrote:
> Op 11-01-17 om 17:13 schreef Daniel Vetter:
> > On Thu, Dec 15, 2016 at 03:29:43PM +0100, Maarten Lankhorst wrote:
> >> If the crtc was brought up with audio before the driver loads,
> >> then crtc_disable will remove a refcount to audio that doesn't exist
> >> before.
> >>
> >> Fortunately we already set power domains on readout, so we can just add
> >> the power domain handling to get_crtc_power_domains, which will update
> >> the power domains correctly in all cases.
> >>
> >> This was found when testing module reload on CI with the crtc enabled,
> >> which resulted in the following warn after module reload + modeset:
> >>
> >> [   24.197041] [ cut here ]
> >> [   24.197075] WARNING: CPU: 0 PID: 99 at 
> >> drivers/gpu/drm/i915/intel_runtime_pm.c:1790 
> >> intel_display_power_put+0x134/0x140 [i915]
> >> [   24.197076] Use count on domain AUDIO is already zero
> >> [   24.197098] CPU: 0 PID: 99 Comm: kworker/u8:2 Not tainted 
> >> 4.9.0-CI-Trybot_393+ #1
> >> [   24.197099] Hardware name:  /NUC6i5SYB, BIOS 
> >> SYSKLi35.86A.0042.2016.0409.1246 04/09/2016
> >> [   24.197102] Workqueue: events_unbound async_run_entry_fn
> >> [   24.197105]  c93c7688 81435b35 c93c76d8 
> >> 
> >> [   24.197107]  c93c76c8 8107e4d6 06fe5dc36f28 
> >> 88025dc30054
> >> [   24.197109]  88025dc36f28 88025dc3 88025dc3 
> >> 0015
> >> [   24.197110] Call Trace:
> >> [   24.197113]  [] dump_stack+0x67/0x92
> >> [   24.197116]  [] __warn+0xc6/0xe0
> >> [   24.197118]  [] warn_slowpath_fmt+0x4a/0x50
> >> [   24.197149]  [] intel_display_power_put+0x134/0x140 
> >> [i915]
> >> [   24.197187]  [] intel_disable_ddi+0x4d/0x80 [i915]
> >> [   24.197223]  [] 
> >> intel_encoders_disable.isra.74+0x7f/0x90 [i915]
> >> [   24.197257]  [] haswell_crtc_disable+0x55/0x170 [i915]
> >> [   24.197292]  [] intel_atomic_commit_tail+0x108/0xfd0 
> >> [i915]
> >> [   24.197295]  [] ? __lock_is_held+0x66/0x90
> >> [   24.197330]  [] intel_atomic_commit+0x429/0x560 [i915]
> >> [   24.197332]  [] 
> >> ?drm_atomic_add_affected_connectors+0x56/0xf0
> >> [   24.197334]  [] drm_atomic_commit+0x46/0x50
> >> [   24.197336]  [] restore_fbdev_mode+0x147/0x270
> >> [   24.197337]  [] 
> >> drm_fb_helper_restore_fbdev_mode_unlocked+0x2e/0x70
> >> [   24.197339]  [] drm_fb_helper_set_par+0x28/0x50
> >> [   24.197374]  [] intel_fbdev_set_par+0x13/0x70 [i915]
> >> [   24.197376]  [] fbcon_init+0x57a/0x600
> >> [   24.197379]  [] visual_init+0xd1/0x130
> >> [   24.197381]  [] do_bind_con_driver+0x1bc/0x3a0
> >> [   24.197384]  [] do_take_over_console+0x111/0x180
> >> [   24.197386]  [] do_fbcon_takeover+0x52/0xb0
> >> [   24.197387]  [] fbcon_event_notify+0x723/0x850
> >> [   24.197390]  [] 
> >> ?__blocking_notifier_call_chain+0x30/0x70
> >> [   24.197392]  [] notifier_call_chain+0x34/0xa0
> >> [   24.197394]  [] 
> >> __blocking_notifier_call_chain+0x48/0x70
> >> [   24.197397]  [] blocking_notifier_call_chain+0x11/0x20
> >> [   24.197398]  [] fb_notifier_call_chain+0x16/0x20
> >> [   24.197400]  [] register_framebuffer+0x24c/0x330
> >> [   24.197402]  [] 
> >> drm_fb_helper_initial_config+0x219/0x3c0
> >> [   24.197436]  [] intel_fbdev_initial_config+0x13/0x30 
> >> [i915]
> >> [   24.197438]  [] async_run_entry_fn+0x34/0x140
> >> [   24.197440]  [] process_one_work+0x1ec/0x6b0
> >> [   24.197442]  [] ? process_one_work+0x166/0x6b0
> >> [   24.197445]  [] worker_thread+0x49/0x490
> >> [   24.197447]  [] ? process_one_work+0x6b0/0x6b0
> >> [   24.197448]  [] kthread+0xeb/0x110
> >> [   24.197451]  [] ? kthread_park+0x60/0x60
> >> [   24.197453]  [] ret_from_fork+0x27/0x40
> >> [   24.197476] ---[ end trace bda64b683b8e8162 ]---
> >>
> >> Signed-off-by: Maarten Lankhorst 
> > Do we still need this with patch 3? I know it'd be nice if we could
> > faithfully restore any state we can also program, but then that's also a
> > lot of complexity ...
> >
> > Otoh patch 3 means we'll stop testing a lot of the fastboot code while
> > reloading the driver. But then that's been the thing in the past, and as
> > long as we still boot up we have at least some test coverage fo the
> > fastboot code (I'm mostly concerned about the plane/buffer readout code,
> > since that's not covered by the state checker).
> >
> > But for now I'd say let's just go with patch 3 only.
> We don't need this patch, but it makes the audio power domain tracked
> like all other power domains. It's a nice cleanup in general and I would
> like it even without the rest of the series. Could otherwise be merged
> through the intel tree through.

Hm, count me convinced.

Reviewed-by: Daniel Vetter 
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list

Re: [PATCH v2 0/7] Host1x IOMMU support + VIC support

2017-01-22 Thread Daniel Vetter
On Tue, Jan 17, 2017 at 06:22:36PM +0200, Mikko Perttunen wrote:
> On 12/14/2016 04:11 PM, Daniel Vetter wrote:
> > On Wed, Dec 14, 2016 at 03:32:16PM +0200, Mikko Perttunen wrote:
> > > On 14.12.2016 15:05, Daniel Vetter wrote:
> > > > On Wed, Dec 14, 2016 at 02:41:28PM +0200, Mikko Perttunen wrote:
> > > > > On 14.12.2016 14:30, Daniel Vetter wrote:
> > > > > > On Wed, Dec 14, 2016 at 01:16:10PM +0200, Mikko Perttunen wrote:
> > > > > > > This series adds IOMMU support to Host1x and TegraDRM
> > > > > > > and adds support for the VIC (Video Image Compositor)
> > > > > > > host1x client. The series is available as a git repository at
> > > > > > > git://github.com/cyndis/linux.git; branch vic-2.
> > > > > > > 
> > > > > > > A userspace test case for VIC can be found at
> > > > > > > https://github.com/cyndis/drm/tree/work/tegra.
> > > > > > > The testcase is in tests/tegra and is called submit_vic.
> > > > > > > The testcase/TRM include full headers and documentation
> > > > > > > to program the unit. The unit by itself, however, does not
> > > > > > > readily map to existing userspace library interfaces, so
> > > > > > > implementations for those are not provided.
> > > > > > 
> > > > > > Afaik libva has an entire pile of post-processing support. Pretty 
> > > > > > sure
> > > > > > other video transcode libraries have similar interfaces, so should 
> > > > > > all be
> > > > > > possible to implement this.
> > > > > 
> > > > > We don't have any actual video transcoding support though, so unless 
> > > > > it's
> > > > > possible to just implement a part of libva and defer the rest to some 
> > > > > CPU
> > > > > implementation, I don't see how this is useful. I suppose I could 
> > > > > implement
> > > > > a GStreamer plugin for colorspace conversion or resizing, since those 
> > > > > are
> > > > > very modular.
> > > > 
> > > > Hm, I guess the question then is, how did that get enabled?
> > > 
> > > What is "that"? I'm not exactly sure.
> > > 
> > > Our architecture is such that there's the VIC that handles colorspace
> > > conversion, rescaling, blitting and can do some 2d postprocessing effects 
> > > as
> > > well.
> > > 
> > > Then there's the separate NVDEC that is a video bitstream decoder. There's
> > > no support for that at the moment. I am working on the IP side of that.
> > > 
> > > The video processing pipeline is then such that NVDEC is fed the 
> > > bitstream;
> > > NVDEC outputs a YUV picture in a specific format; VIC takes that YUV 
> > > picture
> > > and converts/rescales it into the desired format. Or if we are encoding
> > > video, VIC takes your RGB image, converts it into a format that NVENC
> > > understands, and so on.
> > > 
> > > So with just VIC support, I could implement some simple 2D things. I don't
> > > know if anyone would want to specifically use the VIC for those since
> > > applications already have fast CPU algorithms. For the video pipeline 
> > > using
> > > VIC is nice since these units can synchronize work without CPU involvement
> > > and when you're already using NVDEC or NVENC it's barely any extra effort 
> > > to
> > > involve VIC as well. It can also be useful in power usage sensitive
> > > situations, but we aren't really fit for those situations with the 
> > > upstream
> > > kernel anyway :)
> > 
> > Ah I thought the nvdec was already enabled, since for i915 that's how we
> > went about things (we have a pretty much exactly matching split in the
> > various video related engines). But if that's not there yet then no
> > worries, all fine.
> > 
> > Since you do seem to plan to enable everything anyway, might be worth it
> > to go directly with something like libva or libvdpau or whatever the cool
> > thing is. libva is my recommendation since it works on non-X11 too afaik,
> > but I have 0 clue. And might be worth it to check out whether you can't do
> > a super-basic libva driver that only does the post processing stuff. With
> > libva you can import/export images, so it might be possible even ... And
> > directly doing the full video engine support instead of a one-off in
> > gstreamer sounds more sensible to me.
> > -Daniel
> > 
> 
> It took a while, but I now have a libva backend to go with this kernel
> driver: https://github.com/cyndis/vaapi-tegra-driver.
> 
> It is far from complete, but the libva putsurface testcase runs and its
> output looks correct when compared to the intel backend. Would this be
> suitable or should something more be implemented before merging the kernel
> driver?

Seems all reasonable to move ahead with this. Thanks for doing it.
-Daniel
-- 
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: Unix Device Memory Allocation project

2017-01-22 Thread Daniel Vetter
On Mon, Jan 16, 2017 at 11:54:14PM +0100, Marek Olšák wrote:
> Thanks for all the feedback. Things are much clearer now.
> 
> Yeah, we can use the BO modifiers for simple 2D images / planes if
> that's the general direction. I think we can even stuff the
> compression data buffer offset into those 64 bits, considering it's
> not very large (e.g. below 4GB and low bits are unused due to
> alignment).

For compression data the idea is to have an aux plane, with offset/stride.
At least that's what the plan for i915 is.
-Daniel

> 
> For OpenCL at least, we have to keep using the 256-bytes-large per-BO
> metadata to describe more complex allocations.
> 
> Marek
> 
> 
> On Wed, Jan 4, 2017 at 5:59 PM, Daniel Stone  wrote:
> > Hi Christian,
> >
> > On 4 January 2017 at 16:02, Christian König  wrote:
> >> Am 04.01.2017 um 16:47 schrieb Rob Clark:
> >>> If the position of the different parts of the buffer are somewhere
> >>> required to be a function of w/h/bpp/etc then I'm not sure if there is
> >>> a strong advantage to treating them as separate BOs.. although I
> >>> suppose it doesn't preclude it either.  As far as plumbing it through
> >>> mesa/st, it seems convenient to have a single buffer.  (We have kind
> >>> of a hack to deal w/ multi-planar yuv, but I'd rather not propagate
> >>> that.. but I've not thought through those details so much yet.)
> >>
> >> Well I don't want to ruin your day, but there are different requirements
> >> from different hardware.
> >>
> >> For example the UVD engine found in all AMD graphics cards since r600 must
> >> have both planes in a single BO because the memory controller can only
> >> handle a rather small offset between the planes.
> >
> > This is, to a large extent, also true of Intel.
> >
> >> On the other hand I know of embedded MPEG2/H264 decoders where the 
> >> different
> >> planes must be on different memory channels. In this case I can imagine
> >> you want one BO for each plane, because otherwise the device must stitch
> >> together one buffer object from two different memory regions (of course
> >> possible, but rather ugly).
> >
> > Not just embedded, but quite a few platforms where the ratio of
> > required to available memory bandwidth is ... somewhat different to
> > larger discrete systems. Striping allocations such that luma and
> > chroma live on different memory channels isn't uncommon.
> >
> > But I think this is all orthogonal. If you keep auxiliary planes in
> > separate BOs to metadata, you can still handle both cases. How to
> > place buffers is purely an _allocation_ concern, where single vs.
> > multiple BO is purely about addressing them. So your allocator API may
> > become a little more complex - something which only device-specific
> > userspace will ever address - whilst keeping a unified
> > addressing/handle system for the generic parts of userspace which
> > shouldn't have to care about whether the underlying hardware demands a
> > small offset or a completely separate allocation.
> >
> > Having API pegged to the single-underlying-BO concept has been a giant
> > pain for those who can't use single BOs. I don't see anything good
> > coming of the idea for cross-device/cross-vendor sharing either, since
> > it encodes yet more magic implicit detail into buffer sharing. Since
> > that detail ultimately has to be resolved _somewhere_, it's a problem
> > avoided rather than a problem solved.
> >
> > Cheers,
> > Daniel
> > ___
> > 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


[PULL] drm-misc-next

2017-01-22 Thread Daniel Vetter
Hi Dave,

Bunch of things collected by other people why I was enjoying lca. Group
maintainership ftw!

- cleanups for dw-hdmi bride driver (Laurent)
- updates for adv bridge driver (John Stultz) for nexus
- drm_crtc_from_index helper rollout (Shawn Guo)
- removing drm_framebuffer_unregister_private from drivers
- target_vblank (Andrey Grodzovsky)
- misc tiny stuff

Cheers, Daniel


The following changes since commit 282d0a35c8c42c3ac4dd86a7e408ed1b30db4897:

  Merge tag 'drm-misc-next-2017-01-09' of 
git://anongit.freedesktop.org/git/drm-misc into drm-next (2017-01-10 08:06:56 
+1000)

are available in the git repository at:

  git://anongit.freedesktop.org/git/drm-misc tags/drm-misc-next-2017-01-23

for you to fetch changes up to 6f897f51c4181397bf811d260eb7fef8d7ccd14f:

  drm: qxl: Open code teardown function for qxl (2017-01-19 15:33:30 -0200)


Andrey Grodzovsky (1):
  drm/atomic: Add target_vblank support in atomic helpers (v2)

Archit Taneja (3):
  dt-bindings: drm/bridge: adv7511: Add regulator bindings
  drm/bridge: adv7511: Initialize regulators
  drm/bridge: adv7511: Enable HPD interrupts to support hotplug and improve 
monitor detection

Arnd Bergmann (1):
  drm: add more MMU dependencies

Benjamin Gaignard (1):
  drm: fix MMU dependencies

Bhumika Goyal (1):
  drm/exynos: constify exynos_drm_crtc_ops structures

Chris Wilson (1):
  drm: Fix error handling in drm_mm eviction kselftest

Daniel Vetter (4):
  drm/msm: Stop using drm_framebuffer_unregister_private
  drm/omap: Stop using drm_framebuffer_unregister_private
  drm/cma-helper: Stop using drm_framebuffer_unregister_private
  drm/tegra: Stop using drm_framebuffer_unregister_private

Gabriel Krisman Bertazi (5):
  drm: Document drm_cache interface
  drm: Move drm_clflush prototypes to drm_cache header file
  drm: qxl: Let DRM core handle connector registering
  drm: qxl: Open code probing sequence for qxl
  drm: qxl: Open code teardown function for qxl

John Stultz (5):
  drm/bridge: adv7511: Use work_struct to defer hotplug handing to out of 
irq context
  drm/bridge: adv7511: Switch to using drm_kms_helper_hotplug_event()
  drm/bridge: adv7511: Rework adv7511_power_on/off() so they can be reused 
internally
  drm/bridge: adv7511: Reuse __adv7511_power_on/off() when probing EDID
  drm/bridge: adv7511: Re-write the i2c address before EDID probing

Kieran Bingham (2):
  drm: bridge: dw-hdmi: Remove unused function parameter
  drm: bridge: dw-hdmi: Remove PHY configuration resolution parameter

Laurent Pinchart (18):
  drm: bridge: dw-hdmi: Merge __hdmi_phy_i2c_write and hdmi_phy_i2c_write
  drm: bridge: dw-hdmi: Remove unneeded arguments to bind/unbind functions
  drm: bridge: dw-hdmi: Embed drm_bridge in struct dw_hdmi
  drm: bridge: dw-hdmi: Remove encoder field from struct dw_hdmi
  drm: bridge: dw-hdmi: Don't forward HPD events to DRM core before attach
  drm: bridge: dw-hdmi: Move IRQ and IO resource allocation to common code
  drm: bridge: dw-hdmi: Reorder functions to prepare for next commit
  drm: bridge: dw-hdmi: Create connector in the bridge attach operation
  drm: bridge: dw-hdmi: Implement DRM bridge registration
  drm: bridge: dw-hdmi: Rename CONF0 SPARECTRL bit to SVSRET
  drm: bridge: dw-hdmi: Reject invalid product IDs
  drm: bridge: dw-hdmi: Detect AHB audio DMA using correct register
  drm: bridge: dw-hdmi: Handle overflow workaround based on device version
  drm: bridge: dw-hdmi: Detect PHY type at runtime
  drm: bridge: dw-hdmi: Define and use macros for PHY register addresses
  drm: bridge: dw-hdmi: Fix the name of the PHY reset macros
  drm: bridge: dw-hdmi: Assert SVSRET before resetting the PHY
  dt-bindings: display: dw-hdmi: Clean up DT bindings documentation

Rainer Hochecker (1):
  drm: add fourcc codes for 16bit R and RG

Shawn Guo (6):
  drm: exynos: use crtc helper drm_crtc_from_index()
  drm: kirin: use crtc helper drm_crtc_from_index()
  drm: mediatek: use crtc helper drm_crtc_from_index()
  drm: nouveau: use crtc helper drm_crtc_from_index()
  drm: tegra: use crtc helper drm_crtc_from_index()
  drm: vc4: use crtc helper drm_crtc_from_index()

 .../bindings/display/bridge/adi,adv7511.txt|  12 +
 .../devicetree/bindings/display/bridge/dw_hdmi.txt |  85 ++--
 .../devicetree/bindings/display/imx/hdmi.txt   |  51 +--
 .../bindings/display/rockchip/dw_hdmi-rockchip.txt |  43 +-
 Documentation/gpu/drm-mm.rst   |   6 +
 drivers/gpu/drm/Kconfig|   4 +-
 drivers/gpu/drm/armada/Kconfig |   2 +-
 drivers/gpu/drm/bridge/adv7511/adv7511.h   |   6 +
 drivers/gpu/drm/bridge/adv7511/adv7511_drv.c   | 153 +--
 drivers/gpu/drm/bridge/dw-hdmi.c   | 438 

Re: [PATCH v2 22/26] drm/rockchip: vop: test for P{H,V}SYNC

2017-01-22 Thread Mark yao

On 2017年01月22日 00:31, John Keeping wrote:

When connected to the MIPI DSI output, we need to use N{H,V}SYNC for the
internal connection but these flags are meaningless for DSI panels.
Switch the test so that we do not set the P{H,V}SYNC bits unless the
mode requires it.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c7eba305c488..67aefc6d4e9a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -933,8 +933,8 @@ static void vop_crtc_enable(struct drm_crtc *crtc)
}
  
  	pin_pol = 0x8;

-   pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ? 0 : 1;
-   pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ? 0 : (1 << 1);
+   pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
+   pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) ? (1 << 1) : 0;


I'm confuse that why SYNC flags have N and P on drm, they are same meaning.

If no one configure display mode's flags, I don't know which one is 
correct, N or P? it's a problem.

Does anyone can answer it?

For this patch, it may effect non-sync flags mode on other connector's 
behavior,
but seems mostly display mode has sync flags except mipi dsi connector, 
I think feed mipi's requirement would be better.


So it's no problem  on my side.

Reviewed-by: Mark Yao 


VOP_CTRL_SET(vop, pin_pol, pin_pol);
  
  	switch (s->output_type) {



--
Mark Yao


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


Re: [PATCH v2 25/26] drm/rockchip: dw-mipi-dsi: add reset control

2017-01-22 Thread Chris Zhong

Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

In order to fully reset the state of the MIPI controller we must assert
this reset.

This is slightly more complicated than it could be in order to maintain
compatibility with device trees that do not specify the reset property.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 30 ++
  1 file changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 881bb0c62ca5..f780401e8b5e 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -13,6 +13,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -1121,6 +1122,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
of_match_device(dw_mipi_dsi_dt_ids, dev);
const struct dw_mipi_dsi_plat_data *pdata = of_id->data;
struct platform_device *pdev = to_platform_device(dev);
+   struct reset_control *apb_rst;
struct drm_device *drm = data;
struct dw_mipi_dsi *dsi;
struct resource *res;
@@ -1159,6 +1161,34 @@ static int dw_mipi_dsi_bind(struct device *dev, struct 
device *master,
return ret;
}
  
+	/*

+* Note that the reset was not defined in the initial device tree, so
+* we have to be prepared for it not being found.
+*/
+   apb_rst = devm_reset_control_get(dev, "apb");
+   if (IS_ERR(apb_rst)) {
+   if (PTR_ERR(apb_rst) == -ENODEV) {
+   apb_rst = NULL;
+   } else {
+   dev_err(dev, "Unable to get reset control: %d\n", ret);
+   return PTR_ERR(apb_rst);
+   }
+   }
+
+   if (apb_rst) {
+   ret = clk_prepare_enable(dsi->pclk);
+   if (ret) {
+   dev_err(dev, "%s: Failed to enable pclk\n", __func__);
+   return ret;
+   }
+
+   reset_control_assert(apb_rst);
+   usleep_range(10, 20);
+   reset_control_deassert(apb_rst);
+
+   clk_disable_unprepare(dsi->pclk);
+   }
+
ret = clk_prepare_enable(dsi->pllref_clk);
if (ret) {
dev_err(dev, "%s: Failed to enable pllref_clk\n", __func__);



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


Re: [PATCH v2 24/26] drm/rockchip: dw-mipi-dsi: support non-burst modes

2017-01-22 Thread Chris Zhong

Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 16 +---
  1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 2dafb17e31d2..881bb0c62ca5 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -82,6 +82,7 @@
  #define FRAME_BTA_ACK BIT(14)
  #define ENABLE_LOW_POWER  (0x3f << 8)
  #define ENABLE_LOW_POWER_MASK (0x3f << 8)
+#define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS0x1
  #define VID_MODE_TYPE_BURST_SYNC_PULSES   0x2
  #define VID_MODE_TYPE_MASK0x3
  
@@ -286,6 +287,7 @@ struct dw_mipi_dsi {

u32 format;
u16 input_div;
u16 feedback_div;
+   unsigned long mode_flags;
  
  	const struct dw_mipi_dsi_plat_data *pdata;

  };
@@ -548,15 +550,10 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host 
*host,
return -EINVAL;
}
  
-	if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) ||

-   !(device->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)) {
-   dev_err(dsi->dev, "device mode is unsupported\n");
-   return -EINVAL;
-   }
-
dsi->lanes = device->lanes;
dsi->channel = device->channel;
dsi->format = device->format;
+   dsi->mode_flags = device->mode_flags;
dsi->panel = of_drm_find_panel(device->dev.of_node);
if (dsi->panel)
return drm_panel_attach(dsi->panel, >connector);
@@ -713,7 +710,12 @@ static void dw_mipi_dsi_video_mode_config(struct 
dw_mipi_dsi *dsi)
  {
u32 val;
  
-	val = VID_MODE_TYPE_BURST_SYNC_PULSES | ENABLE_LOW_POWER;

+   val = ENABLE_LOW_POWER;
+
+   if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)
+   val |= VID_MODE_TYPE_BURST_SYNC_PULSES;
+   else if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE))
+   val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS;
  
  	dsi_write(dsi, DSI_VID_MODE_CFG, val);

  }



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


[Bug 99499] [REGRESSION, bisected] KMS hard-freezes around fbcon initialization on NV1A

2017-01-22 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99499

--- Comment #3 from Bruno  ---
In all cases nouveau is built as a module and loaded as follows to enable
debugging output (via netconsole) and make use of proper EDID (edid obtained
from monitor with another system on its HDMI connector as nouveau can't fetch
EDID on this NV1A system)

echo edid/viewsonic.edid > /sys/module/drm_kms_helper/parameters/edid_firmware
echo 0xf > /sys/module/drm/parameters/debug
dmesg -n 8
sync
sleep 1
modprobe nouveau

-- 
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 99499] [REGRESSION, bisected] KMS hard-freezes around fbcon initialization on NV1A

2017-01-22 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99499

--- Comment #2 from Bruno  ---
Created attachment 129103
  --> https://bugs.freedesktop.org/attachment.cgi?id=129103=edit
Freezing kernel log (@c85ee6ca79590cd51356bf24fb8936bc352138cf)

-- 
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 99499] [REGRESSION, bisected] KMS hard-freezes around fbcon initialization on NV1A

2017-01-22 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99499

--- Comment #1 from Bruno  ---
Created attachment 129102
  --> https://bugs.freedesktop.org/attachment.cgi?id=129102=edit
Successful kernel log (@13de7f462902d1a452d501cdb2d06ef02cabbfff)

-- 
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 99499] [REGRESSION, bisected] KMS hard-freezes around fbcon initialization on NV1A

2017-01-22 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99499

Bug ID: 99499
   Summary: [REGRESSION, bisected] KMS hard-freezes around fbcon
initialization on NV1A
   Product: DRI
   Version: unspecified
  Hardware: x86 (IA32)
OS: Linux (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/other
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: bonb...@sysophe.eu

Created attachment 129101
  --> https://bugs.freedesktop.org/attachment.cgi?id=129101=edit
Kernel config for regression area

Kernel 4.2 works fine while 4.3 and later fail by freezing hard.

On failure the last kernel message output via netconsole is:
  nouveau :02:00.0: DRM: allocated 1920x1080 fb: 0x4000, bo dd258000

Bisected as follow:
git bisect start 'drivers/gpu/drm/'
# bad: [34cdc49bf8ea385c1b3039be72cf91f98ddf8bbc] sd: Stop disks on reboot
git bisect bad 34cdc49bf8ea385c1b3039be72cf91f98ddf8bbc
# good: [64291f7db5bd8150a74ad2036f1037e6a0428df2] Linux 4.2
git bisect good 64291f7db5bd8150a74ad2036f1037e6a0428df2
# good: [0b2daf09cf3c9893872d68f0ce9a3f4b7e3ff06c] drm/amdgpu: add some common
definitions to amd_shared.h
git bisect good 0b2daf09cf3c9893872d68f0ce9a3f4b7e3ff06c
# good: [a1bfb29a33521efa6b1714589bf68cb4afebacb1] drm/nouveau/device: split
user device implementation out on its own
git bisect good a1bfb29a33521efa6b1714589bf68cb4afebacb1
# bad: [73bf1b7be7aab60d7c651402441dd0b0b4991098] Merge branch 'drm-next-4.3'
of git://people.freedesktop.org/~agd5f/linux into drm-next
git bisect bad 73bf1b7be7aab60d7c651402441dd0b0b4991098
# bad: [ae0a5b2dd2f54584d677701d989732b464b6d8c9] drm/nouveau/mc/gf100-: handle
second interrupt tree
git bisect bad ae0a5b2dd2f54584d677701d989732b464b6d8c9
# good: [0710cc31482ae3711367c42e61580126c50c8ec0] drm/nouveau/dma: convert
user classes to new-style nvkm_object
git bisect good 0710cc31482ae3711367c42e61580126c50c8ec0
# good: [8de65bd0901e2ee7a485a158bfe9e4631cc00644] drm/nouveau/devinit: run
devinit scripts right after preinit
git bisect good 8de65bd0901e2ee7a485a158bfe9e4631cc00644
# good: [e5b31ca63249f03e56529dcd4260b23196ce2c28] drm/nouveau/ce: convert to
new-style nvkm_engine
git bisect good e5b31ca63249f03e56529dcd4260b23196ce2c28
# bad: [97070f23c60869830039b216ff88230f54ef7107] drm/nouveau/pm: convert to
new-style nvkm_engine
git bisect bad 97070f23c60869830039b216ff88230f54ef7107
# good: [70aa8670e5229766f12c4b818a68aa61913df0b6] drm/nouveau/disp: convert to
new-style nvkm_engine
git bisect good 70aa8670e5229766f12c4b818a68aa61913df0b6
# bad: [c85ee6ca79590cd51356bf24fb8936bc352138cf] drm/nouveau/gr: convert to
new-style nvkm_engine
git bisect bad c85ee6ca79590cd51356bf24fb8936bc352138cf
# good: [13de7f462902d1a452d501cdb2d06ef02cabbfff] drm/nouveau/fifo: convert to
new-style nvkm_engine
git bisect good 13de7f462902d1a452d501cdb2d06ef02cabbfff
# first bad commit: [c85ee6ca79590cd51356bf24fb8936bc352138cf] drm/nouveau/gr:
convert to new-style nvkm_engine

-- 
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 10/10] drm/msm/dsi: Add PHY/PLL for 8x96

2017-01-22 Thread Archit Taneja



On 01/20/2017 01:47 AM, Stephen Boyd wrote:

On 01/07, Archit Taneja wrote:

+
+static struct clk *pll_14nm_postdiv_register(struct dsi_pll_14nm *pll_14nm,
+const char *name,
+const char *parent_name,
+unsigned long flags,
+u8 shift)
+{
+   struct dsi_pll_14nm_postdiv *pll_postdiv;
+   struct device *dev = _14nm->pdev->dev;
+   struct clk_init_data postdiv_init = {
+   .parent_names = (const char *[]) { parent_name },
+   .num_parents = 1,
+   .name = name,
+   .flags = flags,
+   .ops = _ops_dsi_pll_14nm_postdiv,
+   };
+
+   pll_postdiv = devm_kzalloc(dev, sizeof(*pll_postdiv), GFP_KERNEL);
+   if (!pll_postdiv)
+   return ERR_PTR(-ENOMEM);
+
+   pll_postdiv->pll = pll_14nm;
+   pll_postdiv->shift = shift;
+   /* both N1 and N2 postdividers are 4 bits wide */
+   pll_postdiv->width = 4;
+   /* range of each divider is from 1 to 15 */
+   pll_postdiv->flags = CLK_DIVIDER_ONE_BASED;
+   pll_postdiv->hw.init = _init;
+
+   return clk_register(dev, _postdiv->hw);


Can you use clk_hw_register() and the variants instead? Same for
the clk_provider calls in this patch.


Will do.

Thanks,
Archit


--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 99486] AMDGPU/Iceland Kernel 4.9.5 lock-up while playing ETS2

2017-01-22 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=99486

Michel Dänzer  changed:

   What|Removed |Added

Product|DRI |Mesa
 QA Contact||dri-devel@lists.freedesktop
   ||.org
  Component|DRM/AMDgpu  |Drivers/Gallium/radeonsi
Version|unspecified |13.0

-- 
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 19/26] drm/rockchip: dw-mipi-dsi: improve PLL configuration

2017-01-22 Thread Chris Zhong

Hi John

On 01/22/2017 12:31 AM, John Keeping wrote:

The multiplication ratio for the PLL is required to be even due to the
use of a "by 2 pre-scaler".  Currently we are likely to end up with an
odd multiplier even though there is an equivalent set of parameters with
an even multiplier.

For example, using the 324MHz bit rate with a reference clock of 24MHz
we end up with M = 27, N = 2 whereas the example in the PHY databook
gives M = 54, N = 4 for this bit rate and reference clock.

By walking down through the available multiplier instead of up we are
more likely to hit an even multiplier.  With the above example we do now
get M = 54, N = 4 as given by the databook.

While doing this, change the loop limits to encode the actual limits on
the divisor, which are:

40MHz >= (pllref / N) >= 5MHz


This formula is limit for N, but we still can not guarantee to get an 
even M.

Do you think we should do a check for M.
such as:
if (m % 2)
continue;
...
for (i = pllref / 5; i > (pllref / 40); i--) {
pre = pllref / i;
if ((tmp > (target_mbps % pre)) && (target_mbps / pre < 512)) {
tmp = target_mbps % pre;
n = i;
m = target_mbps / pre;
if (m % 2)
continue;
}
if (tmp == 0)
break;
}

if (m % 2)
m++;

dsi->lane_mbps = pllref / n * m;
dsi->input_div = n;
dsi->feedback_div = m;





Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 12432e41971b..f2320cf1366c 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -519,7 +519,7 @@ static int dw_mipi_dsi_get_lane_bps(struct dw_mipi_dsi *dsi,
pllref = DIV_ROUND_UP(clk_get_rate(dsi->pllref_clk), USEC_PER_SEC);
tmp = pllref;
  
-	for (i = 1; i < 6; i++) {

+   for (i = pllref / 5; i > (pllref / 40); i--) {
pre = pllref / i;
if ((tmp > (target_mbps % pre)) && (target_mbps / pre < 512)) {
tmp = target_mbps % pre;



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


Re: [PATCH 4/5] dt: add bindings for ZTE tvenc device

2017-01-22 Thread Shawn Guo
On Thu, Jan 19, 2017 at 06:11:17PM +0100, Lucas Stach wrote:
> Am Freitag, den 20.01.2017, 00:24 +0800 schrieb Shawn Guo:
> > From: Shawn Guo 
> > 
> > It adds bindings doc for ZTE VOU TV Encoder device.
> > 
> > Signed-off-by: Shawn Guo 
> > ---
> >  Documentation/devicetree/bindings/display/zte,vou.txt | 15 +++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/display/zte,vou.txt 
> > b/Documentation/devicetree/bindings/display/zte,vou.txt
> > index 740e5bd2e4f7..9c356284232b 100644
> > --- a/Documentation/devicetree/bindings/display/zte,vou.txt
> > +++ b/Documentation/devicetree/bindings/display/zte,vou.txt
> > @@ -49,6 +49,15 @@ Required properties:
> > "osc_clk"
> > "xclk"
> >  
> > +* TV Encoder output device
> > +
> > +Required properties:
> > + - compatible: should be "zte,zx296718-tvenc"
> > + - reg: Physical base address and length of the TVENC device IO region
> > + - zte,tvenc-power-control: the phandle to SYSCTRL block followed by two
> > +   integer cells.  The first cell is the offset of SYSCTRL register used
> > +   to control TV Encoder DAC power, and the second cell is the bit mask.
> 
> I don't know much about this platform, but shouldn't this be handled
> with a proper power domain driver, rather than bashing bits directly?

There is a power domain controller (PCU) on ZTE platform which controls
power for a list of hardware blocks [1].  TVENC DAC is not on the list.
Rather than PCU, it's controlled by SYSCTRL block which contains various
control bits for various aspects of the system.

Shawn

[1] 
https://git.kernel.org/cgit/linux/kernel/git/shawnguo/linux.git/commit/?h=zte/pm-domains=eea1d99b900fe19dce3042dac555c270221be147
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Warning at drivers/gpu/drm/drm_atomic_helper.c

2017-01-22 Thread Fabio Estevam
On Sun, Jan 22, 2017 at 12:26 PM, Fabio Estevam  wrote:
> On Sat, Jan 21, 2017 at 2:40 PM, Fabio Estevam  wrote:
>> Hi,
>>
>> Stopping kmscube application on mx6q through CTRL + C sometimes leads
>> to the following kernel warning:
>>
>> ^C[ 3939.785516] [ cut here ]
>> [ 3939.790313] WARNING: CPU: 1 PID: 67 at
>> drivers/gpu/drm/drm_atomic_helper.c:1032
>> drm_atomic_helper_wait_for_fences+0xe4/0x104
>> [ 3939.801626] Modules linked in:
>> [ 3939.804762] CPU: 1 PID: 67 Comm: kworker/1:1 Tainted: GW
>>4.9.4 #1
>
> Just tested 4.9.5 and the kernel warning is gone.

Actually 4.9.5 shows the same warning.

If I change .atomic_commit like in 782ea2a493ba90800 ("drm/imx: Switch
to drm_fb_cma_prepare_fb() helper") from 4.10-rc1

-   .atomic_commit = imx_drm_atomic_commit,
+   .atomic_commit = drm_atomic_helper_commit,

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


Re: [PATCH v2 20/26] drm/rockchip: dw-mipi-dsi: use specific poll helper

2017-01-22 Thread Chris Zhong


Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

As the documentation for readx_poll_timeout says, we want to use the
specialized macro for readl rather than using the generic version
directly.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index f2320cf1366c..3e19693ae59b 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -471,14 +471,14 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
 PHY_UNRSTZ | PHY_UNSHUTDOWNZ);
  
  
-	ret = readx_poll_timeout(readl, dsi->base + DSI_PHY_STATUS,

+   ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS,
 val, val & LOCK, 1000, PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi->dev, "failed to wait for phy lock state\n");
return ret;
}
  
-	ret = readx_poll_timeout(readl, dsi->base + DSI_PHY_STATUS,

+   ret = readl_poll_timeout(dsi->base + DSI_PHY_STATUS,
 val, val & STOP_STATE_CLK_LANE, 1000,
 PHY_STATUS_TIMEOUT_US);
if (ret < 0) {
@@ -594,7 +594,7 @@ static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi 
*dsi, u32 hdr_val)
int ret;
u32 val, mask;
  
-	ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,

+   ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
 val, !(val & GEN_CMD_FULL), 1000,
 CMD_PKT_STATUS_TIMEOUT_US);
if (ret < 0) {
@@ -605,7 +605,7 @@ static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi 
*dsi, u32 hdr_val)
dsi_write(dsi, DSI_GEN_HDR, hdr_val);
  
  	mask = GEN_CMD_EMPTY | GEN_PLD_W_EMPTY;

-   ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
+   ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
 val, (val & mask) == mask,
 1000, CMD_PKT_STATUS_TIMEOUT_US);
if (ret < 0) {
@@ -664,7 +664,7 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi 
*dsi,
len -= pld_data_bytes;
}
  
-		ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,

+   ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
 val, !(val & GEN_PLD_W_FULL), 1000,
 CMD_PKT_STATUS_TIMEOUT_US);
if (ret < 0) {



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


[git pull] drm fixes for 4.10-rc6 (just missed rc5 tagging :-)

2017-01-22 Thread Dave Airlie
Hi Linus,

Okay holidays and LCA kinda caught up with me, I thought I'd get some
of this dequeued last week, but Hobart was
sunny and warm and not all gloomy and rainy as usual.

This is a bit large, but not too much considering it's two weeks stuff
from AMD and Intel.

core: one locking fix that helps with dynamic suspend/resume races
i915: mostly GVT updates, GVT was a recent introduction so fixes for
it shouldn't cause any notable side effects.
amdgpu: a bunch of fixes for GPUs with a different memory controller
design that need different firmware.
exynos: decon regression fixes
msm: two regression fixes
etnaviv: a workaround for an mmu bug that needs a lot more work.
virtio: sparse fix, and a maintainers update

I've looked through most of this and I think it should be fine, but
let me know if it's scarily too much.

Dave.

The following changes since commit 6edd870bca30b3aa69370a99bcefc1e5f2b8b190:

  Merge branch 'drm-fixes-4.10' of
git://people.freedesktop.org/~agd5f/linux into drm-fixes (2017-01-09
09:47:19 +1000)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux tags/drm-fixes-for-v4.10-rc6

for you to fetch changes up to 932790109f62aa52bdb4bb62aa66653c0b51bc75:

  Merge tag 'drm-qemu-20170110' of git://git.kraxel.org/linux into
drm-fixes (2017-01-23 09:25:53 +1000)


drm fixes across the board


Alex Deucher (8):
  drm/radeon/si: load special ucode for certain MC configs
  drm/amdgpu/si: load special ucode for certain MC configs
  drm/amdgpu: drop oland quirks
  drm/amdgpu: drop the mclk quirk for hainan
  drm/radeon: drop oland quirks
  drm/radeon: drop the mclk quirk for hainan
  drm/radeon: add support for new hainan variants
  drm/amdgpu: add support for new hainan variants

Andrzej Hajda (5):
  drm/exynos/decon5433: update shadow registers iff there are active windows
  drm/exynos/decon5433: set STANDALONE_UPDATE_F also if planes are disabled
  drm/exynos/decon5433: do not disable video after reset
  drm/exynos/decon5433: fix CMU programming
  drm/exynos/decon5433: set STANDALONE_UPDATE_F on output enablement

Changbin Du (13):
  drm/i915/gvt: fix error handing of tlb_control emulation
  drm/i915/gvt: fix return value in mul_force_wake_write
  drm/i915/gvt: always use readq and writeq
  drm/i915/gvt: fix use after free for workload
  drm/i915/gvt: dec vgpu->running_workload_num after the workload
is really done
  drm/i915/gvt: introudce intel_vgpu_reset_resource() to reset
vgpu resource state
  drm/i915/gvt: introuduce intel_vgpu_reset_gtt() to reset gtt
  drm/i915/gvt: move cfg space inititation function to cfg_space.c
  drm/i915/gvt: introduce intel_vgpu_reset_cfg_space to reset
configuration space
  drm/i915/gvt: move mmio init/clean function to mmio.c
  drm/i915/gvt: introduce intel_vgpu_reset_mmio() to reset mmio space
  drm/i915/gvt: fix vGPU instance reuse issues by vGPU reset function
  drm/i915/gvt: rewrite gt reset handler using new function
intel_gvt_reset_vgpu_locked

Chris Wilson (2):
  drm/i915: Clear ret before unbinding in i915_gem_evict_something()
  drm/i915: Fix phys pwrite for struct_mutex-less operation

Daniel Vetter (1):
  drm/probe-helpers: Drop locking from poll_enable

Dave Airlie (8):
  Merge tag 'drm-misc-fixes-2017-01-09' of
git://anongit.freedesktop.org/git/drm-misc into drm-fixes
  Merge tag 'drm-intel-fixes-2017-01-19' of
git://anongit.freedesktop.org/git/drm-intel into drm-fixes
  Merge tag 'drm-misc-fixes-2017-01-13' of
git://anongit.freedesktop.org/git/drm-misc into drm-fixes
  Merge branch 'msm-fixes-4.10-rc4' of
git://people.freedesktop.org/~robclark/linux into drm-fixes
  Merge branch 'drm-fixes-4.10' of
git://people.freedesktop.org/~agd5f/linux into drm-fixes
  Merge branch 'exynos-drm-fixes' of
git://git.kernel.org/.../daeinki/drm-exynos into drm-fixes
  Merge branch 'drm-etnaviv-fixes' of
https://git.pengutronix.de/git/lst/linux into drm-fixes
  Merge tag 'drm-qemu-20170110' of git://git.kraxel.org/linux into drm-fixes

Flora Cui (1):
  drm/amdgpu: fix vm_fault_stop on gfx6

Francisco Jerez (1):
  drm/i915: Remove WaDisableLSQCROPERFforOCL KBL workaround.

Gerd Hoffmann (3):
  drm/virtio: fix framebuffer sparse warning
  drm: update MAINTAINERS for qemu drivers (bochs, cirrus, qxl, virtio-gpu)
  drm: flip cirrus driver status to "obsolete".

Jani Nikula (2):
  Merge tag 'gvt-fixes-2017-01-10' of
https://github.com/01org/gvt-linux into drm-intel-fixes
  Merge tag 'gvt-fixes-2017-01-16' of
https://github.com/01org/gvt-linux into drm-intel-fixes

Jike Song (5):
  drm/i915/gvt: init/destroy vgpu_idr properly
  drm/i915/gvt: destroy the allocated idr on vgpu creating failures
  drm/i915/gvt: cleanup 

[Bug 90481] Radeonsi driver, X crash while playing "Spec ops: the line"

2017-01-22 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90481

--- Comment #26 from theamazingja...@googlemail.com ---
Tested with recent mesa git, Ubuntu 16.04 Padoka PPA, kernel 4.8.11, no gpu
lockup with ~2 hour play. Probably fixed by same commit that fixed Arkham
Origins in Wine and XCOM:EU.

-- 
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 libdrm 2/3] amdgpu: don't mess with shared_handle if amdgpu_bo_import() fails

2017-01-22 Thread Emil Velikov
Do not close the handle if someone else has created it. Afaict there's
no change of ownership implied if the function fails. Thus the caller is
responsible to doing the right thing - trying again, closing the handle
and/or other.

Cc: amd-...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
---
Not 100% sure if it's the correct thing.
---
 amdgpu/amdgpu_bo.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index c9f31587..24fa8880 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -310,7 +310,6 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
size = lseek(shared_handle, 0, SEEK_END);
if (size == (off_t)-1) {
pthread_mutex_unlock(>bo_table_mutex);
-   amdgpu_close_kms_handle(dev, handle);
return -errno;
}
lseek(shared_handle, 0, SEEK_SET);
@@ -355,9 +354,6 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
bo = calloc(1, sizeof(struct amdgpu_bo));
if (!bo) {
pthread_mutex_unlock(>bo_table_mutex);
-   if (type == amdgpu_bo_handle_type_dma_buf_fd) {
-   amdgpu_close_kms_handle(dev, shared_handle);
-   }
return -ENOMEM;
}
 
-- 
2.11.0

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


[PATCH libdrm 3/3] amdgpu: rework and remove amdgpu_get_auth()

2017-01-22 Thread Emil Velikov
All one needs is to establish if dev->fd is the flink (primary/card)
node, rather than use DRM_IOCTL_GET_CLIENT to query the auth status.

The latter is [somewhat] deprecated and incorrect. We need to know [and
store] the primary node FD, since we're going to use it [at a later
stage] for buffer import/export sharing.

Cc: amd-...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
---
Again not 100% sure but things look quite fishy as-is... The
conditionals might be off.

Note: original code [and this one] do not consider if flink_fd is
already set, thus as we dup we'll leak it.
---
 amdgpu/amdgpu_device.c | 43 ++-
 1 file changed, 2 insertions(+), 41 deletions(-)

diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c
index f4ede031..6f04d936 100644
--- a/amdgpu/amdgpu_device.c
+++ b/amdgpu/amdgpu_device.c
@@ -101,34 +101,6 @@ static int fd_compare(void *key1, void *key2)
return result;
 }
 
-/**
-* Get the authenticated form fd,
-*
-* \param   fd   - \c [in]  File descriptor for AMD GPU device
-* \param   auth - \c [out] Pointer to output the fd is authenticated or not
-*  A render node fd, output auth = 0
-*  A legacy fd, get the authenticated for 
compatibility root
-*
-* \return   0 on success\n
-*  >0 - AMD specific error code\n
-*  <0 - Negative POSIX Error code
-*/
-static int amdgpu_get_auth(int fd, int *auth)
-{
-   int r = 0;
-   drm_client_t client = {};
-
-   if (drmGetNodeTypeFromFd(fd) == DRM_NODE_RENDER)
-   *auth = 0;
-   else {
-   client.idx = 0;
-   r = drmIoctl(fd, DRM_IOCTL_GET_CLIENT, );
-   if (!r)
-   *auth = client.auth;
-   }
-   return r;
-}
-
 static void amdgpu_device_free_internal(amdgpu_device_handle dev)
 {
amdgpu_vamgr_deinit(dev->vamgr);
@@ -175,8 +147,6 @@ int amdgpu_device_initialize(int fd,
struct amdgpu_device *dev;
drmVersionPtr version;
int r;
-   int flag_auth = 0;
-   int flag_authexist=0;
uint32_t accel_working = 0;
uint64_t start, max;
 
@@ -185,19 +155,10 @@ int amdgpu_device_initialize(int fd,
pthread_mutex_lock(_mutex);
if (!fd_tab)
fd_tab = util_hash_table_create(fd_hash, fd_compare);
-   r = amdgpu_get_auth(fd, _auth);
-   if (r) {
-   pthread_mutex_unlock(_mutex);
-   return r;
-   }
dev = util_hash_table_get(fd_tab, UINT_TO_PTR(fd));
if (dev) {
-   r = amdgpu_get_auth(dev->fd, _authexist);
-   if (r) {
-   pthread_mutex_unlock(_mutex);
-   return r;
-   }
-   if ((flag_auth) && (!flag_authexist)) {
+   if (drmGetNodeTypeFromFd(fd) == DRM_NODE_RENDER &&
+   drmGetNodeTypeFromFd(dev->fd) == DRM_NODE_PRIMARY) {
dev->flink_fd = dup(fd);
}
*major_version = dev->major_version;
-- 
2.11.0

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


[PATCH libdrm 1/3] amdgpu: add missing unlock on drmPrimeFDToHandle() failure

2017-01-22 Thread Emil Velikov
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
---
 amdgpu/amdgpu_bo.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index d30fd1e7..c9f31587 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -302,6 +302,7 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
/* Get a KMS handle. */
r = drmPrimeFDToHandle(dev->fd, shared_handle, );
if (r) {
+   pthread_mutex_unlock(>bo_table_mutex);
return r;
}
 
-- 
2.11.0

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


[PATCH libdrm 5/5] android: silence ~550 warnings

2017-01-22 Thread Emil Velikov
Analogous to the autoconf build add the following to the build

   -Wno-unused-parameter
   -Wno-missing-field-initializers

Cc: Chih-Wei Huang 
Cc: Rob Herring 
Signed-off-by: Emil Velikov 
---
According to Rob's jenkins build there's still some 26 libdrm warnings
libdrm most of which duplicates - can we fix those properly ?

There might be a lot more since it builds only libdrm and the freedreno,
intel and radeon DSO.

Rob, with this patch/series the total warnings reported drops by half ;-)
---
 Android.common.mk | 4 
 1 file changed, 4 insertions(+)

diff --git a/Android.common.mk b/Android.common.mk
index 71f14ec3..f57b8d37 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -3,6 +3,10 @@ LOCAL_CFLAGS += \
-DHAVE_VISIBILITY=1 \
-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
 
+LOCAL_CFLAGS += \
+   -Wno-unused-parameter \
+   -Wno-missing-field-initializers
+
 # Quiet down the build system and remove any .h files from the sources
 LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
 LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH)
-- 
2.11.0

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


[PATCH libdrm 3/5] android: add HAVE_VISIBILITY to Android.common.mk

2017-01-22 Thread Emil Velikov
Currently only libdrm.so properly annotates its internal/private
symbols. By setting the macro every binary produced will be in the same
boat. This should give is smaller and more secure files

Cc: Chih-Wei Huang 
Cc: Rob Herring 
Signed-off-by: Emil Velikov 
---
 Android.common.mk | 1 +
 Android.mk| 6 --
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index c6ab8f50..ffe92198 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -1,4 +1,5 @@
 LOCAL_CFLAGS += \
+   -DHAVE_VISIBILITY=1 \
-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
 
 # Quiet down the build system and remove any .h files from the sources
diff --git a/Android.mk b/Android.mk
index ec6d5322..5209059e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -41,9 +41,6 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
 LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/drm
 
-LOCAL_CFLAGS := \
-   -DHAVE_VISIBILITY=1
-
 include $(LIBDRM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
@@ -58,9 +55,6 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
 LOCAL_C_INCLUDES := \
 $(LOCAL_PATH)/include/drm
 
-LOCAL_CFLAGS := \
-   -DHAVE_VISIBILITY=1
-
 include $(LIBDRM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
 
-- 
2.11.0

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


[PATCH libdrm 4/5] android: add note about command line defines and config.h

2017-01-22 Thread Emil Velikov
Cc: Chih-Wei Huang 
Cc: Rob Herring 
Signed-off-by: Emil Velikov 
---
 Android.common.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Android.common.mk b/Android.common.mk
index ffe92198..71f14ec3 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -1,3 +1,4 @@
+# XXX: Consider moving these to config.h analogous to autoconf.
 LOCAL_CFLAGS += \
-DHAVE_VISIBILITY=1 \
-DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
-- 
2.11.0

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


[PATCH libdrm 1/5] android: remove LOCAL_MODULE_TAGS := optional tag

2017-01-22 Thread Emil Velikov
Seems to be the default option. Fleshed out from a larger commit in the
AOSP repo/fork.

Cc: Dan Willemsen 
Cc: Chih-Wei Huang 
Cc: Rob Herring 
Signed-off-by: Emil Velikov 
---
Dan a couple of humble requests:
 - can we get a reference when (Android vX) this is the default ?
 - there's a bunch of nice fixes in-tree - can you (anyone in the team)
cleanup the gerrit/aosp tags, rebase and sent them over - see upstream
autogen.sh
* build fixes leanups
* use mmap64 over __mmap2 (with the fix squashed).
please state since when mmap64 is available
* remove libpciaccess dep (with the printf warning fixed)
* tegra offset fix
* others ?

With the above sorted, it would be a lot easier to rebase the repo when
working on the next Android. Note that the atomic code used here is not
the upstream one - I'd suggest switching over ;-)

Thanks !
---
 Android.mk| 2 --
 amdgpu/Android.mk | 1 -
 etnaviv/Android.mk| 1 -
 freedreno/Android.mk  | 1 -
 intel/Android.mk  | 1 -
 libkms/Android.mk | 1 -
 nouveau/Android.mk| 1 -
 radeon/Android.mk | 1 -
 tests/util/Android.mk | 1 -
 9 files changed, 10 deletions(-)

diff --git a/Android.mk b/Android.mk
index 2aa2bc96..6ecc4e1c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -30,7 +30,6 @@ include $(LOCAL_PATH)/Makefile.sources
 #static library for the device (recovery)
 include $(CLEAR_VARS)
 LOCAL_MODULE := libdrm
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FILES))
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
@@ -48,7 +47,6 @@ include $(BUILD_STATIC_LIBRARY)
 # Shared library for the device
 include $(CLEAR_VARS)
 LOCAL_MODULE := libdrm
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FILES))
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
diff --git a/amdgpu/Android.mk b/amdgpu/Android.mk
index 57c53a79..332d9570 100644
--- a/amdgpu/Android.mk
+++ b/amdgpu/Android.mk
@@ -5,7 +5,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_amdgpu
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
diff --git a/etnaviv/Android.mk b/etnaviv/Android.mk
index a3a22959..a70eeac0 100644
--- a/etnaviv/Android.mk
+++ b/etnaviv/Android.mk
@@ -5,7 +5,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_etnaviv
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
diff --git a/freedreno/Android.mk b/freedreno/Android.mk
index fba48f2f..d7e80e12 100644
--- a/freedreno/Android.mk
+++ b/freedreno/Android.mk
@@ -5,7 +5,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_freedreno
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
diff --git a/intel/Android.mk b/intel/Android.mk
index 838a93b3..e7ec5a57 100644
--- a/intel/Android.mk
+++ b/intel/Android.mk
@@ -28,7 +28,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_intel
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_INTEL_FILES))
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
diff --git a/libkms/Android.mk b/libkms/Android.mk
index cf0e9bb0..0259ffbb 100644
--- a/libkms/Android.mk
+++ b/libkms/Android.mk
@@ -45,7 +45,6 @@ LOCAL_SRC_FILES += $(LIBKMS_RADEON_FILES)
 endif
 
 LOCAL_MODULE := libkms
-LOCAL_MODULE_TAGS := optional
 LOCAL_SHARED_LIBRARIES := libdrm
 
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
diff --git a/nouveau/Android.mk b/nouveau/Android.mk
index b67d30fc..451f9a73 100644
--- a/nouveau/Android.mk
+++ b/nouveau/Android.mk
@@ -5,7 +5,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_nouveau
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
diff --git a/radeon/Android.mk b/radeon/Android.mk
index e7044435..57cbc92a 100644
--- a/radeon/Android.mk
+++ b/radeon/Android.mk
@@ -5,7 +5,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_radeon
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
diff --git a/tests/util/Android.mk b/tests/util/Android.mk
index 1bd82aec..c9d087e3 100644
--- a/tests/util/Android.mk
+++ b/tests/util/Android.mk
@@ -27,7 +27,6 @@ include $(CLEAR_VARS)
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_util
-LOCAL_MODULE_TAGS := optional
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
-- 
2.11.0

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


[PATCH libdrm 2/5] android: introduce Android.common.mk to reduce boilerplate

2017-01-22 Thread Emil Velikov
... across the makefiles. Currently this isn't much but that will change
shortly.

As an added bonus this fixes all present and future cases where we've
forgotten to strip out the headers from LOCAL_SRC_FILES.

In a couple of cases (the tests) we start setting
LOCAL_EXPORT_C_INCLUDE_DIRS, which shouldn't be an issue.

Cc: Chih-Wei Huang 
Cc: Rob Herring 
Signed-off-by: Emil Velikov 
---
 Android.common.mk |  6 ++
 Android.mk| 17 ++---
 amdgpu/Android.mk |  7 ++-
 etnaviv/Android.mk|  7 ++-
 freedreno/Android.mk  |  7 ++-
 intel/Android.mk  |  7 ++-
 libkms/Android.mk |  5 ++---
 nouveau/Android.mk|  7 ++-
 radeon/Android.mk |  7 ++-
 tests/modetest/Android.mk |  3 ++-
 tests/proptest/Android.mk |  3 ++-
 tests/util/Android.mk |  6 ++
 12 files changed, 36 insertions(+), 46 deletions(-)
 create mode 100644 Android.common.mk

diff --git a/Android.common.mk b/Android.common.mk
new file mode 100644
index ..c6ab8f50
--- /dev/null
+++ b/Android.common.mk
@@ -0,0 +1,6 @@
+LOCAL_CFLAGS += \
+   -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+
+# Quiet down the build system and remove any .h files from the sources
+LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
+LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH)
diff --git a/Android.mk b/Android.mk
index 6ecc4e1c..ec6d5322 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,6 +21,8 @@
 # IN THE SOFTWARE.
 #
 
+LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk
+
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
@@ -31,7 +33,7 @@ include $(LOCAL_PATH)/Makefile.sources
 include $(CLEAR_VARS)
 LOCAL_MODULE := libdrm
 
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FILES))
+LOCAL_SRC_FILES := $(LIBDRM_FILES)
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/include/drm
@@ -40,25 +42,26 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/drm
 
 LOCAL_CFLAGS := \
-   -DHAVE_VISIBILITY=1 \
-   -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+   -DHAVE_VISIBILITY=1
+
+include $(LIBDRM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
 
 # Shared library for the device
 include $(CLEAR_VARS)
 LOCAL_MODULE := libdrm
 
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FILES))
+LOCAL_SRC_FILES := $(LIBDRM_FILES)
 LOCAL_EXPORT_C_INCLUDE_DIRS := \
-$(LOCAL_PATH) \
 $(LOCAL_PATH)/include/drm
 
 LOCAL_C_INCLUDES := \
 $(LOCAL_PATH)/include/drm
 
 LOCAL_CFLAGS := \
--DHAVE_VISIBILITY=1 \
--DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+   -DHAVE_VISIBILITY=1
+
+include $(LIBDRM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
 
 include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/amdgpu/Android.mk b/amdgpu/Android.mk
index 332d9570..bf0611ba 100644
--- a/amdgpu/Android.mk
+++ b/amdgpu/Android.mk
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_amdgpu
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_AMDGPU_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
-   -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_AMDGPU_FILES)
 
+include $(LIBDRM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
diff --git a/etnaviv/Android.mk b/etnaviv/Android.mk
index a70eeac0..390f9a98 100644
--- a/etnaviv/Android.mk
+++ b/etnaviv/Android.mk
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_etnaviv
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_ETNAVIV_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
-   -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_ETNAVIV_FILES)
 
+include $(LIBDRM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
diff --git a/freedreno/Android.mk b/freedreno/Android.mk
index d7e80e12..2b582aed 100644
--- a/freedreno/Android.mk
+++ b/freedreno/Android.mk
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_freedreno
 
 LOCAL_SHARED_LIBRARIES := libdrm
 
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FREEDRENO_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
-   -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_FREEDRENO_FILES)
 
+include $(LIBDRM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
diff --git a/intel/Android.mk b/intel/Android.mk
index e7ec5a57..5407ff3e 100644
--- a/intel/Android.mk
+++ b/intel/Android.mk
@@ -29,14 +29,11 @@ include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_MODULE := libdrm_intel
 
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_INTEL_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
-   -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES)
 
 LOCAL_SHARED_LIBRARIES := \
libdrm \
libpciaccess
 
+include $(LIBDRM_COMMON_MK)
 include $(BUILD_SHARED_LIBRARY)
diff --git a/libkms/Android.mk b/libkms/Android.mk
index 0259ffbb..0be72054 100644
--- a/libkms/Android.mk
+++ 

[PATCH 8/9] dt-bindings: Add Multi-Inno MI0283QT binding

2017-01-22 Thread Noralf Trønnes
Add device-tree binding documentation for the MI0283QT display panel.

Signed-off-by: Noralf Trønnes 
---

Datasheet: https://cdn-shop.adafruit.com/datasheets/MI0283QT-11+V1.1.PDF


 .../bindings/display/multi-inno,mi0283qt.txt   | 27 ++
 1 file changed, 27 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt

diff --git a/Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt 
b/Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
new file mode 100644
index 000..eed48c3
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
@@ -0,0 +1,27 @@
+Multi-Inno MI0283QT display panel
+
+Required properties:
+- compatible:  "multi-inno,mi0283qt".
+
+The node for this driver must be a child node of a SPI controller, hence
+all mandatory properties described in ../spi/spi-bus.txt must be specified.
+
+Optional properties:
+- dc-gpios:D/C pin. The presence/absence of this GPIO determines
+   the panel interface mode (IM[3:0] pins):
+   - present: IM=x110 4-wire 8-bit data serial interface
+   - absent:  IM=x101 3-wire 9-bit data serial interface
+- reset-gpios: Reset pin
+- power-supply:A regulator node for the supply voltage.
+- backlight:   phandle of the backlight device attached to the panel
+- rotation:panel rotation in degrees counter clockwise (0,90,180,270)
+
+Example:
+   mi0283qt@0{
+   compatible = "multi-inno,mi0283qt";
+   reg = <0>;
+   spi-max-frequency = <3200>;
+   rotation = <90>;
+   dc-gpios = < 25 0>;
+   backlight = <>;
+   };
--
2.10.2

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


[PATCH 1/9] drm/fb-cma-helper: Add drm_fbdev_cma_set_suspend_unlocked()

2017-01-22 Thread Noralf Trønnes
Add a CMA version of drm_fb_helper_set_suspend_unlocked().

Cc: laurent.pinch...@ideasonboard.com
Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 18 ++
 include/drm/drm_fb_cma_helper.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index 4364abf..0ef8b28 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -622,3 +622,21 @@ void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma 
*fbdev_cma, int state)
drm_fb_helper_set_suspend(_cma->fb_helper, state);
 }
 EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
+
+/**
+ * drm_fbdev_cma_set_suspend_unlocked - wrapper around
+ *  drm_fb_helper_set_suspend_unlocked
+ * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
+ * @state: desired state, zero to resume, non-zero to suspend
+ *
+ * Calls drm_fb_helper_set_suspend, which is a wrapper around
+ * fb_set_suspend implemented by fbdev core.
+ */
+void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
+   int state)
+{
+   if (fbdev_cma)
+   drm_fb_helper_set_suspend_unlocked(_cma->fb_helper,
+  state);
+}
+EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 9f4e34e..8dd6e55 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -26,6 +26,8 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
 void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
 void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
 void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
+void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
+   int state);
 
 void drm_fb_cma_destroy(struct drm_framebuffer *fb);
 int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
-- 
2.10.2

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


[PATCH 4/9] drm: Add DRM support for tiny LCD displays

2017-01-22 Thread Noralf Trønnes
tinydrm provides helpers for very simple displays that can use
CMA backed framebuffers and need flushing on changes.

Signed-off-by: Noralf Trønnes 
---
 Documentation/gpu/drm-kms-helpers.rst   |  15 ++
 MAINTAINERS |   7 +
 drivers/gpu/drm/Kconfig |   2 +
 drivers/gpu/drm/Makefile|   1 +
 drivers/gpu/drm/tinydrm/Kconfig |   8 +
 drivers/gpu/drm/tinydrm/Makefile|   1 +
 drivers/gpu/drm/tinydrm/core/Makefile   |   3 +
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c | 374 
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c | 244 ++
 include/drm/tinydrm/tinydrm.h   | 115 +
 10 files changed, 770 insertions(+)
 create mode 100644 drivers/gpu/drm/tinydrm/Kconfig
 create mode 100644 drivers/gpu/drm/tinydrm/Makefile
 create mode 100644 drivers/gpu/drm/tinydrm/core/Makefile
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-core.c
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
 create mode 100644 include/drm/tinydrm/tinydrm.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index 03040aa..a86bd7f 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -272,3 +272,18 @@ Auxiliary Modeset Helpers
 
 .. kernel-doc:: drivers/gpu/drm/drm_modeset_helper.c
:export:
+
+tinydrm Helper Reference
+
+
+.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-core.c
+   :doc: overview
+
+.. kernel-doc:: include/drm/tinydrm/tinydrm.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-core.c
+   :export:
+
+.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+   :export:
diff --git a/MAINTAINERS b/MAINTAINERS
index 741f35f..817e0fe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4365,6 +4365,13 @@ DRM DRIVER FOR TDFX VIDEO CARDS
 S: Orphan / Obsolete
 F: drivers/gpu/drm/tdfx/
 
+DRM DRIVERS FOR TINY DISPLAYS
+M: Noralf Trønnes 
+W: https://github.com/notro/tinydrm/wiki
+S: Maintained
+F: drivers/gpu/drm/tinydrm/
+F: include/drm/tinydrm/
+
 DRM DRIVER FOR USB DISPLAYLINK VIDEO ADAPTERS
 M: Dave Airlie 
 S: Odd Fixes
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 90bc65d..88e01e08e 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -263,6 +263,8 @@ source "drivers/gpu/drm/mxsfb/Kconfig"
 
 source "drivers/gpu/drm/meson/Kconfig"
 
+source "drivers/gpu/drm/tinydrm/Kconfig"
+
 # Keep legacy drivers last
 
 menuconfig DRM_LEGACY
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 92de399..3ee9579 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -94,3 +94,4 @@ obj-$(CONFIG_DRM_ARCPGU)+= arc/
 obj-y  += hisilicon/
 obj-$(CONFIG_DRM_ZTE)  += zte/
 obj-$(CONFIG_DRM_MXSFB)+= mxsfb/
+obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
diff --git a/drivers/gpu/drm/tinydrm/Kconfig b/drivers/gpu/drm/tinydrm/Kconfig
new file mode 100644
index 000..ffb873f
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/Kconfig
@@ -0,0 +1,8 @@
+menuconfig DRM_TINYDRM
+   tristate "Support for simple displays"
+   depends on DRM
+   select DRM_KMS_HELPER
+   select DRM_KMS_CMA_HELPER
+   help
+ Choose this option if you have a tinydrm supported display.
+ If M is selected the module will be called tinydrm.
diff --git a/drivers/gpu/drm/tinydrm/Makefile b/drivers/gpu/drm/tinydrm/Makefile
new file mode 100644
index 000..7476ed1
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_DRM_TINYDRM)  += core/
diff --git a/drivers/gpu/drm/tinydrm/core/Makefile 
b/drivers/gpu/drm/tinydrm/core/Makefile
new file mode 100644
index 000..4f14a0f
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/core/Makefile
@@ -0,0 +1,3 @@
+tinydrm-y := tinydrm-core.o tinydrm-pipe.o
+
+obj-$(CONFIG_DRM_TINYDRM) += tinydrm.o
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-core.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
new file mode 100644
index 000..492b478
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-core.c
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2016 Noralf Trønnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * DOC: overview
+ *
+ * This library provides driver helpers for very simple display hardware.
+ *
+ * It is based on _simple_display_pipe coupled with a _connector which
+ * has only one fixed _display_mode. The framebuffers are backed by the
+ * cma helper and have support for framebuffer 

[PATCH 6/9] drm/tinydrm: Add MIPI DBI support

2017-01-22 Thread Noralf Trønnes
Add support for MIPI DBI compatible controllers.
Interface type C option 1 and 3 are supported (SPI).

Signed-off-by: Noralf Trønnes 
---
 Documentation/gpu/drm-kms-helpers.rst |   12 +
 drivers/gpu/drm/tinydrm/Kconfig   |3 +
 drivers/gpu/drm/tinydrm/Makefile  |3 +
 drivers/gpu/drm/tinydrm/mipi-dbi.c| 1005 +
 include/drm/tinydrm/mipi-dbi.h|  107 
 5 files changed, 1130 insertions(+)
 create mode 100644 drivers/gpu/drm/tinydrm/mipi-dbi.c
 create mode 100644 include/drm/tinydrm/mipi-dbi.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index be07e76..bd18734 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -293,3 +293,15 @@ tinydrm Helper Reference
 
 .. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
:export:
+
+MIPI DBI Helper Reference
+-
+
+.. kernel-doc:: drivers/gpu/drm/tinydrm/mipi-dbi.c
+   :doc: overview
+
+.. kernel-doc:: include/drm/tinydrm/mipi-dbi.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/tinydrm/mipi-dbi.c
+   :export:
diff --git a/drivers/gpu/drm/tinydrm/Kconfig b/drivers/gpu/drm/tinydrm/Kconfig
index ffb873f..128d2f3 100644
--- a/drivers/gpu/drm/tinydrm/Kconfig
+++ b/drivers/gpu/drm/tinydrm/Kconfig
@@ -6,3 +6,6 @@ menuconfig DRM_TINYDRM
help
  Choose this option if you have a tinydrm supported display.
  If M is selected the module will be called tinydrm.
+
+config TINYDRM_MIPI_DBI
+   tristate
diff --git a/drivers/gpu/drm/tinydrm/Makefile b/drivers/gpu/drm/tinydrm/Makefile
index 7476ed1..fe5d4c6 100644
--- a/drivers/gpu/drm/tinydrm/Makefile
+++ b/drivers/gpu/drm/tinydrm/Makefile
@@ -1 +1,4 @@
 obj-$(CONFIG_DRM_TINYDRM)  += core/
+
+# Controllers
+obj-$(CONFIG_TINYDRM_MIPI_DBI) += mipi-dbi.o
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c 
b/drivers/gpu/drm/tinydrm/mipi-dbi.c
new file mode 100644
index 000..5ded299
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -0,0 +1,1005 @@
+/*
+ * MIPI Display Bus Interface (DBI) LCD controller support
+ *
+ * Copyright 2016 Noralf Trønnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MIPI_DBI_MAX_SPI_READ_SPEED 200 /* 2MHz */
+
+#define DCS_POWER_MODE_DISPLAY BIT(2)
+#define DCS_POWER_MODE_DISPLAY_NORMAL_MODE BIT(3)
+#define DCS_POWER_MODE_SLEEP_MODE  BIT(4)
+#define DCS_POWER_MODE_PARTIAL_MODEBIT(5)
+#define DCS_POWER_MODE_IDLE_MODE   BIT(6)
+#define DCS_POWER_MODE_RESERVED_MASK   (BIT(0) | BIT(1) | BIT(7))
+
+/**
+ * DOC: overview
+ *
+ * This library provides helpers for MIPI Display Bus Interface (DBI)
+ * compatible display controllers.
+ *
+ * Many controllers for tiny lcd displays are MIPI compliant and can use this
+ * library. If a controller uses registers 0x2A and 0x2B to set the area to
+ * update and uses register 0x2C to write to frame memory, it is most likely
+ * MIPI compliant.
+ *
+ * Only MIPI Type 1 displays are supported since a full frame memory is needed.
+ *
+ * There are 3 MIPI DBI implementation types:
+ *
+ * A. Motorola 6800 type parallel bus
+ *
+ * B. Intel 8080 type parallel bus
+ *
+ * C. SPI type with 3 options:
+ *
+ *1. 9-bit with the Data/Command signal as the ninth bit
+ *2. Same as above except it's sent as 16 bits
+ *3. 8-bit with the Data/Command signal as a separate D/CX pin
+ *
+ * Currently mipi_dbi only supports Type C options 1 and 3 with
+ * mipi_dbi_spi_init().
+ */
+
+#define MIPI_DBI_DEBUG_COMMAND(cmd, data, len) \
+({ \
+   if (!len) \
+   DRM_DEBUG_DRIVER("cmd=%02x\n", cmd); \
+   else if (len <= 32) \
+   DRM_DEBUG_DRIVER("cmd=%02x, par=%*ph\n", cmd, len, data); \
+   else \
+   DRM_DEBUG_DRIVER("cmd=%02x, len=%zu\n", cmd, len); \
+})
+
+static const u8 mipi_dbi_dcs_read_commands[] = {
+   MIPI_DCS_GET_DISPLAY_ID,
+   MIPI_DCS_GET_RED_CHANNEL,
+   MIPI_DCS_GET_GREEN_CHANNEL,
+   MIPI_DCS_GET_BLUE_CHANNEL,
+   MIPI_DCS_GET_DISPLAY_STATUS,
+   MIPI_DCS_GET_POWER_MODE,
+   MIPI_DCS_GET_ADDRESS_MODE,
+   MIPI_DCS_GET_PIXEL_FORMAT,
+   MIPI_DCS_GET_DISPLAY_MODE,
+   MIPI_DCS_GET_SIGNAL_MODE,
+   MIPI_DCS_GET_DIAGNOSTIC_RESULT,
+   MIPI_DCS_READ_MEMORY_START,
+   MIPI_DCS_READ_MEMORY_CONTINUE,
+   MIPI_DCS_GET_SCANLINE,
+   MIPI_DCS_GET_DISPLAY_BRIGHTNESS,
+   MIPI_DCS_GET_CONTROL_DISPLAY,
+   MIPI_DCS_GET_POWER_SAVE,
+   MIPI_DCS_GET_CABC_MIN_BRIGHTNESS,
+   MIPI_DCS_READ_DDB_START,
+   

[PATCH 2/9] drm: debugfs: Remove all files automatically on cleanup

2017-01-22 Thread Noralf Trønnes
Instead of having the drivers call drm_debugfs_remove_files() in
their drm_driver->debugfs_cleanup hook, do it automatically by
traversing minor->debugfs_list.
Also use debugfs_remove_recursive() so drivers who add their own
debugfs files don't have to keep track of them for removal.

Signed-off-by: Noralf Trønnes 
---
 drivers/gpu/drm/drm_debugfs.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 37fd612..0510ce2 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -218,6 +218,19 @@ int drm_debugfs_remove_files(const struct drm_info_list 
*files, int count,
 }
 EXPORT_SYMBOL(drm_debugfs_remove_files);
 
+static void drm_debugfs_remove_all_files(struct drm_minor *minor)
+{
+   struct drm_info_node *node, *tmp;
+
+   mutex_lock(>debugfs_lock);
+   list_for_each_entry_safe(node, tmp, >debugfs_list, list) {
+   debugfs_remove(node->dent);
+   list_del(>list);
+   kfree(node);
+   }
+   mutex_unlock(>debugfs_lock);
+}
+
 /**
  * Cleanup the debugfs filesystem resources.
  *
@@ -245,9 +258,9 @@ int drm_debugfs_cleanup(struct drm_minor *minor)
}
}
 
-   drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
+   drm_debugfs_remove_all_files(minor);
 
-   debugfs_remove(minor->debugfs_root);
+   debugfs_remove_recursive(minor->debugfs_root);
minor->debugfs_root = NULL;
 
return 0;
-- 
2.10.2

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


[PATCH 7/9] of: Add vendor prefix for Multi-Inno

2017-01-22 Thread Noralf Trønnes
Multi-Inno Technology Co.,Ltd is a Hong Kong based company offering
LCD, LCD module products and complete panel solutions.

Signed-off-by: Noralf Trønnes 
---
 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 c7624ae..95188cc 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -192,6 +192,7 @@ mpl MPL AG
 mqmakermqmaker Inc.
 msiMicro-Star International Co. Ltd.
 mtiImagination Technologies Ltd. (formerly MIPS Technologies Inc.)
+multi-inno Multi-Inno Technology Co.,Ltd
 mundoreaderMundo Reader S.L.
 murata Murata Manufacturing Co., Ltd.
 mxicy  Macronix International Co., Ltd.
-- 
2.10.2

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


[PATCH 5/9] drm/tinydrm: Add helper functions

2017-01-22 Thread Noralf Trønnes
Add common functionality needed by many tinydrm drivers.

Signed-off-by: Noralf Trønnes 
---
 Documentation/gpu/drm-kms-helpers.rst  |   6 +
 drivers/gpu/drm/tinydrm/core/Makefile  |   2 +-
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 490 +
 include/drm/tinydrm/tinydrm-helpers.h  | 100 +
 4 files changed, 597 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
 create mode 100644 include/drm/tinydrm/tinydrm-helpers.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst 
b/Documentation/gpu/drm-kms-helpers.rst
index a86bd7f..be07e76 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -287,3 +287,9 @@ tinydrm Helper Reference
 
 .. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
:export:
+
+.. kernel-doc:: include/drm/tinydrm/tinydrm-helpers.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+   :export:
diff --git a/drivers/gpu/drm/tinydrm/core/Makefile 
b/drivers/gpu/drm/tinydrm/core/Makefile
index 4f14a0f..fb221e6 100644
--- a/drivers/gpu/drm/tinydrm/core/Makefile
+++ b/drivers/gpu/drm/tinydrm/core/Makefile
@@ -1,3 +1,3 @@
-tinydrm-y := tinydrm-core.o tinydrm-pipe.o
+tinydrm-y := tinydrm-core.o tinydrm-pipe.o tinydrm-helpers.o
 
 obj-$(CONFIG_DRM_TINYDRM) += tinydrm.o
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
new file mode 100644
index 000..fc02e01
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -0,0 +1,490 @@
+/*
+ * Copyright (C) 2016 Noralf Trønnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static unsigned int spi_max;
+module_param(spi_max, uint, 0400);
+MODULE_PARM_DESC(spi_max, "Set a lower SPI max transfer size");
+
+/**
+ * tinydrm_merge_clips - Merge clip rectangles
+ * @dst: Destination clip rectangle
+ * @src: Source clip rectangle(s)
+ * @num_clips: Number of @src clip rectangles
+ * @flags: Dirty fb ioctl flags
+ * @max_width: Maximum width of @dst
+ * @max_height: Maximum height of @dst
+ *
+ * This function merges @src clip rectangle(s) into @dst. If @src is NULL,
+ * @max_width and @min_width is used to set a full @dst clip rectangle.
+ *
+ * Returns:
+ * true if it's a full clip, false otherwise
+ */
+bool tinydrm_merge_clips(struct drm_clip_rect *dst,
+struct drm_clip_rect *src, unsigned int num_clips,
+unsigned int flags, u32 max_width, u32 max_height)
+{
+   unsigned int i;
+
+   if (!src || !num_clips) {
+   dst->x1 = 0;
+   dst->x2 = max_width;
+   dst->y1 = 0;
+   dst->y2 = max_height;
+   return true;
+   }
+
+   dst->x1 = ~0;
+   dst->y1 = ~0;
+   dst->x2 = 0;
+   dst->y2 = 0;
+
+   for (i = 0; i < num_clips; i++) {
+   if (flags & DRM_MODE_FB_DIRTY_ANNOTATE_COPY)
+   i++;
+   dst->x1 = min(dst->x1, src[i].x1);
+   dst->x2 = max(dst->x2, src[i].x2);
+   dst->y1 = min(dst->y1, src[i].y1);
+   dst->y2 = max(dst->y2, src[i].y2);
+   }
+
+   if (dst->x2 > max_width || dst->y2 > max_height ||
+   dst->x1 >= dst->x2 || dst->y1 >= dst->y2) {
+   DRM_DEBUG_KMS("Illegal clip: x1=%u, x2=%u, y1=%u, y2=%u\n",
+ dst->x1, dst->x2, dst->y1, dst->y2);
+   dst->x1 = 0;
+   dst->y1 = 0;
+   dst->x2 = max_width;
+   dst->y2 = max_height;
+   }
+
+   return (dst->x2 - dst->x1) == max_width &&
+  (dst->y2 - dst->y1) == max_height;
+}
+EXPORT_SYMBOL(tinydrm_merge_clips);
+
+/**
+ * tinydrm_memcpy - Copy clip buffer
+ * @dst: Destination buffer
+ * @vaddr: Source buffer
+ * @fb: DRM framebuffer
+ * @clip: Clip rectangle area to copy
+ */
+void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
+   struct drm_clip_rect *clip)
+{
+   unsigned int cpp = drm_format_plane_cpp(fb->format->format, 0);
+   unsigned int pitch = fb->pitches[0];
+   void *src = vaddr + (clip->y1 * pitch) + (clip->x1 * cpp);
+   size_t len = (clip->x2 - clip->x1) * cpp;
+   unsigned int y;
+
+   for (y = clip->y1; y < clip->y2; y++) {
+   memcpy(dst, src, len);
+   src += pitch;
+   dst += len;
+   }
+}
+EXPORT_SYMBOL(tinydrm_memcpy);
+
+/**
+ * tinydrm_swab16 - Swap bytes into clip buffer
+ * @dst: RGB565 destination buffer
+ * @vaddr: RGB565 source buffer
+ * @fb: DRM framebuffer
+ * @clip: Clip rectangle area 

[PATCH 9/9] drm/tinydrm: Add support for Multi-Inno MI0283QT display

2017-01-22 Thread Noralf Trønnes
Add driver to support the Multi-Inno MI0283QT display panel.
It has an ILI9341 MIPI DBI compatible display controller.

Signed-off-by: Noralf Trønnes 
---
 MAINTAINERS|   6 +
 drivers/gpu/drm/tinydrm/Kconfig|   8 ++
 drivers/gpu/drm/tinydrm/Makefile   |   3 +
 drivers/gpu/drm/tinydrm/mi0283qt.c | 279 +
 include/drm/tinydrm/ili9341.h  |  54 +++
 5 files changed, 350 insertions(+)
 create mode 100644 drivers/gpu/drm/tinydrm/mi0283qt.c
 create mode 100644 include/drm/tinydrm/ili9341.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 817e0fe..8301800 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4271,6 +4271,12 @@ S:   Supported
 F: drivers/gpu/drm/mediatek/
 F: Documentation/devicetree/bindings/display/mediatek/
 
+DRM DRIVER FOR MI0283QT
+M: Noralf Trønnes 
+S: Maintained
+F: drivers/gpu/drm/tinydrm/mi0283qt.c
+F: Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
+
 DRM DRIVER FOR MSM ADRENO GPU
 M: Rob Clark 
 L: linux-arm-...@vger.kernel.org
diff --git a/drivers/gpu/drm/tinydrm/Kconfig b/drivers/gpu/drm/tinydrm/Kconfig
index 128d2f3..d3161fd 100644
--- a/drivers/gpu/drm/tinydrm/Kconfig
+++ b/drivers/gpu/drm/tinydrm/Kconfig
@@ -9,3 +9,11 @@ menuconfig DRM_TINYDRM
 
 config TINYDRM_MIPI_DBI
tristate
+
+config TINYDRM_MI0283QT
+   tristate "DRM support for MI0283QT"
+   depends on DRM_TINYDRM && SPI
+   select TINYDRM_MIPI_DBI
+   help
+ DRM driver for the Multi-Inno MI0283QT display panel
+ If M is selected the module will be called mi0283qt.
diff --git a/drivers/gpu/drm/tinydrm/Makefile b/drivers/gpu/drm/tinydrm/Makefile
index fe5d4c6..7a3604c 100644
--- a/drivers/gpu/drm/tinydrm/Makefile
+++ b/drivers/gpu/drm/tinydrm/Makefile
@@ -2,3 +2,6 @@ obj-$(CONFIG_DRM_TINYDRM)   += core/
 
 # Controllers
 obj-$(CONFIG_TINYDRM_MIPI_DBI) += mipi-dbi.o
+
+# Displays
+obj-$(CONFIG_TINYDRM_MI0283QT) += mi0283qt.o
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
new file mode 100644
index 000..b29fe86
--- /dev/null
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -0,0 +1,279 @@
+/*
+ * DRM driver for Multi-Inno MI0283QT panels
+ *
+ * Copyright 2016 Noralf Trønnes
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int mi0283qt_init(struct mipi_dbi *mipi)
+{
+   struct tinydrm_device *tdev = >tinydrm;
+   struct device *dev = tdev->drm->dev;
+   u8 addr_mode;
+   int ret;
+
+   DRM_DEBUG_KMS("\n");
+
+   ret = regulator_enable(mipi->regulator);
+   if (ret) {
+   dev_err(dev, "Failed to enable regulator %d\n", ret);
+   return ret;
+   }
+
+   /* Avoid flicker by skipping setup if the bootloader has done it */
+   if (mipi_dbi_display_is_on(mipi))
+   return 0;
+
+   mipi_dbi_hw_reset(mipi);
+   ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET);
+   if (ret) {
+   dev_err(dev, "Error sending command %d\n", ret);
+   regulator_disable(mipi->regulator);
+   return ret;
+   }
+
+   msleep(20);
+
+   mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_OFF);
+
+   mipi_dbi_command(mipi, ILI9341_PWCTRLB, 0x00, 0x83, 0x30);
+   mipi_dbi_command(mipi, ILI9341_PWRSEQ, 0x64, 0x03, 0x12, 0x81);
+   mipi_dbi_command(mipi, ILI9341_DTCTRLA, 0x85, 0x01, 0x79);
+   mipi_dbi_command(mipi, ILI9341_PWCTRLA, 0x39, 0x2c, 0x00, 0x34, 0x02);
+   mipi_dbi_command(mipi, ILI9341_PUMPCTRL, 0x20);
+   mipi_dbi_command(mipi, ILI9341_DTCTRLB, 0x00, 0x00);
+
+   /* Power Control */
+   mipi_dbi_command(mipi, ILI9341_PWCTRL1, 0x26);
+   mipi_dbi_command(mipi, ILI9341_PWCTRL2, 0x11);
+   /* VCOM */
+   mipi_dbi_command(mipi, ILI9341_VMCTRL1, 0x35, 0x3e);
+   mipi_dbi_command(mipi, ILI9341_VMCTRL2, 0xbe);
+
+   /* Memory Access Control */
+   mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
+
+   switch (mipi->rotation) {
+   default:
+   addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
+   ILI9341_MADCTL_MX;
+   break;
+   case 90:
+   addr_mode = ILI9341_MADCTL_MY;
+   break;
+   case 180:
+   addr_mode = ILI9341_MADCTL_MV;
+   break;
+   case 270:
+   addr_mode = ILI9341_MADCTL_MX;
+   break;
+   }
+   addr_mode |= ILI9341_MADCTL_BGR;
+   mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
+

[PATCH 0/9] drm: Add support for tiny LCD displays

2017-01-22 Thread Noralf Trønnes
This is an attempt at providing a DRM version of drivers/staging/fbtft.

The tinydrm library provides a very simplified view of DRM in particular
for tiny displays that has onboard video memory and is connected through
a slow bus like SPI/I2C.

Main changes since the RFCv2 in April last year:
- No tinydrm specific callbacks (dirtyfb+drm_panel_funcs), instead use
  drm_simple_display_pipe_funcs and drm_framebuffer_funcs directly in
  drivers and controller libraries.
- Drop lcdreg abstraction. MIPI DCS isn't really about registers, but
  rather commands with optional parameters. regmap is probably a good
  fit for the other more register oriented controllers.

I will cut back on some of the DRM_DEBUG*() usage when the api has settled.


Noralf.


Changes since RFC v2:
- Rebased on new core helpers
- Don't use drm_panel
- Flush when the framebuffer is changed on the plane
- Add devm_tinydrm_init()
- Fix PRIME support, set vaddr
- Use atomic helpers in suspend/resume
- Add a tinydrm_connector with one display mode
- Set mode_config.preferred_depth and use it for fbdev
- Subclass tinydrm_device in drivers instead of bloating the structure
- The PiTFT display uses a MI0283QT panel, write driver for that instead.
- Drop homegrown lcdreg module, it ended up as a collection of special
  cases.
- Add more documentation

Changes since RFC v1:
- Add fb_deferred_io support to drm_fb_helper and drm_fb_cma_helper,
  and use drm_fb_cma_helper instead.
- Move display pipeline code to drm_simple_kms_helper.
- Don't use (struct drm_driver *)->load().
- Make tinydrm more like a library, exporting the internals.
- Move the struct drm_driver definition from the tinydrm module to the
  driver using a helper macro: TINYDRM_DRM_DRIVER.
- Remove dirtyfb() async code.
- Added support for partial display updates.


Noralf Trønnes (9):
  drm/fb-cma-helper: Add drm_fbdev_cma_set_suspend_unlocked()
  drm: debugfs: Remove all files automatically on cleanup
  drm/simple-helpers: Add missing includes
  drm: Add DRM support for tiny LCD displays
  drm/tinydrm: Add helper functions
  drm/tinydrm: Add MIPI DBI support
  of: Add vendor prefix for Multi-Inno
  dt-bindings: Add Multi-Inno MI0283QT binding
  drm/tinydrm: Add support for Multi-Inno MI0283QT display

 .../bindings/display/multi-inno,mi0283qt.txt   |   27 +
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 Documentation/gpu/drm-kms-helpers.rst  |   33 +
 MAINTAINERS|   13 +
 drivers/gpu/drm/Kconfig|2 +
 drivers/gpu/drm/Makefile   |1 +
 drivers/gpu/drm/drm_debugfs.c  |   17 +-
 drivers/gpu/drm/drm_fb_cma_helper.c|   18 +
 drivers/gpu/drm/tinydrm/Kconfig|   19 +
 drivers/gpu/drm/tinydrm/Makefile   |7 +
 drivers/gpu/drm/tinydrm/core/Makefile  |3 +
 drivers/gpu/drm/tinydrm/core/tinydrm-core.c|  374 
 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c |  490 ++
 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c|  244 +
 drivers/gpu/drm/tinydrm/mi0283qt.c |  279 ++
 drivers/gpu/drm/tinydrm/mipi-dbi.c | 1005 
 include/drm/drm_fb_cma_helper.h|2 +
 include/drm/drm_simple_kms_helper.h|4 +
 include/drm/tinydrm/ili9341.h  |   54 ++
 include/drm/tinydrm/mipi-dbi.h |  107 +++
 include/drm/tinydrm/tinydrm-helpers.h  |  100 ++
 include/drm/tinydrm/tinydrm.h  |  115 +++
 22 files changed, 2913 insertions(+), 2 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/display/multi-inno,mi0283qt.txt
 create mode 100644 drivers/gpu/drm/tinydrm/Kconfig
 create mode 100644 drivers/gpu/drm/tinydrm/Makefile
 create mode 100644 drivers/gpu/drm/tinydrm/core/Makefile
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-core.c
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
 create mode 100644 drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
 create mode 100644 drivers/gpu/drm/tinydrm/mi0283qt.c
 create mode 100644 drivers/gpu/drm/tinydrm/mipi-dbi.c
 create mode 100644 include/drm/tinydrm/ili9341.h
 create mode 100644 include/drm/tinydrm/mipi-dbi.h
 create mode 100644 include/drm/tinydrm/tinydrm-helpers.h
 create mode 100644 include/drm/tinydrm/tinydrm.h

--
2.10.2

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


[PATCH 3/9] drm/simple-helpers: Add missing includes

2017-01-22 Thread Noralf Trønnes
Add missing includes to pull in definitions for drm_crtc,
drm_plane and drm_encoder.

Signed-off-by: Noralf Trønnes 
---
 include/drm/drm_simple_kms_helper.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/drm/drm_simple_kms_helper.h 
b/include/drm/drm_simple_kms_helper.h
index fe8c4ba..d138d08 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -10,6 +10,10 @@
 #ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H
 #define __LINUX_DRM_SIMPLE_KMS_HELPER_H
 
+#include 
+#include 
+#include 
+
 struct drm_simple_display_pipe;
 
 /**
-- 
2.10.2

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


Re: Warning at drivers/gpu/drm/drm_atomic_helper.c

2017-01-22 Thread Fabio Estevam
On Sat, Jan 21, 2017 at 2:40 PM, Fabio Estevam  wrote:
> Hi,
>
> Stopping kmscube application on mx6q through CTRL + C sometimes leads
> to the following kernel warning:
>
> ^C[ 3939.785516] [ cut here ]
> [ 3939.790313] WARNING: CPU: 1 PID: 67 at
> drivers/gpu/drm/drm_atomic_helper.c:1032
> drm_atomic_helper_wait_for_fences+0xe4/0x104
> [ 3939.801626] Modules linked in:
> [ 3939.804762] CPU: 1 PID: 67 Comm: kworker/1:1 Tainted: GW
>4.9.4 #1

Just tested 4.9.5 and the kernel warning is gone.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/1] drm/amd/powerplay: fix misspelling in header guard

2017-01-22 Thread Nicolas Iooss
In smu7_clockpowergating.h, the #ifndef statement which prevents
multiple inclusions of the header file uses _SMU7_CLOCK_POWER_GATING_H_
but the following #define statement uses _SMU7_CLOCK__POWER_GATING_H_.

Signed-off-by: Nicolas Iooss 
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h 
b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h
index d52a28c343e3..c96ed9ed7eaf 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_clockpowergating.h
@@ -22,7 +22,7 @@
  */
 
 #ifndef _SMU7_CLOCK_POWER_GATING_H_
-#define _SMU7_CLOCK__POWER_GATING_H_
+#define _SMU7_CLOCK_POWER_GATING_H_
 
 #include "smu7_hwmgr.h"
 #include "pp_asicblocks.h"
-- 
2.11.0

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


Re: [PATCH v2 17/26] drm/rockchip: dw-mipi-dsi: don't enable PHY PLL until it's configured

2017-01-22 Thread Chris Zhong

Hi John

This patch do the similar thing with 
https://patchwork.kernel.org/patch/9530405/
They are changing the phy configuration order, my suggestion is to merge 
them.



On 01/22/2017 12:31 AM, John Keeping wrote:

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index ce1e6f9a2041..cfe7e4ba305c 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -413,12 +413,12 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
  
  	dw_mipi_dsi_phy_write(dsi, 0x44, HSFREQRANGE_SEL(testdin));
  
-	dw_mipi_dsi_phy_write(dsi, 0x19, PLL_LOOP_DIV_EN | PLL_INPUT_DIV_EN);

dw_mipi_dsi_phy_write(dsi, 0x17, INPUT_DIVIDER(dsi->input_div));
dw_mipi_dsi_phy_write(dsi, 0x18, LOOP_DIV_LOW_SEL(dsi->feedback_div) |
 LOW_PROGRAM_EN);
dw_mipi_dsi_phy_write(dsi, 0x18, LOOP_DIV_HIGH_SEL(dsi->feedback_div) |
 HIGH_PROGRAM_EN);
+   dw_mipi_dsi_phy_write(dsi, 0x19, PLL_LOOP_DIV_EN | PLL_INPUT_DIV_EN);
  
  	dw_mipi_dsi_phy_write(dsi, 0x22, LOW_PROGRAM_EN |

 BIASEXTR_SEL(BIASEXTR_127_7));



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


Re: [PATCH v2 14/26] drm/rockchip: dw-mipi-dsi: fix escape clock rate

2017-01-22 Thread Chris Zhong

Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

Use the same calculation as the vendor kernel to derive the escape clock
speed.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 290282e86d16..c2e0ba96e0a0 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -710,11 +710,13 @@ static void dw_mipi_dsi_disable(struct dw_mipi_dsi *dsi)
  
  static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)

  {
+   u32 esc_clk_division = (dsi->lane_mbps >> 3) / 20 + 1;
+
dsi_write(dsi, DSI_PWR_UP, RESET);
dsi_write(dsi, DSI_PHY_RSTZ, PHY_DISFORCEPLL | PHY_DISABLECLK
  | PHY_RSTZ | PHY_SHUTDOWNZ);
dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVIDSION(10) |
- TX_ESC_CLK_DIVIDSION(7));
+ TX_ESC_CLK_DIVIDSION(esc_clk_division));
  }
  
  static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi *dsi,



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


Re: [PATCH v2 15/26] drm/rockchip: dw-mipi-dsi: ensure PHY is reset

2017-01-22 Thread Chris Zhong


Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

Also don't power up the DSI host at this point since this is not
necessary in order to configure the PHY and we do so later when
selecting video or command mode.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index c2e0ba96e0a0..5b3068e9e8db 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -397,7 +397,10 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi)
return testdin;
}
  
-	dsi_write(dsi, DSI_PWR_UP, POWERUP);

+   /* Start by clearing PHY state */
+   dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_UNTESTCLR);
+   dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_TESTCLR);
+   dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_UNTESTCLR);
  
  	dw_mipi_dsi_phy_write(dsi, 0x10, BYPASS_VCO_RANGE |

 VCO_RANGE_CON_SEL(vco) |



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


Re: [PATCH v2 13/26] drm/rockchip: dw-mipi-dsi: allow commands in panel_disable

2017-01-22 Thread Chris Zhong

Hi John



On 01/22/2017 12:31 AM, John Keeping wrote:

Panel drivers may want to sent commands during the disable function, for
example MIPI_DCS_SET_DISPLAY_OFF before the video signal ends.  In order
to send commands we need to write to registers, so pclk must be enabled.

While changing this, remove the unnecessary code after the panel
unprepare call which seems to be a workaround for a specific panel and
thus belongs in the panel driver.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 12 ++--
  1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 7ada6d8ed143..290282e86d16 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -846,24 +846,16 @@ static void dw_mipi_dsi_encoder_disable(struct 
drm_encoder *encoder)
  {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
  
-	drm_panel_disable(dsi->panel);

-
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
}
  
+	drm_panel_disable(dsi->panel);

+
dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE);
drm_panel_unprepare(dsi->panel);
-   dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE);
  
-	/*

-* This is necessary to make sure the peripheral will be driven
-* normally when the display is enabled again later.
-*/
-   msleep(120);
-
-   dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE);

This workaround is from[0], I also think it should be deleted.

[0]
http://www.spinics.net/lists/dri-devel/msg77192.html


Reviewed-by: Chris Zhong 


dw_mipi_dsi_disable(dsi);
clk_disable_unprepare(dsi->pclk);
  }



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


Re: [PATCH v2 12/26] drm/rockchip: dw-mipi-dsi: prepare panel after phy init

2017-01-22 Thread Chris Zhong

Hi John

Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

Some panels need to be configured with commands sent over the MIPI link,
which they will do in the prepare hook.  Call this after the PHY has
been initialized so that we are able to send commands to the panel.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index ddbc037e7ced..7ada6d8ed143 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -896,12 +896,14 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder 
*encoder)
dw_mipi_dsi_dphy_timing_config(dsi);
dw_mipi_dsi_dphy_interface_config(dsi);
dw_mipi_dsi_clear_err(dsi);
-   if (drm_panel_prepare(dsi->panel))
-   dev_err(dsi->dev, "failed to prepare panel\n");
  
  	dw_mipi_dsi_phy_init(dsi);

dw_mipi_dsi_wait_for_two_frames(mode);
  
+	dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE);

+   if (drm_panel_prepare(dsi->panel))
+   dev_err(dsi->dev, "failed to prepare panel\n");
+
dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE);
drm_panel_enable(dsi->panel);
  



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


Re: [PATCH v2 11/26] drm/rockchip: dw-mipi-dsi: don't assume buffer is aligned

2017-01-22 Thread Chris Zhong

Hi John

Reviewed-by: Chris Zhong 


On 01/22/2017 12:31 AM, John Keeping wrote:

By dereferencing the MIPI command buffer as a u32* we rely on it being
correctly aligned on ARM, but this may not be the case.  Copy it into a
stack variable that will be correctly aligned.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 12 +++-
  1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 03fc096fe1bd..ddbc037e7ced 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -607,10 +607,10 @@ static int dw_mipi_dsi_dcs_short_write(struct dw_mipi_dsi 
*dsi,
  static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
  const struct mipi_dsi_msg *msg)
  {
-   const u32 *tx_buf = msg->tx_buf;
-   int len = msg->tx_len, pld_data_bytes = sizeof(*tx_buf), ret;
+   const u8 *tx_buf = msg->tx_buf;
+   int len = msg->tx_len, pld_data_bytes = sizeof(u32), ret;
u32 hdr_val = GEN_HDATA(msg->tx_len) | GEN_HTYPE(msg->type);
-   u32 remainder = 0;
+   u32 remainder;
u32 val;
  
  	if (msg->tx_len < 3) {

@@ -621,12 +621,14 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi 
*dsi,
  
  	while (DIV_ROUND_UP(len, pld_data_bytes)) {

if (len < pld_data_bytes) {
+   remainder = 0;
memcpy(, tx_buf, len);
dsi_write(dsi, DSI_GEN_PLD_DATA, remainder);
len = 0;
} else {
-   dsi_write(dsi, DSI_GEN_PLD_DATA, *tx_buf);
-   tx_buf++;
+   memcpy(, tx_buf, pld_data_bytes);
+   dsi_write(dsi, DSI_GEN_PLD_DATA, remainder);
+   tx_buf += pld_data_bytes;
len -= pld_data_bytes;
}
  



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


Re: [PATCH v2 10/26] drm/rockchip: dw-mipi-dsi: only request HS clock when required

2017-01-22 Thread Chris Zhong

Hi John

Reviewed-by: Chris Zhong 

On 01/22/2017 12:31 AM, John Keeping wrote:

Requesting the HS clock from the PHY before we initialize it causes an
invalid signal to be sent out since the input clock is not yet
configured.  The PHY databook suggests only asserting this signal when
performing HS transfers, so let's do that.

Signed-off-by: John Keeping 
---
Unchanged in v2
---
  drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 15d33c3c8cb7..03fc096fe1bd 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -545,13 +545,15 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host 
*host,
  static void dw_mipi_message_config(struct dw_mipi_dsi *dsi,
   const struct mipi_dsi_msg *msg)
  {
+   bool lpm = msg->flags & MIPI_DSI_MSG_USE_LPM;
u32 val = 0;
  
  	if (msg->flags & MIPI_DSI_MSG_REQ_ACK)

val |= EN_ACK_RQST;
-   if (msg->flags & MIPI_DSI_MSG_USE_LPM)
+   if (lpm)
val |= CMD_MODE_ALL_LP;
  
+	dsi_write(dsi, DSI_LPCLK_CTRL, lpm ? 0 : PHY_TXREQUESTCLKHS);

dsi_write(dsi, DSI_CMD_MODE_CFG, val);
  }
  
@@ -693,6 +695,7 @@ static void dw_mipi_dsi_set_mode(struct dw_mipi_dsi *dsi,

dsi_write(dsi, DSI_PWR_UP, RESET);
dsi_write(dsi, DSI_MODE_CFG, ENABLE_VIDEO_MODE);
dw_mipi_dsi_video_mode_config(dsi);
+   dsi_write(dsi, DSI_LPCLK_CTRL, PHY_TXREQUESTCLKHS);
dsi_write(dsi, DSI_PWR_UP, POWERUP);
}
  }
@@ -710,7 +713,6 @@ static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
  | PHY_RSTZ | PHY_SHUTDOWNZ);
dsi_write(dsi, DSI_CLKMGR_CFG, TO_CLK_DIVIDSION(10) |
  TX_ESC_CLK_DIVIDSION(7));
-   dsi_write(dsi, DSI_LPCLK_CTRL, PHY_TXREQUESTCLKHS);
  }
  
  static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi *dsi,



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