[PATCH 00/29] Enabling new DAL display driver for amdgpu on Carrizo and Tonga

2016-02-12 Thread Dave Airlie
On 12 February 2016 at 03:19, Harry Wentland  wrote:
> This set of patches enables the new DAL display driver for amdgpu on Carrizo
> Tonga, and Fiji ASICs. This driver will allow us going forward to bring
> display features on the open amdgpu driver (mostly) on par with the Catalyst
> driver.
>
> This driver adds support for
> - Atomic KMS API
> - MST
> - HDMI 2.0
> - Better powerplay integration
> - Support of HW bandwidth formula on Carrizo
> - Better multi-display support and handling of co-functionality
> - Broader support of display dongles
> - Timing synchronization between DP and HDMI
>
> This patch series is based on Alex Deucher's drm-next-4.6-wip tree.
>
So the first minor criticism is this patch doesn't explain WHY.

Why does the Linux kernel need 93k lines of code to run the displays
when whole drivers don't even come close.

We've spent a lot of time ripping abstraction layers out of drivers (exynos
being the major one), what benefits does this major change bring to the
Linux kernel and the AMDGPU driver over and above a leaner, more focused
work.

If were even to consider merging this it would be at a guess considered
staging level material which would require a TODO list of major cleanups.

I do realise you've put a lot of work into this, but I think you are going to
get a lot of review pushback in the next few days and without knowing the
reasons this path was chosen it is going to be hard to take.

Dave.


[PATCH 06/29] drm/amd/dal: Adapter Service

2016-02-12 Thread Dave Airlie
> +
> +/* Stores entire ASIC features by sets */
> +uint32_t adapter_feature_set[FEATURE_MAXIMUM/32];

Is this global, what about multiple GPUs in one machine,
is this per GPU or per system?

Dave.


[PATCH 00/29] Enabling new DAL display driver for amdgpu on Carrizo and Tonga

2016-02-12 Thread Dave Airlie
On 12 February 2016 at 07:06, Daniel Vetter  wrote:
> On Thu, Feb 11, 2016 at 9:52 PM, Dave Airlie  wrote:
>> On 12 February 2016 at 03:19, Harry Wentland  
>> wrote:
>>> This set of patches enables the new DAL display driver for amdgpu on Carrizo
>>> Tonga, and Fiji ASICs. This driver will allow us going forward to bring
>>> display features on the open amdgpu driver (mostly) on par with the Catalyst
>>> driver.
>>>
>>> This driver adds support for
>>> - Atomic KMS API
>>> - MST
>>> - HDMI 2.0
>>> - Better powerplay integration
>>> - Support of HW bandwidth formula on Carrizo
>>> - Better multi-display support and handling of co-functionality
>>> - Broader support of display dongles
>>> - Timing synchronization between DP and HDMI
>>>
>>> This patch series is based on Alex Deucher's drm-next-4.6-wip tree.
>>>
>> So the first minor criticism is this patch doesn't explain WHY.
>>
>> Why does the Linux kernel need 93k lines of code to run the displays
>> when whole drivers don't even come close.
>>
>> We've spent a lot of time ripping abstraction layers out of drivers (exynos
>> being the major one), what benefits does this major change bring to the
>> Linux kernel and the AMDGPU driver over and above a leaner, more focused
>> work.
>>
>> If were even to consider merging this it would be at a guess considered
>> staging level material which would require a TODO list of major cleanups.
>>
>> I do realise you've put a lot of work into this, but I think you are going to
>> get a lot of review pushback in the next few days and without knowing the
>> reasons this path was chosen it is going to be hard to take.
>
> Yeah agreed, we need to figure out the why/how first. Assembling a
> de-staging TODO is imo a second step. And the problem with that is
> that before we can do a full TODO we need to remove all the os and drm
> abstractions. I found delayed_work, timer, memory handling, pixel
> formats (in multiple copies), the i2c stuff Rob noticed and there's
> more I'm sure. With all that I just can't even see how the main DAL
> structures connect and how that would sensibly map to drm concepts.
> Which is most likely needed to make DAL properly atomic.
>
> So de-staging DAL (if we decided this is the right approach) would be
> multi-stage, with removal of the abstractions not needed first, then
> taking a 2nd look and figuring out how to untangle the actual
> concepts.
>
> Aside: If all this abstraction is to make dal run in userspace for
> testing or whatever - nouveau does this, we (Intel) want to do this
> too for unit-testing, so there's definitely room for sharing the
> tools. But the right approach imo is to just implement kernel services
> (like timers) in userspace.
>
> Another thing is that some of the features in here (hdmi 2.0, improved
> dongle support) really should be in shared helpers. If we have that
> hidden behind the dal abstraction it'll be pretty much impossible
> (with major work, which is unreasonable to ask of other people trying
> to get their own driver in) to extract&share it. And for sink handling
> having multiple copies of the same code just doesn't make sense.
>
> Anyway that's my quick thoughts from 2h of reading this. One wishlist:
> Some design overview or diagram how dal structures connect would be
> awesome as a reading aid.

Yes some overview of what the abstractions are and why they exist,

Follow things down the layers really makes for hard work, and in a lot of
places for not much benefit.

Dave.


[PATCH v6 00/15] ASoC: hdac_hdmi: Add DP & notification support

2016-02-12 Thread Subhransu S. Prusty
This patch series adds DP audio and hotplug notification support.

In skylake platform the DP is on a different port which is not
enabled by default. A vendor widget is programmed to enable
playback on all ports. This also enables all the converters.

Codec Dais, widgets, graph are now created dynamically based on
the nodes enumerated, thus removing the hardcoding. Mux controls
are used to establish routing stream to a specific port.

For DP audio support, infoframe needs to be different. Based on
ELD queried we either pack HDMI or DP infoframe.

Also with this series, Jack notification support is added and
Jack event is reported to userspace as is done in case of legacy
driver.

Few fixes are added to check for possible memory leak,
reconfiguring register during resume from D3 etc.

The 8th patch is adding a small macro for getting connection type
in drm header. It is reviewed by drm folks, CCed them. Please
merge it through sound trees.

changes in v6:
- Fixed some review comments
- Fix afg node D3 state

Cc: Jani Nikula 
Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Cc: Daniel Vetter 

Jeeja KP (2):
  ASoC: hdac_hdmi: Add jack reporting
  ASoC: hdac_hdmi: Add PM support

Ramesh Babu (1):
  ASoC: hdac_hdmi: Fix to keep codec power active during enumeration.

Subhransu S. Prusty (12):
  ASoC: hdac_hdmi: Add hotplug notification and read ELD
  ASoC: hdac_hdmi: Apply constraints based on ELD
  ASoC: hdac_hdmi: Enable DP1.2 and all converters/pins
  ASoC: hdac_hdmi: create dais based on number of cvts
  ASoC: hdac_hdmi: Create widget/route based on nodes enumerated
  ASoC: hdac_hdmi: Enable playback on all enumerated ports
  drm/edid: Add API to help find connection type
  ASoC: hdac_hdmi: Add infoframe support for dp audio
  ASoC: hdac_hdmi: Fix possible memory leak in hw_params
  ASoC: hdac_hdmi: Don't fail in dai startup to make userland happy
  ASoC: hdac_hdmi: Fix to reconfigure registers in runtime resume
  ASoC: hdac_hdmi: Fix to wait for D3 before powering off codec

 include/drm/drm_edid.h   |   12 +
 sound/soc/codecs/Kconfig |1 +
 sound/soc/codecs/hdac_hdmi.c | 1208 +-
 sound/soc/codecs/hdac_hdmi.h |6 +
 4 files changed, 1104 insertions(+), 123 deletions(-)
 create mode 100644 sound/soc/codecs/hdac_hdmi.h

-- 
1.9.1



[PATCH v6 08/15] drm/edid: Add API to help find connection type

2016-02-12 Thread Subhransu S. Prusty
To fill the audio infoframe it is required to identify the
connection type as DP or HDMI. This patch adds an API which
parses ELD and returns the display type connected.

Signed-off-by: Subhransu S. Prusty 
Signed-off-by: Vinod Koul 
Reviewed-by: Jani Nikula 
Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Cc: Daniel Vetter 
---
 include/drm/drm_edid.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 2af9769..dec6221 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -403,6 +403,18 @@ static inline int drm_eld_size(const uint8_t *eld)
return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4;
 }

