[git pull] drm next (msm) + fixes

2018-06-10 Thread Dave Airlie
Hi Linus,

I looked at Rob's msm tree, he kept it small due to being late, and it
was in -next for a while before he was ill, so I think it should be
fine. Otherwise this contains a set of i915 fixes and a v3d build fix,
and vc4 leak fix.

Thanks,
Dave.

drm-next-2018-06-11:
msm next, i915, vc4, v3d fixes
The following changes since commit 568cf2e6aa0c762f14d2d0d481a006f93c63ab7a:

  Merge tag 'drm-amdkfd-next-2018-05-28' of
git://people.freedesktop.org/~gabbayo/linux into drm-next (2018-05-30
11:12:22 +1000)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm tags/drm-next-2018-06-11

for you to fetch changes up to 33ce21d6a2491ef9adb8dc395e3f5bbbfcdc95b5:

  Merge tag 'drm-intel-next-fixes-2018-06-08-2' of
git://anongit.freedesktop.org/drm/drm-intel into drm-next (2018-06-09
06:34:51 +1000)


msm next, i915, vc4, v3d fixes


Abhinav Kumar (3):
  drm/msm/dsi: check return value for video done waits
  drm/msm/dsi: check video mode engine status before waiting
  drm/msm/dsi: implement auto PHY timing calculator for 10nm PHY

Archit Taneja (3):
  drm/msm/mdp5: Add global state as a private atomic object
  drm/msm/mdp5: Use the new private_obj state
  drm/msm: Don't subclass drm_atomic_state anymore

Arnd Bergmann (1):
  drm/v3d: add CONFIG_MMU dependency

Ben Hutchings (1):
  drm/msm: Fix possible null dereference on failure of get_pages()

Changbin Du (2):
  drm/i915/gvt: Fix the validation on size field of dp aux header
  drm/i915/kvmgt: Check the pfn got from vfio_pin_pages

Chris Wilson (2):
  drm/i915: Nul-terminate legacy debug string
  drm/i915: Remove stale asserts from i915_gem_find_active_request()

Colin Ian King (1):
  drm/i915/gvt: fix memory leak of a cmd_entry struct on error exit path

Daniel Mack (2):
  drm/msm: remove unbalanced mutex unlock
  drm/msm: use correct aspace pointer in msm_gem_put_iova()

Dave Airlie (3):
  Merge tag 'drm-msm-next-2018-06-04' of
git://people.freedesktop.org/~robclark/linux into drm-next
  Merge tag 'drm-misc-next-fixes-2018-05-31' of
git://anongit.freedesktop.org/drm/drm-misc into drm-next
  Merge tag 'drm-intel-next-fixes-2018-06-08-2' of
git://anongit.freedesktop.org/drm/drm-intel into drm-next

Emil Velikov (1):
  drm/msm: don't deref error pointer in the msm_fbdev_create error path

Eric Anholt (1):
  drm/vc4: Fix leak of the file_priv that stored the perfmon.

Jani Nikula (2):
  Revert "drm/i915/edp: Allow alternate fixed mode for eDP if available."
  Merge tag 'gvt-fixes-2018-04-19' of
https://github.com/intel/gvt-linux into drm-intel-next-fixes

Jeykumar Sankaran (1):
  drm/msm: Add modifier to mdp_get_format arguments

Mahesh Kumar (2):
  drm/i915/icl: fix icl_unmap/map_plls_to_ports
  drm/i915/icl: Don't update enabled dbuf slices struct until updated in hw

Sean Paul (7):
  drm/msm: Mark the crtc->state->event consumed
  drm/msm: Refactor complete_commit() to look more the helpers
  drm/msm: Move implicit sync handling to prepare_fb
  drm/msm: Issue queued events when disabling crtc
  drm/msm: Remove msm_commit/worker, use atomic helper commit
  drm/msm: Switch to atomic_helper_commit()
  drm/msm: Fix NULL deref on bind/probe deferral

Stefan Agner (1):
  drm/msm/dsi: use correct enum in dsi_get_cmd_fmt

Ville Syrjälä (1):
  drm/i915: Remove bogus NV12 PLANE_COLOR_CTL setup

Xiong Zhang (1):
  drm/i915/gvt: Dereference msi eventfd_ctx when it isn't used anymore

Zhenyu Wang (1):
  Back merge 'drm-intel-fixes' into gvt-fixes

 drivers/gpu/drm/i915/gvt/cmd_parser.c  |   1 +
 drivers/gpu/drm/i915/gvt/display.h |   2 +-
 drivers/gpu/drm/i915/gvt/handlers.c|  13 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c   |  34 +++-
 drivers/gpu/drm/i915/i915_gem.c|  17 +-
 drivers/gpu/drm/i915/intel_ddi.c   |   6 +-
 drivers/gpu/drm/i915/intel_display.c   |   7 +-
 drivers/gpu/drm/i915/intel_dp.c|  38 +
 drivers/gpu/drm/i915/intel_drv.h   |   2 -
 drivers/gpu/drm/i915/intel_dsi.c   |   2 +-
 drivers/gpu/drm/i915/intel_dvo.c   |   2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c |   2 +-
 drivers/gpu/drm/i915/intel_lvds.c  |   3 +-
 drivers/gpu/drm/i915/intel_panel.c |   6 -
 drivers/gpu/drm/i915/intel_pm.c|   1 -
 drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c |  17 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c  |   9 +
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c   | 105 
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h   |  27 +--
 drivers/gpu/drm/msm/disp/mdp5/mdp5_mixer.c |  12 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c  |  20 ++-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c |  16 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c   |  17 +-
 drivers/gpu/drm/msm/ds

Re: [PATCH v7 0/6] Add ChromeOS EC CEC Support

2018-06-10 Thread Lee Jones
On Fri, 08 Jun 2018, Hans Verkuil wrote:
> On 08/06/18 10:17, Neil Armstrong wrote:
> > On 08/06/2018 09:53, Hans Verkuil wrote:
> >> On 06/01/2018 10:19 AM, Neil Armstrong wrote:
> >>> Hi All,
> >>>
> >>> The new Google "Fizz" Intel-based ChromeOS device is gaining CEC support
> >>> through it's Embedded Controller, to enable the Linux CEC Core to 
> >>> communicate
> >>> with it and get the CEC Physical Address from the correct HDMI Connector, 
> >>> the
> >>> following must be added/changed:
> >>> - Add the CEC sub-device registration in the ChromeOS EC MFD Driver
> >>> - Add the CEC related commands and events definitions into the EC MFD 
> >>> driver
> >>> - Add a way to get a CEC notifier with it's (optional) connector name
> >>> - Add the CEC notifier to the i915 HDMI driver
> >>> - Add the proper ChromeOS EC CEC Driver
> >>>
> >>> The CEC notifier with the connector name is the tricky point, since even 
> >>> on
> >>> Device-Tree platforms, there is no way to distinguish between multiple 
> >>> HDMI
> >>> connectors from the same DRM driver. The solution I implemented is pretty
> >>> simple and only adds an optional connector name to eventually distinguish
> >>> an HDMI connector notifier from another if they share the same device.
> >>
> >> This looks good to me, which brings me to the next question: how to merge
> >> this?
> >>
> >> It touches on three subsystems (media, drm, mfd), so that makes this
> >> tricky.
> >>
> >> I think there are two options: either the whole series goes through the
> >> media tree, or patches 1+2 go through drm and 3-6 through media. If there
> >> is a high chance of conflicts in the mfd code, then it is also an option to
> >> have patches 3-6 go through the mfd subsystem.
> > 
> > I think patches 3-6 should go in the mfd tree, Lee is used to handle this,
> > then I think the rest could go in the media tree.
> > 
> > Lee, do you think it would be possible to have an immutable branch with 
> > patches 3-6 ?
> > 
> > Could we have an immutable branch from media tree with patch 1 to be merged 
> > in
> > the i915 tree for patch 2 ?
> > 
> > Or patch 1+2 could me merged into the i915 tree and generate an immutable 
> > branch
> 
> I think patches 1+2 can just go to the i915 tree. The i915 driver changes 
> often,
> so going through that tree makes sense. The cec-notifier code is unlikely to 
> change,
> and I am fine with that patch going through i915.
> 
> > for media to merge the mfd branch + patch 7 ?
> 
> Patch 7? I only count 6?
> 
> If 1+2 go through drm and 3-6 go through mfd, then media isn't affected at 
> all.
> There is chance of a conflict when this is eventually pushed to mainline for
> the media Kconfig, but that's all.

What are the *build* dependencies within the set?

I'd be happy to send out a pull-request for either all of the patches,
or just the MFD changes once I've had chance to review them.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 26/28] drm/mediatek: add DPI1/DSI1/DSI2/DSI3 in comp_init

2018-06-10 Thread Stu Hsieh
This patch add components DPI1/DSI1/DSI2/DSI3 in comp_init.
Because the some parameter for these components initialized
in their driver.

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 22f4c72fa785..ff974d82a4a6 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -278,7 +278,11 @@ int mtk_ddp_comp_init(struct device *dev, struct 
device_node *node,
 
if (comp_id == DDP_COMPONENT_BLS ||
comp_id == DDP_COMPONENT_DPI0 ||
+   comp_id == DDP_COMPONENT_DPI1 ||
comp_id == DDP_COMPONENT_DSI0 ||
+   comp_id == DDP_COMPONENT_DSI1 ||
+   comp_id == DDP_COMPONENT_DSI2 ||
+   comp_id == DDP_COMPONENT_DSI3 ||
comp_id == DDP_COMPONENT_PWM0) {
comp->regs = NULL;
comp->clk = NULL;
-- 
2.12.5

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


[PATCH 27/28] drm/mediatek: add third ddp path

2018-06-10 Thread Stu Hsieh
This patch create third crtc by third ddp path

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 3 +++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 5 +
 drivers/gpu/drm/mediatek/mtk_drm_drv.h  | 5 -
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c 
b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
index 658b8dd45b83..2d6aa150a9ff 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
@@ -539,6 +539,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
int ret;
int i;
 
+   if (!path)
+   return 0;
+
for (i = 0; i < path_len; i++) {
enum mtk_ddp_comp_id comp_id = path[i];
struct device_node *node;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 08d5d0b47bfe..3d279a299383 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -232,6 +232,11 @@ static int mtk_drm_kms_init(struct drm_device *drm)
if (ret < 0)
goto err_component_unbind;
 
+   ret = mtk_drm_crtc_create(drm, private->data->third_path,
+ private->data->third_len);
+   if (ret < 0)
+   goto err_component_unbind;
+
/* Use OVL device for all DMA memory allocations */
np = private->comp_node[private->data->main_path[0]] ?:
 private->comp_node[private->data->ext_path[0]];
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
index c3378c452c0a..ecc00ca3221d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
@@ -17,7 +17,7 @@
 #include 
 #include "mtk_drm_ddp_comp.h"
 
-#define MAX_CRTC   2
+#define MAX_CRTC   3
 #define MAX_CONNECTOR  2
 
 struct device;
@@ -33,6 +33,9 @@ struct mtk_mmsys_driver_data {
unsigned int main_len;
const enum mtk_ddp_comp_id *ext_path;
unsigned int ext_len;
+   const enum mtk_ddp_comp_id *third_path;
+   unsigned int third_len;
+
bool shadow_register;
 };
 
-- 
2.12.5

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


[PATCH 22/28] drm/mediatek: add connection from RDMA2 to DSI3

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA2 to DSI3

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index ce89a1d86b93..5a8569fa6505 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -96,6 +96,7 @@
 #define RDMA2_MOUT_DPI10x3
 #define RDMA2_MOUT_DSI10x1
 #define RDMA2_MOUT_DSI20x4
+#define RDMA2_MOUT_DSI30x5
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI0_SEL_IN_RDMA2  0x3
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
@@ -105,6 +106,7 @@
 #define DSI2_SEL_IN_RDMA1  (0x1 << 16)
 #define DSI2_SEL_IN_RDMA2  (0x4 << 16)
 #define DSI3_SEL_IN_RDMA1  (0x1 << 16)
+#define DSI3_SEL_IN_RDMA2  (0x4 << 16)
 #define COLOR1_SEL_IN_OVL1 0x1
 
 #define OVL_MOUT_EN_RDMA   0x1
@@ -214,6 +216,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI2) {
*addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
value = RDMA2_MOUT_DSI2;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI3) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
+   value = RDMA2_MOUT_DSI3;
} else {
value = 0;
}
@@ -257,6 +262,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI2) {
*addr = DISP_REG_CONFIG_DSIE_SEL_IN;
value = DSI2_SEL_IN_RDMA2;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI3) {
+   *addr = DISP_REG_CONFIG_DSIE_SEL_IN;
+   value = DSI3_SEL_IN_RDMA2;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 20/28] drm/mediatek: add connection from RDMA2 to DSI1

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA2 to DSI1

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 2d883815d79c..ae10f8f1e140 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -94,11 +94,13 @@
 #define RDMA1_MOUT_DPI10x3
 #define RDMA2_MOUT_DPI00x2
 #define RDMA2_MOUT_DPI10x3
+#define RDMA2_MOUT_DSI10x1
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI0_SEL_IN_RDMA2  0x3
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
 #define DPI1_SEL_IN_RDMA2  (0x3 << 8)
 #define DSI1_SEL_IN_RDMA1  0x1
+#define DSI1_SEL_IN_RDMA2  0x4
 #define DSI2_SEL_IN_RDMA1  (0x1 << 16)
 #define DSI3_SEL_IN_RDMA1  (0x1 << 16)
 #define COLOR1_SEL_IN_OVL1 0x1
@@ -198,6 +200,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI1) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI1;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI1) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
+   value = RDMA2_MOUT_DSI1;
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
value = RDMA2_MOUT_DPI0;
@@ -241,6 +246,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI1) {
*addr = DISP_REG_CONFIG_DPI_SEL_IN;
value = DPI1_SEL_IN_RDMA2;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI1) {
+   *addr = DISP_REG_CONFIG_DSIE_SEL_IN;
+   value = DSI1_SEL_IN_RDMA2;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 17/28] drm/mediatek: add connection from RDMA1 to DSI3

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA1 to DSI3

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index c3e647b04ffd..a5cee4b7f908 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -88,12 +88,14 @@
 #define RDMA0_MOUT_DSI30x5
 #define RDMA1_MOUT_DSI10x1
 #define RDMA1_MOUT_DSI20x4
+#define RDMA1_MOUT_DSI30x5
 #define RDMA1_MOUT_DPI00x2
 #define RDMA1_MOUT_DPI10x3
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
 #define DSI1_SEL_IN_RDMA1  0x1
 #define DSI2_SEL_IN_RDMA1  (0x1 << 16)
+#define DSI3_SEL_IN_RDMA1  (0x1 << 16)
 #define COLOR1_SEL_IN_OVL1 0x1
 
 #define OVL_MOUT_EN_RDMA   0x1
@@ -182,6 +184,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI2) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DSI2;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI3) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
+   value = RDMA1_MOUT_DSI3;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
@@ -216,6 +221,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI2) {
*addr = DISP_REG_CONFIG_DSIE_SEL_IN;
value = DSI2_SEL_IN_RDMA1;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI3) {
+   *addr = DISP_REG_CONFIG_DSIO_SEL_IN;
+   value = DSI3_SEL_IN_RDMA1;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 23/28] drm/mediatek: add DPI1 support for mutex

2018-06-10 Thread Stu Hsieh
This patch add the DPI1 support for mutex

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 5a8569fa6505..5916fc11693a 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -76,6 +76,7 @@
 #define MUTEX_SOF_DSI0 1
 #define MUTEX_SOF_DSI1 2
 #define MUTEX_SOF_DPI0 3
+#define MUTEX_SOF_DPI1 4
 
 #define OVL0_MOUT_EN_COLOR00x1
 #define OD_MOUT_EN_RDMA0   0x1
@@ -385,6 +386,9 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
case DDP_COMPONENT_DPI0:
reg = MUTEX_SOF_DPI0;
break;
+   case DDP_COMPONENT_DPI1:
+   reg = MUTEX_SOF_DPI1;
+   break;
default:
if (ddp->mutex_mod[id] < 32) {
offset = DISP_REG_MUTEX_MOD(mutex->id);
@@ -417,6 +421,7 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex 
*mutex,
case DDP_COMPONENT_DSI0:
case DDP_COMPONENT_DSI1:
case DDP_COMPONENT_DPI0:
+   case DDP_COMPONENT_DPI1:
writel_relaxed(MUTEX_SOF_SINGLE_MODE,
   ddp->regs + DISP_REG_MUTEX_SOF(mutex->id));
break;
-- 
2.12.5

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


[PATCH 28/28] drm/mediatek: Add support for mediatek SOC MT2712

2018-06-10 Thread Stu Hsieh
This patch add support for the Mediatek MT2712 DISP subsystem.
There are two OVL engine and three disp output in MT2712.

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 39 ++
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 38 +
 2 files changed, 77 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 28dd8531a7de..c3fa5591bfc8 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -65,6 +65,24 @@
 #define MT8173_MUTEX_MOD_DISP_PWM1 24
 #define MT8173_MUTEX_MOD_DISP_OD   25
 
+#define MT2712_MUTEX_MOD_DISP_PWM2 10
+#define MT2712_MUTEX_MOD_DISP_OVL0 11
+#define MT2712_MUTEX_MOD_DISP_OVL1 12
+#define MT2712_MUTEX_MOD_DISP_RDMA013
+#define MT2712_MUTEX_MOD_DISP_RDMA114
+#define MT2712_MUTEX_MOD_DISP_RDMA215
+#define MT2712_MUTEX_MOD_DISP_WDMA016
+#define MT2712_MUTEX_MOD_DISP_WDMA117
+#define MT2712_MUTEX_MOD_DISP_COLOR0   18
+#define MT2712_MUTEX_MOD_DISP_COLOR1   19
+#define MT2712_MUTEX_MOD_DISP_AAL0 20
+#define MT2712_MUTEX_MOD_DISP_UFOE 22
+#define MT2712_MUTEX_MOD_DISP_PWM0 23
+#define MT2712_MUTEX_MOD_DISP_PWM1 24
+#define MT2712_MUTEX_MOD_DISP_OD0  25
+#define MT2712_MUTEX_MOD2_DISP_AAL133
+#define MT2712_MUTEX_MOD2_DISP_OD1 34
+
 #define MT2701_MUTEX_MOD_DISP_OVL  3
 #define MT2701_MUTEX_MOD_DISP_WDMA 6
 #define MT2701_MUTEX_MOD_DISP_COLOR7
@@ -138,6 +156,26 @@ static const unsigned int 
mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_WDMA0] = MT2701_MUTEX_MOD_DISP_WDMA,
 };
 
+static const unsigned int mt2712_mutex_mod[DDP_COMPONENT_ID_MAX] = {
+   [DDP_COMPONENT_AAL0] = MT2712_MUTEX_MOD_DISP_AAL0,
+   [DDP_COMPONENT_AAL1] = MT2712_MUTEX_MOD2_DISP_AAL1,
+   [DDP_COMPONENT_COLOR0] = MT2712_MUTEX_MOD_DISP_COLOR0,
+   [DDP_COMPONENT_COLOR1] = MT2712_MUTEX_MOD_DISP_COLOR1,
+   [DDP_COMPONENT_OD0] = MT2712_MUTEX_MOD_DISP_OD0,
+   [DDP_COMPONENT_OD1] = MT2712_MUTEX_MOD2_DISP_OD1,
+   [DDP_COMPONENT_OVL0] = MT2712_MUTEX_MOD_DISP_OVL0,
+   [DDP_COMPONENT_OVL1] = MT2712_MUTEX_MOD_DISP_OVL1,
+   [DDP_COMPONENT_PWM0] = MT2712_MUTEX_MOD_DISP_PWM0,
+   [DDP_COMPONENT_PWM1] = MT2712_MUTEX_MOD_DISP_PWM1,
+   [DDP_COMPONENT_PWM2] = MT2712_MUTEX_MOD_DISP_PWM2,
+   [DDP_COMPONENT_RDMA0] = MT2712_MUTEX_MOD_DISP_RDMA0,
+   [DDP_COMPONENT_RDMA1] = MT2712_MUTEX_MOD_DISP_RDMA1,
+   [DDP_COMPONENT_RDMA2] = MT2712_MUTEX_MOD_DISP_RDMA2,
+   [DDP_COMPONENT_UFOE] = MT2712_MUTEX_MOD_DISP_UFOE,
+   [DDP_COMPONENT_WDMA0] = MT2712_MUTEX_MOD_DISP_WDMA0,
+   [DDP_COMPONENT_WDMA1] = MT2712_MUTEX_MOD_DISP_WDMA1,
+};
+
 static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_AAL0] = MT8173_MUTEX_MOD_DISP_AAL,
[DDP_COMPONENT_COLOR0] = MT8173_MUTEX_MOD_DISP_COLOR0,
@@ -533,6 +571,7 @@ static int mtk_ddp_remove(struct platform_device *pdev)
 
 static const struct of_device_id ddp_driver_dt_match[] = {
{ .compatible = "mediatek,mt2701-disp-mutex", .data = mt2701_mutex_mod},
+   { .compatible = "mediatek,mt2712-disp-mutex", .data = mt2712_mutex_mod},
{ .compatible = "mediatek,mt8173-disp-mutex", .data = mt8173_mutex_mod},
{},
 };
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 3d279a299383..3a866e1d6af4 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -146,6 +146,32 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = {
DDP_COMPONENT_DPI0,
 };
 
+static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = {
+   DDP_COMPONENT_OVL0,
+   DDP_COMPONENT_COLOR0,
+   DDP_COMPONENT_AAL0,
+   DDP_COMPONENT_OD0,
+   DDP_COMPONENT_RDMA0,
+   DDP_COMPONENT_DPI0,
+   DDP_COMPONENT_PWM0,
+};
+
+static const enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = {
+   DDP_COMPONENT_OVL1,
+   DDP_COMPONENT_COLOR1,
+   DDP_COMPONENT_AAL1,
+   DDP_COMPONENT_OD1,
+   DDP_COMPONENT_RDMA1,
+   DDP_COMPONENT_DPI1,
+   DDP_COMPONENT_PWM1,
+};
+
+static const enum mtk_ddp_comp_id mt2712_mtk_ddp_third[] = {
+   DDP_COMPONENT_RDMA2,
+   DDP_COMPONENT_DSI3,
+   DDP_COMPONENT_PWM2,
+};
+
 static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
DDP_COMPONENT_OVL0,
DDP_COMPONENT_COLOR0,
@@ -173,6 +199,15 @@ static const struct mtk_mmsys_driver_data 
mt2701_mmsys_driver_data = {
.shadow_register = true,
 };
 
+static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = {
+   .main_path = mt2712_mtk_ddp_main,
+   .main_len = ARRAY_SIZE(mt2712_mtk_ddp_main),
+   

[PATCH 25/28] drm/mediatek: add DSI3 support for mutex

2018-06-10 Thread Stu Hsieh
This patch add the DSI3 support for mutex

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 1e7e3872eccc..28dd8531a7de 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -78,6 +78,7 @@
 #define MUTEX_SOF_DPI0 3
 #define MUTEX_SOF_DPI1 4
 #define MUTEX_SOF_DSI2 5
+#define MUTEX_SOF_DSI3 6
 
 #define OVL0_MOUT_EN_COLOR00x1
 #define OD_MOUT_EN_RDMA0   0x1
@@ -387,6 +388,9 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
case DDP_COMPONENT_DSI2:
reg = MUTEX_SOF_DSI2;
break;
+   case DDP_COMPONENT_DSI3:
+   reg = MUTEX_SOF_DSI3;
+   break;
case DDP_COMPONENT_DPI0:
reg = MUTEX_SOF_DPI0;
break;
@@ -425,6 +429,7 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex 
*mutex,
case DDP_COMPONENT_DSI0:
case DDP_COMPONENT_DSI1:
case DDP_COMPONENT_DSI2:
+   case DDP_COMPONENT_DSI3:
case DDP_COMPONENT_DPI0:
case DDP_COMPONENT_DPI1:
writel_relaxed(MUTEX_SOF_SINGLE_MODE,
-- 
2.12.5

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


[PATCH 18/28] drm/mediatek: add connection from RDMA2 to DPI0

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA2 to DPI0

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index a5cee4b7f908..31a0832ef9ec 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -31,6 +31,7 @@
 #define DISP_REG_CONFIG_DSIE_SEL_IN0x0a4
 #define DISP_REG_CONFIG_DSIO_SEL_IN0x0a8
 #define DISP_REG_CONFIG_DPI_SEL_IN 0x0ac
+#define DISP_REG_CONFIG_DISP_RDMA2_SOUT0x0b8
 #define DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN 0x0c4
 #define DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN 0x0c8
 #define DISP_REG_CONFIG_MMSYS_CG_CON0  0x100
@@ -91,7 +92,9 @@
 #define RDMA1_MOUT_DSI30x5
 #define RDMA1_MOUT_DPI00x2
 #define RDMA1_MOUT_DPI10x3
+#define RDMA2_MOUT_DPI00x2
 #define DPI0_SEL_IN_RDMA1  0x1
+#define DPI0_SEL_IN_RDMA2  0x3
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
 #define DSI1_SEL_IN_RDMA1  0x1
 #define DSI2_SEL_IN_RDMA1  (0x1 << 16)
@@ -193,6 +196,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI1) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI1;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI0) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
+   value = RDMA2_MOUT_DPI0;
} else {
value = 0;
}
@@ -224,6 +230,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI3) {
*addr = DISP_REG_CONFIG_DSIO_SEL_IN;
value = DSI3_SEL_IN_RDMA1;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI0) {
+   *addr = DISP_REG_CONFIG_DPI_SEL_IN;
+   value = DPI0_SEL_IN_RDMA2;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 19/28] drm/mediatek: add connection from RDMA2 to DPI1

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA2 to DPI1

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 31a0832ef9ec..2d883815d79c 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -93,9 +93,11 @@
 #define RDMA1_MOUT_DPI00x2
 #define RDMA1_MOUT_DPI10x3
 #define RDMA2_MOUT_DPI00x2
+#define RDMA2_MOUT_DPI10x3
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI0_SEL_IN_RDMA2  0x3
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
+#define DPI1_SEL_IN_RDMA2  (0x3 << 8)
 #define DSI1_SEL_IN_RDMA1  0x1
 #define DSI2_SEL_IN_RDMA1  (0x1 << 16)
 #define DSI3_SEL_IN_RDMA1  (0x1 << 16)
@@ -199,6 +201,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
value = RDMA2_MOUT_DPI0;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI1) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
+   value = RDMA2_MOUT_DPI1;
} else {
value = 0;
}
@@ -233,6 +238,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DPI_SEL_IN;
value = DPI0_SEL_IN_RDMA2;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI1) {
+   *addr = DISP_REG_CONFIG_DPI_SEL_IN;
+   value = DPI1_SEL_IN_RDMA2;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 21/28] drm/mediatek: add connection from RDMA2 to DSI2

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA2 to DSI2

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index ae10f8f1e140..ce89a1d86b93 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -95,6 +95,7 @@
 #define RDMA2_MOUT_DPI00x2
 #define RDMA2_MOUT_DPI10x3
 #define RDMA2_MOUT_DSI10x1
+#define RDMA2_MOUT_DSI20x4
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI0_SEL_IN_RDMA2  0x3
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
@@ -102,6 +103,7 @@
 #define DSI1_SEL_IN_RDMA1  0x1
 #define DSI1_SEL_IN_RDMA2  0x4
 #define DSI2_SEL_IN_RDMA1  (0x1 << 16)
+#define DSI2_SEL_IN_RDMA2  (0x4 << 16)
 #define DSI3_SEL_IN_RDMA1  (0x1 << 16)
 #define COLOR1_SEL_IN_OVL1 0x1
 
@@ -209,6 +211,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DPI1) {
*addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
value = RDMA2_MOUT_DPI1;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI2) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA2_SOUT;
+   value = RDMA2_MOUT_DSI2;
} else {
value = 0;
}
@@ -249,6 +254,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI1) {
*addr = DISP_REG_CONFIG_DSIE_SEL_IN;
value = DSI1_SEL_IN_RDMA2;
+   } else if (cur == DDP_COMPONENT_RDMA2 && next == DDP_COMPONENT_DSI2) {
+   *addr = DISP_REG_CONFIG_DSIE_SEL_IN;
+   value = DSI2_SEL_IN_RDMA2;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 13/28] drm/mediatek: add connection from RDMA0 to DSI3

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA0 to DSI3

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 4 
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index c08aed8dae44..fed1b5704355 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -83,6 +83,7 @@
 #define GAMMA_MOUT_EN_RDMA10x1
 #define RDMA0_MOUT_DPI00x2
 #define RDMA0_MOUT_DSI20x4
+#define RDMA0_MOUT_DSI30x5
 #define RDMA1_MOUT_DPI00x2
 #define DPI0_SEL_IN_RDMA1  0x1
 #define COLOR1_SEL_IN_OVL1 0x1
@@ -164,6 +165,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA0 && next == DDP_COMPONENT_DSI2) {
*addr = DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN;
value = RDMA0_MOUT_DSI2;
+   } else if (cur == DDP_COMPONENT_RDMA0 && next == DDP_COMPONENT_DSI3) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN;
+   value = RDMA0_MOUT_DSI3;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index fe6fdc021fc7..22f4c72fa785 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -228,7 +228,7 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_DSI0]= { MTK_DSI,0, NULL },
[DDP_COMPONENT_DSI1]= { MTK_DSI,1, NULL },
[DDP_COMPONENT_DSI2]= { MTK_DSI,2, NULL },
-   [DDP_COMPONENT_DSI2]= { MTK_DSI,3, NULL },
+   [DDP_COMPONENT_DSI3]= { MTK_DSI,3, NULL },
[DDP_COMPONENT_GAMMA]   = { MTK_DISP_GAMMA, 0, &ddp_gamma },
[DDP_COMPONENT_OD0] = { MTK_DISP_OD,0, &ddp_od },
[DDP_COMPONENT_OD1] = { MTK_DISP_OD,1, &ddp_od },
-- 
2.12.5

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


[PATCH 24/28] drm/mediatek: add DSI2 support for mutex

2018-06-10 Thread Stu Hsieh
This patch add the DSI2 support for mutex

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 5916fc11693a..1e7e3872eccc 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -77,6 +77,7 @@
 #define MUTEX_SOF_DSI1 2
 #define MUTEX_SOF_DPI0 3
 #define MUTEX_SOF_DPI1 4
+#define MUTEX_SOF_DSI2 5
 
 #define OVL0_MOUT_EN_COLOR00x1
 #define OD_MOUT_EN_RDMA0   0x1