+/**
+ * drm_eld_get_conn_type - Get device type hdmi/dp connected
+ * @eld: pointer to an ELD memory structure
+ *
+ * The caller need to use %DRM_ELD_CONN_TYPE_HDMI or %DRM_ELD_CONN_TYPE_DP to
+ * identify the display type connected.
+ */
+static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
+{
+   return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK;
+}
+
 struct edid *drm_do_get_edid(struct drm_connector *connector,
int (*get_edid_block)(void *data, u8 *buf, unsigned int block,
  size_t len),
-- 
1.9.1



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

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=90481

Aaron Paden  changed:

   What|Removed |Added

Version|11.0|11.1

--- Comment #8 from Aaron Paden  ---
Still an issue with with Mesa 11.1.2 and Linux 4.5-rc3

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/20423bd1/attachment.html>


[Bug 79504] LLVM error on fragment shader

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=79504

Michel D�nzer  changed:

   What|Removed |Added

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

--- Comment #17 from Michel D�nzer  ---
Thanks guys. Works for me with radeonsi as well now, if it still doesn't for
you Kyle, please reopen with current glxinfo output.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/3c956a3e/attachment.html>


[Bug 70514] Unresponsive system on boot with radeon + FireGL v7700

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=70514

--- Comment #7 from Michel D�nzer  ---
(In reply to Andriy Dmytruk from comment #6)
> Confirm bug.
> Debian 9 Stretch x64.
> Video HIS HD 3870 IceQ 3 Turbo 512MB (256bit) GDDR4 PCIe (chip RV670)

Different hardware => please file your own report.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/316e737e/attachment.html>


[Bug 79504] LLVM error on fragment shader

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=79504

--- Comment #18 from Kyle Blake  ---
Confirming that it works for me.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/ee70fe3f/attachment.html>


[git pull] drm amd fixes.

2016-02-12 Thread Dave Airlie

Hi Linus,

Been pretty quiet, this is an amdgpu fixes pull from AMD,
a bunch of powerplay stability fixes, race fix, hibernate fix,
and a possible circular locking fix.

Dave.

The following changes since commit 388f7b1d6e8ca06762e2454d28d6c3c55ad0fe95:

  Linux 4.5-rc3 (2016-02-07 15:38:30 -0800)

are available in the git repository at:

  git://people.freedesktop.org/~airlied/linux drm-fixes

for you to fetch changes up to c92a428f408b23215d1a27f652742094bfc50577:

  Merge branch 'drm-fixes-4.5' of git://people.freedesktop.org/~agd5f/linux 
into drm-fixes (2016-02-11 08:39:07 +1000)


Alex Deucher (16):
  drm/amdgpu: add pcie cap module parameters (v2)
  drm/amdgpu/cik: don't mess with aspm if gpu is root bus
  drm/amdgpu/dpm/ci: switch over to the common pcie caps interface
  drm/amdgpu: handle uvd pg flags properly
  drm/amdgpu: handle vce pg flags properly
  drm/amdgpu: clean up vce pg flags for cz/st
  drm/amdgpu: be consistent with uvd cg flags
  drm/amd/powerplay/cz: disable uvd pg
  drm/amd/powerplay/cz: disable vce pg
  drm/amd/powerplay/tonga: disable uvd pg
  drm/amd/powerplay/tonga: disable vce pg
  drm/amdgpu: add a cgs interface to fetch cg and pg flags
  drm/amdgpu: remove unused cg defines
  drma/dmgpu: move cg and pg flags into shared headers
  drm/amdgpu/tonga: plumb pg flags through to powerplay
  drm/amdgpu/cz: plumb pg flags through to powerplay

Christian König (1):
  drm/amdgpu: fix issue with overlapping userptrs

Dave Airlie (1):
  Merge branch 'drm-fixes-4.5' of git://people.freedesktop.org/~agd5f/linux 
into drm-fixes

Flora Cui (1):
  drm/amdgpu: fix s4 resume

Nicolai Hähnle (3):
  drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)
  drm/amdgpu: remove unnecessary forward declaration
  drm/radeon: hold reference to fences in radeon_sa_bo_new

 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  47 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c   |   6 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 160 --
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   |   8 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c|   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c|   5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   |  19 +++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c   |  11 +-
 drivers/gpu/drm/amd/amdgpu/cik.c  | 157 ++---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c |   4 +-
 drivers/gpu/drm/amd/amdgpu/cz_dpm.c   |   6 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c |  70 +-
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c |  10 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c   |   8 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c |  10 +-
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c |   8 ++
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c |   7 +-
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c |   5 +-
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c |   7 +-
 drivers/gpu/drm/amd/amdgpu/vi.c   |   3 +-
 drivers/gpu/drm/amd/include/amd_shared.h  |  32 +
 drivers/gpu/drm/amd/include/cgs_common.h  |   2 +
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c|  18 +++
 drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c |  19 ++-
 drivers/gpu/drm/radeon/radeon_sa.c|   5 +
 25 files changed, 373 insertions(+), 257 deletions(-)


[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Inki Dae
Hi Chanho,

There was a missing one so below is my review again.

2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
> Hi Inki,
> 
> On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
>> Hi Chanho,
>>
>> 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
>>> From: Chanho Park 
>>>
>>> This patch adds a mic_bypass option to bypass the mic
>>> from display out path. The mic(Mobile image compressor) compresses
>>> RGB data from fimd and send the compressed data to the mipi dsi.
>>> The bypass option can be founded from system register and the bit
>>> of the option is 11.
>>>
>>> Cc: Inki Dae 
>>> Cc: Joonyoung Shim 
>>> Cc: Seung-Woo Kim 
>>> Signed-off-by: Chanho Park 
>>> ---
>>>  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
>>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
>>> ++
>>>  2 files changed, 16 insertions(+)
>>>
>>> diff --git 
>>> a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
>>> b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>>> index 27c3ce0..7f90c4a 100644
>>> --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>>> +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>>> @@ -45,6 +45,8 @@ Optional Properties:
>>>   Can be used in case timings cannot be provided otherwise
>>>   or to override timings provided by the panel.
>>>  - samsung,sysreg: handle to syscon used to control the system registers
>>> +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
>>> path.

mic-bypass is not really common property for fimd family so it's not correct 
for fimd device node has mic-bypass property.

>>> +   This option is only available since exynos5420.
>>>  - i80-if-timings: timing configuration for lcd i80 interface support.
>>>- cs-setup: clock cycles for the active period of address signal is 
>>> enabled
>>>until chip select is enabled.
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
>>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> index 70194d0..4fb2952 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>> @@ -94,6 +94,7 @@ struct fimd_driver_data {
>>>   unsigned int lcdblk_offset;
>>>   unsigned int lcdblk_vt_shift;
>>>   unsigned int lcdblk_bypass_shift;
>>> + unsigned int lcdblk_mic_bypass_shift;
>>>
>>>   unsigned int has_shadowcon:1;
>>>   unsigned int has_clksel:1;
>>> @@ -140,6 +141,7 @@ static struct fimd_driver_data exynos5_fimd_driver_data 
>>> = {
>>>   .lcdblk_offset = 0x214,
>>>   .lcdblk_vt_shift = 24,
>>>   .lcdblk_bypass_shift = 15,
>>> + .lcdblk_mic_bypass_shift = 11,
>>>   .has_shadowcon = 1,
>>>   .has_vidoutcon = 1,
>>>   .has_vtsel = 1,
>>> @@ -162,6 +164,7 @@ struct fimd_context {
>>>   u32 i80ifcon;
>>>   booli80_if;
>>>   boolsuspended;
>>> + boolmic_bypass;
>>>   int pipe;
>>>   wait_queue_head_t   wait_vsync_queue;
>>>   atomic_twait_vsync_event;
>>> @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
>>>   return;
>>>   }
>>>
>>> + if (ctx->mic_bypass && ctx->sysreg && regmap_update_bits(ctx->sysreg,
>>> + driver_data->lcdblk_offset,
>>> + 0x1 << driver_data->lcdblk_mic_bypass_shift,
>>> + 0x1 << driver_data->lcdblk_mic_bypass_shift)) 
>>> {
>>> + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
>>> + return;
>>> + }
>>
>> It'd better to consider mic path also because mic bypass bit of lcdblk could 
>> be true by bootloader. In this case, fimd driver wouldn't do anything if 
>> mic_bypass property isn't declared but the mic_bypass bit of lcdblk register 
>> is still set to 1.
> 
> Actually, I wanted to set the bit on kernel side even though it's not
> assigned from bootloader.
> If the bootloader already set the bit, that means mic will be by-pass
> and we don't care about it from kernel side.
> The option is useful when I want to skip the mic on the kernel side.
> 
>>
>> For this, I think you could check lcdblk_mic_pypass_shift to identify 
>> whether mic path is supported or not like below,
>> if (ctx->lcdblk_mic_bypass_shift) {
> 
> It causes all exynos5 fimd driver skips the mic from display path.
> How about below patch instead of this?
> 
> +   if (of_property_read_bool(dev->of_node, "samsung,mic-bypass") &&
> +   ctx->driver_data->lcdblk_mic_bypass_shift)
> +   ctx->mic_bypass = true;

So let's bypass mic path in default like lcdblk_bypass,
/* set mic bypass selection */
if (ctx->has_mic_bypass && ctx->sysreg && 
reg

[PATCH 00/29] Enabling new DAL display driver for amdgpu on Carrizo and Tonga

2016-02-12 Thread Daniel Vetter
On Thu, Feb 11, 2016 at 10:06:14PM +0100, Daniel Vetter wrote:
> On Thu, Feb 11, 2016 at 9:52 PM, Dave Airlie  wrote:
> > On 12 February 2016 at 03:19, Harry Wentland  
> > wrote:
> >> This set of patches enables the new DAL display driver for amdgpu on 
> >> Carrizo
> >> Tonga, and Fiji ASICs. This driver will allow us going forward to bring
> >> display features on the open amdgpu driver (mostly) on par with the 
> >> Catalyst
> >> driver.
> >>
> >> This driver adds support for
> >> - Atomic KMS API
> >> - MST
> >> - HDMI 2.0
> >> - Better powerplay integration
> >> - Support of HW bandwidth formula on Carrizo
> >> - Better multi-display support and handling of co-functionality
> >> - Broader support of display dongles
> >> - Timing synchronization between DP and HDMI
> >>
> >> This patch series is based on Alex Deucher's drm-next-4.6-wip tree.
> >>
> > So the first minor criticism is this patch doesn't explain WHY.
> >
> > Why does the Linux kernel need 93k lines of code to run the displays
> > when whole drivers don't even come close.
> >
> > We've spent a lot of time ripping abstraction layers out of drivers (exynos
> > being the major one), what benefits does this major change bring to the
> > Linux kernel and the AMDGPU driver over and above a leaner, more focused
> > work.
> >
> > If were even to consider merging this it would be at a guess considered
> > staging level material which would require a TODO list of major cleanups.
> >
> > I do realise you've put a lot of work into this, but I think you are going 
> > to
> > get a lot of review pushback in the next few days and without knowing the
> > reasons this path was chosen it is going to be hard to take.
> 
> Yeah agreed, we need to figure out the why/how first. Assembling a
> de-staging TODO is imo a second step. And the problem with that is
> that before we can do a full TODO we need to remove all the os and drm
> abstractions. I found delayed_work, timer, memory handling, pixel
> formats (in multiple copies), the i2c stuff Rob noticed and there's
> more I'm sure. With all that I just can't even see how the main DAL
> structures connect and how that would sensibly map to drm concepts.
> Which is most likely needed to make DAL properly atomic.

More stuff plain duplicated I spotted:
- some edid handling (probably because of the duplicated i2c, but probably
  also because dal).
- has it's own infoframe encoding it seems
- home-grown logging. Yes, DRM_DEBUG isn't the most awesome, but dynamic
  prinkt is pretty neat from what I understand and we should just move
  DRM_DEBUG over to that if you need more flexibility.

Cheers, Daniel

> So de-staging DAL (if we decided this is the right approach) would be
> multi-stage, with removal of the abstractions not needed first, then
> taking a 2nd look and figuring out how to untangle the actual
> concepts.
> 
> Aside: If all this abstraction is to make dal run in userspace for
> testing or whatever - nouveau does this, we (Intel) want to do this
> too for unit-testing, so there's definitely room for sharing the
> tools. But the right approach imo is to just implement kernel services
> (like timers) in userspace.
> 
> Another thing is that some of the features in here (hdmi 2.0, improved
> dongle support) really should be in shared helpers. If we have that
> hidden behind the dal abstraction it'll be pretty much impossible
> (with major work, which is unreasonable to ask of other people trying
> to get their own driver in) to extract&share it. And for sink handling
> having multiple copies of the same code just doesn't make sense.
> 
> Anyway that's my quick thoughts from 2h of reading this. One wishlist:
> Some design overview or diagram how dal structures connect would be
> awesome as a reading aid.
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 08/10] drm/exynos: initialize DMA ops for virtual Exynos DRM device

2016-02-12 Thread Inki Dae
Hi Marek,

2016년 02월 03일 21:42에 Marek Szyprowski 이(가) 쓴 글:
> Virtual DRM device is used for memory allocation for GEM objects. On
> some architectures null dma operations are assigned for virtual devices
> if no explicit initialization has been made.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index 68f0f36..a33ea44 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -144,6 +144,7 @@ static int exynos_drm_load(struct drm_device *dev, 
> unsigned long flags)
>   init_waitqueue_head(&private->wait);
>   spin_lock_init(&private->lock);
>  
> + arch_setup_dma_ops(dev->dev, 0, DMA_BIT_MASK(32), false, false);

As you got the report, above function incurrs build error below,
ERROR: "arch_setup_dma_ops" [drivers/gpu/drm/exynos/exynosdrm.ko] undefined!

Exynos drm can be built as a module. In this case, arch_setup_dma_ops cannot be 
accessed by the module.

I could fix it easily like below but I'm not sure that it's reasonable.

+extern void arch_setup_dma_ops(struct device *dev, u64 dma_base,
+ u64 size, struct iommu_ops *iommu,
+ bool coherent) { };

Thanks,
Inki Dae

>   dev_set_drvdata(dev->dev, dev);
>   dev->dev_private = (void *)private;
>  
> 


[PATCH v3 2/2] drm: remove drm_device_is_unplugged and related code

2016-02-12 Thread Daniel Vetter
On Thu, Feb 11, 2016 at 01:57:30PM -0800, Haixia Shi wrote:
> When a UDL monitor is unplugged, we need to still treat it as a fully
> functional device which just happens to have its connector unplugged.
> This allows user-space to properly deallocate fbs and dumb buffers
> before closing the device.
> 
> This drops the "unplugged" flag hack, which puts the device in a
> non-functional state after USB unplug and rejects most operations on
> the device such as ioctls with error -ENODEV.
> 
> Signed-off-by: Haixia Shi 
> Reviewed-by: Stéphane Marchesin 
> Cc: David Herrmann 

Still missing the in-patch changelog. Please add something like

v2:

 changes done for v2, and who suggested it

v3:

... changes done for v3.

Thanks, Daniel

> ---
>  drivers/gpu/drm/drm_drv.c   |  6 --
>  drivers/gpu/drm/drm_fops.c  |  2 --
>  drivers/gpu/drm/drm_gem.c   |  3 ---
>  drivers/gpu/drm/drm_ioctl.c |  3 ---
>  drivers/gpu/drm/drm_vm.c|  3 ---
>  drivers/gpu/drm/udl/udl_connector.c |  2 --
>  drivers/gpu/drm/udl/udl_fb.c|  6 --
>  include/drm/drmP.h  | 14 --
>  8 files changed, 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 167c8d3..f93ee12 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -376,9 +376,6 @@ struct drm_minor *drm_minor_acquire(unsigned int minor_id)
>  
>   if (!minor) {
>   return ERR_PTR(-ENODEV);
> - } else if (drm_device_is_unplugged(minor->dev)) {
> - drm_dev_unref(minor->dev);
> - return ERR_PTR(-ENODEV);
>   }
>  
>   return minor;
> @@ -464,9 +461,6 @@ void drm_unplug_dev(struct drm_device *dev)
>   drm_minor_unregister(dev, DRM_MINOR_CONTROL);
>  
>   mutex_lock(&drm_global_mutex);
> -
> - drm_device_set_unplugged(dev);
> -
>   if (dev->open_count == 0) {
>   drm_put_dev(dev);
>   }
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 1ea8790..b4332d4 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -497,8 +497,6 @@ int drm_release(struct inode *inode, struct file *filp)
>  
>   if (!--dev->open_count) {
>   retcode = drm_lastclose(dev);
> - if (drm_device_is_unplugged(dev))
> - drm_put_dev(dev);
>   }
>   mutex_unlock(&drm_global_mutex);
>  
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 2e8c77e..c622e32 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -900,9 +900,6 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct 
> *vma)
>   struct drm_vma_offset_node *node;
>   int ret;
>  
> - if (drm_device_is_unplugged(dev))
> - return -ENODEV;
> -
>   drm_vma_offset_lock_lookup(dev->vma_offset_manager);
>   node = drm_vma_offset_exact_lookup_locked(dev->vma_offset_manager,
> vma->vm_pgoff,
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 8ce2a0c..f959074 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -695,9 +695,6 @@ long drm_ioctl(struct file *filp,
>  
>   dev = file_priv->minor->dev;
>  
> - if (drm_device_is_unplugged(dev))
> - return -ENODEV;
> -
>   is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END;
>  
>   if (is_driver_ioctl) {
> diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
> index f90bd5f..3a68be4 100644
> --- a/drivers/gpu/drm/drm_vm.c
> +++ b/drivers/gpu/drm/drm_vm.c
> @@ -657,9 +657,6 @@ int drm_legacy_mmap(struct file *filp, struct 
> vm_area_struct *vma)
>   struct drm_device *dev = priv->minor->dev;
>   int ret;
>  
> - if (drm_device_is_unplugged(dev))
> - return -ENODEV;
> -
>   mutex_lock(&dev->struct_mutex);
>   ret = drm_mmap_locked(filp, vma);
>   mutex_unlock(&dev->struct_mutex);
> diff --git a/drivers/gpu/drm/udl/udl_connector.c 
> b/drivers/gpu/drm/udl/udl_connector.c
> index 4709b54..a6d5e21 100644
> --- a/drivers/gpu/drm/udl/udl_connector.c
> +++ b/drivers/gpu/drm/udl/udl_connector.c
> @@ -96,8 +96,6 @@ static int udl_mode_valid(struct drm_connector *connector,
>  static enum drm_connector_status
>  udl_detect(struct drm_connector *connector, bool force)
>  {
> - if (drm_device_is_unplugged(connector->dev))
> - return connector_status_disconnected;
>   return connector_status_connected;
>  }
>  
> diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
> index 200419d..29aca6c 100644
> --- a/drivers/gpu/drm/udl/udl_fb.c
> +++ b/drivers/gpu/drm/udl/udl_fb.c
> @@ -321,12 +321,6 @@ static void udl_fb_imageblit(struct fb_info *info, const 
> struct fb_image *image)
>  static int udl_fb_open(struct fb_info *info, int user)
>  {
>   struct udl_fbdev *ufbdev = info->par

[PATCH] drm/exynos/decon: fix disable clocks order

2016-02-12 Thread Inki Dae
Picked it up.

Thanks,
Inki Dae

2016년 02월 11일 20:25에 Andrzej Hajda 이(가) 쓴 글:
> Decon requires that clocks should be disabled in reverse order. Otherwise
> system hangs.
> 
> Signed-off-by: Andrzej Hajda 
> ---
>  drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c 
> b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> index 1bf6a21..98615e2 100644
> --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c
> @@ -582,9 +582,9 @@ out:
>  static int exynos5433_decon_suspend(struct device *dev)
>  {
>   struct decon_context *ctx = dev_get_drvdata(dev);
> - int i;
> + int i = ARRAY_SIZE(decon_clks_name);
>  
> - for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++)
> + while (--i >= 0)
>   clk_disable_unprepare(ctx->clks[i]);
>  
>   return 0;
> 


[PATCH] drm/exynos: fix incorrect cpu address for dma_mmap_attrs()

2016-02-12 Thread Inki Dae
Picked it up.

Thanks,
Inki Dae

2016년 02월 11일 20:32에 Marek Szyprowski 이(가) 쓴 글:
> dma_mmap_attrs() should be called with cpu address returned by
> dma_alloc_attrs(). Existing code however passed pages array base as cpu
> address. This worked only by a pure luck on ARM architecture. This patch
> fixes this issue.
> 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 2 +-
>  drivers/gpu/drm/exynos/exynos_drm_gem.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> index f6118ba..8baabd8 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -50,7 +50,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
>   if (vm_size > exynos_gem->size)
>   return -EINVAL;
>  
> - ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->pages,
> + ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->cookie,
>exynos_gem->dma_addr, exynos_gem->size,
>&exynos_gem->dma_attrs);
>   if (ret < 0) {
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c 
> b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> index 47d126a..26b5e4b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
> @@ -335,7 +335,7 @@ static int exynos_drm_gem_mmap_buffer(struct 
> exynos_drm_gem *exynos_gem,
>   if (vm_size > exynos_gem->size)
>   return -EINVAL;
>  
> - ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->pages,
> + ret = dma_mmap_attrs(drm_dev->dev, vma, exynos_gem->cookie,
>exynos_gem->dma_addr, exynos_gem->size,
>&exynos_gem->dma_attrs);
>   if (ret < 0) {
> 


[PULL] drm-intel-fixes

2016-02-12 Thread Jani Nikula

Hi Dave -

Intel fixes all around, mostly display. Sorry I'm late this week.

BR,
Jani.

The following changes since commit 388f7b1d6e8ca06762e2454d28d6c3c55ad0fe95:

  Linux 4.5-rc3 (2016-02-07 15:38:30 -0800)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/drm-intel-fixes-2016-02-12

for you to fetch changes up to ed3f9fd1e865975ceefdb2a43b453e090b1fd787:

  drm/i915: fix error path in intel_setup_gmbus() (2016-02-10 18:11:34 +0200)


Chris Wilson (1):
  drm/i915: Allow i915_gem_object_get_page() on userptr as well

Jani Nikula (5):
  drm/i915/dsi: defend gpio table against out of bounds access
  drm/i915/dsi: don't pass arbitrary data to sideband
  drm/i915/dsi: skip gpio element execution when not supported
  drm/i915/dp: abstract training pattern selection
  drm/i915/dp: reduce missing TPS3 support errors to debug logging

Lyude (2):
  drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
  drm/i915/skl: Fix typo in DPLL_CFGCR1 definition

Matt Roper (2):
  drm/i915/bxt: Don't save/restore eDP panel power during suspend (v3)
  drm/i915: Pretend cursor is always on for ILK-style WM calculations (v2)

Rasmus Villemoes (1):
  drm/i915: fix error path in intel_setup_gmbus()

 drivers/gpu/drm/i915/i915_drv.h   |  4 +++
 drivers/gpu/drm/i915/i915_gem.c   |  3 +-
 drivers/gpu/drm/i915/i915_gem_userptr.c   |  3 +-
 drivers/gpu/drm/i915/i915_reg.h   |  2 +-
 drivers/gpu/drm/i915/i915_suspend.c   |  4 +--
 drivers/gpu/drm/i915/intel_ddi.c  |  3 +-
 drivers/gpu/drm/i915/intel_dp_link_training.c | 45 +++
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c| 21 -
 drivers/gpu/drm/i915/intel_i2c.c  |  2 +-
 drivers/gpu/drm/i915/intel_pm.c   | 14 ++---
 10 files changed, 75 insertions(+), 26 deletions(-)

-- 
Jani Nikula, Intel Open Source Technology Center


[PATCH] radeon: Define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP for consistency and readability - libdrm

2016-02-12 Thread Michel Dänzer
On 12.02.2016 09:32, Alexandre Demers wrote:
> ---
>  include/drm/radeon_drm.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
> index cd31794..e57640a 100644
> --- a/include/drm/radeon_drm.h
> +++ b/include/drm/radeon_drm.h
> @@ -1026,6 +1026,7 @@ struct drm_radeon_info {
>  #define SI_TILE_MODE_COLOR_2D_16BPP  15
>  #define SI_TILE_MODE_COLOR_2D_32BPP  16
>  #define SI_TILE_MODE_COLOR_2D_64BPP  17
> +#define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP   10
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP  11
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP  12
>  #define SI_TILE_MODE_DEPTH_STENCIL_1D4
> 

The define itself looks good, thanks, but please don't append " -
libdrm" to the subject, or that'll get preserved in the Git shortlog.
The way to indicate the repository a patch is for is in the [PATCH]
prefix, e.g. in this case [PATCH libdrm].


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH] radeon: Define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP for consistency and readability

2016-02-12 Thread Michel Dänzer
On 12.02.2016 09:29, Alexandre Demers wrote:
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c | 2 +-
>  include/uapi/drm/radeon_drm.h  | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c 
> b/drivers/gpu/drm/radeon/atombios_crtc.c
> index 801dd60..c88f9fe 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -1287,7 +1287,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
>   } else {
>   switch (target_fb->bits_per_pixel) {
>   case 8:
> - index = 10;
> + index = 
> SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP;
>   break;
>   case 16:
>   index = 
> SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP;
> diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
> index ccb9bcd..407a092 100644
> --- a/include/uapi/drm/radeon_drm.h
> +++ b/include/uapi/drm/radeon_drm.h
> @@ -1057,6 +1057,7 @@ struct drm_radeon_info {
>  #define SI_TILE_MODE_COLOR_2D_16BPP  15
>  #define SI_TILE_MODE_COLOR_2D_32BPP  16
>  #define SI_TILE_MODE_COLOR_2D_64BPP  17
> +#define SI_TILE_MODE_COLOR_2D_SCANOUT_8BPP   10
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_16BPP  11
>  #define SI_TILE_MODE_COLOR_2D_SCANOUT_32BPP  12
>  #define SI_TILE_MODE_DEPTH_STENCIL_1D4
> 

The shortlog (subject line) is a bit long, but other than that,

Reviewed-by: Michel Dänzer 


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Chanho Park
Hi,

On Fri, Feb 12, 2016 at 1:56 PM, Inki Dae  wrote:
> Hi Chanho,
>
> There was a missing one so below is my review again.
>
> 2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
>> Hi Inki,
>>
>> On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
>>> Hi Chanho,
>>>
>>> 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
 From: Chanho Park 

 This patch adds a mic_bypass option to bypass the mic
 from display out path. The mic(Mobile image compressor) compresses
 RGB data from fimd and send the compressed data to the mipi dsi.
 The bypass option can be founded from system register and the bit
 of the option is 11.

 Cc: Inki Dae 
 Cc: Joonyoung Shim 
 Cc: Seung-Woo Kim 
 Signed-off-by: Chanho Park 
 ---
  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
 ++
  2 files changed, 16 insertions(+)

 diff --git 
 a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
 b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
 index 27c3ce0..7f90c4a 100644
 --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
 +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
 @@ -45,6 +45,8 @@ Optional Properties:
   Can be used in case timings cannot be provided otherwise
   or to override timings provided by the panel.
  - samsung,sysreg: handle to syscon used to control the system registers
 +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
 path.
>
> mic-bypass is not really common property for fimd family so it's not correct 
> for fimd device node has mic-bypass property.

According to user manual of exynos, the option has been introduced
since exynos5420.
The exynos5420 and exynos5422(5800) have a fimd controller not decon
display controller.

>
 +   This option is only available since exynos5420.
  - i80-if-timings: timing configuration for lcd i80 interface support.
- cs-setup: clock cycles for the active period of address signal is 
 enabled
until chip select is enabled.
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 70194d0..4fb2952 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -94,6 +94,7 @@ struct fimd_driver_data {
   unsigned int lcdblk_offset;
   unsigned int lcdblk_vt_shift;
   unsigned int lcdblk_bypass_shift;
 + unsigned int lcdblk_mic_bypass_shift;

   unsigned int has_shadowcon:1;
   unsigned int has_clksel:1;
 @@ -140,6 +141,7 @@ static struct fimd_driver_data 
 exynos5_fimd_driver_data = {
   .lcdblk_offset = 0x214,
   .lcdblk_vt_shift = 24,
   .lcdblk_bypass_shift = 15,
 + .lcdblk_mic_bypass_shift = 11,
   .has_shadowcon = 1,
   .has_vidoutcon = 1,
   .has_vtsel = 1,
 @@ -162,6 +164,7 @@ struct fimd_context {
   u32 i80ifcon;
   booli80_if;
   boolsuspended;
 + boolmic_bypass;
   int pipe;
   wait_queue_head_t   wait_vsync_queue;
   atomic_twait_vsync_event;
 @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
   return;
   }

 + if (ctx->mic_bypass && ctx->sysreg && regmap_update_bits(ctx->sysreg,
 + driver_data->lcdblk_offset,
 + 0x1 << driver_data->lcdblk_mic_bypass_shift,
 + 0x1 << 
 driver_data->lcdblk_mic_bypass_shift)) {
 + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
 + return;
 + }
>>>
>>> It'd better to consider mic path also because mic bypass bit of lcdblk 
>>> could be true by bootloader. In this case, fimd driver wouldn't do anything 
>>> if mic_bypass property isn't declared but the mic_bypass bit of lcdblk 
>>> register is still set to 1.
>>
>> Actually, I wanted to set the bit on kernel side even though it's not
>> assigned from bootloader.
>> If the bootloader already set the bit, that means mic will be by-pass
>> and we don't care about it from kernel side.
>> The option is useful when I want to skip the mic on the kernel side.
>>
>>>
>>> For this, I think you could check lcdblk_mic_pypass_shift to identify 
>>> whether mic path is supported or not like below,
>>> if (ctx->lcdblk_mic_bypass_shift) {
>>
>> It causes all exynos5 fimd driver skips the mic from display path.
>> How about below patch i

[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Inki Dae
Hi Chanho,

2016년 02월 12일 16:39에 Chanho Park 이(가) 쓴 글:
> Hi,
> 
> On Fri, Feb 12, 2016 at 1:56 PM, Inki Dae  wrote:
>> Hi Chanho,
>>
>> There was a missing one so below is my review again.
>>
>> 2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
>>> Hi Inki,
>>>
>>> On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
 Hi Chanho,

 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
> From: Chanho Park 
>
> This patch adds a mic_bypass option to bypass the mic
> from display out path. The mic(Mobile image compressor) compresses
> RGB data from fimd and send the compressed data to the mipi dsi.
> The bypass option can be founded from system register and the bit
> of the option is 11.
>
> Cc: Inki Dae 
> Cc: Joonyoung Shim 
> Cc: Seung-Woo Kim 
> Signed-off-by: Chanho Park 
> ---
>  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
> ++
>  2 files changed, 16 insertions(+)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
> b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
> index 27c3ce0..7f90c4a 100644
> --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
> +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
> @@ -45,6 +45,8 @@ Optional Properties:
>   Can be used in case timings cannot be provided otherwise
>   or to override timings provided by the panel.
>  - samsung,sysreg: handle to syscon used to control the system registers
> +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
> path.
>>
>> mic-bypass is not really common property for fimd family so it's not correct 
>> for fimd device node has mic-bypass property.
> 
> According to user manual of exynos, the option has been introduced
> since exynos5420.

That is why samsung-fimd.txt is not correct place. samsung-fimd.txt describes 
hardware information for s3c24xx, s3c64xx also, which don't have mic ip.

> The exynos5420 and exynos5422(5800) have a fimd controller not decon
> display controller.
> 
>>
> +   This option is only available since exynos5420.
>  - i80-if-timings: timing configuration for lcd i80 interface support.
>- cs-setup: clock cycles for the active period of address signal is 
> enabled
>until chip select is enabled.
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index 70194d0..4fb2952 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -94,6 +94,7 @@ struct fimd_driver_data {
>   unsigned int lcdblk_offset;
>   unsigned int lcdblk_vt_shift;
>   unsigned int lcdblk_bypass_shift;
> + unsigned int lcdblk_mic_bypass_shift;
>
>   unsigned int has_shadowcon:1;
>   unsigned int has_clksel:1;
> @@ -140,6 +141,7 @@ static struct fimd_driver_data 
> exynos5_fimd_driver_data = {
>   .lcdblk_offset = 0x214,
>   .lcdblk_vt_shift = 24,
>   .lcdblk_bypass_shift = 15,
> + .lcdblk_mic_bypass_shift = 11,
>   .has_shadowcon = 1,
>   .has_vidoutcon = 1,
>   .has_vtsel = 1,
> @@ -162,6 +164,7 @@ struct fimd_context {
>   u32 i80ifcon;
>   booli80_if;
>   boolsuspended;
> + boolmic_bypass;
>   int pipe;
>   wait_queue_head_t   wait_vsync_queue;
>   atomic_twait_vsync_event;
> @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
>   return;
>   }
>
> + if (ctx->mic_bypass && ctx->sysreg && 
> regmap_update_bits(ctx->sysreg,
> + driver_data->lcdblk_offset,
> + 0x1 << driver_data->lcdblk_mic_bypass_shift,
> + 0x1 << 
> driver_data->lcdblk_mic_bypass_shift)) {
> + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
> + return;
> + }

 It'd better to consider mic path also because mic bypass bit of lcdblk 
 could be true by bootloader. In this case, fimd driver wouldn't do 
 anything if mic_bypass property isn't declared but the mic_bypass bit of 
 lcdblk register is still set to 1.
>>>
>>> Actually, I wanted to set the bit on kernel side even though it's not
>>> assigned from bootloader.
>>> If the bootloader already set the bit, that means mic will be by-pass
>>> and we don't care about it from kernel 

[PATCH] drm/exynos: add mic_bypass option for exynos542x fimd

2016-02-12 Thread Chanho Park
Hi,

On Fri, Feb 12, 2016 at 5:04 PM, Inki Dae  wrote:
> Hi Chanho,
>
> 2016년 02월 12일 16:39에 Chanho Park 이(가) 쓴 글:
>> Hi,
>>
>> On Fri, Feb 12, 2016 at 1:56 PM, Inki Dae  wrote:
>>> Hi Chanho,
>>>
>>> There was a missing one so below is my review again.
>>>
>>> 2016년 02월 11일 22:59에 Chanho Park 이(가) 쓴 글:
 Hi Inki,

 On Thu, Feb 11, 2016 at 7:37 PM, Inki Dae  wrote:
> Hi Chanho,
>
> 2016년 01월 30일 22:58에 Chanho Park 이(가) 쓴 글:
>> From: Chanho Park 
>>
>> This patch adds a mic_bypass option to bypass the mic
>> from display out path. The mic(Mobile image compressor) compresses
>> RGB data from fimd and send the compressed data to the mipi dsi.
>> The bypass option can be founded from system register and the bit
>> of the option is 11.
>>
>> Cc: Inki Dae 
>> Cc: Joonyoung Shim 
>> Cc: Seung-Woo Kim 
>> Signed-off-by: Chanho Park 
>> ---
>>  .../devicetree/bindings/display/exynos/samsung-fimd.txt|  2 ++
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 14 
>> ++
>>  2 files changed, 16 insertions(+)
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
>> b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>> index 27c3ce0..7f90c4a 100644
>> --- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>> +++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
>> @@ -45,6 +45,8 @@ Optional Properties:
>>   Can be used in case timings cannot be provided otherwise
>>   or to override timings provided by the panel.
>>  - samsung,sysreg: handle to syscon used to control the system registers
>> +- samsung,mic-bypass: bypass mic(mobile image compressor) from display 
>> path.
>>>
>>> mic-bypass is not really common property for fimd family so it's not 
>>> correct for fimd device node has mic-bypass property.
>>
>> According to user manual of exynos, the option has been introduced
>> since exynos5420.
>
> That is why samsung-fimd.txt is not correct place. samsung-fimd.txt describes 
> hardware information for s3c24xx, s3c64xx also, which don't have mic ip.

Yes. I just described the option's limitation like below.

>
>> The exynos5420 and exynos5422(5800) have a fimd controller not decon
>> display controller.
>>
>>>
>> +   This option is only available since exynos5420.

I described the limitation in here.

>>  - i80-if-timings: timing configuration for lcd i80 interface support.
>>- cs-setup: clock cycles for the active period of address signal is 
>> enabled
>>until chip select is enabled.
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 70194d0..4fb2952 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -94,6 +94,7 @@ struct fimd_driver_data {
>>   unsigned int lcdblk_offset;
>>   unsigned int lcdblk_vt_shift;
>>   unsigned int lcdblk_bypass_shift;
>> + unsigned int lcdblk_mic_bypass_shift;
>>
>>   unsigned int has_shadowcon:1;
>>   unsigned int has_clksel:1;
>> @@ -140,6 +141,7 @@ static struct fimd_driver_data 
>> exynos5_fimd_driver_data = {
>>   .lcdblk_offset = 0x214,
>>   .lcdblk_vt_shift = 24,
>>   .lcdblk_bypass_shift = 15,
>> + .lcdblk_mic_bypass_shift = 11,
>>   .has_shadowcon = 1,
>>   .has_vidoutcon = 1,
>>   .has_vtsel = 1,
>> @@ -162,6 +164,7 @@ struct fimd_context {
>>   u32 i80ifcon;
>>   booli80_if;
>>   boolsuspended;
>> + boolmic_bypass;
>>   int pipe;
>>   wait_queue_head_t   wait_vsync_queue;
>>   atomic_twait_vsync_event;
>> @@ -461,6 +464,14 @@ static void fimd_commit(struct exynos_drm_crtc 
>> *crtc)
>>   return;
>>   }
>>
>> + if (ctx->mic_bypass && ctx->sysreg && 
>> regmap_update_bits(ctx->sysreg,
>> + driver_data->lcdblk_offset,
>> + 0x1 << 
>> driver_data->lcdblk_mic_bypass_shift,
>> + 0x1 << 
>> driver_data->lcdblk_mic_bypass_shift)) {
>> + DRM_ERROR("Failed to update sysreg for bypass mic.\n");
>> + return;
>> + }
>
> It'd better to consider mic path also because mic bypass bit of lcdblk 
> could be true by bootloader. In this case, fimd driver wouldn't do 
> anything if mic_bypass property isn't declared but the m

[PATCH 08/10] drm/exynos: initialize DMA ops for virtual Exynos DRM device

2016-02-12 Thread Marek Szyprowski
Hello,

On 2016-02-12 06:55, Inki Dae wrote:
> Hi Marek,
>
> 2016년 02월 03일 21:42에 Marek Szyprowski 이(가) 쓴 글:
>> Virtual DRM device is used for memory allocation for GEM objects. On
>> some architectures null dma operations are assigned for virtual devices
>> if no explicit initialization has been made.
>>
>> Signed-off-by: Marek Szyprowski 
>> ---
>>   drivers/gpu/drm/exynos/exynos_drm_drv.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> index 68f0f36..a33ea44 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> @@ -144,6 +144,7 @@ static int exynos_drm_load(struct drm_device *dev, 
>> unsigned long flags)
>>  init_waitqueue_head(&private->wait);
>>  spin_lock_init(&private->lock);
>>   
>> +arch_setup_dma_ops(dev->dev, 0, DMA_BIT_MASK(32), false, false);
> As you got the report, above function incurrs build error below,
> ERROR: "arch_setup_dma_ops" [drivers/gpu/drm/exynos/exynosdrm.ko] undefined!
>
> Exynos drm can be built as a module. In this case, arch_setup_dma_ops cannot 
> be accessed by the module.
>
> I could fix it easily like below but I'm not sure that it's reasonable.
>
> +extern void arch_setup_dma_ops(struct device *dev, u64 dma_base,
> + u64 size, struct iommu_ops *iommu,
> + bool coherent) { };

I don't think this is a good idea - the result will be same as not applying
the patch at all. Please drop this patch for now, I will rework it while
adding support for generic IOMMU for ARM and ARM64.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland



[PATCH 0/5] drm/sti: planes bug fixes and improvment

2016-02-12 Thread Vincent Abriou
This set of patch is about planes.
It bring the support of the atomic_check for the planes.
It also fix some bugs around cursor and gdp.

Bich Hemon (2):
  drm/sti: fallback for GDP scaling
  drm/sti: adapt YUV colorspace in display pipeline

Fabien Dessenne (1):
  drm/sti: force cursor CLUT fetch

Vincent Abriou (2):
  drm/sti: GDP cropping fails when we remove 2 pixels horizontally
  drm/sti: implement atomic_check for the planes

 drivers/gpu/drm/sti/sti_cursor.c | 101 +++---
 drivers/gpu/drm/sti/sti_gdp.c| 216 +--
 drivers/gpu/drm/sti/sti_hqvdp.c  | 175 +++
 drivers/gpu/drm/sti/sti_tvout.c  |  61 +++
 drivers/gpu/drm/sti/sti_vid.c|  31 --
 5 files changed, 373 insertions(+), 211 deletions(-)

-- 
1.9.1



[PATCH 1/5] drm/sti: fallback for GDP scaling

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

When a GDP gets a scale request (which it does not support), it accepts it
but crops or clamps and outputs a warning message.

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_gdp.c | 36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index a34284be..0a696ad 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -361,6 +361,31 @@ static void sti_gdp_init(struct sti_gdp *gdp)
}
 }

+/**
+ * sti_gdp_get_dst
+ * @dev: device
+ * @dst: requested destination size
+ * @src: source size
+ *
+ * Return the cropped / clamped destination size
+ *
+ * RETURNS:
+ * cropped / clamped destination size
+ */
+static int sti_gdp_get_dst(struct device *dev, int dst, int src)
+{
+   if (dst == src)
+   return dst;
+
+   if (dst < src) {
+   dev_dbg(dev, "WARNING: GDP scale not supported, will crop\n");
+   return dst;
+   }
+
+   dev_dbg(dev, "WARNING: GDP scale not supported, will clamp\n");
+   return src;
+}
+
 static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
  struct drm_plane_state *oldstate)
 {
@@ -399,8 +424,8 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,
/* src_x are in 16.16 format */
src_x = state->src_x >> 16;
src_y = state->src_y >> 16;
-   src_w = state->src_w >> 16;
-   src_h = state->src_h >> 16;
+   src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX);
+   src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX);

DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
  crtc->base.id, sti_mixer_to_str(mixer),
@@ -448,10 +473,11 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,

/* input parameters */
top_field->gam_gdp_pmp = fb->pitches[0];
-   top_field->gam_gdp_size = clamp_val(src_h, 0, GAM_GDP_SIZE_MAX) << 16 |
- clamp_val(src_w, 0, GAM_GDP_SIZE_MAX);
+   top_field->gam_gdp_size = src_h << 16 | src_w;

-   /* output parameters */
+   /* output parameters (clamped / cropped) */
+   dst_w = sti_gdp_get_dst(gdp->dev, dst_w, src_w);
+   dst_h = sti_gdp_get_dst(gdp->dev, dst_h, src_h);
ydo = sti_vtg_get_line_number(*mode, dst_y);
yds = sti_vtg_get_line_number(*mode, dst_y + dst_h - 1);
xdo = sti_vtg_get_pixel_number(*mode, dst_x);
-- 
1.9.1



[PATCH 2/5] drm/sti: GDP cropping fails when we remove 2 pixels horizontally

2016-02-12 Thread Vincent Abriou
GDP source width should be equal to the destination width to get
rid of this issue.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_gdp.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 0a696ad..6c1a695 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -471,10 +471,6 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,
top_field->gam_gdp_pml += src_x * (bpp >> 3);
top_field->gam_gdp_pml += src_y * fb->pitches[0];

-   /* input parameters */
-   top_field->gam_gdp_pmp = fb->pitches[0];
-   top_field->gam_gdp_size = src_h << 16 | src_w;
-
/* output parameters (clamped / cropped) */
dst_w = sti_gdp_get_dst(gdp->dev, dst_w, src_w);
dst_h = sti_gdp_get_dst(gdp->dev, dst_h, src_h);
@@ -485,6 +481,11 @@ static void sti_gdp_atomic_update(struct drm_plane 
*drm_plane,
top_field->gam_gdp_vpo = (ydo << 16) | xdo;
top_field->gam_gdp_vps = (yds << 16) | xds;

+   /* input parameters */
+   src_w = dst_w;
+   top_field->gam_gdp_pmp = fb->pitches[0];
+   top_field->gam_gdp_size = src_h << 16 | src_w;
+
/* Same content and chained together */
memcpy(btm_field, top_field, sizeof(*btm_field));
top_field->gam_gdp_nvn = list->btm_field_paddr;
-- 
1.9.1



[PATCH 3/5] drm/sti: force cursor CLUT fetch

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

It may happen that the cursor is displayed with wrong colors which can
be explained by a CLUT wrongly fetched at the first display.
Fetching the CLUT at each commit (=move) ensures that the right colors
are used, at least from the first cursor move.

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_cursor.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index a19693a..8cac640 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -127,7 +127,6 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
/* src_x are in 16.16 format */
int src_w = state->src_w >> 16;
int src_h = state->src_h >> 16;
-   bool first_prepare = plane->status == STI_PLANE_DISABLED ? true : false;
struct drm_gem_cma_object *cma_obj;
u32 y, x;
u32 val;
@@ -193,12 +192,6 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
val = y << 16 | x;
writel(val, cursor->regs + CUR_AWE);

-   if (first_prepare) {
-   /* Set and fetch CLUT */
-   writel(cursor->clut_paddr, cursor->regs + CUR_CML);
-   writel(CUR_CTL_CLUT_UPDATE, cursor->regs + CUR_CTL);
-   }
-
/* Set memory location, size, and position */
writel(cursor->pixmap.paddr, cursor->regs + CUR_PML);
writel(cursor->width, cursor->regs + CUR_PMP);
@@ -208,6 +201,10 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
x = sti_vtg_get_pixel_number(*mode, dst_x);
writel((y << 16) | x, cursor->regs + CUR_VPO);

+   /* Set and fetch CLUT */
+   writel(cursor->clut_paddr, cursor->regs + CUR_CML);
+   writel(CUR_CTL_CLUT_UPDATE, cursor->regs + CUR_CTL);
+
plane->status = STI_PLANE_UPDATED;
 }

-- 
1.9.1



[PATCH 4/5] drm/sti: implement atomic_check for the planes

2016-02-12 Thread Vincent Abriou
Atomic update should never fail. Thus all checks must be done in
the atomic_check function for each plane (gdp, hqvdp and cursor).

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_cursor.c |  90 +---
 drivers/gpu/drm/sti/sti_gdp.c| 173 ++
 drivers/gpu/drm/sti/sti_hqvdp.c  | 175 ---
 3 files changed, 270 insertions(+), 168 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 8cac640..a4c67ab 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -5,12 +5,10 @@
  *  for STMicroelectronics.
  * License terms:  GNU General Public License (GPL), version 2
  */
-#include 

-#include 
+#include 
 #include 
 #include 
-#include 

 #include "sti_compositor.h"
 #include "sti_cursor.h"
@@ -110,34 +108,31 @@ static void sti_cursor_init(struct sti_cursor *cursor)
  (b * 5);
 }

-static void sti_cursor_atomic_update(struct drm_plane *drm_plane,
-struct drm_plane_state *oldstate)
+static int sti_cursor_atomic_check(struct drm_plane *drm_plane,
+  struct drm_plane_state *state)
 {
-   struct drm_plane_state *state = drm_plane->state;
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_cursor *cursor = to_sti_cursor(plane);
struct drm_crtc *crtc = state->crtc;
-   struct sti_mixer *mixer = to_sti_mixer(crtc);
struct drm_framebuffer *fb = state->fb;
-   struct drm_display_mode *mode = &crtc->mode;
-   int dst_x = state->crtc_x;
-   int dst_y = state->crtc_y;
-   int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-   int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+   struct drm_crtc_state *crtc_state;
+   struct drm_display_mode *mode;
+   int dst_x, dst_y, dst_w, dst_h;
+   int src_w, src_h;
+
+   /* no need for further checks if the plane is being disabled */
+   if (!crtc || !fb)
+   return 0;
+
+   crtc_state = drm_atomic_get_crtc_state(state->state, crtc);
+   mode = &crtc_state->mode;
+   dst_x = state->crtc_x;
+   dst_y = state->crtc_y;
+   dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
+   dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
/* src_x are in 16.16 format */
-   int src_w = state->src_w >> 16;
-   int src_h = state->src_h >> 16;
-   struct drm_gem_cma_object *cma_obj;
-   u32 y, x;
-   u32 val;
-
-   DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
- crtc->base.id, sti_mixer_to_str(mixer),
- drm_plane->base.id, sti_plane_to_str(plane));
-   DRM_DEBUG_KMS("(%dx%d)@(%d,%d)\n", dst_w, dst_h, dst_x, dst_y);
-
-   dev_dbg(cursor->dev, "%s %s\n", __func__,
-   sti_plane_to_str(plane));
+   src_w = state->src_w >> 16;
+   src_h = state->src_h >> 16;

if (src_w < STI_CURS_MIN_SIZE ||
src_h < STI_CURS_MIN_SIZE ||
@@ -145,7 +140,7 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
src_h > STI_CURS_MAX_SIZE) {
DRM_ERROR("Invalid cursor size (%dx%d)\n",
src_w, src_h);
-   return;
+   return -EINVAL;
}

/* If the cursor size has changed, re-allocated the pixmap */
@@ -169,16 +164,46 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
GFP_KERNEL | GFP_DMA);
if (!cursor->pixmap.base) {
DRM_ERROR("Failed to allocate memory for pixmap\n");
-   return;
+   return -EINVAL;
}
}

-   cma_obj = drm_fb_cma_get_gem_obj(fb, 0);
-   if (!cma_obj) {
+   if (!drm_fb_cma_get_gem_obj(fb, 0)) {
DRM_ERROR("Can't get CMA GEM object for fb\n");
-   return;
+   return -EINVAL;
}

+   DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
+ crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)),
+ drm_plane->base.id, sti_plane_to_str(plane));
+   DRM_DEBUG_KMS("(%dx%d)@(%d,%d)\n", dst_w, dst_h, dst_x, dst_y);
+
+   return 0;
+}
+
+static void sti_cursor_atomic_update(struct drm_plane *drm_plane,
+struct drm_plane_state *oldstate)
+{
+   struct drm_plane_state *state = drm_plane->state;
+   struct sti_plane *plane = to_sti_plane(drm_plane);
+   struct sti_cursor *cursor = to_sti_cursor(plane);
+   struct drm_crtc *crtc = state->crtc;
+   struct drm_framebuffer *fb = state->fb;
+   struct drm_display_mode *mode;
+   int dst_x, dst_y;
+   struct drm_gem_cma_o

[PATCH 5/5] drm/sti: adapt YUV colorspace in display pipeline

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

Use BT601 for SD/ED resolution and BT709 for HD resolution

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_tvout.c | 61 ++---
 drivers/gpu/drm/sti/sti_vid.c   | 31 +
 2 files changed, 64 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 4c52259..1c27a2c 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -95,6 +95,8 @@

 #define ENCODER_CRTC_MASK(BIT(0) | BIT(1))

+#define TVO_MIN_HD_HEIGHT720
+
 /* enum listing the supported output data format */
 enum sti_tvout_video_out_type {
STI_TVOUT_VIDEO_OUT_RGB,
@@ -258,6 +260,31 @@ static void tvout_vip_set_in_vid_fmt(struct sti_tvout 
*tvout,
 }

 /**
+ * Set preformatter matrix
+ *
+ * @tvout: tvout structure
+ * @mode: display mode structure
+ */
+static void tvout_preformatter_set_matrix(struct sti_tvout *tvout,
+ struct drm_display_mode *mode)
+{
+   unsigned int i;
+   const u32 *pf_matrix;
+
+   if (mode->vdisplay >= TVO_MIN_HD_HEIGHT)
+   pf_matrix = rgb_to_ycbcr_709;
+   else
+   pf_matrix = rgb_to_ycbcr_601;
+
+   for (i = 0; i < 8; i++) {
+   tvout_write(tvout, *(pf_matrix + i),
+   TVO_CSC_MAIN_M0 + (i * 4));
+   tvout_write(tvout, *(pf_matrix + i),
+   TVO_CSC_AUX_M0 + (i * 4));
+   }
+}
+
+/**
  * Start VIP block for DVO output
  *
  * @tvout: pointer on tvout structure
@@ -454,10 +481,6 @@ static void sti_tvout_encoder_mode_set(struct drm_encoder 
*encoder,
 {
 }

-static void sti_tvout_encoder_prepare(struct drm_encoder *encoder)
-{
-}
-
 static void sti_tvout_encoder_destroy(struct drm_encoder *encoder)
 {
struct sti_tvout_encoder *sti_encoder = to_sti_tvout_encoder(encoder);
@@ -470,10 +493,12 @@ static const struct drm_encoder_funcs 
sti_tvout_encoder_funcs = {
.destroy = sti_tvout_encoder_destroy,
 };

-static void sti_dvo_encoder_commit(struct drm_encoder *encoder)
+static void sti_dvo_encoder_enable(struct drm_encoder *encoder)
 {
struct sti_tvout *tvout = to_sti_tvout(encoder);

+   tvout_preformatter_set_matrix(tvout, &encoder->crtc->mode);
+
tvout_dvo_start(tvout, sti_crtc_is_main(encoder->crtc));
 }

@@ -489,8 +514,7 @@ static const struct drm_encoder_helper_funcs 
sti_dvo_encoder_helper_funcs = {
.dpms = sti_tvout_encoder_dpms,
.mode_fixup = sti_tvout_encoder_mode_fixup,
.mode_set = sti_tvout_encoder_mode_set,
-   .prepare = sti_tvout_encoder_prepare,
-   .commit = sti_dvo_encoder_commit,
+   .enable = sti_dvo_encoder_enable,
.disable = sti_dvo_encoder_disable,
 };

@@ -521,10 +545,12 @@ sti_tvout_create_dvo_encoder(struct drm_device *dev,
return drm_encoder;
 }

-static void sti_hda_encoder_commit(struct drm_encoder *encoder)
+static void sti_hda_encoder_enable(struct drm_encoder *encoder)
 {
struct sti_tvout *tvout = to_sti_tvout(encoder);

+   tvout_preformatter_set_matrix(tvout, &encoder->crtc->mode);
+
tvout_hda_start(tvout, sti_crtc_is_main(encoder->crtc));
 }

@@ -543,8 +569,7 @@ static const struct drm_encoder_helper_funcs 
sti_hda_encoder_helper_funcs = {
.dpms = sti_tvout_encoder_dpms,
.mode_fixup = sti_tvout_encoder_mode_fixup,
.mode_set = sti_tvout_encoder_mode_set,
-   .prepare = sti_tvout_encoder_prepare,
-   .commit = sti_hda_encoder_commit,
+   .commit = sti_hda_encoder_enable,
.disable = sti_hda_encoder_disable,
 };

@@ -573,10 +598,12 @@ static struct drm_encoder 
*sti_tvout_create_hda_encoder(struct drm_device *dev,
return drm_encoder;
 }

-static void sti_hdmi_encoder_commit(struct drm_encoder *encoder)
+static void sti_hdmi_encoder_enable(struct drm_encoder *encoder)
 {
struct sti_tvout *tvout = to_sti_tvout(encoder);

+   tvout_preformatter_set_matrix(tvout, &encoder->crtc->mode);
+
tvout_hdmi_start(tvout, sti_crtc_is_main(encoder->crtc));
 }

@@ -592,8 +619,7 @@ static const struct drm_encoder_helper_funcs 
sti_hdmi_encoder_helper_funcs = {
.dpms = sti_tvout_encoder_dpms,
.mode_fixup = sti_tvout_encoder_mode_fixup,
.mode_set = sti_tvout_encoder_mode_set,
-   .prepare = sti_tvout_encoder_prepare,
-   .commit = sti_hdmi_encoder_commit,
+   .commit = sti_hdmi_encoder_enable,
.disable = sti_hdmi_encoder_disable,
 };

@@ -645,18 +671,9 @@ static int sti_tvout_bind(struct device *dev, struct 
device *master, void *data)
 {
struct sti_tvout *tvout = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
-   unsigned int i;

tvout->drm_dev = drm_dev;

-   /* set preformatter matrix */
-   for (i = 0; i < 8; i++) {
-   tvout_write(tvout, rgb_to_ycbcr_601[i],
- 

[PATCH 00/11] drm/sti: encoders/connectors bug fixes

2016-02-12 Thread Vincent Abriou
This bunch of patches deals with encoders and connectors.
For the HDMI connector, it bring the support of the vendor specific
infoframe and bring the support of 2 HDMI connector properties.
It also solves the panel detection and timing issues on the DVO connector
and force the HDA connector reset at start up.

Bich Hemon (2):
  drm/sti: adjust delay for DVO
  drm/sti: fix dvo data_enable signal

Vincent Abriou (9):
  drm/sti: do not clip RGB/YUV component value at connector side
  drm/sti: fix panel detection for DVO connector
  drm/sti: add missing encoder cleanup for DVO connector
  drm/sti: reset HD DACS when HDA connector is created
  drm/sti: HDMI infoframe transmission mode not take into account
  drm/sti: reset infoframe transmission when HDMI is stopped
  drm/sti: add HDMI vendor specific infoframe
  drm/sti: add colorspace property to the HDMI connector
  drm/sti: add hdmi_mode property for HDMI connector

 drivers/gpu/drm/sti/sti_awg_utils.c |  51 +---
 drivers/gpu/drm/sti/sti_dvo.c   |   8 +-
 drivers/gpu/drm/sti/sti_hda.c   |   3 +
 drivers/gpu/drm/sti/sti_hdmi.c  | 225 +---
 drivers/gpu/drm/sti/sti_hdmi.h  |  27 +
 drivers/gpu/drm/sti/sti_tvout.c |  18 +--
 drivers/gpu/drm/sti/sti_vtg.c   |   5 +-
 7 files changed, 296 insertions(+), 41 deletions(-)

-- 
1.9.1



[PATCH 02/11] drm/sti: fix panel detection for DVO connector

2016-02-12 Thread Vincent Abriou
The DVO connector is tag as disconnect because of a wrong management
of the panel detection.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_dvo.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 45cbe2b..9e90b74 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -345,12 +345,14 @@ sti_dvo_connector_detect(struct drm_connector *connector, 
bool force)

DRM_DEBUG_DRIVER("\n");

-   if (!dvo->panel)
+   if (!dvo->panel) {
dvo->panel = of_drm_find_panel(dvo->panel_node);
+   if (dvo->panel)
+   drm_panel_attach(dvo->panel, connector);
+   }

if (dvo->panel)
-   if (!drm_panel_attach(dvo->panel, connector))
-   return connector_status_connected;
+   return connector_status_connected;

return connector_status_disconnected;
 }
-- 
1.9.1



[PATCH 01/11] drm/sti: do not clip RGB/YUV component value at connector side

2016-02-12 Thread Vincent Abriou
Disable the clipping mode for hdmi, dvo and hda connectors.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 1c27a2c..784a3e2 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -326,9 +326,8 @@ static void tvout_dvo_start(struct sti_tvout *tvout, bool 
main_path)
  TVO_VIP_REORDER_Y_G_SEL,
  TVO_VIP_REORDER_CB_B_SEL);

-   /* Set clipping mode (Limited range RGB/Y) */
-   tvout_vip_set_clip_mode(tvout, TVO_VIP_DVO,
-   TVO_VIP_CLIP_LIMITED_RANGE_RGB_Y);
+   /* Set clipping mode */
+   tvout_vip_set_clip_mode(tvout, TVO_VIP_DVO, TVO_VIP_CLIP_DISABLED);

/* Set round mode (rounded to 8-bit per component) */
tvout_vip_set_rnd(tvout, TVO_VIP_DVO, TVO_VIP_RND_8BIT_ROUNDED);
@@ -383,9 +382,8 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, bool 
main_path)
  TVO_VIP_REORDER_Y_G_SEL,
  TVO_VIP_REORDER_CB_B_SEL);

-   /* set clipping mode (Limited range RGB/Y) */
-   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDMI,
-   TVO_VIP_CLIP_LIMITED_RANGE_RGB_Y);
+   /* set clipping mode */
+   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDMI, TVO_VIP_CLIP_DISABLED);

/* set round mode (rounded to 8-bit per component) */
tvout_vip_set_rnd(tvout, TVO_VIP_HDMI, TVO_VIP_RND_8BIT_ROUNDED);
@@ -442,8 +440,8 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool 
main_path)
  TVO_VIP_REORDER_Y_G_SEL,
  TVO_VIP_REORDER_CB_B_SEL);

-   /* set clipping mode (EAV/SAV clipping) */
-   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDF, TVO_VIP_CLIP_EAV_SAV);
+   /* set clipping mode */
+   tvout_vip_set_clip_mode(tvout, TVO_VIP_HDF, TVO_VIP_CLIP_DISABLED);

/* set round mode (rounded to 10-bit per component) */
tvout_vip_set_rnd(tvout, TVO_VIP_HDF, TVO_VIP_RND_10BIT_ROUNDED);
-- 
1.9.1



[PATCH 03/11] drm/sti: add missing encoder cleanup for DVO connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 784a3e2..0b171fd 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -663,6 +663,10 @@ static void sti_tvout_destroy_encoders(struct sti_tvout 
*tvout)
if (tvout->hda)
drm_encoder_cleanup(tvout->hda);
tvout->hda = NULL;
+
+   if (tvout->dvo)
+   drm_encoder_cleanup(tvout->dvo);
+   tvout->dvo = NULL;
 }

 static int sti_tvout_bind(struct device *dev, struct device *master, void 
*data)
-- 
1.9.1



[PATCH 04/11] drm/sti: adjust delay for DVO

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

Modify delay to display last pixel column on DVO

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_vtg.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 313d703..32c7986 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -64,6 +64,9 @@
 /* Delay introduced by the HDMI in nb of pixel */
 #define HDMI_DELAY  (5)

+/* Delay introduced by the DVO in nb of pixel */
+#define DVO_DELAY   (2)
+
 /* delay introduced by the Arbitrary Waveform Generator in nb of pixels */
 #define AWG_DELAY_HD(-9)
 #define AWG_DELAY_ED(-8)
@@ -278,7 +281,7 @@ static void vtg_set_mode(struct sti_vtg *vtg,
vtg_set_hsync_vsync_pos(&sync[VTG_SYNC_ID_HDF - 1], AWG_DELAY_HD, mode);

/* Set hsync and vsync position for DVO */
-   vtg_set_hsync_vsync_pos(&sync[VTG_SYNC_ID_DVO - 1], 0, mode);
+   vtg_set_hsync_vsync_pos(&sync[VTG_SYNC_ID_DVO - 1], DVO_DELAY, mode);

/* Progam the syncs outputs */
for (i = 0; i < VTG_MAX_SYNC_OUTPUT ; i++) {
-- 
1.9.1



[PATCH 05/11] drm/sti: fix dvo data_enable signal

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

Modify AWG algorithm in order to handle more than 1023 lines

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_awg_utils.c | 51 +
 1 file changed, 35 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_awg_utils.c 
b/drivers/gpu/drm/sti/sti_awg_utils.c
index 2378b93..a516eb8 100644
--- a/drivers/gpu/drm/sti/sti_awg_utils.c
+++ b/drivers/gpu/drm/sti/sti_awg_utils.c
@@ -7,6 +7,7 @@
 #include "sti_awg_utils.h"

 #define AWG_OPCODE_OFFSET 10
+#define AWG_MAX_ARG   0x3ff

 enum opcode {
SET,
@@ -67,7 +68,7 @@ static int awg_generate_instr(enum opcode opcode,

mux = 0;
data_enable = 0;
-   arg &= (0x3ff);
+   arg &= AWG_MAX_ARG;
break;
case REPEAT:
case REPLAY:
@@ -78,13 +79,13 @@ static int awg_generate_instr(enum opcode opcode,

mux = 0;
data_enable = 0;
-   arg &= (0x3ff);
+   arg &= AWG_MAX_ARG;
break;
case JUMP:
mux = 0;
data_enable = 0;
arg |= 0x40; /* for jump instruction 7th bit is 1 */
-   arg &= 0x3ff;
+   arg &= AWG_MAX_ARG;
break;
case STOP:
arg = 0;
@@ -112,22 +113,13 @@ static int awg_generate_instr(enum opcode opcode,
return 0;
 }

-int sti_awg_generate_code_data_enable_mode(
+static int awg_generate_line_signal(
struct awg_code_generation_params *fwparams,
struct awg_timing *timing)
 {
long int val;
int ret = 0;

-   if (timing->trailing_lines > 0) {
-   /* skip trailing lines */
-   val = timing->blanking_level;
-   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);
-
-   val = timing->trailing_lines - 1;
-   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
-   }
-
if (timing->trailing_pixels > 0) {
/* skip trailing pixel */
val = timing->blanking_level;
@@ -152,9 +144,36 @@ int sti_awg_generate_code_data_enable_mode(
ret |= awg_generate_instr(SET, val, 0, 0, fwparams);
}

-   /* replay the sequence as many active lines defined */
-   val = timing->active_lines - 1;
-   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
+   return ret;
+}
+
+int sti_awg_generate_code_data_enable_mode(
+   struct awg_code_generation_params *fwparams,
+   struct awg_timing *timing)
+{
+   long int val, tmp_val;
+   int ret = 0;
+
+   if (timing->trailing_lines > 0) {
+   /* skip trailing lines */
+   val = timing->blanking_level;
+   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);
+
+   val = timing->trailing_lines - 1;
+   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
+   }
+
+   tmp_val = timing->active_lines - 1;
+
+   while (tmp_val > 0) {
+   /* generate DE signal for each line */
+   ret |= awg_generate_line_signal(fwparams, timing);
+   /* replay the sequence as many active lines defined */
+   ret |= awg_generate_instr(REPLAY,
+ min_t(int, AWG_MAX_ARG, tmp_val),
+ 0, 0, fwparams);
+   tmp_val -= AWG_MAX_ARG;
+   }

if (timing->blanking_lines > 0) {
/* skip blanking lines */
-- 
1.9.1



[PATCH 06/11] drm/sti: reset HD DACS when HDA connector is created

2016-02-12 Thread Vincent Abriou
Make sure the HD DACS are disabled when the HDA connector
is created.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hda.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 49cce83..293a133 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -685,6 +685,9 @@ static int sti_hda_bind(struct device *dev, struct device 
*master, void *data)
goto err_sysfs;
}

+   /* force to disable hd dacs at startup */
+   hda_enable_hd_dacs(hda, false);
+
return 0;

 err_sysfs:
-- 
1.9.1



[PATCH 07/11] drm/sti: HDMI infoframe transmission mode not take into account

2016-02-12 Thread Vincent Abriou
Set the infoframe transmission mode according to the type of
the infoframe.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index cd50156..8537852 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -321,7 +321,7 @@ static void hdmi_infoframe_write_infopack(struct sti_hdmi 
*hdmi, const u8 *data)

/* Enable transmission slot for updated infoframe */
val = hdmi_read(hdmi, HDMI_SW_DI_CFG);
-   val |= HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_FIELD, slot);
+   val |= HDMI_IFRAME_CFG_DI_N(mode, slot);
hdmi_write(hdmi, val, HDMI_SW_DI_CFG);
 }

-- 
1.9.1



[PATCH 09/11] drm/sti: add HDMI vendor specific infoframe

2016-02-12 Thread Vincent Abriou
Vendor specific infoframe is mandatory for 4K2K resolution.
Without this, the HDMI protocol compliance fails.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 82 +-
 1 file changed, 73 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index ff04ed2..34e33a1 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -51,9 +51,18 @@
 #define HDMI_SW_DI_2_PKT_WORD4  0x0614
 #define HDMI_SW_DI_2_PKT_WORD5  0x0618
 #define HDMI_SW_DI_2_PKT_WORD6  0x061C
+#define HDMI_SW_DI_3_HEAD_WORD  0x0620
+#define HDMI_SW_DI_3_PKT_WORD0  0x0624
+#define HDMI_SW_DI_3_PKT_WORD1  0x0628
+#define HDMI_SW_DI_3_PKT_WORD2  0x062C
+#define HDMI_SW_DI_3_PKT_WORD3  0x0630
+#define HDMI_SW_DI_3_PKT_WORD4  0x0634
+#define HDMI_SW_DI_3_PKT_WORD5  0x0638
+#define HDMI_SW_DI_3_PKT_WORD6  0x063C

 #define HDMI_IFRAME_SLOT_AVI1
 #define HDMI_IFRAME_SLOT_AUDIO  2
+#define HDMI_IFRAME_SLOT_VENDOR 3

 #define  XCAT(prefix, x, suffix)prefix ## x ## suffix
 #define  HDMI_SW_DI_N_HEAD_WORD(x)  XCAT(HDMI_SW_DI_, x, _HEAD_WORD)
@@ -264,6 +273,10 @@ static void hdmi_infoframe_reset(struct sti_hdmi *hdmi,
head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AUDIO);
pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AUDIO);
break;
+   case HDMI_IFRAME_SLOT_VENDOR:
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_VENDOR);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_VENDOR);
+   break;
default:
DRM_ERROR("unsupported infoframe slot: %#x\n", slot);
return;
@@ -305,12 +318,13 @@ static inline unsigned int hdmi_infoframe_subpack(const 
u8 *ptr, size_t size)
  * @data: infoframe to write
  * @size: size to write
  */
-static void hdmi_infoframe_write_infopack(struct sti_hdmi *hdmi, const u8 
*data)
+static void hdmi_infoframe_write_infopack(struct sti_hdmi *hdmi,
+ const u8 *data,
+ size_t size)
 {
const u8 *ptr = data;
u32 val, slot, mode, i;
u32 head_offset, pack_offset;
-   size_t size;

switch (*ptr) {
case HDMI_INFOFRAME_TYPE_AVI:
@@ -318,17 +332,19 @@ static void hdmi_infoframe_write_infopack(struct sti_hdmi 
*hdmi, const u8 *data)
mode = HDMI_IFRAME_FIELD;
head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AVI);
pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AVI);
-   size = HDMI_AVI_INFOFRAME_SIZE;
break;
-
case HDMI_INFOFRAME_TYPE_AUDIO:
slot = HDMI_IFRAME_SLOT_AUDIO;
mode = HDMI_IFRAME_FRAME;
head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AUDIO);
pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AUDIO);
-   size = HDMI_AUDIO_INFOFRAME_SIZE;
break;
-
+   case HDMI_INFOFRAME_TYPE_VENDOR:
+   slot = HDMI_IFRAME_SLOT_VENDOR;
+   mode = HDMI_IFRAME_FRAME;
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_VENDOR);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_VENDOR);
+   break;
default:
DRM_ERROR("unsupported infoframe type: %#x\n", *ptr);
return;
@@ -347,8 +363,9 @@ static void hdmi_infoframe_write_infopack(struct sti_hdmi 
*hdmi, const u8 *data)
/*
 * Each subpack contains 4 bytes
 * The First Bytes of the first subpacket must contain the checksum
-* Packet size in increase by one.
+* Packet size is increase by one.
 */
+   size = size - HDMI_INFOFRAME_HEADER_SIZE + 1;
for (i = 0; i < size; i += sizeof(u32)) {
size_t num;

@@ -401,7 +418,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
return ret;
}

-   hdmi_infoframe_write_infopack(hdmi, buffer);
+   hdmi_infoframe_write_infopack(hdmi, buffer, ret);

return 0;
 }
@@ -437,7 +454,49 @@ static int hdmi_audio_infoframe_config(struct sti_hdmi 
*hdmi)
return ret;
}

-   hdmi_infoframe_write_infopack(hdmi, buffer);
+   hdmi_infoframe_write_infopack(hdmi, buffer, ret);
+
+   return 0;
+}
+
+/*
+ * Prepare and configure the VS infoframe
+ *
+ * Vendor Specific infoframe are transmitted once per frame and
+ * contains vendor specific information.
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ *
+ * Return negative value if error occurs
+ */
+#define HDMI_VENDOR_INFOFRAME_MAX_SIZE 6
+static int hdmi_vendor_infoframe_config(struct sti_hdmi *hdmi)
+{
+   struct drm_display_mode 

[PATCH 08/11] drm/sti: reset infoframe transmission when HDMI is stopped

2016-02-12 Thread Vincent Abriou
Clear all infoframe registers when the HDMI link is stopped.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 43 ++
 1 file changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 8537852..ff04ed2 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -65,6 +65,8 @@
 #define  HDMI_SW_DI_N_PKT_WORD5(x)  XCAT(HDMI_SW_DI_, x, _PKT_WORD5)
 #define  HDMI_SW_DI_N_PKT_WORD6(x)  XCAT(HDMI_SW_DI_, x, _PKT_WORD6)

+#define HDMI_SW_DI_MAX_WORD 7
+
 #define HDMI_IFRAME_DISABLED0x0
 #define HDMI_IFRAME_SINGLE_SHOT 0x1
 #define HDMI_IFRAME_FIELD   0x2
@@ -241,6 +243,43 @@ static void hdmi_config(struct sti_hdmi *hdmi)
hdmi_write(hdmi, conf, HDMI_CFG);
 }

+/*
+ * Helper to reset info frame
+ *
+ * @hdmi: pointer on the hdmi internal structure
+ * @slot: infoframe to reset
+ */
+static void hdmi_infoframe_reset(struct sti_hdmi *hdmi,
+u32 slot)
+{
+   u32 val, i;
+   u32 head_offset, pack_offset;
+
+   switch (slot) {
+   case HDMI_IFRAME_SLOT_AVI:
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AVI);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AVI);
+   break;
+   case HDMI_IFRAME_SLOT_AUDIO:
+   head_offset = HDMI_SW_DI_N_HEAD_WORD(HDMI_IFRAME_SLOT_AUDIO);
+   pack_offset = HDMI_SW_DI_N_PKT_WORD0(HDMI_IFRAME_SLOT_AUDIO);
+   break;
+   default:
+   DRM_ERROR("unsupported infoframe slot: %#x\n", slot);
+   return;
+   }
+
+   /* Disable transmission for the selected slot */
+   val = hdmi_read(hdmi, HDMI_SW_DI_CFG);
+   val &= ~HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, slot);
+   hdmi_write(hdmi, val, HDMI_SW_DI_CFG);
+
+   /* Reset info frame registers */
+   hdmi_write(hdmi, 0x0, head_offset);
+   for (i = 0; i < HDMI_SW_DI_MAX_WORD; i += sizeof(u32))
+   hdmi_write(hdmi, 0x0, pack_offset + i);
+}
+
 /**
  * Helper to concatenate infoframe in 32 bits word
  *
@@ -468,6 +507,10 @@ static void sti_hdmi_disable(struct drm_bridge *bridge)
/* Stop the phy */
hdmi->phy_ops->stop(hdmi);

+   /* Reset info frame transmission */
+   hdmi_infoframe_reset(hdmi, HDMI_IFRAME_SLOT_AVI);
+   hdmi_infoframe_reset(hdmi, HDMI_IFRAME_SLOT_AUDIO);
+
/* Set the default channel data to be a dark red */
hdmi_write(hdmi, 0x, HDMI_DFLT_CHL0_DAT);
hdmi_write(hdmi, 0x, HDMI_DFLT_CHL1_DAT);
-- 
1.9.1



[PATCH 10/11] drm/sti: add colorspace property to the HDMI connector

2016-02-12 Thread Vincent Abriou
Make the value of the colorspace of the HDMI infoframe configurable.
HDMI colorspace could be: RGB, YUV422 or YUV444

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 68 +-
 drivers/gpu/drm/sti/sti_hdmi.h | 12 
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 34e33a1..1f37dc4 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -128,6 +128,7 @@ struct sti_hdmi_connector {
struct drm_connector drm_connector;
struct drm_encoder *encoder;
struct sti_hdmi *hdmi;
+   struct drm_property *colorspace_property;
 };

 #define to_sti_hdmi_connector(x) \
@@ -408,7 +409,7 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi)
}

/* fixed infoframe configuration not linked to the mode */
-   infoframe.colorspace = HDMI_COLORSPACE_RGB;
+   infoframe.colorspace = hdmi->colorspace;
infoframe.quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
infoframe.colorimetry = HDMI_COLORIMETRY_NONE;

@@ -771,12 +772,74 @@ static void sti_hdmi_connector_destroy(struct 
drm_connector *connector)
kfree(hdmi_connector);
 }

+static void sti_hdmi_connector_init_property(struct drm_device *drm_dev,
+struct drm_connector *connector)
+{
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+   struct drm_property *prop;
+
+   /* colorspace property */
+   hdmi->colorspace = DEFAULT_COLORSPACE_MODE;
+   prop = drm_property_create_enum(drm_dev, 0, "colorspace",
+   colorspace_mode_names,
+   ARRAY_SIZE(colorspace_mode_names));
+   if (!prop) {
+   DRM_ERROR("fails to create colorspace property\n");
+   return;
+   }
+   hdmi_connector->colorspace_property = prop;
+   drm_object_attach_property(&connector->base, prop, hdmi->colorspace);
+}
+
+static int
+sti_hdmi_connector_set_property(struct drm_connector *connector,
+   struct drm_connector_state *state,
+   struct drm_property *property,
+   uint64_t val)
+{
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+
+   if (property == hdmi_connector->colorspace_property) {
+   hdmi->colorspace = val;
+   return 0;
+   }
+
+   DRM_ERROR("failed to set hdmi connector property\n");
+   return -EINVAL;
+}
+
+static int
+sti_hdmi_connector_get_property(struct drm_connector *connector,
+   const struct drm_connector_state *state,
+   struct drm_property *property,
+   uint64_t *val)
+{
+   struct sti_hdmi_connector *hdmi_connector
+   = to_sti_hdmi_connector(connector);
+   struct sti_hdmi *hdmi = hdmi_connector->hdmi;
+
+   if (property == hdmi_connector->colorspace_property) {
+   *val = hdmi->colorspace;
+   return 0;
+   }
+
+   DRM_ERROR("failed to get hdmi connector property\n");
+   return -EINVAL;
+}
+
 static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_hdmi_connector_detect,
.destroy = sti_hdmi_connector_destroy,
.reset = drm_atomic_helper_connector_reset,
+   .set_property = drm_atomic_helper_connector_set_property,
+   .atomic_set_property = sti_hdmi_connector_set_property,
+   .atomic_get_property = sti_hdmi_connector_get_property,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
 };
@@ -836,6 +899,9 @@ static int sti_hdmi_bind(struct device *dev, struct device 
*master, void *data)
drm_connector_helper_add(drm_connector,
&sti_hdmi_connector_helper_funcs);

+   /* initialise property */
+   sti_hdmi_connector_init_property(drm_dev, drm_connector);
+
err = drm_connector_register(drm_connector);
if (err)
goto err_connector;
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index 3d22390..f621cd7 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -7,6 +7,7 @@
 #ifndef _STI_HDMI_H_
 #define _STI_HDMI_H_

+#include 
 #include 

 #include 
@@ -24,6 +25,14 @@ struct hdmi_phy_ops {
void (*stop)(struct sti_hdmi *hdmi);
 };

+static const struct drm_prop_enum_list colorspace_mode_na

[PATCH 11/11] drm/sti: add hdmi_mode property for HDMI connector

2016-02-12 Thread Vincent Abriou
Configures the framer of the HDMI connection.
By default starts in HDMI mode and can be swtich to DVI.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 30 --
 drivers/gpu/drm/sti/sti_hdmi.h | 15 +++
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 1f37dc4..69a2286 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -129,6 +129,7 @@ struct sti_hdmi_connector {
struct drm_encoder *encoder;
struct sti_hdmi *hdmi;
struct drm_property *colorspace_property;
+   struct drm_property *hdmi_mode_property;
 };

 #define to_sti_hdmi_connector(x) \
@@ -229,8 +230,10 @@ static void hdmi_config(struct sti_hdmi *hdmi)
/* Clear overrun and underrun fifo */
conf = HDMI_CFG_FIFO_OVERRUN_CLR | HDMI_CFG_FIFO_UNDERRUN_CLR;

-   /* Enable HDMI mode not DVI */
-   conf |= HDMI_CFG_HDMI_NOT_DVI | HDMI_CFG_ESS_NOT_OESS;
+   /* Select encryption type and the framing mode */
+   conf |= HDMI_CFG_ESS_NOT_OESS;
+   if (hdmi->hdmi_mode == HDMI_MODE_HDMI)
+   conf |= HDMI_CFG_HDMI_NOT_DVI;

/* Enable sink term detection */
conf |= HDMI_CFG_SINK_TERM_DET_EN;
@@ -791,6 +794,19 @@ static void sti_hdmi_connector_init_property(struct 
drm_device *drm_dev,
}
hdmi_connector->colorspace_property = prop;
drm_object_attach_property(&connector->base, prop, hdmi->colorspace);
+
+   /* hdmi_mode property */
+   hdmi->hdmi_mode = DEFAULT_HDMI_MODE;
+   prop = drm_property_create_enum(drm_dev, 0, "hdmi_mode",
+   hdmi_mode_names,
+   ARRAY_SIZE(hdmi_mode_names));
+   if (!prop) {
+   DRM_ERROR("fails to create colorspace property\n");
+   return;
+   }
+   hdmi_connector->hdmi_mode_property = prop;
+   drm_object_attach_property(&connector->base, prop, hdmi->hdmi_mode);
+
 }

 static int
@@ -808,6 +824,11 @@ sti_hdmi_connector_set_property(struct drm_connector 
*connector,
return 0;
}

+   if (property == hdmi_connector->hdmi_mode_property) {
+   hdmi->hdmi_mode = val;
+   return 0;
+   }
+
DRM_ERROR("failed to set hdmi connector property\n");
return -EINVAL;
 }
@@ -827,6 +848,11 @@ sti_hdmi_connector_get_property(struct drm_connector 
*connector,
return 0;
}

+   if (property == hdmi_connector->hdmi_mode_property) {
+   *val = hdmi->hdmi_mode;
+   return 0;
+   }
+
DRM_ERROR("failed to get hdmi connector property\n");
return -EINVAL;
 }
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h
index f621cd7..77edb73 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.h
+++ b/drivers/gpu/drm/sti/sti_hdmi.h
@@ -25,6 +25,19 @@ struct hdmi_phy_ops {
void (*stop)(struct sti_hdmi *hdmi);
 };