@@ -383,6 +384,9 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
case DDP_COMPONENT_DSI1:
reg = MUTEX_SOF_DSI0;
break;
+   case DDP_COMPONENT_DSI2:
+   reg = MUTEX_SOF_DSI2;
+   break;
case DDP_COMPONENT_DPI0:
reg = MUTEX_SOF_DPI0;
break;
@@ -420,6 +424,7 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex 
*mutex,
switch (id) {
case DDP_COMPONENT_DSI0:
case DDP_COMPONENT_DSI1:
+   case DDP_COMPONENT_DSI2:
case DDP_COMPONENT_DPI0:
case DDP_COMPONENT_DPI1:
writel_relaxed(MUTEX_SOF_SINGLE_MODE,
-- 
2.12.5

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


[PATCH 09/28] drm/mediatek: add component DSI3

2018-06-10 Thread Stu Hsieh
This patch add the component DSI3

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 192f7374d988..fe6fdc021fc7 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -228,6 +228,7 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_DSI0]= { MTK_DSI,0, NULL },
[DDP_COMPONENT_DSI1]= { MTK_DSI,1, NULL },
[DDP_COMPONENT_DSI2]= { MTK_DSI,2, NULL },
+   [DDP_COMPONENT_DSI2]= { MTK_DSI,3, NULL },
[DDP_COMPONENT_GAMMA]   = { MTK_DISP_GAMMA, 0, &ddp_gamma },
[DDP_COMPONENT_OD0] = { MTK_DISP_OD,0, &ddp_od },
[DDP_COMPONENT_OD1] = { MTK_DISP_OD,1, &ddp_od },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index 8d152b337f15..7413ffeb3c9d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -51,6 +51,7 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_DSI0,
DDP_COMPONENT_DSI1,
DDP_COMPONENT_DSI2,
+   DDP_COMPONENT_DSI3,
DDP_COMPONENT_GAMMA,
DDP_COMPONENT_OD0,
DDP_COMPONENT_OD1,
-- 
2.12.5

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


[PATCH 06/28] drm/mediatek: add ddp component PWM2

2018-06-10 Thread Stu Hsieh
This patch add component PWM2

Signed-off-by: Stu Hsieh 
Reviewed-by: CK Hu 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index a5c7ac2d162d..86e8c9e5df41 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -233,6 +233,7 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_OVL1]= { MTK_DISP_OVL,   1, NULL },
[DDP_COMPONENT_PWM0]= { MTK_DISP_PWM,   0, NULL },
[DDP_COMPONENT_PWM1]= { MTK_DISP_PWM,   1, NULL },
+   [DDP_COMPONENT_PWM2]= { MTK_DISP_PWM,   2, NULL },
[DDP_COMPONENT_RDMA0]   = { MTK_DISP_RDMA,  0, NULL },
[DDP_COMPONENT_RDMA1]   = { MTK_DISP_RDMA,  1, NULL },
[DDP_COMPONENT_RDMA2]   = { MTK_DISP_RDMA,  2, NULL },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index 9b19fc4423f1..e00c2e798abd 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -56,6 +56,7 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_OVL1,
DDP_COMPONENT_PWM0,
DDP_COMPONENT_PWM1,
+   DDP_COMPONENT_PWM2,
DDP_COMPONENT_RDMA0,
DDP_COMPONENT_RDMA1,
DDP_COMPONENT_RDMA2,
-- 
2.12.5

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


[PATCH 10/28] drm/mediatek: add connection from OD1 to RDMA1

2018-06-10 Thread Stu Hsieh
This patch add the connection from OD1 to RDMA1 for ext path.

Signed-off-by: Stu Hsieh 
Reviewed-by: CK Hu 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 58e44349e315..8bfc0debd2c2 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -75,6 +75,7 @@
 
 #define OVL0_MOUT_EN_COLOR00x1
 #define OD_MOUT_EN_RDMA0   0x1
+#define OD1_MOUT_EN_RDMA1  BIT(16)
 #define UFOE_MOUT_EN_DSI0  0x1
 #define COLOR0_SEL_IN_OVL0 0x1
 #define OVL1_MOUT_EN_COLOR10x1
@@ -151,6 +152,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_GAMMA && next == DDP_COMPONENT_RDMA1) {
*addr = DISP_REG_CONFIG_DISP_GAMMA_MOUT_EN;
value = GAMMA_MOUT_EN_RDMA1;
+   } else if (cur == DDP_COMPONENT_OD1 && next == DDP_COMPONENT_RDMA1) {
+   *addr = DISP_REG_CONFIG_DISP_OD_MOUT_EN;
+   value = OD1_MOUT_EN_RDMA1;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
-- 
2.12.5

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


[PATCH 11/28] drm/mediatek: add connection from RDMA0 to DPI0

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA0 to DPI0

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 8bfc0debd2c2..d7953f2f6a36 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -29,6 +29,7 @@
 #define DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0x084
 #define DISP_REG_CONFIG_DISP_COLOR1_SEL_IN 0x088
 #define DISP_REG_CONFIG_DPI_SEL_IN 0x0ac
+#define DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN 0x0c4
 #define DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN 0x0c8
 #define DISP_REG_CONFIG_MMSYS_CG_CON0  0x100
 
@@ -80,6 +81,7 @@
 #define COLOR0_SEL_IN_OVL0 0x1
 #define OVL1_MOUT_EN_COLOR10x1
 #define GAMMA_MOUT_EN_RDMA10x1
+#define RDMA0_MOUT_DPI00x2
 #define RDMA1_MOUT_DPI00x2
 #define DPI0_SEL_IN_RDMA1  0x1
 #define COLOR1_SEL_IN_OVL1 0x1
@@ -155,6 +157,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_OD1 && next == DDP_COMPONENT_RDMA1) {
*addr = DISP_REG_CONFIG_DISP_OD_MOUT_EN;
value = OD1_MOUT_EN_RDMA1;
+   } else if (cur == DDP_COMPONENT_RDMA0 && next == DDP_COMPONENT_DPI0) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN;
+   value = RDMA0_MOUT_DPI0;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
-- 
2.12.5

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


[PATCH 14/28] drm/mediatek: add connection from RDMA1 to DPI1

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA1 to DPI1

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index fed1b5704355..4abd5dabeccf 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -85,7 +85,9 @@
 #define RDMA0_MOUT_DSI20x4
 #define RDMA0_MOUT_DSI30x5
 #define RDMA1_MOUT_DPI00x2
+#define RDMA1_MOUT_DPI10x3
 #define DPI0_SEL_IN_RDMA1  0x1
+#define DPI1_SEL_IN_RDMA1  (0x1 << 8)
 #define COLOR1_SEL_IN_OVL1 0x1
 
 #define OVL_MOUT_EN_RDMA   0x1
@@ -171,6 +173,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI1) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
+   value = RDMA1_MOUT_DPI1;
} else {
value = 0;
}
@@ -190,6 +195,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DPI_SEL_IN;
value = DPI0_SEL_IN_RDMA1;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI1) {
+   *addr = DISP_REG_CONFIG_DPI_SEL_IN;
+   value = DPI1_SEL_IN_RDMA1;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 16/28] drm/mediatek: add connection from RDMA1 to DSI2

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA1 to DSI2

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 7e4ad5580cf6..c3e647b04ffd 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -28,6 +28,7 @@
 #define DISP_REG_CONFIG_DISP_UFOE_MOUT_EN  0x050
 #define DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0x084
 #define DISP_REG_CONFIG_DISP_COLOR1_SEL_IN 0x088
+#define DISP_REG_CONFIG_DSIE_SEL_IN0x0a4
 #define DISP_REG_CONFIG_DSIO_SEL_IN0x0a8
 #define DISP_REG_CONFIG_DPI_SEL_IN 0x0ac
 #define DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN 0x0c4
@@ -86,11 +87,13 @@
 #define RDMA0_MOUT_DSI20x4
 #define RDMA0_MOUT_DSI30x5
 #define RDMA1_MOUT_DSI10x1
+#define RDMA1_MOUT_DSI20x4
 #define RDMA1_MOUT_DPI00x2
 #define RDMA1_MOUT_DPI10x3
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
 #define DSI1_SEL_IN_RDMA1  0x1
+#define DSI2_SEL_IN_RDMA1  (0x1 << 16)
 #define COLOR1_SEL_IN_OVL1 0x1
 
 #define OVL_MOUT_EN_RDMA   0x1
@@ -176,6 +179,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI1) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DSI1;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI2) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
+   value = RDMA1_MOUT_DSI2;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
@@ -207,6 +213,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI1) {
*addr = DISP_REG_CONFIG_DSIO_SEL_IN;
value = DSI1_SEL_IN_RDMA1;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI2) {
+   *addr = DISP_REG_CONFIG_DSIE_SEL_IN;
+   value = DSI2_SEL_IN_RDMA1;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 08/28] drm/mediatek: add component DSI2

2018-06-10 Thread Stu Hsieh
This patch add the component DSI2

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 4f9d81025d69..192f7374d988 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -227,6 +227,7 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_DPI1]= { MTK_DPI,1, NULL },
[DDP_COMPONENT_DSI0]= { MTK_DSI,0, NULL },
[DDP_COMPONENT_DSI1]= { MTK_DSI,1, NULL },
+   [DDP_COMPONENT_DSI2]= { MTK_DSI,2, NULL },
[DDP_COMPONENT_GAMMA]   = { MTK_DISP_GAMMA, 0, &ddp_gamma },
[DDP_COMPONENT_OD0] = { MTK_DISP_OD,0, &ddp_od },
[DDP_COMPONENT_OD1] = { MTK_DISP_OD,1, &ddp_od },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index 54c99c169093..8d152b337f15 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -50,6 +50,7 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_DPI1,
DDP_COMPONENT_DSI0,
DDP_COMPONENT_DSI1,
+   DDP_COMPONENT_DSI2,
DDP_COMPONENT_GAMMA,
DDP_COMPONENT_OD0,
DDP_COMPONENT_OD1,
-- 
2.12.5

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


[PATCH 15/28] drm/mediatek: add connection from RDMA1 to DSI1

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA1 to DSI1

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 4abd5dabeccf..7e4ad5580cf6 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -28,6 +28,7 @@
 #define DISP_REG_CONFIG_DISP_UFOE_MOUT_EN  0x050
 #define DISP_REG_CONFIG_DISP_COLOR0_SEL_IN 0x084
 #define DISP_REG_CONFIG_DISP_COLOR1_SEL_IN 0x088
+#define DISP_REG_CONFIG_DSIO_SEL_IN0x0a8
 #define DISP_REG_CONFIG_DPI_SEL_IN 0x0ac
 #define DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN 0x0c4
 #define DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN 0x0c8
@@ -84,10 +85,12 @@
 #define RDMA0_MOUT_DPI00x2
 #define RDMA0_MOUT_DSI20x4
 #define RDMA0_MOUT_DSI30x5
+#define RDMA1_MOUT_DSI10x1
 #define RDMA1_MOUT_DPI00x2
 #define RDMA1_MOUT_DPI10x3
 #define DPI0_SEL_IN_RDMA1  0x1
 #define DPI1_SEL_IN_RDMA1  (0x1 << 8)
+#define DSI1_SEL_IN_RDMA1  0x1
 #define COLOR1_SEL_IN_OVL1 0x1
 
 #define OVL_MOUT_EN_RDMA   0x1
@@ -170,6 +173,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA0 && next == DDP_COMPONENT_DSI3) {
*addr = DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN;
value = RDMA0_MOUT_DSI3;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI1) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
+   value = RDMA1_MOUT_DSI1;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
@@ -198,6 +204,9 @@ static unsigned int mtk_ddp_sel_in(enum mtk_ddp_comp_id cur,
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI1) {
*addr = DISP_REG_CONFIG_DPI_SEL_IN;
value = DPI1_SEL_IN_RDMA1;
+   } else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DSI1) {
+   *addr = DISP_REG_CONFIG_DSIO_SEL_IN;
+   value = DSI1_SEL_IN_RDMA1;
} else if (cur == DDP_COMPONENT_OVL1 && next == DDP_COMPONENT_COLOR1) {
*addr = DISP_REG_CONFIG_DISP_COLOR1_SEL_IN;
value = COLOR1_SEL_IN_OVL1;
-- 
2.12.5

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


[PATCH 07/28] drm/mediatek: add component DPI1

2018-06-10 Thread Stu Hsieh
This patch add the component DPI1

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 86e8c9e5df41..4f9d81025d69 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -224,6 +224,7 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_COLOR0]  = { MTK_DISP_COLOR, 0, NULL },
[DDP_COMPONENT_COLOR1]  = { MTK_DISP_COLOR, 1, NULL },
[DDP_COMPONENT_DPI0]= { MTK_DPI,0, NULL },
+   [DDP_COMPONENT_DPI1]= { MTK_DPI,1, NULL },
[DDP_COMPONENT_DSI0]= { MTK_DSI,0, NULL },
[DDP_COMPONENT_DSI1]= { MTK_DSI,1, NULL },
[DDP_COMPONENT_GAMMA]   = { MTK_DISP_GAMMA, 0, &ddp_gamma },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index e00c2e798abd..54c99c169093 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -47,6 +47,7 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_COLOR0,
DDP_COMPONENT_COLOR1,
DDP_COMPONENT_DPI0,
+   DDP_COMPONENT_DPI1,
DDP_COMPONENT_DSI0,
DDP_COMPONENT_DSI1,
DDP_COMPONENT_GAMMA,
-- 
2.12.5

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


[PATCH 12/28] drm/mediatek: add connection from RDMA0 to DSI2

2018-06-10 Thread Stu Hsieh
This patch add the connection from RDMA0 to DSI2

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index d7953f2f6a36..c08aed8dae44 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -82,6 +82,7 @@
 #define OVL1_MOUT_EN_COLOR10x1
 #define GAMMA_MOUT_EN_RDMA10x1
 #define RDMA0_MOUT_DPI00x2
+#define RDMA0_MOUT_DSI20x4
 #define RDMA1_MOUT_DPI00x2
 #define DPI0_SEL_IN_RDMA1  0x1
 #define COLOR1_SEL_IN_OVL1 0x1