+/* values for the framing mode property */
+enum sti_hdmi_modes {
+   HDMI_MODE_HDMI,
+   HDMI_MODE_DVI,
+};
+
+static const struct drm_prop_enum_list hdmi_mode_names[] = {
+   { HDMI_MODE_HDMI, "hdmi" },
+   { HDMI_MODE_DVI, "dvi" },
+};
+
+#define DEFAULT_HDMI_MODE HDMI_MODE_HDMI
+
 static const struct drm_prop_enum_list colorspace_mode_names[] = {
{ HDMI_COLORSPACE_RGB, "rgb" },
{ HDMI_COLORSPACE_YUV422, "yuv422" },
@@ -55,6 +68,7 @@ static const struct drm_prop_enum_list 
colorspace_mode_names[] = {
  * @reset: reset control of the hdmi phy
  * @ddc_adapt: i2c ddc adapter
  * @colorspace: current colorspace selected
+ * @hdmi_mode: select framing for HDMI or DVI
  */
 struct sti_hdmi {
struct device dev;
@@ -76,6 +90,7 @@ struct sti_hdmi {
struct reset_control *reset;
struct i2c_adapter *ddc_adapt;
enum hdmi_colorspace colorspace;
+   enum sti_hdmi_modes hdmi_mode;
 };

 u32 hdmi_read(struct sti_hdmi *hdmi, int offset);
-- 
1.9.1



[PATCH 00/10] drm/sti: debugfs

2016-02-12 Thread Vincent Abriou
Those patches introduce debugfs for connector, encoder, crtc and planes.
It adds the following entries:
 - planes:
   gdpx / gdpx_node
   hqvdp
   cursor
   vid
   fps_get / fps_show

 - crtc:
   mixer_aux / mixer_main

 - encoder:
   tvout

 - connectors:
   hda
   hdmi
   dvo

Vincent Abriou (10):
  drm/sti: add debugfs entries for HDMI connector
  drm/sti: add debugfs entries for DVO connector
  drm/sti: add debugfs entries for HDA connector
  drm/sti: add debugfs entries for CURSOR plane
  drm/sti: add debugfs entries for GDP planes
  drm/sti: add debugfs entries for HQVDP plane
  drm/sti: add debugfs entries for VID plane
  drm/sti: add debugfs entries for MIXER crtc
  drm/sti: add debugfs entries for TVOUT encoders
  drm/sti: add debugfs fps_show/fps_get mechanism for planes

 drivers/gpu/drm/sti/sti_compositor.c |   4 +-
 drivers/gpu/drm/sti/sti_cursor.c |  81 +++
 drivers/gpu/drm/sti/sti_drv.c| 128 ++
 drivers/gpu/drm/sti/sti_dvo.c|  70 ++
 drivers/gpu/drm/sti/sti_gdp.c| 238 
 drivers/gpu/drm/sti/sti_hda.c| 105 ++-
 drivers/gpu/drm/sti/sti_hdmi.c   | 175 +++-
 drivers/gpu/drm/sti/sti_hdmi.h   |   4 +-
 drivers/gpu/drm/sti/sti_hqvdp.c  | 254 ++-
 drivers/gpu/drm/sti/sti_mixer.c  | 146 +++-
 drivers/gpu/drm/sti/sti_mixer.h  |   4 +-
 drivers/gpu/drm/sti/sti_plane.c  |  63 +
 drivers/gpu/drm/sti/sti_plane.h  |  17 +++
 drivers/gpu/drm/sti/sti_tvout.c  | 157 ++
 drivers/gpu/drm/sti/sti_vid.c|  94 -
 drivers/gpu/drm/sti/sti_vid.h|   4 +-
 16 files changed, 1524 insertions(+), 20 deletions(-)

-- 
1.9.1



[PATCH 01/10] drm/sti: add debugfs entries for HDMI connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hdmi.c | 175 -
 drivers/gpu/drm/sti/sti_hdmi.h |   4 +-
 2 files changed, 175 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 69a2286..6ef0715 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -6,6 +6,7 @@

 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -550,6 +551,172 @@ static void hdmi_swreset(struct sti_hdmi *hdmi)
clk_disable_unprepare(hdmi->clk_audio);
 }

+#define DBGFS_PRINT_STR(str1, str2) seq_printf(s, "%-24s %s\n", str1, str2)
+#define DBGFS_PRINT_INT(str1, int2) seq_printf(s, "%-24s %d\n", str1, int2)
+#define DBGFS_DUMP(str, reg) seq_printf(s, "%s  %-25s 0x%08X", str, #reg, \
+   hdmi_read(hdmi, reg))
+#define DBGFS_DUMP_DI(reg, slot) DBGFS_DUMP("\n", reg(slot))
+
+static void hdmi_dbg_cfg(struct seq_file *s, int val)
+{
+   int tmp;
+
+   seq_puts(s, "\t");
+   tmp = val & HDMI_CFG_HDMI_NOT_DVI;
+   DBGFS_PRINT_STR("mode:", tmp ? "HDMI" : "DVI");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_HDCP_EN;
+   DBGFS_PRINT_STR("HDCP:", tmp ? "enable" : "disable");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_ESS_NOT_OESS;
+   DBGFS_PRINT_STR("HDCP mode:", tmp ? "ESS enable" : "OESS enable");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_SINK_TERM_DET_EN;
+   DBGFS_PRINT_STR("Sink term detection:", tmp ? "enable" : "disable");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_H_SYNC_POL_NEG;
+   DBGFS_PRINT_STR("Hsync polarity:", tmp ? "inverted" : "normal");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_V_SYNC_POL_NEG;
+   DBGFS_PRINT_STR("Vsync polarity:", tmp ? "inverted" : "normal");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = val & HDMI_CFG_422_EN;
+   DBGFS_PRINT_STR("YUV422 format:", tmp ? "enable" : "disable");
+}
+
+static void hdmi_dbg_sta(struct seq_file *s, int val)
+{
+   int tmp;
+
+   seq_puts(s, "\t");
+   tmp = (val & HDMI_STA_DLL_LCK);
+   DBGFS_PRINT_STR("pll:", tmp ? "locked" : "not locked");
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_STA_HOT_PLUG);
+   DBGFS_PRINT_STR("hdmi cable:", tmp ? "connected" : "not connected");
+}
+
+static void hdmi_dbg_sw_di_cfg(struct seq_file *s, int val)
+{
+   int tmp;
+   char *const en_di[] = {"no transmission",
+  "single transmission",
+  "once every field",
+  "once every frame"};
+
+   seq_puts(s, "\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 1));
+   DBGFS_PRINT_STR("Data island 1:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 2)) >> 4;
+   DBGFS_PRINT_STR("Data island 2:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 3)) >> 8;
+   DBGFS_PRINT_STR("Data island 3:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 4)) >> 12;
+   DBGFS_PRINT_STR("Data island 4:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 5)) >> 16;
+   DBGFS_PRINT_STR("Data island 5:", en_di[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & HDMI_IFRAME_CFG_DI_N(HDMI_IFRAME_MASK, 6)) >> 20;
+   DBGFS_PRINT_STR("Data island 6:", en_di[tmp]);
+}
+
+static int hdmi_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs);
+   DBGFS_DUMP("\n", HDMI_CFG);
+   hdmi_dbg_cfg(s, hdmi_read(hdmi, HDMI_CFG));
+   DBGFS_DUMP("", HDMI_INT_EN);
+   DBGFS_DUMP("\n", HDMI_STA);
+   hdmi_dbg_sta(s, hdmi_read(hdmi, HDMI_STA));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_XMIN);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Xmin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMIN));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_XMAX);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Xmax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_XMAX));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_YMIN);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Ymin:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMIN));
+   DBGFS_DUMP("", HDMI_ACTIVE_VID_YMAX);
+   seq_puts(s, "\t");
+   DBGFS_PRINT_INT("Ymax:", hdmi_read(hdmi, HDMI_ACTIVE_VID_YMAX));
+   DBGFS_DUMP("", HDMI_SW_DI_CFG);
+   hdmi_dbg_sw_di_cfg(s, hdmi_read(hdmi, HDMI_SW_DI_CFG));
+
+   se

[PATCH 02/10] drm/sti: add debugfs entries for DVO connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_dvo.c | 70 +++
 1 file changed, 70 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 9e90b74..25f7663 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -6,6 +6,7 @@

 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -156,6 +157,69 @@ static void dvo_awg_configure(struct sti_dvo *dvo, u32 
*awg_ram_code, int nb)
writel(DVO_AWG_CTRL_EN, dvo->regs + DVO_AWG_DIGSYNC_CTRL);
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(dvo->regs + reg))
+
+static void dvo_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
+{
+   unsigned int i;
+
+   seq_puts(s, "\n\n");
+   seq_puts(s, "  DVO AWG microcode:");
+   for (i = 0; i < AWG_MAX_INST; i++) {
+   if (i % 8 == 0)
+   seq_printf(s, "\n  %04X:", i);
+   seq_printf(s, " %04X", readl(reg + i * 4));
+   }
+}
+
+static int dvo_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
+   DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
+   DBGFS_DUMP(DVO_DOF_CFG);
+   DBGFS_DUMP(DVO_LUT_PROG_LOW);
+   DBGFS_DUMP(DVO_LUT_PROG_MID);
+   DBGFS_DUMP(DVO_LUT_PROG_HIGH);
+   dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I);
+   seq_puts(s, "\n");
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list dvo_debugfs_files[] = {
+   { "dvo", dvo_dbg_show, 0, NULL },
+};
+
+static void dvo_debugfs_exit(struct sti_dvo *dvo, struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(dvo_debugfs_files,
+ARRAY_SIZE(dvo_debugfs_files),
+minor);
+}
+
+static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
+   dvo_debugfs_files[i].data = dvo;
+
+   return drm_debugfs_create_files(dvo_debugfs_files,
+   ARRAY_SIZE(dvo_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 static void sti_dvo_disable(struct drm_bridge *bridge)
 {
struct sti_dvo *dvo = bridge->driver_private;
@@ -455,6 +519,9 @@ static int sti_dvo_bind(struct device *dev, struct device 
*master, void *data)
goto err_sysfs;
}

+   if (dvo_debugfs_init(dvo, drm_dev->primary))
+   DRM_ERROR("DVO debugfs setup failed\n");
+
return 0;

 err_sysfs:
@@ -469,6 +536,9 @@ static void sti_dvo_unbind(struct device *dev,
   struct device *master, void *data)
 {
struct sti_dvo *dvo = dev_get_drvdata(dev);
+   struct drm_device *drm_dev = data;
+
+   dvo_debugfs_exit(dvo, drm_dev->primary);

drm_bridge_remove(dvo->bridge);
 }
-- 
1.9.1



[PATCH 04/10] drm/sti: add debugfs entries for CURSOR plane

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_cursor.c | 79 
 1 file changed, 79 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index a4c67ab..9eac1b9 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -72,6 +72,82 @@ static const uint32_t cursor_supported_formats[] = {

 #define to_sti_cursor(x) container_of(x, struct sti_cursor, plane)

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(cursor->regs + reg))
+
+static void cursor_dbg_vpo(struct seq_file *s, u32 val)
+{
+   seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void cursor_dbg_size(struct seq_file *s, u32 val)
+{
+   seq_printf(s, "\t%d x %d", val & 0x07FF, (val >> 16) & 0x07FF);
+}
+
+static void cursor_dbg_pml(struct seq_file *s,
+  struct sti_cursor *cursor, u32 val)
+{
+   if (cursor->pixmap.paddr == val)
+   seq_printf(s, "\tVirt @: %p", cursor->pixmap.base);
+}
+
+static void cursor_dbg_cml(struct seq_file *s,
+  struct sti_cursor *cursor, u32 val)
+{
+   if (cursor->clut_paddr == val)
+   seq_printf(s, "\tVirt @: %p", cursor->clut);
+}
+
+static int cursor_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "%s: (vaddr = 0x%p)",
+  sti_plane_to_str(&cursor->plane), cursor->regs);
+
+   DBGFS_DUMP(CUR_CTL);
+   DBGFS_DUMP(CUR_VPO);
+   cursor_dbg_vpo(s, readl(cursor->regs + CUR_VPO));
+   DBGFS_DUMP(CUR_PML);
+   cursor_dbg_pml(s, cursor, readl(cursor->regs + CUR_PML));
+   DBGFS_DUMP(CUR_PMP);
+   DBGFS_DUMP(CUR_SIZE);
+   cursor_dbg_size(s, readl(cursor->regs + CUR_SIZE));
+   DBGFS_DUMP(CUR_CML);
+   cursor_dbg_cml(s, cursor, readl(cursor->regs + CUR_CML));
+   DBGFS_DUMP(CUR_AWS);
+   DBGFS_DUMP(CUR_AWE);
+   seq_puts(s, "\n");
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list cursor_debugfs_files[] = {
+   { "cursor", cursor_dbg_show, 0, NULL },
+};
+
+static int cursor_debugfs_init(struct sti_cursor *cursor,
+  struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(cursor_debugfs_files); i++)
+   cursor_debugfs_files[i].data = cursor;
+
+   return drm_debugfs_create_files(cursor_debugfs_files,
+   ARRAY_SIZE(cursor_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 static void sti_cursor_argb_to_clut8(struct sti_cursor *cursor, u32 *src)
 {
u8  *dst = cursor->pixmap.base;
@@ -306,6 +382,9 @@ struct drm_plane *sti_cursor_create(struct drm_device 
*drm_dev,

sti_plane_init_property(&cursor->plane, DRM_PLANE_TYPE_CURSOR);

+   if (cursor_debugfs_init(cursor, drm_dev->primary))
+   DRM_ERROR("CURSOR debugfs setup failed\n");
+
return &cursor->plane.drm_plane;

 err_plane:
-- 
1.9.1



[PATCH 03/10] drm/sti: add debugfs entries for HDA connector

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hda.c | 105 +-
 1 file changed, 104 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index 293a133..ec0d017 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -326,6 +326,103 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool 
enable)
}
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(hda->regs + reg))
+
+static void hda_dbg_cfg(struct seq_file *s, int val)
+{
+   seq_puts(s, "\tAWG ");
+   seq_puts(s, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
+}
+
+static void hda_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
+{
+   unsigned int i;
+
+   seq_puts(s, "\n\n");
+   seq_puts(s, "  HDA AWG microcode:");
+   for (i = 0; i < AWG_MAX_INST; i++) {
+   if (i % 8 == 0)
+   seq_printf(s, "\n  %04X:", i);
+   seq_printf(s, " %04X", readl(reg + i * 4));
+   }
+}
+
+static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
+{
+   u32 val = readl(reg);
+   u32 mask;
+
+   switch ((u32)reg & VIDEO_DACS_CONTROL_MASK) {
+   case VIDEO_DACS_CONTROL_SYSCFG2535:
+   mask = DAC_CFG_HD_OFF_MASK;
+   break;
+   case VIDEO_DACS_CONTROL_SYSCFG5072:
+   mask = DAC_CFG_HD_HZUVW_OFF_MASK;
+   break;
+   default:
+   DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported!");
+   return;
+   }
+
+   seq_puts(s, "\n");
+   seq_printf(s, "\n  %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
+   seq_puts(s, "\tHD DACs ");
+   seq_puts(s, val & mask ? "disabled" : "enabled");
+}
+
+static int hda_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_hda *hda = (struct sti_hda *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs);
+   DBGFS_DUMP(HDA_ANA_CFG);
+   hda_dbg_cfg(s, readl(hda->regs + HDA_ANA_CFG));
+   DBGFS_DUMP(HDA_ANA_SCALE_CTRL_Y);
+   DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CB);
+   DBGFS_DUMP(HDA_ANA_SCALE_CTRL_CR);
+   DBGFS_DUMP(HDA_ANA_ANC_CTRL);
+   DBGFS_DUMP(HDA_ANA_SRC_Y_CFG);
+   DBGFS_DUMP(HDA_ANA_SRC_C_CFG);
+   hda_dbg_awg_microcode(s, hda->regs + HDA_SYNC_AWGI);
+   if (hda->video_dacs_ctrl)
+   hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl);
+   seq_puts(s, "\n");
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list hda_debugfs_files[] = {
+   { "hda", hda_dbg_show, 0, NULL },
+};
+
+static void hda_debugfs_exit(struct sti_hda *hda, struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(hda_debugfs_files,
+ARRAY_SIZE(hda_debugfs_files),
+minor);
+}
+
+static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
+   hda_debugfs_files[i].data = hda;
+
+   return drm_debugfs_create_files(hda_debugfs_files,
+   ARRAY_SIZE(hda_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 /**
  * Configure AWG, writing instructions
  *
@@ -688,6 +785,9 @@ static int sti_hda_bind(struct device *dev, struct device 
*master, void *data)
/* force to disable hd dacs at startup */
hda_enable_hd_dacs(hda, false);

+   if (hda_debugfs_init(hda, drm_dev->primary))
+   DRM_ERROR("HDA debugfs setup failed\n");
+
return 0;

 err_sysfs:
@@ -700,7 +800,10 @@ err_connector:
 static void sti_hda_unbind(struct device *dev,
struct device *master, void *data)
 {
-   /* do nothing */
+   struct sti_hda *hda = dev_get_drvdata(dev);
+   struct drm_device *drm_dev = data;
+
+   hda_debugfs_exit(hda, drm_dev->primary);
 }

 static const struct component_ops sti_hda_ops = {
-- 
1.9.1



[PATCH 05/10] drm/sti: add debugfs entries for GDP planes

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_gdp.c | 236 ++
 1 file changed, 236 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index a6fba9c..8f0e89f 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -31,6 +31,23 @@
 #define GDP_ARGB15550x06
 #define GDP_ARGB0x07

+#define GDP2STR(fmt) { GDP_ ## fmt, #fmt }
+
+static struct gdp_format_to_str {
+   int format;
+   char name[20];
+} gdp_format_to_str[] = {
+   GDP2STR(RGB565),
+   GDP2STR(RGB888),
+   GDP2STR(RGB888_32),
+   GDP2STR(XBGR),
+   GDP2STR(ARGB8565),
+   GDP2STR(ARGB),
+   GDP2STR(ABGR),
+   GDP2STR(ARGB1555),
+   GDP2STR(ARGB)
+   };
+
 #define GAM_GDP_CTL_OFFSET  0x00
 #define GAM_GDP_AGC_OFFSET  0x04
 #define GAM_GDP_VPO_OFFSET  0x0C
@@ -119,6 +136,222 @@ static const uint32_t gdp_supported_formats[] = {
DRM_FORMAT_RGB888,
 };

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(gdp->regs + reg ## _OFFSET))
+
+static void gdp_dbg_ctl(struct seq_file *s, int val)
+{
+   int i;
+
+   seq_puts(s, "\tColor:");
+   for (i = 0; i < ARRAY_SIZE(gdp_format_to_str); i++) {
+   if (gdp_format_to_str[i].format == (val & 0x1F)) {
+   seq_printf(s, gdp_format_to_str[i].name);
+   break;
+   }
+   }
+   if (i == ARRAY_SIZE(gdp_format_to_str))
+   seq_puts(s, "");
+
+   seq_printf(s, "\tWaitNextVsync:%d", val & WAIT_NEXT_VSYNC ? 1 : 0);
+}
+
+static void gdp_dbg_vpo(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x, (val >> 16) & 0x);
+}
+
+static void gdp_dbg_vps(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x, (val >> 16) & 0x);
+}
+
+static void gdp_dbg_size(struct seq_file *s, int val)
+{
+   seq_printf(s, "\t%d x %d", val & 0x, (val >> 16) & 0x);
+}
+
+static void gdp_dbg_nvn(struct seq_file *s, struct sti_gdp *gdp, int val)
+{
+   void *base = NULL;
+   unsigned int i;
+
+   for (i = 0; i < GDP_NODE_NB_BANK; i++) {
+   if (gdp->node_list[i].top_field_paddr == val) {
+   base = gdp->node_list[i].top_field;
+   break;
+   }
+   if (gdp->node_list[i].btm_field_paddr == val) {
+   base = gdp->node_list[i].btm_field;
+   break;
+   }
+   }
+
+   if (base)
+   seq_printf(s, "\tVirt @: %p", base);
+}
+
+static void gdp_dbg_ppt(struct seq_file *s, int val)
+{
+   if (val & GAM_GDP_PPT_IGNORE)
+   seq_puts(s, "\tNot displayed on mixer!");
+}
+
+static void gdp_dbg_mst(struct seq_file *s, int val)
+{
+   if (val & 1)
+   seq_puts(s, "\tBUFFER UNDERFLOW!");
+}
+
+static int gdp_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_plane *drm_plane = &gdp->plane.drm_plane;
+   struct drm_crtc *crtc = drm_plane->crtc;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "%s: (vaddr = 0x%p)",
+  sti_plane_to_str(&gdp->plane), gdp->regs);
+
+   DBGFS_DUMP(GAM_GDP_CTL);
+   gdp_dbg_ctl(s, readl(gdp->regs + GAM_GDP_CTL_OFFSET));
+   DBGFS_DUMP(GAM_GDP_AGC);
+   DBGFS_DUMP(GAM_GDP_VPO);
+   gdp_dbg_vpo(s, readl(gdp->regs + GAM_GDP_VPO_OFFSET));
+   DBGFS_DUMP(GAM_GDP_VPS);
+   gdp_dbg_vps(s, readl(gdp->regs + GAM_GDP_VPS_OFFSET));
+   DBGFS_DUMP(GAM_GDP_PML);
+   DBGFS_DUMP(GAM_GDP_PMP);
+   DBGFS_DUMP(GAM_GDP_SIZE);
+   gdp_dbg_size(s, readl(gdp->regs + GAM_GDP_SIZE_OFFSET));
+   DBGFS_DUMP(GAM_GDP_NVN);
+   gdp_dbg_nvn(s, gdp, readl(gdp->regs + GAM_GDP_NVN_OFFSET));
+   DBGFS_DUMP(GAM_GDP_KEY1);
+   DBGFS_DUMP(GAM_GDP_KEY2);
+   DBGFS_DUMP(GAM_GDP_PPT);
+   gdp_dbg_ppt(s, readl(gdp->regs + GAM_GDP_PPT_OFFSET));
+   DBGFS_DUMP(GAM_GDP_CML);
+   DBGFS_DUMP(GAM_GDP_MST);
+   gdp_dbg_mst(s, readl(gdp->regs + GAM_GDP_MST_OFFSET));
+
+   seq_puts(s, "\n\n");
+   if (!crtc)
+   seq_puts(s, "  Not connected to any DRM CRTC\n");
+   else
+   seq_printf(s, "  Connected to DRM CRTC #%d (%s)\n",
+  crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)));
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static void gdp_node_dump_node(struct seq_file *s, struct sti_gdp_node *node)
+{
+   seq_print

[PATCH 06/10] drm/sti: add debugfs entries for HQVDP plane

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 243 
 1 file changed, 243 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index eace56d..8d2118a 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -414,6 +414,246 @@ static int sti_hqvdp_get_curr_cmd(struct sti_hqvdp *hqvdp)
 }

 /**
+ * sti_hqvdp_get_next_cmd
+ * @hqvdp: hqvdp structure
+ *
+ * Look for the next hqvdp_cmd that will be used by the FW.
+ *
+ * RETURNS:
+ *  the offset of the next command that will be used.
+ * -1 in error cases
+ */
+static int sti_hqvdp_get_next_cmd(struct sti_hqvdp *hqvdp)
+{
+   int next_cmd;
+   dma_addr_t cmd = hqvdp->hqvdp_cmd_paddr;
+   unsigned int i;
+
+   next_cmd = readl(hqvdp->regs + HQVDP_MBX_NEXT_CMD);
+
+   for (i = 0; i < NB_VDP_CMD; i++) {
+   if (cmd == next_cmd)
+   return i * sizeof(struct sti_hqvdp_cmd);
+
+   cmd += sizeof(struct sti_hqvdp_cmd);
+   }
+
+   return -1;
+}
+
+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(hqvdp->regs + reg))
+
+static const char *hqvdp_dbg_get_lut(u32 *coef)
+{
+   if (!memcmp(coef, coef_lut_a_legacy, 16))
+   return "LUT A";
+   if (!memcmp(coef, coef_lut_b, 16))
+   return "LUT B";
+   if (!memcmp(coef, coef_lut_c_y_legacy, 16))
+   return "LUT C Y";
+   if (!memcmp(coef, coef_lut_c_c_legacy, 16))
+   return "LUT C C";
+   if (!memcmp(coef, coef_lut_d_y_legacy, 16))
+   return "LUT D Y";
+   if (!memcmp(coef, coef_lut_d_c_legacy, 16))
+   return "LUT D C";
+   if (!memcmp(coef, coef_lut_e_y_legacy, 16))
+   return "LUT E Y";
+   if (!memcmp(coef, coef_lut_e_c_legacy, 16))
+   return "LUT E C";
+   if (!memcmp(coef, coef_lut_f_y_legacy, 16))
+   return "LUT F Y";
+   if (!memcmp(coef, coef_lut_f_c_legacy, 16))
+   return "LUT F C";
+   return "";
+}
+
+static void hqvdp_dbg_dump_cmd(struct seq_file *s, struct sti_hqvdp_cmd *c)
+{
+   int src_w, src_h, dst_w, dst_h;
+
+   seq_puts(s, "\n\tTOP:");
+   seq_printf(s, "\n\t %-20s 0x%08X", "Config", c->top.config);
+   switch (c->top.config) {
+   case TOP_CONFIG_PROGRESSIVE:
+   seq_puts(s, "\tProgressive");
+   break;
+   case TOP_CONFIG_INTER_TOP:
+   seq_puts(s, "\tInterlaced, top field");
+   break;
+   case TOP_CONFIG_INTER_BTM:
+   seq_puts(s, "\tInterlaced, bottom field");
+   break;
+   default:
+   seq_puts(s, "\t");
+   break;
+   }
+
+   seq_printf(s, "\n\t %-20s 0x%08X", "MemFormat", c->top.mem_format);
+   seq_printf(s, "\n\t %-20s 0x%08X", "CurrentY", c->top.current_luma);
+   seq_printf(s, "\n\t %-20s 0x%08X", "CurrentC", c->top.current_chroma);
+   seq_printf(s, "\n\t %-20s 0x%08X", "YSrcPitch", c->top.luma_src_pitch);
+   seq_printf(s, "\n\t %-20s 0x%08X", "CSrcPitch",
+  c->top.chroma_src_pitch);
+   seq_printf(s, "\n\t %-20s 0x%08X", "InputFrameSize",
+  c->top.input_frame_size);
+   seq_printf(s, "\t%dx%d",
+  c->top.input_frame_size & 0x,
+  c->top.input_frame_size >> 16);
+   seq_printf(s, "\n\t %-20s 0x%08X", "InputViewportSize",
+  c->top.input_viewport_size);
+   src_w = c->top.input_viewport_size & 0x;
+   src_h = c->top.input_viewport_size >> 16;
+   seq_printf(s, "\t%dx%d", src_w, src_h);
+
+   seq_puts(s, "\n\tHVSRC:");
+   seq_printf(s, "\n\t %-20s 0x%08X", "OutputPictureSize",
+  c->hvsrc.output_picture_size);
+   dst_w = c->hvsrc.output_picture_size & 0x;
+   dst_h = c->hvsrc.output_picture_size >> 16;
+   seq_printf(s, "\t%dx%d", dst_w, dst_h);
+   seq_printf(s, "\n\t %-20s 0x%08X", "ParamCtrl", c->hvsrc.param_ctrl);
+
+   seq_printf(s, "\n\t %-20s %s", "yh_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.yh_coef));
+   seq_printf(s, "\n\t %-20s %s", "ch_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.ch_coef));
+   seq_printf(s, "\n\t %-20s %s", "yv_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.yv_coef));
+   seq_printf(s, "\n\t %-20s %s", "cv_coef",
+  hqvdp_dbg_get_lut(c->hvsrc.cv_coef));
+
+   seq_printf(s, "\n\t %-20s", "ScaleH");
+   if (dst_w > src_w)
+   seq_printf(s, " %d/1", dst_w / src_w);
+   else
+   seq_printf(s, " 1/%d", src_w / dst_w);
+
+   seq_printf(s, "\n\t %-20s", "tScaleV");
+   if (dst_h > src_h)
+   seq_printf(s, " %d/1", dst_h / src_h);
+   else
+   seq_printf(s, " 1/%d", src_h / dst_h);
+
+   seq_puts(s

[PATCH 07/10] drm/sti: add debugfs entries for VID plane

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_compositor.c |  2 +-
 drivers/gpu/drm/sti/sti_vid.c| 94 +++-
 drivers/gpu/drm/sti/sti_vid.h|  4 +-
 3 files changed, 95 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index afed217..5b827a9 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -75,7 +75,7 @@ static int sti_compositor_bind(struct device *dev,
switch (desc[i].type) {
case STI_VID_SUBDEV:
compo->vid[vid_id++] =
-   sti_vid_create(compo->dev, desc[i].id,
+   sti_vid_create(compo->dev, drm_dev, desc[i].id,
   compo->regs + desc[i].offset);
break;
case STI_MIXER_MAIN_SUBDEV:
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 0a1e50c..5a2c5dc 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -54,6 +54,93 @@

 #define VID_MIN_HD_HEIGHT   720

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(vid->regs + reg))
+
+static void vid_dbg_ctl(struct seq_file *s, int val)
+{
+   val = val >> 30;
+   seq_puts(s, "\t");
+
+   if (!(val & 1))
+   seq_puts(s, "NOT ");
+   seq_puts(s, "ignored on main mixer - ");
+
+   if (!(val & 2))
+   seq_puts(s, "NOT ");
+   seq_puts(s, "ignored on aux mixer");
+}
+
+static void vid_dbg_vpo(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txdo:%4d\tydo:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void vid_dbg_vps(struct seq_file *s, int val)
+{
+   seq_printf(s, "\txds:%4d\tyds:%4d", val & 0x0FFF, (val >> 16) & 0x0FFF);
+}
+
+static void vid_dbg_mst(struct seq_file *s, int val)
+{
+   if (val & 1)
+   seq_puts(s, "\tBUFFER UNDERFLOW!");
+}
+
+static int vid_dbg_show(struct seq_file *s, void *arg)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_vid *vid = (struct sti_vid *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs);
+
+   DBGFS_DUMP(VID_CTL);
+   vid_dbg_ctl(s, readl(vid->regs + VID_CTL));
+   DBGFS_DUMP(VID_ALP);
+   DBGFS_DUMP(VID_CLF);
+   DBGFS_DUMP(VID_VPO);
+   vid_dbg_vpo(s, readl(vid->regs + VID_VPO));
+   DBGFS_DUMP(VID_VPS);
+   vid_dbg_vps(s, readl(vid->regs + VID_VPS));
+   DBGFS_DUMP(VID_KEY1);
+   DBGFS_DUMP(VID_KEY2);
+   DBGFS_DUMP(VID_MPR0);
+   DBGFS_DUMP(VID_MPR1);
+   DBGFS_DUMP(VID_MPR2);
+   DBGFS_DUMP(VID_MPR3);
+   DBGFS_DUMP(VID_MST);
+   vid_dbg_mst(s, readl(vid->regs + VID_MST));
+   DBGFS_DUMP(VID_BC);
+   DBGFS_DUMP(VID_TINT);
+   DBGFS_DUMP(VID_CSAT);
+   seq_puts(s, "\n");
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list vid_debugfs_files[] = {
+   { "vid", vid_dbg_show, 0, NULL },
+};
+
+static int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
+{
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_SIZE(vid_debugfs_files); i++)
+   vid_debugfs_files[i].data = vid;
+
+   return drm_debugfs_create_files(vid_debugfs_files,
+   ARRAY_SIZE(vid_debugfs_files),
+   minor->debugfs_root, minor);
+}
+
 void sti_vid_commit(struct sti_vid *vid,
struct drm_plane_state *state)
 {
@@ -122,8 +209,8 @@ static void sti_vid_init(struct sti_vid *vid)
writel(VID_CSAT_DFLT, vid->regs + VID_CSAT);
 }

-struct sti_vid *sti_vid_create(struct device *dev, int id,
-  void __iomem *baseaddr)
+struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
+  int id, void __iomem *baseaddr)
 {
struct sti_vid *vid;

@@ -139,5 +226,8 @@ struct sti_vid *sti_vid_create(struct device *dev, int id,

sti_vid_init(vid);

+   if (vid_debugfs_init(vid, drm_dev->primary))
+   DRM_ERROR("VID debugfs setup failed\n");
+
return vid;
 }
diff --git a/drivers/gpu/drm/sti/sti_vid.h b/drivers/gpu/drm/sti/sti_vid.h
index 5dea479..6c84234 100644
--- a/drivers/gpu/drm/sti/sti_vid.h
+++ b/drivers/gpu/drm/sti/sti_vid.h
@@ -23,7 +23,7 @@ struct sti_vid {
 void sti_vid_commit(struct sti_vid *vid,
struct drm_plane_state *state);
 void sti_vid_disable(struct sti_vid *vid);
-struct sti_vid *sti_vid_create(struct device *dev, int id,
-  void __iomem *baseaddr);
+struct sti_vid *sti_vid_create(str

[PATCH 09/10] drm/sti: add debugfs entries for TVOUT encoders

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c | 157 
 1 file changed, 157 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index 0b171fd..d4bb953 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -462,6 +462,157 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool 
main_path)
tvout_write(tvout, 0, TVO_HD_DAC_CFG_OFF);
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  readl(tvout->regs + reg))
+
+static void tvout_dbg_vip(struct seq_file *s, int val)
+{
+   int r, g, b, tmp, mask;
+   char *const reorder[] = {"Y_G", "Cb_B", "Cr_R"};
+   char *const clipping[] = {"No", "EAV/SAV", "Limited range RGB/Y",
+ "Limited range Cb/Cr", "decided by register"};
+   char *const round[] = {"8-bit", "10-bit", "12-bit"};
+   char *const input_sel[] = {"Main (color matrix enabled)",
+  "Main (color matrix by-passed)",
+  "", "", "", "", "", "",
+  "Aux (color matrix enabled)",
+  "Aux (color matrix by-passed)",
+  "", "", "", "", "", "Force value"};
+
+   seq_puts(s, "\t");
+   mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_R_SHIFT;
+   r = (val & mask) >> TVO_VIP_REORDER_R_SHIFT;
+   mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_G_SHIFT;
+   g = (val & mask) >> TVO_VIP_REORDER_G_SHIFT;
+   mask = TVO_VIP_REORDER_MASK << TVO_VIP_REORDER_B_SHIFT;
+   b = (val & mask) >> TVO_VIP_REORDER_B_SHIFT;
+   seq_printf(s, "%-24s %s->%s %s->%s %s->%s\n", "Reorder:",
+  reorder[r], reorder[TVO_VIP_REORDER_CR_R_SEL],
+  reorder[g], reorder[TVO_VIP_REORDER_Y_G_SEL],
+  reorder[b], reorder[TVO_VIP_REORDER_CB_B_SEL]);
+   seq_puts(s, "\t\t\t\t\t");
+   mask = TVO_VIP_CLIP_MASK << TVO_VIP_CLIP_SHIFT;
+   tmp = (val & mask) >> TVO_VIP_CLIP_SHIFT;
+   seq_printf(s, "%-24s %s\n", "Clipping:", clipping[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   mask = TVO_VIP_RND_MASK << TVO_VIP_RND_SHIFT;
+   tmp = (val & mask) >> TVO_VIP_RND_SHIFT;
+   seq_printf(s, "%-24s input data rounded to %s per component\n",
+  "Round:", round[tmp]);
+   seq_puts(s, "\t\t\t\t\t");
+   tmp = (val & TVO_VIP_SEL_INPUT_MASK);
+   seq_printf(s, "%-24s %s", "Input selection:", input_sel[tmp]);
+}
+
+static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val)
+{
+   seq_printf(s, "\t%-24s %s", "HD DAC:",
+  val & 1 ? "disabled" : "enabled");
+}
+
+static int tvout_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_crtc *crtc;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs);
+
+   seq_puts(s, "\n\n  HDMI encoder: ");
+   crtc = tvout->hdmi->crtc;
+   if (crtc) {
+   seq_printf(s, "connected to %s path",
+  sti_crtc_is_main(crtc) ? "main" : "aux");
+   DBGFS_DUMP(TVO_HDMI_SYNC_SEL);
+   DBGFS_DUMP(TVO_VIP_HDMI);
+   tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDMI));
+   } else {
+   seq_puts(s, "disabled");
+   }
+
+   seq_puts(s, "\n\n  DVO encoder: ");
+   crtc = tvout->dvo->crtc;
+   if (crtc) {
+   seq_printf(s, "connected to %s path",
+  sti_crtc_is_main(crtc) ? "main" : "aux");
+   DBGFS_DUMP(TVO_DVO_SYNC_SEL);
+   DBGFS_DUMP(TVO_DVO_CONFIG);
+   DBGFS_DUMP(TVO_VIP_DVO);
+   tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_DVO));
+   } else {
+   seq_puts(s, "disabled");
+   }
+
+   seq_puts(s, "\n\n  HDA encoder: ");
+   crtc = tvout->hda->crtc;
+   if (crtc) {
+   seq_printf(s, "connected to %s path",
+  sti_crtc_is_main(crtc) ? "main" : "aux");
+   DBGFS_DUMP(TVO_HD_SYNC_SEL);
+   DBGFS_DUMP(TVO_HD_DAC_CFG_OFF);
+   tvout_dbg_hd_dac_cfg(s,
+readl(tvout->regs + TVO_HD_DAC_CFG_OFF));
+   DBGFS_DUMP(TVO_VIP_HDF);
+   tvout_dbg_vip(s, readl(tvout->regs + TVO_VIP_HDF));
+   } else {
+   seq_puts(s, "disabled");
+   }
+
+   seq_puts(s, "\n\n  main path configuration");
+   DBGFS_DUMP(TVO_CSC_MAIN_M0);
+   DBGFS_DUMP(TVO_CSC_MAIN_M1);
+   DBGFS_DUMP(TVO_CSC_MAIN_M2);
+   DBGFS_DUMP(TVO

[PATCH 08/10] drm/sti: add debugfs entries for MIXER crtc

2016-02-12 Thread Vincent Abriou
Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_compositor.c |   2 +-
 drivers/gpu/drm/sti/sti_mixer.c  | 146 ++-
 drivers/gpu/drm/sti/sti_mixer.h  |   4 +-
 3 files changed, 149 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index 5b827a9..3d2fa3a 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -81,7 +81,7 @@ static int sti_compositor_bind(struct device *dev,
case STI_MIXER_MAIN_SUBDEV:
case STI_MIXER_AUX_SUBDEV:
compo->mixer[mixer_id++] =
-   sti_mixer_create(compo->dev, desc[i].id,
+   sti_mixer_create(compo->dev, drm_dev, desc[i].id,
 compo->regs + desc[i].offset);
break;
case STI_GPD_SUBDEV:
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 49db835..e7425c3 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -75,6 +75,145 @@ static inline void sti_mixer_reg_write(struct sti_mixer 
*mixer,
writel(val, mixer->regs + reg_id);
 }

+#define DBGFS_DUMP(reg) seq_printf(s, "\n  %-25s 0x%08X", #reg, \
+  sti_mixer_reg_read(mixer, reg))
+
+static void mixer_dbg_ctl(struct seq_file *s, int val)
+{
+   unsigned int i;
+   int count = 0;
+   char *const disp_layer[] = {"BKG", "VID0", "VID1", "GDP0",
+   "GDP1", "GDP2", "GDP3"};
+
+   seq_puts(s, "\tEnabled: ");
+   for (i = 0; i < 7; i++) {
+   if (val & 1) {
+   seq_printf(s, "%s ", disp_layer[i]);
+   count++;
+   }
+   val = val >> 1;
+   }
+
+   val = val >> 2;
+   if (val & 1) {
+   seq_puts(s, "CURS ");
+   count++;
+   }
+   if (!count)
+   seq_puts(s, "Nothing");
+}
+
+static void mixer_dbg_crb(struct seq_file *s, int val)
+{
+   int i;
+
+   seq_puts(s, "\tDepth: ");
+   for (i = 0; i < GAM_MIXER_NB_DEPTH_LEVEL; i++) {
+   switch (val & GAM_DEPTH_MASK_ID) {
+   case GAM_DEPTH_VID0_ID:
+   seq_puts(s, "VID0");
+   break;
+   case GAM_DEPTH_VID1_ID:
+   seq_puts(s, "VID1");
+   break;
+   case GAM_DEPTH_GDP0_ID:
+   seq_puts(s, "GDP0");
+   break;
+   case GAM_DEPTH_GDP1_ID:
+   seq_puts(s, "GDP1");
+   break;
+   case GAM_DEPTH_GDP2_ID:
+   seq_puts(s, "GDP2");
+   break;
+   case GAM_DEPTH_GDP3_ID:
+   seq_puts(s, "GDP3");
+   break;
+   default:
+   seq_puts(s, "---");
+   }
+
+   if (i < GAM_MIXER_NB_DEPTH_LEVEL - 1)
+   seq_puts(s, " < ");
+   val = val >> 3;
+   }
+}
+
+static void mixer_dbg_mxn(struct seq_file *s, void *addr)
+{
+   int i;
+
+   for (i = 1; i < 8; i++)
+   seq_printf(s, "-0x%08X", (int)readl(addr + i * 4));
+}
+
+static int mixer_dbg_show(struct seq_file *s, void *arg)
+{
+   struct drm_info_node *node = s->private;
+   struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data;
+   struct drm_device *dev = node->minor->dev;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   seq_printf(s, "%s: (vaddr = 0x%p)",
+  sti_mixer_to_str(mixer), mixer->regs);
+
+   DBGFS_DUMP(GAM_MIXER_CTL);
+   mixer_dbg_ctl(s, sti_mixer_reg_read(mixer, GAM_MIXER_CTL));
+   DBGFS_DUMP(GAM_MIXER_BKC);
+   DBGFS_DUMP(GAM_MIXER_BCO);
+   DBGFS_DUMP(GAM_MIXER_BCS);
+   DBGFS_DUMP(GAM_MIXER_AVO);
+   DBGFS_DUMP(GAM_MIXER_AVS);
+   DBGFS_DUMP(GAM_MIXER_CRB);
+   mixer_dbg_crb(s, sti_mixer_reg_read(mixer, GAM_MIXER_CRB));
+   DBGFS_DUMP(GAM_MIXER_ACT);
+   DBGFS_DUMP(GAM_MIXER_MBP);
+   DBGFS_DUMP(GAM_MIXER_MX0);
+   mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0);
+   seq_puts(s, "\n");
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list mixer0_debugfs_files[] = {
+   { "mixer_main", mixer_dbg_show, 0, NULL },
+};
+
+static struct drm_info_list mixer1_debugfs_files[] = {
+   { "mixer_aux", mixer_dbg_show, 0, NULL },
+};
+
+static int mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
+{
+   unsigned int i;
+   struct drm_info_list *mixer_debugfs_files;
+   int nb_files;
+
+   switch (mixer->id) {
+   case STI_MIXER_MAIN:
+ 

[PATCH 10/10] drm/sti: add debugfs fps_show/fps_get mechanism for planes

2016-02-12 Thread Vincent Abriou
Display fps on demand for each used plane:
cat /sys/kernel/debug/dri/0/fps_get
Display fps in live in the console for each used plane:
echo 255 > /sys/kernel/debug/dri/0/fps_show

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_cursor.c |   2 +
 drivers/gpu/drm/sti/sti_drv.c| 128 +++
 drivers/gpu/drm/sti/sti_gdp.c|   2 +
 drivers/gpu/drm/sti/sti_hqvdp.c  |  11 ++--
 drivers/gpu/drm/sti/sti_plane.c  |  63 +++
 drivers/gpu/drm/sti/sti_plane.h  |  17 ++
 6 files changed, 216 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 9eac1b9..82b5711 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -306,6 +306,8 @@ static void sti_cursor_atomic_update(struct drm_plane 
*drm_plane,
writel(cursor->clut_paddr, cursor->regs + CUR_CML);
writel(CUR_CTL_CLUT_UPDATE, cursor->regs + CUR_CTL);

+   sti_plane_update_fps(plane, true, false);
+
plane->status = STI_PLANE_UPDATED;
 }

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index bcb1861..e5ef6b6 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -20,6 +20,7 @@

 #include "sti_crtc.h"
 #include "sti_drv.h"
+#include "sti_plane.h"

 #define DRIVER_NAME"sti"
 #define DRIVER_DESC"STMicroelectronics SoC DRM"
@@ -30,6 +31,130 @@
 #define STI_MAX_FB_HEIGHT  4096
 #define STI_MAX_FB_WIDTH   4096

+static int sti_drm_fps_get(void *data, u64 *val)
+{
+   struct drm_device *drm_dev = data;
+   struct drm_plane *p;
+   unsigned int i = 0;
+
+   *val = 0;
+   list_for_each_entry(p, &drm_dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   *val |= plane->fps_info.output << i;
+   i++;
+   }
+
+   return 0;
+}
+
+static int sti_drm_fps_set(void *data, u64 val)
+{
+   struct drm_device *drm_dev = data;
+   struct drm_plane *p;
+   unsigned int i = 0;
+
+   list_for_each_entry(p, &drm_dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   plane->fps_info.output = (val >> i) & 1;
+   i++;
+   }
+
+   return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(sti_drm_fps_fops,
+   sti_drm_fps_get, sti_drm_fps_set, "%llu\n");
+
+static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
+{
+   struct drm_info_node *node = s->private;
+   struct drm_device *dev = node->minor->dev;
+   struct drm_plane *p;
+   int ret;
+
+   ret = mutex_lock_interruptible(&dev->struct_mutex);
+   if (ret)
+   return ret;
+
+   list_for_each_entry(p, &dev->mode_config.plane_list, head) {
+   struct sti_plane *plane = to_sti_plane(p);
+
+   seq_printf(s, "%s%s\n",
+  plane->fps_info.fps_str,
+  plane->fps_info.fips_str);
+   }
+
+   mutex_unlock(&dev->struct_mutex);
+   return 0;
+}
+
+static struct drm_info_list sti_drm_dbg_list[] = {
+   {"fps_get", sti_drm_fps_dbg_show, 0},
+};
+
+static int sti_drm_debugfs_create(struct dentry *root,
+ struct drm_minor *minor,
+ const char *name,
+ const struct file_operations *fops)
+{
+   struct drm_device *dev = minor->dev;
+   struct drm_info_node *node;
+   struct dentry *ent;
+
+   ent = debugfs_create_file(name, S_IRUGO | S_IWUSR, root, dev, fops);
+   if (IS_ERR(ent))
+   return PTR_ERR(ent);
+
+   node = kmalloc(sizeof(*node), GFP_KERNEL);
+   if (!node) {
+   debugfs_remove(ent);
+   return -ENOMEM;
+   }
+
+   node->minor = minor;
+   node->dent = ent;
+   node->info_ent = (void *)fops;
+
+   mutex_lock(&minor->debugfs_lock);
+   list_add(&node->list, &minor->debugfs_list);
+   mutex_unlock(&minor->debugfs_lock);
+
+   return 0;
+}
+
+static int sti_drm_dbg_init(struct drm_minor *minor)
+{
+   int ret;
+
+   ret = drm_debugfs_create_files(sti_drm_dbg_list,
+  ARRAY_SIZE(sti_drm_dbg_list),
+  minor->debugfs_root, minor);
+   if (ret)
+   goto err;
+
+   ret = sti_drm_debugfs_create(minor->debugfs_root, minor, "fps_show",
+&sti_drm_fps_fops);
+   if (ret)
+   goto err;
+
+   DRM_INFO("%s: debugfs installed\n", DRIVER_NAME);
+   return 0;
+err:
+   DRM_ERROR("%s: cannot install debugfs\n", DRIVER_NAME);
+   return ret;
+}
+
+void sti_drm_dbg_cleanup(struct drm_minor *minor)
+{
+   drm_debugfs_remove_files(sti_drm_dbg_list,
+ARRAY_SIZE(sti_drm_dbg_list), minor);
+
+   drm_deb

[PATCH v5 0/5] drm/dsi: DSI for devices with different control bus

2016-02-12 Thread Archit Taneja
We are currently restricted when it comes to supporting DSI on devices
that have a non-DSI control bus. For example, DSI encoder chips are
available in the market that are configured via i2c. Configuring their
registers via DSI bus is either optional or not available at all.

These devices still need to pass DSI parameters (data lanes, mode flags
etc) to the DSI host they are connected to. We don't have a way to do
that at the moment.

After some discussions on the previous RFC[1], we decided to support this
by providing additional API in drm_mipi_dsi.c which lets us create new DSI
devices without the need of them to have a DT node.

[1]: https://lkml.org/lkml/2015/6/30/42

Changes in v5:
- Simplify refactoring as suggested by Thierry.
- Use abbreviations correctly.
- Drop "drm/dsi: Check for used channels"
- Return the correct encoded error code for of_mipi_dsi_device_add
  when CONFIG_OF is disabled.
- Use mipi_dsi_device_unregister to implement mipi_dsi_remove_device_fn()
  too.

Changes in v4:
- Added a new patch that fixes build issues when CONFIG_OF is not set.

Changes in v3:

- Incorporated misc comments by Andrzej. Changed from RFC to a PATCH set.
- Fixed htmldocs warnings.


Archit Taneja (5):
  drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add
  drm/dsi: Use mipi_dsi_device_register_full for DSI device creation
  drm/dsi: Try to match non-DT DSI devices
  drm/dsi: Add routine to unregister a DSI device
  drm/dsi: Get DSI host by DT device node

 drivers/gpu/drm/drm_mipi_dsi.c | 127 +
 include/drm/drm_mipi_dsi.h |  26 +
 2 files changed, 141 insertions(+), 12 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 1/5] drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add

2016-02-12 Thread Archit Taneja
of_mipi_dsi_device_add is used only when CONFIG_OF is enabled. It
currently works if OF support is disabled, but this will change
when we add more functionality to it.

Define the original func if CONFIG_OF is enabled. Define a dummy func
otherwise.

Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 6e6a9c5..4f2a704 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -129,6 +129,7 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
return device_add(&dsi->dev);
 }

+#if IS_ENABLED(CONFIG_OF)
 static struct mipi_dsi_device *
 of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
 {
@@ -170,6 +171,13 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)

return dsi;
 }
+#else
+static struct mipi_dsi_device *
+of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
+{
+   return ERR_PTR(-ENODEV);
+}
+#endif

 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 2/5] drm/dsi: Use mipi_dsi_device_register_full for DSI device creation

2016-02-12 Thread Archit Taneja
Use mipi_dsi_device_register_full for device creation. This takes in
mipi_dsi_device_info as a template to populate the DSI device information.

The reason to introduce this is to have a way to create DSI devices not
available via DT. Drivers that want to create a DSI device can populate
mipi_dsi_device_info and call this function. For DSI devices available
via DT, of_mipi_dsi_device_add is used as before, but this now calls
mipi_dsi_device_register_full internally.

Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 64 +++---
 include/drm/drm_mipi_dsi.h | 16 +++
 2 files changed, 63 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 4f2a704..5d7243d 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -133,8 +133,8 @@ static int mipi_dsi_device_add(struct mipi_dsi_device *dsi)
 static struct mipi_dsi_device *
 of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
 {
-   struct mipi_dsi_device *dsi;
struct device *dev = host->dev;
+   struct mipi_dsi_device_info info = { };
int ret;
u32 reg;

@@ -145,39 +145,69 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)
return ERR_PTR(-EINVAL);
}

-   if (reg > 3) {
-   dev_err(dev, "device node %s has invalid reg property: %u\n",
-   node->full_name, reg);
+   info.channel = reg;
+   info.node = of_node_get(node);
+
+   return mipi_dsi_device_register_full(host, &info);
+}
+#else
+static struct mipi_dsi_device *
+of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
+{
+   return ERR_PTR(-ENODEV);
+}
+#endif
+
+/**
+ * mipi_dsi_device_register_full - create a MIPI DSI device
+ * @host: DSI host to which this device is connected
+ * @info: pointer to template containing DSI device information
+ *
+ * Create a MIPI DSI device by using the device information provided by
+ * mipi_dsi_device_info template
+ *
+ * Returns:
+ * A pointer to the newly created MIPI DSI device, or, a pointer encoded
+ * with an error
+ */
+struct mipi_dsi_device *
+mipi_dsi_device_register_full(struct mipi_dsi_host *host,
+ const struct mipi_dsi_device_info *info)
+{
+   struct mipi_dsi_device *dsi;
+   struct device *dev = host->dev;
+   int ret;
+
+   if (!info) {
+   dev_err(dev, "invalid mipi_dsi_device_info pointer\n");
+   return ERR_PTR(-EINVAL);
+   }
+
+   if (info->channel > 3) {
+   dev_err(dev, "invalid virtual channel: %u\n", info->channel);
return ERR_PTR(-EINVAL);
}

dsi = mipi_dsi_device_alloc(host);
if (IS_ERR(dsi)) {
-   dev_err(dev, "failed to allocate DSI device %s: %ld\n",
-   node->full_name, PTR_ERR(dsi));
+   dev_err(dev, "failed to allocate DSI device %ld\n",
+   PTR_ERR(dsi));
return dsi;
}

-   dsi->dev.of_node = of_node_get(node);
-   dsi->channel = reg;
+   dsi->dev.of_node = info->node;
+   dsi->channel = info->channel;

ret = mipi_dsi_device_add(dsi);
if (ret) {
-   dev_err(dev, "failed to add DSI device %s: %d\n",
-   node->full_name, ret);
+   dev_err(dev, "failed to add DSI device %d\n", ret);
kfree(dsi);
return ERR_PTR(ret);
}

return dsi;
 }
-#else
-static struct mipi_dsi_device *
-of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
-{
-   return ERR_PTR(-ENODEV);
-}
-#endif
+EXPORT_SYMBOL(mipi_dsi_device_register_full);

 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 1b3b1f8..ce5eae43 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -139,6 +139,19 @@ enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB565,
 };

+ /**
+ * struct mipi_dsi_device_info - template for creating a mipi_dsi_device
+ * @channel: DSI virtual channel assigned to peripheral
+ * @node: pointer to OF device node
+ *
+ * This is populated and passed to mipi_dsi_device_new to create a new
+ * DSI device
+ */
+struct mipi_dsi_device_info {
+   u32 channel;
+   struct device_node *node;
+};
+
 /**
  * struct mipi_dsi_device - DSI peripheral device
  * @host: DSI host for this peripheral
@@ -188,6 +201,9 @@ static inline int mipi_dsi_pixel_format_to_bpp(enum 
mipi_dsi_pixel_format fmt)
return -EINVAL;
 }

+struct mipi_dsi_device *
+mipi_dsi_device_register_full(struct mipi_dsi_host *host,
+ const struct mipi_dsi_device_info *info);
 struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node 
*np);
 int mipi_dsi_attach(

[PATCH v5 3/5] drm/dsi: Try to match non-DT DSI devices

2016-02-12 Thread Archit Taneja
Add a device name field in mipi_dsi_device. This name is different from
the actual dev name (which is of the format "hostname.reg"). When the
device is created via DT, this name is set to the modalias string.
In the non-DT case, the driver creating the DSI device provides the
name by populating a filed in mipi_dsi_device_info.

Matching for DT case would be as it was before. For the non-DT case,
we compare the device and driver names. Other buses (like I2C/SPI)
perform a non-DT match by comparing the device name and entries in the
driver's id_table. Such a mechanism isn't used for the DSI bus.

Reviewed-by: Andrzej Hajda 
Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 18 +-
 include/drm/drm_mipi_dsi.h | 10 --
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 5d7243d..42a7aac 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -47,7 +47,17 @@

 static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
 {
-   return of_driver_match_device(dev, drv);
+   struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
+
+   /* attempt OF style match */
+   if (of_driver_match_device(dev, drv))
+   return 1;
+
+   /* compare DSI device and driver names */
+   if (!strcmp(dsi->name, drv->name))
+   return 1;
+
+   return 0;
 }

 static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
@@ -138,6 +148,11 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)
int ret;
u32 reg;

+   if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
+   dev_err(dev, "modalias failure on %s\n", node->full_name);
+   return ERR_PTR(-EINVAL);
+   }
+
ret = of_property_read_u32(node, "reg", ®);
if (ret) {
dev_err(dev, "device node %s has no valid reg property: %d\n",
@@ -197,6 +212,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,

dsi->dev.of_node = info->node;
dsi->channel = info->channel;
+   strlcpy(dsi->name, info->type, sizeof(dsi->name));

ret = mipi_dsi_device_add(dsi);
if (ret) {
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index ce5eae43..a914116 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -139,15 +139,19 @@ enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB565,
 };

- /**
+#define DSI_DEV_NAME_SIZE  20
+
+/**
  * struct mipi_dsi_device_info - template for creating a mipi_dsi_device
+ * @type: DSI peripheral chip type
  * @channel: DSI virtual channel assigned to peripheral
- * @node: pointer to OF device node
+ * @node: pointer to OF device node or NULL
  *
  * This is populated and passed to mipi_dsi_device_new to create a new
  * DSI device
  */
 struct mipi_dsi_device_info {
+   char type[DSI_DEV_NAME_SIZE];
u32 channel;
struct device_node *node;
 };
@@ -156,6 +160,7 @@ struct mipi_dsi_device_info {
  * struct mipi_dsi_device - DSI peripheral device
  * @host: DSI host for this peripheral
  * @dev: driver model device node for this peripheral
+ * @name: DSI peripheral chip type
  * @channel: virtual channel assigned to the peripheral
  * @format: pixel format for video mode
  * @lanes: number of active data lanes
@@ -165,6 +170,7 @@ struct mipi_dsi_device {
struct mipi_dsi_host *host;
struct device dev;

+   char name[DSI_DEV_NAME_SIZE];
unsigned int channel;
unsigned int lanes;
enum mipi_dsi_pixel_format format;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 4/5] drm/dsi: Add routine to unregister a DSI device

2016-02-12 Thread Archit Taneja
A driver calling mipi_dsi_device_register_full might want to unregister
the device once it's done. It might also require it in an error handling
path in case something didn't go right.

Create mipi_dsi_device_unregister for this purpse, use it within
mipi_dsi_remove_device_fn as it does the same thing.

Reviewed-by: Andrzej Hajda 
Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 12 +++-
 include/drm/drm_mipi_dsi.h |  1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 42a7aac..f2f5a6d 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -225,6 +225,16 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
 }
 EXPORT_SYMBOL(mipi_dsi_device_register_full);

+/**
+ * mipi_dsi_device_unregister - unregister MIPI DSI device
+ * @dsi: DSI peripheral device
+ */
+void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi)
+{
+   device_unregister(&dsi->dev);
+}
+EXPORT_SYMBOL(mipi_dsi_device_unregister);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
struct device_node *node;
@@ -244,7 +254,7 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
void *priv)
 {
struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);

-   device_unregister(&dsi->dev);
+   mipi_dsi_device_unregister(dsi);

return 0;
 }
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index a914116..06e0a93 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -210,6 +210,7 @@ static inline int mipi_dsi_pixel_format_to_bpp(enum 
mipi_dsi_pixel_format fmt)
 struct mipi_dsi_device *
 mipi_dsi_device_register_full(struct mipi_dsi_host *host,
  const struct mipi_dsi_device_info *info);
+void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi);
 struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node 
*np);
 int mipi_dsi_attach(struct mipi_dsi_device *dsi);
 int mipi_dsi_detach(struct mipi_dsi_device *dsi);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH v5 5/5] drm/dsi: Get DSI host by DT device node

2016-02-12 Thread Archit Taneja
MIPI DSI devices are inherently aware of their host because they share a
parent-child hierarchy in the device tree.

Non-DSI drivers that create DSI device don't have this data. In order to
get this information, they require to a phandle to the DSI host in the
device tree.

Maintain a list of all the hosts DSI that are currently registered. This
list will be used to find the mipi_dsi_host corresponding to the
device_node passed in of_find_mipi_dsi_host_by_node.

Reviewed-by: Andrzej Hajda 
Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 39 +++
 include/drm/drm_mipi_dsi.h |  3 +++
 2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index f2f5a6d..f5d8083 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -235,6 +235,37 @@ void mipi_dsi_device_unregister(struct mipi_dsi_device 
*dsi)
 }
 EXPORT_SYMBOL(mipi_dsi_device_unregister);

+static DEFINE_MUTEX(host_lock);
+static LIST_HEAD(host_list);
+
+/**
+ * of_find_mipi_dsi_host_by_node() - find the MIPI DSI host matching a
+ *  device tree node
+ * @node: device tree node
+ *
+ * Returns:
+ * A pointer to the MIPI DSI host corresponding to @node or NULL if no
+ * such device exists (or has not been registered yet).
+ */
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
+{
+   struct mipi_dsi_host *host;
+
+   mutex_lock(&host_lock);
+
+   list_for_each_entry(host, &host_list, list) {
+   if (host->dev->of_node == node) {
+   mutex_unlock(&host_lock);
+   return host;
+   }
+   }
+
+   mutex_unlock(&host_lock);
+
+   return NULL;
+}
+EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
struct device_node *node;
@@ -246,6 +277,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
of_mipi_dsi_device_add(host, node);
}

+   mutex_lock(&host_lock);
+   list_add_tail(&host->list, &host_list);
+   mutex_unlock(&host_lock);
+
return 0;
 }
 EXPORT_SYMBOL(mipi_dsi_host_register);