@@ -160,6 +161,9 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_RDMA0 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN;
value = RDMA0_MOUT_DPI0;
+   } else if (cur == DDP_COMPONENT_RDMA0 && next == DDP_COMPONENT_DSI2) {
+   *addr = DISP_REG_CONFIG_DISP_RDMA0_MOUT_EN;
+   value = RDMA0_MOUT_DSI2;
} else if (cur == DDP_COMPONENT_RDMA1 && next == DDP_COMPONENT_DPI0) {
*addr = DISP_REG_CONFIG_DISP_RDMA1_MOUT_EN;
value = RDMA1_MOUT_DPI0;
-- 
2.12.5

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


[PATCH 03/28] drm/mediatek: add ddp component AAL1

2018-06-10 Thread Stu Hsieh
This patch add component AAL1 and
rename AAL to AAL0

Signed-off-by: Stu Hsieh 
Reviewed-by: CK Hu 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 2 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 3 ++-
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 3 ++-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 2 +-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 47ffa240bd25..7217665f4b5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -110,7 +110,7 @@ static const unsigned int 
mt2701_mutex_mod[DDP_COMPONENT_ID_MAX] = {
 };
 
 static const unsigned int mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = {
-   [DDP_COMPONENT_AAL] = MT8173_MUTEX_MOD_DISP_AAL,
+   [DDP_COMPONENT_AAL0] = MT8173_MUTEX_MOD_DISP_AAL,
[DDP_COMPONENT_COLOR0] = MT8173_MUTEX_MOD_DISP_COLOR0,
[DDP_COMPONENT_COLOR1] = MT8173_MUTEX_MOD_DISP_COLOR1,
[DDP_COMPONENT_GAMMA] = MT8173_MUTEX_MOD_DISP_GAMMA,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 4672317e3ad1..0919039805aa 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -218,7 +218,8 @@ struct mtk_ddp_comp_match {
 };
 
 static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = 
{
-   [DDP_COMPONENT_AAL] = { MTK_DISP_AAL,   0, &ddp_aal },
+   [DDP_COMPONENT_AAL0]= { MTK_DISP_AAL,   0, &ddp_aal },
+   [DDP_COMPONENT_AAL1]= { MTK_DISP_AAL,   1, &ddp_aal },
[DDP_COMPONENT_BLS] = { MTK_DISP_BLS,   0, NULL },
[DDP_COMPONENT_COLOR0]  = { MTK_DISP_COLOR, 0, NULL },
[DDP_COMPONENT_COLOR1]  = { MTK_DISP_COLOR, 1, NULL },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index 0828cf8bf85c..eee3c0cc2632 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -41,7 +41,8 @@ enum mtk_ddp_comp_type {
 };
 
 enum mtk_ddp_comp_id {
-   DDP_COMPONENT_AAL,
+   DDP_COMPONENT_AAL0,
+   DDP_COMPONENT_AAL1,
DDP_COMPONENT_BLS,
DDP_COMPONENT_COLOR0,
DDP_COMPONENT_COLOR1,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a2ca90fc403c..a415260f3d5f 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -149,7 +149,7 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = {
 static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
DDP_COMPONENT_OVL0,
DDP_COMPONENT_COLOR0,
-   DDP_COMPONENT_AAL,
+   DDP_COMPONENT_AAL0,
DDP_COMPONENT_OD,
DDP_COMPONENT_RDMA0,
DDP_COMPONENT_UFOE,
-- 
2.12.5

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


[PATCH v5 00/28] Add support for mediatek SOC MT2712

2018-06-10 Thread Stu Hsieh
This patch add support for the Mediatek MT2712 DISP subsystem.
MT2712 is base on MT8173, there are some difference as following:
MT2712 support three disp output(two ovl and one rdma)

Change in v5:
- Keep the value of MAX_CONNECTOR, because it is useless
- Add the new patch for component DPI1
- Add the new patch for component DSI2
- Add the new patch for component DSI3
- Add some connection from RDMA0/RDMA1/RDMA2 to 
  DPI0/DPI1/DSI1/DSI2/DSI3
- Add the new patch about DPI1/DSI2/DSI3 support for mutex
- Add the new patch about DPI1/DSI1/DSI2/DSI3 in comp_init
- Change ddp path DSI2 to DSI3 in third path

Stu Hsieh (28):
  drm/mediatek: update dt-bindings for mt2712
  drm/mediatek: support maximum 64 mutex mod
  drm/mediatek: add ddp component AAL1
  drm/mediatek: add ddp component OD1
  drm/mediatek: add ddp component PWM1
  drm/mediatek: add ddp component PWM2
  drm/mediatek: add component DPI1
  drm/mediatek: add component DSI2
  drm/mediatek: add component DSI3
  drm/mediatek: add connection from OD1 to RDMA1
  drm/mediatek: add connection from RDMA0 to DPI0
  drm/mediatek: add connection from RDMA0 to DSI2
  drm/mediatek: add connection from RDMA0 to DSI3
  drm/mediatek: add connection from RDMA1 to DPI1
  drm/mediatek: add connection from RDMA1 to DSI1
  drm/mediatek: add connection from RDMA1 to DSI2
  drm/mediatek: add connection from RDMA1 to DSI3
  drm/mediatek: add connection from RDMA2 to DPI0
  drm/mediatek: add connection from RDMA2 to DPI1
  drm/mediatek: add connection from RDMA2 to DSI1
  drm/mediatek: add connection from RDMA2 to DSI2
  drm/mediatek: add connection from RDMA2 to DSI3
  drm/mediatek: add DPI1 support for mutex
  drm/mediatek: add DSI2 support for mutex
  drm/mediatek: add DSI3 support for mutex
  drm/mediatek: add DPI1/DSI1/DSI2/DSI3 in comp_init
  drm/mediatek: add third ddp path
  drm/mediatek: Add support for mediatek SOC MT2712

 .../bindings/display/mediatek/mediatek,disp.txt|   2 +-
 drivers/gpu/drm/mediatek/mtk_drm_crtc.c|   3 +
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 227 ++---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c|  15 +-
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h|  10 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c |  47 -
 drivers/gpu/drm/mediatek/mtk_drm_drv.h |   5 +-
 7 files changed, 270 insertions(+), 39 deletions(-)

-- 
2.12.5

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


[PATCH 02/28] drm/mediatek: support maximum 64 mutex mod

2018-06-10 Thread Stu Hsieh
This patch support that if modules more than 32,
add index more than 31 when using DISP_REG_MUTEX_MOD2 bit

Signed-off-by: Stu Hsieh 
Reviewed-by: CK Hu 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c | 75 +-
 1 file changed, 47 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 8130f3dab661..47ffa240bd25 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -41,31 +41,32 @@
 #define DISP_REG_MUTEX_RST(n)  (0x28 + 0x20 * (n))
 #define DISP_REG_MUTEX_MOD(n)  (0x2c + 0x20 * (n))
 #define DISP_REG_MUTEX_SOF(n)  (0x30 + 0x20 * (n))
+#define DISP_REG_MUTEX_MOD2(n) (0x34 + 0x20 * (n))
 
 #define INT_MUTEX  BIT(1)
 
-#define MT8173_MUTEX_MOD_DISP_OVL0 BIT(11)
-#define MT8173_MUTEX_MOD_DISP_OVL1 BIT(12)
-#define MT8173_MUTEX_MOD_DISP_RDMA0BIT(13)
-#define MT8173_MUTEX_MOD_DISP_RDMA1BIT(14)
-#define MT8173_MUTEX_MOD_DISP_RDMA2BIT(15)
-#define MT8173_MUTEX_MOD_DISP_WDMA0BIT(16)
-#define MT8173_MUTEX_MOD_DISP_WDMA1BIT(17)
-#define MT8173_MUTEX_MOD_DISP_COLOR0   BIT(18)
-#define MT8173_MUTEX_MOD_DISP_COLOR1   BIT(19)
-#define MT8173_MUTEX_MOD_DISP_AAL  BIT(20)
-#define MT8173_MUTEX_MOD_DISP_GAMMABIT(21)
-#define MT8173_MUTEX_MOD_DISP_UFOE BIT(22)
-#define MT8173_MUTEX_MOD_DISP_PWM0 BIT(23)
-#define MT8173_MUTEX_MOD_DISP_PWM1 BIT(24)
-#define MT8173_MUTEX_MOD_DISP_OD   BIT(25)
-
-#define MT2701_MUTEX_MOD_DISP_OVL  BIT(3)
-#define MT2701_MUTEX_MOD_DISP_WDMA BIT(6)
-#define MT2701_MUTEX_MOD_DISP_COLORBIT(7)
-#define MT2701_MUTEX_MOD_DISP_BLS  BIT(9)
-#define MT2701_MUTEX_MOD_DISP_RDMA0BIT(10)
-#define MT2701_MUTEX_MOD_DISP_RDMA1BIT(12)
+#define MT8173_MUTEX_MOD_DISP_OVL0 11
+#define MT8173_MUTEX_MOD_DISP_OVL1 12
+#define MT8173_MUTEX_MOD_DISP_RDMA013
+#define MT8173_MUTEX_MOD_DISP_RDMA114
+#define MT8173_MUTEX_MOD_DISP_RDMA215
+#define MT8173_MUTEX_MOD_DISP_WDMA016
+#define MT8173_MUTEX_MOD_DISP_WDMA117
+#define MT8173_MUTEX_MOD_DISP_COLOR0   18
+#define MT8173_MUTEX_MOD_DISP_COLOR1   19
+#define MT8173_MUTEX_MOD_DISP_AAL  20
+#define MT8173_MUTEX_MOD_DISP_GAMMA21
+#define MT8173_MUTEX_MOD_DISP_UFOE 22
+#define MT8173_MUTEX_MOD_DISP_PWM0 23
+#define MT8173_MUTEX_MOD_DISP_PWM1 24
+#define MT8173_MUTEX_MOD_DISP_OD   25
+
+#define MT2701_MUTEX_MOD_DISP_OVL  3
+#define MT2701_MUTEX_MOD_DISP_WDMA 6
+#define MT2701_MUTEX_MOD_DISP_COLOR7
+#define MT2701_MUTEX_MOD_DISP_BLS  9
+#define MT2701_MUTEX_MOD_DISP_RDMA010
+#define MT2701_MUTEX_MOD_DISP_RDMA112
 
 #define MUTEX_SOF_SINGLE_MODE  0
 #define MUTEX_SOF_DSI0 1
@@ -278,6 +279,7 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp,
   mutex[mutex->id]);
unsigned int reg;
+   unsigned int offset;
 
WARN_ON(&ddp->mutex[mutex->id] != mutex);
 
@@ -292,9 +294,17 @@ void mtk_disp_mutex_add_comp(struct mtk_disp_mutex *mutex,
reg = MUTEX_SOF_DPI0;
break;
default:
-   reg = readl_relaxed(ddp->regs + DISP_REG_MUTEX_MOD(mutex->id));
-   reg |= ddp->mutex_mod[id];
-   writel_relaxed(reg, ddp->regs + DISP_REG_MUTEX_MOD(mutex->id));
+   if (ddp->mutex_mod[id] < 32) {
+   offset = DISP_REG_MUTEX_MOD(mutex->id);
+   reg = readl_relaxed(ddp->regs + offset);
+   reg |= 1 << ddp->mutex_mod[id];
+   writel_relaxed(reg, ddp->regs + offset);
+   } else {
+   offset = DISP_REG_MUTEX_MOD2(mutex->id);
+   reg = readl_relaxed(ddp->regs + offset);
+   reg |= 1 << (ddp->mutex_mod[id] - 32);
+   writel_relaxed(reg, ddp->regs + offset);
+   }
return;
}
 
@@ -307,6 +317,7 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex 
*mutex,
struct mtk_ddp *ddp = container_of(mutex, struct mtk_ddp,
   mutex[mutex->id]);
unsigned int reg;
+   unsigned int offset;
 
WARN_ON(&ddp->mutex[mutex->id] != mutex);
 
@@ -318,9 +329,17 @@ void mtk_disp_mutex_remove_comp(struct mtk_disp_mutex 
*mutex,
   ddp->regs + DISP_REG_MUTEX_SOF(mutex->id));
break;
default:
-   reg = readl_relaxed(ddp

[PATCH 04/28] drm/mediatek: add ddp component OD1

2018-06-10 Thread Stu Hsieh
This patch add the component OD1 and
rename the OD to OD0

Signed-off-by: Stu Hsieh 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp.c  | 4 ++--
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 3 ++-
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 3 ++-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c  | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
index 7217665f4b5d..58e44349e315 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp.c
@@ -114,7 +114,7 @@ static const unsigned int 
mt8173_mutex_mod[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_COLOR0] = MT8173_MUTEX_MOD_DISP_COLOR0,
[DDP_COMPONENT_COLOR1] = MT8173_MUTEX_MOD_DISP_COLOR1,
[DDP_COMPONENT_GAMMA] = MT8173_MUTEX_MOD_DISP_GAMMA,
-   [DDP_COMPONENT_OD] = MT8173_MUTEX_MOD_DISP_OD,
+   [DDP_COMPONENT_OD0] = MT8173_MUTEX_MOD_DISP_OD,
[DDP_COMPONENT_OVL0] = MT8173_MUTEX_MOD_DISP_OVL0,
[DDP_COMPONENT_OVL1] = MT8173_MUTEX_MOD_DISP_OVL1,
[DDP_COMPONENT_PWM0] = MT8173_MUTEX_MOD_DISP_PWM0,
@@ -139,7 +139,7 @@ static unsigned int mtk_ddp_mout_en(enum mtk_ddp_comp_id 
cur,
} else if (cur == DDP_COMPONENT_OVL0 && next == DDP_COMPONENT_RDMA0) {
*addr = DISP_REG_CONFIG_DISP_OVL_MOUT_EN;
value = OVL_MOUT_EN_RDMA;
-   } else if (cur == DDP_COMPONENT_OD && next == DDP_COMPONENT_RDMA0) {
+   } else if (cur == DDP_COMPONENT_OD0 && next == DDP_COMPONENT_RDMA0) {
*addr = DISP_REG_CONFIG_DISP_OD_MOUT_EN;
value = OD_MOUT_EN_RDMA0;
} else if (cur == DDP_COMPONENT_UFOE && next == DDP_COMPONENT_DSI0) {
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 0919039805aa..87acf6be87f6 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -227,7 +227,8 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_DSI0]= { MTK_DSI,0, NULL },
[DDP_COMPONENT_DSI1]= { MTK_DSI,1, NULL },
[DDP_COMPONENT_GAMMA]   = { MTK_DISP_GAMMA, 0, &ddp_gamma },
-   [DDP_COMPONENT_OD]  = { MTK_DISP_OD,0, &ddp_od },
+   [DDP_COMPONENT_OD0] = { MTK_DISP_OD,0, &ddp_od },
+   [DDP_COMPONENT_OD1] = { MTK_DISP_OD,1, &ddp_od },
[DDP_COMPONENT_OVL0]= { MTK_DISP_OVL,   0, NULL },
[DDP_COMPONENT_OVL1]= { MTK_DISP_OVL,   1, NULL },
[DDP_COMPONENT_PWM0]= { MTK_DISP_PWM,   0, NULL },
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index eee3c0cc2632..9b19fc4423f1 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -50,7 +50,8 @@ enum mtk_ddp_comp_id {
DDP_COMPONENT_DSI0,
DDP_COMPONENT_DSI1,
DDP_COMPONENT_GAMMA,
-   DDP_COMPONENT_OD,
+   DDP_COMPONENT_OD0,
+   DDP_COMPONENT_OD1,
DDP_COMPONENT_OVL0,
DDP_COMPONENT_OVL1,
DDP_COMPONENT_PWM0,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a415260f3d5f..08d5d0b47bfe 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -150,7 +150,7 @@ static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
DDP_COMPONENT_OVL0,
DDP_COMPONENT_COLOR0,
DDP_COMPONENT_AAL0,
-   DDP_COMPONENT_OD,
+   DDP_COMPONENT_OD0,
DDP_COMPONENT_RDMA0,
DDP_COMPONENT_UFOE,
DDP_COMPONENT_DSI0,
-- 
2.12.5

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


[PATCH 05/28] drm/mediatek: add ddp component PWM1

2018-06-10 Thread Stu Hsieh
This patch add component PWM1 in mtk_ddp_matches

Signed-off-by: Stu Hsieh 
Reviewed-by: CK Hu 
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
index 87acf6be87f6..a5c7ac2d162d 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
@@ -232,6 +232,7 @@ static const struct mtk_ddp_comp_match 
mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
[DDP_COMPONENT_OVL0]= { MTK_DISP_OVL,   0, NULL },
[DDP_COMPONENT_OVL1]= { MTK_DISP_OVL,   1, NULL },
[DDP_COMPONENT_PWM0]= { MTK_DISP_PWM,   0, NULL },
+   [DDP_COMPONENT_PWM1]= { MTK_DISP_PWM,   1, NULL },
[DDP_COMPONENT_RDMA0]   = { MTK_DISP_RDMA,  0, NULL },
[DDP_COMPONENT_RDMA1]   = { MTK_DISP_RDMA,  1, NULL },
[DDP_COMPONENT_RDMA2]   = { MTK_DISP_RDMA,  2, NULL },
-- 
2.12.5

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


[PATCH 01/28] drm/mediatek: update dt-bindings for mt2712

2018-06-10 Thread Stu Hsieh
Update device tree binding documentation for the display subsystem for
Mediatek MT2712 SoCs.

Signed-off-by: Stu Hsieh 
Acked-by: CK Hu 
Acked-by: Rob Herring 
---
 Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt 
b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
index 383183a89164..8469de510001 100644
--- a/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
+++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,disp.txt
@@ -40,7 +40,7 @@ Required properties (all function blocks):
"mediatek,-dpi"- DPI controller, see mediatek,dpi.txt
"mediatek,-disp-mutex" - display mutex
"mediatek,-disp-od"- overdrive
-  the supported chips are mt2701 and mt8173.
+  the supported chips are mt2701, mt2712 and mt8173.
 - reg: Physical base address and length of the function block register space
 - interrupts: The interrupt signal from the function block (required, except 
for
   merge and split function blocks).
-- 
2.12.5

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


[Bug 106287] 18.0.1 introduced glitches in Dying Light

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106287

--- Comment #8 from stu...@gmail.com ---
I've done a bit more playing around and it is a race condition, but it's one
that happens on initialization.  If I let the loading screen/movie play for a
few minutes before actually attempting to play, the issues (water/black box for
sight) don't happen.  If I skip it as quickly as possible, they screw up.

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


Re: [PATCH v2 49/60] drm/omap: Create all planes before CRTCs

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:07PM +0300, Laurent Pinchart wrote:
> Creating all the planes in a single location instead of creating them
> per-CRTC with remaining planes then created in a second step simplifies
> the logic.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_drv.c | 45 
> --
>  1 file changed, 19 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 0d4c3e2db058..99ed47a17ce3 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -271,14 +271,30 @@ static int omap_modeset_init(struct drm_device *dev)
>   return -EINVAL;
>   }
>  
> - /* All planes can be put to any CRTC */
> + /* Create all planes first. They can all be put to any CRTC. */
>   plane_crtc_mask = (1 << num_crtcs) - 1;
>  
> + for (i = 0; i < num_ovls; i++) {
> + enum drm_plane_type type = i < priv->num_dssdevs
> +  ? DRM_PLANE_TYPE_PRIMARY
> +  : DRM_PLANE_TYPE_OVERLAY;
> + struct drm_plane *plane;
> +
> + if (WARN_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)))
> + return -EINVAL;
> +
> + plane = omap_plane_init(dev, i, type, plane_crtc_mask);
> + if (IS_ERR(plane))
> + return PTR_ERR(plane);
> +
> + priv->planes[priv->num_planes++] = plane;
> + }
> +
> + /* Create the CRTCs, encoders and connectors. */
>   for (i = 0; i < priv->num_dssdevs; i++) {
>   struct omap_dss_device *dssdev = priv->dssdevs[i];
>   struct drm_connector *connector;
>   struct drm_encoder *encoder;
> - struct drm_plane *plane;
>   struct drm_crtc *crtc;
>  
>   encoder = omap_encoder_init(dev, dssdev);
> @@ -290,12 +306,7 @@ static int omap_modeset_init(struct drm_device *dev)
>   if (!connector)
>   return -ENOMEM;
>  
> - plane = omap_plane_init(dev, i, DRM_PLANE_TYPE_PRIMARY,
> - plane_crtc_mask);
> - if (IS_ERR(plane))
> - return PTR_ERR(plane);
> -
> - crtc = omap_crtc_init(dev, plane, dssdev);
> + crtc = omap_crtc_init(dev, priv->planes[i], dssdev);
>   if (IS_ERR(crtc))
>   return PTR_ERR(crtc);
>  
> @@ -303,28 +314,10 @@ static int omap_modeset_init(struct drm_device *dev)
>   encoder->possible_crtcs = 1 << i;
>  
>   priv->crtcs[priv->num_crtcs++] = crtc;
> - priv->planes[priv->num_planes++] = plane;
>   priv->encoders[priv->num_encoders++] = encoder;
>   priv->connectors[priv->num_connectors++] = connector;
>   }
>  
> - /*
> -  * Create normal planes for the remaining overlays:
> -  */
> - for (; i < num_ovls; i++) {
> - struct drm_plane *plane;
> -
> - if (WARN_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)))
> - return -EINVAL;
> -
> - plane = omap_plane_init(dev, i, DRM_PLANE_TYPE_OVERLAY,
> - plane_crtc_mask);
> - if (IS_ERR(plane))
> - return PTR_ERR(plane);
> -
> - priv->planes[priv->num_planes++] = plane;
> - }
> -
>   DBG("registered %d planes, %d crtcs, %d encoders and %d connectors\n",
>   priv->num_planes, priv->num_crtcs, priv->num_encoders,
>   priv->num_connectors);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 48/60] drm/omap: Remove unneeded variable assignments in omap_modeset_init

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:06PM +0300, Laurent Pinchart wrote:
> The crtc_idx and plane_idw variables in the main loop are always equal
> to the loop counter i, use it instead. Don't unnecessarily initialize
> dssdev to NULL.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_drv.c | 18 +-
>  1 file changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 9b33859e9ac6..0d4c3e2db058 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -239,10 +239,9 @@ static int omap_modeset_init_properties(struct 
> drm_device *dev)
>  static int omap_modeset_init(struct drm_device *dev)
>  {
>   struct omap_drm_private *priv = dev->dev_private;
> - struct omap_dss_device *dssdev = NULL;
>   int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
>   int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
> - int num_crtcs, crtc_idx, plane_idx;
> + int num_crtcs;
>   unsigned int i;
>   int ret;
>   u32 plane_crtc_mask;
> @@ -275,10 +274,6 @@ static int omap_modeset_init(struct drm_device *dev)
>   /* All planes can be put to any CRTC */
>   plane_crtc_mask = (1 << num_crtcs) - 1;
>  
> - dssdev = NULL;
> -
> - crtc_idx = 0;
> - plane_idx = 0;
>   for (i = 0; i < priv->num_dssdevs; i++) {
>   struct omap_dss_device *dssdev = priv->dssdevs[i];
>   struct drm_connector *connector;
> @@ -295,7 +290,7 @@ static int omap_modeset_init(struct drm_device *dev)
>   if (!connector)
>   return -ENOMEM;
>  
> - plane = omap_plane_init(dev, plane_idx, DRM_PLANE_TYPE_PRIMARY,
> + plane = omap_plane_init(dev, i, DRM_PLANE_TYPE_PRIMARY,
>   plane_crtc_mask);
>   if (IS_ERR(plane))
>   return PTR_ERR(plane);
> @@ -305,27 +300,24 @@ static int omap_modeset_init(struct drm_device *dev)
>   return PTR_ERR(crtc);
>  
>   drm_mode_connector_attach_encoder(connector, encoder);
> - encoder->possible_crtcs = (1 << crtc_idx);
> + encoder->possible_crtcs = 1 << i;
>  
>   priv->crtcs[priv->num_crtcs++] = crtc;
>   priv->planes[priv->num_planes++] = plane;
>   priv->encoders[priv->num_encoders++] = encoder;
>   priv->connectors[priv->num_connectors++] = connector;
> -
> - plane_idx++;
> - crtc_idx++;
>   }
>  
>   /*
>* Create normal planes for the remaining overlays:
>*/
> - for (; plane_idx < num_ovls; plane_idx++) {
> + for (; i < num_ovls; i++) {
>   struct drm_plane *plane;
>  
>   if (WARN_ON(priv->num_planes >= ARRAY_SIZE(priv->planes)))
>   return -EINVAL;
>  
> - plane = omap_plane_init(dev, plane_idx, DRM_PLANE_TYPE_OVERLAY,
> + plane = omap_plane_init(dev, i, DRM_PLANE_TYPE_OVERLAY,
>   plane_crtc_mask);
>   if (IS_ERR(plane))
>   return PTR_ERR(plane);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 47/60] drm/omap: dss: Get regulators at probe time

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:05PM +0300, Laurent Pinchart wrote:
> Regulators for the DPI, DSI, HDMI, SDI and VENC outputs are all looked
> up when connecting the output omap_dss_device. There's no need to delay
> regulator handling to that time, get the regulators at probe time.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dpi.c   | 69 
> ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c   | 36 ---
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c | 33 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c | 31 +
>  drivers/gpu/drm/omapdrm/dss/sdi.c   | 32 +
>  drivers/gpu/drm/omapdrm/dss/venc.c  | 32 +
>  6 files changed, 72 insertions(+), 161 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 68c8424a460d..4557357e4130 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -551,38 +551,6 @@ static int dpi_verify_pll(struct dss_pll *pll)
>   return 0;
>  }
>  
> -static const struct soc_device_attribute dpi_soc_devices[] = {
> - { .machine = "OMAP3[456]*" },
> - { .machine = "[AD]M37*" },
> - { /* sentinel */ }
> -};
> -
> -static int dpi_init_regulator(struct dpi_data *dpi)
> -{
> - struct regulator *vdds_dsi;
> -
> - /*
> -  * The DPI uses the DSI VDDS on OMAP34xx, OMAP35xx, OMAP36xx, AM37xx and
> -  * DM37xx only.
> -  */
> - if (!soc_device_match(dpi_soc_devices))
> - return 0;
> -
> - if (dpi->vdds_dsi_reg)
> - return 0;
> -
> - vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
> - if (IS_ERR(vdds_dsi)) {
> - if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER)
> - DSSERR("can't get VDDS_DSI regulator\n");
> - return PTR_ERR(vdds_dsi);
> - }
> -
> - dpi->vdds_dsi_reg = vdds_dsi;
> -
> - return 0;
> -}
> -
>  static void dpi_init_pll(struct dpi_data *dpi)
>  {
>   struct dss_pll *pll;
> @@ -646,10 +614,6 @@ static int dpi_connect(struct omap_dss_device *dssdev,
>   struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
>   int r;
>  
> - r = dpi_init_regulator(dpi);
> - if (r)
> - return r;
> -
>   dpi_init_pll(dpi);
>  
>   r = dss_mgr_connect(dssdev);
> @@ -737,6 +701,35 @@ static void dpi_uninit_output_port(struct device_node 
> *port)
>   omapdss_device_unregister(out);
>  }
>  
> +static const struct soc_device_attribute dpi_soc_devices[] = {
> + { .machine = "OMAP3[456]*" },
> + { .machine = "[AD]M37*" },
> + { /* sentinel */ }
> +};
> +
> +static int dpi_init_regulator(struct dpi_data *dpi)
> +{
> + struct regulator *vdds_dsi;
> +
> + /*
> +  * The DPI uses the DSI VDDS on OMAP34xx, OMAP35xx, OMAP36xx, AM37xx and
> +  * DM37xx only.
> +  */
> + if (!soc_device_match(dpi_soc_devices))
> + return 0;
> +
> + vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi");
> + if (IS_ERR(vdds_dsi)) {
> + if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER)
> + DSSERR("can't get VDDS_DSI regulator\n");
> + return PTR_ERR(vdds_dsi);
> + }
> +
> + dpi->vdds_dsi_reg = vdds_dsi;
> +
> + return 0;
> +}
> +
>  int dpi_init_port(struct dss_device *dss, struct platform_device *pdev,
> struct device_node *port, enum dss_model dss_model)
>  {
> @@ -769,6 +762,10 @@ int dpi_init_port(struct dss_device *dss, struct 
> platform_device *pdev,
>  
>   mutex_init(&dpi->lock);
>  
> + r = dpi_init_regulator(dpi);
> + if (r)
> + return r;
> +
>   return dpi_init_output_port(dpi, port);
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 2c2570e1ef2f..6718c7f04423 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -1137,26 +1137,6 @@ static void dsi_runtime_put(struct dsi_data *dsi)
>   WARN_ON(r < 0 && r != -ENOSYS);
>  }
>  
> -static int dsi_regulator_init(struct dsi_data *dsi)
> -{
> - struct regulator *vdds_dsi;
> -
> - if (dsi->vdds_dsi_reg != NULL)
> - return 0;
> -
> - vdds_dsi = devm_regulator_get(dsi->dev, "vdd");
> -
> - if (IS_ERR(vdds_dsi)) {
> - if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER)
> - DSSERR("can't get DSI VDD regulator\n");
> - return PTR_ERR(vdds_dsi);
> - }
> -
> - dsi->vdds_dsi_reg = vdds_dsi;
> -
> - return 0;
> -}
> -
>  static void _dsi_print_reset_status(struct dsi_data *dsi)
>  {
>   u32 l;
> @@ -1353,10 +1333,6 @@ static int dsi_pll_enable(struct dss_pll *pll)
>  
>   DSSDBG("PLL init\n");
>  
> - r = dsi_regulator_init(dsi);
> - if (r)
> - return r;
> -
>   r = dsi_runtime_get(dsi);
>   if (r)
>   

Re: [PATCH v2 44/60] drm/omap: dss: Add for_each_dss_output() macro

2018-06-10 Thread Sebastian Reichel
On Sat, May 26, 2018 at 08:25:02PM +0300, Laurent Pinchart wrote:
> Similarly to for_each_dss_display(), the for_each_dss_output() macro
> iterates over all the DSS connected outputs.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c| 20 ++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 ++---
>  2 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 96be800a0f25..519682f18d36 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -127,11 +127,13 @@ struct omap_dss_device 
> *omapdss_find_device_by_port(struct device_node *src,
>  
>  /*
>   * Search for the next device starting at @from. If display_only is true, 
> skip
> - * non-display devices. Release the reference to the @from device, and 
> acquire
> - * a reference to the returned device if found.
> + * non-display devices. If output_only is true, skip non-output devices and
> + * non-connected output devices. Release the reference to the @from device, 
> and
> + * acquire a reference to the returned device if found.
>   */
>  struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
> - bool display_only)
> + bool display_only,
> + bool output_only)

display_only and output_only are mutually exclusive, so I think it
would be better to use this as parameter. It would also improve
code readability a bit:

enum omapdss_device_type {
OMAPDSS_DEVICE_TYPE_ALL,
OMAPDSS_DEVICE_TYPE_OUTPUT_ONLY,
OMAPDSS_DEVICE_TYPE_DISPLAY_ONLY,
};

>  {
>   struct omap_dss_device *dssdev;
>   struct list_head *list;
> @@ -159,9 +161,15 @@ struct omap_dss_device *omapdss_device_get_next(struct 
> omap_dss_device *from,
>   goto done;
>   }
>  
> - /* Filter out non-display entries if display_only is set. */
> - if (!display_only || dssdev->driver)
> - goto done;
> + /*
> +  * Filter out non-display entries if display_only is set, and
> +  * non-output entries if output_only is set.
> +  */
> + if (display_only && !dssdev->driver)
> + continue;
> + if (output_only && (!dssdev->id || !dssdev->next))
> + continue;
> + goto done;
>   }
>  
>   dssdev = NULL;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 5d3e4ced73d1..723124f6e596 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -488,9 +488,9 @@ static inline bool omapdss_is_initialized(void)
>   return !!omapdss_get_dss();
>  }
>  
> -void omapdss_display_init(struct omap_dss_device *dssdev);
>  #define for_each_dss_display(d) \
> - while ((d = omapdss_device_get_next(d, true)) != NULL)
> + while ((d = omapdss_device_get_next(d, true, false)) != NULL)
> +void omapdss_display_init(struct omap_dss_device *dssdev);
>  
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
> @@ -499,7 +499,8 @@ void omapdss_device_put(struct omap_dss_device *dssdev);
>  struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
>   unsigned int port);
>  struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
> - bool display_only);
> + bool display_only,
> + bool output_only);
>  int omapdss_device_connect(struct dss_device *dss,
>  struct omap_dss_device *src,
>  struct omap_dss_device *dst);
> @@ -511,6 +512,8 @@ int omap_dss_get_num_overlay_managers(void);
>  
>  int omap_dss_get_num_overlays(void);
>  
> +#define for_each_dss_output(d) \
> + while ((d = omapdss_device_get_next(d, false, true)) != NULL)
>  int omapdss_output_set_device(struct omap_dss_device *out,
>   struct omap_dss_device *dssdev);
>  int omapdss_output_unset_device(struct omap_dss_device *out);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 43/60] drm/omap: dss: Acquire next dssdev at probe time

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:01PM +0300, Laurent Pinchart wrote:
> Look up the next dssdev at probe time based on device tree links for all
> DSS outputs and encoders. This will be used to reverse the order of the
> dssdev connect and disconnect call chains.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c|  9 +
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c|  9 +
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c |  9 +
>  drivers/gpu/drm/omapdrm/dss/dpi.c| 17 +
>  drivers/gpu/drm/omapdrm/dss/dsi.c| 18 --
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c  | 18 --
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c  | 18 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h|  1 +
>  drivers/gpu/drm/omapdrm/dss/sdi.c| 17 +++--
>  drivers/gpu/drm/omapdrm/dss/venc.c   | 18 --
>  10 files changed, 120 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 904ebec5f5e1..a94d6d0cead9 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -169,6 +169,13 @@ static int opa362_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>   dssdev->of_ports = BIT(1) | BIT(0);
>  
> + dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
> + if (IS_ERR(dssdev->next)) {
> + if (PTR_ERR(dssdev->next) != -EPROBE_DEFER)
> + dev_err(&pdev->dev, "failed to find video sink\n");
> + return PTR_ERR(dssdev->next);
> + }
> +
>   omapdss_device_register(dssdev);
>  
>   return 0;
> @@ -179,6 +186,8 @@ static int __exit opa362_remove(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> + if (dssdev->next)
> + omapdss_device_put(dssdev->next);
>   omapdss_device_unregister(&ddata->dssdev);
>  
>   WARN_ON(omapdss_device_is_enabled(dssdev));
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index cd442f66fa1d..d40a0fd93e67 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -192,6 +192,13 @@ static int tfp410_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>   dssdev->of_ports = BIT(1) | BIT(0);
>  
> + dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
> + if (IS_ERR(dssdev->next)) {
> + if (PTR_ERR(dssdev->next) != -EPROBE_DEFER)
> + dev_err(&pdev->dev, "failed to find video sink\n");
> + return PTR_ERR(dssdev->next);
> + }
> +
>   omapdss_device_register(dssdev);
>  
>   return 0;
> @@ -202,6 +209,8 @@ static int __exit tfp410_remove(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> + if (dssdev->next)
> + omapdss_device_put(dssdev->next);
>   omapdss_device_unregister(&ddata->dssdev);
>  
>   WARN_ON(omapdss_device_is_enabled(dssdev));
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index d21d0829774e..e6adeebb91d1 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -301,6 +301,13 @@ static int tpd_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>   dssdev->of_ports = BIT(1) | BIT(0);
>  
> + dssdev->next = omapdss_of_find_connected_device(pdev->dev.of_node, 1);
> + if (IS_ERR(dssdev->next)) {
> + if (PTR_ERR(dssdev->next) != -EPROBE_DEFER)
> + dev_err(&pdev->dev, "failed to find video sink\n");
> + return PTR_ERR(dssdev->next);
> + }
> +
>   omapdss_device_register(dssdev);
>  
>   return 0;
> @@ -311,6 +318,8 @@ static int __exit tpd_remove(struct platform_device *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> + if (dssdev->next)
> + omapdss_device_put(dssdev->next);
>   omapdss_device_unregister(&ddata->dssdev);
>  
>   WARN_ON(omapdss_device_is_enabled(dssdev));
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index e97f54d5f3e1..650becdf2763 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gp

Re: [PATCH v2 46/60] drm/omap: dss: Remove duplicated parameter to dss_mgr_(dis)connect()

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:04PM +0300, Laurent Pinchart wrote:
> The dss_mgr_connect() and dss_mgr_disconnect() functions take two
> omap_dss_device pointers as parameters, which are always set to the same
> value by all callers. Remove the duplicated pointer.
> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/omapdrm/dss/dpi.c | 8 +++-
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 8 +++-
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 8 +++-
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 8 +++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 ++
>  drivers/gpu/drm/omapdrm/dss/output.c  | 9 -
>  drivers/gpu/drm/omapdrm/dss/sdi.c | 8 +++-
>  drivers/gpu/drm/omapdrm/dss/venc.c| 8 +++-
>  8 files changed, 24 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 650becdf2763..68c8424a460d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -652,7 +652,7 @@ static int dpi_connect(struct omap_dss_device *dssdev,
>  
>   dpi_init_pll(dpi);
>  
> - r = dss_mgr_connect(&dpi->output, dssdev);
> + r = dss_mgr_connect(dssdev);
>   if (r)
>   return r;
>  
> @@ -660,7 +660,7 @@ static int dpi_connect(struct omap_dss_device *dssdev,
>   if (r) {
>   DSSERR("failed to connect output to new device: %s\n",
>   dst->name);
> - dss_mgr_disconnect(&dpi->output, dssdev);
> + dss_mgr_disconnect(dssdev);
>   return r;
>   }
>  
> @@ -670,11 +670,9 @@ static int dpi_connect(struct omap_dss_device *dssdev,
>  static void dpi_disconnect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst)
>  {
> - struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
> -
>   omapdss_output_unset_device(dssdev);
>  
> - dss_mgr_disconnect(&dpi->output, dssdev);
> + dss_mgr_disconnect(dssdev);
>  }
>  
>  static const struct omap_dss_device_ops dpi_ops = {
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index b48ee792244b..2c2570e1ef2f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4915,7 +4915,7 @@ static int dsi_connect(struct omap_dss_device *dssdev,
>   if (r)
>   return r;
>  
> - r = dss_mgr_connect(&dsi->output, dssdev);
> + r = dss_mgr_connect(dssdev);
>   if (r)
>   return r;
>  
> @@ -4923,7 +4923,7 @@ static int dsi_connect(struct omap_dss_device *dssdev,
>   if (r) {
>   DSSERR("failed to connect output to new device: %s\n",
>   dssdev->name);
> - dss_mgr_disconnect(&dsi->output, dssdev);
> + dss_mgr_disconnect(dssdev);
>   return r;
>   }
>  
> @@ -4933,11 +4933,9 @@ static int dsi_connect(struct omap_dss_device *dssdev,
>  static void dsi_disconnect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst)
>  {
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>   omapdss_output_unset_device(dssdev);
>  
> - dss_mgr_disconnect(&dsi->output, dssdev);
> + dss_mgr_disconnect(dssdev);
>  }
>  
>  static const struct omap_dss_device_ops dsi_ops = {
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> index 118c015624b9..5216c5554741 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -458,7 +458,7 @@ static int hdmi_connect(struct omap_dss_device *dssdev,
>   if (r)
>   return r;
>  
> - r = dss_mgr_connect(&hdmi->output, dssdev);
> + r = dss_mgr_connect(dssdev);
>   if (r)
>   return r;
>  
> @@ -466,7 +466,7 @@ static int hdmi_connect(struct omap_dss_device *dssdev,
>   if (r) {
>   DSSERR("failed to connect output to new device: %s\n",
>   dst->name);
> - dss_mgr_disconnect(&hdmi->output, dssdev);
> + dss_mgr_disconnect(dssdev);
>   return r;
>   }
>  
> @@ -476,11 +476,9 @@ static int hdmi_connect(struct omap_dss_device *dssdev,
>  static void hdmi_disconnect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst)
>  {
> - struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev);
> -
>   omapdss_output_unset_device(dssdev);
>  
> - dss_mgr_disconnect(&hdmi->output, dssdev);
> + dss_mgr_disconnect(dssdev);
>  }
>  
>  static int hdmi_read_edid(struct omap_dss_device *dssdev,
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> index 7af60ca4e7b2..363bc5843e0f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> @@ -461,7 +461,7 @@ static int hdmi_connect(struct omap_dss_device *dssdev,
>   if (r)
>   return r;
>  
> - r = dss_mgr_

Re: [PATCH v2 45/60] drm/omap: dss: Add function to retrieve display for an output

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:03PM +0300, Laurent Pinchart wrote:
> Add a new omapdss_display_get() function to retrieve the omap_dss_device
> for a given DSS output. This will be used when reversing the direction
> of the DSS pipeline handling logic.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/display.c | 9 +
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 1 +
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index 65ca71859c7d..697dab0435d6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -49,3 +49,12 @@ void omapdss_display_init(struct omap_dss_device *dssdev)
> "display%u", id);
>  }
>  EXPORT_SYMBOL_GPL(omapdss_display_init);
> +
> +struct omap_dss_device *omapdss_display_get(struct omap_dss_device *output)
> +{
> + while (output->next)
> + output = output->next;
> +
> + return omapdss_device_get(output);
> +}
> +EXPORT_SYMBOL_GPL(omapdss_display_get);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 723124f6e596..1d7263fc6077 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -491,6 +491,7 @@ static inline bool omapdss_is_initialized(void)
>  #define for_each_dss_display(d) \
>   while ((d = omapdss_device_get_next(d, true, false)) != NULL)
>  void omapdss_display_init(struct omap_dss_device *dssdev);
> +struct omap_dss_device *omapdss_display_get(struct omap_dss_device *output);
>  
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 42/60] drm/omap: dss: venc: Move initialization code from bind to probe

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:25:00PM +0300, Laurent Pinchart wrote:
> There's no reason to delay initialization of most of the driver (such as
> mapping memory I/O or enabling runtime PM) to the component bind
> handler. Perform as much of the initialization as possible at probe
> time, initializing at bind time only the parts that depends on the DSS.
> The cleanup code is moved from unbind to remove in a similar way.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/venc.c | 104 
> +
>  1 file changed, 60 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
> b/drivers/gpu/drm/omapdrm/dss/venc.c
> index c8fb91bb1ad3..84069e79ca6a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -756,6 +756,50 @@ static const struct omap_dss_device_ops venc_ops = {
>   .set_timings = venc_set_timings,
>  };
>  
> +/* 
> -
> + * Component Bind & Unbind
> + */
> +
> +static int venc_bind(struct device *dev, struct device *master, void *data)
> +{
> + struct dss_device *dss = dss_get_device(master);
> + struct venc_device *venc = dev_get_drvdata(dev);
> + u8 rev_id;
> + int r;
> +
> + venc->dss = dss;
> +
> + r = venc_runtime_get(venc);
> + if (r)
> + return r;
> +
> + rev_id = (u8)(venc_read_reg(venc, VENC_REV_ID) & 0xff);
> + dev_dbg(dev, "OMAP VENC rev %d\n", rev_id);
> +
> + venc_runtime_put(venc);
> +
> + venc->debugfs = dss_debugfs_create_file(dss, "venc", venc_dump_regs,
> + venc);
> +
> + return 0;
> +}
> +
> +static void venc_unbind(struct device *dev, struct device *master, void 
> *data)
> +{
> + struct venc_device *venc = dev_get_drvdata(dev);
> +
> + dss_debugfs_remove_file(venc->debugfs);
> +}
> +
> +static const struct component_ops venc_component_ops = {
> + .bind   = venc_bind,
> + .unbind = venc_unbind,
> +};
> +
> +/* 
> -
> + * Probe & Remove, Suspend & Resume
> + */
> +
>  static void venc_init_output(struct venc_device *venc)
>  {
>   struct omap_dss_device *out = &venc->output;
> @@ -820,19 +864,15 @@ static int venc_probe_of(struct venc_device *venc)
>   return r;
>  }
>  
> -/* VENC HW IP initialisation */
>  static const struct soc_device_attribute venc_soc_devices[] = {
>   { .machine = "OMAP3[45]*" },
>   { .machine = "AM35*" },
>   { /* sentinel */ }
>  };
>  
> -static int venc_bind(struct device *dev, struct device *master, void *data)
> +static int venc_probe(struct platform_device *pdev)
>  {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct dss_device *dss = dss_get_device(master);
>   struct venc_device *venc;
> - u8 rev_id;
>   struct resource *venc_mem;
>   int r;
>  
> @@ -841,8 +881,8 @@ static int venc_bind(struct device *dev, struct device 
> *master, void *data)
>   return -ENOMEM;
>  
>   venc->pdev = pdev;
> - venc->dss = dss;
> - dev_set_drvdata(dev, venc);
> +
> + platform_set_drvdata(pdev, venc);
>  
>   /* The OMAP34xx, OMAP35xx and AM35xx VENC require the TV DAC clock. */
>   if (soc_device_match(venc_soc_devices))
> @@ -863,63 +903,39 @@ static int venc_bind(struct device *dev, struct device 
> *master, void *data)
>   if (r)
>   goto err_free;
>  
> - pm_runtime_enable(&pdev->dev);
> -
> - r = venc_runtime_get(venc);
> - if (r)
> - goto err_pm_disable;
> -
> - rev_id = (u8)(venc_read_reg(venc, VENC_REV_ID) & 0xff);
> - dev_dbg(&pdev->dev, "OMAP VENC rev %d\n", rev_id);
> -
> - venc_runtime_put(venc);
> -
>   r = venc_probe_of(venc);
> - if (r) {
> - DSSERR("Invalid DT data\n");
> - goto err_pm_disable;
> - }
> + if (r)
> + goto err_free;
>  
> - venc->debugfs = dss_debugfs_create_file(dss, "venc", venc_dump_regs,
> - venc);
> + pm_runtime_enable(&pdev->dev);
>  
>   venc_init_output(venc);
>  
> + r = component_add(&pdev->dev, &venc_component_ops);
> + if (r)
> + goto err_uninit_output;
> +
>   return 0;
>  
> -err_pm_disable:
> +err_uninit_output:
> + venc_uninit_output(venc);
>   pm_runtime_disable(&pdev->dev);
>  err_free:
>   kfree(venc);
>   return r;
>  }
>  
> -static void venc_unbind(struct device *dev, struct device *master, void 
> *data)
> +static int venc_remove(struct platform_device *pdev)
>  {
> - struct venc_device *venc = dev_get_drvdata(dev);
> + struct venc_device *venc = platform_get_drvdata(pdev);
>  
> - dss_debugfs_remove_file(venc->debugfs);
> + component_del(&pdev->dev, &venc_comp

Re: [PATCH v2 41/60] drm/omap: dss: hdmi5: Move initialization code from bind to probe

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:59PM +0300, Laurent Pinchart wrote:
> There's no reason to delay initialization of most of the driver (such as
> mapping memory I/O or enabling runtime PM) to the component bind
> handler. Perform as much of the initialization as possible at probe
> time, initializing at bind time only the parts that depends on the DSS.
> The cleanup code is moved from unbind to remove in a similar way.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/hdmi5.c | 205 
> +++-
>  1 file changed, 110 insertions(+), 95 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> index 92ae561bf974..64b45a612439 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> @@ -544,53 +544,10 @@ static const struct omap_dss_device_ops hdmi_ops = {
>   },
>  };
>  
> -static void hdmi_init_output(struct omap_hdmi *hdmi)
> -{
> - struct omap_dss_device *out = &hdmi->output;
> -
> - out->dev = &hdmi->pdev->dev;
> - out->id = OMAP_DSS_OUTPUT_HDMI;
> - out->output_type = OMAP_DISPLAY_TYPE_HDMI;
> - out->name = "hdmi.0";
> - out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> - out->ops = &hdmi_ops;
> - out->owner = THIS_MODULE;
> - out->of_ports = BIT(0);
> -
> - omapdss_device_register(out);
> -}
> -
> -static void hdmi_uninit_output(struct omap_hdmi *hdmi)
> -{
> - struct omap_dss_device *out = &hdmi->output;
> -
> - omapdss_device_unregister(out);
> -}
> -
> -static int hdmi_probe_of(struct omap_hdmi *hdmi)
> -{
> - struct platform_device *pdev = hdmi->pdev;
> - struct device_node *node = pdev->dev.of_node;
> - struct device_node *ep;
> - int r;
> -
> - ep = of_graph_get_endpoint_by_regs(node, 0, 0);
> - if (!ep)
> - return 0;
> -
> - r = hdmi_parse_lanes_of(pdev, ep, &hdmi->phy);
> - if (r)
> - goto err;
> -
> - of_node_put(ep);
> - return 0;
> -
> -err:
> - of_node_put(ep);
> - return r;
> -}
> +/* 
> -
> + * Audio Callbacks
> + */
>  
> -/* Audio callbacks */
>  static int hdmi_audio_startup(struct device *dev,
> void (*abort_cb)(struct device *dev))
>  {
> @@ -711,27 +668,116 @@ static int hdmi_audio_register(struct omap_hdmi *hdmi)
>   return 0;
>  }
>  
> -/* HDMI HW IP initialisation */
> +/* 
> -
> + * Component Bind & Unbind
> + */
> +
>  static int hdmi5_bind(struct device *dev, struct device *master, void *data)
>  {
> - struct platform_device *pdev = to_platform_device(dev);
>   struct dss_device *dss = dss_get_device(master);
> - struct omap_hdmi *hdmi;
> + struct omap_hdmi *hdmi = dev_get_drvdata(dev);
>   int r;
> +
> + hdmi->dss = dss;
> +
> + r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp);
> + if (r)
> + return r;
> +
> + r = hdmi_audio_register(hdmi);
> + if (r) {
> + DSSERR("Registering HDMI audio failed %d\n", r);
> + goto err_pll_uninit;
> + }
> +
> + hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
> + hdmi);
> +
> + return 0;
> +
> +err_pll_uninit:
> + hdmi_pll_uninit(&hdmi->pll);
> + return r;
> +}
> +
> +static void hdmi5_unbind(struct device *dev, struct device *master, void 
> *data)
> +{
> + struct omap_hdmi *hdmi = dev_get_drvdata(dev);
> +
> + dss_debugfs_remove_file(hdmi->debugfs);
> +
> + if (hdmi->audio_pdev)
> + platform_device_unregister(hdmi->audio_pdev);
> +
> + hdmi_pll_uninit(&hdmi->pll);
> +}
> +
> +static const struct component_ops hdmi5_component_ops = {
> + .bind   = hdmi5_bind,
> + .unbind = hdmi5_unbind,
> +};
> +
> +/* 
> -
> + * Probe & Remove, Suspend & Resume
> + */
> +
> +static void hdmi5_init_output(struct omap_hdmi *hdmi)
> +{
> + struct omap_dss_device *out = &hdmi->output;
> +
> + out->dev = &hdmi->pdev->dev;
> + out->id = OMAP_DSS_OUTPUT_HDMI;
> + out->output_type = OMAP_DISPLAY_TYPE_HDMI;
> + out->name = "hdmi.0";
> + out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> + out->ops = &hdmi_ops;
> + out->owner = THIS_MODULE;
> + out->of_ports = BIT(0);
> +
> + omapdss_device_register(out);
> +}
> +
> +static void hdmi5_uninit_output(struct omap_hdmi *hdmi)
> +{
> + struct omap_dss_device *out = &hdmi->output;
> +
> + omapdss_device_unregister(out);
> +}
> +
> +static int hdmi5_probe_of(struct omap_hdmi *hdmi)
> +{
> + struct platform_device *pdev = hdmi->pdev;
> + struct device_node *node = pdev->dev.of_node;
> + struct device_nod

Re: [PATCH v2 40/60] drm/omap: dss: hdmi4: Move initialization code from bind to probe

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:58PM +0300, Laurent Pinchart wrote:
> There's no reason to delay initialization of most of the driver (such as
> mapping memory I/O or enabling runtime PM) to the component bind
> handler. Perform as much of the initialization as possible at probe
> time, initializing at bind time only the parts that depends on the DSS.
> The cleanup code is moved from unbind to remove in a similar way.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/hdmi4.c | 218 
> +++-
>  1 file changed, 117 insertions(+), 101 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> index 1d1f2e0b2b2a..89fdce02278c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -553,53 +553,10 @@ static const struct omap_dss_device_ops hdmi_ops = {
>   },
>  };
>  
> -static void hdmi_init_output(struct omap_hdmi *hdmi)
> -{
> - struct omap_dss_device *out = &hdmi->output;
> -
> - out->dev = &hdmi->pdev->dev;
> - out->id = OMAP_DSS_OUTPUT_HDMI;
> - out->output_type = OMAP_DISPLAY_TYPE_HDMI;
> - out->name = "hdmi.0";
> - out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> - out->ops = &hdmi_ops;
> - out->owner = THIS_MODULE;
> - out->of_ports = BIT(0);
> -
> - omapdss_device_register(out);
> -}
> -
> -static void hdmi_uninit_output(struct omap_hdmi *hdmi)
> -{
> - struct omap_dss_device *out = &hdmi->output;
> -
> - omapdss_device_unregister(out);
> -}
> -
> -static int hdmi_probe_of(struct omap_hdmi *hdmi)
> -{
> - struct platform_device *pdev = hdmi->pdev;
> - struct device_node *node = pdev->dev.of_node;
> - struct device_node *ep;
> - int r;
> -
> - ep = of_graph_get_endpoint_by_regs(node, 0, 0);
> - if (!ep)
> - return 0;
> -
> - r = hdmi_parse_lanes_of(pdev, ep, &hdmi->phy);
> - if (r)
> - goto err;
> -
> - of_node_put(ep);
> - return 0;
> -
> -err:
> - of_node_put(ep);
> - return r;
> -}
> +/* 
> -
> + * Audio Callbacks
> + */
>  
> -/* Audio callbacks */
>  static int hdmi_audio_startup(struct device *dev,
> void (*abort_cb)(struct device *dev))
>  {
> @@ -714,27 +671,123 @@ static int hdmi_audio_register(struct omap_hdmi *hdmi)
>   return 0;
>  }
>  
> -/* HDMI HW IP initialisation */
> +/* 
> -
> + * Component Bind & Unbind
> + */
> +
>  static int hdmi4_bind(struct device *dev, struct device *master, void *data)
>  {
> - struct platform_device *pdev = to_platform_device(dev);
>   struct dss_device *dss = dss_get_device(master);
> - struct omap_hdmi *hdmi;
> + struct omap_hdmi *hdmi = dev_get_drvdata(dev);
>   int r;
> +
> + hdmi->dss = dss;
> +
> + r = hdmi_pll_init(dss, hdmi->pdev, &hdmi->pll, &hdmi->wp);
> + if (r)
> + return r;
> +
> + r = hdmi4_cec_init(hdmi->pdev, &hdmi->core, &hdmi->wp);
> + if (r)
> + goto err_pll_uninit;
> +
> + r = hdmi_audio_register(hdmi);
> + if (r) {
> + DSSERR("Registering HDMI audio failed\n");
> + goto err_cec_uninit;
> + }
> +
> + hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
> +hdmi);
> +
> + return 0;
> +
> +err_cec_uninit:
> + hdmi4_cec_uninit(&hdmi->core);
> +err_pll_uninit:
> + hdmi_pll_uninit(&hdmi->pll);
> + return r;
> +}
> +
> +static void hdmi4_unbind(struct device *dev, struct device *master, void 
> *data)
> +{
> + struct omap_hdmi *hdmi = dev_get_drvdata(dev);
> +
> + dss_debugfs_remove_file(hdmi->debugfs);
> +
> + if (hdmi->audio_pdev)
> + platform_device_unregister(hdmi->audio_pdev);
> +
> + hdmi4_cec_uninit(&hdmi->core);
> + hdmi_pll_uninit(&hdmi->pll);
> +}
> +
> +static const struct component_ops hdmi4_component_ops = {
> + .bind   = hdmi4_bind,
> + .unbind = hdmi4_unbind,
> +};
> +
> +/* 
> -
> + * Probe & Remove, Suspend & Resume
> + */
> +
> +static void hdmi4_init_output(struct omap_hdmi *hdmi)
> +{
> + struct omap_dss_device *out = &hdmi->output;
> +
> + out->dev = &hdmi->pdev->dev;
> + out->id = OMAP_DSS_OUTPUT_HDMI;
> + out->output_type = OMAP_DISPLAY_TYPE_HDMI;
> + out->name = "hdmi.0";
> + out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> + out->ops = &hdmi_ops;
> + out->owner = THIS_MODULE;
> + out->of_ports = BIT(0);
> +
> + omapdss_device_register(out);
> +}
> +
> +static void hdmi4_uninit_output(struct omap_hdmi *hdmi)
> +{
> + struct omap_dss_device *out = &hdmi->output;
> +
> + omapdss_device_unr

Re: [PATCH v2 39/60] drm/omap: dss: dsi: Move initialization code from bind to probe

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:57PM +0300, Laurent Pinchart wrote:
> There's no reason to delay initialization of most of the driver (such as
> mapping memory I/O or enabling runtime PM) to the component bind
> handler. Perform as much of the initialization as possible at probe
> time, initializing at bind time only the parts that depends on the DSS.
> The cleanup code is moved from unbind to remove in a similar way.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 301 
> --
>  1 file changed, 161 insertions(+), 140 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 278094f29255..79312e53bfd9 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4981,85 +4981,9 @@ static const struct omap_dss_device_ops dsi_ops = {
>   },
>  };
>  
> -static void dsi_init_output(struct dsi_data *dsi)
> -{
> - struct omap_dss_device *out = &dsi->output;
> -
> - out->dev = dsi->dev;
> - out->id = dsi->module_id == 0 ?
> - OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
> -
> - out->output_type = OMAP_DISPLAY_TYPE_DSI;
> - out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
> - out->dispc_channel = dsi_get_channel(dsi);
> - out->ops = &dsi_ops;
> - out->owner = THIS_MODULE;
> - out->of_ports = BIT(0);
> -
> - omapdss_device_register(out);
> -}
> -
> -static void dsi_uninit_output(struct dsi_data *dsi)
> -{
> - struct omap_dss_device *out = &dsi->output;
> -
> - omapdss_device_unregister(out);
> -}
> -
> -static int dsi_probe_of(struct dsi_data *dsi)
> -{
> - struct device_node *node = dsi->dev->of_node;
> - struct property *prop;
> - u32 lane_arr[10];
> - int len, num_pins;
> - int r, i;
> - struct device_node *ep;
> - struct omap_dsi_pin_config pin_cfg;
> -
> - ep = of_graph_get_endpoint_by_regs(node, 0, 0);
> - if (!ep)
> - return 0;
> -
> - prop = of_find_property(ep, "lanes", &len);
> - if (prop == NULL) {
> - dev_err(dsi->dev, "failed to find lane data\n");
> - r = -EINVAL;
> - goto err;
> - }
> -
> - num_pins = len / sizeof(u32);
> -
> - if (num_pins < 4 || num_pins % 2 != 0 ||
> - num_pins > dsi->num_lanes_supported * 2) {
> - dev_err(dsi->dev, "bad number of lanes\n");
> - r = -EINVAL;
> - goto err;
> - }
> -
> - r = of_property_read_u32_array(ep, "lanes", lane_arr, num_pins);
> - if (r) {
> - dev_err(dsi->dev, "failed to read lane data\n");
> - goto err;
> - }
> -
> - pin_cfg.num_pins = num_pins;
> - for (i = 0; i < num_pins; ++i)
> - pin_cfg.pins[i] = (int)lane_arr[i];
> -
> - r = dsi_configure_pins(&dsi->output, &pin_cfg);
> - if (r) {
> - dev_err(dsi->dev, "failed to configure pins");
> - goto err;
> - }
> -
> - of_node_put(ep);
> -
> - return 0;
> -
> -err:
> - of_node_put(ep);
> - return r;
> -}
> +/* 
> -
> + * PLL
> + */
>  
>  static const struct dss_pll_ops dsi_pll_ops = {
>   .enable = dsi_pll_enable,
> @@ -5174,7 +5098,153 @@ static int dsi_init_pll_data(struct dss_device *dss, 
> struct dsi_data *dsi)
>   return 0;
>  }
>  
> -/* DSI1 HW IP initialisation */
> +/* 
> -
> + * Component Bind & Unbind
> + */
> +
> +static int dsi_bind(struct device *dev, struct device *master, void *data)
> +{
> + struct dss_device *dss = dss_get_device(master);
> + struct dsi_data *dsi = dev_get_drvdata(dev);
> + char name[10];
> + u32 rev;
> + int r;
> +
> + dsi->dss = dss;
> +
> + dsi_init_pll_data(dss, dsi);
> +
> + r = dsi_runtime_get(dsi);
> + if (r)
> + return r;
> +
> + rev = dsi_read_reg(dsi, DSI_REVISION);
> + dev_dbg(dev, "OMAP DSI rev %d.%d\n",
> +FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0));
> +
> + dsi->line_buffer_size = dsi_get_line_buf_size(dsi);
> +
> + dsi_runtime_put(dsi);
> +
> + snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1);
> + dsi->debugfs.regs = dss_debugfs_create_file(dss, name,
> + dsi_dump_dsi_regs, &dsi);
> +#ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
> + snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1);
> + dsi->debugfs.irqs = dss_debugfs_create_file(dss, name,
> + dsi_dump_dsi_irqs, &dsi);
> +#endif
> + snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1);
> + dsi->debugfs.clks = dss_debugfs_create_file(dss, name,
> +  

Re: [PATCH v2 38/60] drm/omap: dss: Cleanup error paths in output init functions

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:56PM +0300, Laurent Pinchart wrote:
> Rename the jump labels according to the cleanup they perform, not the
> location they're accessed from, and move functions from error checks to
> cleanup paths, and move reference handling to simplify cleanup.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dpi.c   | 10 ++
>  drivers/gpu/drm/omapdrm/dss/dsi.c   |  9 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c |  7 ---
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c |  7 ---
>  drivers/gpu/drm/omapdrm/dss/sdi.c   |  7 ++-
>  drivers/gpu/drm/omapdrm/dss/venc.c  |  7 +++
>  6 files changed, 19 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 8a7c951a413c..e97f54d5f3e1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -745,15 +745,14 @@ int dpi_init_port(struct dss_device *dss, struct 
> platform_device *pdev,
>   return 0;
>  
>   r = of_property_read_u32(ep, "data-lines", &datalines);
> + of_node_put(ep);
>   if (r) {
>   DSSERR("failed to parse datalines\n");
> - goto err_datalines;
> + return r;
>   }
>  
>   dpi->data_lines = datalines;
>  
> - of_node_put(ep);
> -
>   dpi->pdev = pdev;
>   dpi->dss_model = dss_model;
>   dpi->dss = dss;
> @@ -764,11 +763,6 @@ int dpi_init_port(struct dss_device *dss, struct 
> platform_device *pdev,
>   dpi_init_output_port(dpi, port);
>  
>   return 0;
> -
> -err_datalines:
> - of_node_put(ep);
> -
> - return r;
>  }
>  
>  void dpi_uninit_port(struct device_node *port)
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index b3e50d8a7477..278094f29255 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5360,7 +5360,7 @@ static int dsi_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   r = dsi_runtime_get(dsi);
>   if (r)
> - goto err_runtime_get;
> + goto err_pm_disable;
>  
>   rev = dsi_read_reg(dsi, DSI_REVISION);
>   dev_dbg(dev, "OMAP DSI rev %d.%d\n",
> @@ -5381,7 +5381,7 @@ static int dsi_bind(struct device *dev, struct device 
> *master, void *data)
>   r = dsi_probe_of(dsi);
>   if (r) {
>   DSSERR("Invalid DSI DT data\n");
> - goto err_probe_of;
> + goto err_uninit_output;
>   }
>  
>   r = of_platform_populate(dev->of_node, NULL, NULL, dev);
> @@ -5404,11 +5404,10 @@ static int dsi_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   return 0;
>  
> -err_probe_of:
> +err_uninit_output:
>   dsi_uninit_output(dsi);
>   dsi_runtime_put(dsi);
> -
> -err_runtime_get:
> +err_pm_disable:
>   pm_runtime_disable(dev);
>   return r;
>  }
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> index bf800cede2ad..1d1f2e0b2b2a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -780,9 +780,7 @@ static int hdmi4_bind(struct device *dev, struct device 
> *master, void *data)
>   r = hdmi_audio_register(hdmi);
>   if (r) {
>   DSSERR("Registering HDMI audio failed\n");
> - hdmi_uninit_output(hdmi);
> - pm_runtime_disable(&pdev->dev);
> - return r;
> + goto err_uninit_output;
>   }
>  
>   hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
> @@ -790,6 +788,9 @@ static int hdmi4_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   return 0;
>  
> +err_uninit_output:
> + hdmi_uninit_output(hdmi);
> + pm_runtime_disable(&pdev->dev);
>  err_pll:
>   hdmi_pll_uninit(&hdmi->pll);
>  err_free:
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> index e5d23dd19f99..92ae561bf974 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> @@ -773,9 +773,7 @@ static int hdmi5_bind(struct device *dev, struct device 
> *master, void *data)
>   r = hdmi_audio_register(hdmi);
>   if (r) {
>   DSSERR("Registering HDMI audio failed %d\n", r);
> - hdmi_uninit_output(hdmi);
> - pm_runtime_disable(&pdev->dev);
> - return r;
> + goto err_uninit_output;
>   }
>  
>   hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
> @@ -783,6 +781,9 @@ static int hdmi5_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   return 0;
>  
> +err_uninit_output:
> + hdmi_uninit_output(hdmi);
> + pm_runtime_disable(&pdev->dev);
>  err_pll:
>   hdmi_pll_uninit(&hdmi->pll);
>  err_free:
> diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c 
> 

Re: [PATCH v2 37/60] drm/omap: displays: Don't cast dssdev to panel data unnecessarily

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:55PM +0300, Laurent Pinchart wrote:
> The connect handle of the analog TV and HDMI connectors casts the dssdev
> to panel data only to then access fields of the panel data that are also
> present in the dssdev. Remove the cast and use dssdev directly.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c | 5 ++---
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  | 5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 4f32c8ddcfbd..eab898b5bf0f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -43,13 +43,12 @@ static const struct videomode tvc_pal_vm = {
>  
>  static int tvc_connect(struct omap_dss_device *dssdev)
>  {
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *src;
>   int r;
>  
> - src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
> + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
>   if (IS_ERR_OR_NULL(src)) {
> - dev_err(ddata->dev, "failed to find video source\n");
> + dev_err(dssdev->dev, "failed to find video source\n");
>   return src ? PTR_ERR(src) : -EINVAL;
>   }
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index b3f88ab0cd6e..cf06b47d6ce7 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -53,13 +53,12 @@ struct panel_drv_data {
>  
>  static int hdmic_connect(struct omap_dss_device *dssdev)
>  {
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *src;
>   int r;
>  
> - src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
> + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
>   if (IS_ERR_OR_NULL(src)) {
> - dev_err(ddata->dev, "failed to find video source\n");
> + dev_err(dssdev->dev, "failed to find video source\n");
>   return src ? PTR_ERR(src) : -EINVAL;
>   }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 36/60] drm/omap: dss: Extend omapdss_of_find_source_for_first_ep() to sinks

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:54PM +0300, Laurent Pinchart wrote:
> The omapdss_of_find_source_for_first_ep() function locates the source
> corresponding to the first endpoint of the first port of a device node.
> We can easily extend it to locate sinks as well by passing the port
> number as a parameter. This will be useful to find sinks in encoders
> drivers.
> 
> Extend the function and rename it to omapdss_of_find_connected_device()
> to reflect its new extended purpose.
> 
> Additionally, it is useful to differentiate between failures to return
> the connected device because no link exists in the device tree for the
> requested port, or because the connected device as described in the
> device tree is invalid or not probed yet. Return NULL in the first case
> and an error code in the second case, and update the callers
> accordingly.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c |  6 +++---
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   |  6 +++---
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |  6 +++---
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |  2 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |  2 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c   |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |  6 +++---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c|  6 +++---
>  .../gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c|  6 +++---
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c|  6 +++---
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |  6 +++---
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c|  6 +++---
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c|  6 +++---
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c|  6 +++---
>  drivers/gpu/drm/omapdrm/dss/dss-of.c   | 14 
> +++---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  2 +-
>  16 files changed, 44 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index b960c4d0e84d..4f32c8ddcfbd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -47,10 +47,10 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>   struct omap_dss_device *src;
>   int r;
>  
> - src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> - if (IS_ERR(src)) {
> + src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
> + if (IS_ERR_OR_NULL(src)) {
>   dev_err(ddata->dev, "failed to find video source\n");
> - return PTR_ERR(src);
> + return src ? PTR_ERR(src) : -EINVAL;
>   }
>  
>   r = omapdss_device_connect(dssdev->dss, src, dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 8ff674bf75e6..6eae18b42b82 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -61,10 +61,10 @@ static int dvic_connect(struct omap_dss_device *dssdev)
>   struct omap_dss_device *src;
>   int r;
>  
> - src = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
> - if (IS_ERR(src)) {
> + src = omapdss_of_find_connected_device(dssdev->dev->of_node, 0);
> + if (IS_ERR_OR_NULL(src)) {
>   dev_err(dssdev->dev, "failed to find video source\n");
> - return PTR_ERR(src);
> + return src ? PTR_ERR(src) : -EINVAL;
>   }
>  
>   r = omapdss_device_connect(dssdev->dss, src, dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 2afaa2ca602b..b3f88ab0cd6e 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -57,10 +57,10 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
>   struct omap_dss_device *src;
>   int r;
>  
> - src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> - if (IS_ERR(src)) {
> + src = omapdss_of_find_connected_device(ddata->dev->of_node, 0);
> + if (IS_ERR_OR_NULL(src)) {
>   dev_err(ddata->dev, "failed to find video source\n");
> - return PTR_ERR(src);
> + return src ? PTR_ERR(src) : -EINVAL;
>   }
>  
>   r = omapdss_device_connect(dssdev->dss, src, dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index eb0ebb850114..904ebec5f5e1 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drive

Re: [PATCH v2 35/60] drm/omap: dss: Replace omap_dss_device port number with bitmask

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:53PM +0300, Laurent Pinchart wrote:
> The omap_dss_device port_num field stores the DT port number associated
> with the device. The field is used in different ways depending on the
> device type:
> 
> - For DPI outputs, the port number is used as an identifier of the DPI
> instance
> 
> - For sources, the port number is used to look up the omap_dss_device by
> DT port node
> 
> As omap_dss_device instances are only looked up as sources by sinks,
> setting the field to the number of the source port works for both use
> cases.
> 
> However, to enable looking up sinks, we need to record all the ports
> associated with an omap_dss_device. Do so by turning the port_num field
> into an of_ports bitmask. For DPI outputs the port number is
> additionally stored in the dpi_data structure as the output ID.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c|  1 +
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c  |  1 +
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c |  1 +
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c |  1 +
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c |  2 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c  |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c  |  1 +
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  1 +
>  .../drm/omapdrm/displays/panel-lgphilips-lb035q02.c   |  1 +
>  .../gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c   |  1 +
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c|  1 +
>  .../gpu/drm/omapdrm/displays/panel-sony-acx565akm.c   |  1 +
>  .../gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c   |  1 +
>  .../gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c   |  1 +
>  drivers/gpu/drm/omapdrm/dss/base.c|  2 +-
>  drivers/gpu/drm/omapdrm/dss/dpi.c | 19 
> +--
>  drivers/gpu/drm/omapdrm/dss/dsi.c |  1 +
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c   |  1 +
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c   |  1 +
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 ++--
>  drivers/gpu/drm/omapdrm/dss/sdi.c |  2 +-
>  drivers/gpu/drm/omapdrm/dss/venc.c|  1 +
>  22 files changed, 31 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index f7250db0f3b7..b960c4d0e84d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -169,6 +169,7 @@ static int tvc_probe(struct platform_device *pdev)
>   dssdev->dev = &pdev->dev;
>   dssdev->type = OMAP_DISPLAY_TYPE_VENC;
>   dssdev->owner = THIS_MODULE;
> + dssdev->of_ports = BIT(0);
>  
>   omapdss_display_init(dssdev);
>   omapdss_device_register(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index b4f84baff144..8ff674bf75e6 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -389,6 +389,7 @@ static int dvic_probe(struct platform_device *pdev)
>   dssdev->dev = &pdev->dev;
>   dssdev->type = OMAP_DISPLAY_TYPE_DVI;
>   dssdev->owner = THIS_MODULE;
> + dssdev->of_ports = BIT(0);
>  
>   omapdss_display_init(dssdev);
>   omapdss_device_register(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 2f8ae93c117a..2afaa2ca602b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -349,6 +349,7 @@ static int hdmic_probe(struct platform_device *pdev)
>   dssdev->dev = &pdev->dev;
>   dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
>   dssdev->owner = THIS_MODULE;
> + dssdev->of_ports = BIT(0);
>  
>   omapdss_display_init(dssdev);
>   omapdss_device_register(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 4d7f4dae2c10..eb0ebb850114 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -167,6 +167,7 @@ static int opa362_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_VENC;
>   dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
>   dssdev->owner = THIS_MODULE;
> + dssdev->of_ports = BIT(1) | BIT(0);
>  
>   omapdss_device_register(dssdev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index 833544d8502f..fb767d674297 100644
> --- a/drivers/gpu/drm/omapdrm/displays/en

Re: [PATCH v2 34/60] drm/omap: dss: Modify omapdss_find_output_from_display() to return channel

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:52PM +0300, Laurent Pinchart wrote:
> The omapdss_find_output_from_display() function is only used to retrieve
> the dispc channel corresponding to the display. Return the dispc channel
> directly, and rename the function to omapdss_device_get_dispc_channel()
> to match its new purpose.
> 
> The dssdev->id check is removed as the dssdev is guaranteed to be an
> output and have a non-zero id, as proved by the lack of crash despite
> the caller never checking the returned pointer before dereferencing it.
> 
> As the function is not specific to outputs anymore, move it from
> output.c to base.c.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/base.c|  9 +
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 +--
>  drivers/gpu/drm/omapdrm/dss/output.c  | 12 
>  drivers/gpu/drm/omapdrm/omap_crtc.c   |  5 +
>  4 files changed, 11 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index b4bc58c5134d..7f9d8a8be8c3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -236,6 +236,15 @@ void omapdss_device_disconnect(struct omap_dss_device 
> *src,
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> +enum omap_channel omapdss_device_get_dispc_channel(struct omap_dss_device 
> *dssdev)
> +{
> + while (dssdev->src)
> + dssdev = dssdev->src;
> +
> + return dssdev->dispc_channel;
> +}
> +EXPORT_SYMBOL(omapdss_device_get_dispc_channel);
> +
>  /* 
> -
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4df405ae20db..121bc953ba31 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -504,6 +504,7 @@ int omapdss_device_connect(struct dss_device *dss,
>  struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
>  struct omap_dss_device *dst);
> +enum omap_channel omapdss_device_get_dispc_channel(struct omap_dss_device 
> *dssdev);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> @@ -513,8 +514,6 @@ int omapdss_output_set_device(struct omap_dss_device *out,
>   struct omap_dss_device *dssdev);
>  int omapdss_output_unset_device(struct omap_dss_device *out);
>  
> -struct omap_dss_device *omapdss_find_output_from_display(struct 
> omap_dss_device *dssdev);
> -
>  typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
>  int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
>  int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index a5df6eed4aef..191b2e801257 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -88,18 +88,6 @@ int omapdss_output_unset_device(struct omap_dss_device 
> *out)
>  }
>  EXPORT_SYMBOL(omapdss_output_unset_device);
>  
> -struct omap_dss_device *omapdss_find_output_from_display(struct 
> omap_dss_device *dssdev)
> -{
> - while (dssdev->src)
> - dssdev = dssdev->src;
> -
> - if (dssdev->id != 0)
> - return omapdss_device_get(dssdev);
> -
> - return NULL;
> -}
> -EXPORT_SYMBOL(omapdss_find_output_from_display);
> -
>  int dss_install_mgr_ops(struct dss_device *dss,
>   const struct dss_mgr_ops *mgr_ops,
>   struct omap_drm_private *priv)
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
> b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 4ddc4ed18b47..c5f1915aef67 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -699,12 +699,9 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>   struct drm_crtc *crtc = NULL;
>   struct omap_crtc *omap_crtc;
>   enum omap_channel channel;
> - struct omap_dss_device *out;
>   int ret;
>  
> - out = omapdss_find_output_from_display(dssdev);
> - channel = out->dispc_channel;
> - omapdss_device_put(out);
> + channel = omapdss_device_get_dispc_channel(dssdev);
>  
>   DBG("%s", channel_names[channel]);
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 32/60] drm/omap: dss: Store dss_device pointer in omap_dss_device

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:50PM +0300, Laurent Pinchart wrote:
> Storing the dss_device pointer in the omap_dss_device structure will
> allow accessing the dss_device from the dss_mgr API functions.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  |  2 +-
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c|  2 +-
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   |  2 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c   |  2 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c   |  2 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c|  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c|  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |  2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c |  2 +-
>  drivers/gpu/drm/omapdrm/dss/base.c  | 11 +--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  4 +++-
>  drivers/gpu/drm/omapdrm/omap_drv.c  |  2 +-
>  17 files changed, 27 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index a7eb25bd9283..f7250db0f3b7 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -53,7 +53,7 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(src);
>   }
>  
> - r = omapdss_device_connect(src, dssdev);
> + r = omapdss_device_connect(dssdev->dss, src, dssdev);
>   if (r) {
>   omapdss_device_put(src);
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 3e71af9ba0c3..b4f84baff144 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -67,7 +67,7 @@ static int dvic_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(src);
>   }
>  
> - r = omapdss_device_connect(src, dssdev);
> + r = omapdss_device_connect(dssdev->dss, src, dssdev);
>   if (r) {
>   omapdss_device_put(src);
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index fd0bad4dc7c9..2f8ae93c117a 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -63,7 +63,7 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(src);
>   }
>  
> - r = omapdss_device_connect(src, dssdev);
> + r = omapdss_device_connect(dssdev->dss, src, dssdev);
>   if (r) {
>   omapdss_device_put(src);
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 01b00eea3a98..4d7f4dae2c10 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -43,7 +43,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
>   return PTR_ERR(src);
>   }
>  
> - r = omapdss_device_connect(src, dssdev);
> + r = omapdss_device_connect(dssdev->dss, src, dssdev);
>   if (r) {
>   omapdss_device_put(src);
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index 6f71d2b7de03..833544d8502f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -39,7 +39,7 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
>   return PTR_ERR(src);
>   }
>  
> - r = omapdss_device_connect(src, dssdev);
> + r = omapdss_device_connect(dssdev->dss, src, dssdev);
>   if (r) {
>   omapdss_device_put(src);
>   return r;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index 8031f2c087f6..3a3c36fef446 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -48,7 +48,7 @@ static int tpd_connect(struct omap_dss_device *dssdev,
>   return PTR_ERR(src);
> 

Re: [PATCH v2 33/60] drm/omap: dss: Move DSS mgr ops and private data to dss_device

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:51PM +0300, Laurent Pinchart wrote:
> The DSS manager ops and private data pointer are specific to a DSS
> instance. Store them in the dss_device structure instead of global
> variable.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss.h |  2 ++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  5 +--
>  drivers/gpu/drm/omapdrm/dss/output.c  | 58 
> ---
>  drivers/gpu/drm/omapdrm/omap_crtc.c   |  6 ++--
>  drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.c|  4 +--
>  6 files changed, 44 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
> b/drivers/gpu/drm/omapdrm/dss/dss.h
> index a4514843e925..54f96241b9ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -266,6 +266,8 @@ struct dss_device {
>  
>   struct dispc_device *dispc;
>   const struct dispc_ops *dispc_ops;
> + const struct dss_mgr_ops *mgr_ops;
> + struct omap_drm_private *mgr_ops_priv;
>  };
>  
>  /* core */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4befe8aab333..4df405ae20db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -574,9 +574,10 @@ struct dss_mgr_ops {
>   void (*handler)(void *), void *data);
>  };
>  
> -int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
> +int dss_install_mgr_ops(struct dss_device *dss,
> + const struct dss_mgr_ops *mgr_ops,
>   struct omap_drm_private *priv);
> -void dss_uninstall_mgr_ops(void);
> +void dss_uninstall_mgr_ops(struct dss_device *dss);
>  
>  int dss_mgr_connect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst);
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index b5bf7a5e35d9..a5df6eed4aef 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  
> +#include "dss.h"
>  #include "omapdss.h"
>  
>  static DEFINE_MUTEX(output_lock);
> @@ -99,90 +100,97 @@ struct omap_dss_device 
> *omapdss_find_output_from_display(struct omap_dss_device
>  }
>  EXPORT_SYMBOL(omapdss_find_output_from_display);
>  
> -static const struct dss_mgr_ops *dss_mgr_ops;
> -static struct omap_drm_private *dss_mgr_ops_priv;
> -
> -int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
> +int dss_install_mgr_ops(struct dss_device *dss,
> + const struct dss_mgr_ops *mgr_ops,
>   struct omap_drm_private *priv)
>  {
> - if (dss_mgr_ops)
> + if (dss->mgr_ops)
>   return -EBUSY;
>  
> - dss_mgr_ops = mgr_ops;
> - dss_mgr_ops_priv = priv;
> + dss->mgr_ops = mgr_ops;
> + dss->mgr_ops_priv = priv;
>  
>   return 0;
>  }
>  EXPORT_SYMBOL(dss_install_mgr_ops);
>  
> -void dss_uninstall_mgr_ops(void)
> +void dss_uninstall_mgr_ops(struct dss_device *dss)
>  {
> - dss_mgr_ops = NULL;
> - dss_mgr_ops_priv = NULL;
> + dss->mgr_ops = NULL;
> + dss->mgr_ops_priv = NULL;
>  }
>  EXPORT_SYMBOL(dss_uninstall_mgr_ops);
>  
>  int dss_mgr_connect(struct omap_dss_device *dssdev, struct omap_dss_device 
> *dst)
>  {
> - return dss_mgr_ops->connect(dss_mgr_ops_priv,
> - dssdev->dispc_channel, dst);
> + return dssdev->dss->mgr_ops->connect(dssdev->dss->mgr_ops_priv,
> +  dssdev->dispc_channel, dst);
>  }
>  EXPORT_SYMBOL(dss_mgr_connect);
>  
>  void dss_mgr_disconnect(struct omap_dss_device *dssdev,
>   struct omap_dss_device *dst)
>  {
> - dss_mgr_ops->disconnect(dss_mgr_ops_priv, dssdev->dispc_channel, dst);
> + dssdev->dss->mgr_ops->disconnect(dssdev->dss->mgr_ops_priv,
> +  dssdev->dispc_channel, dst);
>  }
>  EXPORT_SYMBOL(dss_mgr_disconnect);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>const struct videomode *vm)
>  {
> - dss_mgr_ops->set_timings(dss_mgr_ops_priv, dssdev->dispc_channel, vm);
> + dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,
> +   dssdev->dispc_channel, vm);
>  }
>  EXPORT_SYMBOL(dss_mgr_set_timings);
>  
>  void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>   const struct dss_lcd_mgr_config *config)
>  {
> - dss_mgr_ops->set_lcd_config(dss_mgr_ops_priv,
> - dssdev->dispc_channel, config);
> + dssdev->dss->mgr_ops->set_lcd_config(dssdev->dss->mgr_ops_priv,
> +  dssdev->dispc_channel, config);
>  }
>  EXPORT_SYMBOL(dss_mgr_set_lcd_config);
>  
>  int dss_mgr_enable(struct omap

Re: [PATCH v2 31/60] drm/omap: dss: Move and rename omap_dss_(get|put)_device()

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:49PM +0300, Laurent Pinchart wrote:
> The functions operate on any omap_dss_device, move them from display.c
> to base.c. While at it rename them to match the naming of the other
> functions operating on struct omap_dss_device.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |  4 ++--
>  .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c|  4 ++--
>  .../omapdrm/displays/panel-lgphilips-lb035q02.c|  4 ++--
>  .../drm/omapdrm/displays/panel-nec-nl8048hl11.c|  4 ++--
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |  4 ++--
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c|  4 ++--
>  .../drm/omapdrm/displays/panel-tpo-td028ttec1.c|  4 ++--
>  .../drm/omapdrm/displays/panel-tpo-td043mtea1.c|  4 ++--
>  drivers/gpu/drm/omapdrm/dss/base.c | 27 
> +++---
>  drivers/gpu/drm/omapdrm/dss/display.c  | 24 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  5 ++--
>  drivers/gpu/drm/omapdrm/dss/output.c   |  2 +-
>  drivers/gpu/drm/omapdrm/omap_connector.c   |  4 ++--
>  drivers/gpu/drm/omapdrm/omap_crtc.c|  2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.c |  8 +++
>  21 files changed, 62 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index f1d1c67d72b8..a7eb25bd9283 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -55,7 +55,7 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>  
>   r = omapdss_device_connect(src, dssdev);
>   if (r) {
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>   return r;
>   }
>  
> @@ -68,7 +68,7 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
>  
>   omapdss_device_disconnect(src, dssdev);
>  
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>  }
>  
>  static int tvc_enable(struct omap_dss_device *dssdev)
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 9e0b5a0b2eea..3e71af9ba0c3 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -69,7 +69,7 @@ static int dvic_connect(struct omap_dss_device *dssdev)
>  
>   r = omapdss_device_connect(src, dssdev);
>   if (r) {
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>   return r;
>   }
>  
> @@ -82,7 +82,7 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
>  
>   omapdss_device_disconnect(src, dssdev);
>  
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>  }
>  
>  static int dvic_enable(struct omap_dss_device *dssdev)
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 064b051c0a29..fd0bad4dc7c9 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -65,7 +65,7 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
>  
>   r = omapdss_device_connect(src, dssdev);
>   if (r) {
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>   return r;
>   }
>  
> @@ -78,7 +78,7 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
>  
>   omapdss_device_disconnect(src, dssdev);
>  
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>  }
>  
>  static int hdmic_enable(struct omap_dss_device *dssdev)
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index c1ed4e2ce8f3..01b00eea3a98 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -45,7 +45,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
>  
>   r = omapdss_device_connect(src, dssdev);
>   if (r) {
> - omap_dss_put_device(src);
> + omapdss_device_put(src);
>   return r;
>   }
>  
> @@ -60,7 +60,7 @@ static void opa362_disconnect(struct omap_dss_device 
> *dssdev,
>  
>   omapdss_device_disconnect(src, &ddata->dssdev);
>  
> - omap_dss_put_device(src);
> + 

Re: [PATCH v2 30/60] drm/omap: dss: Remove panel devices list

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:48PM +0300, Laurent Pinchart wrote:
> The panel devices list isn't used anymore, all panel devices are
> accessed through the global devices list. Remove it.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c |  9 ++--
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   | 14 ++-
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |  8 ++-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |  8 ++-
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c|  8 ++-
>  .../omapdrm/displays/panel-lgphilips-lb035q02.c|  8 ++-
>  .../drm/omapdrm/displays/panel-nec-nl8048hl11.c|  8 ++-
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |  8 ++-
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c| 27 
> +++---
>  .../drm/omapdrm/displays/panel-tpo-td028ttec1.c|  8 ++-
>  .../drm/omapdrm/displays/panel-tpo-td043mtea1.c| 22 --
>  drivers/gpu/drm/omapdrm/dss/display.c  | 23 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  3 ---
>  13 files changed, 31 insertions(+), 123 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index fb23fae7fbf4..f1d1c67d72b8 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -154,7 +154,6 @@ static int tvc_probe(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata;
>   struct omap_dss_device *dssdev;
> - int r;
>  
>   ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
>   if (!ddata)
> @@ -172,11 +171,7 @@ static int tvc_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>  
>   omapdss_display_init(dssdev);
> - r = omapdss_register_display(dssdev);
> - if (r) {
> - dev_err(&pdev->dev, "Failed to register panel\n");
> - return r;
> - }
> + omapdss_device_register(dssdev);
>  
>   return 0;
>  }
> @@ -186,7 +181,7 @@ static int __exit tvc_remove(struct platform_device *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> - omapdss_unregister_display(&ddata->dssdev);
> + omapdss_device_unregister(&ddata->dssdev);
>  
>   tvc_disable(dssdev);
>   tvc_disconnect(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 5333fb166c83..9e0b5a0b2eea 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -391,19 +391,9 @@ static int dvic_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>  
>   omapdss_display_init(dssdev);
> - r = omapdss_register_display(dssdev);
> - if (r) {
> - dev_err(&pdev->dev, "Failed to register panel\n");
> - goto err_reg;
> - }
> + omapdss_device_register(dssdev);
>  
>   return 0;
> -
> -err_reg:
> - i2c_put_adapter(ddata->i2c_adapter);
> - mutex_destroy(&ddata->hpd_lock);
> -
> - return r;
>  }
>  
>  static int __exit dvic_remove(struct platform_device *pdev)
> @@ -411,7 +401,7 @@ static int __exit dvic_remove(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> - omapdss_unregister_display(&ddata->dssdev);
> + omapdss_device_unregister(&ddata->dssdev);
>  
>   dvic_disable(dssdev);
>   dvic_disconnect(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 2c5e8cf70c9f..064b051c0a29 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -351,11 +351,7 @@ static int hdmic_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>  
>   omapdss_display_init(dssdev);
> - r = omapdss_register_display(dssdev);
> - if (r) {
> - dev_err(&pdev->dev, "Failed to register panel\n");
> - return r;
> - }
> + omapdss_device_register(dssdev);
>  
>   return 0;
>  }
> @@ -365,7 +361,7 @@ static int __exit hdmic_remove(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> - omapdss_unregister_display(&ddata->dssdev);
> + omapdss_device_unregister(&ddata->dssdev);
>  
>   hdmic_disable(dssdev);
>   hdmic_disconnect(dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index 87f11

Re: [PATCH v2 29/60] drm/omap: dss: Split omapdss_register_display()

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:47PM +0300, Laurent Pinchart wrote:
> Split the function into omapdss_display_init() to perform
> display-specific initialization of the omap_dss_device, and
> omapdss_register_display() to register the device. The latter will then
> be replaced by more generic registration.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  | 1 +
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c| 1 +
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c| 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 1 +
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c | 1 +
>  drivers/gpu/drm/omapdrm/dss/display.c   | 6 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   | 1 +
>  13 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index f579bd9ce7cb..fb23fae7fbf4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -171,6 +171,7 @@ static int tvc_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_VENC;
>   dssdev->owner = THIS_MODULE;
>  
> + omapdss_display_init(dssdev);
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(&pdev->dev, "Failed to register panel\n");
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 48dbb9df76b5..5333fb166c83 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -390,6 +390,7 @@ static int dvic_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_DVI;
>   dssdev->owner = THIS_MODULE;
>  
> + omapdss_display_init(dssdev);
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(&pdev->dev, "Failed to register panel\n");
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 4acb53788862..2c5e8cf70c9f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -350,6 +350,7 @@ static int hdmic_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
>   dssdev->owner = THIS_MODULE;
>  
> + omapdss_display_init(dssdev);
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(&pdev->dev, "Failed to register panel\n");
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index 32af5b11b448..87f11618e85f 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -218,6 +218,7 @@ static int panel_dpi_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_DPI;
>   dssdev->owner = THIS_MODULE;
>  
> + omapdss_display_init(dssdev);
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(&pdev->dev, "Failed to register panel\n");
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 353510af58e7..94275fc931be 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -1328,6 +1328,7 @@ static int dsicm_probe(struct platform_device *pdev)
>   dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
>   OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
>  
> + omapdss_display_init(dssdev);
>   r = omapdss_register_display(dssdev);
>   if (r) {
>   dev_err(dev, "Failed to register panel\n");
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> index 5bea3eadd7d2..88c075414b7c 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> @@ -270,6 +270,7 @@ static int lb035q02_panel_spi_probe(struct spi_device 
> *spi)
>   dssdev->type = OMAP_DISPLAY_TYPE_DPI;
>   dssdev->owner = THIS_MODULE;
>  
> + omapdss_display_init(dssdev);
>   r = omapdss_register_display(dssdev);
>   if (r

Re: [PATCH v2 28/60] drm/omap: dss: Make omap_dss_get_next_device() more generic

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:46PM +0300, Laurent Pinchart wrote:
> Despite its name, the omap_dss_get_next_device() function operates on
> display devices only. Make it more generic by allowing operation on all
> devices, with a parameter to specify the device type.
> 
> While at it rename the function to omapdss_device_get_next() to match
> the naming of the other functions operating on struct omap_dss_device.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/base.c| 52 
> +++
>  drivers/gpu/drm/omapdrm/dss/display.c | 49 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 ++--
>  3 files changed, 56 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 7cd3076c2140..f7b8958f15bc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -104,6 +104,58 @@ struct omap_dss_device 
> *omapdss_find_device_by_port(struct device_node *src,
>   return NULL;
>  }
>  
> +/*
> + * Search for the next device starting at @from. If display_only is true, 
> skip
> + * non-display devices. Release the reference to the @from device, and 
> acquire
> + * a reference to the returned device if found.
> + */
> +struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
> + bool display_only)
> +{
> + struct omap_dss_device *dssdev;
> + struct list_head *list;
> +
> + mutex_lock(&omapdss_devices_lock);
> +
> + if (list_empty(&omapdss_devices_list)) {
> + dssdev = NULL;
> + goto done;
> + }
> +
> + /*
> +  * Start from the from entry if given or from omapdss_devices_list
> +  * otherwise.
> +  */
> + list = from ? &from->list : &omapdss_devices_list;
> +
> + list_for_each_entry(dssdev, list, list) {
> + /*
> +  * Stop if we reach the omapdss_devices_list, that's the end of
> +  * the list.
> +  */
> + if (&dssdev->list == &omapdss_devices_list) {
> + dssdev = NULL;
> + goto done;
> + }
> +
> + /* Filter out non-display entries if display_only is set. */
> + if (!display_only || dssdev->driver)
> + goto done;
> + }
> +
> + dssdev = NULL;
> +
> +done:
> + if (from)
> + omap_dss_put_device(from);
> + if (dssdev)
> + omap_dss_get_device(dssdev);
> +
> + mutex_unlock(&omapdss_devices_lock);
> + return dssdev;
> +}
> +EXPORT_SYMBOL(omapdss_device_get_next);
> +
>  int omapdss_device_connect(struct omap_dss_device *src,
>  struct omap_dss_device *dst)
>  {
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index 383512c8a466..0c94d5208398 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -92,52 +92,3 @@ void omap_dss_put_device(struct omap_dss_device *dssdev)
>   module_put(dssdev->owner);
>  }
>  EXPORT_SYMBOL(omap_dss_put_device);
> -
> -/*
> - * ref count of the found device is incremented.
> - * ref count of from-device is decremented.
> - */
> -struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device 
> *from)
> -{
> - struct list_head *l;
> - struct omap_dss_device *dssdev;
> -
> - mutex_lock(&panel_list_mutex);
> -
> - if (list_empty(&panel_list)) {
> - dssdev = NULL;
> - goto out;
> - }
> -
> - if (from == NULL) {
> - dssdev = list_first_entry(&panel_list, struct omap_dss_device,
> - panel_list);
> - omap_dss_get_device(dssdev);
> - goto out;
> - }
> -
> - omap_dss_put_device(from);
> -
> - list_for_each(l, &panel_list) {
> - dssdev = list_entry(l, struct omap_dss_device, panel_list);
> - if (dssdev == from) {
> - if (list_is_last(l, &panel_list)) {
> - dssdev = NULL;
> - goto out;
> - }
> -
> - dssdev = list_entry(l->next, struct omap_dss_device,
> - panel_list);
> - omap_dss_get_device(dssdev);
> - goto out;
> - }
> - }
> -
> - WARN(1, "'from' dssdev not found\n");
> -
> - dssdev = NULL;
> -out:
> - mutex_unlock(&panel_list_mutex);
> - return dssdev;
> -}
> -EXPORT_SYMBOL(omap_dss_get_next_device);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a6ddc881ea72..94a3f98bdd3d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -

Re: [PATCH v2 27/60] drm/omap: dss: Rename for_each_dss_dev macro to for_each_dss_display

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:45PM +0300, Laurent Pinchart wrote:
> The macro iterates over displays only, rename it accordingly.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss.c | 2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.c| 4 ++--
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 8e7646181302..5b7613ff2f2e 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1557,7 +1557,7 @@ static void dss_shutdown(struct platform_device *pdev)
>  
>   DSSDBG("shutdown\n");
>  
> - for_each_dss_dev(dssdev) {
> + for_each_dss_display(dssdev) {
>   if (!dssdev->driver)
>   continue;
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 26abc09f3d4a..a6ddc881ea72 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -501,7 +501,7 @@ void omapdss_device_disconnect(struct omap_dss_device 
> *src,
>  
>  struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
>  void omap_dss_put_device(struct omap_dss_device *dssdev);
> -#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
> +#define for_each_dss_display(d) while ((d = omap_dss_get_next_device(d)) != 
> NULL)
>  struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device 
> *from);
>  
>  int omap_dss_get_num_overlay_managers(void);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index f1df5be198a8..21ca4002ac38 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -188,7 +188,7 @@ static int omap_connect_dssdevs(struct drm_device *ddev)
>   if (!omapdss_stack_is_ready())
>   return -EPROBE_DEFER;
>  
> - for_each_dss_dev(dssdev) {
> + for_each_dss_display(dssdev) {
>   r = omapdss_device_connect(dssdev, NULL);
>   if (r == -EPROBE_DEFER) {
>   omap_dss_put_device(dssdev);
> @@ -200,7 +200,7 @@ static int omap_connect_dssdevs(struct drm_device *ddev)
>   omap_dss_get_device(dssdev);
>   priv->dssdevs[priv->num_dssdevs++] = dssdev;
>   if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) {
> - /* To balance the 'for_each_dss_dev' loop */
> + /* To balance the 'for_each_dss_display' loop */
>   omap_dss_put_device(dssdev);
>   break;
>   }
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 26/60] drm/omap: dss: Remove output devices list

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:44PM +0300, Laurent Pinchart wrote:
> The output devices list isn't used anymore, all output devices are
> accessed through the global devices list. Remove it.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |  9 ++-
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |  8 ++
>  .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   |  8 ++
>  drivers/gpu/drm/omapdrm/dss/base.c |  2 ++
>  drivers/gpu/drm/omapdrm/dss/dpi.c  |  4 +--
>  drivers/gpu/drm/omapdrm/dss/dsi.c  |  4 +--
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c|  4 +--
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c|  4 +--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  5 
>  drivers/gpu/drm/omapdrm/dss/output.c   | 29 
> --
>  drivers/gpu/drm/omapdrm/dss/sdi.c  |  4 +--
>  drivers/gpu/drm/omapdrm/dss/venc.c |  4 +--
>  12 files changed, 20 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index c9c744e0c92e..c1ed4e2ce8f3 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -146,7 +146,6 @@ static int opa362_probe(struct platform_device *pdev)
>   struct panel_drv_data *ddata;
>   struct omap_dss_device *dssdev;
>   struct gpio_desc *gpio;
> - int r;
>  
>   dev_dbg(&pdev->dev, "probe\n");
>  
> @@ -169,11 +168,7 @@ static int opa362_probe(struct platform_device *pdev)
>   dssdev->output_type = OMAP_DISPLAY_TYPE_VENC;
>   dssdev->owner = THIS_MODULE;
>  
> - r = omapdss_register_output(dssdev);
> - if (r) {
> - dev_err(&pdev->dev, "Failed to register output\n");
> - return r;
> - }
> + omapdss_device_register(dssdev);
>  
>   return 0;
>  }
> @@ -183,7 +178,7 @@ static int __exit opa362_remove(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> - omapdss_unregister_output(&ddata->dssdev);
> + omapdss_device_unregister(&ddata->dssdev);
>  
>   WARN_ON(omapdss_device_is_enabled(dssdev));
>   if (omapdss_device_is_enabled(dssdev))
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index f568e53a9104..b360a68f074d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -192,11 +192,7 @@ static int tfp410_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>   dssdev->port_num = 1;
>  
> - r = omapdss_register_output(dssdev);
> - if (r) {
> - dev_err(&pdev->dev, "Failed to register output\n");
> - return r;
> - }
> + omapdss_device_register(dssdev);
>  
>   return 0;
>  }
> @@ -206,7 +202,7 @@ static int __exit tfp410_remove(struct platform_device 
> *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> - omapdss_unregister_output(&ddata->dssdev);
> + omapdss_device_unregister(&ddata->dssdev);
>  
>   WARN_ON(omapdss_device_is_enabled(dssdev));
>   if (omapdss_device_is_enabled(dssdev))
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index 7bbe794e9d21..efeae1401490 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -301,11 +301,7 @@ static int tpd_probe(struct platform_device *pdev)
>   dssdev->owner = THIS_MODULE;
>   dssdev->port_num = 1;
>  
> - r = omapdss_register_output(dssdev);
> - if (r) {
> - dev_err(&pdev->dev, "Failed to register output\n");
> - return r;
> - }
> + omapdss_device_register(dssdev);
>  
>   return 0;
>  }
> @@ -315,7 +311,7 @@ static int __exit tpd_remove(struct platform_device *pdev)
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct omap_dss_device *dssdev = &ddata->dssdev;
>  
> - omapdss_unregister_output(&ddata->dssdev);
> + omapdss_device_unregister(&ddata->dssdev);
>  
>   WARN_ON(omapdss_device_is_enabled(dssdev));
>   if (omapdss_device_is_enabled(dssdev))
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 810dcddded8a..7cd3076c2140 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -63,6 +63,7 @@ void omapdss_device_register(struct omap_dss_device *dssdev)
>   list_add_tail(&dssdev->list, &omapdss_devic

Re: [PATCH v2 25/60] drm/omap: Move DSI debugfs clocks dump to dsi%u_clks files

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:43PM +0300, Laurent Pinchart wrote:
> The DSI clocks are dumped in the DSS-level debugfs clocks file. This
> complicates the implementation as the DSI private data has to be looked
> up through the outputs list. Simplify it by creating two debugfs files,
> dsi1_clks and dsi2_clks, to dump the DSI clocks.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 43 
> ---
>  drivers/gpu/drm/omapdrm/dss/dss.c |  3 ---
>  drivers/gpu/drm/omapdrm/dss/dss.h |  2 --
>  3 files changed, 9 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 9952803b58d2..adfda2a63ada 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -403,6 +403,7 @@ struct dsi_data {
>   struct {
>   struct dss_debugfs_entry *irqs;
>   struct dss_debugfs_entry *regs;
> + struct dss_debugfs_entry *clks;
>   } debugfs;
>  
>  #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
> @@ -442,27 +443,6 @@ static inline struct dsi_data *to_dsi_data(struct 
> omap_dss_device *dssdev)
>   return dev_get_drvdata(dssdev->dev);
>  }
>  
> -static struct dsi_data *dsi_get_dsi_from_id(int module)
> -{
> - struct omap_dss_device *out;
> - enum omap_dss_output_id id;
> -
> - switch (module) {
> - case 0:
> - id = OMAP_DSS_OUTPUT_DSI1;
> - break;
> - case 1:
> - id = OMAP_DSS_OUTPUT_DSI2;
> - break;
> - default:
> - return NULL;
> - }
> -
> - out = omap_dss_get_output(id);
> -
> - return out ? to_dsi_data(out) : NULL;
> -}
> -
>  static inline void dsi_write_reg(struct dsi_data *dsi,
>const struct dsi_reg idx, u32 val)
>  {
> @@ -1448,8 +1428,9 @@ static void dsi_pll_disable(struct dss_pll *pll)
>   dsi_pll_uninit(dsi, true);
>  }
>  
> -static void dsi_dump_dsi_clocks(struct dsi_data *dsi, struct seq_file *s)
> +static int dsi_dump_dsi_clocks(struct seq_file *s, void *p)
>  {
> + struct dsi_data *dsi = p;
>   struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo;
>   enum dss_clk_source dispc_clk_src, dsi_clk_src;
>   int dsi_module = dsi->module_id;
> @@ -1459,7 +1440,7 @@ static void dsi_dump_dsi_clocks(struct dsi_data *dsi, 
> struct seq_file *s)
>   dsi_clk_src = dss_get_dsi_clk_source(dsi->dss, dsi_module);
>  
>   if (dsi_runtime_get(dsi))
> - return;
> + return 0;
>  
>   seq_printf(s,   "- DSI%d PLL -\n", dsi_module + 1);
>  
> @@ -1503,18 +1484,8 @@ static void dsi_dump_dsi_clocks(struct dsi_data *dsi, 
> struct seq_file *s)
>   seq_printf(s,   "LP_CLK\t\t%lu\n", dsi->current_lp_cinfo.lp_clk);
>  
>   dsi_runtime_put(dsi);
> -}
> -
> -void dsi_dump_clocks(struct seq_file *s)
> -{
> - struct dsi_data *dsi;
> - int i;
>  
> - for  (i = 0; i < MAX_NUM_DSI; i++) {
> - dsi = dsi_get_dsi_from_id(i);
> - if (dsi)
> - dsi_dump_dsi_clocks(dsi, s);
> - }
> + return 0;
>  }
>  
>  #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
> @@ -5426,6 +5397,9 @@ static int dsi_bind(struct device *dev, struct device 
> *master, void *data)
>   dsi->debugfs.irqs = dss_debugfs_create_file(dss, name,
>   dsi_dump_dsi_irqs, &dsi);
>  #endif
> + snprintf(name, sizeof(name), "dsi%u_clks", dsi->module_id + 1);
> + dsi->debugfs.clks = dss_debugfs_create_file(dss, name,
> + dsi_dump_dsi_clocks, &dsi);
>  
>   return 0;
>  
> @@ -5442,6 +5416,7 @@ static void dsi_unbind(struct device *dev, struct 
> device *master, void *data)
>  {
>   struct dsi_data *dsi = dev_get_drvdata(dev);
>  
> + dss_debugfs_remove_file(dsi->debugfs.clks);
>   dss_debugfs_remove_file(dsi->debugfs.irqs);
>   dss_debugfs_remove_file(dsi->debugfs.regs);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 59b238f03437..8e7646181302 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -394,9 +394,6 @@ static int dss_debug_dump_clocks(struct seq_file *s, void 
> *p)
>  
>   dss_dump_clocks(dss, s);
>   dispc_dump_clocks(dss->dispc, s);
> -#ifdef CONFIG_OMAP2_DSS_DSI
> - dsi_dump_clocks(s);
> -#endif
>   return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
> b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 4f1eb7f5b922..a4514843e925 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -373,8 +373,6 @@ static inline void sdi_uninit_port(struct device_node 
> *port)
>  
>  #ifdef CONFIG_OMAP2_DSS_DSI
>  
> -void dsi_dump_clocks(struct seq_file *s);
> -
>  void dsi_irq_handler(void);
>  
>  #endif

Re: [PATCH v2 24/60] drm/omap: dsi: Simplify debugfs implementation

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:42PM +0300, Laurent Pinchart wrote:
> The DSI debugfs regs and irqs show handlers received a pointer to the
> DSI private data. There's no need to look it up from the list of DSS
> outputs. Use the pointer directly, this allows simplifying the
> implementation of the handlers.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 63 
> +--
>  1 file changed, 14 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 4427389e0049..9952803b58d2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -1518,8 +1518,9 @@ void dsi_dump_clocks(struct seq_file *s)
>  }
>  
>  #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
> -static void dsi_dump_dsi_irqs(struct dsi_data *dsi, struct seq_file *s)
> +static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
>  {
> + struct dsi_data *dsi = p;
>   unsigned long flags;
>   struct dsi_irq_stats stats;
>  
> @@ -1603,33 +1604,20 @@ static void dsi_dump_dsi_irqs(struct dsi_data *dsi, 
> struct seq_file *s)
>   PIS(ULPSACTIVENOT_ALL0);
>   PIS(ULPSACTIVENOT_ALL1);
>  #undef PIS
> -}
> -
> -static int dsi1_dump_irqs(struct seq_file *s, void *p)
> -{
> - struct dsi_data *dsi = dsi_get_dsi_from_id(0);
>  
> - dsi_dump_dsi_irqs(dsi, s);
> - return 0;
> -}
> -
> -static int dsi2_dump_irqs(struct seq_file *s, void *p)
> -{
> - struct dsi_data *dsi = dsi_get_dsi_from_id(1);
> -
> - dsi_dump_dsi_irqs(dsi, s);
>   return 0;
>  }
>  #endif
>  
> -static void dsi_dump_dsi_regs(struct dsi_data *dsi, struct seq_file *s)
> +static int dsi_dump_dsi_regs(struct seq_file *s, void *p)
>  {
> -#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsi, r))
> + struct dsi_data *dsi = p;
>  
>   if (dsi_runtime_get(dsi))
> - return;
> + return 0;
>   dsi_enable_scp_clk(dsi);
>  
> +#define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsi, r))
>   DUMPREG(DSI_REVISION);
>   DUMPREG(DSI_SYSCONFIG);
>   DUMPREG(DSI_SYSSTATUS);
> @@ -1699,25 +1687,11 @@ static void dsi_dump_dsi_regs(struct dsi_data *dsi, 
> struct seq_file *s)
>   DUMPREG(DSI_PLL_GO);
>   DUMPREG(DSI_PLL_CONFIGURATION1);
>   DUMPREG(DSI_PLL_CONFIGURATION2);
> +#undef DUMPREG
>  
>   dsi_disable_scp_clk(dsi);
>   dsi_runtime_put(dsi);
> -#undef DUMPREG
> -}
> -
> -static int dsi1_dump_regs(struct seq_file *s, void *p)
> -{
> - struct dsi_data *dsi = dsi_get_dsi_from_id(0);
>  
> - dsi_dump_dsi_regs(dsi, s);
> - return 0;
> -}
> -
> -static int dsi2_dump_regs(struct seq_file *s, void *p)
> -{
> - struct dsi_data *dsi = dsi_get_dsi_from_id(1);
> -
> - dsi_dump_dsi_regs(dsi, s);
>   return 0;
>  }
>  
> @@ -5305,6 +5279,7 @@ static int dsi_bind(struct device *dev, struct device 
> *master, void *data)
>   struct dsi_data *dsi;
>   struct resource *dsi_mem;
>   struct resource *res;
> + char name[10];
>  
>   dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
>   if (!dsi)
> @@ -5443,23 +5418,13 @@ static int dsi_bind(struct device *dev, struct device 
> *master, void *data)
>  
>   dsi_runtime_put(dsi);
>  
> - if (dsi->module_id == 0)
> - dsi->debugfs.regs = dss_debugfs_create_file(dss, "dsi1_regs",
> - dsi1_dump_regs,
> - &dsi);
> - else
> - dsi->debugfs.regs = dss_debugfs_create_file(dss, "dsi2_regs",
> - dsi2_dump_regs,
> - &dsi);
> + snprintf(name, sizeof(name), "dsi%u_regs", dsi->module_id + 1);
> + dsi->debugfs.regs = dss_debugfs_create_file(dss, name,
> + dsi_dump_dsi_regs, &dsi);
>  #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
> - if (dsi->module_id == 0)
> - dsi->debugfs.irqs = dss_debugfs_create_file(dss, "dsi1_irqs",
> - dsi1_dump_irqs,
> - &dsi);
> - else
> - dsi->debugfs.irqs = dss_debugfs_create_file(dss, "dsi2_irqs",
> - dsi2_dump_irqs,
> - &dsi);
> + snprintf(name, sizeof(name), "dsi%u_irqs", dsi->module_id + 1);
> + dsi->debugfs.irqs = dss_debugfs_create_file(dss, name,
> + dsi_dump_dsi_irqs, &dsi);
>  #endif
>  
>   return 0;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesk

Re: [PATCH v2 23/60] drm/omap: displays: Remove input omap_dss_device from panel data

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:41PM +0300, Laurent Pinchart wrote:
> All connectors, encoders and panels store a pointer to their input
> omap_dss_device in the panel driver data structure. This duplicates the
> src field in the omap_dss_device structure. Remove the private copy and
> use the src field.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c |  41 ++---
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   |  43 ++---
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |  88 +-
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |  41 ++---
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |  41 ++---
>  .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   |  68 +++-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |  44 +++--
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c| 190 
> ++---
>  .../omapdrm/displays/panel-lgphilips-lb035q02.c|  41 ++---
>  .../drm/omapdrm/displays/panel-nec-nl8048hl11.c|  42 ++---
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |  42 ++---
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c|  42 ++---
>  .../drm/omapdrm/displays/panel-tpo-td028ttec1.c|  42 ++---
>  .../drm/omapdrm/displays/panel-tpo-td043mtea1.c|  44 +++--
>  14 files changed, 362 insertions(+), 447 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index d77e21fc26ad..f579bd9ce7cb 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -18,7 +18,6 @@
>  
>  struct panel_drv_data {
>   struct omap_dss_device dssdev;
> - struct omap_dss_device *in;
>  
>   struct device *dev;
>  
> @@ -45,40 +44,37 @@ static const struct videomode tvc_pal_vm = {
>  static int tvc_connect(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in;
> + struct omap_dss_device *src;
>   int r;
>  
> - in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> - if (IS_ERR(in)) {
> + src = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
> + if (IS_ERR(src)) {
>   dev_err(ddata->dev, "failed to find video source\n");
> - return PTR_ERR(in);
> + return PTR_ERR(src);
>   }
>  
> - r = omapdss_device_connect(in, dssdev);
> + r = omapdss_device_connect(src, dssdev);
>   if (r) {
> - omap_dss_put_device(in);
> + omap_dss_put_device(src);
>   return r;
>   }
>  
> - ddata->in = in;
>   return 0;
>  }
>  
>  static void tvc_disconnect(struct omap_dss_device *dssdev)
>  {
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *src = dssdev->src;
>  
> - omapdss_device_disconnect(in, dssdev);
> + omapdss_device_disconnect(src, dssdev);
>  
> - omap_dss_put_device(in);
> - ddata->in = NULL;
> + omap_dss_put_device(src);
>  }
>  
>  static int tvc_enable(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *src = dssdev->src;
>   int r;
>  
>   dev_dbg(ddata->dev, "enable\n");
> @@ -89,9 +85,9 @@ static int tvc_enable(struct omap_dss_device *dssdev)
>   if (omapdss_device_is_enabled(dssdev))
>   return 0;
>  
> - in->ops->set_timings(in, &ddata->vm);
> + src->ops->set_timings(src, &ddata->vm);
>  
> - r = in->ops->enable(in);
> + r = src->ops->enable(src);
>   if (r)
>   return r;
>  
> @@ -103,14 +99,14 @@ static int tvc_enable(struct omap_dss_device *dssdev)
>  static void tvc_disable(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *src = dssdev->src;
>  
>   dev_dbg(ddata->dev, "disable\n");
>  
>   if (!omapdss_device_is_enabled(dssdev))
>   return;
>  
> - in->ops->disable(in);
> + src->ops->disable(src);
>  
>   dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
>  }
> @@ -119,11 +115,11 @@ static void tvc_set_timings(struct omap_dss_device 
> *dssdev,
>   struct videomode *vm)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> + struct omap_dss_device *src = dssdev->src;
>  
>   ddata->vm = *vm;
>  
> - in->ops->set_timings(in, vm);
> + src->ops->set_timings(src, vm);
>  }
>  
>  static void tvc_get_timings(struct omap_dss_device *dssdev,
> @@ -137,10 +133,9 @@ static void tvc_get_timings(struct omap_dss_device 
> *dssdev,
> 

Re: [PATCH v2 22/60] drm/omap: dss: Move src and dst check and set to connection handlers

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:40PM +0300, Laurent Pinchart wrote:
> The encoders duplicate the same omap_dss_device src and dst fields set
> and checks in their connect and disconnect handlers. Move the code to
> the connect and disconnect wrappers.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  | 10 -
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  | 10 -
>  .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   | 11 --
>  drivers/gpu/drm/omapdrm/dss/base.c | 24 
> --
>  drivers/gpu/drm/omapdrm/dss/dpi.c  |  5 -
>  drivers/gpu/drm/omapdrm/dss/dsi.c  |  5 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c|  5 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c|  5 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  8 +++-
>  drivers/gpu/drm/omapdrm/dss/output.c   |  6 --
>  drivers/gpu/drm/omapdrm/dss/sdi.c  |  5 -
>  drivers/gpu/drm/omapdrm/dss/venc.c |  5 -
>  12 files changed, 25 insertions(+), 74 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 5b9ef09e6b2d..6baca0dc2b62 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -51,9 +51,6 @@ static int opa362_connect(struct omap_dss_device *dssdev,
>   return r;
>   }
>  
> - dst->src = dssdev;
> - dssdev->dst = dst;
> -
>   ddata->in = in;
>   return 0;
>  }
> @@ -64,13 +61,6 @@ static void opa362_disconnect(struct omap_dss_device 
> *dssdev,
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - WARN_ON(dst != dssdev->dst);
> - if (dst != dssdev->dst)
> - return;
> -
> - dst->src = NULL;
> - dssdev->dst = NULL;
> -
>   omapdss_device_disconnect(in, &ddata->dssdev);
>  
>   omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index b22c8f71c0e5..c1ae8bebf04d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -47,9 +47,6 @@ static int tfp410_connect(struct omap_dss_device *dssdev,
>   return r;
>   }
>  
> - dst->src = dssdev;
> - dssdev->dst = dst;
> -
>   ddata->in = in;
>   return 0;
>  }
> @@ -60,13 +57,6 @@ static void tfp410_disconnect(struct omap_dss_device 
> *dssdev,
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - WARN_ON(dst != dssdev->dst);
> - if (dst != dssdev->dst)
> - return;
> -
> - dst->src = NULL;
> - dssdev->dst = NULL;
> -
>   omapdss_device_disconnect(in, &ddata->dssdev);
>  
>   omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index 640f15b88467..8aa338d01bf7 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -55,9 +55,6 @@ static int tpd_connect(struct omap_dss_device *dssdev,
>   return r;
>   }
>  
> - dst->src = dssdev;
> - dssdev->dst = dst;
> -
>   gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
>   gpiod_set_value_cansleep(ddata->ls_oe_gpio, 1);
>  
> @@ -74,17 +71,9 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - WARN_ON(dst != dssdev->dst);
> -
> - if (dst != dssdev->dst)
> - return;
> -
>   gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
>   gpiod_set_value_cansleep(ddata->ls_oe_gpio, 0);
>  
> - dst->src = NULL;
> - dssdev->dst = NULL;
> -
>   omapdss_device_disconnect(in, &ddata->dssdev);
>  
>   omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 01c117d8775b..810dcddded8a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -105,15 +105,27 @@ struct omap_dss_device 
> *omapdss_find_device_by_port(struct device_node *src,
>  int omapdss_device_connect(struct omap_dss_device *src,
>  struct omap_dss_device *dst)
>  {
> + int ret;
> +
>   dev_dbg(src->dev, "connect\n");
>  
>   if (omapdss_device_is_connected(src))
>   return -EBUSY;
>  
>   if (src->driver)
> - return src->driver->connect(src);
> + ret = src->driver->connect(src);
>   else
> -

Re: [PATCH v2 21/60] drm/omap: dss: Move debug message and checks to connection handlers

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:39PM +0300, Laurent Pinchart wrote:
> The connectors, encoders and display duplicate the same debug messages
> and connection checks in their omap_dss_device connect and disconnect
> handlers. Move the code to the connect and disconnect wrappers.
> 
> To simplify the code the connect function returns -EBUSY unconditionally
> if the device is already connected. This doesn't cause any change in
> practice: the connect handler of displays is never called on a connected
> device as it is only invoked during omapdrm initialization.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  | 10 --
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c|  6 --
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   | 10 --
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c   | 11 ---
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c   |  7 ---
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c|  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c |  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c |  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  |  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c |  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c |  6 --
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c |  6 --
>  drivers/gpu/drm/omapdrm/dss/base.c  | 12 
>  14 files changed, 12 insertions(+), 92 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 41ba3c5dbe7d..d77e21fc26ad 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -48,11 +48,6 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>   struct omap_dss_device *in;
>   int r;
>  
> - dev_dbg(ddata->dev, "connect\n");
> -
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
>   in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
>   if (IS_ERR(in)) {
>   dev_err(ddata->dev, "failed to find video source\n");
> @@ -74,11 +69,6 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - dev_dbg(ddata->dev, "disconnect\n");
> -
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
>   omapdss_device_disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index f193bbda550c..9a3ecc3ed5b2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -63,9 +63,6 @@ static int dvic_connect(struct omap_dss_device *dssdev)
>   struct omap_dss_device *in;
>   int r;
>  
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
>   in = omapdss_of_find_source_for_first_ep(dssdev->dev->of_node);
>   if (IS_ERR(in)) {
>   dev_err(dssdev->dev, "failed to find video source\n");
> @@ -87,9 +84,6 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
>   omapdss_device_disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 014554afbb0d..665af9932317 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -58,11 +58,6 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
>   struct omap_dss_device *in;
>   int r;
>  
> - dev_dbg(ddata->dev, "connect\n");
> -
> - if (omapdss_device_is_connected(dssdev))
> - return 0;
> -
>   in = omapdss_of_find_source_for_first_ep(ddata->dev->of_node);
>   if (IS_ERR(in)) {
>   dev_err(ddata->dev, "failed to find video source\n");
> @@ -84,11 +79,6 @@ static void hdmic_disconnect(struct omap_dss_device 
> *dssdev)
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - dev_dbg(ddata->dev, "disconnect\n");
> -
> - if (!omapdss_device_is_connected(dssdev))
> - return;
> -
>   omapdss_device_disconnect(in, dssdev);

Re: [PATCH v2 20/60] drm/omap: dss: Add functions to connect and disconnect devices

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:38PM +0300, Laurent Pinchart wrote:
> The omap_dss_device objects model display components and are connected
> at runtime to create display pipelines. The connect and disconnect
> operations implemented by each component contain lots of duplicate code.
> As a first step towards fixing this, create new functions to wrap the
> direct calls to those operations and use them.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c   |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c|  4 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c|  4 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c|  4 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c |  4 ++--
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c  |  6 +++---
>  .../drm/omapdrm/displays/panel-lgphilips-lb035q02.c  |  4 ++--
>  .../gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c  |  4 ++--
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c   |  4 ++--
>  .../gpu/drm/omapdrm/displays/panel-sony-acx565akm.c  |  4 ++--
>  .../gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c  |  4 ++--
>  .../gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c  |  4 ++--
>  drivers/gpu/drm/omapdrm/dss/base.c   | 20 
> 
>  drivers/gpu/drm/omapdrm/dss/omapdss.h|  4 
>  drivers/gpu/drm/omapdrm/omap_drv.c   |  4 ++--
>  17 files changed, 55 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index a94868d9398b..41ba3c5dbe7d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -59,7 +59,7 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(in);
>   }
>  
> - r = in->ops->connect(in, dssdev);
> + r = omapdss_device_connect(in, dssdev);
>   if (r) {
>   omap_dss_put_device(in);
>   return r;
> @@ -79,7 +79,7 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
>   if (!omapdss_device_is_connected(dssdev))
>   return;
>  
> - in->ops->disconnect(in, dssdev);
> + omapdss_device_disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
>   ddata->in = NULL;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 021e3b651c89..f193bbda550c 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -72,7 +72,7 @@ static int dvic_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(in);
>   }
>  
> - r = in->ops->connect(in, dssdev);
> + r = omapdss_device_connect(in, dssdev);
>   if (r) {
>   omap_dss_put_device(in);
>   return r;
> @@ -90,7 +90,7 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
>   if (!omapdss_device_is_connected(dssdev))
>   return;
>  
> - in->ops->disconnect(in, dssdev);
> + omapdss_device_disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
>   ddata->in = NULL;
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index b528bd51ada3..014554afbb0d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -69,7 +69,7 @@ static int hdmic_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(in);
>   }
>  
> - r = in->ops->connect(in, dssdev);
> + r = omapdss_device_connect(in, dssdev);
>   if (r) {
>   omap_dss_put_device(in);
>   return r;
> @@ -89,7 +89,7 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev)
>   if (!omapdss_device_is_connected(dssdev))
>   return;
>  
> - in->ops->disconnect(in, dssdev);
> + omapdss_device_disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
>   ddata->in = NULL;
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 37982ffe0ad4..752b565987c1 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -50,7 +50,7 @@ static int opa362_connect(struct omap_dss_device *dssdev,
>   return PTR_ERR(in);
>   }
>  
> - r = in->ops->connect(in, dssdev);
> + r = omapdss_device_connect(in, dssdev);
>   if (r) {
>   omap_dss_put_device(in);
>   return r;
> @@ -82,7 +82,7 @@ static void opa362_d

Re: [PATCH v2 19/60] drm/omap: dss: Move common device operations to common structure

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:37PM +0300, Laurent Pinchart wrote:
> The various types of omapdss_*_ops structures define multiple operations
> that are not specific to a bus type. To simplify the code and remove
> dependencies on specific bus types move those operations to a common
> structure. Operations that are specific to a bus type are kept in the
> specialized ops structures.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c |  14 +--
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c   |  14 +--
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c  |  42 
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c  |  20 ++--
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c  |  20 ++--
>  .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c   |  48 -
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c   |  16 +--
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c| 120 
> ++---
>  .../omapdrm/displays/panel-lgphilips-lb035q02.c|  14 +--
>  .../drm/omapdrm/displays/panel-nec-nl8048hl11.c|  14 +--
>  .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c |  14 +--
>  .../drm/omapdrm/displays/panel-sony-acx565akm.c|  14 +--
>  .../drm/omapdrm/displays/panel-tpo-td028ttec1.c|  14 +--
>  .../drm/omapdrm/displays/panel-tpo-td043mtea1.c|  16 +--
>  drivers/gpu/drm/omapdrm/dss/dpi.c  |   4 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c  |  50 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c|  14 +--
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c|  12 ++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  | 109 ---
>  drivers/gpu/drm/omapdrm/dss/sdi.c  |   4 +-
>  drivers/gpu/drm/omapdrm/dss/venc.c |   4 +-
>  21 files changed, 256 insertions(+), 321 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 6b640ede6614..a94868d9398b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -59,7 +59,7 @@ static int tvc_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(in);
>   }
>  
> - r = in->ops.atv->connect(in, dssdev);
> + r = in->ops->connect(in, dssdev);
>   if (r) {
>   omap_dss_put_device(in);
>   return r;
> @@ -79,7 +79,7 @@ static void tvc_disconnect(struct omap_dss_device *dssdev)
>   if (!omapdss_device_is_connected(dssdev))
>   return;
>  
> - in->ops.atv->disconnect(in, dssdev);
> + in->ops->disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
>   ddata->in = NULL;
> @@ -99,9 +99,9 @@ static int tvc_enable(struct omap_dss_device *dssdev)
>   if (omapdss_device_is_enabled(dssdev))
>   return 0;
>  
> - in->ops.atv->set_timings(in, &ddata->vm);
> + in->ops->set_timings(in, &ddata->vm);
>  
> - r = in->ops.atv->enable(in);
> + r = in->ops->enable(in);
>   if (r)
>   return r;
>  
> @@ -120,7 +120,7 @@ static void tvc_disable(struct omap_dss_device *dssdev)
>   if (!omapdss_device_is_enabled(dssdev))
>   return;
>  
> - in->ops.atv->disable(in);
> + in->ops->disable(in);
>  
>   dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
>  }
> @@ -133,7 +133,7 @@ static void tvc_set_timings(struct omap_dss_device 
> *dssdev,
>  
>   ddata->vm = *vm;
>  
> - in->ops.atv->set_timings(in, vm);
> + in->ops->set_timings(in, vm);
>  }
>  
>  static void tvc_get_timings(struct omap_dss_device *dssdev,
> @@ -150,7 +150,7 @@ static int tvc_check_timings(struct omap_dss_device 
> *dssdev,
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   struct omap_dss_device *in = ddata->in;
>  
> - return in->ops.atv->check_timings(in, vm);
> + return in->ops->check_timings(in, vm);
>  }
>  
>  static const struct omap_dss_driver tvc_driver = {
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 84598ea12a9b..021e3b651c89 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -72,7 +72,7 @@ static int dvic_connect(struct omap_dss_device *dssdev)
>   return PTR_ERR(in);
>   }
>  
> - r = in->ops.dvi->connect(in, dssdev);
> + r = in->ops->connect(in, dssdev);
>   if (r) {
>   omap_dss_put_device(in);
>   return r;
> @@ -90,7 +90,7 @@ static void dvic_disconnect(struct omap_dss_device *dssdev)
>   if (!omapdss_device_is_connected(dssdev))
>   return;
>  
> - in->ops.dvi->disconnect(in, dssdev);
> + in->ops->disconnect(in, dssdev);
>  
>   omap_dss_put_device(in);
>   ddata->in = NULL;
> @@ 

Re: [PATCH v2 18/60] drm/omap: dss: Allow looking up any device by port

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:36PM +0300, Laurent Pinchart wrote:
> The omap_dss_find_output_by_port() function looks up an omap_dss_device
> by port from the list of devices registered as outputs. In preparation
> for looking up sinks in addition to sources, allow the function to look
> up any registered device. Rename it to omap_dss_find_device_by_port() to
> match its new purpose.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/base.c| 13 +
>  drivers/gpu/drm/omapdrm/dss/dss-of.c  |  2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 ++--
>  drivers/gpu/drm/omapdrm/dss/output.c  | 13 -
>  4 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 63fe0a717884..df6cb1ac43c8 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -89,6 +89,19 @@ static bool omapdss_device_is_registered(struct 
> device_node *node)
>   return found;
>  }
>  
> +struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
> + unsigned int port)
> +{
> + struct omap_dss_device *dssdev;
> +
> + list_for_each_entry(dssdev, &omapdss_devices_list, list) {
> + if (dssdev->dev->of_node == src && dssdev->port_num == port)
> + return omap_dss_get_device(dssdev);
> + }
> +
> + return NULL;
> +}
> +
>  /* 
> -
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c 
> b/drivers/gpu/drm/omapdrm/dss/dss-of.c
> index b51af09e9111..771b20db2d98 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss-of.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c
> @@ -74,7 +74,7 @@ omapdss_of_find_source_for_first_ep(struct device_node 
> *node)
>   return NULL;
>  
>   /* ... and finally the source. */
> - src = omap_dss_find_output_by_port(src_node, port_number);
> + src = omapdss_find_device_by_port(src_node, port_number);
>   of_node_put(src_node);
>  
>   return src ? src : ERR_PTR(-EPROBE_DEFER);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index ff0f603bce76..2ec74206bcff 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -563,6 +563,8 @@ void omapdss_unregister_display(struct omap_dss_device 
> *dssdev);
>  
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
> +struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
> + unsigned int port);
>  
>  struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
>  void omap_dss_put_device(struct omap_dss_device *dssdev);
> @@ -576,8 +578,6 @@ int omap_dss_get_num_overlays(void);
>  int omapdss_register_output(struct omap_dss_device *output);
>  void omapdss_unregister_output(struct omap_dss_device *output);
>  struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
> -struct omap_dss_device *omap_dss_find_output_by_port(struct device_node *src,
> -  unsigned int port);
>  int omapdss_output_set_device(struct omap_dss_device *out,
>   struct omap_dss_device *dssdev);
>  int omapdss_output_unset_device(struct omap_dss_device *out);
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index be254ea42e08..e659c8e5c419 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -122,19 +122,6 @@ struct omap_dss_device *omap_dss_get_output(enum 
> omap_dss_output_id id)
>  }
>  EXPORT_SYMBOL(omap_dss_get_output);
>  
> -struct omap_dss_device *omap_dss_find_output_by_port(struct device_node *src,
> -  unsigned int port)
> -{
> - struct omap_dss_device *out;
> -
> - list_for_each_entry(out, &output_list, output_list) {
> - if (out->dev->of_node == src && out->port_num == port)
> - return omap_dss_get_device(out);
> - }
> -
> - return NULL;
> -}
> -
>  struct omap_dss_device *omapdss_find_output_from_display(struct 
> omap_dss_device *dssdev)
>  {
>   while (dssdev->src)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 17/60] drm/omap: dss: Rework output lookup by port node

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:35PM +0300, Laurent Pinchart wrote:
> The omap_dss_find_output_by_port_node() function defined in output.c
> looks up an output from its port node. To do so it needs to call helper
> functions from dss-of.c to lookup the port parent and the port number.
> As omap_dss_find_output_by_port_node() is only called by
> omapdss_of_find_source_for_first_ep() from dss-of.c this goes back and
> forth between the to source files and isn't very clear.
> 
> Simplify the code by passing both the parent and the port number to
> omap_dss_find_output_by_port_node() instead of the port node, and rename
> the function to omap_dss_find_output_by_port().
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss-of.c  | 39 
> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 ++
>  drivers/gpu/drm/omapdrm/dss/output.c  | 17 +++
>  3 files changed, 23 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss-of.c 
> b/drivers/gpu/drm/omapdrm/dss/dss-of.c
> index 4602a79c6c44..b51af09e9111 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss-of.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss-of.c
> @@ -21,7 +21,8 @@
>  
>  #include "omapdss.h"
>  
> -struct device_node *dss_of_port_get_parent_device(struct device_node *port)
> +static struct device_node *
> +dss_of_port_get_parent_device(struct device_node *port)
>  {
>   struct device_node *np;
>   int i;
> @@ -45,40 +46,36 @@ struct device_node *dss_of_port_get_parent_device(struct 
> device_node *port)
>   return NULL;
>  }
>  
> -u32 dss_of_port_get_port_number(struct device_node *port)
> -{
> - int r;
> - u32 reg;
> -
> - r = of_property_read_u32(port, "reg", ®);
> - if (r)
> - reg = 0;
> -
> - return reg;
> -}
> -
>  struct omap_dss_device *
>  omapdss_of_find_source_for_first_ep(struct device_node *node)
>  {
> - struct device_node *ep;
> + struct device_node *src_node;
>   struct device_node *src_port;
> + struct device_node *ep;
>   struct omap_dss_device *src;
> + u32 port_number = 0;
>  
> + /* Get the endpoint... */
>   ep = of_graph_get_endpoint_by_regs(node, 0, 0);
>   if (!ep)
>   return ERR_PTR(-EINVAL);
>  
> + /* ... and its remote port... */
>   src_port = of_graph_get_remote_port(ep);
> - if (!src_port) {
> - of_node_put(ep);
> - return ERR_PTR(-EINVAL);
> - }
> -
>   of_node_put(ep);
> + if (!src_port)
> + return ERR_PTR(-EINVAL);
>  
> - src = omap_dss_find_output_by_port_node(src_port);
> -
> + /* ... and the remote port's number and parent... */
> + of_property_read_u32(src_port, "reg", &port_number);
> + src_node = dss_of_port_get_parent_device(src_port);
>   of_node_put(src_port);
> + if (!src_node)
> + return NULL;
> +
> + /* ... and finally the source. */
> + src = omap_dss_find_output_by_port(src_node, port_number);
> + of_node_put(src_node);
>  
>   return src ? src : ERR_PTR(-EPROBE_DEFER);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 1ccf0c67d308..ff0f603bce76 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -576,7 +576,8 @@ int omap_dss_get_num_overlays(void);
>  int omapdss_register_output(struct omap_dss_device *output);
>  void omapdss_unregister_output(struct omap_dss_device *output);
>  struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
> -struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node 
> *port);
> +struct omap_dss_device *omap_dss_find_output_by_port(struct device_node *src,
> +  unsigned int port);
>  int omapdss_output_set_device(struct omap_dss_device *out,
>   struct omap_dss_device *dssdev);
>  int omapdss_output_unset_device(struct omap_dss_device *out);
> @@ -603,9 +604,6 @@ static inline bool omapdss_device_is_enabled(struct 
> omap_dss_device *dssdev)
>  struct omap_dss_device *
>  omapdss_of_find_source_for_first_ep(struct device_node *node);
>  
> -struct device_node *dss_of_port_get_parent_device(struct device_node *port);
> -u32 dss_of_port_get_port_number(struct device_node *port);
> -
>  enum dss_writeback_channel {
>   DSS_WB_LCD1_MGR =   0,
>   DSS_WB_LCD2_MGR =   1,
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index 7f18153a1bde..be254ea42e08 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -122,27 +122,16 @@ struct omap_dss_device *omap_dss_get_output(enum 
> omap_dss_output_id id)
>  }
>  EXPORT_SYMBOL(omap_dss_get_output);
>  
> -struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node 
> *port)
> 

Re: [PATCH v2 16/60] drm/omap: dss: Create and use omapdss_device_is_registered()

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:34PM +0300, Laurent Pinchart wrote:
> The omapdss_component_is_loaded() function test whether a component is
> loaded by checking whether it is present in the displays list or the
> outputs list. Simplify the implementation by checking for the component
> in the global omap_dss_device list.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/base.c| 22 +++---
>  drivers/gpu/drm/omapdrm/dss/display.c | 18 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 ---
>  drivers/gpu/drm/omapdrm/dss/output.c  | 13 -
>  4 files changed, 19 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 18b72d7c717a..63fe0a717884 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -71,6 +71,24 @@ void omapdss_device_unregister(struct omap_dss_device 
> *dssdev)
>   mutex_unlock(&omapdss_devices_lock);
>  }
>  
> +static bool omapdss_device_is_registered(struct device_node *node)
> +{
> + struct omap_dss_device *dssdev;
> + bool found = false;
> +
> + mutex_lock(&omapdss_devices_lock);
> +
> + list_for_each_entry(dssdev, &omapdss_devices_list, list) {
> + if (dssdev->dev->of_node == node) {
> + found = true;
> + break;
> + }
> + }
> +
> + mutex_unlock(&omapdss_devices_lock);
> + return found;
> +}
> +
>  /* 
> -
>   * Components Handling
>   */
> @@ -157,9 +175,7 @@ static bool omapdss_component_is_loaded(struct 
> omapdss_comp_node *comp)
>  {
>   if (comp->dss_core_component)
>   return true;
> - if (omapdss_component_is_display(comp->node))
> - return true;
> - if (omapdss_component_is_output(comp->node))
> + if (omapdss_device_is_registered(comp->node))
>   return true;
>  
>   return false;
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index eacbbf45f737..383512c8a466 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -72,24 +72,6 @@ void omapdss_unregister_display(struct omap_dss_device 
> *dssdev)
>  }
>  EXPORT_SYMBOL(omapdss_unregister_display);
>  
> -bool omapdss_component_is_display(struct device_node *node)
> -{
> - struct omap_dss_device *dssdev;
> - bool found = false;
> -
> - mutex_lock(&panel_list_mutex);
> - list_for_each_entry(dssdev, &panel_list, panel_list) {
> - if (dssdev->dev->of_node == node) {
> - found = true;
> - goto out;
> - }
> - }
> -out:
> - mutex_unlock(&panel_list_mutex);
> - return found;
> -}
> -EXPORT_SYMBOL(omapdss_component_is_display);
> -
>  struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev)
>  {
>   if (!try_module_get(dssdev->owner))
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index e029613509a1..1ccf0c67d308 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -737,9 +737,6 @@ struct dispc_ops {
>  struct dispc_device *dispc_get_dispc(struct dss_device *dss);
>  const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
>  
> -bool omapdss_component_is_display(struct device_node *node);
> -bool omapdss_component_is_output(struct device_node *node);
> -
>  bool omapdss_stack_is_ready(void);
>  void omapdss_gather_components(struct device *dev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index 1a2d24906edd..7f18153a1bde 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -109,19 +109,6 @@ void omapdss_unregister_output(struct omap_dss_device 
> *out)
>  }
>  EXPORT_SYMBOL(omapdss_unregister_output);
>  
> -bool omapdss_component_is_output(struct device_node *node)
> -{
> - struct omap_dss_device *out;
> -
> - list_for_each_entry(out, &output_list, output_list) {
> - if (out->dev->of_node == node)
> - return true;
> - }
> -
> - return false;
> -}
> -EXPORT_SYMBOL(omapdss_component_is_output);
> -
>  struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id)
>  {
>   struct omap_dss_device *out;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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

Re: [PATCH v2 15/60] drm/omap: dss: Create global list of all omap_dss_device instances

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:33PM +0300, Laurent Pinchart wrote:
> The omap_dss_device instances are stored in two separate lists,
> depending on whether they are panels or outputs. Create a third list
> that stores all omap_dss_device instances to allow generic code to
> operate on all instances.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/base.c| 45 
> ---
>  drivers/gpu/drm/omapdrm/dss/display.c |  4 
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 
>  drivers/gpu/drm/omapdrm/dss/output.c  |  2 ++
>  4 files changed, 46 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 99e8cb8dc65b..18b72d7c717a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -14,24 +14,17 @@
>   */
>  
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
> -#include 
>  
>  #include "dss.h"
>  #include "omapdss.h"
>  
>  static struct dss_device *dss_device;
>  
> -static struct list_head omapdss_comp_list;
> -
> -struct omapdss_comp_node {
> - struct list_head list;
> - struct device_node *node;
> - bool dss_core_component;
> -};
> -
>  struct dss_device *omapdss_get_dss(void)
>  {
>   return dss_device;
> @@ -56,6 +49,40 @@ const struct dispc_ops *dispc_get_ops(struct dss_device 
> *dss)
>  }
>  EXPORT_SYMBOL(dispc_get_ops);
>  
> +
> +/* 
> -
> + * OMAP DSS Devices Handling
> + */
> +
> +static LIST_HEAD(omapdss_devices_list);
> +static DEFINE_MUTEX(omapdss_devices_lock);
> +
> +void omapdss_device_register(struct omap_dss_device *dssdev)
> +{
> + mutex_lock(&omapdss_devices_lock);
> + list_add_tail(&dssdev->list, &omapdss_devices_list);
> + mutex_unlock(&omapdss_devices_lock);
> +}
> +
> +void omapdss_device_unregister(struct omap_dss_device *dssdev)
> +{
> + mutex_lock(&omapdss_devices_lock);
> + list_del(&dssdev->list);
> + mutex_unlock(&omapdss_devices_lock);
> +}
> +
> +/* 
> -
> + * Components Handling
> + */
> +
> +static struct list_head omapdss_comp_list;
> +
> +struct omapdss_comp_node {
> + struct list_head list;
> + struct device_node *node;
> + bool dss_core_component;
> +};
> +
>  static bool omapdss_list_contains(const struct device_node *node)
>  {
>   struct omapdss_comp_node *comp;
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index e07e3319d6e0..eacbbf45f737 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -56,6 +56,8 @@ int omapdss_register_display(struct omap_dss_device *dssdev)
>   mutex_lock(&panel_list_mutex);
>   list_add_tail(&dssdev->panel_list, &panel_list);
>   mutex_unlock(&panel_list_mutex);
> +
> + omapdss_device_register(dssdev);
>   return 0;
>  }
>  EXPORT_SYMBOL(omapdss_register_display);
> @@ -65,6 +67,8 @@ void omapdss_unregister_display(struct omap_dss_device 
> *dssdev)
>   mutex_lock(&panel_list_mutex);
>   list_del(&dssdev->panel_list);
>   mutex_unlock(&panel_list_mutex);
> +
> + omapdss_device_register(dssdev);
>  }
>  EXPORT_SYMBOL(omapdss_unregister_display);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index abf101bb27ea..e029613509a1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -450,6 +450,7 @@ struct omap_dss_device {
>  
>   struct module *owner;
>  
> + struct list_head list;
>   struct list_head panel_list;
>  
>   unsigned int alias_id;
> @@ -560,6 +561,9 @@ static inline bool omapdss_is_initialized(void)
>  int omapdss_register_display(struct omap_dss_device *dssdev);
>  void omapdss_unregister_display(struct omap_dss_device *dssdev);
>  
> +void omapdss_device_register(struct omap_dss_device *dssdev);
> +void omapdss_device_unregister(struct omap_dss_device *dssdev);
> +
>  struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
>  void omap_dss_put_device(struct omap_dss_device *dssdev);
>  #define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index 0fcd13ea8824..1a2d24906edd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -97,6 +97,7 @@ EXPORT_SYMBOL(omapdss_output_unset_device);
>  int omapdss_register_output(struct omap_dss_device *out)
>  {
>   list_add_tail(&out->output_list, &output_list);
> + omapdss_device_register(out);
>   return 0;
>  }
>  EXPORT_SYMBOL(omapdss_register_output);
> @@ -104,6 +105,7 @@ EXPORT_SYMBO

Re: [PATCH v2 14/60] drm/omap: dss: Rename omap_dss_device list field to output_list

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:32PM +0300, Laurent Pinchart wrote:
> For coherency with the panel_list field, rename list to output_list.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 +-
>  drivers/gpu/drm/omapdrm/dss/output.c  | 10 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 39e2906fd5fe..abf101bb27ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -481,7 +481,7 @@ struct omap_dss_device {
>  
>   /* OMAP DSS output specific fields */
>  
> - struct list_head list;
> + struct list_head output_list;
>  
>   /* DISPC channel for this output */
>   enum omap_channel dispc_channel;
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index 96b9d4cd505f..0fcd13ea8824 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -96,14 +96,14 @@ EXPORT_SYMBOL(omapdss_output_unset_device);
>  
>  int omapdss_register_output(struct omap_dss_device *out)
>  {
> - list_add_tail(&out->list, &output_list);
> + list_add_tail(&out->output_list, &output_list);
>   return 0;
>  }
>  EXPORT_SYMBOL(omapdss_register_output);
>  
>  void omapdss_unregister_output(struct omap_dss_device *out)
>  {
> - list_del(&out->list);
> + list_del(&out->output_list);
>  }
>  EXPORT_SYMBOL(omapdss_unregister_output);
>  
> @@ -111,7 +111,7 @@ bool omapdss_component_is_output(struct device_node *node)
>  {
>   struct omap_dss_device *out;
>  
> - list_for_each_entry(out, &output_list, list) {
> + list_for_each_entry(out, &output_list, output_list) {
>   if (out->dev->of_node == node)
>   return true;
>   }
> @@ -124,7 +124,7 @@ struct omap_dss_device *omap_dss_get_output(enum 
> omap_dss_output_id id)
>  {
>   struct omap_dss_device *out;
>  
> - list_for_each_entry(out, &output_list, list) {
> + list_for_each_entry(out, &output_list, output_list) {
>   if (out->id == id)
>   return out;
>   }
> @@ -145,7 +145,7 @@ struct omap_dss_device 
> *omap_dss_find_output_by_port_node(struct device_node *po
>  
>   reg = dss_of_port_get_port_number(port);
>  
> - list_for_each_entry(out, &output_list, list) {
> + list_for_each_entry(out, &output_list, output_list) {
>   if (out->dev->of_node == src_node && out->port_num == reg) {
>   of_node_put(src_node);
>   return omap_dss_get_device(out);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 13/60] drm/omap: dss: Remove omap_dss_device panel fields

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:31PM +0300, Laurent Pinchart wrote:
> The omap_dss_device panel.dsi_pix_fmt and panel.dsi_mode fields are
> unused. Remove them.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   | 5 -
>  2 files changed, 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 555ab2ac5576..8d98cd628e11 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -1333,7 +1333,6 @@ static int dsicm_probe(struct platform_device *pdev)
>   dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>   dssdev->owner = THIS_MODULE;
>  
> - dssdev->panel.dsi_pix_fmt = OMAP_DSS_DSI_FMT_RGB888;
>   dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
>   OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a93afbbe19de..39e2906fd5fe 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -457,11 +457,6 @@ struct omap_dss_device {
>   enum omap_display_type type;
>   enum omap_display_type output_type;
>  
> - struct {
> - enum omap_dss_dsi_pixel_format dsi_pix_fmt;
> - enum omap_dss_dsi_mode dsi_mode;
> - } panel;
> -
>   const char *name;
>  
>   const struct omap_dss_driver *driver;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 12/60] drm/omap: displays: Remove videomode from omap_dss_device structure

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:30PM +0300, Laurent Pinchart wrote:
> The omap_dss_device structure stores a videomode. All the connector and
> panel drivers that use omap_dss_device also store the videomode in their
> own panel_drv_data structures. There's no need to duplicate, remove the
> videomode field from omap_dss_device.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  | 2 --
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c| 2 --
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   | 2 --
>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c   | 1 -
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c   | 1 -
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c| 1 -
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c| 2 --
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 +++-
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 2 --
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | 2 --
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  | 2 --
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | 2 --
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 2 --
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c | 2 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   | 2 --
>  15 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index a49bc4a8dcae..6b640ede6614 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -132,7 +132,6 @@ static void tvc_set_timings(struct omap_dss_device 
> *dssdev,
>   struct omap_dss_device *in = ddata->in;
>  
>   ddata->vm = *vm;
> - dssdev->panel.vm = *vm;
>  
>   in->ops.atv->set_timings(in, vm);
>  }
> @@ -186,7 +185,6 @@ static int tvc_probe(struct platform_device *pdev)
>   dssdev->dev = &pdev->dev;
>   dssdev->type = OMAP_DISPLAY_TYPE_VENC;
>   dssdev->owner = THIS_MODULE;
> - dssdev->panel.vm = tvc_pal_vm;
>  
>   r = omapdss_register_display(dssdev);
>   if (r) {
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index c320f3c5ae6c..84598ea12a9b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -139,7 +139,6 @@ static void dvic_set_timings(struct omap_dss_device 
> *dssdev,
>   struct omap_dss_device *in = ddata->in;
>  
>   ddata->vm = *vm;
> - dssdev->panel.vm = *vm;
>  
>   in->ops.dvi->set_timings(in, vm);
>  }
> @@ -403,7 +402,6 @@ static int dvic_probe(struct platform_device *pdev)
>   dssdev->dev = &pdev->dev;
>   dssdev->type = OMAP_DISPLAY_TYPE_DVI;
>   dssdev->owner = THIS_MODULE;
> - dssdev->panel.vm = dvic_default_vm;
>  
>   r = omapdss_register_display(dssdev);
>   if (r) {
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index 6f12f9bb8054..e031280468fb 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -142,7 +142,6 @@ static void hdmic_set_timings(struct omap_dss_device 
> *dssdev,
>   struct omap_dss_device *in = ddata->in;
>  
>   ddata->vm = *vm;
> - dssdev->panel.vm = *vm;
>  
>   in->ops.hdmi->set_timings(in, vm);
>  }
> @@ -368,7 +367,6 @@ static int hdmic_probe(struct platform_device *pdev)
>   dssdev->dev = &pdev->dev;
>   dssdev->type = OMAP_DISPLAY_TYPE_HDMI;
>   dssdev->owner = THIS_MODULE;
> - dssdev->panel.vm = hdmic_default_vm;
>  
>   r = omapdss_register_display(dssdev);
>   if (r) {
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index 27d63a14efe3..0e3f4a20e531 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -143,7 +143,6 @@ static void opa362_set_timings(struct omap_dss_device 
> *dssdev,
>   dev_dbg(dssdev->dev, "set_timings\n");
>  
>   ddata->vm = *vm;
> - dssdev->panel.vm = *vm;
>  
>   in->ops.atv->set_timings(in, vm);
>  }
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index 566c63a3ad59..08e63e39d0b7 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -137,7 +137,6 @@ static void tfp410_set_timings(struct omap_dss_device 
> *dssdev,
>   tfp410_fix_timings(vm);
>  
>   ddata->vm = *vm;
> - dssdev->pa

[Bug 97909] X-Plane 10 crashes with SIGSEGV on radeonsi

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=97909

--- Comment #16 from Joonas Sarajärvi  ---
Now that I tried removing the workaround again, it looks like things still work
for me. So now at least one working combination that does not trigger this bug
looks like this:

- Fedora 28
- kernel 4.16.14-300.fc28.x86_64
- mesa 18.0.2
- x-plane 11.21

Compared to my earlier report, all the bits have changed their versions. Does
anyone have any idea on if this was addressed in the driver stack or if it is
actually X-plane behaving nicer?

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


Re: [PATCH v2 11/60] drm/omap: dss: Constify omap_dss_driver operations structure

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:29PM +0300, Laurent Pinchart wrote:
> The structure contains function pointers that don't need to be modified.
> Make all its instances const to improve security.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c  | 2 +-
>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c| 2 +-
>  drivers/gpu/drm/omapdrm/displays/connector-hdmi.c   | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dpi.c| 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c  | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c | 2 +-
>  drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c | 2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   | 2 +-
>  drivers/gpu/drm/omapdrm/omap_connector.c| 6 +++---
>  drivers/gpu/drm/omapdrm/omap_encoder.c  | 6 +++---
>  14 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 5fdecc12b608..a49bc4a8dcae 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -154,7 +154,7 @@ static int tvc_check_timings(struct omap_dss_device 
> *dssdev,
>   return in->ops.atv->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver tvc_driver = {
> +static const struct omap_dss_driver tvc_driver = {
>   .connect= tvc_connect,
>   .disconnect = tvc_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 6d8cbd9e2110..c320f3c5ae6c 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -297,7 +297,7 @@ static void dvic_disable_hpd(struct omap_dss_device 
> *dssdev)
>   mutex_unlock(&ddata->hpd_lock);
>  }
>  
> -static struct omap_dss_driver dvic_driver = {
> +static const struct omap_dss_driver dvic_driver = {
>   .connect= dvic_connect,
>   .disconnect = dvic_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> index ca30ed9da7eb..6f12f9bb8054 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
> @@ -269,7 +269,7 @@ static int hdmic_set_infoframe(struct omap_dss_device 
> *dssdev,
>   return in->ops.hdmi->set_infoframe(in, avi);
>  }
>  
> -static struct omap_dss_driver hdmic_driver = {
> +static const struct omap_dss_driver hdmic_driver = {
>   .connect= hdmic_connect,
>   .disconnect = hdmic_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> index 6cbf570d6727..e874f0b72798 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
> @@ -153,7 +153,7 @@ static int panel_dpi_check_timings(struct omap_dss_device 
> *dssdev,
>   return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver panel_dpi_ops = {
> +static const struct omap_dss_driver panel_dpi_ops = {
>   .connect= panel_dpi_connect,
>   .disconnect = panel_dpi_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 428de90fced1..d7c57d84d7bd 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -1210,7 +1210,7 @@ static void dsicm_get_size(struct omap_dss_device 
> *dssdev,
>   *height = ddata->height_mm;
>  }
>  
> -static struct omap_dss_driver dsicm_ops = {
> +static const struct omap_dss_driver dsicm_ops = {
>   .connect= dsicm_connect,
>   .disconnect = dsicm_disconnect,
>  
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> index 754197099440..ad98d2ffcf1b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
> @@ -228,7 +228,7 @@ static int lb035q02_check_timings(struct omap_dss_device 
> *dssdev,
>   return in->ops.dpi->check_timings(in, vm);
>  }
>  
> -static struct omap_dss_driver lb035q02_ops = {
> +static const struct omap_dss_driver lb035q02_ops =

Re: [PATCH v2 10/60] drm/omap: dss: Remove unused omapdss_default_get_timings()

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:28PM +0300, Laurent Pinchart wrote:
> All omap_dss_driver instances provide the get_timings operation. Remove
> the default function.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/display.c | 10 --
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index 25c3be86d7f4..e07e3319d6e0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -28,19 +28,12 @@
>  
>  #include "omapdss.h"
>  
> -static void omapdss_default_get_timings(struct omap_dss_device *dssdev,
> - struct videomode *vm)
> -{
> - *vm = dssdev->panel.vm;
> -}
> -
>  static LIST_HEAD(panel_list);
>  static DEFINE_MUTEX(panel_list_mutex);
>  static int disp_num_counter;
>  
>  int omapdss_register_display(struct omap_dss_device *dssdev)
>  {
> - struct omap_dss_driver *drv = dssdev->driver;
>   int id;
>  
>   /*
> @@ -60,9 +53,6 @@ int omapdss_register_display(struct omap_dss_device *dssdev)
>   dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
> "display%u", id);
>  
> - if (drv && drv->get_timings == NULL)
> - drv->get_timings = omapdss_default_get_timings;
> -
>   mutex_lock(&panel_list_mutex);
>   list_add_tail(&dssdev->panel_list, &panel_list);
>   mutex_unlock(&panel_list_mutex);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 09/60] drm/omap: dss: Remove DSS encoders get_timings operation

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:27PM +0300, Laurent Pinchart wrote:
> The get_timings operation from DSS encoders (not to be confused with the
> identically named operation in omap_dss_driver) is never called. Remove
> it.
> 
> Signed-off-by: Laurent Pinchart 
> ---

good catch!

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/encoder-opa362.c| 11 ---
>  drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c|  9 -
>  drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c |  9 -
>  drivers/gpu/drm/omapdrm/dss/dpi.c| 13 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c  |  9 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c  |  9 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h| 10 --
>  drivers/gpu/drm/omapdrm/dss/sdi.c|  9 -
>  drivers/gpu/drm/omapdrm/dss/venc.c   | 13 -
>  9 files changed, 92 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> index afee1b8b457a..27d63a14efe3 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
> @@ -148,16 +148,6 @@ static void opa362_set_timings(struct omap_dss_device 
> *dssdev,
>   in->ops.atv->set_timings(in, vm);
>  }
>  
> -static void opa362_get_timings(struct omap_dss_device *dssdev,
> -struct videomode *vm)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> -
> - dev_dbg(dssdev->dev, "get_timings\n");
> -
> - *vm = ddata->vm;
> -}
> -
>  static int opa362_check_timings(struct omap_dss_device *dssdev,
>   struct videomode *vm)
>  {
> @@ -178,7 +168,6 @@ static const struct omapdss_atv_ops opa362_atv_ops = {
>  
>   .check_timings  = opa362_check_timings,
>   .set_timings= opa362_set_timings,
> - .get_timings= opa362_get_timings,
>  };
>  
>  static int opa362_probe(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> index ed7ae384c3ed..566c63a3ad59 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
> @@ -142,14 +142,6 @@ static void tfp410_set_timings(struct omap_dss_device 
> *dssdev,
>   in->ops.dpi->set_timings(in, vm);
>  }
>  
> -static void tfp410_get_timings(struct omap_dss_device *dssdev,
> -struct videomode *vm)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> -
> - *vm = ddata->vm;
> -}
> -
>  static int tfp410_check_timings(struct omap_dss_device *dssdev,
>   struct videomode *vm)
>  {
> @@ -170,7 +162,6 @@ static const struct omapdss_dvi_ops tfp410_dvi_ops = {
>  
>   .check_timings  = tfp410_check_timings,
>   .set_timings= tfp410_set_timings,
> - .get_timings= tfp410_get_timings,
>  };
>  
>  static int tfp410_probe_of(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c 
> b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> index d275bf152da5..4753e5455f82 100644
> --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
> @@ -136,14 +136,6 @@ static void tpd_set_timings(struct omap_dss_device 
> *dssdev,
>   in->ops.hdmi->set_timings(in, vm);
>  }
>  
> -static void tpd_get_timings(struct omap_dss_device *dssdev,
> - struct videomode *vm)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> -
> - *vm = ddata->vm;
> -}
> -
>  static int tpd_check_timings(struct omap_dss_device *dssdev,
>struct videomode *vm)
>  {
> @@ -249,7 +241,6 @@ static const struct omapdss_hdmi_ops tpd_hdmi_ops = {
>  
>   .check_timings  = tpd_check_timings,
>   .set_timings= tpd_set_timings,
> - .get_timings= tpd_get_timings,
>  
>   .read_edid  = tpd_read_edid,
>   .detect = tpd_detect,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 3d662e6805eb..af002c57a41d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -491,18 +491,6 @@ static void dpi_set_timings(struct omap_dss_device 
> *dssdev,
>   mutex_unlock(&dpi->lock);
>  }
>  
> -static void dpi_get_timings(struct omap_dss_device *dssdev,
> - struct videomode *vm)
> -{
> - struct dpi_data *dpi = dpi_get_data_from_dssdev(dssdev);
> -
> - mutex_lock(&dpi->lock);
> -
> - *vm = dpi->vm;
> -
> - mutex_unlock(&dpi->lock);
> -}
> -
>  static int dpi_check_timings(struct omap_dss_device *dssdev,
>

Re: [PATCH v2 08/60] drm/omap: dss: Remove omapdss_atv_ops get_wss and set_wss operations

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:26PM +0300, Laurent Pinchart wrote:
> The operations are never used, remove them. If the need to set wide
> screen signaling data arises later, it should be implemented by
> extending the DRM bridge API.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  .../gpu/drm/omapdrm/displays/connector-analog-tv.c | 19 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  6 
>  drivers/gpu/drm/omapdrm/dss/venc.c | 41 
> --
>  3 files changed, 66 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> index 9eabd7201a12..5fdecc12b608 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
> @@ -154,22 +154,6 @@ static int tvc_check_timings(struct omap_dss_device 
> *dssdev,
>   return in->ops.atv->check_timings(in, vm);
>  }
>  
> -static u32 tvc_get_wss(struct omap_dss_device *dssdev)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> -
> - return in->ops.atv->get_wss(in);
> -}
> -
> -static int tvc_set_wss(struct omap_dss_device *dssdev, u32 wss)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *in = ddata->in;
> -
> - return in->ops.atv->set_wss(in, wss);
> -}
> -
>  static struct omap_dss_driver tvc_driver = {
>   .connect= tvc_connect,
>   .disconnect = tvc_disconnect,
> @@ -180,9 +164,6 @@ static struct omap_dss_driver tvc_driver = {
>   .set_timings= tvc_set_timings,
>   .get_timings= tvc_get_timings,
>   .check_timings  = tvc_check_timings,
> -
> - .get_wss= tvc_get_wss,
> - .set_wss= tvc_set_wss,
>  };
>  
>  static int tvc_probe(struct platform_device *pdev)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 8d530057a4b9..67db0ea272f3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -362,9 +362,6 @@ struct omapdss_atv_ops {
>   struct videomode *vm);
>   void (*get_timings)(struct omap_dss_device *dssdev,
>   struct videomode *vm);
> -
> - int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
> - u32 (*get_wss)(struct omap_dss_device *dssdev);
>  };
>  
>  struct omapdss_hdmi_ops {
> @@ -554,9 +551,6 @@ struct omap_dss_driver {
>   void (*get_size)(struct omap_dss_device *dssdev,
>unsigned int *width, unsigned int *height);
>  
> - int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
> - u32 (*get_wss)(struct omap_dss_device *dssdev);
> -
>   int (*read_edid)(struct omap_dss_device *dssdev, u8 *buf, int len);
>   bool (*detect)(struct omap_dss_device *dssdev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
> b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 24d1ced210bd..3f4b8a181d74 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -626,44 +626,6 @@ static void venc_get_timings(struct omap_dss_device 
> *dssdev,
>   mutex_unlock(&venc->venc_lock);
>  }
>  
> -static u32 venc_get_wss(struct omap_dss_device *dssdev)
> -{
> - struct venc_device *venc = dssdev_to_venc(dssdev);
> -
> - /* Invert due to VENC_L21_WC_CTL:INV=1 */
> - return (venc->wss_data >> 8) ^ 0xf;
> -}
> -
> -static int venc_set_wss(struct omap_dss_device *dssdev, u32 wss)
> -{
> - struct venc_device *venc = dssdev_to_venc(dssdev);
> - const struct venc_config *config;
> - int r;
> -
> - DSSDBG("venc_set_wss\n");
> -
> - mutex_lock(&venc->venc_lock);
> -
> - config = venc_timings_to_config(&venc->vm);
> -
> - /* Invert due to VENC_L21_WC_CTL:INV=1 */
> - venc->wss_data = (wss ^ 0xf) << 8;
> -
> - r = venc_runtime_get(venc);
> - if (r)
> - goto err;
> -
> - venc_write_reg(venc, VENC_BSTAMP_WSS_DATA, config->bstamp_wss_data |
> -venc->wss_data);
> -
> - venc_runtime_put(venc);
> -
> -err:
> - mutex_unlock(&venc->venc_lock);
> -
> - return r;
> -}
> -
>  static int venc_init_regulator(struct venc_device *venc)
>  {
>   struct regulator *vdda_dac;
> @@ -810,9 +772,6 @@ static const struct omapdss_atv_ops venc_ops = {
>   .check_timings = venc_check_timings,
>   .set_timings = venc_set_timings,
>   .get_timings = venc_get_timings,
> -
> - .set_wss = venc_set_wss,
> - .get_wss = venc_get_wss,
>  };
>  
>  static void venc_init_output(struct venc_device *venc)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> ht

Re: [PATCH v2 07/60] drm/omap: dss: Handle DPI and SDI port initialization failures

2018-06-10 Thread Sebastian Reichel
On Sat, May 26, 2018 at 08:24:25PM +0300, Laurent Pinchart wrote:
> The dpi_init_port() and sdi_init_port() functions can return errors but
> their return value is ignored. This prevents both probe failures and
> probe deferral from working correctly. Propagate the errors up the call
> stack.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index abd45b08f3a1..59b238f03437 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1183,7 +1183,8 @@ static int dss_init_ports(struct dss_device *dss)
>   struct platform_device *pdev = dss->pdev;
>   struct device_node *parent = pdev->dev.of_node;
>   struct device_node *port;
> - int i;
> + unsigned int i;
> + int r;
>  
>   for (i = 0; i < dss->feat->num_ports; i++) {
>   port = of_graph_get_port_by_id(parent, i);
> @@ -1192,11 +1193,17 @@ static int dss_init_ports(struct dss_device *dss)
>  
>   switch (dss->feat->ports[i]) {
>   case OMAP_DISPLAY_TYPE_DPI:
> - dpi_init_port(dss, pdev, port, dss->feat->model);
> + r = dpi_init_port(dss, pdev, port, dss->feat->model);
> + if (r)
> + return r;
>   break;
> +
>   case OMAP_DISPLAY_TYPE_SDI:
> - sdi_init_port(dss, pdev, port);
> + r = sdi_init_port(dss, pdev, port);
> + if (r)
> + return r;
>   break;
> +
>   default:
>   break;
>   }
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 06/60] drm/omap: dss: Move platform_device_register from core.c to dss.c probe

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:24PM +0300, Laurent Pinchart wrote:
> From: Jyri Sarha 
> 
> Register the omapdrm device when we know that dss device probe going
> to succeed. This avoids DSS6 and DSS2 omapdrm device registration from
> colliding with each other.
> 
> Signed-off-by: Jyri Sarha 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

> Changes since v0:
> 
> - Store the OMAP DRM platform device pointer in struct dss_device
> - Register the OMAP DRM platform device at the very end of dss_bind()
> ---
>  drivers/gpu/drm/omapdrm/dss/core.c | 26 ++
>  drivers/gpu/drm/omapdrm/dss/dss.c  | 13 +
>  drivers/gpu/drm/omapdrm/dss/dss.h  |  2 ++
>  3 files changed, 17 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/core.c 
> b/drivers/gpu/drm/omapdrm/dss/core.c
> index acef7ece5783..6c9f667f9982 100644
> --- a/drivers/gpu/drm/omapdrm/dss/core.c
> +++ b/drivers/gpu/drm/omapdrm/dss/core.c
> @@ -45,36 +45,14 @@ static struct platform_driver * const omap_dss_drivers[] 
> = {
>  #endif
>  };
>  
> -static struct platform_device *omap_drm_device;
> -
>  static int __init omap_dss_init(void)
>  {
> - int r;
> -
> - r = platform_register_drivers(omap_dss_drivers,
> -   ARRAY_SIZE(omap_dss_drivers));
> - if (r)
> - goto err_reg;
> -
> - omap_drm_device = platform_device_register_simple("omapdrm", 0, NULL, 
> 0);
> - if (IS_ERR(omap_drm_device)) {
> - r = PTR_ERR(omap_drm_device);
> - goto err_reg;
> - }
> -
> - return 0;
> -
> -err_reg:
> - platform_unregister_drivers(omap_dss_drivers,
> - ARRAY_SIZE(omap_dss_drivers));
> -
> - return r;
> + return platform_register_drivers(omap_dss_drivers,
> +  ARRAY_SIZE(omap_dss_drivers));
>  }
>  
>  static void __exit omap_dss_exit(void)
>  {
> - platform_device_unregister(omap_drm_device);
> -
>   platform_unregister_drivers(omap_dss_drivers,
>   ARRAY_SIZE(omap_dss_drivers));
>  }
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index d27d7f85bcd1..abd45b08f3a1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1315,6 +1315,7 @@ static const struct soc_device_attribute 
> dss_soc_devices[] = {
>  static int dss_bind(struct device *dev)
>  {
>   struct dss_device *dss = dev_get_drvdata(dev);
> + struct platform_device *drm_pdev;
>   int r;
>  
>   r = component_bind_all(dev, NULL);
> @@ -1325,11 +1326,23 @@ static int dss_bind(struct device *dev)
>  
>   omapdss_set_dss(dss);
>  
> + drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
> + if (IS_ERR(drm_pdev)) {
> + component_unbind_all(dev, NULL);
> + return PTR_ERR(drm_pdev);
> + }
> +
> + dss->drm_pdev = drm_pdev;
> +
>   return 0;
>  }
>  
>  static void dss_unbind(struct device *dev)
>  {
> + struct dss_device *dss = dev_get_drvdata(dev);
> +
> + platform_device_unregister(dss->drm_pdev);
> +
>   omapdss_set_dss(NULL);
>  
>   component_unbind_all(dev, NULL);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
> b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 847c78ade024..4f1eb7f5b922 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -235,6 +235,8 @@ struct dss_device {
>   struct regmap   *syscon_pll_ctrl;
>   u32 syscon_pll_ctrl_offset;
>  
> + struct platform_device *drm_pdev;
> +
>   struct clk  *parent_clk;
>   struct clk  *dss_clk;
>   unsigned long   dss_clk_rate;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 05/60] drm/omap: dss: Gather OMAP DSS components at probe time

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:23PM +0300, Laurent Pinchart wrote:
> The omapdss_gather_components() function walks the OF graph to create a
> list of all components part of the display device. There's no need to
> delay this operation until DSS bind time as we have all the information
> we need at probe time.
> 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 0b908e9de792..d27d7f85bcd1 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1323,7 +1323,6 @@ static int dss_bind(struct device *dev)
>  
>   pm_set_vt_switch(0);
>  
> - omapdss_gather_components(dev);
>   omapdss_set_dss(dss);
>  
>   return 0;
> @@ -1474,6 +1473,8 @@ static int dss_probe(struct platform_device *pdev)
>  dss);
>  
>   /* Add all the child devices as components. */
> + omapdss_gather_components(&pdev->dev);
> +
>   device_for_each_child(&pdev->dev, &match, dss_add_child_component);
>  
>   r = component_master_add_with_match(&pdev->dev, &dss_component_ops, 
> match);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 03/60] drm/omap: Do dss_device (display) ordering in omap_drv.c

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:21PM +0300, Laurent Pinchart wrote:
> From: Peter Ujfalusi 
> 
> Sort the dssdev array based on DT aliases.
> 
> With this change we can remove the panel ordering from dss/display.c and
> have all sorting related to dssdevs in one place.
> 
> Signed-off-by: Peter Ujfalusi 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

> Changes since v0:
> 
> - Make alias_id unsigned
> ---
>  drivers/gpu/drm/omapdrm/dss/display.c |  2 ++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  1 +
>  drivers/gpu/drm/omapdrm/omap_drv.c| 18 ++
>  3 files changed, 21 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> index 424143128cd4..3ef99f344bd3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -52,6 +52,8 @@ int omapdss_register_display(struct omap_dss_device *dssdev)
>   if (id < 0)
>   id = disp_num_counter++;
>  
> + dssdev->alias_id = id;
> +
>   snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id);
>  
>   /* Use 'label' property for name, if it exists */
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 14d74adb13fb..eae105b0b961 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -467,6 +467,7 @@ struct omap_dss_device {
>  
>   /* alias in the form of "display%d" */
>   char alias[16];
> + unsigned int alias_id;
>  
>   enum omap_display_type type;
>   enum omap_display_type output_type;
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 9277aa8c49c0..e2d7f8bfb4c1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -15,6 +15,8 @@
>   * this program.  If not, see .
>   */
>  
> +#include 
> +#include 
>  #include 
>  
>  #include 
> @@ -165,6 +167,18 @@ static void omap_disconnect_dssdevs(struct drm_device 
> *ddev)
>   priv->num_dssdevs = 0;
>  }
>  
> +static int omap_compare_dssdevs(const void *a, const void *b)
> +{
> + const struct omap_dss_device *dssdev1 = *(struct omap_dss_device **)a;
> + const struct omap_dss_device *dssdev2 = *(struct omap_dss_device **)b;
> +
> + if (dssdev1->alias_id > dssdev2->alias_id)
> + return 1;
> + else if (dssdev1->alias_id < dssdev2->alias_id)
> + return -1;
> + return 0;
> +}
> +
>  static int omap_connect_dssdevs(struct drm_device *ddev)
>  {
>   struct omap_drm_private *priv = ddev->dev_private;
> @@ -193,6 +207,10 @@ static int omap_connect_dssdevs(struct drm_device *ddev)
>   }
>   }
>  
> + /* Sort the list by DT aliases */
> + sort(priv->dssdevs, priv->num_dssdevs, sizeof(priv->dssdevs[0]),
> +  omap_compare_dssdevs, NULL);
> +
>   return 0;
>  
>  cleanup:
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCH v2 02/60] drm/omap: Manage the usable omap_dss_device list within omap_drm_private

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:20PM +0300, Laurent Pinchart wrote:
> From: Peter Ujfalusi 
> 
> Instead of reaching back to DSS to iterate through the dss_devices every
> time, use an internal array where we store the available and usable
> dss_devices.
> 
> At the same time remove the omapdss_device_is_connected() check from
> omap_modeset_init() as it became irrelevant: We are not adding dssdevs
> if their connect failed.
> 
> Signed-off-by: Peter Ujfalusi 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

> Changes since v0:
> 
> - Make loop counter unsigned
> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 94 
> --
>  drivers/gpu/drm/omapdrm/omap_drv.h |  3 ++
>  2 files changed, 62 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 244ed3707589..9277aa8c49c0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -149,18 +149,27 @@ static int get_connector_type(struct omap_dss_device 
> *dssdev)
>   }
>  }
>  
> -static void omap_disconnect_dssdevs(void)
> +static void omap_disconnect_dssdevs(struct drm_device *ddev)
>  {
> - struct omap_dss_device *dssdev = NULL;
> + struct omap_drm_private *priv = ddev->dev_private;
> + unsigned int i;
> +
> + for (i = 0; i < priv->num_dssdevs; i++) {
> + struct omap_dss_device *dssdev = priv->dssdevs[i];
>  
> - for_each_dss_dev(dssdev)
>   dssdev->driver->disconnect(dssdev);
> + priv->dssdevs[i] = NULL;
> + omap_dss_put_device(dssdev);
> + }
> +
> + priv->num_dssdevs = 0;
>  }
>  
> -static int omap_connect_dssdevs(void)
> +static int omap_connect_dssdevs(struct drm_device *ddev)
>  {
> - int r;
> + struct omap_drm_private *priv = ddev->dev_private;
>   struct omap_dss_device *dssdev = NULL;
> + int r;
>  
>   if (!omapdss_stack_is_ready())
>   return -EPROBE_DEFER;
> @@ -173,6 +182,14 @@ static int omap_connect_dssdevs(void)
>   } else if (r) {
>   dev_warn(dssdev->dev, "could not connect display: %s\n",
>   dssdev->name);
> + } else {
> + omap_dss_get_device(dssdev);
> + priv->dssdevs[priv->num_dssdevs++] = dssdev;
> + if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) {
> + /* To balance the 'for_each_dss_dev' loop */
> + omap_dss_put_device(dssdev);
> + break;
> + }
>   }
>   }
>  
> @@ -183,7 +200,7 @@ static int omap_connect_dssdevs(void)
>* if we are deferring probe, we disconnect the devices we previously
>* connected
>*/
> - omap_disconnect_dssdevs();
> + omap_disconnect_dssdevs(ddev);
>  
>   return r;
>  }
> @@ -208,6 +225,7 @@ static int omap_modeset_init(struct drm_device *dev)
>   int num_ovls = priv->dispc_ops->get_num_ovls(priv->dispc);
>   int num_mgrs = priv->dispc_ops->get_num_mgrs(priv->dispc);
>   int num_crtcs, crtc_idx, plane_idx;
> + unsigned int i;
>   int ret;
>   u32 plane_crtc_mask;
>  
> @@ -225,11 +243,7 @@ static int omap_modeset_init(struct drm_device *dev)
>* configuration does not match the expectations or exceeds
>* the available resources, the configuration is rejected.
>*/
> - num_crtcs = 0;
> - for_each_dss_dev(dssdev)
> - if (omapdss_device_is_connected(dssdev))
> - num_crtcs++;
> -
> + num_crtcs = priv->num_dssdevs;
>   if (num_crtcs > num_mgrs || num_crtcs > num_ovls ||
>   num_crtcs > ARRAY_SIZE(priv->crtcs) ||
>   num_crtcs > ARRAY_SIZE(priv->planes) ||
> @@ -247,15 +261,13 @@ static int omap_modeset_init(struct drm_device *dev)
>  
>   crtc_idx = 0;
>   plane_idx = 0;
> - for_each_dss_dev(dssdev) {
> + for (i = 0; i < priv->num_dssdevs; i++) {
> + struct omap_dss_device *dssdev = priv->dssdevs[i];
>   struct drm_connector *connector;
>   struct drm_encoder *encoder;
>   struct drm_plane *plane;
>   struct drm_crtc *crtc;
>  
> - if (!omapdss_device_is_connected(dssdev))
> - continue;
> -
>   encoder = omap_encoder_init(dev, dssdev);
>   if (!encoder)
>   return -ENOMEM;
> @@ -335,11 +347,14 @@ static int omap_modeset_init(struct drm_device *dev)
>  /*
>   * Enable the HPD in external components if supported
>   */
> -static void omap_modeset_enable_external_hpd(void)
> +static void omap_modeset_enable_external_hpd(struct drm_device *ddev)
>  {
> - struct omap_dss_device *dssdev = NULL;
> + struct omap_

[PATCH] omapfb: encoder-tpd12s015: fix error return code

2018-06-10 Thread Julia Lawall
Return an error code on failure.

Problem found using Coccinelle.

Signed-off-by: Julia Lawall 

---
 drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c |   12 +++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c 
b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c
index 80dc473..2b58bfc 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/encoder-tpd12s015.c
@@ -240,22 +240,28 @@ static int tpd_probe(struct platform_device *pdev)
 
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0,
GPIOD_OUT_LOW);
-   if (IS_ERR(gpio))
+   if (IS_ERR(gpio)) {
+   r = PTR_ERR(gpio);
goto err_gpio;
+   }
 
ddata->ct_cp_hpd_gpio = gpio;
 
gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 1,
GPIOD_OUT_LOW);
-   if (IS_ERR(gpio))
+   if (IS_ERR(gpio)) {
+   r = PTR_ERR(gpio);
goto err_gpio;
+   }
 
ddata->ls_oe_gpio = gpio;
 
gpio = devm_gpiod_get_index(&pdev->dev, NULL, 2,
GPIOD_IN);
-   if (IS_ERR(gpio))
+   if (IS_ERR(gpio)) {
+   r = PTR_ERR(gpio);
goto err_gpio;
+   }
 
ddata->hpd_gpio = gpio;
 

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


[Bug 106877] The game Rise of the Tomb Raider lead to GPU hang when I try in same place jump into the hole.

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106877

Bug ID: 106877
   Summary: The game Rise of the Tomb Raider lead to GPU hang when
I try in same place jump into the hole.
   Product: DRI
   Version: XOrg git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: DRM/AMDgpu
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: mikhail.v.gavri...@gmail.com

Demonstration: https://youtu.be/jbesfySez3k

$ inxi -bM
System:Host: localhost.localdomain Kernel: 4.18.0-0.rc0.git2.1.fc29.x86_64
x86_64 bits: 64
   Desktop: Gnome 3.29.2 Distro: Fedora release 29 (Rawhide)
Machine:   Device: desktop System: Gigabyte product: Z87M-D3H serial: N/A
   Mobo: Gigabyte model: Z87M-D3H serial: N/A UEFI: American Megatrends
v: F11 date: 08/12/2014
Batteryhidpp__0: charge: N/A condition: NA/NA Wh
CPU:   Quad core Intel Core i7-4770 (-MT-MCP-) speed/max: 3754/3900 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Vega 10 XT [Radeon RX Vega
64]
   Display Server: wayland (X.org 12 ) drivers: modesetting,fbdev,vesa
Resolution: 3840x2160@59.98hz
   OpenGL: renderer: Radeon RX Vega (VEGA10, DRM 3.25.0,
4.18.0-0.rc0.git2.1.fc29.x86_64, LLVM 6.0.1)
   version: 4.5 Mesa 18.1.1
Network:   Card: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
Controller driver: r8169
Drives:HDD Total Size: 16241.0GB (23.1% used)
Info:  Processes: 432 Uptime: 38 min Memory: 15013.4/32037.0MB Client:
Shell (bash) inxi: 2.3.56 

dmesg output:
[82950.961053] amdgpu :07:00.0: [gfxhub] VMC page fault (src_id:0 ring:158
vmid:7 pasid:32784)
[82950.961070] amdgpu :07:00.0:   at page 0x1891990f from 27
[82950.961075] amdgpu :07:00.0: VM_L2_PROTECTION_FAULT_STATUS:0x0070113C
[82961.293312] [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx timeout,
last signaled seq=8478374, last emitted seq=8478376
[82961.293347] [drm] No hardware hang detected. Did some blocks stall?

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


[Bug 106666] amdgpu 0000:09:00.0: [gfxhub] VMC page fault (src_id:0 ring:56 vmid:3 pas_id:0), [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx timeout, last signaled seq=327845, last emitted seq=32

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=10

--- Comment #17 from udo  ---
Latest firmwares do influence the situation in a positive way.

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


Re: [PATCH v2 01/60] drm/omap: Allocate drm_device earlier and unref it as last step

2018-06-10 Thread Sebastian Reichel
Hi,

On Sat, May 26, 2018 at 08:24:19PM +0300, Laurent Pinchart wrote:
> From: Peter Ujfalusi 
> 
> If we allocate the drm_device earlier we can just return the error code
> without the need to use goto.
> Do the unref of the drm_device as a last step when cleaning up. This will
> make the drm_device available longer for us and makes sure that we only
> free up the memory when all other cleanups have been already done.
> 
> Signed-off-by: Peter Ujfalusi 
> Reviewed-by: Laurent Pinchart 
> Signed-off-by: Tomi Valkeinen 
> Signed-off-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_drv.c | 29 +
>  1 file changed, 13 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 5005ecc284d2..244ed3707589 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -525,6 +525,14 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>  
>   DBG("%s", dev_name(dev));
>  
> + /* Allocate and initialize the DRM device. */
> + ddev = drm_dev_alloc(&omap_drm_driver, dev);
> + if (IS_ERR(ddev))
> + return PTR_ERR(ddev);
> +
> + priv->ddev = ddev;
> + ddev->dev_private = priv;
> +
>   priv->dev = dev;
>   priv->dss = omapdss_get_dss();
>   priv->dispc = dispc_get_dispc(priv->dss);
> @@ -543,16 +551,6 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>   mutex_init(&priv->list_lock);
>   INIT_LIST_HEAD(&priv->obj_list);
>  
> - /* Allocate and initialize the DRM device. */
> - ddev = drm_dev_alloc(&omap_drm_driver, priv->dev);
> - if (IS_ERR(ddev)) {
> - ret = PTR_ERR(ddev);
> - goto err_destroy_wq;
> - }
> -
> - priv->ddev = ddev;
> - ddev->dev_private = priv;
> -
>   /* Get memory bandwidth limits */
>   if (priv->dispc_ops->get_memory_bandwidth_limit)
>   priv->max_bandwidth =
> @@ -563,7 +561,7 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>   ret = omap_modeset_init(ddev);
>   if (ret) {
>   dev_err(priv->dev, "omap_modeset_init failed: ret=%d\n", ret);
> - goto err_free_drm_dev;
> + goto err_gem_deinit;
>   }
>  
>   /* Initialize vblank handling, start with all CRTCs disabled. */
> @@ -599,14 +597,13 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>  err_cleanup_modeset:
>   drm_mode_config_cleanup(ddev);
>   omap_drm_irq_uninstall(ddev);
> -err_free_drm_dev:
> +err_gem_deinit:
>   omap_gem_deinit(ddev);
> - drm_dev_unref(ddev);
> -err_destroy_wq:
>   destroy_workqueue(priv->wq);
>   omap_disconnect_dssdevs();
>  err_crtc_uninit:
>   omap_crtc_pre_uninit();
> + drm_dev_unref(ddev);
>   return ret;
>  }
>  
> @@ -630,12 +627,12 @@ static void omapdrm_cleanup(struct omap_drm_private 
> *priv)
>   omap_drm_irq_uninstall(ddev);
>   omap_gem_deinit(ddev);
>  
> - drm_dev_unref(ddev);
> -
>   destroy_workqueue(priv->wq);
>  
>   omap_disconnect_dssdevs();
>   omap_crtc_pre_uninit();
> +
> + drm_dev_unref(ddev);
>  }
>  
>  static int pdev_probe(struct platform_device *pdev)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCHv2 07/17] drm/omap: dispc: disp_wb_setup to check return code

2018-06-10 Thread Sebastian Reichel
Hi,

On Wed, Feb 28, 2018 at 01:26:04PM +0200, Tomi Valkeinen wrote:
> From: Benoit Parrot 
> 
> When dispc_wb_setup() calls dispc_ovl_setup_common() it does not
> check for failure but instead keeps on partially setting up WB.
> This causes the WB H/W to be partially initialized and yield
> unexpected behavior.
> 
> Make sure return code is successful before proceeding.
> 
> Signed-off-by: Benoit Parrot 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dispc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
> b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index d2d95c76a313..f0f729fc4ca2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -2783,6 +2783,8 @@ int dispc_wb_setup(struct dispc_device *dispc,
>   wi->height, wi->fourcc, wi->rotation, zorder,
>   wi->pre_mult_alpha, global_alpha, wi->rotation_type,
>   replication, vm, mem_to_mem);
> + if (r)
> + return r;
>  
>   switch (wi->fourcc) {
>   case DRM_FORMAT_RGB565:
> @@ -2823,7 +2825,7 @@ int dispc_wb_setup(struct dispc_device *dispc,
>   REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0);
>   }
>  
> - return r;
> + return 0;
>  }
>  
>  static int dispc_ovl_enable(struct dispc_device *dispc,
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCHv2 06/17] drm/omap: remove leftover enums

2018-06-10 Thread Sebastian Reichel
Hi,

On Wed, Feb 28, 2018 at 01:26:03PM +0200, Tomi Valkeinen wrote:
> A few enums are not used anywhere, so remove them.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 ---
>  1 file changed, 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a4f71e082c1c..162f36fa3431 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -163,21 +163,6 @@ enum omap_overlay_caps {
>   OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
>  };
>  
> -enum omap_dss_clk_source {
> - OMAP_DSS_CLK_SRC_FCK = 0,   /* OMAP2/3: DSS1_ALWON_FCLK
> -  * OMAP4: DSS_FCLK */
> - OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC,   /* OMAP3: DSI1_PLL_FCLK
> -  * OMAP4: PLL1_CLK1 */
> - OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK
> -  * OMAP4: PLL1_CLK2 */
> - OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC,  /* OMAP4: PLL2_CLK1 */
> - OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI,/* OMAP4: PLL2_CLK2 */
> -};
> -
> -enum omap_hdmi_flags {
> - OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
> -};
> -
>  enum omap_dss_output_id {
>   OMAP_DSS_OUTPUT_DPI = 1 << 0,
>   OMAP_DSS_OUTPUT_DBI = 1 << 1,
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCHv2 05/17] dt-bindings: display: add HPD gpio to DVI connector

2018-06-10 Thread Sebastian Reichel
Hi,

On Wed, Feb 28, 2018 at 01:26:02PM +0200, Tomi Valkeinen wrote:
> Add hpd-gpios property to dvi-connector.txt.
> 
> Signed-off-by: Tomi Valkeinen 
> Cc: devicet...@vger.kernel.org
> Reviewed-by: Rob Herring 
> Reviewed-by: Laurent Pinchart 

Reviewed-by: Sebastian Reichel 

-- Sebastian

> ---
>  Documentation/devicetree/bindings/display/connector/dvi-connector.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/connector/dvi-connector.txt 
> b/Documentation/devicetree/bindings/display/connector/dvi-connector.txt
> index fc53f7c60bc6..207e42e9eba0 100644
> --- a/Documentation/devicetree/bindings/display/connector/dvi-connector.txt
> +++ b/Documentation/devicetree/bindings/display/connector/dvi-connector.txt
> @@ -10,6 +10,7 @@ Optional properties:
>  - analog: the connector has DVI analog pins
>  - digital: the connector has DVI digital pins
>  - dual-link: the connector has pins for DVI dual-link
> +- hpd-gpios: HPD GPIO number
>  
>  Required nodes:
>  - Video port for DVI input
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCHv2 04/17] drm/omap: add HPD support to connector-dvi

2018-06-10 Thread Sebastian Reichel
Hi,

On Wed, Feb 28, 2018 at 01:26:01PM +0200, Tomi Valkeinen wrote:
> Add HPD support to the DVI connector driver. The code is almost
> identical to the HPD code in the HDMI connector driver.
> 
> Signed-off-by: Tomi Valkeinen 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 118 
> +++
>  1 file changed, 118 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c 
> b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> index 391d80364346..6d8cbd9e2110 100644
> --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c
> @@ -9,6 +9,7 @@
>   * the Free Software Foundation.
>   */
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -44,6 +45,14 @@ struct panel_drv_data {
>   struct videomode vm;
>  
>   struct i2c_adapter *i2c_adapter;
> +
> + struct gpio_desc *hpd_gpio;
> +
> + void (*hpd_cb)(void *cb_data, enum drm_connector_status status);
> + void *hpd_cb_data;
> + bool hpd_enabled;
> + /* mutex for hpd fields above */
> + struct mutex hpd_lock;
>  };
>  
>  #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev)
> @@ -189,6 +198,9 @@ static int dvic_read_edid(struct omap_dss_device *dssdev,
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
>   int r, l, bytes_read;
>  
> + if (ddata->hpd_gpio && !gpiod_get_value_cansleep(ddata->hpd_gpio))
> + return -ENODEV;
> +
>   if (!ddata->i2c_adapter)
>   return -ENODEV;
>  
> @@ -220,6 +232,9 @@ static bool dvic_detect(struct omap_dss_device *dssdev)
>   unsigned char out;
>   int r;
>  
> + if (ddata->hpd_gpio)
> + return gpiod_get_value_cansleep(ddata->hpd_gpio);
> +
>   if (!ddata->i2c_adapter)
>   return true;
>  
> @@ -228,6 +243,60 @@ static bool dvic_detect(struct omap_dss_device *dssdev)
>   return r == 0;
>  }
>  
> +static int dvic_register_hpd_cb(struct omap_dss_device *dssdev,
> +  void (*cb)(void *cb_data,
> + enum drm_connector_status status),
> +  void *cb_data)
> +{
> + struct panel_drv_data *ddata = to_panel_data(dssdev);
> +
> + if (!ddata->hpd_gpio)
> + return -ENOTSUPP;
> +
> + mutex_lock(&ddata->hpd_lock);
> + ddata->hpd_cb = cb;
> + ddata->hpd_cb_data = cb_data;
> + mutex_unlock(&ddata->hpd_lock);
> + return 0;
> +}
> +
> +static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev)
> +{
> + struct panel_drv_data *ddata = to_panel_data(dssdev);
> +
> + if (!ddata->hpd_gpio)
> + return;
> +
> + mutex_lock(&ddata->hpd_lock);
> + ddata->hpd_cb = NULL;
> + ddata->hpd_cb_data = NULL;
> + mutex_unlock(&ddata->hpd_lock);
> +}
> +
> +static void dvic_enable_hpd(struct omap_dss_device *dssdev)
> +{
> + struct panel_drv_data *ddata = to_panel_data(dssdev);
> +
> + if (!ddata->hpd_gpio)
> + return;
> +
> + mutex_lock(&ddata->hpd_lock);
> + ddata->hpd_enabled = true;
> + mutex_unlock(&ddata->hpd_lock);
> +}
> +
> +static void dvic_disable_hpd(struct omap_dss_device *dssdev)
> +{
> + struct panel_drv_data *ddata = to_panel_data(dssdev);
> +
> + if (!ddata->hpd_gpio)
> + return;
> +
> + mutex_lock(&ddata->hpd_lock);
> + ddata->hpd_enabled = false;
> + mutex_unlock(&ddata->hpd_lock);
> +}
> +
>  static struct omap_dss_driver dvic_driver = {
>   .connect= dvic_connect,
>   .disconnect = dvic_disconnect,
> @@ -241,14 +310,60 @@ static struct omap_dss_driver dvic_driver = {
>  
>   .read_edid  = dvic_read_edid,
>   .detect = dvic_detect,
> +
> + .register_hpd_cb= dvic_register_hpd_cb,
> + .unregister_hpd_cb  = dvic_unregister_hpd_cb,
> + .enable_hpd = dvic_enable_hpd,
> + .disable_hpd= dvic_disable_hpd,
>  };
>  
> +static irqreturn_t dvic_hpd_isr(int irq, void *data)
> +{
> + struct panel_drv_data *ddata = data;
> +
> + mutex_lock(&ddata->hpd_lock);
> + if (ddata->hpd_enabled && ddata->hpd_cb) {
> + enum drm_connector_status status;
> +
> + if (dvic_detect(&ddata->dssdev))
> + status = connector_status_connected;
> + else
> + status = connector_status_disconnected;
> +
> + ddata->hpd_cb(ddata->hpd_cb_data, status);
> + }
> + mutex_unlock(&ddata->hpd_lock);
> +
> + return IRQ_HANDLED;
> +}
> +
>  static int dvic_probe_of(struct platform_device *pdev)
>  {
>   struct panel_drv_data *ddata = platform_get_drvdata(pdev);
>   struct device_node *node = pdev->dev.of_node;
>   struct device_node *adapter_node;
>   struct i2c_adapter *adapter;
> + struct gpio_desc *gpio;
> + int r;
> +
> + gpio = devm_

Re: [PATCHv2 03/17] drm/omap: Init fbdev emulation only when we have displays

2018-06-10 Thread Sebastian Reichel
Hi,

On Wed, Feb 28, 2018 at 01:26:00PM +0200, Tomi Valkeinen wrote:
> From: Peter Ujfalusi 
> 
> Do not try to init the fbdev if either num_crtcs or num_connectors is 0.
> In this case we do not have display so the fbdev init would fail anyways.
> 
> Signed-off-by: Peter Ujfalusi 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
> b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index be94480326d7..0f66c74a54b0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -249,6 +249,9 @@ void omap_fbdev_init(struct drm_device *dev)
>   struct drm_fb_helper *helper;
>   int ret = 0;
>  
> + if (!priv->num_crtcs || !priv->num_connectors)
> + return;
> +
>   fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
>   if (!fbdev)
>   goto fail;
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


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


Re: [PATCHv2 02/17] drm/omap: cleanup fbdev init/free

2018-06-10 Thread Sebastian Reichel
Hi,

On Wed, Feb 28, 2018 at 01:25:59PM +0200, Tomi Valkeinen wrote:
> omap_fbdev_init() and omap_fbdev_free() use priv->fbdev directly.
> However, omap_fbdev_init() returns the fbdev, and omap_drv.c also
> assigns the return value to priv->fbdev. This is slightly confusing.
> 
> Clean this up by removing the omap_fbdev_init() return value, as we
> don't care whether fbdev init succeeded or not. Also change omap_drv.c
> to call omap_fbdev_free() always, and omap_fbdev_free() does the check
> if fbdev was initialized.
> 
> While at it, rename omap_fbdev_free() to omap_fbdev_fini() to better
> match the "init" counterpart.
> 
> Signed-off-by: Tomi Valkeinen 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/omap_drv.c   |  9 -
>  drivers/gpu/drm/omapdrm/omap_fbdev.c | 18 --
>  drivers/gpu/drm/omapdrm/omap_fbdev.h |  9 -
>  3 files changed, 16 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 65a567dcf3ab..4f48b908bdc6 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -570,7 +570,7 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>   for (i = 0; i < priv->num_crtcs; i++)
>   drm_crtc_vblank_off(priv->crtcs[i]);
>  
> - priv->fbdev = omap_fbdev_init(ddev);
> + omap_fbdev_init(ddev);
>  
>   drm_kms_helper_poll_init(ddev);
>   omap_modeset_enable_external_hpd();
> @@ -588,8 +588,8 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>  err_cleanup_helpers:
>   omap_modeset_disable_external_hpd();
>   drm_kms_helper_poll_fini(ddev);
> - if (priv->fbdev)
> - omap_fbdev_free(ddev);
> +
> + omap_fbdev_fini(ddev);
>  err_cleanup_modeset:
>   drm_mode_config_cleanup(ddev);
>   omap_drm_irq_uninstall(ddev);
> @@ -615,8 +615,7 @@ static void omapdrm_cleanup(struct omap_drm_private *priv)
>   omap_modeset_disable_external_hpd();
>   drm_kms_helper_poll_fini(ddev);
>  
> - if (priv->fbdev)
> - omap_fbdev_free(ddev);
> + omap_fbdev_fini(ddev);
>  
>   drm_atomic_helper_shutdown(ddev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
> b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index 632ebcf2165f..be94480326d7 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -242,7 +242,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi)
>  }
>  
>  /* initialize fbdev helper */
> -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
> +void omap_fbdev_init(struct drm_device *dev)
>  {
>   struct omap_drm_private *priv = dev->dev_private;
>   struct omap_fbdev *fbdev = NULL;
> @@ -260,10 +260,8 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device 
> *dev)
>   drm_fb_helper_prepare(dev, helper, &omap_fb_helper_funcs);
>  
>   ret = drm_fb_helper_init(dev, helper, priv->num_connectors);
> - if (ret) {
> - dev_err(dev->dev, "could not init fbdev: ret=%d\n", ret);
> + if (ret)
>   goto fail;
> - }
>  
>   ret = drm_fb_helper_single_add_all_connectors(helper);
>   if (ret)
> @@ -275,7 +273,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device 
> *dev)
>  
>   priv->fbdev = helper;
>  
> - return helper;
> + return;
>  
>  fini:
>   drm_fb_helper_fini(helper);
> @@ -283,12 +281,9 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device 
> *dev)
>   kfree(fbdev);
>  
>   dev_warn(dev->dev, "omap_fbdev_init failed\n");
> - /* well, limp along without an fbdev.. maybe X11 will work? */
> -
> - return NULL;
>  }
>  
> -void omap_fbdev_free(struct drm_device *dev)
> +void omap_fbdev_fini(struct drm_device *dev)
>  {
>   struct omap_drm_private *priv = dev->dev_private;
>   struct drm_fb_helper *helper = priv->fbdev;
> @@ -296,11 +291,14 @@ void omap_fbdev_free(struct drm_device *dev)
>  
>   DBG();
>  
> + if (!helper)
> + return;
> +
>   drm_fb_helper_unregister_fbi(helper);
>  
>   drm_fb_helper_fini(helper);
>  
> - fbdev = to_omap_fbdev(priv->fbdev);
> + fbdev = to_omap_fbdev(helper);
>  
>   /* unpin the GEM object pinned in omap_fbdev_create() */
>   if (fbdev->bo)
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.h 
> b/drivers/gpu/drm/omapdrm/omap_fbdev.h
> index 1f5ba0996a1a..7dfd843f73f1 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.h
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.h
> @@ -24,14 +24,13 @@ struct drm_device;
>  struct drm_fb_helper;
>  
>  #ifdef CONFIG_DRM_FBDEV_EMULATION
> -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev);
> -void omap_fbdev_free(struct drm_device *dev);
> +void omap_fbdev_init(struct drm_device *dev);
> +void omap_fbdev_fini(struct drm_device *dev);
>  #else
> -static inline struct drm_fb_helper *omap_fbdev_init(st

[Bug 106666] amdgpu 0000:09:00.0: [gfxhub] VMC page fault (src_id:0 ring:56 vmid:3 pas_id:0), [drm:amdgpu_job_timedout [amdgpu]] *ERROR* ring gfx timeout, last signaled seq=327845, last emitted seq=32

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=10

--- Comment #16 from Sebastian Frysztak  ---
Hi everyone,

I have the same issue with 2400g, and I believe I have found a way to reproduce
it.

Please try the following apitrace of a game called Deadly Premonition [1]. Just
decompress it (it's almost 1.5 GB) and run it with 32-bit version of apitrace:

apitrace replay deadly_premonition.trace

Please let me know if it works.

[1] https://mega.nz/#!O3JSCbZI!TEYmOxpvjCosO3AhW1kvdcxdMCEkpqNTxrl9tWdDVYE

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


[Bug 106875] The game Anima Gate of Memories has artefects on Vega 56

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106875

--- Comment #1 from mikhail.v.gavri...@gmail.com ---
apitrace is here: https://dumps.sy24.ru/GoMLinux.x86_64.tar.xz (1.1GB)

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


[Bug 106875] The game Anima Gate of Memories has artefects on Vega 56

2018-06-10 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106875

Bug ID: 106875
   Summary: The game Anima Gate of Memories has artefects on Vega
56
   Product: Mesa
   Version: 18.0
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: mikhail.v.gavri...@gmail.com
QA Contact: dri-devel@lists.freedesktop.org

The game Anima Gate of Memories has artefects on Vega 56

Demonstration: https://youtu.be/T9TFd_dO8ck
Steam link: https://store.steampowered.com/app/380750/Anima_Gate_of_Memories/

$ inxi -bM
System:Host: localhost.localdomain Kernel: 4.18.0-0.rc0.git2.1.fc29.x86_64
x86_64 bits: 64
   Desktop: Gnome 3.29.2 Distro: Fedora release 29 (Rawhide)
Machine:   Device: desktop System: Gigabyte product: Z87M-D3H serial: N/A
   Mobo: Gigabyte model: Z87M-D3H serial: N/A UEFI: American Megatrends
v: F11 date: 08/12/2014
Batteryhidpp__0: charge: N/A condition: NA/NA Wh
CPU:   Quad core Intel Core i7-4770 (-MT-MCP-) speed/max: 3707/3900 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Vega 10 XT [Radeon RX Vega
64]
   Display Server: wayland (X.org 12 ) drivers: modesetting,fbdev,vesa
Resolution: 3840x2160@59.98hz
   OpenGL: renderer: Radeon RX Vega (VEGA10, DRM 3.25.0,
4.18.0-0.rc0.git2.1.fc29.x86_64, LLVM 6.0.1)
   version: 4.5 Mesa 18.1.1
Network:   Card: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
Controller driver: r8169
Drives:HDD Total Size: 16241.0GB (22.9% used)
Info:  Processes: 452 Uptime: 16:07 Memory: 21792.9/32037.0MB Client: Shell
(bash) inxi: 2.3.56

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