@@ -262,6 +297,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
void *priv)
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
 {
device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
+
+   mutex_lock(&host_lock);
+   list_del_init(&host->list);
+   mutex_unlock(&host_lock);
 }
 EXPORT_SYMBOL(mipi_dsi_host_unregister);

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 06e0a93..7a9840f 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -96,14 +96,17 @@ struct mipi_dsi_host_ops {
  * struct mipi_dsi_host - DSI host device
  * @dev: driver model device node for this DSI host
  * @ops: DSI host operations
+ * @list: list management
  */
 struct mipi_dsi_host {
struct device *dev;
const struct mipi_dsi_host_ops *ops;
+   struct list_head list;
 };

 int mipi_dsi_host_register(struct mipi_dsi_host *host);
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);

 /* DSI mode flags */

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation



[PATCH 1/4] drm/sti: update VTG timing programming

2016-02-12 Thread Vincent Abriou
This update eases to understand the VTG programming.
It also sets a VTG output id for each supported connectors.

Signed-off-by: Vincent Abriou 
---
 drivers/gpu/drm/sti/sti_tvout.c |  59 ++--
 drivers/gpu/drm/sti/sti_vtg.c   | 197 
 drivers/gpu/drm/sti/sti_vtg.h   |   5 +
 3 files changed, 173 insertions(+), 88 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index f2afcf5..4c52259 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -17,6 +17,7 @@
 #include 

 #include "sti_crtc.h"
+#include "sti_vtg.h"

 /* glue registers */
 #define TVO_CSC_MAIN_M0  0x000
@@ -85,19 +86,7 @@
 #define TVO_VIP_SEL_INPUT_BYPASSED   1

 #define TVO_SYNC_MAIN_VTG_SET_REF0x00
-#define TVO_SYNC_MAIN_VTG_SET_1  0x01
-#define TVO_SYNC_MAIN_VTG_SET_2  0x02
-#define TVO_SYNC_MAIN_VTG_SET_3  0x03
-#define TVO_SYNC_MAIN_VTG_SET_4  0x04
-#define TVO_SYNC_MAIN_VTG_SET_5  0x05
-#define TVO_SYNC_MAIN_VTG_SET_6  0x06
 #define TVO_SYNC_AUX_VTG_SET_REF 0x10
-#define TVO_SYNC_AUX_VTG_SET_1   0x11
-#define TVO_SYNC_AUX_VTG_SET_2   0x12
-#define TVO_SYNC_AUX_VTG_SET_3   0x13
-#define TVO_SYNC_AUX_VTG_SET_4   0x14
-#define TVO_SYNC_AUX_VTG_SET_5   0x15
-#define TVO_SYNC_AUX_VTG_SET_6   0x16

 #define TVO_SYNC_HD_DCS_SHIFT8

@@ -280,24 +269,26 @@ static void tvout_dvo_start(struct sti_tvout *tvout, bool 
main_path)
struct device_node *node = tvout->dev->of_node;
bool sel_input_logic_inverted = false;
u32 tvo_in_vid_format;
-   int val;
+   int val, tmp;

dev_dbg(tvout->dev, "%s\n", __func__);

if (main_path) {
DRM_DEBUG_DRIVER("main vip for DVO\n");
-   /* Select the input sync for dvo = VTG set 4 */
-   val  = TVO_SYNC_MAIN_VTG_SET_4 << TVO_SYNC_DVO_PAD_VSYNC_SHIFT;
-   val |= TVO_SYNC_MAIN_VTG_SET_4 << TVO_SYNC_DVO_PAD_HSYNC_SHIFT;
-   val |= TVO_SYNC_MAIN_VTG_SET_4;
+   /* Select the input sync for dvo */
+   tmp = TVO_SYNC_MAIN_VTG_SET_REF | VTG_SYNC_ID_DVO;
+   val  = tmp << TVO_SYNC_DVO_PAD_VSYNC_SHIFT;
+   val |= tmp << TVO_SYNC_DVO_PAD_HSYNC_SHIFT;
+   val |= tmp;
tvout_write(tvout, val, TVO_DVO_SYNC_SEL);
tvo_in_vid_format = TVO_MAIN_IN_VID_FORMAT;
} else {
DRM_DEBUG_DRIVER("aux vip for DVO\n");
-   /* Select the input sync for dvo = VTG set 4 */
-   val  = TVO_SYNC_AUX_VTG_SET_4 << TVO_SYNC_DVO_PAD_VSYNC_SHIFT;
-   val |= TVO_SYNC_AUX_VTG_SET_4 << TVO_SYNC_DVO_PAD_HSYNC_SHIFT;
-   val |= TVO_SYNC_AUX_VTG_SET_4;
+   /* Select the input sync for dvo */
+   tmp = TVO_SYNC_AUX_VTG_SET_REF | VTG_SYNC_ID_DVO;
+   val  = tmp << TVO_SYNC_DVO_PAD_VSYNC_SHIFT;
+   val |= tmp << TVO_SYNC_DVO_PAD_HSYNC_SHIFT;
+   val |= tmp;
tvout_write(tvout, val, TVO_DVO_SYNC_SEL);
tvo_in_vid_format = TVO_AUX_IN_VID_FORMAT;
}
@@ -345,13 +336,17 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, 
bool main_path)

if (main_path) {
DRM_DEBUG_DRIVER("main vip for hdmi\n");
-   /* select the input sync for hdmi = VTG set 1 */
-   tvout_write(tvout, TVO_SYNC_MAIN_VTG_SET_1, TVO_HDMI_SYNC_SEL);
+   /* select the input sync for hdmi */
+   tvout_write(tvout,
+   TVO_SYNC_MAIN_VTG_SET_REF | VTG_SYNC_ID_HDMI,
+   TVO_HDMI_SYNC_SEL);
tvo_in_vid_format = TVO_MAIN_IN_VID_FORMAT;
} else {
DRM_DEBUG_DRIVER("aux vip for hdmi\n");
-   /* select the input sync for hdmi = VTG set 1 */
-   tvout_write(tvout, TVO_SYNC_AUX_VTG_SET_1, TVO_HDMI_SYNC_SEL);
+   /* select the input sync for hdmi */
+   tvout_write(tvout,
+   TVO_SYNC_AUX_VTG_SET_REF | VTG_SYNC_ID_HDMI,
+   TVO_HDMI_SYNC_SEL);
tvo_in_vid_format = TVO_AUX_IN_VID_FORMAT;
}

@@ -397,13 +392,19 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool 
main_path)
dev_dbg(tvout->dev, "%s\n", __func__);

if (main_path) {
-   val = TVO_SYNC_MAIN_VTG_SET_2 << TVO_SYNC_HD_DCS_SHIFT;
-   val |= TVO_SYNC_MAIN_VTG_SET_3;
+   DRM_DEBUG_DRIVER("main vip for HDF\n");
+   /* Select the input sync for HD analog and HD DCS */
+   val  = TVO_SYNC_MAIN_VTG_SET_REF | VTG_SYNC_ID_HDDCS;
+   val  = val << TVO_SYNC_HD_DCS_SHIFT;
+   val |= TVO_SYNC_MAIN_VTG_SET_REF | VTG_SYNC_ID_HDF;
tvout_write(tvout, val, TVO_HD_S

[PATCH 4/4] drm/sti: GDP planes only support RGB formats

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

Only RGB formats supported by GDP planes

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_gdp.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 990b28e..a34284be 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -32,10 +32,6 @@
 #define GDP_ABGR(GDP_ARGB | BIGNOTLITTLE | ALPHASWITCH)
 #define GDP_ARGB15550x06
 #define GDP_ARGB0x07
-#define GDP_CLUT8   0x0B
-#define GDP_YCBR888 0x10
-#define GDP_YCBR422R0x12
-#define GDP_AYCBR   0x15

 #define GAM_GDP_CTL_OFFSET  0x00
 #define GAM_GDP_AGC_OFFSET  0x04
@@ -123,10 +119,6 @@ static const uint32_t gdp_supported_formats[] = {
DRM_FORMAT_ARGB1555,
DRM_FORMAT_RGB565,
DRM_FORMAT_RGB888,
-   DRM_FORMAT_AYUV,
-   DRM_FORMAT_YUV444,
-   DRM_FORMAT_VYUY,
-   DRM_FORMAT_C8,
 };

 static int sti_gdp_fourcc2format(int fourcc)
@@ -148,14 +140,6 @@ static int sti_gdp_fourcc2format(int fourcc)
return GDP_RGB565;
case DRM_FORMAT_RGB888:
return GDP_RGB888;
-   case DRM_FORMAT_AYUV:
-   return GDP_AYCBR;
-   case DRM_FORMAT_YUV444:
-   return GDP_YCBR888;
-   case DRM_FORMAT_VYUY:
-   return GDP_YCBR422R;
-   case DRM_FORMAT_C8:
-   return GDP_CLUT8;
}
return -1;
 }
@@ -165,7 +149,6 @@ static int sti_gdp_get_alpharange(int format)
switch (format) {
case GDP_ARGB8565:
case GDP_ARGB:
-   case GDP_AYCBR:
case GDP_ABGR:
return GAM_GDP_ALPHARANGE_255;
}
-- 
1.9.1



[PATCH 00/10] Exynos DRM: various fixes for 64bit and Exynos5433

2016-02-12 Thread Andrzej Hajda
Hi Emil,


On 02/08/2016 12:14 PM, Emil Velikov wrote:
> Hi Marek,
> 
> On 3 February 2016 at 12:42, Marek Szyprowski  
> wrote:
>> Hello all,
>>
>> This patch series is a set of various fixes to get Exynos DRM working on
>> Exynos 5433 SoCs and 64bit ARM64 architecture.
>>
> As you mentioned "64bit Exynos" devices, I'm wondering if you'll have
> some input on the current exynos drm ABI as mentioned here [1]. I.e.
> it feels broken when using 32bit userspace on 64 bit kernel due to the
> use of unsigned int and alike types. Should we replace them (fix
> things) with explicitly sized ones - _u32/64.
> 
> Does that sound reasonable, is anyone from the Exynos team interested
> in sorting it out ?

I will take care of it.
Thanks of pointing it out.

Regards
Andrzej

> 
> Regards,
> Emil
> 
> [1] https://lists.freedesktop.org/archives/dri-devel/2016-January/099547.html
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 



[PATCH 0/4] drm/sti: cleanup and minor fixes

2016-02-12 Thread Vincent Abriou
Those patches bring some cleaness on some functions and comments.

Bich Hemon (2):
  drm/sti: awg_utils code cleanup
  drm/sti: GDP planes only support RGB formats

Fabien Dessenne (1):
  drm/sti: clarify the skip frame/field message

Vincent Abriou (1):
  drm/sti: update VTG timing programming

 drivers/gpu/drm/sti/sti_awg_utils.c |  33 +++---
 drivers/gpu/drm/sti/sti_gdp.c   |  17 
 drivers/gpu/drm/sti/sti_hqvdp.c |   4 +-
 drivers/gpu/drm/sti/sti_tvout.c |  59 +--
 drivers/gpu/drm/sti/sti_vtg.c   | 197 +---
 drivers/gpu/drm/sti/sti_vtg.h   |   5 +
 6 files changed, 187 insertions(+), 128 deletions(-)

-- 
1.9.1



[PATCH 2/4] drm/sti: awg_utils code cleanup

2016-02-12 Thread Vincent Abriou
From: Bich Hemon 

data_en is a local variable that doesn't need to be set as
awg_generate_instr can be called directly with the requested value.

Signed-off-by: Bich Hemon 
---
 drivers/gpu/drm/sti/sti_awg_utils.c | 33 -
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_awg_utils.c 
b/drivers/gpu/drm/sti/sti_awg_utils.c
index 00d0698..2378b93 100644
--- a/drivers/gpu/drm/sti/sti_awg_utils.c
+++ b/drivers/gpu/drm/sti/sti_awg_utils.c
@@ -34,6 +34,8 @@ static int awg_generate_instr(enum opcode opcode,
/* skip, repeat and replay arg should not exceed 1023.
 * If user wants to exceed this value, the instruction should be
 * duplicate and arg should be adjust for each duplicated instruction.
+*
+* mux_sel is used in case of SAV/EAV synchronization.
 */

while (arg_tmp > 0) {
@@ -115,63 +117,52 @@ int sti_awg_generate_code_data_enable_mode(
struct awg_timing *timing)
 {
long int val;
-   long int data_en;
int ret = 0;

if (timing->trailing_lines > 0) {
/* skip trailing lines */
val = timing->blanking_level;
-   data_en = 0;
-   ret |= awg_generate_instr(RPLSET, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);

val = timing->trailing_lines - 1;
-   data_en = 0;
-   ret |= awg_generate_instr(REPLAY, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
}

if (timing->trailing_pixels > 0) {
/* skip trailing pixel */
val = timing->blanking_level;
-   data_en = 0;
-   ret |= awg_generate_instr(RPLSET, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);

val = timing->trailing_pixels - 1;
-   data_en = 0;
-   ret |= awg_generate_instr(SKIP, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(SKIP, val, 0, 0, fwparams);
}

/* set DE signal high */
val = timing->blanking_level;
-   data_en = 1;
ret |= awg_generate_instr((timing->trailing_pixels > 0) ? SET : RPLSET,
-   val, 0, data_en, fwparams);
+   val, 0, 1, fwparams);

if (timing->blanking_pixels > 0) {
/* skip the number of active pixel */
val = timing->active_pixels - 1;
-   data_en = 1;
-   ret |= awg_generate_instr(SKIP, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(SKIP, val, 0, 1, fwparams);

/* set DE signal low */
val = timing->blanking_level;
-   data_en = 0;
-   ret |= awg_generate_instr(SET, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(SET, val, 0, 0, fwparams);
}

/* replay the sequence as many active lines defined */
val = timing->active_lines - 1;
-   data_en = 0;
-   ret |= awg_generate_instr(REPLAY, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);

if (timing->blanking_lines > 0) {
/* skip blanking lines */
val = timing->blanking_level;
-   data_en = 0;
-   ret |= awg_generate_instr(RPLSET, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(RPLSET, val, 0, 0, fwparams);

val = timing->blanking_lines - 1;
-   data_en = 0;
-   ret |= awg_generate_instr(REPLAY, val, 0, data_en, fwparams);
+   ret |= awg_generate_instr(REPLAY, val, 0, 0, fwparams);
}

return ret;
-- 
1.9.1



[PATCH 0/2] drm/sti: support of interlaced content with Bottom Field

2016-02-12 Thread Vincent Abriou
Interlaced video can have different scan order:
Top Field First or Bottom Field First

In case of video with interlaced content, this information should be
propagated from the userland to the DRM kernel driver that will process the
deinterlacing starting with the top or the bottom field first.
That's why we introduce this new flag definition DRM_MODE_FB_BFF (Bottom Field
First) that should be used jointly with the already existing
DRM_MODE_FB_INTERLACED flag incase of interlaced video with Bottom Field First
scan order should be processed.

Fabien Dessenne (2):
  drm: Add DRM_MODE_FB_BFF flag definition
  drm/sti: support interlaced top / bottom field first

 drivers/gpu/drm/drm_crtc.c  |  3 +-
 drivers/gpu/drm/sti/sti_hqvdp.c | 72 +
 include/uapi/drm/drm_mode.h |  1 +
 3 files changed, 47 insertions(+), 29 deletions(-)

-- 
1.9.1



[PATCH 1/2] drm: Add DRM_MODE_FB_BFF flag definition

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

If a buffer is interlaced, this "Bottom Field First" flag specifies
which of the top or the bottom field shall be displayed first.
When set, the bottom field shall be displayed first.
When unset the top field shall be displayed first.

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/drm_crtc.c  | 3 ++-
 include/uapi/drm/drm_mode.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d40bab2..64b4fdac 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3315,7 +3315,8 @@ internal_framebuffer_create(struct drm_device *dev,
struct drm_framebuffer *fb;
int ret;

-   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) {
+   if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS
+   | DRM_MODE_FB_BFF)) {
DRM_DEBUG_KMS("bad framebuffer flags 0x%08x\n", r->flags);
return ERR_PTR(-EINVAL);
}
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 50adb46..f7c9111 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -354,6 +354,7 @@ struct drm_mode_fb_cmd {

 #define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
 #define DRM_MODE_FB_MODIFIERS  (1<<1) /* enables ->modifer[] */
+#define DRM_MODE_FB_BFF(1<<2) /* if interlaced, bottom field 
first */

 struct drm_mode_fb_cmd2 {
__u32 fb_id;
-- 
1.9.1



[PATCH 2/2] drm/sti: support interlaced top / bottom field first

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

Support top field first and bottom field first interlaced buffers

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 72 +
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index e9c33fb..e024c13 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -325,7 +325,7 @@ struct sti_hqvdp_cmd {
  * @clk_pix_main:  pix main clock
  * @reset: reset control
  * @vtg_nb:notifier to handle VTG Vsync
- * @btm_field_pending: is there any bottom field (interlaced frame) to display
+ * @nxt_field_pending: is there any other field (interlaced frame) to display
  * @hqvdp_cmd: buffer of commands
  * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
  * @vtg:   vtg for main data path
@@ -340,7 +340,7 @@ struct sti_hqvdp {
struct clk *clk_pix_main;
struct reset_control *reset;
struct notifier_block vtg_nb;
-   bool btm_field_pending;
+   bool nxt_field_pending;
void *hqvdp_cmd;
dma_addr_t hqvdp_cmd_paddr;
struct sti_vtg *vtg;
@@ -784,7 +784,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
  * @evt: event message
  * @data: private data
  *
- * Handle VTG Vsync event, display pending bottom field
+ * Handle VTG Vsync event, display next field
  *
  * RETURNS:
  * 0 on success.
@@ -792,8 +792,8 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned long evt, void *data)
 {
struct sti_hqvdp *hqvdp = container_of(nb, struct sti_hqvdp, vtg_nb);
-   int btm_cmd_offset, top_cmd_offest;
-   struct sti_hqvdp_cmd *btm_cmd, *top_cmd;
+   int next_cmd_offset, curr_cmd_offest;
+   struct sti_hqvdp_cmd *next_cmd, *curr_cmd;

if ((evt != VTG_TOP_FIELD_EVENT) && (evt != VTG_BOTTOM_FIELD_EVENT)) {
DRM_DEBUG_DRIVER("Unknown event\n");
@@ -808,31 +808,41 @@ int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned 
long evt, void *data)
sti_hqvdp_disable(hqvdp);
}

-   if (hqvdp->btm_field_pending) {
-   /* Create the btm field command from the current one */
-   btm_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
-   top_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
-   if ((btm_cmd_offset == -1) || (top_cmd_offest == -1)) {
+   if (hqvdp->nxt_field_pending) {
+   /* Create the next field command from the current one */
+   next_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
+   curr_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
+   if ((next_cmd_offset == -1) || (curr_cmd_offest == -1)) {
DRM_DEBUG_DRIVER("Warning: no cmd, will skip field\n");
return -EBUSY;
}

-   btm_cmd = hqvdp->hqvdp_cmd + btm_cmd_offset;
-   top_cmd = hqvdp->hqvdp_cmd + top_cmd_offest;
-
-   memcpy(btm_cmd, top_cmd, sizeof(*btm_cmd));
-
-   btm_cmd->top.config = TOP_CONFIG_INTER_BTM;
-   btm_cmd->top.current_luma +=
-   btm_cmd->top.luma_src_pitch / 2;
-   btm_cmd->top.current_chroma +=
-   btm_cmd->top.chroma_src_pitch / 2;
+   next_cmd = hqvdp->hqvdp_cmd + next_cmd_offset;
+   curr_cmd = hqvdp->hqvdp_cmd + curr_cmd_offest;
+
+   memcpy(next_cmd, curr_cmd, sizeof(*next_cmd));
+
+   if (curr_cmd->top.config == TOP_CONFIG_INTER_TOP) {
+   /* Display the bottom field now */
+   next_cmd->top.config = TOP_CONFIG_INTER_BTM;
+   next_cmd->top.current_luma +=
+   next_cmd->top.luma_src_pitch / 2;
+   next_cmd->top.current_chroma +=
+   next_cmd->top.chroma_src_pitch / 2;
+   } else {
+   /* Display the top field now */
+   next_cmd->top.config = TOP_CONFIG_INTER_TOP;
+   next_cmd->top.current_luma -=
+   next_cmd->top.luma_src_pitch / 2;
+   next_cmd->top.current_chroma -=
+   next_cmd->top.chroma_src_pitch / 2;
+   }

/* Post the command to mailbox */
-   writel(hqvdp->hqvdp_cmd_paddr + btm_cmd_offset,
-   hqvdp->regs + HQVDP_MBX_NEXT_CMD);
+   writel(hqvdp->hqvdp_cmd_paddr + next_cmd_offset,
+  hqvdp->regs + HQVDP_MBX_NEXT_CMD);

-   hqvdp->btm_field_pending = false;
+   hqvdp->nxt_field_pending = false;

dev_dbg(hqvdp->dev, "%s Posted command:0x%x\n",

[PATCH 3/4] drm/sti: clarify the skip frame/field message

2016-02-12 Thread Vincent Abriou
From: Fabien Dessenne 

When a frame or a field is skipped, output a Warning message instead of
an Error message.

Signed-off-by: Fabien Dessenne 
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 43861b5..284af75 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -580,7 +580,7 @@ int sti_hqvdp_vtg_cb(struct notifier_block *nb, unsigned 
long evt, void *data)
btm_cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
top_cmd_offest = sti_hqvdp_get_curr_cmd(hqvdp);
if ((btm_cmd_offset == -1) || (top_cmd_offest == -1)) {
-   DRM_ERROR("Cannot get cmds, skip btm field\n");
+   DRM_DEBUG_DRIVER("Warning: no cmd, will skip field\n");
return -EBUSY;
}

@@ -810,7 +810,7 @@ static void sti_hqvdp_atomic_update(struct drm_plane 
*drm_plane,

cmd_offset = sti_hqvdp_get_free_cmd(hqvdp);
if (cmd_offset == -1) {
-   DRM_ERROR("No available hqvdp_cmd now\n");
+   DRM_DEBUG_DRIVER("Warning: no cmd, will skip frame\n");
return;
}
cmd = hqvdp->hqvdp_cmd + cmd_offset;
-- 
1.9.1



[REGRESSION] i915: No HDMI output with 4.4

2016-02-12 Thread Oleksandr Natalenko
Ville,

I've applied patch you've provided and did couple of replugging with 
intel_reg in between. Here are the results.

I used additional VGA cable to see what actually I type in console :).

Both HDMI and VGA cables plugged: [1]
Both HDMI and VGA cables unplugged: [2]
Only HDMI cable plugged: [3]
Only VGA cable plugged: [4]

And here goes dmesg with all the stuff logged: [5]

Hope this helps.

[1] https://gist.github.com/58a0eb50dcf84e104555
[2] https://gist.github.com/7e8749a3e2cc58ea8aac
[3] https://gist.github.com/9d76930da7380634b845
[4] https://gist.github.com/c0d2e2f64242ad4f01f2
[5] https://gist.github.com/fda3b9fed3ca4d31cd20

11.02.2016 16:01, Ville Syrjälä wrote:
> OK, so the hpd interrupt does happen, and yet the live status 
> supposedly
> claims that nothing is there. Port C live status definitely works here
> on my IVB, so not sure what the deal is.
> 
> Can you grab intel-gpu-tools and run
> intel_reg read 0xc4000 0xc4004 0xc4008 0xc400c 0xc4030
> a couple of times after plugging the monitor in, and also run it when
> nothing is plugged in.
> 
> Also you could try something like the following patch so we might
> observe the live status with a bit more detail. Though the fact that it
> doesn't seem to work for you even when the monitor was already plugged
> in is somewhat troubling:
> 
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1392,12 +1392,17 @@ intel_hdmi_detect(struct drm_connector
> *connector, bool force)
> 
>   intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
> 
> - for (try = 0; !live_status && try < 9; try++) {
> - if (try)
> - msleep(10);
> - live_status = intel_digital_port_connected(dev_priv,
> + printk("port %c live status\n ",
> port_name(hdmi_to_dig_port(intel_hdmi)->port));
> + for (try = 0; try < 250; try++) {
> + bool status = intel_digital_port_connected(dev_priv,
>   hdmi_to_dig_port(intel_hdmi));
> + live_status |= status;
> + printk("%c", status ? '#' : '_');
> + if (try % 50 == 49)
> + printk("\n ");
> + usleep_range(1000, 1000);
>   }
> + printk("\n");
> 
>   if (!live_status)
>   DRM_DEBUG_KMS("Live status not up!");
> --
> 2.4.10
> 
> Oh, and if you have another cable you can try, might be a good idea to
> see if it behaves any better.
> 


[PATCH v10 1/4] drm/kms_helper: Add a common place to call init and exit functions.

2016-02-12 Thread Ville Syrjälä
On Thu, Jan 21, 2016 at 03:10:18PM -0800, Rafael Antognolli wrote:
> The module_init and module_exit functions will start here, and call the
> subsequent init's and exit's.
> 
> v10:
>  - Keep __init on drm_fb_helper init function.
>  - Move MODULE_* macros to the common file.
> 
> Signed-off-by: Rafael Antognolli 

Looks all right to me.

Reviewed-by: Ville Syrjälä 

> ---
>  drivers/gpu/drm/Makefile|  4 ++-
>  drivers/gpu/drm/drm_crtc_helper.c   |  3 ---
>  drivers/gpu/drm/drm_fb_helper.c |  9 +++
>  drivers/gpu/drm/drm_kms_helper_common.c | 47 
> +
>  include/drm/drm_fb_helper.h |  6 +
>  5 files changed, 60 insertions(+), 9 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_kms_helper_common.c
> 
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index f858aa2..dfe513f 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -24,7 +24,9 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o
>  drm-y += $(drm-m)
>  
>  drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
> - drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o
> + drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
> + drm_kms_helper_common.o
> +
>  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
>  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
>  drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index 5d4bc64..baac181 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -73,9 +73,6 @@
>   * &drm_crtc_helper_funcs, struct &drm_encoder_helper_funcs and struct
>   * &drm_connector_helper_funcs.
>   */
> -MODULE_AUTHOR("David Airlie, Jesse Barnes");
> -MODULE_DESCRIPTION("DRM KMS helper");
> -MODULE_LICENSE("GPL and additional rights");
>  
>  /**
>   * drm_helper_move_panel_connectors_to_head() - move panels to the front in 
> the
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 1e103c4..c27b964 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -2175,9 +2175,9 @@ EXPORT_SYMBOL(drm_fb_helper_hotplug_event);
>   * but the module doesn't depend on any fb console symbols.  At least
>   * attempt to load fbcon to avoid leaving the system without a usable 
> console.
>   */
> -#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
> -static int __init drm_fb_helper_modinit(void)
> +int __init drm_fb_helper_modinit(void)
>  {
> +#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
>   const char *name = "fbcon";
>   struct module *fbcon;
>  
> @@ -2187,8 +2187,7 @@ static int __init drm_fb_helper_modinit(void)
>  
>   if (!fbcon)
>   request_module_nowait(name);
> +#endif
>   return 0;
>  }
> -
> -module_init(drm_fb_helper_modinit);
> -#endif
> +EXPORT_SYMBOL(drm_fb_helper_modinit);
> diff --git a/drivers/gpu/drm/drm_kms_helper_common.c 
> b/drivers/gpu/drm/drm_kms_helper_common.c
> new file mode 100644
> index 000..d361005
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_kms_helper_common.c
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *Rafael Antognolli 
> + *
> + */
> +
> +#include 
> +#include 
> +
> +MODULE_AUTHOR("David Airlie, Jesse Barnes");
> +MODULE_DESCRIPTION("DRM KMS helper");
> +MODULE_LICENSE("GPL and additional rights");
> +
> +static int __init drm_kms_helper_init(void)
> +{
> + /* Call init functions from specific kms helpers here */
> + return drm_fb_helper_modinit();
> +}
> +
> +static void __exit drm_kms_he

[Intel-gfx] [PATCH v10 2/4] drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.

2016-02-12 Thread Ville Syrjälä
On Thu, Jan 21, 2016 at 03:10:19PM -0800, Rafael Antognolli wrote:
> This module is heavily based on i2c-dev. Once loaded, it provides one
> dev node per DP AUX channel, named drm_dp_auxN, where N is an integer.
> 
> It's possible to know which connector owns this aux channel by looking
> at the respective sysfs /sys/class/drm_aux_dev/drm_dp_auxN/connector, if
> the connector device pointer was correctly set in the aux helper struct.
> 
> Two main operations are provided on the registers read and write. The
> address of the register to be read or written is given using lseek. The
> seek position is updated upon read or write.
> 
> v2:
>  - lseek is used to select the register to read/write
>  - read/write are used instead of ioctl
>  - no blocking_notifier is used, just a direct callback
> 
> v3:
>  - use drm_dp_aux_dev prefix for public functions
>  - chardev is named drm_dp_auxN
>  - read/write don't allocate a buffer anymore, and transfer up to 16 bytes a
>time
>  - remove notifier list from the implementation
>  - option on menuconfig is now a boolean
>  - add inline stub functions to avoid breakage when this option is disabled
> 
> v4:
>  - fix build system changes - actually disable this module when not selected.
> 
> v5:
>  - Use kref to avoid device closing while still in use
>  - Don't use list, use an idr for storing aux_dev
>  - Remove "connector" attribute
>  - set aux.dev to the connector drm_connector device, instead of
>drm_device
> 
> v6:
>  - Use atomic_t for usage count
>  - Use a mutex instead of spinlock for idr lock
>  - Destroy chardev immediately on unregister
>  - other minor suggestions from Ville
> 
> v7:
>  - style fixes
>  - error handling fixes
> 
> v8:
>  - more error handling fixes
> 
> v9:
>  - remove module_init and module_exit, and add drm_dp_aux_dev_init/exit
>  to drm_kms_helper_init/exit.
> 
> Signed-off-by: Rafael Antognolli 

Only checked the init/exit stuff since I should have read the rest 
many times by now.

Reviewed-by: Ville Syrjälä 

> ---
>  drivers/gpu/drm/Kconfig |   8 +
>  drivers/gpu/drm/Makefile|   1 +
>  drivers/gpu/drm/drm_dp_aux_dev.c| 368 
> 
>  drivers/gpu/drm/drm_dp_helper.c |  16 +-
>  drivers/gpu/drm/drm_kms_helper_common.c |  15 +-
>  include/drm/drm_dp_aux_dev.h|  62 ++
>  6 files changed, 468 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_dp_aux_dev.c
>  create mode 100644 include/drm/drm_dp_aux_dev.h
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 59babd5..dff87ca 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -25,6 +25,14 @@ config DRM_MIPI_DSI
>   bool
>   depends on DRM
>  
> +config DRM_DP_AUX_CHARDEV
> + bool "DRM DP AUX Interface"
> + depends on DRM
> + help
> +   Choose this option to enable a /dev/drm_dp_auxN node that allows to
> +   read and write values to arbitrary DPCD registers on the DP aux
> +   channel.
> +
>  config DRM_KMS_HELPER
>   tristate
>   depends on DRM
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index dfe513f..424fcb7 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -30,6 +30,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 
> drm_probe_helper.o \
>  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
>  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
>  drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
> +drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
>  
>  obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
>  
> diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c 
> b/drivers/gpu/drm/drm_dp_aux_dev.c
> new file mode 100644
> index 000..f73b38b
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_dp_aux_dev.c
> @@ -0,0 +1,368 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION

[PATCH 1/4] drm/exynos: remove struct exynos_drm_panel_info

2016-02-12 Thread Andrzej Hajda
struct exynos_drm_panel_info is not used anymore, except exynos_dp,
which can integrate useful fields directly into its context.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos7_drm_decon.c |  1 -
 drivers/gpu/drm/exynos/exynos_dp_core.c|  7 ++-
 drivers/gpu/drm/exynos/exynos_dp_core.h|  4 ++--
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |  1 -
 include/drm/exynos_drm.h   | 15 ---
 5 files changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c 
b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
index 52bda3b..9336107 100644
--- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c
+++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c
@@ -60,7 +60,6 @@ struct decon_context {
wait_queue_head_t   wait_vsync_queue;
atomic_twait_vsync_event;

-   struct exynos_drm_panel_info panel;
struct drm_encoder *encoder;
 };

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index b79c316..461f6a1 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -977,9 +977,7 @@ static int exynos_dp_get_modes(struct drm_connector 
*connector)
return 0;
}

-   drm_display_mode_from_videomode(&dp->priv.vm, mode);
-   mode->width_mm = dp->priv.width_mm;
-   mode->height_mm = dp->priv.height_mm;
+   drm_display_mode_from_videomode(&dp->vm, mode);
connector->display_info.width_mm = mode->width_mm;
connector->display_info.height_mm = mode->height_mm;

@@ -1249,8 +1247,7 @@ static int exynos_dp_dt_parse_panel(struct 
exynos_dp_device *dp)
 {
int ret;

-   ret = of_get_videomode(dp->dev->of_node, &dp->priv.vm,
-   OF_USE_NATIVE_MODE);
+   ret = of_get_videomode(dp->dev->of_node, &dp->vm, OF_USE_NATIVE_MODE);
if (ret) {
DRM_ERROR("failed: of_get_videomode() : %d\n", ret);
return ret;
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.h 
b/drivers/gpu/drm/exynos/exynos_dp_core.h
index 66eec4b..b5c2d8f 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.h
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.h
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 

 #include "exynos_drm_drv.h"

@@ -164,8 +165,7 @@ struct exynos_dp_device {
struct phy  *phy;
int dpms_mode;
int hpd_gpio;
-
-   struct exynos_drm_panel_info priv;
+   struct videomodevm;
 };

 /* exynos_dp_reg.c */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 70194d0..2d48169 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -168,7 +168,6 @@ struct fimd_context {
atomic_twin_updated;
atomic_ttriggering;

-   struct exynos_drm_panel_info panel;
struct fimd_driver_data *driver_data;
struct drm_encoder *encoder;
 };
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index cb65fa1..e9fb2bd 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -18,27 +18,12 @@
 #include 

 /**
- * A structure for lcd panel information.
- *
- * @timing: default video mode for initializing
- * @width_mm: physical size of lcd width.
- * @height_mm: physical size of lcd height.
- */
-struct exynos_drm_panel_info {
-   struct videomode vm;
-   u32 width_mm;
-   u32 height_mm;
-};
-
-/**
  * Platform Specific Structure for DRM based FIMD.
  *
- * @panel: default panel info for initializing
  * @default_win: default window layer number to be used for UI.
  * @bpp: default bit per pixel.
  */
 struct exynos_drm_fimd_pdata {
-   struct exynos_drm_panel_info panel;
u32 vidcon0;
u32 vidcon1;
unsigned intdefault_win;
-- 
1.9.1



[PATCH 0/4] drm/exynos: cleanup of header files

2016-02-12 Thread Andrzej Hajda
Hi Inki,

This small cleanup series is based on exynos-drm-next.

Regards
Andrzej


Andrzej Hajda (4):
  drm/exynos: remove struct exynos_drm_panel_info
  drm/exynos/fimc: remove unused camera interface polarization code
  drm/exynos: remove platform data structures and
include/drm/exynos_drm.h
  drm/exynos: use arch independent types in uapi header

 drivers/gpu/drm/exynos/exynos7_drm_decon.c |   1 -
 drivers/gpu/drm/exynos/exynos_dp_core.c|   7 +-
 drivers/gpu/drm/exynos/exynos_dp_core.h|   4 +-
 drivers/gpu/drm/exynos/exynos_drm_fimc.c   |  28 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |   1 -
 include/drm/exynos_drm.h   | 101 -
 include/uapi/drm/exynos_drm.h  |  26 
 7 files changed, 17 insertions(+), 151 deletions(-)
 delete mode 100644 include/drm/exynos_drm.h

-- 
1.9.1



[PATCH 4/4] drm/exynos: use arch independent types in uapi header

2016-02-12 Thread Andrzej Hajda
User API structs should not use types which size/alignment/padding depends
on architecture. The patch fixes it for all structures except
drm_exynos_g2d_userptr, as g2d related stuff seems to be more complicated
and will be reviewed/adjusted later.

Signed-off-by: Andrzej Hajda 
---
 include/uapi/drm/exynos_drm.h | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
index 312c67d..d2a5bb1 100644
--- a/include/uapi/drm/exynos_drm.h
+++ b/include/uapi/drm/exynos_drm.h
@@ -28,8 +28,8 @@
  */
 struct drm_exynos_gem_create {
__u64 size;
-   unsigned int flags;
-   unsigned int handle;
+   __u32 flags;
+   __u32 handle;
 };

 /**
@@ -42,8 +42,8 @@ struct drm_exynos_gem_create {
  * be set by driver.
  */
 struct drm_exynos_gem_info {
-   unsigned int handle;
-   unsigned int flags;
+   __u32 handle;
+   __u32 flags;
__u64 size;
 };

@@ -56,8 +56,8 @@ struct drm_exynos_gem_info {
  * @edid: the edid data pointer from user side.
  */
 struct drm_exynos_vidi_connection {
-   unsigned int connection;
-   unsigned int extensions;
+   __u32 connection;
+   __u32 extensions;
__u64 edid;
 };

@@ -206,9 +206,9 @@ struct drm_exynos_ipp_prop_list {
  * @pos: property of image position(src-cropped,dst-scaler).
  */
 struct drm_exynos_ipp_config {
-   enum drm_exynos_ops_id ops_id;
-   enum drm_exynos_flipflip;
-   enum drm_exynos_degree  degree;
+   __u32 ops_id;
+   __u32 flip;
+   __u32 degree;
__u32   fmt;
struct drm_exynos_szsz;
struct drm_exynos_pos   pos;
@@ -233,7 +233,7 @@ enum drm_exynos_ipp_cmd {
  */
 struct drm_exynos_ipp_property {
struct drm_exynos_ipp_config config[EXYNOS_DRM_OPS_MAX];
-   enum drm_exynos_ipp_cmd cmd;
+   __u32   cmd;
__u32   ipp_id;
__u32   prop_id;
__u32   refresh_rate;
@@ -255,8 +255,8 @@ enum drm_exynos_ipp_buf_type {
  * @user_data: user data.
  */
 struct drm_exynos_ipp_queue_buf {
-   enum drm_exynos_ops_id  ops_id;
-   enum drm_exynos_ipp_buf_typebuf_type;
+   __u32   ops_id;
+   __u32   buf_type;
__u32   prop_id;
__u32   buf_id;
__u32   handle[EXYNOS_DRM_PLANAR_MAX];
@@ -280,7 +280,7 @@ enum drm_exynos_ipp_ctrl {
  */
 struct drm_exynos_ipp_cmd_ctrl {
__u32   prop_id;
-   enum drm_exynos_ipp_ctrlctrl;
+   __u32   ctrl;
 };

 #define DRM_EXYNOS_GEM_CREATE  0x00
-- 
1.9.1



[PATCH 2/4] drm/exynos/fimc: remove unused camera interface polarization code

2016-02-12 Thread Andrzej Hajda
Polarization was never configured for DRM-FIMC device, so fimc_set_polarity
function did nothing. In fact DRM does not use camera interface so there
is no point in configuring it.

Signed-off-by: Andrzej Hajda 
---
 drivers/gpu/drm/exynos/exynos_drm_fimc.c | 28 
 1 file changed, 28 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
index 8a4f4a0..0525c56 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c
@@ -163,7 +163,6 @@ struct fimc_context {
u32 clk_frequency;
struct regmap   *sysreg;
struct fimc_scaler  sc;
-   struct exynos_drm_ipp_pol   pol;
int id;
int irq;
boolsuspended;
@@ -260,32 +259,6 @@ static void fimc_set_type_ctrl(struct fimc_context *ctx, 
enum fimc_wb wb)
fimc_write(ctx, cfg, EXYNOS_CIGCTRL);
 }

-static void fimc_set_polarity(struct fimc_context *ctx,
-   struct exynos_drm_ipp_pol *pol)
-{
-   u32 cfg;
-
-   DRM_DEBUG_KMS("inv_pclk[%d]inv_vsync[%d]\n",
-   pol->inv_pclk, pol->inv_vsync);
-   DRM_DEBUG_KMS("inv_href[%d]inv_hsync[%d]\n",
-   pol->inv_href, pol->inv_hsync);
-
-   cfg = fimc_read(ctx, EXYNOS_CIGCTRL);
-   cfg &= ~(EXYNOS_CIGCTRL_INVPOLPCLK | EXYNOS_CIGCTRL_INVPOLVSYNC |
-EXYNOS_CIGCTRL_INVPOLHREF | EXYNOS_CIGCTRL_INVPOLHSYNC);
-
-   if (pol->inv_pclk)
-   cfg |= EXYNOS_CIGCTRL_INVPOLPCLK;
-   if (pol->inv_vsync)
-   cfg |= EXYNOS_CIGCTRL_INVPOLVSYNC;
-   if (pol->inv_href)
-   cfg |= EXYNOS_CIGCTRL_INVPOLHREF;
-   if (pol->inv_hsync)
-   cfg |= EXYNOS_CIGCTRL_INVPOLHSYNC;
-
-   fimc_write(ctx, cfg, EXYNOS_CIGCTRL);
-}
-
 static void fimc_handle_jpeg(struct fimc_context *ctx, bool enable)
 {
u32 cfg;
@@ -1467,7 +1440,6 @@ static int fimc_ippdrv_start(struct device *dev, enum 
drm_exynos_ipp_cmd cmd)
/* If set ture, we can save jpeg about screen */
fimc_handle_jpeg(ctx, false);
fimc_set_scaler(ctx, &ctx->sc);
-   fimc_set_polarity(ctx, &ctx->pol);

switch (cmd) {
case IPP_CMD_M2M:
-- 
1.9.1



[PATCH 3/4] drm/exynos: remove platform data structures and include/drm/exynos_drm.h

2016-02-12 Thread Andrzej Hajda
Platform data structures are not used for long time so the whole header
file can be safely removed.

Signed-off-by: Andrzej Hajda 
---
 include/drm/exynos_drm.h | 86 
 1 file changed, 86 deletions(-)
 delete mode 100644 include/drm/exynos_drm.h

diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
deleted file mode 100644
index e9fb2bd..000
--- a/include/drm/exynos_drm.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* exynos_drm.h
- *
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- * Authors:
- * Inki Dae 
- * Joonyoung Shim 
- * Seung-Woo Kim 
- *
- * 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.
- */
-#ifndef _EXYNOS_DRM_H_
-#define _EXYNOS_DRM_H_
-
-#include 
-#include 
-
-/**
- * Platform Specific Structure for DRM based FIMD.
- *
- * @default_win: default window layer number to be used for UI.
- * @bpp: default bit per pixel.
- */
-struct exynos_drm_fimd_pdata {
-   u32 vidcon0;
-   u32 vidcon1;
-   unsigned intdefault_win;
-   unsigned intbpp;
-};
-
-/**
- * Platform Specific Structure for DRM based HDMI.
- *
- * @hdmi_dev: device point to specific hdmi driver.
- * @mixer_dev: device point to specific mixer driver.
- *
- * this structure is used for common hdmi driver and each device object
- * would be used to access specific device driver(hdmi or mixer driver)
- */
-struct exynos_drm_common_hdmi_pd {
-   struct device *hdmi_dev;
-   struct device *mixer_dev;
-};
-
-/**
- * Platform Specific Structure for DRM based HDMI core.
- *
- * @is_v13: set if hdmi version 13 is.
- * @cfg_hpd: function pointer to configure hdmi hotplug detection pin
- * @get_hpd: function pointer to get value of hdmi hotplug detection pin
- */
-struct exynos_drm_hdmi_pdata {
-   bool is_v13;
-   void (*cfg_hpd)(bool external);
-   int (*get_hpd)(void);
-};
-
-/**
- * Platform Specific Structure for DRM based IPP.
- *
- * @inv_pclk: if set 1. invert pixel clock
- * @inv_vsync: if set 1. invert vsync signal for wb
- * @inv_href: if set 1. invert href signal
- * @inv_hsync: if set 1. invert hsync signal for wb
- */
-struct exynos_drm_ipp_pol {
-   unsigned int inv_pclk;
-   unsigned int inv_vsync;
-   unsigned int inv_href;
-   unsigned int inv_hsync;
-};
-
-/**
- * Platform Specific Structure for DRM based FIMC.
- *
- * @pol: current hardware block polarity settings.
- * @clk_rate: current hardware clock rate.
- */
-struct exynos_drm_fimc_pdata {
-   struct exynos_drm_ipp_pol pol;
-   int clk_rate;
-};
-
-#endif /* _EXYNOS_DRM_H_ */
-- 
1.9.1



[Bug 38454] [KMS] ATI RV280 ennoying many OpenGL troubles

2016-02-12 Thread bugzilla-dae...@freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=38454

Timothy Arceri  changed:

   What|Removed |Added

  Component|Mesa core   |Drivers/DRI/r200
   Assignee|mesa-dev at lists.freedesktop. |dri-devel at 
lists.freedesktop
   |org |.org

-- 
You are receiving this mail because:
You are the assignee for the bug.
-- next part --
An HTML attachment was scrubbed...
URL: 
<https://lists.freedesktop.org/archives/dri-devel/attachments/20160212/50ccf91c/attachment.html>


[PULL] topic/drm-misc

2016-02-12 Thread Daniel Vetter
Hi Dave,

More drm-misc stuff:
- vgaswitcheroo support for apple gmux from Lukas Wunner
- checks for ->mode_fixup in non-atomic helpers from Carlos Palminha, plus
  removing dummy funcs from drivers. Carlos promised to follow up with
  more, since there's lots more silly dummy functions around.
- dma-buf patches from Tiago, except the ioctl itself (that needed a
  respin to address review from David Herrmann)
- encoder mask for atomic from Maarten
- bunch of random things all over.

Aside: the connector_mask stuff from Maarten that landed in 4.5 is blowing
up in certain mst unplug cases. Maarten is looking into it.

Cheers, Daniel


The following changes since commit 10c1b6183a163aca59ba92b88f2b4c4cecd20d4c:

  drm/tegra: drop unused variable. (2016-02-09 11:17:37 +1000)

are available in the git repository at:

  git://anongit.freedesktop.org/drm-intel tags/topic/drm-misc-2016-02-12

for you to fetch changes up to 382ab95d1af85381d8a5dff09b16a80c7e492534:

  drm/msm: remove unused variable (2016-02-11 11:48:39 +0100)


Arnd Bergmann (1):
  drm/msm: remove unused variable

Carlos Palminha (5):
  drm: fixes when i2c encoder slave mode_fixup is null.
  drm: fixes crct set_mode when encoder mode_fixup is null.
  drm/i2c/sil164: removed unnecessary code, mode_fixup is now optional.
  drm/i2c/tda998x: removed unnecessary code, mode_fixup is now optional.
  drm/bridge: removed dummy mode_fixup function from dw-hdmi.

Daniel Thompson (1):
  drm: prime: Honour O_RDWR during prime-handle-to-fd

Haixia Shi (1):
  drm/msm: remove the drm_device_is_unplugged check

Insu Yun (1):
  ch7006: correctly handling failed allocation

LABBE Corentin (1):
  drm: modes: add missing [drm] to message printing

Lukas Wunner (13):
  vga_switcheroo: Add handler flags infrastructure
  vga_switcheroo: Add support for switching only the DDC
  apple-gmux: Track switch state
  apple-gmux: Add switch_ddc support
  drm/edid: Switch DDC when reading the EDID
  drm/i915: Switch DDC when reading the EDID
  drm/nouveau: Switch DDC when reading the EDID
  drm/radeon: Switch DDC when reading the EDID
  apple-gmux: Add helper for presence detect
  drm/i915: Defer probe if gmux is present but its driver isn't
  drm/nouveau: Defer probe if gmux is present but its driver isn't
  drm/radeon: Defer probe if gmux is present but its driver isn't
  apple-gmux: Fix build breakage if !CONFIG_ACPI

Maarten Lankhorst (5):
  drm/core: Add drm_encoder_index.
  drm/core: Add drm_for_each_encoder_mask, v2.
  drm/i915: Do not touch best_encoder for load detect.
  drm/atomic: Do not unset crtc when an encoder is stolen
  drm/atomic: Add encoder_mask to crtc_state, v3.

Rasmus Villemoes (1):
  drm/gma500: fix error path in gma_intel_setup_gmbus()

Tiago Vignatti (3):
  dma-buf: Remove range-based flush
  drm/i915: Implement end_cpu_access
  drm/i915: Use CPU mapping for userspace dma-buf mmap()

Ville Syrjälä (1):
  drm: Add drm_format_plane_width() and drm_format_plane_height()

 Documentation/DocBook/gpu.tmpl   |   5 +
 Documentation/dma-buf-sharing.txt|  19 ++--
 drivers/dma-buf/dma-buf.c|  13 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c |   3 +-
 drivers/gpu/drm/bridge/dw-hdmi.c |   8 --
 drivers/gpu/drm/drm_atomic_helper.c  |  57 +--
 drivers/gpu/drm/drm_crtc.c   |  65 +
 drivers/gpu/drm/drm_crtc_helper.c|  10 +-
 drivers/gpu/drm/drm_edid.c   |  26 +
 drivers/gpu/drm/drm_encoder_slave.c  |   3 +
 drivers/gpu/drm/drm_modes.c  |   3 +-
 drivers/gpu/drm/drm_prime.c  |  10 +-
 drivers/gpu/drm/gma500/intel_gmbus.c |   2 +-
 drivers/gpu/drm/i2c/ch7006_drv.c |   2 +
 drivers/gpu/drm/i2c/sil164_drv.c |   9 --
 drivers/gpu/drm/i2c/tda998x_drv.c|   9 --
 drivers/gpu/drm/i915/i915_drv.c  |  12 +++
 drivers/gpu/drm/i915/i915_gem_dmabuf.c   |  42 +++-
 drivers/gpu/drm/i915/intel_display.c |   5 +-
 drivers/gpu/drm/i915/intel_lvds.c|   8 +-
 drivers/gpu/drm/msm/msm_fbdev.c  |   4 -
 drivers/gpu/drm/nouveau/nouveau_acpi.c   |   2 +-
 drivers/gpu/drm/nouveau/nouveau_connector.c  |  21 +++-
 drivers/gpu/drm/nouveau/nouveau_drm.c|  11 +++
 drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c|   4 +-
 drivers/gpu/drm/radeon/radeon_atpx_handler.c |   3 +-
 drivers/gpu/drm/radeon/radeon_connectors.c   |   6 ++
 drivers/gpu/drm/radeon/radeon_drv.c  |  11 +++
 drivers/gpu/drm/udl/udl_fb.c |   2 -
 drivers/gpu/vga/vga_switcheroo.c | 119 ++-
 dri

[Intel-gfx] [PATCH v10 2/4] drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.

2016-02-12 Thread Daniel Vetter
On Fri, Feb 12, 2016 at 01:53:10PM +0200, Ville Syrjälä wrote:
> On Thu, Jan 21, 2016 at 03:10:19PM -0800, Rafael Antognolli wrote:
> > This module is heavily based on i2c-dev. Once loaded, it provides one
> > dev node per DP AUX channel, named drm_dp_auxN, where N is an integer.
> > 
> > It's possible to know which connector owns this aux channel by looking
> > at the respective sysfs /sys/class/drm_aux_dev/drm_dp_auxN/connector, if
> > the connector device pointer was correctly set in the aux helper struct.
> > 
> > Two main operations are provided on the registers read and write. The
> > address of the register to be read or written is given using lseek. The
> > seek position is updated upon read or write.
> > 
> > v2:
> >  - lseek is used to select the register to read/write
> >  - read/write are used instead of ioctl
> >  - no blocking_notifier is used, just a direct callback
> > 
> > v3:
> >  - use drm_dp_aux_dev prefix for public functions
> >  - chardev is named drm_dp_auxN
> >  - read/write don't allocate a buffer anymore, and transfer up to 16 bytes a
> >time
> >  - remove notifier list from the implementation
> >  - option on menuconfig is now a boolean
> >  - add inline stub functions to avoid breakage when this option is disabled
> > 
> > v4:
> >  - fix build system changes - actually disable this module when not 
> > selected.
> > 
> > v5:
> >  - Use kref to avoid device closing while still in use
> >  - Don't use list, use an idr for storing aux_dev
> >  - Remove "connector" attribute
> >  - set aux.dev to the connector drm_connector device, instead of
> >drm_device
> > 
> > v6:
> >  - Use atomic_t for usage count
> >  - Use a mutex instead of spinlock for idr lock
> >  - Destroy chardev immediately on unregister
> >  - other minor suggestions from Ville
> > 
> > v7:
> >  - style fixes
> >  - error handling fixes
> > 
> > v8:
> >  - more error handling fixes
> > 
> > v9:
> >  - remove module_init and module_exit, and add drm_dp_aux_dev_init/exit
> >  to drm_kms_helper_init/exit.
> > 
> > Signed-off-by: Rafael Antognolli 
> 
> Only checked the init/exit stuff since I should have read the rest 
> many times by now.
> 
> Reviewed-by: Ville Syrjälä 

Merged the first 2 patches to drm-misc, thanks.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/Kconfig |   8 +
> >  drivers/gpu/drm/Makefile|   1 +
> >  drivers/gpu/drm/drm_dp_aux_dev.c| 368 
> > 
> >  drivers/gpu/drm/drm_dp_helper.c |  16 +-
> >  drivers/gpu/drm/drm_kms_helper_common.c |  15 +-
> >  include/drm/drm_dp_aux_dev.h|  62 ++
> >  6 files changed, 468 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/drm_dp_aux_dev.c
> >  create mode 100644 include/drm/drm_dp_aux_dev.h
> > 
> > diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> > index 59babd5..dff87ca 100644
> > --- a/drivers/gpu/drm/Kconfig
> > +++ b/drivers/gpu/drm/Kconfig
> > @@ -25,6 +25,14 @@ config DRM_MIPI_DSI
> > bool
> > depends on DRM
> >  
> > +config DRM_DP_AUX_CHARDEV
> > +   bool "DRM DP AUX Interface"
> > +   depends on DRM
> > +   help
> > + Choose this option to enable a /dev/drm_dp_auxN node that allows to
> > + read and write values to arbitrary DPCD registers on the DP aux
> > + channel.
> > +
> >  config DRM_KMS_HELPER
> > tristate
> > depends on DRM
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index dfe513f..424fcb7 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -30,6 +30,7 @@ drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o 
> > drm_probe_helper.o \
> >  drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
> >  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
> >  drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
> > +drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
> >  
> >  obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
> >  
> > diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c 
> > b/drivers/gpu/drm/drm_dp_aux_dev.c
> > new file mode 100644
> > index 000..f73b38b
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_dp_aux_dev.c
> > @@ -0,0 +1,368 @@
> > +/*
> > + * Copyright © 2015 Intel Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the 
> > "Software"),
> > + * to deal in the Software without restriction, including without 
> > limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice (including the 
> > next
> > + * paragraph) shall be included in all copies or substantial portions of 
> > the
> > +

[PATCH 0/2] Support exynos5420-fimd

2016-02-12 Thread Chanho Park
This patchset introduces exynos5420-fimd compatible to support
a mic-bypass option from display path. Since exynos5420, the
option has been introduced and controlled by system register.
The option is only available for exynos5420/exynos5422 and 5800,
we need to add the new exynos5420-fimd compatible.

Chanho Park (2):
  drm/exynos: add exynos5420 support for fimd
  ARM: dts: add exynos5420-fimd compatible

 .../bindings/display/exynos/samsung-fimd.txt   |  3 ++-
 arch/arm/boot/dts/exynos5420.dtsi  |  1 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 31 +-
 3 files changed, 33 insertions(+), 2 deletions(-)

-- 
2.5.0



[PATCH 1/2] drm/exynos: add exynos5420 support for fimd

2016-02-12 Thread Chanho Park
This patch adds a exynos5420 driver data to support mic_bypass
option to bypass the mic from display out path.
The mic(Mobile image compressor) compresses RGB data from fimd
and send the compressed data to the mipi dsi.
The bypass option can be founded from system register and the bit
is 11. The option bit has been introduced since exynos5420. The
only difference between exynos5250 and exynos5420/exynos5422 is
existence of the bit. Until the MIC is defined and enabled from
device tree, the bypass mic will be default option.

Cc: Inki Dae 
Cc: Joonyoung Shim 
Cc: Seung-Woo Kim 
Signed-off-by: Chanho Park 
---
 .../bindings/display/exynos/samsung-fimd.txt   |  3 ++-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   | 31 +-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt 
b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
index 27c3ce0..c7c6b9a 100644
--- a/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
+++ b/Documentation/devicetree/bindings/display/exynos/samsung-fimd.txt
@@ -12,7 +12,8 @@ Required properties:
"samsung,exynos3250-fimd"; /* for Exynos3250/3472 SoCs */
"samsung,exynos4210-fimd"; /* for Exynos4 SoCs */
"samsung,exynos4415-fimd"; /* for Exynos4415 SoC */
-   "samsung,exynos5250-fimd"; /* for Exynos5 SoCs */
+   "samsung,exynos5250-fimd"; /* for Exynos5250 SoCs */
+   "samsung,exynos5420-fimd"; /* for Exynos5420/5422/5800 SoCs */

 - reg: physical base address and length of the FIMD registers set.

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 70194d0..41c3bb2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -94,12 +94,14 @@ struct fimd_driver_data {
unsigned int lcdblk_offset;
unsigned int lcdblk_vt_shift;
unsigned int lcdblk_bypass_shift;
+   unsigned int lcdblk_mic_bypass_shift;

unsigned int has_shadowcon:1;
unsigned int has_clksel:1;
unsigned int has_limited_fmt:1;
unsigned int has_vidoutcon:1;
unsigned int has_vtsel:1;
+   unsigned int has_mic_bypass:1;
 };

 static struct fimd_driver_data s3c64xx_fimd_driver_data = {
@@ -145,6 +147,18 @@ static struct fimd_driver_data exynos5_fimd_driver_data = {
.has_vtsel = 1,
 };

+static struct fimd_driver_data exynos5420_fimd_driver_data = {
+   .timing_base = 0x2,
+   .lcdblk_offset = 0x214,
+   .lcdblk_vt_shift = 24,
+   .lcdblk_bypass_shift = 15,
+   .lcdblk_mic_bypass_shift = 11,
+   .has_shadowcon = 1,
+   .has_vidoutcon = 1,
+   .has_vtsel = 1,
+   .has_mic_bypass = 1,
+};
+
 struct fimd_context {
struct device   *dev;
struct drm_device   *drm_dev;
@@ -184,6 +198,8 @@ static const struct of_device_id fimd_driver_dt_match[] = {
  .data = &exynos4415_fimd_driver_data },
{ .compatible = "samsung,exynos5250-fimd",
  .data = &exynos5_fimd_driver_data },
+   { .compatible = "samsung,exynos5420-fimd",
+ .data = &exynos5420_fimd_driver_data },
{},
 };
 MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
@@ -461,6 +477,18 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
return;
}

+   /* TODO: When MIC is enabled for display path, the lcdblk_mic_bypass
+* bit should be cleared.
+*/
+   if (driver_data->has_mic_bypass && ctx->sysreg &&
+   regmap_update_bits(ctx->sysreg,
+   driver_data->lcdblk_offset,
+   0x1 << driver_data->lcdblk_mic_bypass_shift,
+   0x1 << driver_data->lcdblk_mic_bypass_shift)) {
+   DRM_ERROR("Failed to update sysreg for bypass mic.\n");
+   return;
+   }
+
/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(mode->vdisplay - 1) |
   VIDTCON2_HOZVAL(mode->hdisplay - 1) |
@@ -861,7 +889,8 @@ static void fimd_dp_clock_enable(struct exynos_drm_crtc 
*crtc, bool enable)
 * clock. On these SoCs the bootloader may enable it but any
 * power domain off/on will reset it to disable state.
 */
-   if (ctx->driver_data != &exynos5_fimd_driver_data)
+   if (ctx->driver_data != &exynos5_fimd_driver_data ||
+   ctx->driver_data != &exynos5420_fimd_driver_data)
return;

val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE;
-- 
2.5.0



[PATCH 2/2] ARM: dts: add exynos5420-fimd compatible

2016-02-12 Thread Chanho Park
This patch changes the compatible of exynos5420 fimd
to "exynos5420-fimd". To support mic bypass from display
path, the new compatible is introduced for exynos5420.

Cc: Inki Dae 
Cc: Kukjin Kim 
Cc: Krzysztof Kozlowski 
Signed-off-by: Chanho Park 
---
 arch/arm/boot/dts/exynos5420.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/exynos5420.dtsi 
b/arch/arm/boot/dts/exynos5420.dtsi
index 48a0a55..252c7a3 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -1151,6 +1151,7 @@
 };

 &fimd {
+   compatible = "samsung,exynos5420-fimd";
clocks = <&clock CLK_SCLK_FIMD1>, <&clock CLK_FIMD1>;
clock-names = "sclk_fimd", "fimd";
power-domains = <&disp_pd>;
-- 
2.5.0



[PATCH 04/17] drm/amdgpu: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 8 
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 093599a..3483018 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -3624,16 +3624,8 @@ dce_v10_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v10_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v10_0_ext_helper_funcs = {
.dpms = dce_v10_0_ext_dpms,
-   .mode_fixup = dce_v10_0_ext_mode_fixup,
.prepare = dce_v10_0_ext_prepare,
.mode_set = dce_v10_0_ext_mode_set,
.commit = dce_v10_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 8e67249..36deea1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3619,16 +3619,8 @@ dce_v11_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v11_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v11_0_ext_helper_funcs = {
.dpms = dce_v11_0_ext_dpms,
-   .mode_fixup = dce_v11_0_ext_mode_fixup,
.prepare = dce_v11_0_ext_prepare,
.mode_set = dce_v11_0_ext_mode_set,
.commit = dce_v11_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index d0e128c..25dd8b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -3554,16 +3554,8 @@ dce_v8_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v8_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v8_0_ext_helper_funcs = {
.dpms = dce_v8_0_ext_dpms,
-   .mode_fixup = dce_v8_0_ext_mode_fixup,
.prepare = dce_v8_0_ext_prepare,
.mode_set = dce_v8_0_ext_mode_set,
.commit = dce_v8_0_ext_commit,
-- 
2.5.0



[PATCH 01/17] drm/virtio: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
b/drivers/gpu/drm/virtio/virtgpu_display.c
index a165f03..429aa31 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -282,13 +282,6 @@ static const struct drm_crtc_helper_funcs 
virtio_gpu_crtc_helper_funcs = {
.atomic_check  = virtio_gpu_crtc_atomic_check,
 };

-static bool virtio_gpu_enc_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -362,7 +355,6 @@ virtio_gpu_best_encoder(struct drm_connector *connector)
 }

 static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = {
-   .mode_fixup = virtio_gpu_enc_mode_fixup,
.mode_set   = virtio_gpu_enc_mode_set,
.enable = virtio_gpu_enc_enable,
.disable= virtio_gpu_enc_disable,
-- 
2.5.0



[PATCH 00/17] drm encoders cleanup: nuke optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
mode_fixup function for encoder drivers became optional with patch
http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha
 at synopsys.com

This patch set nukes all the dummy mode_fixup implementations.

(made on top of Daniel topic/drm-misc branch)

Carlos Palminha (17):
  drm/virtio: removed optional dummy encoder mode_fixup function.
  drm/udl: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/amdgpu: removed optional dummy encoder mode_fixup function.
  drm/ast: removed optional dummy encoder mode_fixup function.
  drm/bochs: removed optional dummy encoder mode_fixup function.
  drm/cirrus: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/gma500: removed optional dummy encoder mode_fixup function.
  drm/imx: removed optional dummy encoder mode_fixup function.
  drm/msm/mdp: removed optional dummy encoder mode_fixup function.
  drm/mgag200: removed optional dummy encoder mode_fixup function.
  drm/qxl: removed optional dummy encoder mode_fixup function.
  drm/radeon: removed optional dummy encoder mode_fixup function.
  drm/rockchip: removed optional dummy encoder mode_fixup function.
  drm/sti: removed optional dummy encoder mode_fixup function.
  drm/tilcdc: removed optional dummy encoder mode_fixup function.

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  8 
 drivers/gpu/drm/ast/ast_mode.c   |  8 
 drivers/gpu/drm/bochs/bochs_kms.c|  8 
 drivers/gpu/drm/cirrus/cirrus_mode.c |  9 -
 drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
 drivers/gpu/drm/gma500/cdv_intel_crt.c   |  1 -
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |  1 -
 drivers/gpu/drm/gma500/gma_display.c |  7 ---
 drivers/gpu/drm/gma500/gma_display.h |  3 ---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c   |  1 -
 drivers/gpu/drm/imx/dw_hdmi-imx.c|  8 
 drivers/gpu/drm/imx/imx-ldb.c|  8 
 drivers/gpu/drm/imx/imx-tve.c|  8 
 drivers/gpu/drm/imx/parallel-display.c   |  8 
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  8 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  |  9 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  |  8 
 drivers/gpu/drm/qxl/qxl_display.c|  9 -
 drivers/gpu/drm/radeon/atombios_encoders.c   |  8 
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c   |  8 
 drivers/gpu/drm/sti/sti_tvout.c  | 10 --
 drivers/gpu/drm/tilcdc/tilcdc_panel.c|  9 -
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c   |  9 -
 drivers/gpu/drm/udl/udl_encoder.c|  8 
 drivers/gpu/drm/virtio/virtgpu_display.c |  8 
 33 files changed, 244 deletions(-)

-- 
2.5.0



[PATCH 04/17] drm/amdgpu: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 8 
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 093599a..3483018 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -3624,16 +3624,8 @@ dce_v10_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v10_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v10_0_ext_helper_funcs = {
.dpms = dce_v10_0_ext_dpms,
-   .mode_fixup = dce_v10_0_ext_mode_fixup,
.prepare = dce_v10_0_ext_prepare,
.mode_set = dce_v10_0_ext_mode_set,
.commit = dce_v10_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 8e67249..36deea1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3619,16 +3619,8 @@ dce_v11_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v11_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v11_0_ext_helper_funcs = {
.dpms = dce_v11_0_ext_dpms,
-   .mode_fixup = dce_v11_0_ext_mode_fixup,
.prepare = dce_v11_0_ext_prepare,
.mode_set = dce_v11_0_ext_mode_set,
.commit = dce_v11_0_ext_commit,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index d0e128c..25dd8b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -3554,16 +3554,8 @@ dce_v8_0_ext_dpms(struct drm_encoder *encoder, int mode)

 }

-static bool dce_v8_0_ext_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static const struct drm_encoder_helper_funcs dce_v8_0_ext_helper_funcs = {
.dpms = dce_v8_0_ext_dpms,
-   .mode_fixup = dce_v8_0_ext_mode_fixup,
.prepare = dce_v8_0_ext_prepare,
.mode_set = dce_v8_0_ext_mode_set,
.commit = dce_v8_0_ext_commit,
-- 
2.5.0



[PATCH 00/17] drm encoders cleanup: nuke optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
mode_fixup function for encoder drivers became optional with patch
http://patchwork.freedesktop.org/patch/msgid/1455106522-32307-1-git-send-email-palminha
 at synopsys.com

This patch set nukes all the dummy mode_fixup implementations.

(made on top of Daniel topic/drm-misc branch)

Carlos Palminha (17):
  drm/virtio: removed optional dummy encoder mode_fixup function.
  drm/udl: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/amdgpu: removed optional dummy encoder mode_fixup function.
  drm/ast: removed optional dummy encoder mode_fixup function.
  drm/bochs: removed optional dummy encoder mode_fixup function.
  drm/cirrus: removed optional dummy encoder mode_fixup function.
  drm/exynos: removed optional dummy encoder mode_fixup function.
  drm/gma500: removed optional dummy encoder mode_fixup function.
  drm/imx: removed optional dummy encoder mode_fixup function.
  drm/msm/mdp: removed optional dummy encoder mode_fixup function.
  drm/mgag200: removed optional dummy encoder mode_fixup function.
  drm/qxl: removed optional dummy encoder mode_fixup function.
  drm/radeon: removed optional dummy encoder mode_fixup function.
  drm/rockchip: removed optional dummy encoder mode_fixup function.
  drm/sti: removed optional dummy encoder mode_fixup function.
  drm/tilcdc: removed optional dummy encoder mode_fixup function.

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c   |  8 
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c|  8 
 drivers/gpu/drm/ast/ast_mode.c   |  8 
 drivers/gpu/drm/bochs/bochs_kms.c|  8 
 drivers/gpu/drm/cirrus/cirrus_mode.c |  9 -
 drivers/gpu/drm/exynos/exynos_dp_core.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  |  8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |  8 
 drivers/gpu/drm/gma500/cdv_intel_crt.c   |  1 -
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c  |  1 -
 drivers/gpu/drm/gma500/gma_display.c |  7 ---
 drivers/gpu/drm/gma500/gma_display.h |  3 ---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c   |  1 -
 drivers/gpu/drm/imx/dw_hdmi-imx.c|  8 
 drivers/gpu/drm/imx/imx-ldb.c|  8 
 drivers/gpu/drm/imx/imx-tve.c|  8 
 drivers/gpu/drm/imx/parallel-display.c   |  8 
 drivers/gpu/drm/mgag200/mgag200_mode.c   |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  |  8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c |  8 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  |  9 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  |  8 
 drivers/gpu/drm/qxl/qxl_display.c|  9 -
 drivers/gpu/drm/radeon/atombios_encoders.c   |  8 
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c   |  8 
 drivers/gpu/drm/sti/sti_tvout.c  | 10 --
 drivers/gpu/drm/tilcdc/tilcdc_panel.c|  9 -
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c   |  9 -
 drivers/gpu/drm/udl/udl_encoder.c|  8 
 drivers/gpu/drm/virtio/virtgpu_display.c |  8 
 33 files changed, 244 deletions(-)

-- 
2.5.0



[PATCH 03/17] drm/exynos: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e977a81..736115c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1597,13 +1597,6 @@ static int exynos_dsi_create_connector(struct 
drm_encoder *encoder)
return 0;
 }

-static bool exynos_dsi_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dsi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -1623,7 +1616,6 @@ static void exynos_dsi_mode_set(struct drm_encoder 
*encoder,
 }

 static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = 
{
-   .mode_fixup = exynos_dsi_mode_fixup,
.mode_set = exynos_dsi_mode_set,
.enable = exynos_dsi_enable,
.disable = exynos_dsi_disable,
-- 
2.5.0



[PATCH 02/17] drm/udl: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/udl/udl_encoder.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_encoder.c 
b/drivers/gpu/drm/udl/udl_encoder.c
index a181a64..59a4b34 100644
--- a/drivers/gpu/drm/udl/udl_encoder.c
+++ b/drivers/gpu/drm/udl/udl_encoder.c
@@ -26,13 +26,6 @@ static void udl_encoder_disable(struct drm_encoder *encoder)
 {
 }

-static bool udl_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void udl_encoder_prepare(struct drm_encoder *encoder)
 {
 }
@@ -54,7 +47,6 @@ udl_encoder_dpms(struct drm_encoder *encoder, int mode)

 static const struct drm_encoder_helper_funcs udl_helper_funcs = {
.dpms = udl_encoder_dpms,
-   .mode_fixup = udl_mode_fixup,
.prepare = udl_encoder_prepare,
.mode_set = udl_encoder_mode_set,
.commit = udl_encoder_commit,
-- 
2.5.0



[PATCH 03/17] drm/exynos: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e977a81..736115c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1597,13 +1597,6 @@ static int exynos_dsi_create_connector(struct 
drm_encoder *encoder)
return 0;
 }

-static bool exynos_dsi_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dsi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -1623,7 +1616,6 @@ static void exynos_dsi_mode_set(struct drm_encoder 
*encoder,
 }

 static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = 
{
-   .mode_fixup = exynos_dsi_mode_fixup,
.mode_set = exynos_dsi_mode_set,
.enable = exynos_dsi_enable,
.disable = exynos_dsi_disable,
-- 
2.5.0



[PATCH 01/17] drm/virtio: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c 
b/drivers/gpu/drm/virtio/virtgpu_display.c
index a165f03..429aa31 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -282,13 +282,6 @@ static const struct drm_crtc_helper_funcs 
virtio_gpu_crtc_helper_funcs = {
.atomic_check  = virtio_gpu_crtc_atomic_check,
 };

-static bool virtio_gpu_enc_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void virtio_gpu_enc_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -362,7 +355,6 @@ virtio_gpu_best_encoder(struct drm_connector *connector)
 }

 static const struct drm_encoder_helper_funcs virtio_gpu_enc_helper_funcs = {
-   .mode_fixup = virtio_gpu_enc_mode_fixup,
.mode_set   = virtio_gpu_enc_mode_set,
.enable = virtio_gpu_enc_enable,
.disable= virtio_gpu_enc_disable,
-- 
2.5.0



[PATCH 02/17] drm/udl: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/udl/udl_encoder.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_encoder.c 
b/drivers/gpu/drm/udl/udl_encoder.c
index a181a64..59a4b34 100644
--- a/drivers/gpu/drm/udl/udl_encoder.c
+++ b/drivers/gpu/drm/udl/udl_encoder.c
@@ -26,13 +26,6 @@ static void udl_encoder_disable(struct drm_encoder *encoder)
 {
 }

-static bool udl_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void udl_encoder_prepare(struct drm_encoder *encoder)
 {
 }
@@ -54,7 +47,6 @@ udl_encoder_dpms(struct drm_encoder *encoder, int mode)

 static const struct drm_encoder_helper_funcs udl_helper_funcs = {
.dpms = udl_encoder_dpms,
-   .mode_fixup = udl_mode_fixup,
.prepare = udl_encoder_prepare,
.mode_set = udl_encoder_mode_set,
.commit = udl_encoder_commit,
-- 
2.5.0



[PATCH 05/17] drm/ast: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/ast/ast_mode.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index 0123458..f221e2d 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -710,13 +710,6 @@ static void ast_encoder_dpms(struct drm_encoder *encoder, 
int mode)

 }

-static bool ast_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void ast_encoder_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -736,7 +729,6 @@ static void ast_encoder_commit(struct drm_encoder *encoder)

 static const struct drm_encoder_helper_funcs ast_enc_helper_funcs = {
.dpms = ast_encoder_dpms,
-   .mode_fixup = ast_mode_fixup,
.prepare = ast_encoder_prepare,
.commit = ast_encoder_commit,
.mode_set = ast_encoder_mode_set,
-- 
2.5.0



[PATCH 06/17] drm/bochs: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/bochs/bochs_kms.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/bochs/bochs_kms.c 
b/drivers/gpu/drm/bochs/bochs_kms.c
index 2849f1b..317c27f 100644
--- a/drivers/gpu/drm/bochs/bochs_kms.c
+++ b/drivers/gpu/drm/bochs/bochs_kms.c
@@ -152,13 +152,6 @@ static void bochs_crtc_init(struct drm_device *dev)
drm_crtc_helper_add(crtc, &bochs_helper_funcs);
 }

-static bool bochs_encoder_mode_fixup(struct drm_encoder *encoder,
-const struct drm_display_mode *mode,
-struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void bochs_encoder_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -179,7 +172,6 @@ static void bochs_encoder_commit(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs bochs_encoder_helper_funcs = {
.dpms = bochs_encoder_dpms,
-   .mode_fixup = bochs_encoder_mode_fixup,
.mode_set = bochs_encoder_mode_set,
.prepare = bochs_encoder_prepare,
.commit = bochs_encoder_commit,
-- 
2.5.0



[PATCH 08/17] drm/exynos: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/exynos/exynos_dp_core.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_dpi.c  | 8 
 drivers/gpu/drm/exynos/exynos_drm_vidi.c | 8 
 3 files changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c 
b/drivers/gpu/drm/exynos/exynos_dp_core.c
index 673164b..9fd12c62 100644
--- a/drivers/gpu/drm/exynos/exynos_dp_core.c
+++ b/drivers/gpu/drm/exynos/exynos_dp_core.c
@@ -1155,13 +1155,6 @@ static int exynos_dp_create_connector(struct drm_encoder 
*encoder)
return 0;
 }

-static bool exynos_dp_mode_fixup(struct drm_encoder *encoder,
-const struct drm_display_mode *mode,
-struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dp_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -1177,7 +1170,6 @@ static void exynos_dp_disable(struct drm_encoder *encoder)
 }

 static const struct drm_encoder_helper_funcs exynos_dp_encoder_helper_funcs = {
-   .mode_fixup = exynos_dp_mode_fixup,
.mode_set = exynos_dp_mode_set,
.enable = exynos_dp_enable,
.disable = exynos_dp_disable,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
index 05350ae..75e570f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c
@@ -128,13 +128,6 @@ static int exynos_dpi_create_connector(struct drm_encoder 
*encoder)
return 0;
 }

-static bool exynos_dpi_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_dpi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -162,7 +155,6 @@ static void exynos_dpi_disable(struct drm_encoder *encoder)
 }

 static const struct drm_encoder_helper_funcs exynos_dpi_encoder_helper_funcs = 
{
-   .mode_fixup = exynos_dpi_mode_fixup,
.mode_set = exynos_dpi_mode_set,
.enable = exynos_dpi_enable,
.disable = exynos_dpi_disable,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c 
b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index 62ac4e5..65108cb 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -410,13 +410,6 @@ static int vidi_create_connector(struct drm_encoder 
*encoder)
return 0;
 }

-static bool exynos_vidi_mode_fixup(struct drm_encoder *encoder,
-const struct drm_display_mode *mode,
-struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void exynos_vidi_mode_set(struct drm_encoder *encoder,
   struct drm_display_mode *mode,
   struct drm_display_mode *adjusted_mode)
@@ -432,7 +425,6 @@ static void exynos_vidi_disable(struct drm_encoder *encoder)
 }

 static const struct drm_encoder_helper_funcs exynos_vidi_encoder_helper_funcs 
= {
-   .mode_fixup = exynos_vidi_mode_fixup,
.mode_set = exynos_vidi_mode_set,
.enable = exynos_vidi_enable,
.disable = exynos_vidi_disable,
-- 
2.5.0



[PATCH 09/17] drm/gma500: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/gma500/cdv_intel_crt.c  | 1 -
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c | 1 -
 drivers/gpu/drm/gma500/gma_display.c| 7 ---
 drivers/gpu/drm/gma500/gma_display.h| 3 ---
 drivers/gpu/drm/gma500/oaktrail_hdmi.c  | 1 -
 5 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c 
b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index d0717a8..b837e7a 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -217,7 +217,6 @@ static int cdv_intel_crt_set_property(struct drm_connector 
*connector,

 static const struct drm_encoder_helper_funcs cdv_intel_crt_helper_funcs = {
.dpms = cdv_intel_crt_dpms,
-   .mode_fixup = gma_encoder_mode_fixup,
.prepare = gma_encoder_prepare,
.commit = gma_encoder_commit,
.mode_set = cdv_intel_crt_mode_set,
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c 
b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index ddf2d77..28f9d90 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -255,7 +255,6 @@ static void cdv_hdmi_destroy(struct drm_connector 
*connector)

 static const struct drm_encoder_helper_funcs cdv_hdmi_helper_funcs = {
.dpms = cdv_hdmi_dpms,
-   .mode_fixup = gma_encoder_mode_fixup,
.prepare = gma_encoder_prepare,
.mode_set = cdv_hdmi_mode_set,
.commit = gma_encoder_commit,
diff --git a/drivers/gpu/drm/gma500/gma_display.c 
b/drivers/gpu/drm/gma500/gma_display.c
index ff17af4..9270821 100644
--- a/drivers/gpu/drm/gma500/gma_display.c
+++ b/drivers/gpu/drm/gma500/gma_display.c
@@ -478,13 +478,6 @@ int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int 
y)
return 0;
 }

-bool gma_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
 const struct drm_display_mode *mode,
 struct drm_display_mode *adjusted_mode)
diff --git a/drivers/gpu/drm/gma500/gma_display.h 
b/drivers/gpu/drm/gma500/gma_display.h
index ed569d8..78b9f98 100644
--- a/drivers/gpu/drm/gma500/gma_display.h
+++ b/drivers/gpu/drm/gma500/gma_display.h
@@ -90,9 +90,6 @@ extern void gma_crtc_restore(struct drm_crtc *crtc);
 extern void gma_encoder_prepare(struct drm_encoder *encoder);
 extern void gma_encoder_commit(struct drm_encoder *encoder);
 extern void gma_encoder_destroy(struct drm_encoder *encoder);
-extern bool gma_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode);

 /* Common clock related functions */
 extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi.c 
b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
index 2d18499..8b2eb32 100644
--- a/drivers/gpu/drm/gma500/oaktrail_hdmi.c
+++ b/drivers/gpu/drm/gma500/oaktrail_hdmi.c
@@ -601,7 +601,6 @@ static void oaktrail_hdmi_destroy(struct drm_connector 
*connector)

 static const struct drm_encoder_helper_funcs oaktrail_hdmi_helper_funcs = {
.dpms = oaktrail_hdmi_dpms,
-   .mode_fixup = gma_encoder_mode_fixup,
.prepare = gma_encoder_prepare,
.mode_set = oaktrail_hdmi_mode_set,
.commit = gma_encoder_commit,
-- 
2.5.0



[PATCH 10/17] drm/imx: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/imx/dw_hdmi-imx.c  | 8 
 drivers/gpu/drm/imx/imx-ldb.c  | 8 
 drivers/gpu/drm/imx/imx-tve.c  | 8 
 drivers/gpu/drm/imx/parallel-display.c | 8 
 4 files changed, 32 deletions(-)

diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 063825f..21d6158 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -109,13 +109,6 @@ static void dw_hdmi_imx_encoder_disable(struct drm_encoder 
*encoder)
 {
 }

-static bool dw_hdmi_imx_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adj_mode)
-{
-   return true;
-}
-
 static void dw_hdmi_imx_encoder_mode_set(struct drm_encoder *encoder,
 struct drm_display_mode *mode,
 struct drm_display_mode *adj_mode)
@@ -138,7 +131,6 @@ static void dw_hdmi_imx_encoder_prepare(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs dw_hdmi_imx_encoder_helper_funcs 
= {
-   .mode_fixup = dw_hdmi_imx_encoder_mode_fixup,
.mode_set   = dw_hdmi_imx_encoder_mode_set,
.prepare= dw_hdmi_imx_encoder_prepare,
.commit = dw_hdmi_imx_encoder_commit,
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index 22ac482..024d613 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -139,13 +139,6 @@ static void imx_ldb_encoder_dpms(struct drm_encoder 
*encoder, int mode)
 {
 }

-static bool imx_ldb_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void imx_ldb_set_clock(struct imx_ldb *ldb, int mux, int chno,
unsigned long serial_clk, unsigned long di_clk)
 {
@@ -376,7 +369,6 @@ static const struct drm_encoder_funcs imx_ldb_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs imx_ldb_encoder_helper_funcs = {
.dpms = imx_ldb_encoder_dpms,
-   .mode_fixup = imx_ldb_encoder_mode_fixup,
.prepare = imx_ldb_encoder_prepare,
.commit = imx_ldb_encoder_commit,
.mode_set = imx_ldb_encoder_mode_set,
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index 292349f..ae7a9fb 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -286,13 +286,6 @@ static void imx_tve_encoder_dpms(struct drm_encoder 
*encoder, int mode)
dev_err(tve->dev, "failed to disable TVOUT: %d\n", ret);
 }

-static bool imx_tve_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
 {
struct imx_tve *tve = enc_to_tve(encoder);
@@ -379,7 +372,6 @@ static const struct drm_encoder_funcs imx_tve_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs imx_tve_encoder_helper_funcs = {
.dpms = imx_tve_encoder_dpms,
-   .mode_fixup = imx_tve_encoder_mode_fixup,
.prepare = imx_tve_encoder_prepare,
.mode_set = imx_tve_encoder_mode_set,
.commit = imx_tve_encoder_commit,
diff --git a/drivers/gpu/drm/imx/parallel-display.c 
b/drivers/gpu/drm/imx/parallel-display.c
index 0ffef17..363e2c7 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -112,13 +112,6 @@ static void imx_pd_encoder_dpms(struct drm_encoder 
*encoder, int mode)
drm_panel_enable(imxpd->panel);
 }

-static bool imx_pd_encoder_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
 {
struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
@@ -166,7 +159,6 @@ static const struct drm_encoder_funcs imx_pd_encoder_funcs 
= {

 static const struct drm_encoder_helper_funcs imx_pd_encoder_helper_funcs = {
.dpms = imx_pd_encoder_dpms,
-   .mode_fixup = imx_pd_encoder_mode_fixup,
.prepare = imx_pd_encoder_prepare,
.commit = imx_pd_encoder_commit,
.mode_set = imx_pd_encoder_mode_set,
-- 
2.5.0



[PATCH 15/17] drm/rockchip: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c 
b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index f8f8f29..7766206 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -875,13 +875,6 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder 
*encoder)
clk_disable_unprepare(dsi->pclk);
 }

-static bool dw_mipi_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void dw_mipi_dsi_encoder_commit(struct drm_encoder *encoder)
 {
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
@@ -931,7 +924,6 @@ static void dw_mipi_dsi_encoder_commit(struct drm_encoder 
*encoder)

 static struct drm_encoder_helper_funcs
 dw_mipi_dsi_encoder_helper_funcs = {
-   .mode_fixup = dw_mipi_dsi_encoder_mode_fixup,
.commit = dw_mipi_dsi_encoder_commit,
.mode_set = dw_mipi_dsi_encoder_mode_set,
.disable = dw_mipi_dsi_encoder_disable,
-- 
2.5.0



[PATCH 07/17] drm/cirrus: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/cirrus/cirrus_mode.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c 
b/drivers/gpu/drm/cirrus/cirrus_mode.c
index 4a02854..432ce94 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -430,14 +430,6 @@ void cirrus_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 
*red, u16 *green,
*blue = cirrus_crtc->lut_b[regno];
 }

-
-static bool cirrus_encoder_mode_fixup(struct drm_encoder *encoder,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void cirrus_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -466,7 +458,6 @@ static void cirrus_encoder_destroy(struct drm_encoder 
*encoder)

 static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = {
.dpms = cirrus_encoder_dpms,
-   .mode_fixup = cirrus_encoder_mode_fixup,
.mode_set = cirrus_encoder_mode_set,
.prepare = cirrus_encoder_prepare,
.commit = cirrus_encoder_commit,
-- 
2.5.0



[PATCH 11/17] drm/msm/mdp: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c  | 8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c  | 8 
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c | 8 
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c  | 9 -
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_encoder.c  | 8 
 5 files changed, 41 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
index 2f57e94..106f0e7 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dsi_encoder.c
@@ -47,13 +47,6 @@ static const struct drm_encoder_funcs mdp4_dsi_encoder_funcs 
= {
.destroy = mdp4_dsi_encoder_destroy,
 };

-static bool mdp4_dsi_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp4_dsi_encoder_mode_set(struct drm_encoder *encoder,
  struct drm_display_mode *mode,
  struct drm_display_mode *adjusted_mode)
@@ -163,7 +156,6 @@ static void mdp4_dsi_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp4_dsi_encoder_helper_funcs = {
-   .mode_fixup = mdp4_dsi_encoder_mode_fixup,
.mode_set = mdp4_dsi_encoder_mode_set,
.disable = mdp4_dsi_encoder_disable,
.enable = mdp4_dsi_encoder_enable,
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
index a21df54..35ad78a 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_dtv_encoder.c
@@ -94,13 +94,6 @@ static const struct drm_encoder_funcs mdp4_dtv_encoder_funcs 
= {
.destroy = mdp4_dtv_encoder_destroy,
 };

-static bool mdp4_dtv_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp4_dtv_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -234,7 +227,6 @@ static void mdp4_dtv_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp4_dtv_encoder_helper_funcs = {
-   .mode_fixup = mdp4_dtv_encoder_mode_fixup,
.mode_set = mdp4_dtv_encoder_mode_set,
.enable = mdp4_dtv_encoder_enable,
.disable = mdp4_dtv_encoder_disable,
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
index cd63fed..bc3d8e7 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_lcdc_encoder.c
@@ -260,13 +260,6 @@ static void setup_phy(struct drm_encoder *encoder)
mdp4_write(mdp4_kms, REG_MDP4_LVDS_PHY_CFG0, lvds_phy_cfg0);
 }

-static bool mdp4_lcdc_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp4_lcdc_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -430,7 +423,6 @@ static void mdp4_lcdc_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp4_lcdc_encoder_helper_funcs = {
-   .mode_fixup = mdp4_lcdc_encoder_mode_fixup,
.mode_set = mdp4_lcdc_encoder_mode_set,
.disable = mdp4_lcdc_encoder_disable,
.enable = mdp4_lcdc_encoder_enable,
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
index 1aa21db..69094cb 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cmd_encoder.c
@@ -188,13 +188,6 @@ static const struct drm_encoder_funcs 
mdp5_cmd_encoder_funcs = {
.destroy = mdp5_cmd_encoder_destroy,
 };

-static bool mdp5_cmd_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode,
-   struct drm_display_mode *adjusted_mode)
-{
-   return true;
-}
-
 static void mdp5_cmd_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
@@ -256,7 +249,6 @@ static void mdp5_cmd_encoder_enable(struct drm_encoder 
*encoder)
 }

 static const struct drm_encoder_helper_funcs mdp5_cmd_encoder_helper_funcs = {
-   .mode_fixup = mdp5_cmd_encoder_mode_fixup,
.mode_set = mdp5_cmd_encoder_mode_set,
.disable = mdp5_cmd_encoder_disable,
.enable = mdp5_cmd_encoder_enable,
@@ -340,4 +332,3 @@ fail:

return ERR_PT

[PATCH 13/17] drm/qxl: removed optional dummy encoder mode_fixup function.

2016-02-12 Thread Carlos Palminha
---
 drivers/gpu/drm/qxl/qxl_display.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c 
b/drivers/gpu/drm/qxl/qxl_display.c
index 8627651..43e5f50 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -734,14 +734,6 @@ static void qxl_enc_dpms(struct drm_encoder *encoder, int 
mode)
DRM_DEBUG("\n");
 }

-static bool qxl_enc_mode_fixup(struct drm_encoder *encoder,
-  const struct drm_display_mode *mode,
-  struct drm_display_mode *adjusted_mode)
-{
-   DRM_DEBUG("\n");
-   return true;
-}
-
 static void qxl_enc_prepare(struct drm_encoder *encoder)
 {
DRM_DEBUG("\n");
@@ -864,7 +856,6 @@ static struct drm_encoder *qxl_best_encoder(struct 
drm_connector *connector)

 static const struct drm_encoder_helper_funcs qxl_enc_helper_funcs = {
.dpms = qxl_enc_dpms,
-   .mode_fixup = qxl_enc_mode_fixup,
.prepare = qxl_enc_prepare,
.mode_set = qxl_enc_mode_set,
.commit = qxl_enc_commit,
-- 
2.5.0



  1   2   >