Re: [PATCH v16 4/8] drm: bridge: Cadence: Add MHDP8501 DP/HDMI driver

2024-07-03 Thread Benjamin Gaignard



Le 02/07/2024 à 14:22, Sandor Yu a écrit :

Add a new DRM DisplayPort and HDMI bridge driver for Candence MHDP8501
used in i.MX8MQ SOC. MHDP8501 could support HDMI or DisplayPort
standards according embedded Firmware running in the uCPU.

For iMX8MQ SOC, the DisplayPort/HDMI FW was loaded and activated by
SOC's ROM code. Bootload binary included respective specific firmware
is required.

Driver will check display connector type and
then load the corresponding driver.

Signed-off-by: Sandor Yu 
Tested-by: Alexander Stein 
---
v15->v16:
- rebase the patchset sits on top Dmitry's
'make use of the HDMI connector infrastructure' patchset ([2]).
- Add DRM_BRIDGE_OP_HDMI flags for HDMI driver,
- Introduce the hdmi info frame helper functions, added hdmi_clear_infoframe(),
   hdmi_write_infoframe() and hdmi_tmds_char_rate_valid().
- mode_fixup() was replaced by atomic_check().
- Fix video mode 4Kp30 did not work on some displays that support
   LTE_340Mcsc_scramble.
- updated for tmds_char_rate added in patch #2.

v13->v14:
- Rebase to next-20240219, replace get_edid function by edid_read
   function.

v12->v13:
- Explicitly include linux/platform_device.h for cdns-mhdp8501-core.c
- Fix build warning
- Order bit bpc and color_space in descending shit.

v11->v12:
- Replace DRM_INFO with dev_info or dev_warn.
- Replace DRM_ERROR with dev_err.
- Return ret when cdns_mhdp_dpcd_read failed in function 
cdns_dp_aux_transferi().
- Remove unused parmeter in function cdns_dp_get_msa_misc
   and use two separate variables for color space and bpc.
- Add year 2024 to copyright.

  drivers/gpu/drm/bridge/cadence/Kconfig|  16 +
  drivers/gpu/drm/bridge/cadence/Makefile   |   2 +
  .../drm/bridge/cadence/cdns-mhdp8501-core.c   | 330 +
  .../drm/bridge/cadence/cdns-mhdp8501-core.h   | 367 +
  .../gpu/drm/bridge/cadence/cdns-mhdp8501-dp.c | 700 ++
  .../drm/bridge/cadence/cdns-mhdp8501-hdmi.c   | 595 +++
  6 files changed, 2010 insertions(+)
  create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-core.c
  create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-core.h
  create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-dp.c
  create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-hdmi.c

diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig 
b/drivers/gpu/drm/bridge/cadence/Kconfig
index e0973339e9e3..45848e741f5f 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -51,3 +51,19 @@ config DRM_CDNS_MHDP8546_J721E
  initializes the J721E Display Port and sets up the
  clock and data muxes.
  endif
+
+config DRM_CDNS_MHDP8501
+   tristate "Cadence MHDP8501 DP/HDMI bridge"
+   select DRM_KMS_HELPER
+   select DRM_PANEL_BRIDGE
+   select DRM_DISPLAY_DP_HELPER
+   select DRM_DISPLAY_HELPER
+   select CDNS_MHDP_HELPER
+   select DRM_CDNS_AUDIO
+   depends on OF
+   help
+ Support Cadence MHDP8501 DisplayPort/HDMI bridge.
+ Cadence MHDP8501 support one or more protocols,
+ including DisplayPort and HDMI.
+ To use the DP and HDMI drivers, their respective
+ specific firmware is required.
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile 
b/drivers/gpu/drm/bridge/cadence/Makefile
index 087dc074820d..02c1a9f3cf6f 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -6,3 +6,5 @@ obj-$(CONFIG_CDNS_MHDP_HELPER) += cdns-mhdp-helper.o
  obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
  cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
  cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
+obj-$(CONFIG_DRM_CDNS_MHDP8501) += cdns-mhdp8501.o
+cdns-mhdp8501-y := cdns-mhdp8501-core.o cdns-mhdp8501-dp.o cdns-mhdp8501-hdmi.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-core.c
new file mode 100644
index ..c306db982b76
--- /dev/null
+++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8501-core.c
@@ -0,0 +1,330 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Cadence Display Port Interface (DP) driver
+ *
+ * Copyright (C) 2023, 2024 NXP Semiconductor, Inc.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "cdns-mhdp8501-core.h"
+
+static int cdns_mhdp8501_read_hpd(struct cdns_mhdp8501_device *mhdp)
+{
+   u8 status;
+   int ret;
+
+   mutex_lock(>mbox_mutex);
+
+   ret = cdns_mhdp_mailbox_send(>base, MB_MODULE_ID_GENERAL,
+GENERAL_GET_HPD_STATE, 0, NULL);
+   if (ret)
+   goto err_get_hpd;
+
+   ret = cdns_mhdp_mailbox_recv_header(>base, MB_MODULE_ID_GENERAL,
+   GENERAL_GET_HPD_STATE,
+   sizeof(status));
+   if (ret)
+   goto 

Re: [PATCH v2 10/12] media: platform: mtk-mdp3: Get fine-grain control of cmdq_pkt_finalize()

2024-06-06 Thread Benjamin Gaignard



Le 22/02/2024 à 16:41, Chun-Kuang Hu a écrit :

In order to have fine-grained control, use cmdq_pkt_eoc() and
cmdq_pkt_jump_rel() to replace cmdq_pkt_finalize().

Signed-off-by: Chun-Kuang Hu 
---
  drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 3 ++-
  drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 2 ++
  drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h | 1 +
  3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c 
b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
index 6adac857a477..b720e69b341d 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
@@ -471,7 +471,8 @@ int mdp_cmdq_send(struct mdp_dev *mdp, struct 
mdp_cmdq_param *param)
dev_err(dev, "mdp_path_config error\n");
goto err_free_path;
}
-   cmdq_pkt_finalize(>pkt);
+   cmdq_pkt_eoc(>pkt);
+   cmdq_pkt_jump_rel(>pkt, CMDQ_INST_SIZE, mdp->cmdq_shift_pa);
  
  	for (i = 0; i < num_comp; i++)

memcpy([i], path->comps[i].comp,
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c 
b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index 94f4ed78523b..2214744c937c 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -231,6 +231,8 @@ static int mdp_probe(struct platform_device *pdev)
goto err_put_scp;
}
  
+	mdp->cmdq_shift_pa = cmdq_get_shift_pa(mdp->cmdq_clt->chan);

+
init_waitqueue_head(>callback_wq);
ida_init(>mdp_ida);
platform_set_drvdata(pdev, mdp);
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h 
b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
index 7e21d226ceb8..ed61e0bb69ee 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
@@ -83,6 +83,7 @@ struct mdp_dev {
u32 id_count;
struct ida  mdp_ida;
struct cmdq_client  *cmdq_clt;
+   u8  cmdq_shift_pa;


Can send a new version of this series because this patch can't
be applied on media_tree/master branch.
The code look correct for me but we need to be able to applied it
to perform more checks.

Regards,
Benjamin


wait_queue_head_t   callback_wq;
  
  	struct v4l2_device			v4l2_dev;


Re: [PATCH 5/9] dma-buf: heaps: mtk_sec_heap: Initialise tee session

2023-09-29 Thread Benjamin Gaignard



Le 28/09/2023 à 19:48, Jeffrey Kardatzke a écrit :

On Thu, Sep 28, 2023 at 1:30 AM Benjamin Gaignard
 wrote:


Le 27/09/2023 à 20:56, Jeffrey Kardatzke a écrit :

On Wed, Sep 27, 2023 at 8:18 AM Benjamin Gaignard
 wrote:

Le 27/09/2023 à 15:46, Joakim Bech a écrit :

On Mon, Sep 25, 2023 at 12:49:50PM +, Yong Wu (吴勇) wrote:

On Tue, 2023-09-12 at 11:32 +0200, AngeloGioacchino Del Regno wrote:

Il 12/09/23 08:17, Yong Wu (吴勇) ha scritto:

On Mon, 2023-09-11 at 11:29 +0200, AngeloGioacchino Del Regno
wrote:

Il 11/09/23 04:30, Yong Wu ha scritto:

The TEE probe later than dma-buf heap, and PROBE_DEDER doesn't
work
here since this is not a platform driver, therefore initialise
the
TEE
context/session while we allocate the first secure buffer.

Signed-off-by: Yong Wu 
---
  drivers/dma-buf/heaps/mtk_secure_heap.c | 61
+
  1 file changed, 61 insertions(+)

diff --git a/drivers/dma-buf/heaps/mtk_secure_heap.c
b/drivers/dma-
buf/heaps/mtk_secure_heap.c
index bbf1c8dce23e..e3da33a3d083 100644
--- a/drivers/dma-buf/heaps/mtk_secure_heap.c
+++ b/drivers/dma-buf/heaps/mtk_secure_heap.c
@@ -10,6 +10,12 @@
  #include 
  #include 
  #include 
+#include 
+#include 
+
+#define TZ_TA_MEM_UUID  "4477588a-8476-11e2-ad15-
e41f1390d676"
+

Is this UUID the same for all SoCs and all TZ versions?

Yes. It is the same for all SoCs and all TZ versions currently.


That's good news!

Is this UUID used in any userspace component? (example: Android
HALs?)

No. Userspace never use it. If userspace would like to allocate this
secure buffer, it can achieve through the existing dmabuf IOCTL via
/dev/dma_heap/mtk_svp node.


In general I think as mentioned elsewhere in comments, that there isn't
that much here that seems to be unique for MediaTek in this patch
series, so I think it worth to see whether this whole patch set can be
made more generic. Having said that, the UUID is always unique for a
certain Trusted Application. So, it's not entirely true saying that the
UUID is the same for all SoCs and all TrustZone versions. It might be
true for a family of MediaTek devices and the TEE in use, but not
generically.

So, if we need to differentiate between different TA implementations,
then we need different UUIDs. If it would be possible to make this patch
set generic, then it sounds like a single UUID would be sufficient, but
that would imply that all TA's supporting such a generic UUID would be
implemented the same from an API point of view. Which also means that
for example Trusted Application function ID's needs to be the same etc.
Not impossible to achieve, but still not easy (different TEE follows
different specifications) and it's not typically something we've done in
the past.

Unfortunately there is no standardized database of TA's describing what
they implement and support.

As an alternative, we could implement a query call in the TEE answering,
"What UUID does your TA have that implements secure unmapped heap?".
I.e., something that reminds of a lookup table. Then we wouldn't have to
carry this in UAPI, DT or anywhere else.

Joakim does a TA could offer a generic API and hide the hardware specific
details (like kernel uAPI does for drivers) ?

It would have to go through another layer (like the tee driver) to be
a generic API. The main issue with TAs is that they have UUIDs you
need to connect to and specific codes for each function; so we should
abstract at a layer above where those exist in the dma-heap code.

Aside that question I wonder what are the needs to perform a 'secure' playback.
I have in mind 2 requirements:
- secure memory regions, which means configure the hardware to ensure that only
dedicated hardware blocks and read or write into it.
- set hardware blocks in secure modes so they access to secure memory.
Do you see something else ?

This is more or less what is required, but this is out of scope for
the Linux kernel since it can't be trusted to do these things...this
is all done in firmware or the TEE itself.

Yes kernel can't be trusted to do these things but know what we need could help
to define a API for a generic TA.

Just to brainstorm on mailing list:
What about a TA API like
TA_secure_memory_region() and TA_unsecure_memory_region() with parameters like:
- device identifier (an ID or compatible string maybe)
- memory region (physical address, size, offset)
- requested access rights (read, write)

and on kernel side a IOMMU driver because it basically have all this 
information already
(device attachment, kernel map/unmap).

In my mind it sound like a solution to limit the impact (new controls, new 
memory type)
inside v4l2. Probably we won't need new heap either.
All hardware dedicated implementations could live inside the TA which can offer 
a generic
API.

The main problem with that type of design is the limitations of
TrustZone memory protection. Usually there is a limit to the number of
regions you can define f

Re: [PATCH 5/9] dma-buf: heaps: mtk_sec_heap: Initialise tee session

2023-09-28 Thread Benjamin Gaignard



Le 27/09/2023 à 20:56, Jeffrey Kardatzke a écrit :

On Wed, Sep 27, 2023 at 8:18 AM Benjamin Gaignard
 wrote:


Le 27/09/2023 à 15:46, Joakim Bech a écrit :

On Mon, Sep 25, 2023 at 12:49:50PM +, Yong Wu (吴勇) wrote:

On Tue, 2023-09-12 at 11:32 +0200, AngeloGioacchino Del Regno wrote:

Il 12/09/23 08:17, Yong Wu (吴勇) ha scritto:

On Mon, 2023-09-11 at 11:29 +0200, AngeloGioacchino Del Regno
wrote:

Il 11/09/23 04:30, Yong Wu ha scritto:

The TEE probe later than dma-buf heap, and PROBE_DEDER doesn't
work
here since this is not a platform driver, therefore initialise
the
TEE
context/session while we allocate the first secure buffer.

Signed-off-by: Yong Wu 
---
 drivers/dma-buf/heaps/mtk_secure_heap.c | 61
+
 1 file changed, 61 insertions(+)

diff --git a/drivers/dma-buf/heaps/mtk_secure_heap.c
b/drivers/dma-
buf/heaps/mtk_secure_heap.c
index bbf1c8dce23e..e3da33a3d083 100644
--- a/drivers/dma-buf/heaps/mtk_secure_heap.c
+++ b/drivers/dma-buf/heaps/mtk_secure_heap.c
@@ -10,6 +10,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#define TZ_TA_MEM_UUID  "4477588a-8476-11e2-ad15-
e41f1390d676"
+

Is this UUID the same for all SoCs and all TZ versions?

Yes. It is the same for all SoCs and all TZ versions currently.


That's good news!

Is this UUID used in any userspace component? (example: Android
HALs?)

No. Userspace never use it. If userspace would like to allocate this
secure buffer, it can achieve through the existing dmabuf IOCTL via
/dev/dma_heap/mtk_svp node.


In general I think as mentioned elsewhere in comments, that there isn't
that much here that seems to be unique for MediaTek in this patch
series, so I think it worth to see whether this whole patch set can be
made more generic. Having said that, the UUID is always unique for a
certain Trusted Application. So, it's not entirely true saying that the
UUID is the same for all SoCs and all TrustZone versions. It might be
true for a family of MediaTek devices and the TEE in use, but not
generically.

So, if we need to differentiate between different TA implementations,
then we need different UUIDs. If it would be possible to make this patch
set generic, then it sounds like a single UUID would be sufficient, but
that would imply that all TA's supporting such a generic UUID would be
implemented the same from an API point of view. Which also means that
for example Trusted Application function ID's needs to be the same etc.
Not impossible to achieve, but still not easy (different TEE follows
different specifications) and it's not typically something we've done in
the past.

Unfortunately there is no standardized database of TA's describing what
they implement and support.

As an alternative, we could implement a query call in the TEE answering,
"What UUID does your TA have that implements secure unmapped heap?".
I.e., something that reminds of a lookup table. Then we wouldn't have to
carry this in UAPI, DT or anywhere else.

Joakim does a TA could offer a generic API and hide the hardware specific
details (like kernel uAPI does for drivers) ?

It would have to go through another layer (like the tee driver) to be
a generic API. The main issue with TAs is that they have UUIDs you
need to connect to and specific codes for each function; so we should
abstract at a layer above where those exist in the dma-heap code.

Aside that question I wonder what are the needs to perform a 'secure' playback.
I have in mind 2 requirements:
- secure memory regions, which means configure the hardware to ensure that only
dedicated hardware blocks and read or write into it.
- set hardware blocks in secure modes so they access to secure memory.
Do you see something else ?

This is more or less what is required, but this is out of scope for
the Linux kernel since it can't be trusted to do these things...this
is all done in firmware or the TEE itself.


Yes kernel can't be trusted to do these things but know what we need could help
to define a API for a generic TA.

Just to brainstorm on mailing list:
What about a TA API like
TA_secure_memory_region() and TA_unsecure_memory_region() with parameters like:
- device identifier (an ID or compatible string maybe)
- memory region (physical address, size, offset)
- requested access rights (read, write)

and on kernel side a IOMMU driver because it basically have all this 
information already
(device attachment, kernel map/unmap).

In my mind it sound like a solution to limit the impact (new controls, new 
memory type)
inside v4l2. Probably we won't need new heap either.
All hardware dedicated implementations could live inside the TA which can offer 
a generic
API.


Regards,
Benjamin



Re: [PATCH 5/9] dma-buf: heaps: mtk_sec_heap: Initialise tee session

2023-09-27 Thread Benjamin Gaignard



Le 27/09/2023 à 15:46, Joakim Bech a écrit :

On Mon, Sep 25, 2023 at 12:49:50PM +, Yong Wu (吴勇) wrote:

On Tue, 2023-09-12 at 11:32 +0200, AngeloGioacchino Del Regno wrote:

Il 12/09/23 08:17, Yong Wu (吴勇) ha scritto:

On Mon, 2023-09-11 at 11:29 +0200, AngeloGioacchino Del Regno
wrote:

Il 11/09/23 04:30, Yong Wu ha scritto:

The TEE probe later than dma-buf heap, and PROBE_DEDER doesn't
work
here since this is not a platform driver, therefore initialise
the
TEE
context/session while we allocate the first secure buffer.

Signed-off-by: Yong Wu 
---
drivers/dma-buf/heaps/mtk_secure_heap.c | 61
+
1 file changed, 61 insertions(+)

diff --git a/drivers/dma-buf/heaps/mtk_secure_heap.c
b/drivers/dma-
buf/heaps/mtk_secure_heap.c
index bbf1c8dce23e..e3da33a3d083 100644
--- a/drivers/dma-buf/heaps/mtk_secure_heap.c
+++ b/drivers/dma-buf/heaps/mtk_secure_heap.c
@@ -10,6 +10,12 @@
#include 
#include 
#include 
+#include 
+#include 
+
+#define TZ_TA_MEM_UUID "4477588a-8476-11e2-ad15-
e41f1390d676"
+

Is this UUID the same for all SoCs and all TZ versions?

Yes. It is the same for all SoCs and all TZ versions currently.


That's good news!

Is this UUID used in any userspace component? (example: Android
HALs?)

No. Userspace never use it. If userspace would like to allocate this
secure buffer, it can achieve through the existing dmabuf IOCTL via
/dev/dma_heap/mtk_svp node.


In general I think as mentioned elsewhere in comments, that there isn't
that much here that seems to be unique for MediaTek in this patch
series, so I think it worth to see whether this whole patch set can be
made more generic. Having said that, the UUID is always unique for a
certain Trusted Application. So, it's not entirely true saying that the
UUID is the same for all SoCs and all TrustZone versions. It might be
true for a family of MediaTek devices and the TEE in use, but not
generically.

So, if we need to differentiate between different TA implementations,
then we need different UUIDs. If it would be possible to make this patch
set generic, then it sounds like a single UUID would be sufficient, but
that would imply that all TA's supporting such a generic UUID would be
implemented the same from an API point of view. Which also means that
for example Trusted Application function ID's needs to be the same etc.
Not impossible to achieve, but still not easy (different TEE follows
different specifications) and it's not typically something we've done in
the past.

Unfortunately there is no standardized database of TA's describing what
they implement and support.

As an alternative, we could implement a query call in the TEE answering,
"What UUID does your TA have that implements secure unmapped heap?".
I.e., something that reminds of a lookup table. Then we wouldn't have to
carry this in UAPI, DT or anywhere else.


Joakim does a TA could offer a generic API and hide the hardware specific
details (like kernel uAPI does for drivers) ?

Aside that question I wonder what are the needs to perform a 'secure' playback.
I have in mind 2 requirements:
- secure memory regions, which means configure the hardware to ensure that only
dedicated hardware blocks and read or write into it.
- set hardware blocks in secure modes so they access to secure memory.
Do you see something else ?

Regards,
Benjamin





[PATCH] drm: exynos: Make g2d_open() and g2d_close() static

2023-01-20 Thread Benjamin Gaignard
Fix "no previous prototype" warning when compiling with W=1 by making
the functions static like the ones above them.

Fixes: eb4d9796fa34 ("drm/exynos: g2d: Convert to driver component API")
Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/exynos/exynos_drm_g2d.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.h 
b/drivers/gpu/drm/exynos/exynos_drm_g2d.h
index 74ea3c26dead..4631c0579fb9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.h
@@ -34,11 +34,11 @@ static inline int exynos_g2d_exec_ioctl(struct drm_device 
*dev, void *data,
return -ENODEV;
 }
 
-int g2d_open(struct drm_device *drm_dev, struct drm_file *file)
+static int g2d_open(struct drm_device *drm_dev, struct drm_file *file)
 {
return 0;
 }
 
-void g2d_close(struct drm_device *drm_dev, struct drm_file *file)
+static void g2d_close(struct drm_device *drm_dev, struct drm_file *file)
 { }
 #endif
-- 
2.34.1



Re: [PATCH v2, 0/4] Cooperate with DSI RX devices to modify dsi funcs and delay mipi high to cooperate with panel sequence

2022-03-08 Thread Benjamin Gaignard



Le 08/03/2022 à 10:12, Hsin-Yi Wang a écrit :

On Fri, Mar 4, 2022 at 7:25 PM Benjamin Gaignard
 wrote:


Le 04/03/2022 à 11:15, xinlei@mediatek.com a écrit :

From: Xinlei Lee 

In upstream-v5.8, dsi_enable will operate panel_enable, but this
modification has been moved in v5.9. In order to ensure the timing of
dsi_power_on/off and the timing of pulling up/down the MIPI signal,
the modification of v5.9 is synchronized in this series of patches.

Hello,

I'm trying to debug an issue on mt8183 kukui krane sku176 device.
The problem is that boe-tv101wum-nl6 panel isn't working.
At boot time I can see these logs:
panel-boe-tv101wum-nl6 14014000.dsi.0: failed to write command 1
panel-boe-tv101wum-nl6 14014000.dsi.0: failed to init panel: -62
and a DSI interrupt time out.

Since I believe the problem is link to DSI/panel enabling sequence
I have try this series but that doesn't solve the issue.
I notice that when going out of deep sleep mode panel is functional.

May you have any idea to debug/solve this problem ?


Hi Benjamin,

I think this might not be related to this series. Which kernel are you using?
I tried the krane sku176 with linux-next 5.17-rc6
(519dd6c19986696f59847ff8bf930436ccffd9a1 (tag: next-20220307,
linux-next/master) with or without this series, both can get the display on.

dsi related message:
[0.206330] mediatek-drm mediatek-drm.1.auto: Adding component
match for /soc/dsi@14014000
[4.567577] panel-boe-tv101wum-nl6 14014000.dsi.0: supply pp3300
not found, using dummy regulator
[4.567732] panel-boe-tv101wum-nl6 14014000.dsi.0: GPIO lookup for
consumer enable
[4.567738] panel-boe-tv101wum-nl6 14014000.dsi.0: using device
tree for GPIO lookup
[4.567757] of_get_named_gpiod_flags: parsed 'enable-gpios'
property of node '/soc/dsi@14014000/panel@0[0]' - status (0)
[4.585884] panel-boe-tv101wum-nl6 14014000.dsi.0: supply pp3300
not found, using dummy regulator
[4.586037] panel-boe-tv101wum-nl6 14014000.dsi.0: GPIO lookup for
consumer enable
[4.586042] panel-boe-tv101wum-nl6 14014000.dsi.0: using device
tree for GPIO lookup
[4.586059] of_get_named_gpiod_flags: parsed 'enable-gpios'
property of node '/soc/dsi@14014000/panel@0[0]' - status (0)
[4.587430] mediatek-drm mediatek-drm.1.auto: bound 14014000.dsi
(ops 0xffd369a752b8)


Maybe some config is not enabled?


I using 5.17.0-rc1-next-20220127 kernel tag.
The configs look similar.

I have the follow log at boot time:

[1.533384] phy phy-11e5.dsi-phy.2: Looking up phy-supply from device 
tree
[1.533402] phy phy-11e5.dsi-phy.2: Looking up phy-supply property in 
node /soc/dsi-phy@11e5 failed
[3.173068] mediatek-drm mediatek-drm.1.auto: Adding component match for 
/soc/dsi@14014000
[4.671806] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up avdd-supply 
from device tree
[4.680348] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up avee-supply 
from device tree
[4.688784] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up pp3300-supply 
from device tree
[4.697816] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up pp1800-supply 
from device tree
[4.842346] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up avdd-supply 
from device tree
[4.854573] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up avee-supply 
from device tree
[4.862976] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up pp3300-supply 
from device tree
[4.871568] panel-boe-tv101wum-nl6 14014000.dsi.0: Looking up pp1800-supply 
from device tree
[4.964021] mediatek-drm mediatek-drm.1.auto: bound 14014000.dsi (ops 
mtk_dsi_component_ops)
...
[   38.273437] [drm] Wait DSI IRQ(0x0002) Timeout
[   38.281584] panel-boe-tv101wum-nl6 14014000.dsi.0: failed to write command 1
[   38.288651] panel-boe-tv101wum-nl6 14014000.dsi.0: failed to init panel: -62
...
[   70.113674] mediatek-drm mediatek-drm.1.auto: [drm] *ERROR* flip_done timed 
out
[   70.121054] mediatek-drm mediatek-drm.1.auto: [drm] *ERROR* [CRTC:45:crtc-0] 
commit wait timed out
[   70.130037] [drm:mtk_drm_crtc_atomic_begin] *ERROR* new event while there is 
still a pending event
[   70.241222] [ cut here ]
[   70.245898] [CRTC:45:crtc-0] vblank wait timed out
[   70.250729] WARNING: CPU: 7 PID: 397 at 
drivers/gpu/drm/drm_atomic_helper.c:1529 
drm_atomic_helper_wait_for_vblanks.part.0+0x290/0x24
[   70.262815] Modules linked in: hci_uart btqca btbcm bluetooth cdc_ether 
usbnet r8152 mtk_mdp3 hid_multitouch mtk_jpeg panfrost cros_6
[   70.309348] CPU: 7 PID: 397 Comm: gnome-shell Tainted: GW 
5.17.0-rc1-next-20220127+ #57
[   70.318731] Hardware name: MediaTek krane sku176 board (DT)
[   70.324293] pstate: 6005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   70.331244] pc : drm_atomic_helper_wait_for_vblanks.part.0+0x290/0x2b4
[   70.337762] lr : drm_atomic_helper_wait_for_vblanks.part.0+0x290/0x2b4
[   70.344279] sp : 892339e0
[   70.347583] x29: 892339e0 x28

Re: [PATCH v2, 0/4] Cooperate with DSI RX devices to modify dsi funcs and delay mipi high to cooperate with panel sequence

2022-03-04 Thread Benjamin Gaignard



Le 04/03/2022 à 11:15, xinlei@mediatek.com a écrit :

From: Xinlei Lee 

In upstream-v5.8, dsi_enable will operate panel_enable, but this
modification has been moved in v5.9. In order to ensure the timing of
dsi_power_on/off and the timing of pulling up/down the MIPI signal,
the modification of v5.9 is synchronized in this series of patches.


Hello,

I'm trying to debug an issue on mt8183 kukui krane sku176 device.
The problem is that boe-tv101wum-nl6 panel isn't working.
At boot time I can see these logs:
panel-boe-tv101wum-nl6 14014000.dsi.0: failed to write command 1
panel-boe-tv101wum-nl6 14014000.dsi.0: failed to init panel: -62
and a DSI interrupt time out.

Since I believe the problem is link to DSI/panel enabling sequence
I have try this series but that doesn't solve the issue.
I notice that when going out of deep sleep mode panel is functional.

May you have any idea to debug/solve this problem ?

Regards,
Benjamin



Changes since v1:
1. Dsi sequence marked with patch adjustment
2. Fixes: mtk_dsi: Use the drm_panel_bridge

Jitao Shi (3):
   drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
   drm/mediatek: Separate poweron/poweroff from enable/disable and define
 new funcs
   drm/mediatek: keep dsi as LP00 before dcs cmds transfer

Xinlei Lee (1):
   drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff
 function

  drivers/gpu/drm/mediatek/mtk_dsi.c | 73 --
  1 file changed, 49 insertions(+), 24 deletions(-)



[PATCH] drm/panel: boe-tv101wum-nl6: Fix errors cases handling in prepare function

2022-02-23 Thread Benjamin Gaignard
Make sure that pp3300 regulator and enable gpio are cleaned before
leave in error cases.

Fixes: 18c58153b8c62 ("drm/panel: boe-tv101wum-nl6: Support enabling a 3.3V 
rail")
Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c 
b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index 5fcbde789ddb..382a17bb96d8 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -1245,11 +1245,11 @@ static int boe_panel_prepare(struct drm_panel *panel)
 
ret = regulator_enable(boe->pp3300);
if (ret < 0)
-   return ret;
+   goto disablegpio;
 
ret = regulator_enable(boe->pp1800);
if (ret < 0)
-   return ret;
+   goto poweroff3v3;
 
usleep_range(3000, 5000);
 
@@ -1286,6 +1286,9 @@ static int boe_panel_prepare(struct drm_panel *panel)
 poweroff1v8:
usleep_range(5000, 7000);
regulator_disable(boe->pp1800);
+poweroff3v3:
+   regulator_disable(boe->pp3300);
+disablegpio:
gpiod_set_value(boe->enable_gpio, 0);
 
return ret;
-- 
2.32.0



Re: [PATCH v11, 04/19] media: mtk-vcodec: export decoder pm functions

2021-11-30 Thread Benjamin Gaignard



Le 29/11/2021 à 04:41, Yunfei Dong a écrit :

Register each hardware as platform device, need to call pm functions
to open/close power and clock from module mtk-vcodec-dec, export these
functions.


The commit message confuse me, maybe something like:
"When mtk vcodec decoder is build as a module we need to export
mtk-vcodec-dec pm functions to make them visible by the other components"

With that:
Reviewed-by: Benjamin Gaignard 



Signed-off-by: Yunfei Dong 
---
  drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
index 20bd157a855c..221cf60e9fbf 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
@@ -77,12 +77,14 @@ int mtk_vcodec_init_dec_pm(struct platform_device *pdev,
put_device(pm->larbvdec);
return ret;
  }
+EXPORT_SYMBOL_GPL(mtk_vcodec_init_dec_pm);
  
  void mtk_vcodec_release_dec_pm(struct mtk_vcodec_pm *pm)

  {
pm_runtime_disable(pm->dev);
put_device(pm->larbvdec);
  }
+EXPORT_SYMBOL_GPL(mtk_vcodec_release_dec_pm);
  
  int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)

  {
@@ -94,6 +96,7 @@ int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm)
  
  	return ret;

  }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_on);
  
  void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)

  {
@@ -103,6 +106,7 @@ void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm)
if (ret)
mtk_v4l2_err("pm_runtime_put_sync fail %d", ret);
  }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_pw_off);
  
  void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)

  {
@@ -129,6 +133,7 @@ void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)
for (i -= 1; i >= 0; i--)
clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
  }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_on);
  
  void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)

  {
@@ -139,3 +144,4 @@ void mtk_vcodec_dec_clock_off(struct mtk_vcodec_pm *pm)
for (i = dec_clk->clk_num - 1; i >= 0; i--)
clk_disable_unprepare(dec_clk->clk_info[i].vcodec_clk);
  }
+EXPORT_SYMBOL_GPL(mtk_vcodec_dec_clock_off);


Re: [PATCH v11, 01/19] media: mtk-vcodec: Get numbers of register bases from DT

2021-11-30 Thread Benjamin Gaignard



Le 29/11/2021 à 04:41, Yunfei Dong a écrit :

Different platform may has different numbers of register bases. Gets the
numbers of register bases from DT (sizeof(u32) * 4 bytes for each).

Reviewed-by: Tzung-Bi Shih
Signed-off-by: Yunfei Dong 
---
  .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c  | 37 ++-
  1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index e6e6a8203eeb..59caf2163349 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -78,6 +78,30 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void 
*priv)
return IRQ_HANDLED;
  }
  
+static int mtk_vcodec_get_reg_bases(struct mtk_vcodec_dev *dev)

+{
+   struct platform_device *pdev = dev->plat_dev;
+   int reg_num, i;
+
+   /* Sizeof(u32) * 4 bytes for each register base. */
+   reg_num = of_property_count_elems_of_size(pdev->dev.of_node, "reg",
+   sizeof(u32) * 4);


It looks strange for me to have a "reg" size equal to sizeof(u32) * 4. Usually
we more see reg size = sizeof(u32).


+   if (reg_num <= 0 || reg_num > NUM_MAX_VDEC_REG_BASE) {


If reg_num = NUM_MAX_VDEC_REG_BASE you will iterate out of bounds of 
dev->reg_base array.
That never happens because dev->reg_base size equal NUM_MAX_VCODEC_REG_BASE.
The question is what is the real needed size for dev->reg_base array ? 
NUM_MAX_VDEC_REG_BASE or
NUM_MAX_VCODEC_REG_BASE ?

Regards,
Benjamin


+   dev_err(>dev, "Invalid register property size: %d\n", 
reg_num);
+   return -EINVAL;
+   }
+
+   for (i = 0; i < reg_num; i++) {
+   dev->reg_base[i] = devm_platform_ioremap_resource(pdev, i);
+   if (IS_ERR(dev->reg_base[i]))
+   return PTR_ERR(dev->reg_base[i]);
+
+   mtk_v4l2_debug(2, "reg[%d] base=%p", i, dev->reg_base[i]);
+   }
+
+   return 0;
+}
+
  static int fops_vcodec_open(struct file *file)
  {
struct mtk_vcodec_dev *dev = video_drvdata(file);
@@ -206,7 +230,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
struct resource *res;
phandle rproc_phandle;
enum mtk_vcodec_fw_type fw_type;
-   int i, ret;
+   int ret;
  
  	dev = devm_kzalloc(>dev, sizeof(*dev), GFP_KERNEL);

if (!dev)
@@ -238,14 +262,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
goto err_dec_pm;
}
  
-	for (i = 0; i < NUM_MAX_VDEC_REG_BASE; i++) {

-   dev->reg_base[i] = devm_platform_ioremap_resource(pdev, i);
-   if (IS_ERR((__force void *)dev->reg_base[i])) {
-   ret = PTR_ERR((__force void *)dev->reg_base[i]);
-   goto err_res;
-   }
-   mtk_v4l2_debug(2, "reg[%d] base=%p", i, dev->reg_base[i]);
-   }
+   ret = mtk_vcodec_get_reg_bases(dev);
+   if (ret)
+   goto err_res;
  
  	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

if (res == NULL) {


Re: [PATCH v6, 12/15] media: mtk-vcodec: Support 34bits dma address for vdec

2021-10-07 Thread Benjamin Gaignard



Le 01/09/2021 à 10:32, Yunfei Dong a écrit :

Use the dma_set_mask_and_coherent helper to set vdec
DMA bit mask to support 34bits iova space(16GB) that
the mt8192 iommu HW support.

Whole the iova range separate to 0~4G/4G~8G/8G~12G/12G~16G,
regarding which iova range VDEC actually locate, it
depends on the dma-ranges property of vdec dtsi node.

Signed-off-by: Yunfei Dong 
---
  drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index 002352fcf8de..1a8d9308327d 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -417,6 +417,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
}
}
  
+	if (of_get_property(pdev->dev.of_node, "dma-ranges", NULL))

+   dma_set_mask_and_coherent(>dev, DMA_BIT_MASK(34));
+


Hi Yunfei,

Does all SoC support 34bits iova space ?
If not you need to also check SoC version before setting dma mask.

Regards,
Benjamin


for (i = 0; i < MTK_VDEC_HW_MAX; i++)
mutex_init(>dec_mutex[i]);
spin_lock_init(>irqlock);


[PATCH v2 1/2] dt-bindings: display: rockchip: Add compatible for rk3568 HDMI

2021-07-08 Thread Benjamin Gaignard
Define a new compatible for rk3568 HDMI.
This version of HDMI hardware block needs two new clocks hclk_vio and hclk
to provide phy reference clocks.

Signed-off-by: Benjamin Gaignard 
---
version 2:
- Add the clocks needed for the phy.

 .../bindings/display/rockchip/rockchip,dw-hdmi.yaml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml 
b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml
index 75cd9c686e985..cb8643b3a8b84 100644
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml
@@ -23,6 +23,7 @@ properties:
   - rockchip,rk3288-dw-hdmi
   - rockchip,rk3328-dw-hdmi
   - rockchip,rk3399-dw-hdmi
+  - rockchip,rk3568-dw-hdmi
 
   reg-io-width:
 const: 4
@@ -51,8 +52,11 @@ properties:
   - vpll
   - enum:
   - grf
+  - hclk_vio
+  - vpll
+  - enum:
+  - hclk
   - vpll
-  - const: vpll
 
   ddc-i2c-bus:
 $ref: /schemas/types.yaml#/definitions/phandle
-- 
2.25.1



[PATCH v2 2/2] drm/rockchip: dw_hdmi: add rk3568 support

2021-07-08 Thread Benjamin Gaignard
Add a new dw_hdmi_plat_data struct and new compatible for rk3568.
This version of the HDMI hardware block need two clocks to provide
phy reference clock: hclk_vio and hclk.

Signed-off-by: Benjamin Gaignard 
---
version 2:
- Add the clocks needed for the phy.

 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 68 +
 1 file changed, 68 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 830bdd5e9b7ce..dc0e255e45745 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -50,6 +50,10 @@
 #define RK3399_GRF_SOC_CON20   0x6250
 #define RK3399_HDMI_LCDC_SEL   BIT(6)
 
+#define RK3568_GRF_VO_CON1 0x0364
+#define RK3568_HDMI_SDAIN_MSK  BIT(15)
+#define RK3568_HDMI_SCLIN_MSK  BIT(14)
+
 #define HIWORD_UPDATE(val, mask)   (val | (mask) << 16)
 
 /**
@@ -71,6 +75,8 @@ struct rockchip_hdmi {
const struct rockchip_hdmi_chip_data *chip_data;
struct clk *vpll_clk;
struct clk *grf_clk;
+   struct clk *hclk_vio;
+   struct clk *hclk_vop;
struct dw_hdmi *hdmi;
struct phy *phy;
 };
@@ -216,6 +222,26 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi 
*hdmi)
return PTR_ERR(hdmi->grf_clk);
}
 
+   hdmi->hclk_vio = devm_clk_get(hdmi->dev, "hclk_vio");
+   if (PTR_ERR(hdmi->hclk_vio) == -ENOENT) {
+   hdmi->hclk_vio = NULL;
+   } else if (PTR_ERR(hdmi->hclk_vio) == -EPROBE_DEFER) {
+   return -EPROBE_DEFER;
+   } else if (IS_ERR(hdmi->hclk_vio)) {
+   dev_err(hdmi->dev, "failed to get hclk_vio clock\n");
+   return PTR_ERR(hdmi->hclk_vio);
+   }
+
+   hdmi->hclk_vop = devm_clk_get(hdmi->dev, "hclk");
+   if (PTR_ERR(hdmi->hclk_vop) == -ENOENT) {
+   hdmi->hclk_vop = NULL;
+   } else if (PTR_ERR(hdmi->hclk_vop) == -EPROBE_DEFER) {
+   return -EPROBE_DEFER;
+   } else if (IS_ERR(hdmi->hclk_vop)) {
+   dev_err(hdmi->dev, "failed to get hclk_vop clock\n");
+   return PTR_ERR(hdmi->hclk_vop);
+   }
+
return 0;
 }
 
@@ -467,6 +493,19 @@ static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data 
= {
.use_drm_infoframe = true,
 };
 
+static struct rockchip_hdmi_chip_data rk3568_chip_data = {
+   .lcdsel_grf_reg = -1,
+};
+
+static const struct dw_hdmi_plat_data rk3568_hdmi_drv_data = {
+   .mode_valid = dw_hdmi_rockchip_mode_valid,
+   .mpll_cfg   = rockchip_mpll_cfg,
+   .cur_ctr= rockchip_cur_ctr,
+   .phy_config = rockchip_phy_config,
+   .phy_data = _chip_data,
+   .use_drm_infoframe = true,
+};
+
 static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = {
{ .compatible = "rockchip,rk3228-dw-hdmi",
  .data = _hdmi_drv_data
@@ -480,6 +519,9 @@ static const struct of_device_id dw_hdmi_rockchip_dt_ids[] 
= {
{ .compatible = "rockchip,rk3399-dw-hdmi",
  .data = _hdmi_drv_data
},
+   { .compatible = "rockchip,rk3568-dw-hdmi",
+ .data = _hdmi_drv_data
+   },
{},
 };
 MODULE_DEVICE_TABLE(of, dw_hdmi_rockchip_dt_ids);
@@ -536,6 +578,28 @@ static int dw_hdmi_rockchip_bind(struct device *dev, 
struct device *master,
return ret;
}
 
+   ret = clk_prepare_enable(hdmi->hclk_vio);
+   if (ret) {
+   dev_err(hdmi->dev, "Failed to enable HDMI hclk_vio: %d\n",
+   ret);
+   return ret;
+   }
+
+   ret = clk_prepare_enable(hdmi->hclk_vop);
+   if (ret) {
+   dev_err(hdmi->dev, "Failed to enable HDMI hclk_vop: %d\n",
+   ret);
+   return ret;
+   }
+
+   if (hdmi->chip_data == _chip_data) {
+   regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1,
+HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK |
+  RK3568_HDMI_SCLIN_MSK,
+  RK3568_HDMI_SDAIN_MSK |
+  RK3568_HDMI_SCLIN_MSK));
+   }
+
hdmi->phy = devm_phy_optional_get(dev, "hdmi");
if (IS_ERR(hdmi->phy)) {
ret = PTR_ERR(hdmi->phy);
@@ -559,6 +623,8 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct 
device *master,
ret = PTR_ERR(hdmi->hdmi);
drm_encoder_cleanup(encoder);
clk_disable_unprepare(hdmi->vpll_clk);
+   clk_disable_unprepare(hdmi->hclk_vio);
+   clk_disable_unprepare(hdmi->hclk_vop);
}
 
return ret;
@@ -571,6 +637,8 @@ static void dw_hdmi_rockchip_unbind(struct device 

[PATCH v2 0/2] Add support of HDMI for rk3568

2021-07-08 Thread Benjamin Gaignard
Add a compatible and platform datas to support HDMI for rk3568 SoC.

version 2:
- Add the clocks needed for the phy.
 
Benjamin Gaignard (2):
  dt-bindings: display: rockchip: Add compatible for rk3568 HDMI
  drm/rockchip: dw_hdmi: add rk3568 support

 .../display/rockchip/rockchip,dw-hdmi.yaml|  6 +-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   | 68 +++
 2 files changed, 73 insertions(+), 1 deletion(-)

-- 
2.25.1



[PATCH 1/2] dt-bindings: display: rockchip: Add compatible for rk3568 HDMI

2021-07-06 Thread Benjamin Gaignard
Define a new compatible for rk3568 HDMI.

Signed-off-by: Benjamin Gaignard 
---
 .../devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml   | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml 
b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml
index 75cd9c686e985..d5f4e8eb6e624 100644
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,dw-hdmi.yaml
@@ -23,6 +23,7 @@ properties:
   - rockchip,rk3288-dw-hdmi
   - rockchip,rk3328-dw-hdmi
   - rockchip,rk3399-dw-hdmi
+  - rockchip,rk3568-dw-hdmi
 
   reg-io-width:
 const: 4
-- 
2.25.1



[PATCH 2/2] drm/rockchip: dw_hdmi: add rk3568 support

2021-07-06 Thread Benjamin Gaignard
Add a new dw_hdmi_plat_data struct and new compatible for rk3568.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 28 +
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 830bdd5e9b7ce..5817c3a9fe64b 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -50,6 +50,10 @@
 #define RK3399_GRF_SOC_CON20   0x6250
 #define RK3399_HDMI_LCDC_SEL   BIT(6)
 
+#define RK3568_GRF_VO_CON1 0x0364
+#define RK3568_HDMI_SDAIN_MSK  BIT(15)
+#define RK3568_HDMI_SCLIN_MSK  BIT(14)
+
 #define HIWORD_UPDATE(val, mask)   (val | (mask) << 16)
 
 /**
@@ -467,6 +471,19 @@ static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data 
= {
.use_drm_infoframe = true,
 };
 
+static struct rockchip_hdmi_chip_data rk3568_chip_data = {
+   .lcdsel_grf_reg = -1,
+};
+
+static const struct dw_hdmi_plat_data rk3568_hdmi_drv_data = {
+   .mode_valid = dw_hdmi_rockchip_mode_valid,
+   .mpll_cfg   = rockchip_mpll_cfg,
+   .cur_ctr= rockchip_cur_ctr,
+   .phy_config = rockchip_phy_config,
+   .phy_data = _chip_data,
+   .use_drm_infoframe = true,
+};
+
 static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = {
{ .compatible = "rockchip,rk3228-dw-hdmi",
  .data = _hdmi_drv_data
@@ -480,6 +497,9 @@ static const struct of_device_id dw_hdmi_rockchip_dt_ids[] 
= {
{ .compatible = "rockchip,rk3399-dw-hdmi",
  .data = _hdmi_drv_data
},
+   { .compatible = "rockchip,rk3568-dw-hdmi",
+ .data = _hdmi_drv_data
+   },
{},
 };
 MODULE_DEVICE_TABLE(of, dw_hdmi_rockchip_dt_ids);
@@ -536,6 +556,14 @@ static int dw_hdmi_rockchip_bind(struct device *dev, 
struct device *master,
return ret;
}
 
+   if (hdmi->chip_data == _chip_data) {
+   regmap_write(hdmi->regmap, RK3568_GRF_VO_CON1,
+HIWORD_UPDATE(RK3568_HDMI_SDAIN_MSK |
+  RK3568_HDMI_SCLIN_MSK,
+  RK3568_HDMI_SDAIN_MSK |
+  RK3568_HDMI_SCLIN_MSK));
+   }
+
hdmi->phy = devm_phy_optional_get(dev, "hdmi");
if (IS_ERR(hdmi->phy)) {
ret = PTR_ERR(hdmi->phy);
-- 
2.25.1



[PATCH 0/2] Add support of HDMI for rk3568

2021-07-06 Thread Benjamin Gaignard
Add a compatible and platform datas to support HDMI for rk3568 SoC.

Benjamin Gaignard (2):
  dt-bindings: display: rockchip: Add compatible for rk3568 HDMI
  drm/rockchip: dw_hdmi: add rk3568 support

 .../display/rockchip/rockchip,dw-hdmi.yaml|  1 +
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c   | 28 +++
 2 files changed, 29 insertions(+)

-- 
2.25.1



[PATCH] drm/agpsupport: Fix warning in functions documentation

2021-01-06 Thread Benjamin Gaignard
Fix the warnings reported in functions documentation when compiling with W=1

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_agpsupport.c | 111 ---
 1 file changed, 59 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/drm_agpsupport.c b/drivers/gpu/drm/drm_agpsupport.c
index 4c7ad46fdd21..db610db9303c 100644
--- a/drivers/gpu/drm/drm_agpsupport.c
+++ b/drivers/gpu/drm/drm_agpsupport.c
@@ -46,16 +46,16 @@
 #include "drm_legacy.h"
 
 /**
- * Get AGP information.
+ * drm_agp_info - Get AGP information.
  *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg pointer to a (output) drm_agp_info structure.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device
+ * @info: drm_agp_info structure to be fill
  *
  * Verifies the AGP device has been initialized and acquired and fills in the
  * drm_agp_info structure with the information in drm_agp_head::agp_info.
+ *
+ * Returns:
+ * zero on success or a negative number on failure.
  */
 int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
 {
@@ -93,13 +93,15 @@ int drm_agp_info_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
- * Acquire the AGP device.
+ * drm_agp_acquire - Acquire the AGP device.
  *
- * \param dev DRM device that is to acquire AGP.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device that is to acquire AGP.
  *
  * Verifies the AGP device hasn't been acquired before and calls
  * \c agp_backend_acquire.
+ *
+ * Returns:
+ * zero on success or a negative number on failure.
  */
 int drm_agp_acquire(struct drm_device *dev)
 {
@@ -116,16 +118,17 @@ int drm_agp_acquire(struct drm_device *dev)
 EXPORT_SYMBOL(drm_agp_acquire);
 
 /**
- * Acquire the AGP device (ioctl).
+ * drm_agp_acquire_ioctl - Acquire the AGP device (ioctl).
  *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg user argument.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device
+ * @data: private data
+ * @file_priv: DRM file private.
  *
  * Verifies the AGP device hasn't been acquired before and calls
  * \c agp_backend_acquire.
+ *
+ * Returns:
+ * zero on success or a negative number on failure.
  */
 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
  struct drm_file *file_priv)
@@ -134,12 +137,14 @@ int drm_agp_acquire_ioctl(struct drm_device *dev, void 
*data,
 }
 
 /**
- * Release the AGP device.
+ * drm_agp_release - Release the AGP device.
  *
- * \param dev DRM device that is to release AGP.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device that is to release AGP.
  *
  * Verifies the AGP device has been acquired and calls \c agp_backend_release.
+ *
+ * Returns:
+ * zero on success or a negative number on failure.
  */
 int drm_agp_release(struct drm_device *dev)
 {
@@ -158,14 +163,16 @@ int drm_agp_release_ioctl(struct drm_device *dev, void 
*data,
 }
 
 /**
- * Enable the AGP bus.
+ * drm_agp_enable - Enable the AGP bus.
  *
- * \param dev DRM device that has previously acquired AGP.
- * \param mode Requested AGP mode.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device that has previously acquired AGP.
+ * @mode: Requested AGP mode.
  *
  * Verifies the AGP device has been acquired but not enabled, and calls
  * \c agp_enable.
+ *
+ * Returns:
+ * zero on success or a negative number on failure.
  */
 int drm_agp_enable(struct drm_device *dev, struct drm_agp_mode mode)
 {
@@ -188,16 +195,16 @@ int drm_agp_enable_ioctl(struct drm_device *dev, void 
*data,
 }
 
 /**
- * Allocate AGP memory.
+ * drm_agp_alloc - Allocate AGP memory.
  *
- * \param inode device inode.
- * \param file_priv file private pointer.
- * \param cmd command.
- * \param arg pointer to a drm_agp_buffer structure.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device
+ * @request: memory allocation request
  *
  * Verifies the AGP device is present and has been acquired, allocates the
  * memory via agp_allocate_memory() and creates a drm_agp_mem entry for it.
+ *
+ * Returns:
+ * zero on success or a negative number on failure.
  */
 int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
 {
@@ -243,13 +250,14 @@ int drm_agp_alloc_ioctl(struct drm_device *dev, void 
*data,
 }
 
 /**
- * Search for the AGP memory entry associated with a handle.
+ * drm_agp_lookup_entry - Search for the AGP memory entry associated with a 
handle.
  *
- * \param dev DRM device structure.
- * \param handle AGP memory handle.
- * \return pointer to the drm_agp_mem structure associated with \p handle.
+ * @dev: DRM device structure.
+ * @handle: AGP memory handle.
  *
  * Walks through drm_agp_head::memory until finding a matching handle.
+ *
+ * Returns: pointer to the drm_agp_mem structure associat

Re: [PATCH] drm/stm: ltdc: remove call of pm-runtime functions

2020-07-08 Thread Benjamin Gaignard
Le jeu. 2 juil. 2020 à 14:18, Philippe CORNU  a écrit :
>
>
>
> On 7/1/20 2:04 PM, Yannick Fertre wrote:
> > It is not necessary to suspend or stop the ltdc clocks
> > to modify the pixel clock.
> >
> > Signed-off-by: Yannick Fertre 
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 16 
> >   1 file changed, 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 3f590d916e91..6e28f707092f 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -506,15 +506,7 @@ static bool ltdc_crtc_mode_fixup(struct drm_crtc *crtc,
> >struct drm_display_mode *adjusted_mode)
> >   {
> >   struct ltdc_device *ldev = crtc_to_ltdc(crtc);
> > - struct drm_device *ddev = crtc->dev;
> >   int rate = mode->clock * 1000;
> > - bool runtime_active;
> > - int ret;
> > -
> > - runtime_active = pm_runtime_active(ddev->dev);
> > -
> > - if (runtime_active)
> > - pm_runtime_put_sync(ddev->dev);
> >
> >   if (clk_set_rate(ldev->pixel_clk, rate) < 0) {
> >   DRM_ERROR("Cannot set rate (%dHz) for pixel clk\n", rate);
> > @@ -523,14 +515,6 @@ static bool ltdc_crtc_mode_fixup(struct drm_crtc *crtc,
> >
> >   adjusted_mode->clock = clk_get_rate(ldev->pixel_clk) / 1000;
> >
> > - if (runtime_active) {
> > - ret = pm_runtime_get_sync(ddev->dev);
> > - if (ret) {
> > - DRM_ERROR("Failed to fixup mode, cannot get sync\n");
> > - return false;
> > - }
> > - }
> > -
> >   DRM_DEBUG_DRIVER("requested clock %dkHz, adjusted clock %dkHz\n",
> >mode->clock, adjusted_mode->clock);
> >
> >
> Hi Yannick,
> Many thanks for your patch,
> Acked-by: Philippe Cornu 
> Philippe :-)

Applied on drm-misc-next.

Thanks,
Benjamin

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


Re: [PATCH] drm/stm: repair runtime power management

2020-07-08 Thread Benjamin Gaignard
Le jeu. 2 juil. 2020 à 14:31, Philippe CORNU  a écrit :
>
>
>
> On 2/29/20 11:16 PM, Marek Vasut wrote:
> > Add missing pm_runtime_get_sync() into ltdc_crtc_atomic_enable() to
> > match pm_runtime_put_sync() in ltdc_crtc_atomic_disable(), otherwise
> > the LTDC might suspend via runtime PM, disable clock, and then fail
> > to resume later on.
> >
> > The test which triggers it is roughly -- run qt5 application which
> > uses eglfs platform and etnaviv, stop the application, sleep for 15
> > minutes, run the application again. This leads to a timeout waiting
> > for vsync, because the LTDC has suspended, but did not resume.
> >
> > Fixes: 35ab6cfbf211 ("drm/stm: support runtime power management")
> > Signed-off-by: Marek Vasut 
> > Cc: Yannick Fertré 
> > Cc: Philippe Cornu 
> > Cc: Benjamin Gaignard 
> > Cc: Vincent Abriou 
> > Cc: Maxime Coquelin 
> > Cc: Alexandre Torgue 
> > To: dri-devel@lists.freedesktop.org
> > Cc: linux-st...@st-md-mailman.stormreply.com
> > Cc: linux-arm-ker...@lists.infradead.org
> > ---
> > [ cut here ]
> > WARNING: CPU: 0 PID: 297 at drivers/gpu/drm/drm_atomic_helper.c:1494 
> > drm_atomic_helper_wait_for_vblanks+0x1dc/0x200
> > [CRTC:35:crtc-0] vblank wait timed out
> > Modules linked in:
> > CPU: 0 PID: 297 Comm: QSGRenderThread Not tainted 
> > 5.6.0-rc3-next-20200228-00010-g318bf0fc08ef #2
> > Hardware name: STM32 (Device Tree Support)
> > [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
> > [] (show_stack) from [] (dump_stack+0xb4/0xd0)
> > [] (dump_stack) from [] (__warn+0xd4/0xf0)
> > [] (__warn) from [] (warn_slowpath_fmt+0x78/0xa8)
> > [] (warn_slowpath_fmt) from [] 
> > (drm_atomic_helper_wait_for_vblanks+0x1dc/0x200)
> > [] (drm_atomic_helper_wait_for_vblanks) from [] 
> > (drm_atomic_helper_commit_tail+0
> > x50/0x60)
> > [] (drm_atomic_helper_commit_tail) from [] 
> > (commit_tail+0x12c/0x13c)
> > [] (commit_tail) from [] 
> > (drm_atomic_helper_commit+0xf4/0x100)
> > [] (drm_atomic_helper_commit) from [] 
> > (drm_atomic_helper_set_config+0x58/0x6c)
> > [] (drm_atomic_helper_set_config) from [] 
> > (drm_mode_setcrtc+0x450/0x550)
> > [] (drm_mode_setcrtc) from [] 
> > (drm_ioctl_kernel+0x90/0xe8)
> > [] (drm_ioctl_kernel) from [] (drm_ioctl+0x2e4/0x32c)
> > [] (drm_ioctl) from [] (vfs_ioctl+0x20/0x38)
> > [] (vfs_ioctl) from [] (ksys_ioctl+0xbc/0x7b0)
> > [] (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x54)
> > Exception stack(0xee8f3fa8 to 0xee8f3ff0)
> > 3fa0:   0005 adcbeb18 0005 c06864a2 adcbeb18 
> > 0001
> > 3fc0: 0005 adcbeb18 c06864a2 0036 0029 0023 0023 
> > 0007
> > 3fe0: b113b098 adcbeafc b1125413 b6155cf8
> > ---[ end trace 2ad5ba954ceb767a ]---
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 99bf93e8b36f..301de0498078 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -425,9 +425,12 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc 
> > *crtc,
> >   struct drm_crtc_state *old_state)
> >   {
> >   struct ltdc_device *ldev = crtc_to_ltdc(crtc);
> > + struct drm_device *ddev = crtc->dev;
> >
> >   DRM_DEBUG_DRIVER("\n");
> >
> > + pm_runtime_get_sync(ddev->dev);
> > +
> >   /* Sets the background color value */
> >   reg_write(ldev->regs, LTDC_BCCR, BCCR_BCBLACK);
> >
> >
> Hi Marek,
> Many thanks for your patch,
> Acked-by: Philippe Cornu 
> Tested-by: Yannick Fertre 
>
>
> Hi Benjamin,
> Could you please apply "drm/stm: ltdc: remove call of pm-runtime
> functions" **before** this one. Thank you.

Applied on drm-misc-next.

Thanks,
Benjamin

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


Re: [Linux-stm32] [PATCH v3 3/5] ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board

2020-05-16 Thread Benjamin GAIGNARD



On 5/15/20 11:24 AM, dillon min wrote:
> Hi Benjamin,
>
> thanks for reply.
>
> On Fri, May 15, 2020 at 4:31 PM Benjamin GAIGNARD
>  wrote:
>>
>>
>> On 5/14/20 3:07 PM, dillon min wrote:
>>> Hi Alexandre,
>>>
>>> On Thu, May 14, 2020 at 8:53 PM Alexandre Torgue
>>>  wrote:
>>>>
>>>> On 5/14/20 10:24 AM, Linus Walleij wrote:
>>>>> On Tue, May 12, 2020 at 9:04 AM  wrote:
>>>>>
>>>>>> From: dillon min 
>>>>>>
>>>>>> Enable the ltdc & ili9341 on stm32429-disco board.
>>>>>>
>>>>>> Signed-off-by: dillon min 
>>>>> This mostly looks good but...
>>>>>
>>>>>> + {
>>>>>> +   status = "okay";
>>>>>> +   pinctrl-0 = <_pins>;
>>>>>> +   pinctrl-names = "default";
>>>>>> +   #address-cells = <1>;
>>>>>> +   #size-cells = <0>;
>>>>>> +   cs-gpios = < 2 GPIO_ACTIVE_LOW>;
>>>>>> +   dmas = < 3 2 0x400 0x0>,
>>>>>> +  < 4 2 0x400 0x0>;
>>>>>> +   dma-names = "rx", "tx";
>>>>> These DMA assignments seem to be SoC things and should
>>>>> rather be in the DTS(I) file where  is defined, right?
>>>>> stm32f429.dtsi I suppose?
>>>> I agree with Linus, DMA have to be defined in SoC dtsi. And if a board
>>>> doesn't want to use it, we use the "delete-property".
>>> Yes, will move to Soc dtsi in next submits.
>>>
>>> i'm working on write a v4l2-m2m driver for dma2d of stm32 to support
>>> pixel conversion
>>> alpha blending between foreground and background graphics.
>>>
>>> as you know, some soc's engineer trying to add this function to drm system.
>>>
>>> do you know st's planning about soc's hardware accelerator driver on 
>>> stm32mp?
>>> such as chrom-art, will add to drm subsystem via ioctl to access, or to 
>>> v4l2,
>> On stm32mp we do not plan to use chrom-art in drm or v4l2 because it
>> does fit
>> with userland way of working. We use the GPU to do conversion, scaling,
>> blending
>> and composition in only one go.
>> As explain here [1] DRM subsytem it isn't a solution and v4l2-m2m isn't
>> used in any
>> mainline compositors like Weston or android surfaceflinger.
>>
>> Benjamin
>>
> After check stm32mp's datasheets, they don't have chrom-art ip inside. sorry 
> for
> didn't check it yet.
>
> for stm32h7 series with chrom-art, jpeg hardware accelerator inside.
> does st has plan to
> setup a driver to support it ? i prefer v4l2-m2m should be easier to
> implement it.
> co work with dcmi, fbdev.
ST doesn't plan to create a driver for chrom-art because nothing in 
mainline
userland could use it.

Benjamin
>
> thanks.
>
> best regards.
>
> Dillon
>> [1]
>> https://www.phoronix.com/scan.php?page=news_item=Linux-DRM-No-2D-Accel-API
>>> thanks.
>>>
>>>>> It is likely the same no matter which device is using spi5.
>>>>>
>>>>> Yours,
>>>>> Linus Walleij
>>>>>
>>> ___
>>> Linux-stm32 mailing list
>>> linux-st...@st-md-mailman.stormreply.com
>>> https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Linux-stm32] [PATCH v3 3/5] ARM: dts: stm32: enable ltdc binding with ili9341 on stm32429-disco board

2020-05-16 Thread Benjamin GAIGNARD



On 5/14/20 3:07 PM, dillon min wrote:
> Hi Alexandre,
>
> On Thu, May 14, 2020 at 8:53 PM Alexandre Torgue
>  wrote:
>>
>>
>> On 5/14/20 10:24 AM, Linus Walleij wrote:
>>> On Tue, May 12, 2020 at 9:04 AM  wrote:
>>>
 From: dillon min 

 Enable the ltdc & ili9341 on stm32429-disco board.

 Signed-off-by: dillon min 
>>> This mostly looks good but...
>>>
 + {
 +   status = "okay";
 +   pinctrl-0 = <_pins>;
 +   pinctrl-names = "default";
 +   #address-cells = <1>;
 +   #size-cells = <0>;
 +   cs-gpios = < 2 GPIO_ACTIVE_LOW>;
 +   dmas = < 3 2 0x400 0x0>,
 +  < 4 2 0x400 0x0>;
 +   dma-names = "rx", "tx";
>>> These DMA assignments seem to be SoC things and should
>>> rather be in the DTS(I) file where  is defined, right?
>>> stm32f429.dtsi I suppose?
>> I agree with Linus, DMA have to be defined in SoC dtsi. And if a board
>> doesn't want to use it, we use the "delete-property".
> Yes, will move to Soc dtsi in next submits.
>
> i'm working on write a v4l2-m2m driver for dma2d of stm32 to support
> pixel conversion
> alpha blending between foreground and background graphics.
>
> as you know, some soc's engineer trying to add this function to drm system.
>
> do you know st's planning about soc's hardware accelerator driver on stm32mp?
> such as chrom-art, will add to drm subsystem via ioctl to access, or to v4l2,
On stm32mp we do not plan to use chrom-art in drm or v4l2 because it 
does fit
with userland way of working. We use the GPU to do conversion, scaling, 
blending
and composition in only one go.
As explain here [1] DRM subsytem it isn't a solution and v4l2-m2m isn't 
used in any
mainline compositors like Weston or android surfaceflinger.

Benjamin

[1] 
https://www.phoronix.com/scan.php?page=news_item=Linux-DRM-No-2D-Accel-API
>
> thanks.
>
>>> It is likely the same no matter which device is using spi5.
>>>
>>> Yours,
>>> Linus Walleij
>>>
> ___
> Linux-stm32 mailing list
> linux-st...@st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 4/4] dt-bindings: Add missing 'additionalProperties: false'

2020-03-26 Thread Benjamin Gaignard
Le mer. 25 mars 2020 à 23:06, Rob Herring  a écrit :
>
> Setting 'additionalProperties: false' is frequently omitted, but is
> important in order to check that there aren't extra undocumented
> properties in a binding.
>
> Ideally, we'd just add this automatically and make this the default, but
> there's some cases where it doesn't work. For example, if a common
> schema is referenced, then properties in the common schema aren't part
> of what's considered for 'additionalProperties'. Also, sometimes there
> are bus specific properties such as 'spi-max-frequency' that go into
> bus child nodes, but aren't defined in the child node's schema.
>
> So let's stick with the json-schema defined default and add
> 'additionalProperties: false' where needed. This will be a continual
> review comment and game of wack-a-mole.

for stm32 bindings:
Reviewed-by Benjamin Gaignard 



>
> Signed-off-by: Rob Herring 
> ---
>  .../devicetree/bindings/arm/altera/socfpga-clk-manager.yaml| 2 ++
>  .../bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml   | 2 ++
>  Documentation/devicetree/bindings/arm/msm/qcom,llcc.yaml   | 2 ++
>  Documentation/devicetree/bindings/arm/renesas,prr.yaml | 2 ++
>  .../devicetree/bindings/arm/samsung/exynos-chipid.yaml | 2 ++
>  Documentation/devicetree/bindings/arm/samsung/pmu.yaml | 2 ++
>  .../bindings/arm/samsung/samsung-secure-firmware.yaml  | 2 ++
>  .../devicetree/bindings/arm/stm32/st,stm32-syscon.yaml | 2 ++
>  Documentation/devicetree/bindings/clock/fsl,plldig.yaml| 2 ++
>  Documentation/devicetree/bindings/clock/imx8mn-clock.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/imx8mp-clock.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/milbeaut-clock.yaml| 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-ipq8074.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-msm8996.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-msm8998.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-qcs404.yaml   | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-sc7180.yaml   | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc-sm8150.yaml   | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,gcc.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,mmcc.yaml | 2 ++
>  .../devicetree/bindings/clock/qcom,msm8998-gpucc.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,rpmhcc.yaml   | 2 ++
>  .../devicetree/bindings/clock/qcom,sc7180-dispcc.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,sc7180-gpucc.yaml | 2 ++
>  .../devicetree/bindings/clock/qcom,sc7180-videocc.yaml | 2 ++
>  .../devicetree/bindings/clock/qcom,sdm845-dispcc.yaml  | 2 ++
>  Documentation/devicetree/bindings/clock/qcom,sdm845-gpucc.yaml | 2 ++
>  .../devicetree/bindings/clock/qcom,sdm845-videocc.yaml | 2 ++
>  .../devicetree/bindings/display/amlogic,meson-vpu.yaml | 2 ++
>  .../devicetree/bindings/dma/sifive,fu540-c000-pdma.yaml| 2 ++
>  Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 2 ++
>  Documentation/devicetree/bindings/eeprom/at24.yaml | 2 ++
>  .../firmware/intel,ixp4xx-network-processing-engine.yaml   | 3 +++
>  .../devicetree/bindings/gpio/brcm,xgs-iproc-gpio.yaml  | 2 ++
>  .../devicetree/bindings/gpio/socionext,uniphier-gpio.yaml  | 2 ++
>  Documentation/devicetree/bindings/gpio/xylon,logicvc-gpio.yaml | 2 ++
>  Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml| 2 ++
>  Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml| 2 ++
>  Documentation/devicetree/bindings/gpu/arm,mali-utgard.yaml | 2 ++
>  Documentation/devicetree/bindings/gpu/samsung-rotator.yaml | 2 ++
>  Documentation/devicetree/bindings/hwmon/adi,adm1177.yaml   | 2 ++
>  Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml   | 2 ++
>  Documentation/devicetree/bindings/hwmon/pmbus/ti,ucd90320.yaml | 2 ++
>  Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml | 2 ++
>  Documentation/devicetree/bindings/iio/accel/bosch,bma400.yaml  | 2 ++
>  Documentation/devicetree/bindings/iio/adc/adi,ad7780.yaml  | 2 ++
>  Documentation/devicetree/bindings/iio/adc/avia-hx711.yaml  | 2 ++
>  Documentation/devicetree/bindings/iio/adc/lltc,ltc2496.yaml| 2 ++
>  .../devicetree/bindings/iio/adc/microchip,mcp3911.yaml | 2 ++
>  .../devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml| 2 ++
>  .../devicetree/bindings/iio/chemical/plantower,pms7003.yaml| 2 ++
>  .../devicetree/bindings/iio/chemical/sensirion,sps30.yaml

Re: [PATCH v2] drm: context: Clean up documentation

2020-03-17 Thread Benjamin GAIGNARD



On 3/6/20 12:08 PM, Daniel Vetter wrote:
> Acked-by: Daniel Vetter
The series has been pushed on drm-misc-next.

Thanks,

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


Re: [PATCH] MAINTAINERS: adjust to VIVANTE GPU schema conversion

2020-03-16 Thread Benjamin GAIGNARD



On 3/15/20 8:21 AM, Lukas Bulwahn wrote:
> Commit 90aeca875f8a ("dt-bindings: display: Convert etnaviv to
> json-schema") missed to adjust the DRM DRIVERS FOR VIVANTE GPU IP entry
> in MAINTAINERS.
>
> Since then, ./scripts/get_maintainer.pl --self-test complains:
>
>warning: no file matches \
>F: Documentation/devicetree/bindings/display/etnaviv/
>
> Update MAINTAINERS entry to location of converted schema.
>
> Signed-off-by: Lukas Bulwahn 
Reviewed-by: Benjamin Gaignard 

Thanks
> ---
> applies cleanly on next-20200313
>
> Benjamin, please ack.
> Rob, please pick this patch (it is not urgent, though)
>
>
>   MAINTAINERS | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 77eede976d0f..50a7a6d62e06 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5766,7 +5766,7 @@ L:  dri-devel@lists.freedesktop.org
>   S:  Maintained
>   F:  drivers/gpu/drm/etnaviv/
>   F:  include/uapi/drm/etnaviv_drm.h
> -F:   Documentation/devicetree/bindings/display/etnaviv/
> +F:   Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>   
>   DRM DRIVERS FOR ZTE ZX
>   M:  Shawn Guo 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 1/1] dt-bindings: display: fix panel warnings

2020-03-13 Thread Benjamin GAIGNARD



On 3/8/20 12:50 PM, Sam Ravnborg wrote:
> Fix following type af warnings in the panel bindings:
>
> Warning (unit_address_vs_reg): /example-0/dsi/panel: node has a reg or ranges 
> property, but no unit name
> Warning (unit_address_vs_reg): /example-0/dsi@ff45: node has a unit name, 
> but no reg property
>
> Removing the "@xxx" from the node name fixed first warning.
> Adding a missing reg property fixed the second warning
>
> Signed-off-by: Sam Ravnborg 
> Cc: Thierry Reding 
> Cc: Linus Walleij 
> Cc: Rob Herring 
> Cc: Heiko Stuebner 
> Cc: Maxime Ripard 
> Cc: Benjamin Gaignard 
> Cc: Laurent Pinchart 

I will add W=1 in my command line when check the yaml files to not 
reproduce this later.

Reviewed-by: Benjamin Gaignard 

Thanks,
Benjamin

> ---
>   .../devicetree/bindings/display/panel/elida,kd35t133.yaml | 2 +-
>   .../bindings/display/panel/leadtek,ltk500hd1829.yaml  | 2 +-
>   .../devicetree/bindings/display/panel/novatek,nt35510.yaml| 4 ++--
>   .../devicetree/bindings/display/panel/orisetech,otm8009a.yaml | 2 +-
>   .../devicetree/bindings/display/panel/panel-dpi.yaml  | 2 +-
>   .../devicetree/bindings/display/panel/panel-simple-dsi.yaml   | 2 +-
>   .../devicetree/bindings/display/panel/raydium,rm68200.yaml| 2 +-
>   .../devicetree/bindings/display/panel/xinpeng,xpp055c272.yaml | 2 +-
>   8 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/elida,kd35t133.yaml 
> b/Documentation/devicetree/bindings/display/panel/elida,kd35t133.yaml
> index 4bd74eaa61be..aa761f697b7a 100644
> --- a/Documentation/devicetree/bindings/display/panel/elida,kd35t133.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/elida,kd35t133.yaml
> @@ -34,7 +34,7 @@ additionalProperties: false
>   
>   examples:
> - |
> -dsi@ff45 {
> +dsi {
>   #address-cells = <1>;
>   #size-cells = <0>;
>   panel@0 {
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml 
> b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> index 4ebcea7d0c63..2c9b8aa34815 100644
> --- 
> a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> +++ 
> b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> @@ -34,7 +34,7 @@ additionalProperties: false
>   
>   examples:
> - |
> -dsi@ff45 {
> +dsi {
>   #address-cells = <1>;
>   #size-cells = <0>;
>   panel@0 {
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml 
> b/Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
> index 791fc9daa68b..73d2ff3baaff 100644
> --- a/Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/novatek,nt35510.yaml
> @@ -40,10 +40,10 @@ examples:
> - |
>   #include 
>   
> -dsi@a0351000 {
> +dsi {
>   #address-cells = <1>;
>   #size-cells = <0>;
> -panel {
> +panel@0 {
>   compatible = "hydis,hva40wv1", "novatek,nt35510";
>   reg = <0>;
>   vdd-supply = <_ldo_aux4_reg>;
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml 
> b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml
> index 6e6ac995c27b..4b6dda6dbc0f 100644
> --- a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml
> @@ -39,7 +39,7 @@ required:
>   
>   examples:
> - |
> -dsi@0 {
> +dsi {
> #address-cells = <1>;
> #size-cells = <0>;
> panel@0 {
> diff --git a/Documentation/devicetree/bindings/display/panel/panel-dpi.yaml 
> b/Documentation/devicetree/bindings/display/panel/panel-dpi.yaml
> index 5275d350f8cb..f63870384c00 100644
> --- a/Documentation/devicetree/bindings/display/panel/panel-dpi.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/panel-dpi.yaml
> @@ -48,7 +48,7 @@ additionalProperties: false
>   
>   examples:
> - |
> -panel@0 {
> +panel {
>   compatible = "osddisplays,osd057T0559-34ts", "panel-dpi";
>   label = "osddisplay";
>   power-supply = <_supply>;
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
> b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> in

[PATCH] drm: bufs: Clean up documentation

2020-03-07 Thread Benjamin Gaignard
Fix kernel doc comments to avoid warnings when compiling with W=1.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_bufs.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 19297e58b232..dcabf5698333 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -134,7 +134,7 @@ static int drm_map_handle(struct drm_device *dev, struct 
drm_hash_item *hash,
 shift, add);
 }
 
-/**
+/*
  * Core function to create a range of memory available for mapping by a
  * non-root process.
  *
@@ -398,7 +398,7 @@ struct drm_local_map *drm_legacy_findmap(struct drm_device 
*dev,
 }
 EXPORT_SYMBOL(drm_legacy_findmap);
 
-/**
+/*
  * Ioctl to specify a range of memory that is available for mapping by a
  * non-root process.
  *
@@ -499,7 +499,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void 
*data,
return 0;
 }
 
-/**
+/*
  * Remove a map private from list and deallocate resources if the mapping
  * isn't in use.
  *
@@ -659,7 +659,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void 
*data,
return ret;
 }
 
-/**
+/*
  * Cleanup after an error on one of the addbufs() functions.
  *
  * \param dev DRM device.
@@ -694,7 +694,7 @@ static void drm_cleanup_buf_error(struct drm_device *dev,
 }
 
 #if IS_ENABLED(CONFIG_AGP)
-/**
+/*
  * Add AGP buffers for DMA transfers.
  *
  * \param dev struct drm_device to which the buffers are to be added.
@@ -1230,7 +1230,7 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
return 0;
 }
 
-/**
+/*
  * Add buffers for DMA transfers (ioctl).
  *
  * \param inode device inode.
@@ -1271,7 +1271,7 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data,
return ret;
 }
 
-/**
+/*
  * Get information about the buffer mappings.
  *
  * This was originally mean for debugging purposes, or by a sophisticated
@@ -1362,7 +1362,7 @@ int drm_legacy_infobufs(struct drm_device *dev, void 
*data,
return __drm_legacy_infobufs(dev, data, >count, copy_one_buf);
 }
 
-/**
+/*
  * Specifies a low and high water mark for buffer allocation
  *
  * \param inode device inode.
@@ -1411,7 +1411,7 @@ int drm_legacy_markbufs(struct drm_device *dev, void 
*data,
return 0;
 }
 
-/**
+/*
  * Unreserve the buffers in list, previously reserved using drmDMA.
  *
  * \param inode device inode.
@@ -1463,7 +1463,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void 
*data,
return 0;
 }
 
-/**
+/*
  * Maps all of the DMA buffers into client-virtual space (ioctl).
  *
  * \param inode device inode.
-- 
2.15.0

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


[PATCH v2] drm: context: Clean up documentation

2020-03-07 Thread Benjamin Gaignard
Fix kernel doc comments to avoid warnings when compiling with W=1.

Signed-off-by: Benjamin Gaignard 
---
version 2:
- Since it is legacy interface do not fix the description but
  replace /** by /* to remove kerneldoc validation warnings

 drivers/gpu/drm/drm_context.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index 1f802d8e5681..c99be950bf17 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -47,7 +47,7 @@ struct drm_ctx_list {
 /** \name Context bitmap support */
 /*@{*/
 
-/**
+/*
  * Free a handle from the context bitmap.
  *
  * \param dev DRM device.
@@ -68,7 +68,7 @@ void drm_legacy_ctxbitmap_free(struct drm_device * dev, int 
ctx_handle)
mutex_unlock(>struct_mutex);
 }
 
-/**
+/*
  * Context bitmap allocation.
  *
  * \param dev DRM device.
@@ -88,7 +88,7 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
return ret;
 }
 
-/**
+/*
  * Context bitmap initialization.
  *
  * \param dev DRM device.
@@ -104,7 +104,7 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
idr_init(>ctx_idr);
 }
 
-/**
+/*
  * Context bitmap cleanup.
  *
  * \param dev DRM device.
@@ -163,7 +163,7 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, 
struct drm_file *file)
 /** \name Per Context SAREA Support */
 /*@{*/
 
-/**
+/*
  * Get per-context SAREA.
  *
  * \param inode device inode.
@@ -211,7 +211,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void 
*data,
return 0;
 }
 
-/**
+/*
  * Set per-context SAREA.
  *
  * \param inode device inode.
@@ -263,7 +263,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void 
*data,
 /** \name The actual DRM context handling routines */
 /*@{*/
 
-/**
+/*
  * Switch context.
  *
  * \param dev DRM device.
@@ -290,7 +290,7 @@ static int drm_context_switch(struct drm_device * dev, int 
old, int new)
return 0;
 }
 
-/**
+/*
  * Complete context switch.
  *
  * \param dev DRM device.
@@ -318,7 +318,7 @@ static int drm_context_switch_complete(struct drm_device 
*dev,
return 0;
 }
 
-/**
+/*
  * Reserve contexts.
  *
  * \param inode device inode.
@@ -351,7 +351,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data,
return 0;
 }
 
-/**
+/*
  * Add context.
  *
  * \param inode device inode.
@@ -404,7 +404,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
return 0;
 }
 
-/**
+/*
  * Get context.
  *
  * \param inode device inode.
@@ -428,7 +428,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data,
return 0;
 }
 
-/**
+/*
  * Switch context.
  *
  * \param inode device inode.
@@ -452,7 +452,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
return drm_context_switch(dev, dev->last_context, ctx->handle);
 }
 
-/**
+/*
  * New context.
  *
  * \param inode device inode.
@@ -478,7 +478,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
return 0;
 }
 
-/**
+/*
  * Remove context.
  *
  * \param inode device inode.
-- 
2.15.0

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


[PATCH] drm: lock: Clean up documentation

2020-03-07 Thread Benjamin Gaignard
Fix kernel doc comments to avoid warnings when compiling with W=1.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_lock.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index 2c79e8199e3c..f16eefbf2829 100644
--- a/drivers/gpu/drm/drm_lock.c
+++ b/drivers/gpu/drm/drm_lock.c
@@ -46,7 +46,7 @@
 
 static int drm_lock_take(struct drm_lock_data *lock_data, unsigned int 
context);
 
-/**
+/*
  * Take the heavyweight lock.
  *
  * \param lock lock pointer.
@@ -93,7 +93,7 @@ int drm_lock_take(struct drm_lock_data *lock_data,
return 0;
 }
 
-/**
+/*
  * This takes a lock forcibly and hands it to context. Should ONLY be used
  * inside *_unlock to give lock to kernel before calling *_dma_schedule.
  *
@@ -150,7 +150,7 @@ static int drm_legacy_lock_free(struct drm_lock_data 
*lock_data,
return 0;
 }
 
-/**
+/*
  * Lock ioctl.
  *
  * \param inode device inode.
@@ -243,7 +243,7 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
return 0;
 }
 
-/**
+/*
  * Unlock ioctl.
  *
  * \param inode device inode.
@@ -275,7 +275,7 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, 
struct drm_file *file_
return 0;
 }
 
-/**
+/*
  * This function returns immediately and takes the hw lock
  * with the kernel context if it is free, otherwise it gets the highest 
priority when and if
  * it is eventually released.
@@ -287,7 +287,6 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, 
struct drm_file *file_
  * This should be sufficient to wait for GPU idle without
  * having to worry about starvation.
  */
-
 void drm_legacy_idlelock_take(struct drm_lock_data *lock_data)
 {
int ret;
-- 
2.15.0

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


[PATCH] drm: vm: Clean up documentation

2020-03-07 Thread Benjamin Gaignard
Fix kernel doc comments to avoid warnings when compiling with W=1.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_vm.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c
index 64619fe90046..aa88911bbc06 100644
--- a/drivers/gpu/drm/drm_vm.c
+++ b/drivers/gpu/drm/drm_vm.c
@@ -102,7 +102,7 @@ static pgprot_t drm_dma_prot(uint32_t map_type, struct 
vm_area_struct *vma)
return tmp;
 }
 
-/**
+/*
  * \c fault method for AGP virtual memory.
  *
  * \param vma virtual memory area.
@@ -192,7 +192,7 @@ static vm_fault_t drm_vm_fault(struct vm_fault *vmf)
 }
 #endif
 
-/**
+/*
  * \c nopage method for shared virtual memory.
  *
  * \param vma virtual memory area.
@@ -225,7 +225,7 @@ static vm_fault_t drm_vm_shm_fault(struct vm_fault *vmf)
return 0;
 }
 
-/**
+/*
  * \c close method for shared virtual memory.
  *
  * \param vma virtual memory area.
@@ -294,7 +294,7 @@ static void drm_vm_shm_close(struct vm_area_struct *vma)
mutex_unlock(>struct_mutex);
 }
 
-/**
+/*
  * \c fault method for DMA virtual memory.
  *
  * \param address access address.
@@ -329,7 +329,7 @@ static vm_fault_t drm_vm_dma_fault(struct vm_fault *vmf)
return 0;
 }
 
-/**
+/*
  * \c fault method for scatter-gather virtual memory.
  *
  * \param address access address.
@@ -435,7 +435,7 @@ static void drm_vm_close_locked(struct drm_device *dev,
}
 }
 
-/**
+/*
  * \c close method for all virtual memory types.
  *
  * \param vma virtual memory area.
@@ -453,7 +453,7 @@ static void drm_vm_close(struct vm_area_struct *vma)
mutex_unlock(>struct_mutex);
 }
 
-/**
+/*
  * mmap DMA memory.
  *
  * \param file_priv DRM file private.
@@ -513,7 +513,7 @@ static resource_size_t drm_core_get_reg_ofs(struct 
drm_device *dev)
 #endif
 }
 
-/**
+/*
  * mmap DMA memory.
  *
  * \param file_priv DRM file private.
-- 
2.15.0

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


Re: [PATCH] gpu: drm: context: Clean up documentation

2020-03-05 Thread Benjamin GAIGNARD



On 3/4/20 5:07 PM, Emil Velikov wrote:
> On Mon, 3 Feb 2020 at 08:11, Benjamin Gaignard  
> wrote:
>> Fix kernel doc comments to avoid warnings when compiling with W=1.
>>
>> Signed-off-by: Benjamin Gaignard 
>> ---
>>   drivers/gpu/drm/drm_context.c | 145 
>> ++
>>   1 file changed, 61 insertions(+), 84 deletions(-)
>>
> Since we're talking about legacy, aka user mode-setting code, I think
> a wiser solution is to simply remove the documentation. It is _not_
> something we should encourage people to read, let alone use.
>
> Nit: prefix should be "drm:"
Should I assume it is the same for drm_vm.c and drm_bufs.c ?

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


Re: [PATCH] gpu: drm: context: Clean up documentation

2020-03-04 Thread Benjamin Gaignard
Le lun. 3 févr. 2020 à 09:11, Benjamin Gaignard
 a écrit :
>
> Fix kernel doc comments to avoid warnings when compiling with W=1.

gentle ping.

Benjamin

>
> Signed-off-by: Benjamin Gaignard 
> ---
>  drivers/gpu/drm/drm_context.c | 145 
> ++
>  1 file changed, 61 insertions(+), 84 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
> index 1f802d8e5681..54e64d612a2b 100644
> --- a/drivers/gpu/drm/drm_context.c
> +++ b/drivers/gpu/drm/drm_context.c
> @@ -43,15 +43,11 @@ struct drm_ctx_list {
> struct drm_file *tag;
>  };
>
> -/**/
> -/** \name Context bitmap support */
> -/*@{*/
> -
>  /**
> - * Free a handle from the context bitmap.
> + * drm_legacy_ctxbitmap_free() - Free a handle from the context bitmap.
>   *
> - * \param dev DRM device.
> - * \param ctx_handle context handle.
> + * @dev: DRM device.
> + * @ctx_handle: context handle.
>   *
>   * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and 
> the entry
>   * in drm_device::ctx_idr, while holding the drm_device::struct_mutex
> @@ -69,10 +65,10 @@ void drm_legacy_ctxbitmap_free(struct drm_device * dev, 
> int ctx_handle)
>  }
>
>  /**
> - * Context bitmap allocation.
> + * drm_legacy_ctxbitmap_next() - Context bitmap allocation.
>   *
> - * \param dev DRM device.
> - * \return (non-negative) context handle on success or a negative number on 
> failure.
> + * @dev: DRM device.
> + * Return: (non-negative) context handle on success or a negative number on 
> failure.
>   *
>   * Allocate a new idr from drm_device::ctx_idr while holding the
>   * drm_device::struct_mutex lock.
> @@ -89,9 +85,9 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * 
> dev)
>  }
>
>  /**
> - * Context bitmap initialization.
> + * drm_legacy_ctxbitmap_init() - Context bitmap initialization.
>   *
> - * \param dev DRM device.
> + * @dev: DRM device.
>   *
>   * Initialise the drm_device::ctx_idr
>   */
> @@ -105,9 +101,9 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
>  }
>
>  /**
> - * Context bitmap cleanup.
> + * drm_legacy_ctxbitmap_cleanup() - bitmap cleanup.
>   *
> - * \param dev DRM device.
> + * @dev: DRM device.
>   *
>   * Free all idr members using drm_ctx_sarea_free helper function
>   * while holding the drm_device::struct_mutex lock.
> @@ -157,20 +153,13 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, 
> struct drm_file *file)
> mutex_unlock(>ctxlist_mutex);
>  }
>
> -/*@}*/
> -
> -/**/
> -/** \name Per Context SAREA Support */
> -/*@{*/
> -
>  /**
> - * Get per-context SAREA.
> + * drm_legacy_getsareactx() - Get per-context SAREA.
>   *
> - * \param inode device inode.
> - * \param file_priv DRM file private.
> - * \param cmd command.
> - * \param arg user argument pointing to a drm_ctx_priv_map structure.
> - * \return zero on success or a negative number on failure.
> + * @dev: DRM device to operate on
> + * @data: request data
> + * @file_priv: DRM file private.
> + * Return:  zero on success or a negative number on failure.
>   *
>   * Gets the map from drm_device::ctx_idr with the handle specified and
>   * returns its handle.
> @@ -212,13 +201,12 @@ int drm_legacy_getsareactx(struct drm_device *dev, void 
> *data,
>  }
>
>  /**
> - * Set per-context SAREA.
> + * drm_legacy_setsareactx() - Set per-context SAREA.
>   *
> - * \param inode device inode.
> - * \param file_priv DRM file private.
> - * \param cmd command.
> - * \param arg user argument pointing to a drm_ctx_priv_map structure.
> - * \return zero on success or a negative number on failure.
> + * @dev: DRM device to operate on
> + * @data: request data
> + * @file_priv: DRM file private.
> + * Return: zero on success or a negative number on failure.
>   *
>   * Searches the mapping specified in \p arg and update the entry in
>   * drm_device::ctx_idr with it.
> @@ -257,19 +245,13 @@ int drm_legacy_setsareactx(struct drm_device *dev, void 
> *data,
> return 0;
>  }
>
> -/*@}*/
> -
> -/**/
> -/** \name The actual DRM context handling routines */
> -/*@{*/
> -
>  /**
> - * Switch context.
> + * drm_context_switch() - Switch context.
>   *
> - * \param dev DRM device.
> - * \param old old context handle.
> - * \param new new context handle.
> - * \return zero on success or a negative number on failure.
> + * @dev: DRM device.

Re: [PATCH] drm/dp_mst: Check crc4 value while building sideband message

2020-02-28 Thread Benjamin Gaignard
Le mar. 4 févr. 2020 à 20:00, Lyude Paul  a écrit :
>
> Reviewed-by: Lyude Paul 
>

Applied on drm-misc-next
Thanks,
Benjamin

> On Mon, 2020-02-03 at 13:16 +0100, Benjamin Gaignard wrote:
> > Check that computed crc value is matching the one encoded in the message.
> >
> > Signed-off-by: Benjamin Gaignard 
> > ---
> > CC: ly...@redhat.com
> > CC: airl...@linux.ie
> > CC: jani.nik...@linux.intel.com
> >  drivers/gpu/drm/drm_dp_mst_topology.c | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > index 822d2f177f90..eee899d6742b 100644
> > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > @@ -736,6 +736,10 @@ static bool drm_dp_sideband_msg_build(struct
> > drm_dp_sideband_msg_rx *msg,
> >   if (msg->curchunk_idx >= msg->curchunk_len) {
> >   /* do CRC */
> >   crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len -
> > 1);
> > + if (crc4 != msg->chunk[msg->curchunk_len - 1])
> > + print_hex_dump(KERN_DEBUG, "wrong crc",
> > +DUMP_PREFIX_NONE, 16, 1,
> > +msg->chunk,  msg->curchunk_len, false);
> >   /* copy chunk into bigger msg */
> >   memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len -
> > 1);
> >   msg->curlen += msg->curchunk_len - 1;
> --
> Cheers,
> Lyude Paul
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v6] drm/dp_mst: Fix W=1 warnings

2020-02-28 Thread Benjamin Gaignard
Le mer. 5 févr. 2020 à 09:53, Benjamin Gaignard
 a écrit :
>
> Fix the warnings that show up with W=1.
> They are all about unused but set variables.
> If functions returns are not used anymore make them void.
>
> Signed-off-by: Benjamin Gaignard 
> Reviewed-by: Lyude Paul 

Applied on drm-misc-next

> ---
> version 6:
> - change drm_dp_check_mstb_guid() prototype to be able to return an error
> - add check for drm_dp_check_mstb_guid() return value
> - check drm_dp_dpcd_read() return value in drm_dp_mst_dump_topology()
>
> version 5:
> - fix indentation
>
> version 4:
> - do not touch crc4 unused variable in this patch
> CC: ly...@redhat.com
> CC: airl...@linux.ie
> CC: jani.nik...@linux.intel.com
>
>  drivers/gpu/drm/drm_dp_mst_topology.c | 114 
> +++---
>  1 file changed, 65 insertions(+), 49 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 4104f15f4594..0ced7a204985 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1034,7 +1034,8 @@ static bool drm_dp_sideband_parse_req(struct 
> drm_dp_sideband_msg_rx *raw,
> }
>  }
>
> -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
> u32 offset, u8 num_bytes, u8 *bytes)
> +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg,
> +u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
>  {
> struct drm_dp_sideband_msg_req_body req;
>
> @@ -1044,17 +1045,14 @@ static int build_dpcd_write(struct 
> drm_dp_sideband_msg_tx *msg, u8 port_num, u32
> req.u.dpcd_write.num_bytes = num_bytes;
> req.u.dpcd_write.bytes = bytes;
> drm_dp_encode_sideband_req(, msg);
> -
> -   return 0;
>  }
>
> -static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
> +static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
>  {
> struct drm_dp_sideband_msg_req_body req;
>
> req.req_type = DP_LINK_ADDRESS;
> drm_dp_encode_sideband_req(, msg);
> -   return 0;
>  }
>
>  static int build_clear_payload_id_table(struct drm_dp_sideband_msg_tx *msg)
> @@ -1066,7 +1064,8 @@ static int build_clear_payload_id_table(struct 
> drm_dp_sideband_msg_tx *msg)
> return 0;
>  }
>
> -static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int 
> port_num)
> +static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg,
> +int port_num)
>  {
> struct drm_dp_sideband_msg_req_body req;
>
> @@ -1077,10 +1076,11 @@ static int build_enum_path_resources(struct 
> drm_dp_sideband_msg_tx *msg, int por
> return 0;
>  }
>
> -static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
> port_num,
> - u8 vcpi, uint16_t pbn,
> - u8 number_sdp_streams,
> - u8 *sdp_stream_sink)
> +static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg,
> +  int port_num,
> +  u8 vcpi, uint16_t pbn,
> +  u8 number_sdp_streams,
> +  u8 *sdp_stream_sink)
>  {
> struct drm_dp_sideband_msg_req_body req;
> memset(, 0, sizeof(req));
> @@ -1093,11 +1093,10 @@ static int build_allocate_payload(struct 
> drm_dp_sideband_msg_tx *msg, int port_n
>number_sdp_streams);
> drm_dp_encode_sideband_req(, msg);
> msg->path_msg = true;
> -   return 0;
>  }
>
> -static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
> - int port_num, bool power_up)
> +static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
> +  int port_num, bool power_up)
>  {
> struct drm_dp_sideband_msg_req_body req;
>
> @@ -1109,7 +1108,6 @@ static int build_power_updown_phy(struct 
> drm_dp_sideband_msg_tx *msg,
> req.u.port_num.port_number = port_num;
> drm_dp_encode_sideband_req(, msg);
> msg->path_msg = true;
> -   return 0;
>  }
>
>  static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
> @@ -2052,29 +2050,24 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
>   offset, size, buffer);
>  }
>
> -static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
> +static int drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb,

[PATCH v4 3/3] dt-bindings: panel: Convert orisetech, otm8009a to json-schema

2020-02-07 Thread Benjamin Gaignard
Convert orisetech,otm8009a to json-schema.

Signed-off-by: Benjamin Gaignard 
---
 .../bindings/display/panel/orisetech,otm8009a.txt  | 23 --
 .../bindings/display/panel/orisetech,otm8009a.yaml | 53 ++
 2 files changed, 53 insertions(+), 23 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml

diff --git 
a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt 
b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
deleted file mode 100644
index 203b03eefb68..
--- a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Orise Tech OTM8009A 3.97" 480x800 TFT LCD panel (MIPI-DSI video mode)
-
-The Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD panel connected using
-a MIPI-DSI video interface. Its backlight is managed through the DSI link.
-
-Required properties:
-  - compatible: "orisetech,otm8009a"
-  - reg: the virtual channel number of a DSI peripheral
-
-Optional properties:
-  - reset-gpios: a GPIO spec for the reset pin (active low).
-  - power-supply: phandle of the regulator that provides the supply voltage.
-
-Example:
- {
-   ...
-   panel@0 {
-   compatible = "orisetech,otm8009a";
-   reg = <0>;
-   reset-gpios = < 7 GPIO_ACTIVE_LOW>;
-   power-supply = <>;
-   };
-};
diff --git 
a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml 
b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml
new file mode 100644
index ..6e6ac995c27b
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/orisetech,otm8009a.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Orise Tech OTM8009A 3.97" 480x800 TFT LCD panel (MIPI-DSI video mode)
+
+maintainers:
+  - Philippe CORNU 
+
+description: |
+ The Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD panel 
connected using
+ a MIPI-DSI video interface. Its backlight is managed through the 
DSI link.
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+const: orisetech,otm8009a
+
+  reg:
+maxItems: 1
+description: DSI virtual channel
+
+  enable-gpios: true
+  port: true
+  power-supply: true
+
+  reset-gpios:
+maxItems: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+dsi@0 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  panel@0 {
+compatible = "orisetech,otm8009a";
+reg = <0>;
+reset-gpios = < 15 0>;
+power-supply = <>;
+  };
+};
+...
+
-- 
2.15.0

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


[PATCH v4 1/3] dt-bindings: one file of all simple DSI panels

2020-02-07 Thread Benjamin Gaignard
From: Sam Ravnborg 

To complement panel-simple.yaml, create panel-simple-dsi.yaml.
panel-simple-dsi-yaml are for all simple DSP panels with a single
power-supply and optional backlight / enable GPIO.

Migrate panasonic,vvx10f034n00 over to the new file.

The objectives with one file for all the simple DSI panels are:
- Make it simpler to add bindings for simple DSI panels
- Keep the number of bindings file lower
- Keep the binding documentation for simple DSI panels more consistent

Signed-off-by: Sam Ravnborg 
Signed-off-by: Benjamin Gaignard 
Cc: Thierry Reding 
Cc: Rob Herring 
Cc: Maxime Ripard 
Cc: Yannick Fertre 
Cc: Mark Rutland 
Cc: Daniel Vetter 
Cc: dri-devel@lists.freedesktop.org
Cc: devicet...@vger.kernel.org
---
version 4:
- remove orisetech,otm8009a and raydium,rm68200 compatibles
- remove reset-gpios optional property

version 3:
- add orisetech,otm8009a and raydium,rm68200 compatibles
- add reset-gpios optional property
- fix indentation on compatible enumeration

 .../display/panel/panasonic,vvx10f034n00.txt   | 20 ---
 .../bindings/display/panel/panel-simple-dsi.yaml   | 67 ++
 2 files changed, 67 insertions(+), 20 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml

diff --git 
a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt 
b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
deleted file mode 100644
index 37dedf6a6702..
--- a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Panasonic 10" WUXGA TFT LCD panel
-
-Required properties:
-- compatible: should be "panasonic,vvx10f034n00"
-- reg: DSI virtual channel of the peripheral
-- power-supply: phandle of the regulator that provides the supply voltage
-
-Optional properties:
-- backlight: phandle of the backlight device attached to the panel
-
-Example:
-
-   mdss_dsi@fd922800 {
-   panel@0 {
-   compatible = "panasonic,vvx10f034n00";
-   reg = <0>;
-   power-supply = <_vsp>;
-   backlight = <_wled>;
-   };
-   };
diff --git 
a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
new file mode 100644
index ..8b60368a2425
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-simple-dsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Simple DSI panels with a single power-supply
+
+maintainers:
+  - Thierry Reding 
+  - Sam Ravnborg 
+
+description: |
+  This binding file is a collection of the DSI panels that
+  requires only a single power-supply.
+  There are optionally a backlight and an enable GPIO.
+  The panel may use an OF graph binding for the association to the display,
+  or it may be a direct child node of the display.
+
+  If the panel is more advanced a dedicated binding file is required.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+enum:
+  # compatible must be listed in alphabetical order, ordered by compatible.
+  # The description in the comment is mandatory for each compatible.
+
+# Panasonic 10" WUXGA TFT LCD panel
+  - panasonic,vvx10f034n00
+
+  reg:
+maxItems: 1
+description: DSI virtual channel
+
+  backlight: true
+  enable-gpios: true
+  port: true
+  power-supply: true
+
+additionalProperties: false
+
+required:
+  - compatible
+  - power-supply
+  - reg
+
+examples:
+  - |
+mdss_dsi@fd922800 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  panel@0 {
+compatible = "panasonic,vvx10f034n00";
+reg = <0>;
+power-supply = <_lcd_reg>;
+
+port {
+  panel: endpoint {
+remote-endpoint = <_out>;
+  };
+};
+  };
+};
-- 
2.15.0

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


[PATCH v4 2/3] dt-bindings: panel: Convert raydium, rm68200 to json-schema

2020-02-07 Thread Benjamin Gaignard
Convert raydium,rm68200 to json-schema.

Signed-off-by: Benjamin Gaignard 
---
 .../bindings/display/panel/raydium,rm68200.txt | 25 --
 .../bindings/display/panel/raydium,rm68200.yaml| 56 ++
 2 files changed, 56 insertions(+), 25 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml

diff --git 
a/Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt 
b/Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt
deleted file mode 100644
index cbb79ef3bfc9..
--- a/Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-Raydium Semiconductor Corporation RM68200 5.5" 720p MIPI-DSI TFT LCD panel
-
-The Raydium Semiconductor Corporation RM68200 is a 5.5" 720x1280 TFT LCD
-panel connected using a MIPI-DSI video interface.
-
-Required properties:
-  - compatible: "raydium,rm68200"
-  - reg: the virtual channel number of a DSI peripheral
-
-Optional properties:
-  - reset-gpios: a GPIO spec for the reset pin (active low).
-  - power-supply: phandle of the regulator that provides the supply voltage.
-  - backlight: phandle of the backlight device attached to the panel.
-
-Example:
- {
-   ...
-   panel@0 {
-   compatible = "raydium,rm68200";
-   reg = <0>;
-   reset-gpios = < 15 GPIO_ACTIVE_LOW>;
-   power-supply = <>;
-   backlight = <_backlight>;
-   };
-};
diff --git 
a/Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml 
b/Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml
new file mode 100644
index ..09149f140d5f
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/raydium,rm68200.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Raydium Semiconductor Corporation RM68200 5.5" 720p MIPI-DSI TFT LCD 
panel
+
+maintainers:
+  - Philippe CORNU 
+
+description: |
+ The Raydium Semiconductor Corporation RM68200 is a 5.5" 720x1280 
TFT LCD
+ panel connected using a MIPI-DSI video interface.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+const: raydium,rm68200
+
+  reg:
+maxItems: 1
+description: DSI virtual channel
+
+  backlight: true
+  enable-gpios: true
+  port: true
+  power-supply: true
+
+  reset-gpios:
+maxItems: 1
+
+additionalProperties: false
+
+required:
+  - compatible
+  - power-supply
+  - reg
+
+examples:
+  - |
+dsi@0 {
+  #address-cells = <1>;
+  #size-cells = <0>;
+  panel@0 {
+compatible = "raydium,rm68200";
+reg = <0>;
+reset-gpios = < 15 0>;
+power-supply = <>;
+backlight = <_backlight>;
+  };
+};
+...
-- 
2.15.0

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


[PATCH v4 0/3] dt-bindings: add simple DSI panels

2020-02-07 Thread Benjamin Gaignard
To complement panel-simple.yaml, create panel-simple-dsi.yaml.
panel-simple-dsi-yaml are for all simple DSP panels with a single
power-supply and optional backlight / enable GPIO / reset GPIO.

Some DSI panels like orisetech,otm8009a or raydium,rm68200 are quite
similar to simple dsi panel but with small variations. Create dedicated
yaml files for them.

Benjamin Gaignard (2):
  dt-bindings: panel: Convert raydium,rm68200 to json-schema
  dt-bindings: panel: Convert orisetech,otm8009a to json-schema

Sam Ravnborg (1):
  dt-bindings: one file of all simple DSI panels

 .../bindings/display/panel/orisetech,otm8009a.txt  | 23 
 .../bindings/display/panel/orisetech,otm8009a.yaml | 53 +
 .../display/panel/panasonic,vvx10f034n00.txt   | 20 ---
 .../bindings/display/panel/panel-simple-dsi.yaml   | 67 ++
 .../bindings/display/panel/raydium,rm68200.txt | 25 
 .../bindings/display/panel/raydium,rm68200.yaml| 56 ++
 6 files changed, 176 insertions(+), 68 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml

-- 
2.15.0

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


[PATCH v6] drm/dp_mst: Fix W=1 warnings

2020-02-05 Thread Benjamin Gaignard
Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

Signed-off-by: Benjamin Gaignard 
Reviewed-by: Lyude Paul 
---
version 6:
- change drm_dp_check_mstb_guid() prototype to be able to return an error
- add check for drm_dp_check_mstb_guid() return value
- check drm_dp_dpcd_read() return value in drm_dp_mst_dump_topology()

version 5:
- fix indentation
  
version 4:
- do not touch crc4 unused variable in this patch
CC: ly...@redhat.com
CC: airl...@linux.ie
CC: jani.nik...@linux.intel.com

 drivers/gpu/drm/drm_dp_mst_topology.c | 114 +++---
 1 file changed, 65 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 4104f15f4594..0ced7a204985 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1034,7 +1034,8 @@ static bool drm_dp_sideband_parse_req(struct 
drm_dp_sideband_msg_rx *raw,
}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg,
+u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1044,17 +1045,14 @@ static int build_dpcd_write(struct 
drm_dp_sideband_msg_tx *msg, u8 port_num, u32
req.u.dpcd_write.num_bytes = num_bytes;
req.u.dpcd_write.bytes = bytes;
drm_dp_encode_sideband_req(, msg);
-
-   return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
struct drm_dp_sideband_msg_req_body req;
 
req.req_type = DP_LINK_ADDRESS;
drm_dp_encode_sideband_req(, msg);
-   return 0;
 }
 
 static int build_clear_payload_id_table(struct drm_dp_sideband_msg_tx *msg)
@@ -1066,7 +1064,8 @@ static int build_clear_payload_id_table(struct 
drm_dp_sideband_msg_tx *msg)
return 0;
 }
 
-static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int 
port_num)
+static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg,
+int port_num)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1077,10 +1076,11 @@ static int build_enum_path_resources(struct 
drm_dp_sideband_msg_tx *msg, int por
return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
- u8 vcpi, uint16_t pbn,
- u8 number_sdp_streams,
- u8 *sdp_stream_sink)
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg,
+  int port_num,
+  u8 vcpi, uint16_t pbn,
+  u8 number_sdp_streams,
+  u8 *sdp_stream_sink)
 {
struct drm_dp_sideband_msg_req_body req;
memset(, 0, sizeof(req));
@@ -1093,11 +1093,10 @@ static int build_allocate_payload(struct 
drm_dp_sideband_msg_tx *msg, int port_n
   number_sdp_streams);
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
- int port_num, bool power_up)
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+  int port_num, bool power_up)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1109,7 +1108,6 @@ static int build_power_updown_phy(struct 
drm_dp_sideband_msg_tx *msg,
req.u.port_num.port_number = port_num;
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -2052,29 +2050,24 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
  offset, size, buffer);
 }
 
-static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
+static int drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-   int ret;
+   int ret = 0;
 
memcpy(mstb->guid, guid, 16);
 
if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
if (mstb->port_parent) {
-   ret = drm_dp_send_dpcd_write(
-   mstb->mgr,
-   mstb->port_parent,
-   DP_GUID,
-   16,
-   mstb->guid);
+   ret = drm_dp_send_dpcd_write(mstb->mgr,
+   

Re: [PATCH] drm/stm: ltdc: check number of endpoints

2020-02-04 Thread Benjamin Gaignard
Le jeu. 23 janv. 2020 à 10:51, Philippe CORNU  a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu 
>
> Philippe :-)
>
> On 1/21/20 11:14 AM, Yannick Fertre wrote:
> > Number of endpoints could exceed the fix value MAX_ENDPOINTS(2).
> > Instead of increase simply this value, the number of endpoint
> > could be read from device tree. Load sequence has been a little
> > rework to take care of several panel or bridge which can be
> > connected/disconnected or enable/disable.

This patch doesn't apply on drm-misc-next.
Yannick could you rebase is on top of drm-misc-next and resend it ?
Thanks,

Benjamin
> >
> > Signed-off-by: Yannick Fertré 
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 104 
> > ++---
> >   1 file changed, 52 insertions(+), 52 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index c2815e8..dba8e7f 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -42,8 +42,6 @@
> >
> >   #define MAX_IRQ 4
> >
> > -#define MAX_ENDPOINTS 2
> > -
> >   #define HWVER_10200 0x010200
> >   #define HWVER_10300 0x010300
> >   #define HWVER_20101 0x020101
> > @@ -1190,36 +1188,20 @@ int ltdc_load(struct drm_device *ddev)
> >   struct ltdc_device *ldev = ddev->dev_private;
> >   struct device *dev = ddev->dev;
> >   struct device_node *np = dev->of_node;
> > - struct drm_bridge *bridge[MAX_ENDPOINTS] = {NULL};
> > - struct drm_panel *panel[MAX_ENDPOINTS] = {NULL};
> > + struct drm_bridge *bridge;
> > + struct drm_panel *panel;
> >   struct drm_crtc *crtc;
> >   struct reset_control *rstc;
> >   struct resource *res;
> > - int irq, ret, i, endpoint_not_ready = -ENODEV;
> > + int irq, i, nb_endpoints;
> > + int ret = -ENODEV;
> >
> >   DRM_DEBUG_DRIVER("\n");
> >
> > - /* Get endpoints if any */
> > - for (i = 0; i < MAX_ENDPOINTS; i++) {
> > - ret = drm_of_find_panel_or_bridge(np, 0, i, [i],
> > -   [i]);
> > -
> > - /*
> > -  * If at least one endpoint is -EPROBE_DEFER, defer probing,
> > -  * else if at least one endpoint is ready, continue probing.
> > -  */
> > - if (ret == -EPROBE_DEFER)
> > - return ret;
> > - else if (!ret)
> > - endpoint_not_ready = 0;
> > - }
> > -
> > - if (endpoint_not_ready)
> > - return endpoint_not_ready;
> > -
> > - rstc = devm_reset_control_get_exclusive(dev, NULL);
> > -
> > - mutex_init(>err_lock);
> > + /* Get number of endpoints */
> > + nb_endpoints = of_graph_get_endpoint_count(np);
> > + if (!nb_endpoints)
> > + return -ENODEV;
> >
> >   ldev->pixel_clk = devm_clk_get(dev, "lcd");
> >   if (IS_ERR(ldev->pixel_clk)) {
> > @@ -1233,6 +1215,43 @@ int ltdc_load(struct drm_device *ddev)
> >   return -ENODEV;
> >   }
> >
> > + /* Get endpoints if any */
> > + for (i = 0; i < nb_endpoints; i++) {
> > + ret = drm_of_find_panel_or_bridge(np, 0, i, , );
> > +
> > + /*
> > +  * If at least one endpoint is -ENODEV, continue probing,
> > +  * else if at least one endpoint returned an error
> > +  * (ie -EPROBE_DEFER) then stop probing.
> > +  */
> > + if (ret == -ENODEV)
> > + continue;
> > + else if (ret)
> > + goto err;
> > +
> > + if (panel) {
> > + bridge = drm_panel_bridge_add_typed(panel,
> > + 
> > DRM_MODE_CONNECTOR_DPI);
> > + if (IS_ERR(bridge)) {
> > + DRM_ERROR("panel-bridge endpoint %d\n", i);
> > + ret = PTR_ERR(bridge);
> > + goto err;
> > + }
> > + }
> > +
> > + if (bridge) {
> > + ret = ltdc_encoder_init(ddev, bridge);
> > + if (ret) {
> > + DRM_ERROR("init encoder endpoint %d\n", i);
> > + goto err;
> > + }
> > + }
> > + }
> > +
> > + rstc = devm_reset_control_get_exclusive(dev, NULL);
> > +
> > + mutex_init(>err_lock);
> > +
> >   if (!IS_ERR(rstc)) {
> >   reset_control_assert(rstc);
> >   usleep_range(10, 20);
> > @@ -1268,7 +1287,6 @@ int ltdc_load(struct drm_device *ddev)
> >   }
> >   }
> >
> > -
> >   ret = ltdc_get_caps(ddev);
> >   if (ret) {
> >   DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> > @@ -1278,27 +1296,6 @@ int ltdc_load(struct drm_device *ddev)
> >
> >   DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", 

Re: [PATCH] drm/stm: dsi: stm mipi dsi doesn't print error on probe deferral

2020-02-04 Thread Benjamin Gaignard
Le jeu. 23 janv. 2020 à 10:54, Philippe CORNU  a écrit :
>
> Dears Yannick & Etienne,
> Thank you for your patch,
>
> Reviewed-by: Philippe Cornu 
>
> Philippe :-)
>
> On 1/21/20 11:24 AM, Yannick Fertre wrote:
> > From: Etienne Carriere 
> >
> > Change DSI driver to not print an error trace when probe
> > is deferred for a clock resource.

Applied on drm-misc-next?
Thanks,
Benjamin

> >
> > Signed-off-by: Etienne Carriere 
> > ---
> >   drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c 
> > b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> > index 4b16563..2e1f266 100644
> > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> > @@ -377,7 +377,9 @@ static int dw_mipi_dsi_stm_probe(struct platform_device 
> > *pdev)
> >   dsi->pllref_clk = devm_clk_get(dev, "ref");
> >   if (IS_ERR(dsi->pllref_clk)) {
> >   ret = PTR_ERR(dsi->pllref_clk);
> > - DRM_ERROR("Unable to get pll reference clock: %d\n", ret);
> > + if (ret != -EPROBE_DEFER)
> > + DRM_ERROR("Unable to get pll reference clock: %d\n",
> > +   ret);
> >   goto err_clk_get;
> >   }
> >
> >
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/stm: ltdc: check crtc state before enabling LIE

2020-02-04 Thread Benjamin Gaignard
Le jeu. 23 janv. 2020 à 10:50, Philippe CORNU  a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu 
>
> Philippe :-)
>
> On 1/21/20 11:14 AM, Yannick Fertre wrote:
> > Following investigations of a hardware bug, the LIE interrupt
> > can occur while the display controller is not activated.
> > LIE interrupt (vblank) don't have to be set if the CRTC is not
> > enabled.
> >

Applied on drm-misc-next.

Thanks
Benjamin

> > Signed-off-by: Yannick Fertre 
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 7 ++-
> >   1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index c2815e8..ea654c7 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -648,9 +648,14 @@ static const struct drm_crtc_helper_funcs 
> > ltdc_crtc_helper_funcs = {
> >   static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc)
> >   {
> >   struct ltdc_device *ldev = crtc_to_ltdc(crtc);
> > + struct drm_crtc_state *state = crtc->state;
> >
> >   DRM_DEBUG_DRIVER("\n");
> > - reg_set(ldev->regs, LTDC_IER, IER_LIE);
> > +
> > + if (state->enable)
> > + reg_set(ldev->regs, LTDC_IER, IER_LIE);
> > + else
> > + return -EPERM;
> >
> >   return 0;
> >   }
> >
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/stm: ltdc: add number of interrupts

2020-02-04 Thread Benjamin Gaignard
Le jeu. 23 janv. 2020 à 10:49, Philippe CORNU  a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu 
>
> Philippe :-)
>
> On 1/21/20 11:13 AM, Yannick Fertre wrote:
> > The number of interrupts depends on the ltdc version.
> > Don't try to get interrupt which not exist, avoiding
> > kernel warning messages.

Applied on drm-misc-next.

Thanks,
Benjamin

> >
> > Signed-off-by: Yannick Fertre 
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 30 +++---
> >   drivers/gpu/drm/stm/ltdc.h |  1 +
> >   2 files changed, 16 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index c2815e8..58092b0 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -1146,12 +1146,14 @@ static int ltdc_get_caps(struct drm_device *ddev)
> >   ldev->caps.pad_max_freq_hz = 9000;
> >   if (ldev->caps.hw_version == HWVER_10200)
> >   ldev->caps.pad_max_freq_hz = 6500;
> > + ldev->caps.nb_irq = 2;
> >   break;
> >   case HWVER_20101:
> >   ldev->caps.reg_ofs = REG_OFS_4;
> >   ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1;
> >   ldev->caps.non_alpha_only_l1 = false;
> >   ldev->caps.pad_max_freq_hz = 15000;
> > + ldev->caps.nb_irq = 4;
> >   break;
> >   default:
> >   return -ENODEV;
> > @@ -1251,13 +1253,21 @@ int ltdc_load(struct drm_device *ddev)
> >   reg_clear(ldev->regs, LTDC_IER,
> > IER_LIE | IER_RRIE | IER_FUIE | IER_TERRIE);
> >
> > - for (i = 0; i < MAX_IRQ; i++) {
> > + ret = ltdc_get_caps(ddev);
> > + if (ret) {
> > + DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> > +   ldev->caps.hw_version);
> > + goto err;
> > + }
> > +
> > + DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
> > +
> > + for (i = 0; i < ldev->caps.nb_irq; i++) {
> >   irq = platform_get_irq(pdev, i);
> > - if (irq == -EPROBE_DEFER)
> > + if (irq < 0) {
> > + ret = irq;
> >   goto err;
> > -
> > - if (irq < 0)
> > - continue;
> > + }
> >
> >   ret = devm_request_threaded_irq(dev, irq, ltdc_irq,
> >   ltdc_irq_thread, IRQF_ONESHOT,
> > @@ -1268,16 +1278,6 @@ int ltdc_load(struct drm_device *ddev)
> >   }
> >   }
> >
> > -
> > - ret = ltdc_get_caps(ddev);
> > - if (ret) {
> > - DRM_ERROR("hardware identifier (0x%08x) not supported!\n",
> > -   ldev->caps.hw_version);
> > - goto err;
> > - }
> > -
> > - DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version);
> > -
> >   /* Add endpoints panels or bridges if any */
> >   for (i = 0; i < MAX_ENDPOINTS; i++) {
> >   if (panel[i]) {
> > diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> > index a1ad0ae..310e87f 100644
> > --- a/drivers/gpu/drm/stm/ltdc.h
> > +++ b/drivers/gpu/drm/stm/ltdc.h
> > @@ -19,6 +19,7 @@ struct ltdc_caps {
> >   const u32 *pix_fmt_hw;  /* supported pixel formats */
> >   bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */
> >   int pad_max_freq_hz;/* max frequency supported by pad */
> > + int nb_irq; /* number of hardware interrupts */
> >   };
> >
> >   #define LTDC_MAX_LAYER  4
> >
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/stm: ltdc: enable/disable depends on encoder

2020-02-04 Thread Benjamin Gaignard
Le jeu. 23 janv. 2020 à 10:47, Philippe CORNU  a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu 
>
> Philippe :-)
>
> On 1/20/20 2:46 PM, Yannick Fertre wrote:
> > From: Yannick Fertré 
> >
> > When connected to a dsi host, the ltdc display controller
> > must send frames only after the end of the dsi panel
> > initialization to avoid errors when the dsi host sends
> > commands to the dsi panel (dsi px fifo full).
> > To avoid this issue, the display controller must be
> > enabled/disabled when the encoder is enabled/disabled.
> >

Applied on drm-misc-next.

Thanks
Benjamin

> > Signed-off-by: Yannick Fertré 
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 14 --
> >   1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 719dfc5..9ef125d 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -437,9 +437,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc 
> > *crtc,
> >   /* Commit shadow registers = update planes at next vblank */
> >   reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR);
> >
> > - /* Enable LTDC */
> > - reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > -
> >   drm_crtc_vblank_on(crtc);
> >   }
> >
> > @@ -453,9 +450,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc 
> > *crtc,
> >
> >   drm_crtc_vblank_off(crtc);
> >
> > - /* disable LTDC */
> > - reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > -
> >   /* disable IRQ */
> >   reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE);
> >
> > @@ -1058,9 +1052,13 @@ static const struct drm_encoder_funcs 
> > ltdc_encoder_funcs = {
> >   static void ltdc_encoder_disable(struct drm_encoder *encoder)
> >   {
> >   struct drm_device *ddev = encoder->dev;
> > + struct ltdc_device *ldev = ddev->dev_private;
> >
> >   DRM_DEBUG_DRIVER("\n");
> >
> > + /* Disable LTDC */
> > + reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > +
> >   /* Set to sleep state the pinctrl whatever type of encoder */
> >   pinctrl_pm_select_sleep_state(ddev->dev);
> >   }
> > @@ -1068,6 +1066,7 @@ static void ltdc_encoder_disable(struct drm_encoder 
> > *encoder)
> >   static void ltdc_encoder_enable(struct drm_encoder *encoder)
> >   {
> >   struct drm_device *ddev = encoder->dev;
> > + struct ltdc_device *ldev = ddev->dev_private;
> >
> >   DRM_DEBUG_DRIVER("\n");
> >
> > @@ -1078,6 +1077,9 @@ static void ltdc_encoder_enable(struct drm_encoder 
> > *encoder)
> >*/
> >   if (encoder->encoder_type == DRM_MODE_ENCODER_DPI)
> >   pinctrl_pm_select_default_state(ddev->dev);
> > +
> > + /* Enable LTDC */
> > + reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> >   }
> >
> >   static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> >
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/dp_mst: Check crc4 value while building sideband message

2020-02-04 Thread Benjamin Gaignard
Check that computed crc value is matching the one encoded in the message.

Signed-off-by: Benjamin Gaignard 
---
CC: ly...@redhat.com
CC: airl...@linux.ie
CC: jani.nik...@linux.intel.com
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 822d2f177f90..eee899d6742b 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -736,6 +736,10 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
if (msg->curchunk_idx >= msg->curchunk_len) {
/* do CRC */
crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
+   if (crc4 != msg->chunk[msg->curchunk_len - 1])
+   print_hex_dump(KERN_DEBUG, "wrong crc",
+  DUMP_PREFIX_NONE, 16, 1,
+  msg->chunk,  msg->curchunk_len, false);
/* copy chunk into bigger msg */
memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len - 
1);
msg->curlen += msg->curchunk_len - 1;
-- 
2.15.0

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


[PATCH] gpu: drm: context: Clean up documentation

2020-02-03 Thread Benjamin Gaignard
Fix kernel doc comments to avoid warnings when compiling with W=1.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_context.c | 145 ++
 1 file changed, 61 insertions(+), 84 deletions(-)

diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
index 1f802d8e5681..54e64d612a2b 100644
--- a/drivers/gpu/drm/drm_context.c
+++ b/drivers/gpu/drm/drm_context.c
@@ -43,15 +43,11 @@ struct drm_ctx_list {
struct drm_file *tag;
 };
 
-/**/
-/** \name Context bitmap support */
-/*@{*/
-
 /**
- * Free a handle from the context bitmap.
+ * drm_legacy_ctxbitmap_free() - Free a handle from the context bitmap.
  *
- * \param dev DRM device.
- * \param ctx_handle context handle.
+ * @dev: DRM device.
+ * @ctx_handle: context handle.
  *
  * Clears the bit specified by \p ctx_handle in drm_device::ctx_bitmap and the 
entry
  * in drm_device::ctx_idr, while holding the drm_device::struct_mutex
@@ -69,10 +65,10 @@ void drm_legacy_ctxbitmap_free(struct drm_device * dev, int 
ctx_handle)
 }
 
 /**
- * Context bitmap allocation.
+ * drm_legacy_ctxbitmap_next() - Context bitmap allocation.
  *
- * \param dev DRM device.
- * \return (non-negative) context handle on success or a negative number on 
failure.
+ * @dev: DRM device.
+ * Return: (non-negative) context handle on success or a negative number on 
failure.
  *
  * Allocate a new idr from drm_device::ctx_idr while holding the
  * drm_device::struct_mutex lock.
@@ -89,9 +85,9 @@ static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
 }
 
 /**
- * Context bitmap initialization.
+ * drm_legacy_ctxbitmap_init() - Context bitmap initialization.
  *
- * \param dev DRM device.
+ * @dev: DRM device.
  *
  * Initialise the drm_device::ctx_idr
  */
@@ -105,9 +101,9 @@ void drm_legacy_ctxbitmap_init(struct drm_device * dev)
 }
 
 /**
- * Context bitmap cleanup.
+ * drm_legacy_ctxbitmap_cleanup() - bitmap cleanup.
  *
- * \param dev DRM device.
+ * @dev: DRM device.
  *
  * Free all idr members using drm_ctx_sarea_free helper function
  * while holding the drm_device::struct_mutex lock.
@@ -157,20 +153,13 @@ void drm_legacy_ctxbitmap_flush(struct drm_device *dev, 
struct drm_file *file)
mutex_unlock(>ctxlist_mutex);
 }
 
-/*@}*/
-
-/**/
-/** \name Per Context SAREA Support */
-/*@{*/
-
 /**
- * Get per-context SAREA.
+ * drm_legacy_getsareactx() - Get per-context SAREA.
  *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg user argument pointing to a drm_ctx_priv_map structure.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device to operate on
+ * @data: request data
+ * @file_priv: DRM file private.
+ * Return:  zero on success or a negative number on failure.
  *
  * Gets the map from drm_device::ctx_idr with the handle specified and
  * returns its handle.
@@ -212,13 +201,12 @@ int drm_legacy_getsareactx(struct drm_device *dev, void 
*data,
 }
 
 /**
- * Set per-context SAREA.
+ * drm_legacy_setsareactx() - Set per-context SAREA.
  *
- * \param inode device inode.
- * \param file_priv DRM file private.
- * \param cmd command.
- * \param arg user argument pointing to a drm_ctx_priv_map structure.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device to operate on
+ * @data: request data
+ * @file_priv: DRM file private.
+ * Return: zero on success or a negative number on failure.
  *
  * Searches the mapping specified in \p arg and update the entry in
  * drm_device::ctx_idr with it.
@@ -257,19 +245,13 @@ int drm_legacy_setsareactx(struct drm_device *dev, void 
*data,
return 0;
 }
 
-/*@}*/
-
-/**/
-/** \name The actual DRM context handling routines */
-/*@{*/
-
 /**
- * Switch context.
+ * drm_context_switch() - Switch context.
  *
- * \param dev DRM device.
- * \param old old context handle.
- * \param new new context handle.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device.
+ * @old: old context handle.
+ * @new: new context handle.
+ * Return: zero on success or a negative number on failure.
  *
  * Attempt to set drm_device::context_flag.
  */
@@ -291,11 +273,12 @@ static int drm_context_switch(struct drm_device * dev, 
int old, int new)
 }
 
 /**
- * Complete context switch.
+ * drm_context_switch_complete() - Complete context switch.
  *
- * \param dev DRM device.
- * \param new new context handle.
- * \return zero on success or a negative number on failure.
+ * @dev: DRM device.
+ * @file_priv: DRM file private.
+ * @new: new context handle.
+ * Return: zero on success or a negative number on failure.
  *
  * Updates drm_device::last_context and drm_device::last_switch. Verifies the
  * hardware lock is held, clears the drm_device::context_f

[PATCH v4] drm/dp_mst: Fix W=1 warnings

2020-02-03 Thread Benjamin Gaignard
Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

Signed-off-by: Benjamin Gaignard 
---
version 4:
- do not touch crc4 unused variable in this patch
CC: ly...@redhat.com
CC: airl...@linux.ie
 drivers/gpu/drm/drm_dp_mst_topology.c | 78 ++-
 1 file changed, 31 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 4104f15f4594..44a8731665e4 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1034,7 +1034,7 @@ static bool drm_dp_sideband_parse_req(struct 
drm_dp_sideband_msg_rx *raw,
}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1044,17 +1044,14 @@ static int build_dpcd_write(struct 
drm_dp_sideband_msg_tx *msg, u8 port_num, u32
req.u.dpcd_write.num_bytes = num_bytes;
req.u.dpcd_write.bytes = bytes;
drm_dp_encode_sideband_req(, msg);
-
-   return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
struct drm_dp_sideband_msg_req_body req;
 
req.req_type = DP_LINK_ADDRESS;
drm_dp_encode_sideband_req(, msg);
-   return 0;
 }
 
 static int build_clear_payload_id_table(struct drm_dp_sideband_msg_tx *msg)
@@ -1077,7 +1074,7 @@ static int build_enum_path_resources(struct 
drm_dp_sideband_msg_tx *msg, int por
return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
  u8 vcpi, uint16_t pbn,
  u8 number_sdp_streams,
  u8 *sdp_stream_sink)
@@ -1093,10 +1090,9 @@ static int build_allocate_payload(struct 
drm_dp_sideband_msg_tx *msg, int port_n
   number_sdp_streams);
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
  int port_num, bool power_up)
 {
struct drm_dp_sideband_msg_req_body req;
@@ -1109,7 +1105,6 @@ static int build_power_updown_phy(struct 
drm_dp_sideband_msg_tx *msg,
req.u.port_num.port_number = port_num;
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -2054,25 +2049,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-   int ret;
-
memcpy(mstb->guid, guid, 16);
 
if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
if (mstb->port_parent) {
-   ret = drm_dp_send_dpcd_write(
-   mstb->mgr,
-   mstb->port_parent,
-   DP_GUID,
-   16,
-   mstb->guid);
+   drm_dp_send_dpcd_write(mstb->mgr,
+  mstb->port_parent,
+  DP_GUID,
+  16,
+  mstb->guid);
} else {
-
-   ret = drm_dp_dpcd_write(
-   mstb->mgr->aux,
-   DP_GUID,
-   mstb->guid,
-   16);
+   drm_dp_dpcd_write(mstb->mgr->aux,
+ DP_GUID,
+ mstb->guid,
+ 16);
}
}
 }
@@ -2595,7 +2585,7 @@ static bool drm_dp_validate_guid(struct 
drm_dp_mst_topology_mgr *mgr,
return false;
 }
 
-static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes)
+static void build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -2604,8 +2594,6 @@ static int build_dpcd_read(struct drm_dp_sideband_msg_tx 
*msg, u8 port_num, u32
req.u.dpcd_read.dpcd_address =

[PATCH v5] drm/dp_mst: Fix W=1 warnings

2020-02-03 Thread Benjamin Gaignard
Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

Signed-off-by: Benjamin Gaignard 
---
version 5:
- fix indentation
  
version 4:
- do not touch crc4 unused variable in this patch
CC: ly...@redhat.com
CC: airl...@linux.ie
CC: jani.nik...@linux.intel.com

 drivers/gpu/drm/drm_dp_mst_topology.c | 92 +++
 1 file changed, 40 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 4104f15f4594..822d2f177f90 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1034,7 +1034,8 @@ static bool drm_dp_sideband_parse_req(struct 
drm_dp_sideband_msg_rx *raw,
}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg,
+u8 port_num, u32 offset, u8 num_bytes, u8 *bytes)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1044,17 +1045,14 @@ static int build_dpcd_write(struct 
drm_dp_sideband_msg_tx *msg, u8 port_num, u32
req.u.dpcd_write.num_bytes = num_bytes;
req.u.dpcd_write.bytes = bytes;
drm_dp_encode_sideband_req(, msg);
-
-   return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
struct drm_dp_sideband_msg_req_body req;
 
req.req_type = DP_LINK_ADDRESS;
drm_dp_encode_sideband_req(, msg);
-   return 0;
 }
 
 static int build_clear_payload_id_table(struct drm_dp_sideband_msg_tx *msg)
@@ -1066,7 +1064,8 @@ static int build_clear_payload_id_table(struct 
drm_dp_sideband_msg_tx *msg)
return 0;
 }
 
-static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int 
port_num)
+static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg,
+int port_num)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1077,10 +1076,11 @@ static int build_enum_path_resources(struct 
drm_dp_sideband_msg_tx *msg, int por
return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
- u8 vcpi, uint16_t pbn,
- u8 number_sdp_streams,
- u8 *sdp_stream_sink)
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg,
+  int port_num,
+  u8 vcpi, uint16_t pbn,
+  u8 number_sdp_streams,
+  u8 *sdp_stream_sink)
 {
struct drm_dp_sideband_msg_req_body req;
memset(, 0, sizeof(req));
@@ -1093,11 +1093,10 @@ static int build_allocate_payload(struct 
drm_dp_sideband_msg_tx *msg, int port_n
   number_sdp_streams);
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
- int port_num, bool power_up)
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+  int port_num, bool power_up)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1109,7 +1108,6 @@ static int build_power_updown_phy(struct 
drm_dp_sideband_msg_tx *msg,
req.u.port_num.port_number = port_num;
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -2054,25 +2052,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-   int ret;
-
memcpy(mstb->guid, guid, 16);
 
if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
if (mstb->port_parent) {
-   ret = drm_dp_send_dpcd_write(
-   mstb->mgr,
-   mstb->port_parent,
-   DP_GUID,
-   16,
-   mstb->guid);
+   drm_dp_send_dpcd_write(mstb->mgr,
+  mstb->port_parent,
+  DP_GUID,
+  16,
+  mstb->guid);
} else {
-
-   ret = drm_dp_dpcd_write(
-   mstb->mgr->aux,
-   DP_GUID,
-   mstb->gui

Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2020-02-03 Thread Benjamin GAIGNARD

On 1/31/20 12:22 AM, Dave Airlie wrote:
 hi-actually yes, we should probably be using this instead of just dropping
 this. Also, I didn't write this code originally I just refactored a bunch
 of
 it - Dave Airlied is the original author, but the original version of this
 code was written ages ago. tbh, I think it's a safe bet to say that they
 probably did mean to use this but forgot to and no one noticed until now.
>>> Hi,
>>>
>>> Any clue about how to use crc value ? Does it have to be checked
>>> against something else ?
>>> If crc are not matching what should we do of the data copied just before ?
>> We should be able to just take the CRC value from the sideband message and
>> then generate our own CRC value using the sideband message contents, and 
>> check
>> if the two are equal. If they aren't, something went wrong and we didn't
>> receive the message properly.
>>
>> Now as to what we should do when we have CRC mismatches? That's a bit more
>> difficult. If you have access to the DP MST spec, I suppose a place to start
>> figuring that out would be checking if there's a way for us to request that a
>> branch device resend whatever message it sent previously. If there isn't, I
>> guess we should just print an error in dmesg (possibly with a hexdump of the
>> failed message as well) and not forward the message to the driver. Not sure 
>> of
>> any better way of handling it then that
> Yeah I think this reflects what I wanted to do, I've no memory of a
> retransmit option in the spec, but I've away from it for a while. But
> we'd want to compare the CRC with what we got to make sure the are the
> same.

Hmm, that far more complex than just fix compilation warnings :)

I will split the patch in two:

- one for of all other warnings, hopefully it can get reviewed

- one for this crc4 variable. Does checking crc value and print an error 
should be acceptable ?

Something like:

if (crc4 != msg->chunk[msg->curchunk_len - 1])

     print_hex_dump(KERN_DEBUG, "wrong crc", DUMP_PREFIX_NONE, 16, 1, 
msg->chunk,  msg->curchunk_len, false);


Benjamin


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


[PATCH v3] dt-bindings: one file of all simple DSI panels

2020-01-31 Thread Benjamin Gaignard
From: Sam Ravnborg 

To complement panel-simple.yaml, create panel-simple-dsi.yaml.
panel-simple-dsi-yaml are for all simple DSP panels with a single
power-supply and optional backlight / enable GPIO / reset GPIO.

Migrate panasonic,vvx10f034n00, orisetech,otm8009a and raydium,rm68200 over to 
the new file.

The objectives with one file for all the simple DSI panels are:
- Make it simpler to add bindings for simple DSI panels
- Keep the number of bindings file lower
- Keep the binding documentation for simple DSI panels more consistent

Signed-off-by: Sam Ravnborg 
Signed-off-by: Benjamin Gaignard 
Cc: Thierry Reding 
Cc: Rob Herring 
Cc: Maxime Ripard 
Cc: Yannick Fertre 
Cc: Mark Rutland 
Cc: Daniel Vetter 
Cc: dri-devel@lists.freedesktop.org
Cc: devicet...@vger.kernel.org
---
version 3:
- add orisetech,otm8009a and raydium,rm68200 compatibles
- add reset-gpios optional property
- fix indentation on compatible enumeration
=> Rob had reviewed the second version but, given the changes in version 3
   I haven't added here.
 .../bindings/display/panel/orisetech,otm8009a.txt  | 23 ---
 .../display/panel/panasonic,vvx10f034n00.txt   | 20 --
 .../bindings/display/panel/panel-simple-dsi.yaml   | 74 ++
 .../bindings/display/panel/raydium,rm68200.txt | 25 
 4 files changed, 74 insertions(+), 68 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
 create mode 100644 
Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
 delete mode 100644 
Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt

diff --git 
a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt 
b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
deleted file mode 100644
index 203b03eefb68..
--- a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Orise Tech OTM8009A 3.97" 480x800 TFT LCD panel (MIPI-DSI video mode)
-
-The Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD panel connected using
-a MIPI-DSI video interface. Its backlight is managed through the DSI link.
-
-Required properties:
-  - compatible: "orisetech,otm8009a"
-  - reg: the virtual channel number of a DSI peripheral
-
-Optional properties:
-  - reset-gpios: a GPIO spec for the reset pin (active low).
-  - power-supply: phandle of the regulator that provides the supply voltage.
-
-Example:
- {
-   ...
-   panel@0 {
-   compatible = "orisetech,otm8009a";
-   reg = <0>;
-   reset-gpios = < 7 GPIO_ACTIVE_LOW>;
-   power-supply = <>;
-   };
-};
diff --git 
a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt 
b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
deleted file mode 100644
index 37dedf6a6702..
--- a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Panasonic 10" WUXGA TFT LCD panel
-
-Required properties:
-- compatible: should be "panasonic,vvx10f034n00"
-- reg: DSI virtual channel of the peripheral
-- power-supply: phandle of the regulator that provides the supply voltage
-
-Optional properties:
-- backlight: phandle of the backlight device attached to the panel
-
-Example:
-
-   mdss_dsi@fd922800 {
-   panel@0 {
-   compatible = "panasonic,vvx10f034n00";
-   reg = <0>;
-   power-supply = <_vsp>;
-   backlight = <_wled>;
-   };
-   };
diff --git 
a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
new file mode 100644
index ..1168b8186490
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/panel-simple-dsi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Simple DSI panels with a single power-supply
+
+maintainers:
+  - Thierry Reding 
+  - Sam Ravnborg 
+
+description: |
+  This binding file is a collection of the DSI panels that
+  requires only a single power-supply.
+  There are optionally a backlight and an enable GPIO.
+  The panel may use an OF graph binding for the association to the display,
+  or it may be a direct child node of the display.
+
+  If the panel is more advanced a dedicated binding file is required.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+
+  compatible:
+enum:
+  # compatible must be listed in alphabetical order, o

Re: [PATCH v3] dt-bindings: one file of all simple DSI panels

2020-01-31 Thread Benjamin GAIGNARD


On 1/30/20 3:48 PM, Rob Herring wrote:
> On Thu, Jan 30, 2020 at 2:45 AM Benjamin Gaignard
>  wrote:
>> From: Sam Ravnborg 
>>
>> To complement panel-simple.yaml, create panel-simple-dsi.yaml.
>> panel-simple-dsi-yaml are for all simple DSP panels with a single
>> power-supply and optional backlight / enable GPIO / reset GPIO.
>>
>> Migrate panasonic,vvx10f034n00, orisetech,otm8009a and raydium,rm68200 over 
>> to the new file.
>>
>> The objectives with one file for all the simple DSI panels are:
>>  - Make it simpler to add bindings for simple DSI panels
>>  - Keep the number of bindings file lower
>>  - Keep the binding documentation for simple DSI panels more consistent
>>
>> Signed-off-by: Sam Ravnborg 
>> Signed-off-by: Benjamin Gaignard 
>> Cc: Thierry Reding 
>> Cc: Rob Herring 
>> Cc: Maxime Ripard 
>> Cc: Yannick Fertre 
>> Cc: Mark Rutland 
>> Cc: Daniel Vetter 
>> Cc: dri-devel@lists.freedesktop.org
>> Cc: devicet...@vger.kernel.org
>> ---
>> version 3:
>> - add orisetech,otm8009a and raydium,rm68200 compatibles
>> - add reset-gpios optional property
>> - fix indentation on compatible enumeration
>> => Rob had reviewed the second version but, given the changes in version 3
>> I haven't added here.
>>   .../bindings/display/panel/orisetech,otm8009a.txt  | 23 ---
>>   .../display/panel/panasonic,vvx10f034n00.txt   | 20 --
>>   .../bindings/display/panel/panel-simple-dsi.yaml   | 74 
>> ++
>>   .../bindings/display/panel/raydium,rm68200.txt | 25 
>>   4 files changed, 74 insertions(+), 68 deletions(-)
>>   delete mode 100644 
>> Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
>>   delete mode 100644 
>> Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
>>   create mode 100644 
>> Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
>>   delete mode 100644 
>> Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt 
>> b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
>> deleted file mode 100644
>> index 203b03eefb68..
>> --- a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt
>> +++ /dev/null
>> @@ -1,23 +0,0 @@
>> -Orise Tech OTM8009A 3.97" 480x800 TFT LCD panel (MIPI-DSI video mode)
>> -
>> -The Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD panel connected using
>> -a MIPI-DSI video interface. Its backlight is managed through the DSI link.
>> -
>> -Required properties:
>> -  - compatible: "orisetech,otm8009a"
>> -  - reg: the virtual channel number of a DSI peripheral
>> -
>> -Optional properties:
>> -  - reset-gpios: a GPIO spec for the reset pin (active low).
>> -  - power-supply: phandle of the regulator that provides the supply voltage.
>> -
>> -Example:
>> - {
>> -   ...
>> -   panel@0 {
>> -   compatible = "orisetech,otm8009a";
>> -   reg = <0>;
>> -   reset-gpios = < 7 GPIO_ACTIVE_LOW>;
>> -   power-supply = <>;
>> -   };
>> -};
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt 
>> b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
>> deleted file mode 100644
>> index 37dedf6a6702..
>> --- 
>> a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
>> +++ /dev/null
>> @@ -1,20 +0,0 @@
>> -Panasonic 10" WUXGA TFT LCD panel
>> -
>> -Required properties:
>> -- compatible: should be "panasonic,vvx10f034n00"
>> -- reg: DSI virtual channel of the peripheral
>> -- power-supply: phandle of the regulator that provides the supply voltage
>> -
>> -Optional properties:
>> -- backlight: phandle of the backlight device attached to the panel
>> -
>> -Example:
>> -
>> -   mdss_dsi@fd922800 {
>> -   panel@0 {
>> -   compatible = "panasonic,vvx10f034n00";
>> -   reg = <0>;
>> -   power-supply = <_vsp>;
>> -   backlight = <_wled>;
>> -   };
>> -   };
>> diff --git 
>> a/Documentation/devicetree/bindings/display/p

Re: [PATCH v2 2/2] dt-bindings: one file of all simple DSI panels

2020-01-30 Thread Benjamin Gaignard
Le mer. 29 janv. 2020 à 20:47, Sam Ravnborg  a écrit :
>
> Hi Benjamin.
> > > >
> > > > Here's the problem. If it is not required, then panels with multiple
> > > > supplies will get added here because they didn't care to begin with.
> > > > Then when someone decides to think about the supplies it will have to
> > > > be moved. Bindings need to be complete from the start.
> > >
> > > Fair enough, I will add fixed supply in dts files.
> > > If reset-gpios could be added in this schema then we could include
> > > oristech panel here.
> >
> > Does this patch has been merged ?
>
> I was sidetracked by other things.
> Maybe you can move it forward?

Yes I will send a v3.
Benjamin

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


[PATCH v3] dt-bindings: display: Convert etnaviv to json-schema

2020-01-29 Thread Benjamin Gaignard
Convert etnaviv bindings to yaml format.
Move bindings file from display to gpu folder.

Signed-off-by: Benjamin Gaignard 
---
version 3:
- describe clock-names as enum to allow all possible mix

version 2:
- move bindings file from display to gpu folder
 .../bindings/display/etnaviv/etnaviv-drm.txt   | 36 ---
 .../devicetree/bindings/gpu/vivante,gc.yaml| 69 ++
 2 files changed, 69 insertions(+), 36 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
 create mode 100644 Documentation/devicetree/bindings/gpu/vivante,gc.yaml

diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt 
b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
deleted file mode 100644
index 8def11b16a24..
--- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Vivante GPU core devices
-
-
-Required properties:
-- compatible: Should be "vivante,gc"
-  A more specific compatible is not needed, as the cores contain chip
-  identification registers at fixed locations, which provide all the
-  necessary information to the driver.
-- reg: should be register base and length as documented in the
-  datasheet
-- interrupts: Should contain the cores interrupt line
-- clocks: should contain one clock for entry in clock-names
-  see Documentation/devicetree/bindings/clock/clock-bindings.txt
-- clock-names:
-   - "bus":AXI/master interface clock
-   - "reg":AHB/slave interface clock
-   (only required if GPU can gate slave interface independently)
-   - "core":   GPU core clock
-   - "shader": Shader clock (only required if GPU has feature PIPE_3D)
-
-Optional properties:
-- power-domains: a power domain consumer specifier according to
-  Documentation/devicetree/bindings/power/power_domain.txt
-
-example:
-
-gpu_3d: gpu@13 {
-   compatible = "vivante,gc";
-   reg = <0x0013 0x4000>;
-   interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6QDL_CLK_GPU3D_AXI>,
-< IMX6QDL_CLK_GPU3D_CORE>,
-< IMX6QDL_CLK_GPU3D_SHADER>;
-   clock-names = "bus", "core", "shader";
-   power-domains = < 1>;
-};
diff --git a/Documentation/devicetree/bindings/gpu/vivante,gc.yaml 
b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
new file mode 100644
index ..0bc4b38d5cbb
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpu/vivante,gc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Vivante GPU Bindings
+
+description: Vivante GPU core devices
+
+maintainers:
+  -  Lucas Stach 
+
+properties:
+  compatible:
+const: vivante,gc
+
+  reg:
+maxItems: 1
+
+  interrupts:
+maxItems: 1
+
+  clocks:
+items:
+  - description: AXI/master interface clock
+  - description: GPU core clock
+  - description: Shader clock (only required if GPU has feature PIPE_3D)
+  - description: AHB/slave interface clock (only required if GPU can gate 
slave interface independently)
+minItems: 1
+maxItems: 4
+
+  clock-names:
+items:
+  enum: [ bus, core, shader, reg ]
+minItems: 1
+maxItems: 4
+
+  resets:
+maxItems: 1
+
+  power-domains:
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+#include 
+gpu@13 {
+  compatible = "vivante,gc";
+  reg = <0x0013 0x4000>;
+  interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
+  clocks = < IMX6QDL_CLK_GPU3D_AXI>,
+   < IMX6QDL_CLK_GPU3D_CORE>,
+   < IMX6QDL_CLK_GPU3D_SHADER>;
+  clock-names = "bus", "core", "shader";
+  power-domains = < 1>;
+};
+
+...
-- 
2.15.0

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


Re: [PATCH v2] dt-bindings: display: Convert etnaviv to json-schema

2020-01-29 Thread Benjamin GAIGNARD


On 1/28/20 8:35 PM, Rob Herring wrote:
> On Tue, Jan 28, 2020 at 6:31 AM Benjamin GAIGNARD
>  wrote:
>>
>> On 1/28/20 1:06 PM, Maxime Ripard wrote:
>>> Hi Benjamin,
>>>
>>> On Tue, Jan 28, 2020 at 09:20:13AM +0100, Benjamin Gaignard wrote:
>>>> Convert etnaviv bindings to yaml format.
>>>>
>>>> Signed-off-by: Benjamin Gaignard 
>>>> ---
>>>>.../bindings/display/etnaviv/etnaviv-drm.txt   | 36 ---
>>>>.../devicetree/bindings/gpu/vivante,gc.yaml| 72 
>>>> ++
>>>>2 files changed, 72 insertions(+), 36 deletions(-)
>>>>delete mode 100644 
>>>> Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
>>>>create mode 100644 Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>>>>
>>>> diff --git 
>>>> a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt 
>>>> b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
>>>> deleted file mode 100644
>>>> index 8def11b16a24..
>>>> --- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
>>>> +++ /dev/null
>>>> @@ -1,36 +0,0 @@
>>>> -Vivante GPU core devices
>>>> -
>>>> -
>>>> -Required properties:
>>>> -- compatible: Should be "vivante,gc"
>>>> -  A more specific compatible is not needed, as the cores contain chip
>>>> -  identification registers at fixed locations, which provide all the
>>>> -  necessary information to the driver.
>>>> -- reg: should be register base and length as documented in the
>>>> -  datasheet
>>>> -- interrupts: Should contain the cores interrupt line
>>>> -- clocks: should contain one clock for entry in clock-names
>>>> -  see Documentation/devicetree/bindings/clock/clock-bindings.txt
>>>> -- clock-names:
>>>> -   - "bus":AXI/master interface clock
>>>> -   - "reg":AHB/slave interface clock
>>>> -   (only required if GPU can gate slave interface 
>>>> independently)
>>>> -   - "core":   GPU core clock
>>>> -   - "shader": Shader clock (only required if GPU has feature PIPE_3D)
>>>> -
>>>> -Optional properties:
>>>> -- power-domains: a power domain consumer specifier according to
>>>> -  Documentation/devicetree/bindings/power/power_domain.txt
>>>> -
>>>> -example:
>>>> -
>>>> -gpu_3d: gpu@13 {
>>>> -compatible = "vivante,gc";
>>>> -reg = <0x0013 0x4000>;
>>>> -interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
>>>> -clocks = < IMX6QDL_CLK_GPU3D_AXI>,
>>>> - < IMX6QDL_CLK_GPU3D_CORE>,
>>>> - < IMX6QDL_CLK_GPU3D_SHADER>;
>>>> -clock-names = "bus", "core", "shader";
>>>> -power-domains = < 1>;
>>>> -};
>>>> diff --git a/Documentation/devicetree/bindings/gpu/vivante,gc.yaml 
>>>> b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>>>> new file mode 100644
>>>> index ..c4f549c0d750
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>>>> @@ -0,0 +1,72 @@
>>>> +# SPDX-License-Identifier: GPL-2.0
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/gpu/vivante,gc.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Vivante GPU Bindings
>>>> +
>>>> +description: Vivante GPU core devices
>>>> +
>>>> +maintainers:
>>>> +  -  Lucas Stach 
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +const: vivante,gc
>>>> +
>>>> +  reg:
>>>> +maxItems: 1
>>>> +
>>>> +  interrupts:
>>>> +maxItems: 1
>>>> +
>>>> +  clocks:
>>>> +items:
>>>> +  - description: AXI/master interface clock
>>>> +  - description: GPU core clock
>>>> +  - description: Shader clock (only required if GPU has feature 
>>>> PIPE_3D)
>>>> +  - description: AHB/slave interface clock (only required if GPU can 
>>>> gate slave interface independently)
>>> Can you have an AHB slave interface clock without a shader clock?
>> No because the items in the list are ordered so you need to have, in
>> order: "bus", "core", "shader", "reg"
>>
>> If it is needed to allow any number of clock in any order I could write
>> it like this:
> Yes, but I prefer we don't allow any order if we don't have to. Did
> you run this schema against dtbs_check or just audit the dts files
> with vivante?

Both, I found these mix of reg-names:

"core"

"bus","core"

"bus","core","shader"

That not really match with original bindings description...


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


Re: [PATCH v2] dt-bindings: display: Convert etnaviv to json-schema

2020-01-29 Thread Benjamin GAIGNARD


On 1/28/20 1:06 PM, Maxime Ripard wrote:
> Hi Benjamin,
>
> On Tue, Jan 28, 2020 at 09:20:13AM +0100, Benjamin Gaignard wrote:
>> Convert etnaviv bindings to yaml format.
>>
>> Signed-off-by: Benjamin Gaignard 
>> ---
>>   .../bindings/display/etnaviv/etnaviv-drm.txt   | 36 ---
>>   .../devicetree/bindings/gpu/vivante,gc.yaml| 72 
>> ++
>>   2 files changed, 72 insertions(+), 36 deletions(-)
>>   delete mode 100644 
>> Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
>>   create mode 100644 Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt 
>> b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
>> deleted file mode 100644
>> index 8def11b16a24..
>> --- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
>> +++ /dev/null
>> @@ -1,36 +0,0 @@
>> -Vivante GPU core devices
>> -
>> -
>> -Required properties:
>> -- compatible: Should be "vivante,gc"
>> -  A more specific compatible is not needed, as the cores contain chip
>> -  identification registers at fixed locations, which provide all the
>> -  necessary information to the driver.
>> -- reg: should be register base and length as documented in the
>> -  datasheet
>> -- interrupts: Should contain the cores interrupt line
>> -- clocks: should contain one clock for entry in clock-names
>> -  see Documentation/devicetree/bindings/clock/clock-bindings.txt
>> -- clock-names:
>> -   - "bus":AXI/master interface clock
>> -   - "reg":AHB/slave interface clock
>> -   (only required if GPU can gate slave interface independently)
>> -   - "core":   GPU core clock
>> -   - "shader": Shader clock (only required if GPU has feature PIPE_3D)
>> -
>> -Optional properties:
>> -- power-domains: a power domain consumer specifier according to
>> -  Documentation/devicetree/bindings/power/power_domain.txt
>> -
>> -example:
>> -
>> -gpu_3d: gpu@13 {
>> -compatible = "vivante,gc";
>> -reg = <0x0013 0x4000>;
>> -interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
>> -clocks = < IMX6QDL_CLK_GPU3D_AXI>,
>> - < IMX6QDL_CLK_GPU3D_CORE>,
>> - < IMX6QDL_CLK_GPU3D_SHADER>;
>> -clock-names = "bus", "core", "shader";
>> -power-domains = < 1>;
>> -};
>> diff --git a/Documentation/devicetree/bindings/gpu/vivante,gc.yaml 
>> b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>> new file mode 100644
>> index ..c4f549c0d750
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
>> @@ -0,0 +1,72 @@
>> +# SPDX-License-Identifier: GPL-2.0
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/gpu/vivante,gc.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Vivante GPU Bindings
>> +
>> +description: Vivante GPU core devices
>> +
>> +maintainers:
>> +  -  Lucas Stach 
>> +
>> +properties:
>> +  compatible:
>> +const: vivante,gc
>> +
>> +  reg:
>> +maxItems: 1
>> +
>> +  interrupts:
>> +maxItems: 1
>> +
>> +  clocks:
>> +items:
>> +  - description: AXI/master interface clock
>> +  - description: GPU core clock
>> +  - description: Shader clock (only required if GPU has feature PIPE_3D)
>> +  - description: AHB/slave interface clock (only required if GPU can 
>> gate slave interface independently)
> Can you have an AHB slave interface clock without a shader clock?

No because the items in the list are ordered so you need to have, in 
order: "bus", "core", "shader", "reg"

If it is needed to allow any number of clock in any order I could write 
it like this:

clocks:

   minItems: 1

   maxItems: 4

clock-names:

   items:

     enum: [ bus, core, shader, reg]

   minItems: 1

   maxItems: 4

Benjamin

>
>> +minItems: 2
>> +maxItems: 4
>> +
>> +  clock-names:
>> +items:
>> +  - const: bus
>> +  - const: core
>> +  - const: shader
>> +  - const: reg
>> +minItems: 2
>> +maxItems: 4
> If so, that check will fail, since it would expect a clock named
> shader on the 3rd item.
>
> It looks good otherwise, thanks!
> Maxime
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] dt-bindings: one file of all simple DSI panels

2020-01-28 Thread Benjamin Gaignard
Le mer. 8 janv. 2020 à 10:41, Benjamin Gaignard
 a écrit :
>
> Le mar. 7 janv. 2020 à 18:05, Rob Herring  a écrit :
> >
> > On Tue, Jan 7, 2020 at 9:44 AM Benjamin Gaignard
> >  wrote:
> > >
> > > Le jeu. 2 janv. 2020 à 11:17, Sam Ravnborg  a écrit :
> > > >
> > > > To complement panel-simple.yaml, create panel-simple-dsi.yaml.
> > > > panel-simple-dsi-yaml are for all simple DSP panels with a single
> > > > power-supply and optional backlight / enable GPIO.
> > > >
> > > > Migrate panasonic,vvx10f034n00 over to the new file.
> > > >
> > > > The objectives with one file for all the simple DSI panels are:
> > > > - Make it simpler to add bindings for simple DSI panels
> > > > - Keep the number of bindings file lower
> > > > - Keep the binding documentation for simple DSI panels more 
> > > > consistent
> > > >
> > > > Signed-off-by: Sam Ravnborg 
> > > > Cc: Thierry Reding 
> > > > Cc: Rob Herring 
> > > > Cc: Maxime Ripard 
> > > > Cc: Yannick Fertre 
> > > > Cc: Mark Rutland 
> > > > Cc: Daniel Vetter 
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Cc: devicet...@vger.kernel.org
> > > > ---
> > > >  .../display/panel/panasonic,vvx10f034n00.txt  | 20 --
> > > >  .../display/panel/panel-simple-dsi.yaml   | 67 +++
> > > >  2 files changed, 67 insertions(+), 20 deletions(-)
> > > >  delete mode 100644 
> > > > Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > > >  create mode 100644 
> > > > Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> > > >
> > > > diff --git 
> > > > a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > > >  
> > > > b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > > > deleted file mode 100644
> > > > index 37dedf6a6702..
> > > > --- 
> > > > a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > > > +++ /dev/null
> > > > @@ -1,20 +0,0 @@
> > > > -Panasonic 10" WUXGA TFT LCD panel
> > > > -
> > > > -Required properties:
> > > > -- compatible: should be "panasonic,vvx10f034n00"
> > > > -- reg: DSI virtual channel of the peripheral
> > > > -- power-supply: phandle of the regulator that provides the supply 
> > > > voltage
> > > > -
> > > > -Optional properties:
> > > > -- backlight: phandle of the backlight device attached to the panel
> > > > -
> > > > -Example:
> > > > -
> > > > -   mdss_dsi@fd922800 {
> > > > -   panel@0 {
> > > > -   compatible = "panasonic,vvx10f034n00";
> > > > -   reg = <0>;
> > > > -   power-supply = <_vsp>;
> > > > -   backlight = <_wled>;
> > > > -   };
> > > > -   };
> > > > diff --git 
> > > > a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
> > > > b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> > > > new file mode 100644
> > > > index ..05c52390269e
> > > > --- /dev/null
> > > > +++ 
> > > > b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> > > > @@ -0,0 +1,67 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/display/panel/panel-simple-dsi.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Simple DSI panels with a single power-supply
> > > > +
> > > > +maintainers:
> > > > +  - Thierry Reding 
> > > > +  - Sam Ravnborg 
> > > > +
> > > > +description: |
> > > > +  This binding file is a collection of the DSI panels that
> > > > +  requires only a single power-supply.
> > > > +  There are optionally a backlight and an enable GPIO.
> > > > +  The panel may use an OF graph binding for the association to the 
>

[PATCH] dt-bindings: display: Convert etnaviv to json-schema

2020-01-28 Thread Benjamin Gaignard
Convert etnaviv bindings to yaml format.

Signed-off-by: Benjamin Gaignard 
---
 .../bindings/display/etnaviv/etnaviv-drm.txt   | 36 ---
 .../bindings/display/etnaviv/etnaviv-drm.yaml  | 72 ++
 2 files changed, 72 insertions(+), 36 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
 create mode 100644 
Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.yaml

diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt 
b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
deleted file mode 100644
index 8def11b16a24..
--- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Vivante GPU core devices
-
-
-Required properties:
-- compatible: Should be "vivante,gc"
-  A more specific compatible is not needed, as the cores contain chip
-  identification registers at fixed locations, which provide all the
-  necessary information to the driver.
-- reg: should be register base and length as documented in the
-  datasheet
-- interrupts: Should contain the cores interrupt line
-- clocks: should contain one clock for entry in clock-names
-  see Documentation/devicetree/bindings/clock/clock-bindings.txt
-- clock-names:
-   - "bus":AXI/master interface clock
-   - "reg":AHB/slave interface clock
-   (only required if GPU can gate slave interface independently)
-   - "core":   GPU core clock
-   - "shader": Shader clock (only required if GPU has feature PIPE_3D)
-
-Optional properties:
-- power-domains: a power domain consumer specifier according to
-  Documentation/devicetree/bindings/power/power_domain.txt
-
-example:
-
-gpu_3d: gpu@13 {
-   compatible = "vivante,gc";
-   reg = <0x0013 0x4000>;
-   interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6QDL_CLK_GPU3D_AXI>,
-< IMX6QDL_CLK_GPU3D_CORE>,
-< IMX6QDL_CLK_GPU3D_SHADER>;
-   clock-names = "bus", "core", "shader";
-   power-domains = < 1>;
-};
diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.yaml 
b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.yaml
new file mode 100644
index ..5a6c387f168d
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/etnaviv/etnaviv-drm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Vivante GPU Bindings
+
+description: Vivante GPU core devices
+
+maintainers:
+  -  Lucas Stach 
+
+properties:
+  compatible:
+const: vivante,gc
+
+  reg:
+maxItems: 1
+
+  interrupts:
+maxItems: 1
+
+  clocks:
+items:
+  - description: AXI/master interface clock
+  - description: GPU core clock
+  - description: Shader clock (only required if GPU has feature PIPE_3D)
+  - description: AHB/slave interface clock (only required if GPU can gate 
slave interface independently)
+minItems: 2
+maxItems: 4
+
+  clock-names:
+items:
+  - const: bus
+  - const: core
+  - const: shader
+  - const: reg
+minItems: 2
+maxItems: 4
+
+  resets:
+maxItems: 1
+
+  power-domains:
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+#include 
+gpu@13 {
+  compatible = "vivante,gc";
+  reg = <0x0013 0x4000>;
+  interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
+  clocks = < IMX6QDL_CLK_GPU3D_AXI>,
+   < IMX6QDL_CLK_GPU3D_CORE>,
+   < IMX6QDL_CLK_GPU3D_SHADER>;
+  clock-names = "bus", "core", "shader";
+  power-domains = < 1>;
+};
+
+...
-- 
2.15.0

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


[PATCH v2] dt-bindings: display: Convert etnaviv to json-schema

2020-01-28 Thread Benjamin Gaignard
Convert etnaviv bindings to yaml format.

Signed-off-by: Benjamin Gaignard 
---
 .../bindings/display/etnaviv/etnaviv-drm.txt   | 36 ---
 .../devicetree/bindings/gpu/vivante,gc.yaml| 72 ++
 2 files changed, 72 insertions(+), 36 deletions(-)
 delete mode 100644 
Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
 create mode 100644 Documentation/devicetree/bindings/gpu/vivante,gc.yaml

diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt 
b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
deleted file mode 100644
index 8def11b16a24..
--- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Vivante GPU core devices
-
-
-Required properties:
-- compatible: Should be "vivante,gc"
-  A more specific compatible is not needed, as the cores contain chip
-  identification registers at fixed locations, which provide all the
-  necessary information to the driver.
-- reg: should be register base and length as documented in the
-  datasheet
-- interrupts: Should contain the cores interrupt line
-- clocks: should contain one clock for entry in clock-names
-  see Documentation/devicetree/bindings/clock/clock-bindings.txt
-- clock-names:
-   - "bus":AXI/master interface clock
-   - "reg":AHB/slave interface clock
-   (only required if GPU can gate slave interface independently)
-   - "core":   GPU core clock
-   - "shader": Shader clock (only required if GPU has feature PIPE_3D)
-
-Optional properties:
-- power-domains: a power domain consumer specifier according to
-  Documentation/devicetree/bindings/power/power_domain.txt
-
-example:
-
-gpu_3d: gpu@13 {
-   compatible = "vivante,gc";
-   reg = <0x0013 0x4000>;
-   interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
-   clocks = < IMX6QDL_CLK_GPU3D_AXI>,
-< IMX6QDL_CLK_GPU3D_CORE>,
-< IMX6QDL_CLK_GPU3D_SHADER>;
-   clock-names = "bus", "core", "shader";
-   power-domains = < 1>;
-};
diff --git a/Documentation/devicetree/bindings/gpu/vivante,gc.yaml 
b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
new file mode 100644
index ..c4f549c0d750
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpu/vivante,gc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Vivante GPU Bindings
+
+description: Vivante GPU core devices
+
+maintainers:
+  -  Lucas Stach 
+
+properties:
+  compatible:
+const: vivante,gc
+
+  reg:
+maxItems: 1
+
+  interrupts:
+maxItems: 1
+
+  clocks:
+items:
+  - description: AXI/master interface clock
+  - description: GPU core clock
+  - description: Shader clock (only required if GPU has feature PIPE_3D)
+  - description: AHB/slave interface clock (only required if GPU can gate 
slave interface independently)
+minItems: 2
+maxItems: 4
+
+  clock-names:
+items:
+  - const: bus
+  - const: core
+  - const: shader
+  - const: reg
+minItems: 2
+maxItems: 4
+
+  resets:
+maxItems: 1
+
+  power-domains:
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+#include 
+#include 
+gpu@13 {
+  compatible = "vivante,gc";
+  reg = <0x0013 0x4000>;
+  interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>;
+  clocks = < IMX6QDL_CLK_GPU3D_AXI>,
+   < IMX6QDL_CLK_GPU3D_CORE>,
+   < IMX6QDL_CLK_GPU3D_SHADER>;
+  clock-names = "bus", "core", "shader";
+  power-domains = < 1>;
+};
+
+...
-- 
2.15.0

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


Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2020-01-27 Thread Benjamin Gaignard
Le ven. 24 janv. 2020 à 23:08, Lyude Paul  a écrit :
>
> On Tue, 2020-01-07 at 14:11 +0100, Benjamin Gaignard wrote:
> > Le ven. 20 déc. 2019 à 15:03, Benjamin Gaignard
> >  a écrit :
> > > Le lun. 16 déc. 2019 à 09:28, Benjamin Gaignard
> > >  a écrit :
> > > > Le mer. 4 déc. 2019 à 17:47, Jani Nikula  a
> > > > écrit :
> > > > > On Thu, 28 Nov 2019, Benjamin Gaignard 
> > > > > wrote:
> > > > > > Fix the warnings that show up with W=1.
> > > > > > They are all about unused but set variables.
> > > > > > If functions returns are not used anymore make them void.
> > > > > >
> > > > > > Signed-off-by: Benjamin Gaignard 
> > > > > > ---
> > > > > > CC: Jani Nikula 
> > > > > >
> > > > > > changes in version 3:
> > > > > > - remove the hunk that may conflict with c485e2c97dae
> > > > > >   ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")
> > > > > >
> > > > > > changes in version 2:
> > > > > > - fix indentations
> > > > > > - when possible change functions prototype to void
> > > > > >
> > > > > > drivers/gpu/drm/drm_dp_mst_topology.c | 83 +--
> > > > > > 
> > > > > >  1 file changed, 31 insertions(+), 52 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > index 1437bc46368b..d5cb5688b5dd 100644
> > > > > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > @@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
> > > > > > drm_dp_sideband_msg_rx *msg,
> > > > > > u8 *replybuf, u8 replybuflen,
> > > > > > bool hdr)
> > > > > >  {
> > > > > >   int ret;
> > > > > > - u8 crc4;
> > > > > >
> > > > > >   if (hdr) {
> > > > > >   u8 hdrlen;
> > > > > > @@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
> > > > > > drm_dp_sideband_msg_rx *msg,
> > > > > >   }
> > > > > >
> > > > > >   if (msg->curchunk_idx >= msg->curchunk_len) {
> > > > > > - /* do CRC */
> > > > > > - crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
> > > > > > >curchunk_len - 1);
> > > > >
> > > > > Again, someone needs to check if crc4 should be *used* instead of
> > > > > thrown
> > > > > away. Blindly throwing stuff out is not the way to go.
> > > >
> > > > Hi Dave,
> > > >
> > >
> > > + Lyude who has been hacking in this code recently
> >
> > gentle ping for the reviewers,
> >
> hi-actually yes, we should probably be using this instead of just dropping
> this. Also, I didn't write this code originally I just refactored a bunch of
> it - Dave Airlied is the original author, but the original version of this
> code was written ages ago. tbh, I think it's a safe bet to say that they
> probably did mean to use this but forgot to and no one noticed until now.

Hi,

Any clue about how to use crc value ? Does it have to be checked
against something else ?
If crc are not matching what should we do of the data copied just before ?

Benjamin

>
> > Thanks,
> > Benjamin
> > > > Your are the original writer of this code, could you tell us if we can
> > > > drop crc4
> > > > ao if there is something else that I have misunderstood ?
> > > >
> > > > Thanks,
> > > > Benjamin
> > > >
> > > > > BR,
> > > > > Jani.
> > > > >
> > > > > >   /* copy chunk into bigger msg */
> > > > > >   memcpy(>msg[msg->curlen], msg->chunk, msg-
> > > > > > >curchunk_len - 1);
> > > > > >   msg->curlen += msg->curchunk_len - 1;
> > > > > > @@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct
> > > > > > drm_dp_sideband_msg_rx *raw,
&g

Re: [PATCH v2] drm: fix parameters documentation style

2020-01-20 Thread Benjamin GAIGNARD

On 1/18/20 10:41 AM, Sam Ravnborg wrote:
> Hi Benjamin
>
> On Tue, Jan 14, 2020 at 05:01:35PM +0100, Benjamin Gaignard wrote:
>> Remove old documentation style and use new one to avoid warnings when
>> compiling with W=1
>>
>> Signed-off-by: Benjamin Gaignard 
> Thanks for the warning fixes.
> This is legacy stuff that is not even wired into the kernel-doc stuff.
> But that is no excuse for old-style comments.

There is still quite a few of them in other drm files (drm_context.c,  
drm_bufs.c, drm_vm.c, drm_lock.c)

but I don't know how to fix them. Your advices are welcome.

Benjamin

>
> Applied to drm-misc-next.
>
>   Sam
>
>> ---
>> CC: Randy Dunlap 
>> version 2:
>> - fix return documentation
>>
>>   drivers/gpu/drm/drm_dma.c | 21 +++--
>>   1 file changed, 11 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
>> index e45b07890c5a..a7add55a85b4 100644
>> --- a/drivers/gpu/drm/drm_dma.c
>> +++ b/drivers/gpu/drm/drm_dma.c
>> @@ -42,10 +42,10 @@
>>   #include "drm_legacy.h"
>>   
>>   /**
>> - * Initialize the DMA data.
>> + * drm_legacy_dma_setup() - Initialize the DMA data.
>>*
>> - * \param dev DRM device.
>> - * \return zero on success or a negative value on failure.
>> + * @dev: DRM device.
>> + * Return: zero on success or a negative value on failure.
>>*
>>* Allocate and initialize a drm_device_dma structure.
>>*/
>> @@ -71,9 +71,9 @@ int drm_legacy_dma_setup(struct drm_device *dev)
>>   }
>>   
>>   /**
>> - * Cleanup the DMA resources.
>> + * drm_legacy_dma_takedown() - Cleanup the DMA resources.
>>*
>> - * \param dev DRM device.
>> + * @dev: DRM device.
>>*
>>* Free all pages associated with DMA buffers, the buffers and pages 
>> lists, and
>>* finally the drm_device::dma structure itself.
>> @@ -120,10 +120,10 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
>>   }
>>   
>>   /**
>> - * Free a buffer.
>> + * drm_legacy_free_buffer() - Free a buffer.
>>*
>> - * \param dev DRM device.
>> - * \param buf buffer to free.
>> + * @dev: DRM device.
>> + * @buf: buffer to free.
>>*
>>* Resets the fields of \p buf.
>>*/
>> @@ -139,9 +139,10 @@ void drm_legacy_free_buffer(struct drm_device *dev, 
>> struct drm_buf * buf)
>>   }
>>   
>>   /**
>> - * Reclaim the buffers.
>> + * drm_legacy_reclaim_buffers() - Reclaim the buffers.
>>*
>> - * \param file_priv DRM file private.
>> + * @dev: DRM device.
>> + * @file_priv: DRM file private.
>>*
>>* Frees each buffer associated with \p file_priv not already on the 
>> hardware.
>>*/
>> -- 
>> 2.15.0
>>
>> ___
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2020-01-18 Thread Benjamin Gaignard
Le sam. 18 janv. 2020 à 01:55, Lyude Paul  a écrit :
>
> Hey, does this still need review?

yes please.
There is a question about what we should do of crc4 variable below.

Thanks,
Benjamin
>
> On Tue, 2020-01-07 at 14:11 +0100, Benjamin Gaignard wrote:
> > Le ven. 20 déc. 2019 à 15:03, Benjamin Gaignard
> >  a écrit :
> > > Le lun. 16 déc. 2019 à 09:28, Benjamin Gaignard
> > >  a écrit :
> > > > Le mer. 4 déc. 2019 à 17:47, Jani Nikula  a
> > > > écrit :
> > > > > On Thu, 28 Nov 2019, Benjamin Gaignard 
> > > > > wrote:
> > > > > > Fix the warnings that show up with W=1.
> > > > > > They are all about unused but set variables.
> > > > > > If functions returns are not used anymore make them void.
> > > > > >
> > > > > > Signed-off-by: Benjamin Gaignard 
> > > > > > ---
> > > > > > CC: Jani Nikula 
> > > > > >
> > > > > > changes in version 3:
> > > > > > - remove the hunk that may conflict with c485e2c97dae
> > > > > >   ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")
> > > > > >
> > > > > > changes in version 2:
> > > > > > - fix indentations
> > > > > > - when possible change functions prototype to void
> > > > > >
> > > > > > drivers/gpu/drm/drm_dp_mst_topology.c | 83 +--
> > > > > > 
> > > > > >  1 file changed, 31 insertions(+), 52 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > index 1437bc46368b..d5cb5688b5dd 100644
> > > > > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > > > @@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct
> > > > > > drm_dp_sideband_msg_rx *msg,
> > > > > > u8 *replybuf, u8 replybuflen,
> > > > > > bool hdr)
> > > > > >  {
> > > > > >   int ret;
> > > > > > - u8 crc4;
> > > > > >
> > > > > >   if (hdr) {
> > > > > >   u8 hdrlen;
> > > > > > @@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct
> > > > > > drm_dp_sideband_msg_rx *msg,
> > > > > >   }
> > > > > >
> > > > > >   if (msg->curchunk_idx >= msg->curchunk_len) {
> > > > > > - /* do CRC */
> > > > > > - crc4 = drm_dp_msg_data_crc4(msg->chunk, msg-
> > > > > > >curchunk_len - 1);
> > > > >
> > > > > Again, someone needs to check if crc4 should be *used* instead of
> > > > > thrown
> > > > > away. Blindly throwing stuff out is not the way to go.
> > > >
> > > > Hi Dave,
> > > >
> > >
> > > + Lyude who has been hacking in this code recently
> >
> > gentle ping for the reviewers,
> >
> > Thanks,
> > Benjamin
> > > > Your are the original writer of this code, could you tell us if we can
> > > > drop crc4
> > > > ao if there is something else that I have misunderstood ?
> > > >
> > > > Thanks,
> > > > Benjamin
> > > >
> > > > > BR,
> > > > > Jani.
> > > > >
> > > > > >   /* copy chunk into bigger msg */
> > > > > >   memcpy(>msg[msg->curlen], msg->chunk, msg-
> > > > > > >curchunk_len - 1);
> > > > > >   msg->curlen += msg->curchunk_len - 1;
> > > > > > @@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct
> > > > > > drm_dp_sideband_msg_rx *raw,
> > > > > >   }
> > > > > >  }
> > > > > >
> > > > > > -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
> > > > > > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> > > > > > +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8
> > > > > > port_num, u32 offset, u8 num_bytes, u8 

[PATCH v2] drm: fix parameters documentation style

2020-01-15 Thread Benjamin Gaignard
Remove old documentation style and use new one to avoid warnings when
compiling with W=1

Signed-off-by: Benjamin Gaignard 
---
CC: Randy Dunlap 
version 2:
- fix return documentation

 drivers/gpu/drm/drm_dma.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index e45b07890c5a..a7add55a85b4 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -42,10 +42,10 @@
 #include "drm_legacy.h"
 
 /**
- * Initialize the DMA data.
+ * drm_legacy_dma_setup() - Initialize the DMA data.
  *
- * \param dev DRM device.
- * \return zero on success or a negative value on failure.
+ * @dev: DRM device.
+ * Return: zero on success or a negative value on failure.
  *
  * Allocate and initialize a drm_device_dma structure.
  */
@@ -71,9 +71,9 @@ int drm_legacy_dma_setup(struct drm_device *dev)
 }
 
 /**
- * Cleanup the DMA resources.
+ * drm_legacy_dma_takedown() - Cleanup the DMA resources.
  *
- * \param dev DRM device.
+ * @dev: DRM device.
  *
  * Free all pages associated with DMA buffers, the buffers and pages lists, and
  * finally the drm_device::dma structure itself.
@@ -120,10 +120,10 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
 }
 
 /**
- * Free a buffer.
+ * drm_legacy_free_buffer() - Free a buffer.
  *
- * \param dev DRM device.
- * \param buf buffer to free.
+ * @dev: DRM device.
+ * @buf: buffer to free.
  *
  * Resets the fields of \p buf.
  */
@@ -139,9 +139,10 @@ void drm_legacy_free_buffer(struct drm_device *dev, struct 
drm_buf * buf)
 }
 
 /**
- * Reclaim the buffers.
+ * drm_legacy_reclaim_buffers() - Reclaim the buffers.
  *
- * \param file_priv DRM file private.
+ * @dev: DRM device.
+ * @file_priv: DRM file private.
  *
  * Frees each buffer associated with \p file_priv not already on the hardware.
  */
-- 
2.15.0

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


[PATCH] drm: fix parameters documentation style

2020-01-15 Thread Benjamin Gaignard
Remove old documentation style and use new one to avoid warnings when
compiling with W=1

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_dma.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/drm_dma.c b/drivers/gpu/drm/drm_dma.c
index e45b07890c5a..f90bdd4ac69d 100644
--- a/drivers/gpu/drm/drm_dma.c
+++ b/drivers/gpu/drm/drm_dma.c
@@ -42,10 +42,10 @@
 #include "drm_legacy.h"
 
 /**
- * Initialize the DMA data.
+ * drm_legacy_dma_setup() - Initialize the DMA data.
  *
- * \param dev DRM device.
- * \return zero on success or a negative value on failure.
+ * @dev: DRM device.
+ * return zero on success or a negative value on failure.
  *
  * Allocate and initialize a drm_device_dma structure.
  */
@@ -71,9 +71,9 @@ int drm_legacy_dma_setup(struct drm_device *dev)
 }
 
 /**
- * Cleanup the DMA resources.
+ * drm_legacy_dma_takedown() - Cleanup the DMA resources.
  *
- * \param dev DRM device.
+ * @dev: DRM device.
  *
  * Free all pages associated with DMA buffers, the buffers and pages lists, and
  * finally the drm_device::dma structure itself.
@@ -120,10 +120,10 @@ void drm_legacy_dma_takedown(struct drm_device *dev)
 }
 
 /**
- * Free a buffer.
+ * drm_legacy_free_buffer() - Free a buffer.
  *
- * \param dev DRM device.
- * \param buf buffer to free.
+ * @dev: DRM device.
+ * @buf: buffer to free.
  *
  * Resets the fields of \p buf.
  */
@@ -139,9 +139,10 @@ void drm_legacy_free_buffer(struct drm_device *dev, struct 
drm_buf * buf)
 }
 
 /**
- * Reclaim the buffers.
+ * drm_legacy_reclaim_buffers() - Reclaim the buffers.
  *
- * \param file_priv DRM file private.
+ * @dev: DRM device.
+ * @file_priv: DRM file private.
  *
  * Frees each buffer associated with \p file_priv not already on the hardware.
  */
-- 
2.15.0

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


Re: [PATCH 18/23] drm/sti: Convert to CRTC VBLANK callbacks

2020-01-10 Thread Benjamin Gaignard
Le ven. 10 janv. 2020 à 10:21, Thomas Zimmermann  a écrit :
>
> VBLANK callbacks in struct drm_driver are deprecated in favor of
> their equivalents in struct drm_crtc_funcs. Convert sti over.
>

Hi Thomas,

Since you remove the last calls to sti_crtc functions from sti_drv.c I
think that the include could also be removed.

Anyway that looks for me:
Acked-by: Benjamin Gaignard 

Thanks,
Benjamin

> Signed-off-by: Thomas Zimmermann 
> ---
>  drivers/gpu/drm/sti/sti_crtc.c | 11 ---
>  drivers/gpu/drm/sti/sti_crtc.h |  2 --
>  drivers/gpu/drm/sti/sti_drv.c  |  3 ---
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
> index dc64fbfc4e61..49e6cb8f5836 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.c
> +++ b/drivers/gpu/drm/sti/sti_crtc.c
> @@ -279,12 +279,13 @@ int sti_crtc_vblank_cb(struct notifier_block *nb,
> return 0;
>  }
>
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
> +static int sti_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
> +   struct drm_device *dev = crtc->dev;
> +   unsigned int pipe = crtc->index;
> struct sti_private *dev_priv = dev->dev_private;
> struct sti_compositor *compo = dev_priv->compo;
> struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
> -   struct drm_crtc *crtc = >mixer[pipe]->drm_crtc;
> struct sti_vtg *vtg = compo->vtg[pipe];
>
> DRM_DEBUG_DRIVER("\n");
> @@ -297,8 +298,10 @@ int sti_crtc_enable_vblank(struct drm_device *dev, 
> unsigned int pipe)
> return 0;
>  }
>
> -void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
> +static void sti_crtc_disable_vblank(struct drm_crtc *crtc)
>  {
> +   struct drm_device *drm_dev = crtc->dev;
> +   unsigned int pipe = crtc->index;
> struct sti_private *priv = drm_dev->dev_private;
> struct sti_compositor *compo = priv->compo;
> struct notifier_block *vtg_vblank_nb = >vtg_vblank_nb[pipe];
> @@ -330,6 +333,8 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
> .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> .late_register = sti_crtc_late_register,
> +   .enable_vblank = sti_crtc_enable_vblank,
> +   .disable_vblank = sti_crtc_disable_vblank,
>  };
>
>  bool sti_crtc_is_main(struct drm_crtc *crtc)
> diff --git a/drivers/gpu/drm/sti/sti_crtc.h b/drivers/gpu/drm/sti/sti_crtc.h
> index df489ab14e2b..1132b4586712 100644
> --- a/drivers/gpu/drm/sti/sti_crtc.h
> +++ b/drivers/gpu/drm/sti/sti_crtc.h
> @@ -15,8 +15,6 @@ struct sti_mixer;
>
>  int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
>   struct drm_plane *primary, struct drm_plane *cursor);
> -int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe);
> -void sti_crtc_disable_vblank(struct drm_device *dev, unsigned int pipe);
>  int sti_crtc_vblank_cb(struct notifier_block *nb,
>unsigned long event, void *data);
>  bool sti_crtc_is_main(struct drm_crtc *drm_crtc);
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index a39fc36f815b..8e30001bf545 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -146,9 +146,6 @@ static struct drm_driver sti_driver = {
> .dumb_create = drm_gem_cma_dumb_create,
> .fops = _driver_fops,
>
> -   .enable_vblank = sti_crtc_enable_vblank,
> -   .disable_vblank = sti_crtc_disable_vblank,
> -
> .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table,
> --
> 2.24.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/fb-cma-helpers: Fix include issue

2020-01-09 Thread Benjamin GAIGNARD

On 12/3/19 5:49 PM, Benjamin Gaignard wrote:
> Le mer. 20 nov. 2019 à 00:28, Benjamin Gaignard
>  a écrit :
>> Exported functions prototypes are missing in drm_fb_cma_helper.c
>> Include drm_fb_cma_helper to fix that issue.
>>
> Gentle ping to reviewers.
> Thanks,
> Benjamin

I know that removing warnings is not a sexy task, but reviewers are welcome.

Thanks,

Benjamin

>
>> Signed-off-by: Benjamin Gaignard 
>> ---
>>   drivers/gpu/drm/drm_fb_cma_helper.c | 1 +
>>   include/drm/drm_fb_cma_helper.h | 2 ++
>>   2 files changed, 3 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
>> b/drivers/gpu/drm/drm_fb_cma_helper.c
>> index c0b0f603af63..9801c0333eca 100644
>> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
>> @@ -9,6 +9,7 @@
>>*  Copyright (C) 2012 Red Hat
>>*/
>>
>> +#include 
>>   #include 
>>   #include 
>>   #include 
>> diff --git a/include/drm/drm_fb_cma_helper.h 
>> b/include/drm/drm_fb_cma_helper.h
>> index 4becb09975a4..795aea1d0a25 100644
>> --- a/include/drm/drm_fb_cma_helper.h
>> +++ b/include/drm/drm_fb_cma_helper.h
>> @@ -2,6 +2,8 @@
>>   #ifndef __DRM_FB_CMA_HELPER_H__
>>   #define __DRM_FB_CMA_HELPER_H__
>>
>> +#include 
>> +
>>   struct drm_framebuffer;
>>   struct drm_plane_state;
>>
>> --
>> 2.15.0
>>
>> ___
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/modes: tag unused variables to avoid warnings

2020-01-09 Thread Benjamin GAIGNARD


On 1/7/20 2:24 PM, Thomas Zimmermann wrote:
> Hi
>
> Am 10.12.19 um 11:24 schrieb Benjamin Gaignard:
>> Some variables are set but never used. To avoid warning when compiling
>> with W=1 and keep the algorithm like it is tag theses variables
>> with _maybe_unused macro.
>>
>> Signed-off-by: Benjamin Gaignard 
> Acked-by: Thomas Zimmermann 

Applied on drm-misc-next.

Thanks,

Benjamin

>
>> ---
>> changes in this version:
>> - do not modify the code to remove the unused variables
>>just prefix them with __maybe_unused macro.
>>
>>   drivers/gpu/drm/drm_modes.c | 9 +
>>   1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index 88232698d7a0..70aed4e2990d 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
>> *dev, int hdisplay,
>>  /* 3) Nominal HSync width (% of line period) - default 8 */
>>   #define CVT_HSYNC_PERCENTAGE   8
>>  unsigned int hblank_percentage;
>> -int vsyncandback_porch, vback_porch, hblank;
>> +int vsyncandback_porch, __maybe_unused vback_porch, hblank;
>>   
>>  /* estimated the horizontal period */
>>  tmp1 = HV_FACTOR * 100  -
>> @@ -386,9 +386,10 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
>> hdisplay, int vdisplay,
>>  int top_margin, bottom_margin;
>>  int interlace;
>>  unsigned int hfreq_est;
>> -int vsync_plus_bp, vback_porch;
>> -unsigned int vtotal_lines, vfieldrate_est, hperiod;
>> -unsigned int vfield_rate, vframe_rate;
>> +int vsync_plus_bp, __maybe_unused vback_porch;
>> +unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
>> +unsigned int __maybe_unused hperiod;
>> +unsigned int vfield_rate, __maybe_unused vframe_rate;
>>  int left_margin, right_margin;
>>  unsigned int total_active_pixels, ideal_duty_cycle;
>>  unsigned int hblank, total_pixels, pixel_freq;
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/fb-cma-helpers: Fix include issue

2020-01-09 Thread Benjamin Gaignard
Le jeu. 9 janv. 2020 à 17:29, Benjamin GAIGNARD
 a écrit :
>
>
> On 12/3/19 5:49 PM, Benjamin Gaignard wrote:
> > Le mer. 20 nov. 2019 à 00:28, Benjamin Gaignard
> >  a écrit :
> >> Exported functions prototypes are missing in drm_fb_cma_helper.c
> >> Include drm_fb_cma_helper to fix that issue.
> >>
> > Gentle ping to reviewers.
> > Thanks,
> > Benjamin
>
> I know that removing warnings is not a sexy task, but reviewers are welcome.

Applied on drm-misc-next, with Thomas ack even if dri patchwork doesn't show it.

Thanks
Benjamin

>
> Thanks,
>
> Benjamin
>
> >
> >> Signed-off-by: Benjamin Gaignard 
> >> ---
> >>   drivers/gpu/drm/drm_fb_cma_helper.c | 1 +
> >>   include/drm/drm_fb_cma_helper.h | 2 ++
> >>   2 files changed, 3 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
> >> b/drivers/gpu/drm/drm_fb_cma_helper.c
> >> index c0b0f603af63..9801c0333eca 100644
> >> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> >> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> >> @@ -9,6 +9,7 @@
> >>*  Copyright (C) 2012 Red Hat
> >>*/
> >>
> >> +#include 
> >>   #include 
> >>   #include 
> >>   #include 
> >> diff --git a/include/drm/drm_fb_cma_helper.h 
> >> b/include/drm/drm_fb_cma_helper.h
> >> index 4becb09975a4..795aea1d0a25 100644
> >> --- a/include/drm/drm_fb_cma_helper.h
> >> +++ b/include/drm/drm_fb_cma_helper.h
> >> @@ -2,6 +2,8 @@
> >>   #ifndef __DRM_FB_CMA_HELPER_H__
> >>   #define __DRM_FB_CMA_HELPER_H__
> >>
> >> +#include 
> >> +
> >>   struct drm_framebuffer;
> >>   struct drm_plane_state;
> >>
> >> --
> >> 2.15.0
> >>
> >> ___
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] dt-bindings: one file of all simple DSI panels

2020-01-08 Thread Benjamin Gaignard
Le mar. 7 janv. 2020 à 18:05, Rob Herring  a écrit :
>
> On Tue, Jan 7, 2020 at 9:44 AM Benjamin Gaignard
>  wrote:
> >
> > Le jeu. 2 janv. 2020 à 11:17, Sam Ravnborg  a écrit :
> > >
> > > To complement panel-simple.yaml, create panel-simple-dsi.yaml.
> > > panel-simple-dsi-yaml are for all simple DSP panels with a single
> > > power-supply and optional backlight / enable GPIO.
> > >
> > > Migrate panasonic,vvx10f034n00 over to the new file.
> > >
> > > The objectives with one file for all the simple DSI panels are:
> > > - Make it simpler to add bindings for simple DSI panels
> > > - Keep the number of bindings file lower
> > > - Keep the binding documentation for simple DSI panels more consistent
> > >
> > > Signed-off-by: Sam Ravnborg 
> > > Cc: Thierry Reding 
> > > Cc: Rob Herring 
> > > Cc: Maxime Ripard 
> > > Cc: Yannick Fertre 
> > > Cc: Mark Rutland 
> > > Cc: Daniel Vetter 
> > > Cc: dri-devel@lists.freedesktop.org
> > > Cc: devicet...@vger.kernel.org
> > > ---
> > >  .../display/panel/panasonic,vvx10f034n00.txt  | 20 --
> > >  .../display/panel/panel-simple-dsi.yaml   | 67 +++
> > >  2 files changed, 67 insertions(+), 20 deletions(-)
> > >  delete mode 100644 
> > > Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > >  create mode 100644 
> > > Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> > >
> > > diff --git 
> > > a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > >  
> > > b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > > deleted file mode 100644
> > > index 37dedf6a6702..
> > > --- 
> > > a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> > > +++ /dev/null
> > > @@ -1,20 +0,0 @@
> > > -Panasonic 10" WUXGA TFT LCD panel
> > > -
> > > -Required properties:
> > > -- compatible: should be "panasonic,vvx10f034n00"
> > > -- reg: DSI virtual channel of the peripheral
> > > -- power-supply: phandle of the regulator that provides the supply voltage
> > > -
> > > -Optional properties:
> > > -- backlight: phandle of the backlight device attached to the panel
> > > -
> > > -Example:
> > > -
> > > -   mdss_dsi@fd922800 {
> > > -   panel@0 {
> > > -   compatible = "panasonic,vvx10f034n00";
> > > -   reg = <0>;
> > > -   power-supply = <_vsp>;
> > > -   backlight = <_wled>;
> > > -   };
> > > -   };
> > > diff --git 
> > > a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
> > > b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> > > new file mode 100644
> > > index ..05c52390269e
> > > --- /dev/null
> > > +++ 
> > > b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> > > @@ -0,0 +1,67 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/display/panel/panel-simple-dsi.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Simple DSI panels with a single power-supply
> > > +
> > > +maintainers:
> > > +  - Thierry Reding 
> > > +  - Sam Ravnborg 
> > > +
> > > +description: |
> > > +  This binding file is a collection of the DSI panels that
> > > +  requires only a single power-supply.
> > > +  There are optionally a backlight and an enable GPIO.
> > > +  The panel may use an OF graph binding for the association to the 
> > > display,
> > > +  or it may be a direct child node of the display.
> > > +
> > > +  If the panel is more advanced a dedicated binding file is required.
> > > +
> > > +allOf:
> > > +  - $ref: panel-common.yaml#
> > > +
> > > +properties:
> > > +
> > > +  compatible:
> > > +enum:
> > > +# compatible must be listed in alphabetical order, ordered by 
> > > compatible.
> > > +# The description in the comment is mandatory f

Re: [PATCH v2 2/2] dt-bindings: one file of all simple DSI panels

2020-01-07 Thread Benjamin Gaignard
Le jeu. 2 janv. 2020 à 11:17, Sam Ravnborg  a écrit :
>
> To complement panel-simple.yaml, create panel-simple-dsi.yaml.
> panel-simple-dsi-yaml are for all simple DSP panels with a single
> power-supply and optional backlight / enable GPIO.
>
> Migrate panasonic,vvx10f034n00 over to the new file.
>
> The objectives with one file for all the simple DSI panels are:
> - Make it simpler to add bindings for simple DSI panels
> - Keep the number of bindings file lower
> - Keep the binding documentation for simple DSI panels more consistent
>
> Signed-off-by: Sam Ravnborg 
> Cc: Thierry Reding 
> Cc: Rob Herring 
> Cc: Maxime Ripard 
> Cc: Yannick Fertre 
> Cc: Mark Rutland 
> Cc: Daniel Vetter 
> Cc: dri-devel@lists.freedesktop.org
> Cc: devicet...@vger.kernel.org
> ---
>  .../display/panel/panasonic,vvx10f034n00.txt  | 20 --
>  .../display/panel/panel-simple-dsi.yaml   | 67 +++
>  2 files changed, 67 insertions(+), 20 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
>
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt 
> b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> deleted file mode 100644
> index 37dedf6a6702..
> --- 
> a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -Panasonic 10" WUXGA TFT LCD panel
> -
> -Required properties:
> -- compatible: should be "panasonic,vvx10f034n00"
> -- reg: DSI virtual channel of the peripheral
> -- power-supply: phandle of the regulator that provides the supply voltage
> -
> -Optional properties:
> -- backlight: phandle of the backlight device attached to the panel
> -
> -Example:
> -
> -   mdss_dsi@fd922800 {
> -   panel@0 {
> -   compatible = "panasonic,vvx10f034n00";
> -   reg = <0>;
> -   power-supply = <_vsp>;
> -   backlight = <_wled>;
> -   };
> -   };
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml 
> b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> new file mode 100644
> index ..05c52390269e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
> @@ -0,0 +1,67 @@
> +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/panel/panel-simple-dsi.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Simple DSI panels with a single power-supply
> +
> +maintainers:
> +  - Thierry Reding 
> +  - Sam Ravnborg 
> +
> +description: |
> +  This binding file is a collection of the DSI panels that
> +  requires only a single power-supply.
> +  There are optionally a backlight and an enable GPIO.
> +  The panel may use an OF graph binding for the association to the display,
> +  or it may be a direct child node of the display.
> +
> +  If the panel is more advanced a dedicated binding file is required.
> +
> +allOf:
> +  - $ref: panel-common.yaml#
> +
> +properties:
> +
> +  compatible:
> +enum:
> +# compatible must be listed in alphabetical order, ordered by compatible.
> +# The description in the comment is mandatory for each compatible.
> +
> +# Panasonic 10" WUXGA TFT LCD panel
> +- panasonic,vvx10f034n00

Hi Sam,

I have tested your patch with these 2 dsi panels:
# Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD
  - orisetech,otm8009a
 # Raydium Semiconductor Corporation RM68200 is a 5.5" 720x1280 TFT LCD
   - raydium,rm68200

It is close to be fine for me but I have minors comments below.

Benjamin

> +
> +  reg:
> +maxItems: 1
> +description: DSI virtual channel
> +
> +  backlight: true
> +  enable-gpios: true
> +  port: true
> +  power-supply: true

add reset-gpios: true to support orisetech panel

> +
> +additionalProperties: false
> +
> +required:
> +  - compatible
> +  - power-supply

power-supply should optional

> +  - reg
> +
> +examples:
> +  - |
> +mdss_dsi@fd922800 {
> +  #address-cells = <1>;
> +  #size-cells = <0>;
> +  panel@0 {
> +compatible = "panasonic,vvx10f034n00";
> +reg = <0>;
> +power-supply = <_lcd_reg>;
> +
> +port {
> +  panel: endpoint {
> +remote-endpoint = <_out>;
> +  };
> +};
> +  };
> +};
> --
> 2.20.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/2] dt-bindings: one binding file for all simple panels

2020-01-07 Thread Benjamin Gaignard
Le jeu. 2 janv. 2020 à 11:17, Sam Ravnborg  a écrit :
>
> There is an increasing number of new simple panels.
> Common for many of these simple panels are that they have one
> mandatory power-supply and some of them have backlight and / or
> an enable gpio.
>
> The binding file to describe these panels adds overhead
> that really do not add value.
> The binding are known and there is nothing gained from a
> dedicated binding file nor for any dedicated example.
>
> The following patch introduces a single panel-simple.yaml
> and converts two ampire bindings over to the new file.
>
> The conversion - if applied will have following effects:
>
> - The maintainer for the individual file will change
> There is no need for many different maintainers for a simple binding.
> We have the same situation with the panel-simple driver in the kernel.
>
> - The license will change to (GPL-2.0-only OR BSD-2-Clause)
> There is usually only a single line copied from the original
> file, a line that is often copied from a datasheet.
> This license change should be acceptable considered what little
> is copied.
> If the license change is not OK we can use a dedicated binding
> file in these cases.
>
> This is a follow-up on Rob's big patch converting a lot of panel bindings
> to individual files:
>
> "dt-bindings: display: Convert a bunch of panels to DT schema"
> https://patchwork.ozlabs.org/patch/1197683/
>
> The objectives with one file for the relevant simple panels are:
> - Make it simpler to add bindings for simple panels
> - Keep the number of bindings file lower and thus easier to find a
>   relevant file to copy from when adding new panels.
> - Keep the binding documentation for simple panels more consistent
> - Make it simpler to add support for new panels
>
> v2:
>   - spelling fixes (imirkin via irc, Rob)
>   - updated description (Rob)
>   - list properires in alphabetical order
>   - added power-supply to example (Rob)
>   - updated title
>   - reworded changelog a little
>
> Signed-off-by: Sam Ravnborg 
> Cc: Thierry Reding 
> Cc: Rob Herring 
> Cc: Maxime Ripard 
> Cc: Yannick Fertre 
> Cc: Mark Rutland 
> Cc: Daniel Vetter 
> Cc: dri-devel@lists.freedesktop.org
> Cc: devicet...@vger.kernel.org
> ---
>  .../panel/ampire,am-480272h3tmqw-t01h.yaml| 42 -
>  .../panel/ampire,am800480r3tmqwa1h.txt|  7 ---
>  .../bindings/display/panel/panel-simple.yaml  | 59 +++
>  3 files changed, 59 insertions(+), 49 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.yaml
>  delete mode 100644 
> Documentation/devicetree/bindings/display/panel/ampire,am800480r3tmqwa1h.txt
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/panel-simple.yaml
>
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.yaml
>  
> b/Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.yaml
> deleted file mode 100644
> index c6e33e7f36d0..
> --- 
> a/Documentation/devicetree/bindings/display/panel/ampire,am-480272h3tmqw-t01h.yaml
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -%YAML 1.2
> 
> -$id: 
> http://devicetree.org/schemas/display/panel/ampire,am-480272h3tmqw-t01h.yaml#
> -$schema: http://devicetree.org/meta-schemas/core.yaml#
> -
> -title: Ampire AM-480272H3TMQW-T01H 4.3" WQVGA TFT LCD panel
> -
> -maintainers:
> -  - Yannick Fertre 
> -  - Thierry Reding 
> -
> -allOf:
> -  - $ref: panel-common.yaml#
> -
> -properties:
> -  compatible:
> -const: ampire,am-480272h3tmqw-t01h
> -
> -  power-supply: true
> -  enable-gpios: true
> -  backlight: true
> -  port: true
> -
> -required:
> -  - compatible
> -
> -additionalProperties: false
> -
> -examples:
> -  - |
> -panel_rgb: panel {
> -  compatible = "ampire,am-480272h3tmqw-t01h";
> -  enable-gpios = < 8 1>;
> -  port {
> -panel_in_rgb: endpoint {
> -  remote-endpoint = <_out_rgb>;
> -};
> -  };
> -};
> -
> -...
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/ampire,am800480r3tmqwa1h.txt
>  
> b/Documentation/devicetree/bindings/display/panel/ampire,am800480r3tmqwa1h.txt
> deleted file mode 100644
> index 83e2cae1cc1b..
> --- 
> a/Documentation/devicetree/bindings/display/panel/ampire,am800480r3tmqwa1h.txt
> +++ /dev/null
> @@ -1,7 +0,0 @@
> -Ampire AM-800480R3TMQW-A1H 7.0" WVGA TFT LCD panel
> -
> -Required properties:
> -- compatible: should be "ampire,am800480r3tmqwa1h"
> -
> -This binding is compatible with the simple-panel binding, which is specified
> -in simple-panel.txt in this directory.
> diff --git 
> a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
> b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> new file mode 100644
> index ..51ca50201182
> --- /dev/null
> +++ 

Re: [PATCH] drm/modes: tag unused variables to avoid warnings

2020-01-07 Thread Benjamin Gaignard
Le mer. 11 déc. 2019 à 10:20, Benjamin Gaignard
 a écrit :
>
> Some variables are set but never used. To avoid warning when compiling
> with W=1 and keep the algorithm like it is tag theses variables
> with _maybe_unused macro.

Gentle ping.
Thanks,
Benjamin

>
> Signed-off-by: Benjamin Gaignard 
> ---
> changes in this version:
> - do not modify the code to remove the unused variables
>   just prefix them with __maybe_unused macro.
>
>  drivers/gpu/drm/drm_modes.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 88232698d7a0..70aed4e2990d 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
> *dev, int hdisplay,
> /* 3) Nominal HSync width (% of line period) - default 8 */
>  #define CVT_HSYNC_PERCENTAGE   8
> unsigned int hblank_percentage;
> -   int vsyncandback_porch, vback_porch, hblank;
> +   int vsyncandback_porch, __maybe_unused vback_porch, hblank;
>
> /* estimated the horizontal period */
> tmp1 = HV_FACTOR * 100  -
> @@ -386,9 +386,10 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
> hdisplay, int vdisplay,
> int top_margin, bottom_margin;
> int interlace;
> unsigned int hfreq_est;
> -   int vsync_plus_bp, vback_porch;
> -   unsigned int vtotal_lines, vfieldrate_est, hperiod;
> -   unsigned int vfield_rate, vframe_rate;
> +   int vsync_plus_bp, __maybe_unused vback_porch;
> +   unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
> +   unsigned int __maybe_unused hperiod;
> +   unsigned int vfield_rate, __maybe_unused vframe_rate;
> int left_margin, right_margin;
> unsigned int total_active_pixels, ideal_duty_cycle;
> unsigned int hblank, total_pixels, pixel_freq;
> --
> 2.15.0
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2020-01-07 Thread Benjamin Gaignard
Le ven. 20 déc. 2019 à 15:03, Benjamin Gaignard
 a écrit :
>
> Le lun. 16 déc. 2019 à 09:28, Benjamin Gaignard
>  a écrit :
> >
> > Le mer. 4 déc. 2019 à 17:47, Jani Nikula  a 
> > écrit :
> > >
> > > On Thu, 28 Nov 2019, Benjamin Gaignard  wrote:
> > > > Fix the warnings that show up with W=1.
> > > > They are all about unused but set variables.
> > > > If functions returns are not used anymore make them void.
> > > >
> > > > Signed-off-by: Benjamin Gaignard 
> > > > ---
> > > > CC: Jani Nikula 
> > > >
> > > > changes in version 3:
> > > > - remove the hunk that may conflict with c485e2c97dae
> > > >   ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")
> > > >
> > > > changes in version 2:
> > > > - fix indentations
> > > > - when possible change functions prototype to void
> > > >
> > > > drivers/gpu/drm/drm_dp_mst_topology.c | 83 
> > > > +--
> > > >  1 file changed, 31 insertions(+), 52 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> > > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > index 1437bc46368b..d5cb5688b5dd 100644
> > > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > > @@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct 
> > > > drm_dp_sideband_msg_rx *msg,
> > > > u8 *replybuf, u8 replybuflen, bool 
> > > > hdr)
> > > >  {
> > > >   int ret;
> > > > - u8 crc4;
> > > >
> > > >   if (hdr) {
> > > >   u8 hdrlen;
> > > > @@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct 
> > > > drm_dp_sideband_msg_rx *msg,
> > > >   }
> > > >
> > > >   if (msg->curchunk_idx >= msg->curchunk_len) {
> > > > - /* do CRC */
> > > > - crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len 
> > > > - 1);
> > >
> > > Again, someone needs to check if crc4 should be *used* instead of thrown
> > > away. Blindly throwing stuff out is not the way to go.
> >
> > Hi Dave,
> >
>
> + Lyude who has been hacking in this code recently

gentle ping for the reviewers,

Thanks,
Benjamin
>
> > Your are the original writer of this code, could you tell us if we can drop 
> > crc4
> > ao if there is something else that I have misunderstood ?
> >
> > Thanks,
> > Benjamin
> >
> > >
> > > BR,
> > > Jani.
> > >
> > > >   /* copy chunk into bigger msg */
> > > >   memcpy(>msg[msg->curlen], msg->chunk, 
> > > > msg->curchunk_len - 1);
> > > >   msg->curlen += msg->curchunk_len - 1;
> > > > @@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct 
> > > > drm_dp_sideband_msg_rx *raw,
> > > >   }
> > > >  }
> > > >
> > > > -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> > > > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> > > > +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> > > > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> > > >  {
> > > >   struct drm_dp_sideband_msg_req_body req;
> > > >
> > > > @@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct 
> > > > drm_dp_sideband_msg_tx *msg, u8 port_num, u32
> > > >   req.u.dpcd_write.num_bytes = num_bytes;
> > > >   req.u.dpcd_write.bytes = bytes;
> > > >   drm_dp_encode_sideband_req(, msg);
> > > > -
> > > > - return 0;
> > > >  }
> > > >
> > > > -static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
> > > > +static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
> > > >  {
> > > >   struct drm_dp_sideband_msg_req_body req;
> > > >
> > > >   req.req_type = DP_LINK_ADDRESS;
> > > >   drm_dp_encode_sideband_req(, msg);
> > > > - return 0;
> > > >  }
> > > >
> > > >  static int build_enum_path_resources(

Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2019-12-20 Thread Benjamin Gaignard
Le lun. 16 déc. 2019 à 09:28, Benjamin Gaignard
 a écrit :
>
> Le mer. 4 déc. 2019 à 17:47, Jani Nikula  a 
> écrit :
> >
> > On Thu, 28 Nov 2019, Benjamin Gaignard  wrote:
> > > Fix the warnings that show up with W=1.
> > > They are all about unused but set variables.
> > > If functions returns are not used anymore make them void.
> > >
> > > Signed-off-by: Benjamin Gaignard 
> > > ---
> > > CC: Jani Nikula 
> > >
> > > changes in version 3:
> > > - remove the hunk that may conflict with c485e2c97dae
> > >   ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")
> > >
> > > changes in version 2:
> > > - fix indentations
> > > - when possible change functions prototype to void
> > >
> > > drivers/gpu/drm/drm_dp_mst_topology.c | 83 
> > > +--
> > >  1 file changed, 31 insertions(+), 52 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> > > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > index 1437bc46368b..d5cb5688b5dd 100644
> > > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > > @@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct 
> > > drm_dp_sideband_msg_rx *msg,
> > > u8 *replybuf, u8 replybuflen, bool 
> > > hdr)
> > >  {
> > >   int ret;
> > > - u8 crc4;
> > >
> > >   if (hdr) {
> > >   u8 hdrlen;
> > > @@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct 
> > > drm_dp_sideband_msg_rx *msg,
> > >   }
> > >
> > >   if (msg->curchunk_idx >= msg->curchunk_len) {
> > > - /* do CRC */
> > > - crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 
> > > 1);
> >
> > Again, someone needs to check if crc4 should be *used* instead of thrown
> > away. Blindly throwing stuff out is not the way to go.
>
> Hi Dave,
>

+ Lyude who has been hacking in this code recently

> Your are the original writer of this code, could you tell us if we can drop 
> crc4
> ao if there is something else that I have misunderstood ?
>
> Thanks,
> Benjamin
>
> >
> > BR,
> > Jani.
> >
> > >   /* copy chunk into bigger msg */
> > >   memcpy(>msg[msg->curlen], msg->chunk, 
> > > msg->curchunk_len - 1);
> > >   msg->curlen += msg->curchunk_len - 1;
> > > @@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct 
> > > drm_dp_sideband_msg_rx *raw,
> > >   }
> > >  }
> > >
> > > -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> > > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> > > +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> > > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> > >  {
> > >   struct drm_dp_sideband_msg_req_body req;
> > >
> > > @@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct 
> > > drm_dp_sideband_msg_tx *msg, u8 port_num, u32
> > >   req.u.dpcd_write.num_bytes = num_bytes;
> > >   req.u.dpcd_write.bytes = bytes;
> > >   drm_dp_encode_sideband_req(, msg);
> > > -
> > > - return 0;
> > >  }
> > >
> > > -static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
> > > +static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
> > >  {
> > >   struct drm_dp_sideband_msg_req_body req;
> > >
> > >   req.req_type = DP_LINK_ADDRESS;
> > >   drm_dp_encode_sideband_req(, msg);
> > > - return 0;
> > >  }
> > >
> > >  static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, 
> > > int port_num)
> > > @@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct 
> > > drm_dp_sideband_msg_tx *msg, int por
> > >   return 0;
> > >  }
> > >
> > > -static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, 
> > > int port_num,
> > > +static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, 
> > > int port_num,
> > > u8 vcpi, uint16_t pbn,
> > > u8 number_sdp_streams,
> > >

Re: [PATCH] drm/stm: ltdc: move pinctrl to encoder mode set

2019-12-20 Thread Benjamin Gaignard
Le lun. 2 déc. 2019 à 18:19, Philippe CORNU  a écrit :
>
> Dear Yannick,
> Thank you for your patch,
>
> Acked-by: Philippe Cornu 
>

Applied on drm-misc-next,

Thanks,
Benjamin

> Philippe :-)
>
> On 11/27/19 11:23 AM, Yannick Fertre wrote:
> > From: Yannick Fertré 
> >
> > The pin control must be set to default as soon as possible to
> > establish a good video link between tv & bridge hdmi
> > (encoder mode set is call before encoder enable).
> >
> > Signed-off-by: Yannick Fertre 
> > ---
> >   drivers/gpu/drm/stm/ltdc.c | 24 ++--
> >   1 file changed, 18 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index 49ef406..dba8e7f 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -435,9 +435,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc 
> > *crtc,
> >   /* Commit shadow registers = update planes at next vblank */
> >   reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR);
> >
> > - /* Enable LTDC */
> > - reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > -
> >   drm_crtc_vblank_on(crtc);
> >   }
> >
> > @@ -451,9 +448,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc 
> > *crtc,
> >
> >   drm_crtc_vblank_off(crtc);
> >
> > - /* disable LTDC */
> > - reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > -
> >   /* disable IRQ */
> >   reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE);
> >
> > @@ -1042,9 +1036,13 @@ static const struct drm_encoder_funcs 
> > ltdc_encoder_funcs = {
> >   static void ltdc_encoder_disable(struct drm_encoder *encoder)
> >   {
> >   struct drm_device *ddev = encoder->dev;
> > + struct ltdc_device *ldev = ddev->dev_private;
> >
> >   DRM_DEBUG_DRIVER("\n");
> >
> > + /* Disable LTDC */
> > + reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > +
> >   /* Set to sleep state the pinctrl whatever type of encoder */
> >   pinctrl_pm_select_sleep_state(ddev->dev);
> >   }
> > @@ -1052,6 +1050,19 @@ static void ltdc_encoder_disable(struct drm_encoder 
> > *encoder)
> >   static void ltdc_encoder_enable(struct drm_encoder *encoder)
> >   {
> >   struct drm_device *ddev = encoder->dev;
> > + struct ltdc_device *ldev = ddev->dev_private;
> > +
> > + DRM_DEBUG_DRIVER("\n");
> > +
> > + /* Enable LTDC */
> > + reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN);
> > +}
> > +
> > +static void ltdc_encoder_mode_set(struct drm_encoder *encoder,
> > +   struct drm_display_mode *mode,
> > +   struct drm_display_mode *adjusted_mode)
> > +{
> > + struct drm_device *ddev = encoder->dev;
> >
> >   DRM_DEBUG_DRIVER("\n");
> >
> > @@ -1067,6 +1078,7 @@ static void ltdc_encoder_enable(struct drm_encoder 
> > *encoder)
> >   static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = {
> >   .disable = ltdc_encoder_disable,
> >   .enable = ltdc_encoder_enable,
> > + .mode_set = ltdc_encoder_mode_set,
> >   };
> >
> >   static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge 
> > *bridge)
> >
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2019-12-16 Thread Benjamin Gaignard
Le mer. 4 déc. 2019 à 17:47, Jani Nikula  a écrit :
>
> On Thu, 28 Nov 2019, Benjamin Gaignard  wrote:
> > Fix the warnings that show up with W=1.
> > They are all about unused but set variables.
> > If functions returns are not used anymore make them void.
> >
> > Signed-off-by: Benjamin Gaignard 
> > ---
> > CC: Jani Nikula 
> >
> > changes in version 3:
> > - remove the hunk that may conflict with c485e2c97dae
> >   ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")
> >
> > changes in version 2:
> > - fix indentations
> > - when possible change functions prototype to void
> >
> > drivers/gpu/drm/drm_dp_mst_topology.c | 83 
> > +--
> >  1 file changed, 31 insertions(+), 52 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > index 1437bc46368b..d5cb5688b5dd 100644
> > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > @@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct 
> > drm_dp_sideband_msg_rx *msg,
> > u8 *replybuf, u8 replybuflen, bool hdr)
> >  {
> >   int ret;
> > - u8 crc4;
> >
> >   if (hdr) {
> >   u8 hdrlen;
> > @@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct 
> > drm_dp_sideband_msg_rx *msg,
> >   }
> >
> >   if (msg->curchunk_idx >= msg->curchunk_len) {
> > - /* do CRC */
> > - crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 
> > 1);
>
> Again, someone needs to check if crc4 should be *used* instead of thrown
> away. Blindly throwing stuff out is not the way to go.

Hi Dave,

Your are the original writer of this code, could you tell us if we can drop crc4
ao if there is something else that I have misunderstood ?

Thanks,
Benjamin

>
> BR,
> Jani.
>
> >   /* copy chunk into bigger msg */
> >   memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len 
> > - 1);
> >   msg->curlen += msg->curchunk_len - 1;
> > @@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct 
> > drm_dp_sideband_msg_rx *raw,
> >   }
> >  }
> >
> > -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> > +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> > port_num, u32 offset, u8 num_bytes, u8 *bytes)
> >  {
> >   struct drm_dp_sideband_msg_req_body req;
> >
> > @@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct 
> > drm_dp_sideband_msg_tx *msg, u8 port_num, u32
> >   req.u.dpcd_write.num_bytes = num_bytes;
> >   req.u.dpcd_write.bytes = bytes;
> >   drm_dp_encode_sideband_req(, msg);
> > -
> > - return 0;
> >  }
> >
> > -static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
> > +static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
> >  {
> >   struct drm_dp_sideband_msg_req_body req;
> >
> >   req.req_type = DP_LINK_ADDRESS;
> >   drm_dp_encode_sideband_req(, msg);
> > - return 0;
> >  }
> >
> >  static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, 
> > int port_num)
> > @@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct 
> > drm_dp_sideband_msg_tx *msg, int por
> >   return 0;
> >  }
> >
> > -static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
> > port_num,
> > +static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
> > port_num,
> > u8 vcpi, uint16_t pbn,
> > u8 number_sdp_streams,
> > u8 *sdp_stream_sink)
> > @@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct 
> > drm_dp_sideband_msg_tx *msg, int port_n
> >  number_sdp_streams);
> >   drm_dp_encode_sideband_req(, msg);
> >   msg->path_msg = true;
> > - return 0;
> >  }
> >
> > -static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
> > +static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
> > int port_num, bool power_up)
> >  {
> >   struct drm_dp_sideband_msg_req_body req;
> > @@ -1080,7 

[PATCH] drm/modes: tag unused variables to avoid warnings

2019-12-11 Thread Benjamin Gaignard
Some variables are set but never used. To avoid warning when compiling
with W=1 and keep the algorithm like it is tag theses variables
with _maybe_unused macro.

Signed-off-by: Benjamin Gaignard 
---
changes in this version:
- do not modify the code to remove the unused variables
  just prefix them with __maybe_unused macro.
  
 drivers/gpu/drm/drm_modes.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 88232698d7a0..70aed4e2990d 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
*dev, int hdisplay,
/* 3) Nominal HSync width (% of line period) - default 8 */
 #define CVT_HSYNC_PERCENTAGE   8
unsigned int hblank_percentage;
-   int vsyncandback_porch, vback_porch, hblank;
+   int vsyncandback_porch, __maybe_unused vback_porch, hblank;
 
/* estimated the horizontal period */
tmp1 = HV_FACTOR * 100  -
@@ -386,9 +386,10 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, 
int vdisplay,
int top_margin, bottom_margin;
int interlace;
unsigned int hfreq_est;
-   int vsync_plus_bp, vback_porch;
-   unsigned int vtotal_lines, vfieldrate_est, hperiod;
-   unsigned int vfield_rate, vframe_rate;
+   int vsync_plus_bp, __maybe_unused vback_porch;
+   unsigned int vtotal_lines, __maybe_unused vfieldrate_est;
+   unsigned int __maybe_unused hperiod;
+   unsigned int vfield_rate, __maybe_unused vframe_rate;
int left_margin, right_margin;
unsigned int total_active_pixels, ideal_duty_cycle;
unsigned int hblank, total_pixels, pixel_freq;
-- 
2.15.0

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


Re: [PATCH] drm/modes: remove unused variables

2019-12-06 Thread Benjamin GAIGNARD
+ Zhao Yakui

On 12/5/19 10:55 AM, Jani Nikula wrote:
> On Wed, 04 Dec 2019, Benjamin GAIGNARD  wrote:
>> On 12/4/19 10:35 AM, Thomas Zimmermann wrote:
>>> Hi
>>>
>>> Am 19.11.19 um 14:47 schrieb Benjamin Gaignard:
>>>> When compiling with W=1 few warnings about unused variables show up.
>>>> This patch removes all the involved variables.
>>>>
>>>> Signed-off-by: Benjamin Gaignard 
>>>> ---
>>>>drivers/gpu/drm/drm_modes.c | 22 +++---
>>>>1 file changed, 3 insertions(+), 19 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>>>> index 88232698d7a0..aca901aff042 100644
>>>> --- a/drivers/gpu/drm/drm_modes.c
>>>> +++ b/drivers/gpu/drm/drm_modes.c
>>>> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct 
>>>> drm_device *dev, int hdisplay,
>>>>/* 3) Nominal HSync width (% of line period) - default 
>>>> 8 */
>>>>#define CVT_HSYNC_PERCENTAGE8
>>>>unsigned int hblank_percentage;
>>>> -  int vsyncandback_porch, vback_porch, hblank;
>>>> +  int vsyncandback_porch, hblank;
>>>>
>>>>/* estimated the horizontal period */
>>>>tmp1 = HV_FACTOR * 100  -
>>>> @@ -249,7 +249,6 @@ struct drm_display_mode *drm_cvt_mode(struct 
>>>> drm_device *dev, int hdisplay,
>>>>else
>>>>vsyncandback_porch = tmp1;
>>>>/* 10. Find number of lines in back porch */
>>>> -  vback_porch = vsyncandback_porch - vsync;
>>>>drm_mode->vtotal = vdisplay_rnd + 2 * vmargin +
>>>>vsyncandback_porch + CVT_MIN_V_PORCH;
>>>>/* 5) Definition of Horizontal blanking time limitation 
>>>> */
>>>> @@ -386,9 +385,8 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
>>>> hdisplay, int vdisplay,
>>>>int top_margin, bottom_margin;
>>>>int interlace;
>>>>unsigned int hfreq_est;
>>>> -  int vsync_plus_bp, vback_porch;
>>>> -  unsigned int vtotal_lines, vfieldrate_est, hperiod;
>>>> -  unsigned int vfield_rate, vframe_rate;
>>>> +  int vsync_plus_bp;
>>>> +  unsigned int vtotal_lines;
>>>>int left_margin, right_margin;
>>>>unsigned int total_active_pixels, ideal_duty_cycle;
>>>>unsigned int hblank, total_pixels, pixel_freq;
>>>> @@ -451,23 +449,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
>>>> hdisplay, int vdisplay,
>>>>/* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 100)) */
>>>>vsync_plus_bp = MIN_VSYNC_PLUS_BP * hfreq_est / 1000;
>>>>vsync_plus_bp = (vsync_plus_bp + 500) / 1000;
>>>> -  /*  9. Find the number of lines in V back porch alone: */
>>>> -  vback_porch = vsync_plus_bp - V_SYNC_RQD;
>>>>/*  10. Find the total number of lines in Vertical field 
>>>> period: */
>>>>vtotal_lines = vdisplay_rnd + top_margin + bottom_margin +
>>>>vsync_plus_bp + GTF_MIN_V_PORCH;
>>>> -  /*  11. Estimate the Vertical field frequency: */
>>>> -  vfieldrate_est = hfreq_est / vtotal_lines;
>>>> -  /*  12. Find the actual horizontal period: */
>>>> -  hperiod = 100 / (vfieldrate_rqd * vtotal_lines);
>>>> -
>>>> -  /*  13. Find the actual Vertical field frequency: */
>>>> -  vfield_rate = hfreq_est / vtotal_lines;
>>>> -  /*  14. Find the Vertical frame frequency: */
>>>> -  if (interlaced)
>>>> -  vframe_rate = vfield_rate / 2;
>>>> -  else
>>>> -  vframe_rate = vfield_rate;
>>> The amount of unused code is quite large, which makes me wonder if
>>> there's something missing below where these variables are supposed to be
>>> used.
>>>
>>> If these variables can be removed, comments should mention that steps 9
>>> and 11 to 14 are being left out. After all, the function is fairly
>>> explicit about implementing the GTF algorithm step by step.
>>>
>>> Best regards
>>> Thomas
>> If the goal is to k

Re: [PATCH v2 27/28] drm/sti: Use drm_bridge_init()

2019-12-05 Thread Benjamin Gaignard
Le mer. 4 déc. 2019 à 12:48, Mihail Atanassov
 a écrit :
>
> No functional change.
>
> v2:
>  - Also apply drm_bridge_init() in sti_hdmi.c and sti_hda.c (Sam,
>Benjamin)
>
> Signed-off-by: Mihail Atanassov 

Reviewed-by: Benjamin Gaignard 

> ---
>  drivers/gpu/drm/sti/sti_dvo.c  | 4 +---
>  drivers/gpu/drm/sti/sti_hda.c  | 3 +--
>  drivers/gpu/drm/sti/sti_hdmi.c | 3 +--
>  3 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
> index 68289b0b063a..20a3956b33bc 100644
> --- a/drivers/gpu/drm/sti/sti_dvo.c
> +++ b/drivers/gpu/drm/sti/sti_dvo.c
> @@ -462,9 +462,7 @@ static int sti_dvo_bind(struct device *dev, struct device 
> *master, void *data)
> if (!bridge)
> return -ENOMEM;
>
> -   bridge->driver_private = dvo;
> -   bridge->funcs = _dvo_bridge_funcs;
> -   bridge->of_node = dvo->dev.of_node;
> +   drm_bridge_init(bridge, >dev, _dvo_bridge_funcs, NULL, dvo);
> drm_bridge_add(bridge);
>
> err = drm_bridge_attach(encoder, bridge, NULL);
> diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
> index 8f7bf33815fd..c7296e354a34 100644
> --- a/drivers/gpu/drm/sti/sti_hda.c
> +++ b/drivers/gpu/drm/sti/sti_hda.c
> @@ -699,8 +699,7 @@ static int sti_hda_bind(struct device *dev, struct device 
> *master, void *data)
> if (!bridge)
> return -ENOMEM;
>
> -   bridge->driver_private = hda;
> -   bridge->funcs = _hda_bridge_funcs;
> +   drm_bridge_init(bridge, dev, _hda_bridge_funcs, NULL, hda);
> drm_bridge_attach(encoder, bridge, NULL);
>
> connector->encoder = encoder;
> diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
> index 814560ead4e1..c9ae3e18fa5d 100644
> --- a/drivers/gpu/drm/sti/sti_hdmi.c
> +++ b/drivers/gpu/drm/sti/sti_hdmi.c
> @@ -1279,8 +1279,7 @@ static int sti_hdmi_bind(struct device *dev, struct 
> device *master, void *data)
> if (!bridge)
> return -EINVAL;
>
> -   bridge->driver_private = hdmi;
> -   bridge->funcs = _hdmi_bridge_funcs;
> +   drm_bridge_init(bridge, dev, _hdmi_bridge_funcs, NULL, hdmi);
> drm_bridge_attach(encoder, bridge, NULL);
>
> connector->encoder = encoder;
> --
> 2.23.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/modes: remove unused variables

2019-12-04 Thread Benjamin GAIGNARD

On 12/4/19 10:35 AM, Thomas Zimmermann wrote:
> Hi
>
> Am 19.11.19 um 14:47 schrieb Benjamin Gaignard:
>> When compiling with W=1 few warnings about unused variables show up.
>> This patch removes all the involved variables.
>>
>> Signed-off-by: Benjamin Gaignard 
>> ---
>>   drivers/gpu/drm/drm_modes.c | 22 +++---
>>   1 file changed, 3 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
>> index 88232698d7a0..aca901aff042 100644
>> --- a/drivers/gpu/drm/drm_modes.c
>> +++ b/drivers/gpu/drm/drm_modes.c
>> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
>> *dev, int hdisplay,
>>  /* 3) Nominal HSync width (% of line period) - default 8 */
>>   #define CVT_HSYNC_PERCENTAGE   8
>>  unsigned int hblank_percentage;
>> -int vsyncandback_porch, vback_porch, hblank;
>> +int vsyncandback_porch, hblank;
>>   
>>  /* estimated the horizontal period */
>>  tmp1 = HV_FACTOR * 100  -
>> @@ -249,7 +249,6 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
>> *dev, int hdisplay,
>>  else
>>  vsyncandback_porch = tmp1;
>>  /* 10. Find number of lines in back porch */
>> -vback_porch = vsyncandback_porch - vsync;
>>  drm_mode->vtotal = vdisplay_rnd + 2 * vmargin +
>>  vsyncandback_porch + CVT_MIN_V_PORCH;
>>  /* 5) Definition of Horizontal blanking time limitation */
>> @@ -386,9 +385,8 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
>> hdisplay, int vdisplay,
>>  int top_margin, bottom_margin;
>>  int interlace;
>>  unsigned int hfreq_est;
>> -int vsync_plus_bp, vback_porch;
>> -unsigned int vtotal_lines, vfieldrate_est, hperiod;
>> -unsigned int vfield_rate, vframe_rate;
>> +int vsync_plus_bp;
>> +unsigned int vtotal_lines;
>>  int left_margin, right_margin;
>>  unsigned int total_active_pixels, ideal_duty_cycle;
>>  unsigned int hblank, total_pixels, pixel_freq;
>> @@ -451,23 +449,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
>> hdisplay, int vdisplay,
>>  /* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 100)) */
>>  vsync_plus_bp = MIN_VSYNC_PLUS_BP * hfreq_est / 1000;
>>  vsync_plus_bp = (vsync_plus_bp + 500) / 1000;
>> -/*  9. Find the number of lines in V back porch alone: */
>> -vback_porch = vsync_plus_bp - V_SYNC_RQD;
>>  /*  10. Find the total number of lines in Vertical field period: */
>>  vtotal_lines = vdisplay_rnd + top_margin + bottom_margin +
>>  vsync_plus_bp + GTF_MIN_V_PORCH;
>> -/*  11. Estimate the Vertical field frequency: */
>> -vfieldrate_est = hfreq_est / vtotal_lines;
>> -/*  12. Find the actual horizontal period: */
>> -hperiod = 100 / (vfieldrate_rqd * vtotal_lines);
>> -
>> -/*  13. Find the actual Vertical field frequency: */
>> -vfield_rate = hfreq_est / vtotal_lines;
>> -/*  14. Find the Vertical frame frequency: */
>> -if (interlaced)
>> -vframe_rate = vfield_rate / 2;
>> -else
>> -vframe_rate = vfield_rate;
> The amount of unused code is quite large, which makes me wonder if
> there's something missing below where these variables are supposed to be
> used.
>
> If these variables can be removed, comments should mention that steps 9
> and 11 to 14 are being left out. After all, the function is fairly
> explicit about implementing the GTF algorithm step by step.
>
> Best regards
> Thomas

If the goal is to keep all the steps then I could prefix all problematic 
variables with __maybe_unused macro.

Benjamin

>
>>  /*  15. Find number of pixels in left margin: */
>>  if (margins)
>>  left_margin = (hdisplay_rnd * GTF_MARGIN_PERCENTAGE + 500) /
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v3] drm/dp_mst: Fix W=1 warnings

2019-12-03 Thread Benjamin Gaignard
Le sam. 30 nov. 2019 à 14:24, Benjamin Gaignard
 a écrit :
>
> Fix the warnings that show up with W=1.
> They are all about unused but set variables.
> If functions returns are not used anymore make them void.
>
> Signed-off-by: Benjamin Gaignard 
> ---
> CC: Jani Nikula 
>
> changes in version 3:
> - remove the hunk that may conflict with c485e2c97dae
>   ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

I have test today this patch on drm-misc-next where the other patch is
present, it apply fine and I don't have warning anymore.

Benjamin
>
> changes in version 2:
> - fix indentations
> - when possible change functions prototype to void
>
> drivers/gpu/drm/drm_dp_mst_topology.c | 83 +--
>  1 file changed, 31 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 1437bc46368b..d5cb5688b5dd 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct 
> drm_dp_sideband_msg_rx *msg,
>   u8 *replybuf, u8 replybuflen, bool hdr)
>  {
> int ret;
> -   u8 crc4;
>
> if (hdr) {
> u8 hdrlen;
> @@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct 
> drm_dp_sideband_msg_rx *msg,
> }
>
> if (msg->curchunk_idx >= msg->curchunk_len) {
> -   /* do CRC */
> -   crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 
> 1);
> /* copy chunk into bigger msg */
> memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len 
> - 1);
> msg->curlen += msg->curchunk_len - 1;
> @@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct 
> drm_dp_sideband_msg_rx *raw,
> }
>  }
>
> -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
> u32 offset, u8 num_bytes, u8 *bytes)
> +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
> port_num, u32 offset, u8 num_bytes, u8 *bytes)
>  {
> struct drm_dp_sideband_msg_req_body req;
>
> @@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct 
> drm_dp_sideband_msg_tx *msg, u8 port_num, u32
> req.u.dpcd_write.num_bytes = num_bytes;
> req.u.dpcd_write.bytes = bytes;
> drm_dp_encode_sideband_req(, msg);
> -
> -   return 0;
>  }
>
> -static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
> +static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
>  {
> struct drm_dp_sideband_msg_req_body req;
>
> req.req_type = DP_LINK_ADDRESS;
> drm_dp_encode_sideband_req(, msg);
> -   return 0;
>  }
>
>  static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int 
> port_num)
> @@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct 
> drm_dp_sideband_msg_tx *msg, int por
> return 0;
>  }
>
> -static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
> port_num,
> +static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
> port_num,
>   u8 vcpi, uint16_t pbn,
>   u8 number_sdp_streams,
>   u8 *sdp_stream_sink)
> @@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct 
> drm_dp_sideband_msg_tx *msg, int port_n
>number_sdp_streams);
> drm_dp_encode_sideband_req(, msg);
> msg->path_msg = true;
> -   return 0;
>  }
>
> -static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
> +static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
>   int port_num, bool power_up)
>  {
> struct drm_dp_sideband_msg_req_body req;
> @@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct 
> drm_dp_sideband_msg_tx *msg,
> req.u.port_num.port_number = port_num;
> drm_dp_encode_sideband_req(, msg);
> msg->path_msg = true;
> -   return 0;
>  }
>
>  static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
> @@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port 
> *port,
>   */
>  static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
>  {
> -   int ret;
> u8 rad[6], lct;
> bool send_link = false;
> switch (port->pdt) {
> case DP_PEER_DEVICE_DP_LEGACY_CONV:
> case DP_PEER_DEVI

Re: [PATCH] drm/modes: remove unused variables

2019-12-03 Thread Benjamin Gaignard
Le mer. 20 nov. 2019 à 00:29, Benjamin Gaignard
 a écrit :
>
> When compiling with W=1 few warnings about unused variables show up.
> This patch removes all the involved variables.
>

Gentle ping to reviewers.
Thanks,
Benjamin

> Signed-off-by: Benjamin Gaignard 
> ---
>  drivers/gpu/drm/drm_modes.c | 22 +++---
>  1 file changed, 3 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index 88232698d7a0..aca901aff042 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
> *dev, int hdisplay,
> /* 3) Nominal HSync width (% of line period) - default 8 */
>  #define CVT_HSYNC_PERCENTAGE   8
> unsigned int hblank_percentage;
> -   int vsyncandback_porch, vback_porch, hblank;
> +   int vsyncandback_porch, hblank;
>
> /* estimated the horizontal period */
> tmp1 = HV_FACTOR * 100  -
> @@ -249,7 +249,6 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
> *dev, int hdisplay,
> else
> vsyncandback_porch = tmp1;
> /* 10. Find number of lines in back porch */
> -   vback_porch = vsyncandback_porch - vsync;
> drm_mode->vtotal = vdisplay_rnd + 2 * vmargin +
> vsyncandback_porch + CVT_MIN_V_PORCH;
> /* 5) Definition of Horizontal blanking time limitation */
> @@ -386,9 +385,8 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
> hdisplay, int vdisplay,
> int top_margin, bottom_margin;
> int interlace;
> unsigned int hfreq_est;
> -   int vsync_plus_bp, vback_porch;
> -   unsigned int vtotal_lines, vfieldrate_est, hperiod;
> -   unsigned int vfield_rate, vframe_rate;
> +   int vsync_plus_bp;
> +   unsigned int vtotal_lines;
> int left_margin, right_margin;
> unsigned int total_active_pixels, ideal_duty_cycle;
> unsigned int hblank, total_pixels, pixel_freq;
> @@ -451,23 +449,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int 
> hdisplay, int vdisplay,
> /* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 100)) */
> vsync_plus_bp = MIN_VSYNC_PLUS_BP * hfreq_est / 1000;
> vsync_plus_bp = (vsync_plus_bp + 500) / 1000;
> -   /*  9. Find the number of lines in V back porch alone: */
> -   vback_porch = vsync_plus_bp - V_SYNC_RQD;
> /*  10. Find the total number of lines in Vertical field period: */
> vtotal_lines = vdisplay_rnd + top_margin + bottom_margin +
> vsync_plus_bp + GTF_MIN_V_PORCH;
> -   /*  11. Estimate the Vertical field frequency: */
> -   vfieldrate_est = hfreq_est / vtotal_lines;
> -   /*  12. Find the actual horizontal period: */
> -   hperiod = 100 / (vfieldrate_rqd * vtotal_lines);
> -
> -   /*  13. Find the actual Vertical field frequency: */
> -   vfield_rate = hfreq_est / vtotal_lines;
> -   /*  14. Find the Vertical frame frequency: */
> -   if (interlaced)
> -   vframe_rate = vfield_rate / 2;
> -   else
> -   vframe_rate = vfield_rate;
> /*  15. Find number of pixels in left margin: */
> if (margins)
> left_margin = (hdisplay_rnd * GTF_MARGIN_PERCENTAGE + 500) /
> --
> 2.15.0
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/fb-cma-helpers: Fix include issue

2019-12-03 Thread Benjamin Gaignard
Le mer. 20 nov. 2019 à 00:28, Benjamin Gaignard
 a écrit :
>
> Exported functions prototypes are missing in drm_fb_cma_helper.c
> Include drm_fb_cma_helper to fix that issue.
>

Gentle ping to reviewers.
Thanks,
Benjamin

> Signed-off-by: Benjamin Gaignard 
> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 1 +
>  include/drm/drm_fb_cma_helper.h | 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
> b/drivers/gpu/drm/drm_fb_cma_helper.c
> index c0b0f603af63..9801c0333eca 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -9,6 +9,7 @@
>   *  Copyright (C) 2012 Red Hat
>   */
>
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index 4becb09975a4..795aea1d0a25 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -2,6 +2,8 @@
>  #ifndef __DRM_FB_CMA_HELPER_H__
>  #define __DRM_FB_CMA_HELPER_H__
>
> +#include 
> +
>  struct drm_framebuffer;
>  struct drm_plane_state;
>
> --
> 2.15.0
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/crtc-helper: drm_connector_get_single_encoder prototype is missing

2019-12-03 Thread Benjamin Gaignard
Le mer. 20 nov. 2019 à 00:28, Benjamin GAIGNARD
 a écrit :
>
>
> On 11/19/19 7:53 PM, Souza, Jose wrote:
> > On Tue, 2019-11-19 at 13:58 +0100, Benjamin Gaignard wrote:
> >> Include drm_crtc_helper_internal.h to provide
> >> drm_connector_get_single_encoder
> >> prototype.
> >>
> >> Fixes: a92462d6bf493 ("drm/connector: Share with non-atomic drivers
> >> the function to get the single encoder")
> > drm_connector_get_single_encoder() is implemented before the use in
> > this file so it is not broken, no need of a fixes tag.
> >
> > Reviewed-by: José Roberto de Souza 
>
> I will remove fixe tag before push it.
>
> Thanks,
>
> Benjamin

Applied on drm-misc-next with out Fixes tag.
Thanks for the review.

Benjamin

>
> >
> >> Cc: José Roberto de Souza 
> >>
> >> Signed-off-by: Benjamin Gaignard 
> >> ---
> >>   drivers/gpu/drm/drm_crtc_helper.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
> >> b/drivers/gpu/drm/drm_crtc_helper.c
> >> index 499b05aaccfc..93a4eec429e8 100644
> >> --- a/drivers/gpu/drm/drm_crtc_helper.c
> >> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> >> @@ -48,6 +48,8 @@
> >>   #include 
> >>   #include 
> >>
> >> +#include "drm_crtc_helper_internal.h"
> >> +
> >>   /**
> >>* DOC: overview
> >>*
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH v3] drm/dp_mst: Fix W=1 warnings

2019-11-30 Thread Benjamin Gaignard
Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

Signed-off-by: Benjamin Gaignard 
---
CC: Jani Nikula 

changes in version 3:
- remove the hunk that may conflict with c485e2c97dae 
  ("drm/dp_mst: Refactor pdt setup/teardown, add more locking")

changes in version 2:
- fix indentations
- when possible change functions prototype to void

drivers/gpu/drm/drm_dp_mst_topology.c | 83 +--
 1 file changed, 31 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 1437bc46368b..d5cb5688b5dd 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -674,7 +674,6 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
  u8 *replybuf, u8 replybuflen, bool hdr)
 {
int ret;
-   u8 crc4;
 
if (hdr) {
u8 hdrlen;
@@ -716,8 +715,6 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
}
 
if (msg->curchunk_idx >= msg->curchunk_len) {
-   /* do CRC */
-   crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
/* copy chunk into bigger msg */
memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len - 
1);
msg->curlen += msg->curchunk_len - 1;
@@ -1014,7 +1011,7 @@ static bool drm_dp_sideband_parse_req(struct 
drm_dp_sideband_msg_rx *raw,
}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1024,17 +1021,14 @@ static int build_dpcd_write(struct 
drm_dp_sideband_msg_tx *msg, u8 port_num, u32
req.u.dpcd_write.num_bytes = num_bytes;
req.u.dpcd_write.bytes = bytes;
drm_dp_encode_sideband_req(, msg);
-
-   return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
struct drm_dp_sideband_msg_req_body req;
 
req.req_type = DP_LINK_ADDRESS;
drm_dp_encode_sideband_req(, msg);
-   return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int 
port_num)
@@ -1048,7 +1042,7 @@ static int build_enum_path_resources(struct 
drm_dp_sideband_msg_tx *msg, int por
return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
  u8 vcpi, uint16_t pbn,
  u8 number_sdp_streams,
  u8 *sdp_stream_sink)
@@ -1064,10 +1058,9 @@ static int build_allocate_payload(struct 
drm_dp_sideband_msg_tx *msg, int port_n
   number_sdp_streams);
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
  int port_num, bool power_up)
 {
struct drm_dp_sideband_msg_req_body req;
@@ -1080,7 +1073,6 @@ static int build_power_updown_phy(struct 
drm_dp_sideband_msg_tx *msg,
req.u.port_num.port_number = port_num;
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1746,14 +1738,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port 
*port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-   int ret;
u8 rad[6], lct;
bool send_link = false;
switch (port->pdt) {
case DP_PEER_DEVICE_DP_LEGACY_CONV:
case DP_PEER_DEVICE_SST_SINK:
/* add i2c over sideband */
-   ret = drm_dp_mst_register_i2c_bus(>aux);
+   drm_dp_mst_register_i2c_bus(>aux);
break;
case DP_PEER_DEVICE_MST_BRANCHING:
lct = drm_dp_calculate_rad(port, rad);
@@ -1823,25 +1814,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-   int ret;
-
memcpy(mstb->guid, guid, 16);
 
if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
if (mstb->port_parent) {
-   ret = drm_dp_send_dpcd_write(
-   mstb->mgr,
-

[PATCH v2] drm/dp_mst: Fix W=1 warnings

2019-11-30 Thread Benjamin Gaignard
Fix the warnings that show up with W=1.
They are all about unused but set variables.
If functions returns are not used anymore make them void.

Signed-off-by: Benjamin Gaignard 
CC: Jani Nikula 
---
changes in version 2:
- fix indentations
- when possible change functions prototype to void

Note: this patch may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt
setup/teardown, add more locking") when it will hit drm-misc-next

 drivers/gpu/drm/drm_dp_mst_topology.c | 83 +--
 1 file changed, 31 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index b854a422a523..ff2d81db0778 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -672,7 +672,6 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
  u8 *replybuf, u8 replybuflen, bool hdr)
 {
int ret;
-   u8 crc4;
 
if (hdr) {
u8 hdrlen;
@@ -714,8 +713,6 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
}
 
if (msg->curchunk_idx >= msg->curchunk_len) {
-   /* do CRC */
-   crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
/* copy chunk into bigger msg */
memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len - 
1);
msg->curlen += msg->curchunk_len - 1;
@@ -1012,7 +1009,7 @@ static bool drm_dp_sideband_parse_req(struct 
drm_dp_sideband_msg_rx *raw,
}
 }
 
-static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
+static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 port_num, 
u32 offset, u8 num_bytes, u8 *bytes)
 {
struct drm_dp_sideband_msg_req_body req;
 
@@ -1022,17 +1019,14 @@ static int build_dpcd_write(struct 
drm_dp_sideband_msg_tx *msg, u8 port_num, u32
req.u.dpcd_write.num_bytes = num_bytes;
req.u.dpcd_write.bytes = bytes;
drm_dp_encode_sideband_req(, msg);
-
-   return 0;
 }
 
-static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
+static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
 {
struct drm_dp_sideband_msg_req_body req;
 
req.req_type = DP_LINK_ADDRESS;
drm_dp_encode_sideband_req(, msg);
-   return 0;
 }
 
 static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int 
port_num)
@@ -1046,7 +1040,7 @@ static int build_enum_path_resources(struct 
drm_dp_sideband_msg_tx *msg, int por
return 0;
 }
 
-static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
+static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
port_num,
  u8 vcpi, uint16_t pbn,
  u8 number_sdp_streams,
  u8 *sdp_stream_sink)
@@ -1062,10 +1056,9 @@ static int build_allocate_payload(struct 
drm_dp_sideband_msg_tx *msg, int port_n
   number_sdp_streams);
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
-static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
+static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
  int port_num, bool power_up)
 {
struct drm_dp_sideband_msg_req_body req;
@@ -1078,7 +1071,6 @@ static int build_power_updown_phy(struct 
drm_dp_sideband_msg_tx *msg,
req.u.port_num.port_number = port_num;
drm_dp_encode_sideband_req(, msg);
msg->path_msg = true;
-   return 0;
 }
 
 static int drm_dp_mst_assign_payload_id(struct drm_dp_mst_topology_mgr *mgr,
@@ -1744,14 +1736,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port 
*port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-   int ret;
u8 rad[6], lct;
bool send_link = false;
switch (port->pdt) {
case DP_PEER_DEVICE_DP_LEGACY_CONV:
case DP_PEER_DEVICE_SST_SINK:
/* add i2c over sideband */
-   ret = drm_dp_mst_register_i2c_bus(>aux);
+   drm_dp_mst_register_i2c_bus(>aux);
break;
case DP_PEER_DEVICE_MST_BRANCHING:
lct = drm_dp_calculate_rad(port, rad);
@@ -1821,25 +1812,20 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-   int ret;
-
memcpy(mstb->guid, guid, 16);
 
if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
if (mstb->port_parent) {
-   ret = drm_dp_send_dpcd_write(
-   mstb->mgr,
-

Re: [PATCH v2] drm/dp_mst: Fix W=1 warnings

2019-11-30 Thread Benjamin GAIGNARD

On 11/28/19 12:21 PM, Jani Nikula wrote:
> On Thu, 28 Nov 2019, Benjamin Gaignard  wrote:
>> Fix the warnings that show up with W=1.
>> They are all about unused but set variables.
>> If functions returns are not used anymore make them void.
>>
>> Signed-off-by: Benjamin Gaignard 
>> CC: Jani Nikula 
>> ---
>> changes in version 2:
>> - fix indentations
>> - when possible change functions prototype to void
>>
>> Note: this patch may conflict with c485e2c97dae ("drm/dp_mst: Refactor pdt
>> setup/teardown, add more locking") when it will hit drm-misc-next
> Well, why create an unnecessary conflict when the referenced commit also
> fixes the same warnings as a side-effect?

Because this commit is not merged (yet ?) in drm-misc-next which where I 
start.

Benjamin

> BR,
> Jani.
>
>
>>   drivers/gpu/drm/drm_dp_mst_topology.c | 83 
>> +--
>>   1 file changed, 31 insertions(+), 52 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
>> b/drivers/gpu/drm/drm_dp_mst_topology.c
>> index b854a422a523..ff2d81db0778 100644
>> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
>> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
>> @@ -672,7 +672,6 @@ static bool drm_dp_sideband_msg_build(struct 
>> drm_dp_sideband_msg_rx *msg,
>>u8 *replybuf, u8 replybuflen, bool hdr)
>>   {
>>  int ret;
>> -u8 crc4;
>>   
>>  if (hdr) {
>>  u8 hdrlen;
>> @@ -714,8 +713,6 @@ static bool drm_dp_sideband_msg_build(struct 
>> drm_dp_sideband_msg_rx *msg,
>>  }
>>   
>>  if (msg->curchunk_idx >= msg->curchunk_len) {
>> -/* do CRC */
>> -crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
>>  /* copy chunk into bigger msg */
>>  memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len - 
>> 1);
>>  msg->curlen += msg->curchunk_len - 1;
>> @@ -1012,7 +1009,7 @@ static bool drm_dp_sideband_parse_req(struct 
>> drm_dp_sideband_msg_rx *raw,
>>  }
>>   }
>>   
>> -static int build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
>> port_num, u32 offset, u8 num_bytes, u8 *bytes)
>> +static void build_dpcd_write(struct drm_dp_sideband_msg_tx *msg, u8 
>> port_num, u32 offset, u8 num_bytes, u8 *bytes)
>>   {
>>  struct drm_dp_sideband_msg_req_body req;
>>   
>> @@ -1022,17 +1019,14 @@ static int build_dpcd_write(struct 
>> drm_dp_sideband_msg_tx *msg, u8 port_num, u32
>>  req.u.dpcd_write.num_bytes = num_bytes;
>>  req.u.dpcd_write.bytes = bytes;
>>  drm_dp_encode_sideband_req(, msg);
>> -
>> -return 0;
>>   }
>>   
>> -static int build_link_address(struct drm_dp_sideband_msg_tx *msg)
>> +static void build_link_address(struct drm_dp_sideband_msg_tx *msg)
>>   {
>>  struct drm_dp_sideband_msg_req_body req;
>>   
>>  req.req_type = DP_LINK_ADDRESS;
>>  drm_dp_encode_sideband_req(, msg);
>> -return 0;
>>   }
>>   
>>   static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, 
>> int port_num)
>> @@ -1046,7 +1040,7 @@ static int build_enum_path_resources(struct 
>> drm_dp_sideband_msg_tx *msg, int por
>>  return 0;
>>   }
>>   
>> -static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
>> port_num,
>> +static void build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int 
>> port_num,
>>u8 vcpi, uint16_t pbn,
>>u8 number_sdp_streams,
>>u8 *sdp_stream_sink)
>> @@ -1062,10 +1056,9 @@ static int build_allocate_payload(struct 
>> drm_dp_sideband_msg_tx *msg, int port_n
>> number_sdp_streams);
>>  drm_dp_encode_sideband_req(, msg);
>>  msg->path_msg = true;
>> -return 0;
>>   }
>>   
>> -static int build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
>> +static void build_power_updown_phy(struct drm_dp_sideband_msg_tx *msg,
>>int port_num, bool power_up)
>>   {
>>  struct drm_dp_sideband_msg_req_body req;
>> @@ -1078,7 +1071,6 @@ static int build_power_updown_phy(struct 
>> drm_dp_sideband_msg_tx *msg,
>>  req.u.port_num.port_number = port_num;
>>  drm_dp_encode_sideband_req(, msg);
>>  msg->path_msg = true;
>> -r

Re: [PATCH v2 0/4] drm/rect: Bugfixes and selftests

2019-11-28 Thread Benjamin GAIGNARD

On 11/22/19 6:56 PM, Ville Syrjala wrote:
> From: Ville Syrjälä 
>
> My earlier fixes for drm_rect + div-by-zero fix + some
> selftests that Daniel requested.
>
> Cc: Maarten Lankhorst 
> Cc: Benjamin Gaignard 
> Cc: Daniel Vetter 

Thanks to have handle this.

Reviewed-by: Benjamin Gaignard 
>
> Ville Syrjälä (4):
>drm/rect: Avoid division by zero
>drm/rect: Keep the scaled clip bounded
>drm/rect: Keep the clipped dst rectangle in place
>drm/selftests: Add drm_rect selftests
>
>   drivers/gpu/drm/drm_rect.c|  36 +--
>   drivers/gpu/drm/selftests/Makefile|   3 +-
>   .../gpu/drm/selftests/drm_modeset_selftests.h |   4 +
>   .../drm/selftests/test-drm_modeset_common.h   |   7 +
>   drivers/gpu/drm/selftests/test-drm_rect.c | 220 ++
>   include/drm/drm_rect.h|   2 +
>   6 files changed, 257 insertions(+), 15 deletions(-)
>   create mode 100644 drivers/gpu/drm/selftests/test-drm_rect.c
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH 28/30] drm/sti: sti_vdo: Use drm_bridge_init()

2019-11-27 Thread Benjamin Gaignard
Le mer. 27 nov. 2019 à 17:19, Sam Ravnborg  a écrit :
>
> Hi Mihail.
>
> > >
> > > I can see from grepping that bridge.driver_private is used
> > > in a couple of other files in sti/
> > >
> > > Like sti_hdmi.c:
> > > bridge->driver_private = hdmi;
> > > bridge->funcs = _hdmi_bridge_funcs;
> > > drm_bridge_attach(encoder, bridge, NULL);
> > >
> > >
> > > I wonder if a drm_bridge_init() should be added there.
> > > I did not look closely - but it looked suspisiously.
> >
> > My goal with drm_bridge_init() was to get devlinks sorted out for
> > cross-module uses of a drm_bridge (via of_drm_find_bridge()), so I only
> > considered locations where drm_bridge_add/remove() were used.
> >
> > Would you be okay with a promise to push a cleanup of this one and the
> > one in sti_hda.c after patch 1/30 lands in some form? I'd rather not
> > make this series much longer, it's already pushing it at 30 :).
>
> Absolutely - my drive-by comment was more out of concern if this
> was missing. A clean-up later souns good.

Or you can just do the changes for sti_hdmi and sti_hda in this patch too.

Benjamin

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

Re: [PATCH] drm/dp_mst: Fix W=1 warnings

2019-11-27 Thread Benjamin Gaignard
Le mer. 13 nov. 2019 à 08:55, Benjamin Gaignard
 a écrit :
>
> Fix the warnings that show up with W=1.
> They are all about unused but set variables.

gentle ping to reviewers,

Thanks,
Benjamin
>
> Signed-off-by: Benjamin Gaignard 
> ---
>  drivers/gpu/drm/drm_dp_mst_topology.c | 50 
> +--
>  1 file changed, 19 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index b854a422a523..6ff554be8000 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -672,7 +672,6 @@ static bool drm_dp_sideband_msg_build(struct 
> drm_dp_sideband_msg_rx *msg,
>   u8 *replybuf, u8 replybuflen, bool hdr)
>  {
> int ret;
> -   u8 crc4;
>
> if (hdr) {
> u8 hdrlen;
> @@ -714,8 +713,6 @@ static bool drm_dp_sideband_msg_build(struct 
> drm_dp_sideband_msg_rx *msg,
> }
>
> if (msg->curchunk_idx >= msg->curchunk_len) {
> -   /* do CRC */
> -   crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 
> 1);
> /* copy chunk into bigger msg */
> memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len 
> - 1);
> msg->curlen += msg->curchunk_len - 1;
> @@ -1744,14 +1741,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port 
> *port,
>   */
>  static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
>  {
> -   int ret;
> u8 rad[6], lct;
> bool send_link = false;
> switch (port->pdt) {
> case DP_PEER_DEVICE_DP_LEGACY_CONV:
> case DP_PEER_DEVICE_SST_SINK:
> /* add i2c over sideband */
> -   ret = drm_dp_mst_register_i2c_bus(>aux);
> +   drm_dp_mst_register_i2c_bus(>aux);
> break;
> case DP_PEER_DEVICE_MST_BRANCHING:
> lct = drm_dp_calculate_rad(port, rad);
> @@ -1821,21 +1817,18 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
>
>  static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
>  {
> -   int ret;
> -
> memcpy(mstb->guid, guid, 16);
>
> if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
> if (mstb->port_parent) {
> -   ret = drm_dp_send_dpcd_write(
> +   drm_dp_send_dpcd_write(
> mstb->mgr,
> mstb->port_parent,
> DP_GUID,
> 16,
> mstb->guid);
> } else {
> -
> -   ret = drm_dp_dpcd_write(
> +   drm_dp_dpcd_write(
> mstb->mgr->aux,
> DP_GUID,
> mstb->guid,
> @@ -2427,14 +2420,14 @@ static void drm_dp_send_link_address(struct 
> drm_dp_mst_topology_mgr *mgr,
>  {
> struct drm_dp_sideband_msg_tx *txmsg;
> struct drm_dp_link_address_ack_reply *reply;
> -   int i, len, ret;
> +   int i, ret;
>
> txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
> if (!txmsg)
> return;
>
> txmsg->dst = mstb;
> -   len = build_link_address(txmsg);
> +   build_link_address(txmsg);
>
> mstb->link_address_sent = true;
> drm_dp_queue_down_tx(mgr, txmsg);
> @@ -2476,7 +2469,6 @@ drm_dp_send_enum_path_resources(struct 
> drm_dp_mst_topology_mgr *mgr,
>  {
> struct drm_dp_enum_path_resources_ack_reply *path_res;
> struct drm_dp_sideband_msg_tx *txmsg;
> -   int len;
> int ret;
>
> txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
> @@ -2484,7 +2476,7 @@ drm_dp_send_enum_path_resources(struct 
> drm_dp_mst_topology_mgr *mgr,
> return -ENOMEM;
>
> txmsg->dst = mstb;
> -   len = build_enum_path_resources(txmsg, port->port_num);
> +   build_enum_path_resources(txmsg, port->port_num);
>
> drm_dp_queue_down_tx(mgr, txmsg);
>
> @@ -2567,7 +2559,7 @@ static int drm_dp_payload_send_msg(struct 
> drm_dp_mst_topology_mgr *mgr,
>  {
> struct drm_dp_sideband_msg_tx *txmsg;
> struct drm_dp_mst_branch *mstb;
> -   int len, ret, port_num;
> +   int ret, port_num;
> u8 sinks[DRM_DP_MAX_SDP_STREAMS];
> int i;
>

Re: [Intel-gfx] [PATCH 2/2] drm/rect: Keep the clipped dst rectangle in place

2019-11-21 Thread Benjamin GAIGNARD

On 11/20/19 6:11 PM, Ville Syrjälä wrote:
> On Wed, Nov 20, 2019 at 05:43:40PM +0100, Daniel Vetter wrote:
>> On Wed, Nov 20, 2019 at 06:25:12PM +0200, Ville Syrjala wrote:
>>> From: Ville Syrjälä 
>>>
>>> Now that we've constrained the clipped source rectangle such
>>> that it can't have negative dimensions doing the same for the
>>> dst rectangle seems appropriate. Should at least result in
>>> the clipped src and dst rectangles being a bit more consistent
>>> with each other.
>>>
>>> Cc: Benjamin Gaignard 
>>> Cc: Maarten Lankhorst 
>>> Signed-off-by: Ville Syrjälä 
>> selftests for this stuff? Looks like the prime example, write testcase
>> proving code is busted, fix it, everyone celebrate?
> Yeah, seems like a good idea. Though I'll have to figure out if it's
> actually broken or not ;)
>
> Hmm. Ouch. There's seems to be a div by zero lurking in there if
> dst_w/h == 0. I wonder why nothing has hit that.

At least W=1 warnings have disappear with these patches ;-)

Benjamin

>> -Daniel
>>
>>> ---
>>>   drivers/gpu/drm/drm_rect.c | 22 +++---
>>>   1 file changed, 11 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
>>> index 7762b6e9278d..229325fcf333 100644
>>> --- a/drivers/gpu/drm/drm_rect.c
>>> +++ b/drivers/gpu/drm/drm_rect.c
>>> @@ -52,14 +52,14 @@ bool drm_rect_intersect(struct drm_rect *r1, const 
>>> struct drm_rect *r2)
>>>   }
>>>   EXPORT_SYMBOL(drm_rect_intersect);
>>>   
>>> -static u32 clip_scaled(u32 src, u32 dst, u32 clip)
>>> +static u32 clip_scaled(int src, int dst, int *clip)
>>>   {
>>> u64 tmp;
>>>   
>>> /* Only clip what we have. Keeps the result bounded as well. */
>>> -   clip = min(clip, dst);
>>> +   *clip = min(*clip, dst);
>>>   
>>> -   tmp = mul_u32_u32(src, dst - clip);
>>> +   tmp = mul_u32_u32(src, dst - *clip);
>>>   
>>> /*
>>>  * Round toward 1.0 when clipping so that we don't accidentally
>>> @@ -92,34 +92,34 @@ bool drm_rect_clip_scaled(struct drm_rect *src, struct 
>>> drm_rect *dst,
>>> diff = clip->x1 - dst->x1;
>>> if (diff > 0) {
>>> u32 new_src_w = clip_scaled(drm_rect_width(src),
>>> -   drm_rect_width(dst), diff);
>>> +   drm_rect_width(dst), );
>>>   
>>> src->x1 = src->x2 - new_src_w;
>>> -   dst->x1 = clip->x1;
>>> +   dst->x1 += diff;
>>> }
>>> diff = clip->y1 - dst->y1;
>>> if (diff > 0) {
>>> u32 new_src_h = clip_scaled(drm_rect_height(src),
>>> -   drm_rect_height(dst), diff);
>>> +   drm_rect_height(dst), );
>>>   
>>> src->y1 = src->y2 - new_src_h;
>>> -   dst->y1 = clip->y1;
>>> +   dst->y1 += diff;
>>> }
>>> diff = dst->x2 - clip->x2;
>>> if (diff > 0) {
>>> u32 new_src_w = clip_scaled(drm_rect_width(src),
>>> -   drm_rect_width(dst), diff);
>>> +   drm_rect_width(dst), );
>>>   
>>> src->x2 = src->x1 + new_src_w;
>>> -   dst->x2 = clip->x2;
>>> +   dst->x2 -= diff;
>>> }
>>> diff = dst->y2 - clip->y2;
>>> if (diff > 0) {
>>> u32 new_src_h = clip_scaled(drm_rect_height(src),
>>> -   drm_rect_height(dst), diff);
>>> +   drm_rect_height(dst), );
>>>   
>>> src->y2 = src->y1 + new_src_h;
>>> -   dst->y2 = clip->y2;
>>> +   dst->y2 -= diff;
>>> }
>>>   
>>> return drm_rect_visible(dst);
>>> -- 
>>> 2.23.0
>>>
>>> ___
>>> Intel-gfx mailing list
>>> intel-...@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>> -- 
>> Daniel Vetter
>> Software Engineer, Intel Corporation
>> http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/modes: remove unused variables

2019-11-19 Thread Benjamin Gaignard
When compiling with W=1 few warnings about unused variables show up.
This patch removes all the involved variables.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_modes.c | 22 +++---
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 88232698d7a0..aca901aff042 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -233,7 +233,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
*dev, int hdisplay,
/* 3) Nominal HSync width (% of line period) - default 8 */
 #define CVT_HSYNC_PERCENTAGE   8
unsigned int hblank_percentage;
-   int vsyncandback_porch, vback_porch, hblank;
+   int vsyncandback_porch, hblank;
 
/* estimated the horizontal period */
tmp1 = HV_FACTOR * 100  -
@@ -249,7 +249,6 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device 
*dev, int hdisplay,
else
vsyncandback_porch = tmp1;
/* 10. Find number of lines in back porch */
-   vback_porch = vsyncandback_porch - vsync;
drm_mode->vtotal = vdisplay_rnd + 2 * vmargin +
vsyncandback_porch + CVT_MIN_V_PORCH;
/* 5) Definition of Horizontal blanking time limitation */
@@ -386,9 +385,8 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, 
int vdisplay,
int top_margin, bottom_margin;
int interlace;
unsigned int hfreq_est;
-   int vsync_plus_bp, vback_porch;
-   unsigned int vtotal_lines, vfieldrate_est, hperiod;
-   unsigned int vfield_rate, vframe_rate;
+   int vsync_plus_bp;
+   unsigned int vtotal_lines;
int left_margin, right_margin;
unsigned int total_active_pixels, ideal_duty_cycle;
unsigned int hblank, total_pixels, pixel_freq;
@@ -451,23 +449,9 @@ drm_gtf_mode_complex(struct drm_device *dev, int hdisplay, 
int vdisplay,
/* [V SYNC+BP] = RINT(([MIN VSYNC+BP] * hfreq_est / 100)) */
vsync_plus_bp = MIN_VSYNC_PLUS_BP * hfreq_est / 1000;
vsync_plus_bp = (vsync_plus_bp + 500) / 1000;
-   /*  9. Find the number of lines in V back porch alone: */
-   vback_porch = vsync_plus_bp - V_SYNC_RQD;
/*  10. Find the total number of lines in Vertical field period: */
vtotal_lines = vdisplay_rnd + top_margin + bottom_margin +
vsync_plus_bp + GTF_MIN_V_PORCH;
-   /*  11. Estimate the Vertical field frequency: */
-   vfieldrate_est = hfreq_est / vtotal_lines;
-   /*  12. Find the actual horizontal period: */
-   hperiod = 100 / (vfieldrate_rqd * vtotal_lines);
-
-   /*  13. Find the actual Vertical field frequency: */
-   vfield_rate = hfreq_est / vtotal_lines;
-   /*  14. Find the Vertical frame frequency: */
-   if (interlaced)
-   vframe_rate = vfield_rate / 2;
-   else
-   vframe_rate = vfield_rate;
/*  15. Find number of pixels in left margin: */
if (margins)
left_margin = (hdisplay_rnd * GTF_MARGIN_PERCENTAGE + 500) /
-- 
2.15.0

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

Re: [PATCH] drm/crtc-helper: drm_connector_get_single_encoder prototype is missing

2019-11-19 Thread Benjamin GAIGNARD

On 11/19/19 7:53 PM, Souza, Jose wrote:
> On Tue, 2019-11-19 at 13:58 +0100, Benjamin Gaignard wrote:
>> Include drm_crtc_helper_internal.h to provide
>> drm_connector_get_single_encoder
>> prototype.
>>
>> Fixes: a92462d6bf493 ("drm/connector: Share with non-atomic drivers
>> the function to get the single encoder")
> drm_connector_get_single_encoder() is implemented before the use in
> this file so it is not broken, no need of a fixes tag.
>
> Reviewed-by: José Roberto de Souza 

I will remove fixe tag before push it.

Thanks,

Benjamin

>
>> Cc: José Roberto de Souza 
>>
>> Signed-off-by: Benjamin Gaignard 
>> ---
>>   drivers/gpu/drm/drm_crtc_helper.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_crtc_helper.c
>> b/drivers/gpu/drm/drm_crtc_helper.c
>> index 499b05aaccfc..93a4eec429e8 100644
>> --- a/drivers/gpu/drm/drm_crtc_helper.c
>> +++ b/drivers/gpu/drm/drm_crtc_helper.c
>> @@ -48,6 +48,8 @@
>>   #include 
>>   #include 
>>   
>> +#include "drm_crtc_helper_internal.h"
>> +
>>   /**
>>* DOC: overview
>>*
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/rect: remove useless call to clamp_t

2019-11-19 Thread Benjamin Gaignard
Clamping a value between INT_MIN and INT_MAX always return the value itself
and generate warnings when compiling with W=1.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_rect.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index b8363aaa9032..681f1fd09357 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -89,7 +89,7 @@ bool drm_rect_clip_scaled(struct drm_rect *src, struct 
drm_rect *dst,
u32 new_src_w = clip_scaled(drm_rect_width(src),
drm_rect_width(dst), diff);
 
-   src->x1 = clamp_t(int64_t, src->x2 - new_src_w, INT_MIN, 
INT_MAX);
+   src->x1 = src->x2 - new_src_w;
dst->x1 = clip->x1;
}
diff = clip->y1 - dst->y1;
@@ -97,7 +97,7 @@ bool drm_rect_clip_scaled(struct drm_rect *src, struct 
drm_rect *dst,
u32 new_src_h = clip_scaled(drm_rect_height(src),
drm_rect_height(dst), diff);
 
-   src->y1 = clamp_t(int64_t, src->y2 - new_src_h, INT_MIN, 
INT_MAX);
+   src->y1 = src->y2 - new_src_h;
dst->y1 = clip->y1;
}
diff = dst->x2 - clip->x2;
@@ -105,7 +105,7 @@ bool drm_rect_clip_scaled(struct drm_rect *src, struct 
drm_rect *dst,
u32 new_src_w = clip_scaled(drm_rect_width(src),
drm_rect_width(dst), diff);
 
-   src->x2 = clamp_t(int64_t, src->x1 + new_src_w, INT_MIN, 
INT_MAX);
+   src->x2 = src->x1 + new_src_w;
dst->x2 = clip->x2;
}
diff = dst->y2 - clip->y2;
@@ -113,7 +113,7 @@ bool drm_rect_clip_scaled(struct drm_rect *src, struct 
drm_rect *dst,
u32 new_src_h = clip_scaled(drm_rect_height(src),
drm_rect_height(dst), diff);
 
-   src->y2 = clamp_t(int64_t, src->y1 + new_src_h, INT_MIN, 
INT_MAX);
+   src->y2 = src->y1 + new_src_h;
dst->y2 = clip->y2;
}
 
-- 
2.15.0

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

[PATCH] drm/crtc-helper: drm_connector_get_single_encoder prototype is missing

2019-11-19 Thread Benjamin Gaignard
Include drm_crtc_helper_internal.h to provide drm_connector_get_single_encoder
prototype.

Fixes: a92462d6bf493 ("drm/connector: Share with non-atomic drivers the 
function to get the single encoder")

Cc: José Roberto de Souza 

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_crtc_helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index 499b05aaccfc..93a4eec429e8 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -48,6 +48,8 @@
 #include 
 #include 
 
+#include "drm_crtc_helper_internal.h"
+
 /**
  * DOC: overview
  *
-- 
2.15.0

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

[PATCH] drm/fb-cma-helpers: Fix include issue

2019-11-19 Thread Benjamin Gaignard
Exported functions prototypes are missing in drm_fb_cma_helper.c
Include drm_fb_cma_helper to fix that issue.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 1 +
 include/drm/drm_fb_cma_helper.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
b/drivers/gpu/drm/drm_fb_cma_helper.c
index c0b0f603af63..9801c0333eca 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -9,6 +9,7 @@
  *  Copyright (C) 2012 Red Hat
  */
 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 4becb09975a4..795aea1d0a25 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -2,6 +2,8 @@
 #ifndef __DRM_FB_CMA_HELPER_H__
 #define __DRM_FB_CMA_HELPER_H__
 
+#include 
+
 struct drm_framebuffer;
 struct drm_plane_state;
 
-- 
2.15.0

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

[PATCH] drm/dp_mst: Fix W=1 warnings

2019-11-12 Thread Benjamin Gaignard
Fix the warnings that show up with W=1.
They are all about unused but set variables.

Signed-off-by: Benjamin Gaignard 
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 50 +--
 1 file changed, 19 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index b854a422a523..6ff554be8000 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -672,7 +672,6 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
  u8 *replybuf, u8 replybuflen, bool hdr)
 {
int ret;
-   u8 crc4;
 
if (hdr) {
u8 hdrlen;
@@ -714,8 +713,6 @@ static bool drm_dp_sideband_msg_build(struct 
drm_dp_sideband_msg_rx *msg,
}
 
if (msg->curchunk_idx >= msg->curchunk_len) {
-   /* do CRC */
-   crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
/* copy chunk into bigger msg */
memcpy(>msg[msg->curlen], msg->chunk, msg->curchunk_len - 
1);
msg->curlen += msg->curchunk_len - 1;
@@ -1744,14 +1741,13 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port 
*port,
  */
 static bool drm_dp_port_setup_pdt(struct drm_dp_mst_port *port)
 {
-   int ret;
u8 rad[6], lct;
bool send_link = false;
switch (port->pdt) {
case DP_PEER_DEVICE_DP_LEGACY_CONV:
case DP_PEER_DEVICE_SST_SINK:
/* add i2c over sideband */
-   ret = drm_dp_mst_register_i2c_bus(>aux);
+   drm_dp_mst_register_i2c_bus(>aux);
break;
case DP_PEER_DEVICE_MST_BRANCHING:
lct = drm_dp_calculate_rad(port, rad);
@@ -1821,21 +1817,18 @@ ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
 
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 {
-   int ret;
-
memcpy(mstb->guid, guid, 16);
 
if (!drm_dp_validate_guid(mstb->mgr, mstb->guid)) {
if (mstb->port_parent) {
-   ret = drm_dp_send_dpcd_write(
+   drm_dp_send_dpcd_write(
mstb->mgr,
mstb->port_parent,
DP_GUID,
16,
mstb->guid);
} else {
-
-   ret = drm_dp_dpcd_write(
+   drm_dp_dpcd_write(
mstb->mgr->aux,
DP_GUID,
mstb->guid,
@@ -2427,14 +2420,14 @@ static void drm_dp_send_link_address(struct 
drm_dp_mst_topology_mgr *mgr,
 {
struct drm_dp_sideband_msg_tx *txmsg;
struct drm_dp_link_address_ack_reply *reply;
-   int i, len, ret;
+   int i, ret;
 
txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
if (!txmsg)
return;
 
txmsg->dst = mstb;
-   len = build_link_address(txmsg);
+   build_link_address(txmsg);
 
mstb->link_address_sent = true;
drm_dp_queue_down_tx(mgr, txmsg);
@@ -2476,7 +2469,6 @@ drm_dp_send_enum_path_resources(struct 
drm_dp_mst_topology_mgr *mgr,
 {
struct drm_dp_enum_path_resources_ack_reply *path_res;
struct drm_dp_sideband_msg_tx *txmsg;
-   int len;
int ret;
 
txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
@@ -2484,7 +2476,7 @@ drm_dp_send_enum_path_resources(struct 
drm_dp_mst_topology_mgr *mgr,
return -ENOMEM;
 
txmsg->dst = mstb;
-   len = build_enum_path_resources(txmsg, port->port_num);
+   build_enum_path_resources(txmsg, port->port_num);
 
drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2567,7 +2559,7 @@ static int drm_dp_payload_send_msg(struct 
drm_dp_mst_topology_mgr *mgr,
 {
struct drm_dp_sideband_msg_tx *txmsg;
struct drm_dp_mst_branch *mstb;
-   int len, ret, port_num;
+   int ret, port_num;
u8 sinks[DRM_DP_MAX_SDP_STREAMS];
int i;
 
@@ -2592,9 +2584,9 @@ static int drm_dp_payload_send_msg(struct 
drm_dp_mst_topology_mgr *mgr,
sinks[i] = i;
 
txmsg->dst = mstb;
-   len = build_allocate_payload(txmsg, port_num,
-id,
-pbn, port->num_sdp_streams, sinks);
+   build_allocate_payload(txmsg, port_num,
+  id,
+  pbn, port->num_sdp_streams, sinks);
 
drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2623,7 +2615,7 @@ int drm_dp_send_power_updown_phy(struct 
drm_dp_mst_topology_mgr *mgr,
 struct drm_dp_mst_port *port, bool power_up)
 {
   

Re: [PATCH v2] drm: atomic helper: fix W=1 warnings

2019-11-07 Thread Benjamin Gaignard
Le mar. 22 oct. 2019 à 10:37, Daniel Vetter  a écrit :
>
> On Tue, Oct 08, 2019 at 02:42:54PM +0200, Benjamin Gaignard wrote:
> > Few for_each macro set variables that are never used later which led
> > to generate unused-but-set-variable warnings.
> > Add (void)(foo) inside the macros to remove these warnings
> >
> > Signed-off-by: Benjamin Gaignard 
>
> OCD in me would lean towards annotating all of them, unconditionally, and
> be done. But I guess this works too. Either way:
>
> Reviewed-by: Daniel Vetter 

Thanks,

Applied to drm-misc-next
Benjamin

> > ---
> >  include/drm/drm_atomic.h | 17 ++---
> >  1 file changed, 14 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> > index 927e1205d7aa..b6c73fd9f55a 100644
> > --- a/include/drm/drm_atomic.h
> > +++ b/include/drm/drm_atomic.h
> > @@ -693,6 +693,7 @@ void drm_state_dump(struct drm_device *dev, struct 
> > drm_printer *p);
> >(__i)++) 
> >   \
> >   for_each_if ((__state)->connectors[__i].ptr &&
> >   \
> >((connector) = (__state)->connectors[__i].ptr,   
> >   \
> > +  (void)(connector) /* Only to avoid 
> > unused-but-set-variable warning */, \
> >(old_connector_state) = 
> > (__state)->connectors[__i].old_state,  \
> >(new_connector_state) = 
> > (__state)->connectors[__i].new_state, 1))
> >
> > @@ -714,6 +715,7 @@ void drm_state_dump(struct drm_device *dev, struct 
> > drm_printer *p);
> >(__i)++) 
> >   \
> >   for_each_if ((__state)->connectors[__i].ptr &&
> >   \
> >((connector) = (__state)->connectors[__i].ptr,   
> >   \
> > +  (void)(connector) /* Only to avoid 
> > unused-but-set-variable warning */, \
> >(old_connector_state) = 
> > (__state)->connectors[__i].old_state, 1))
> >
> >  /**
> > @@ -734,7 +736,9 @@ void drm_state_dump(struct drm_device *dev, struct 
> > drm_printer *p);
> >(__i)++) 
> >   \
> >   for_each_if ((__state)->connectors[__i].ptr &&
> >   \
> >((connector) = (__state)->connectors[__i].ptr,   
> >   \
> > -  (new_connector_state) = 
> > (__state)->connectors[__i].new_state, 1))
> > +  (void)(connector) /* Only to avoid 
> > unused-but-set-variable warning */, \
> > +  (new_connector_state) = 
> > (__state)->connectors[__i].new_state, \
> > +  (void)(new_connector_state) /* Only to avoid 
> > unused-but-set-variable warning */, 1))
> >
> >  /**
> >   * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic 
> > update
> > @@ -754,7 +758,9 @@ void drm_state_dump(struct drm_device *dev, struct 
> > drm_printer *p);
> >(__i)++)   \
> >   for_each_if ((__state)->crtcs[__i].ptr &&   \
> >((crtc) = (__state)->crtcs[__i].ptr,   \
> > +   (void)(crtc) /* Only to avoid 
> > unused-but-set-variable warning */, \
> >(old_crtc_state) = 
> > (__state)->crtcs[__i].old_state, \
> > +  (void)(old_crtc_state) /* Only to avoid 
> > unused-but-set-variable warning */, \
> >(new_crtc_state) = 
> > (__state)->crtcs[__i].new_state, 1))
> >
> >  /**
> > @@ -793,7 +799,9 @@ void drm_state_dump(struct drm_device *dev, struct 
> > drm_printer *p);
> >(__i)++)   \
> >   for_each_if ((__state)->crtcs[__i].ptr &&   \
> >((crtc) = (__state)->crtcs[__i].ptr,   \
> > -  (new_crtc_state) = 
> > (__state)->crtcs[__i].new_state, 1))
> > +  (void)(crtc) /* Only to avoid 
> > unused-but-set-variable warning */, \
> > +  (new_crtc_state) = 
> >

Re: [PATCH v2] drm: atomic helper: fix W=1 warnings

2019-10-21 Thread Benjamin Gaignard
Le mer. 9 oct. 2019 à 09:13, Benjamin Gaignard
 a écrit :
>
> Few for_each macro set variables that are never used later which led
> to generate unused-but-set-variable warnings.
> Add (void)(foo) inside the macros to remove these warnings
>

Gentle ping,
Thanks,
Benjamin

> Signed-off-by: Benjamin Gaignard 
> ---
>  include/drm/drm_atomic.h | 17 ++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index 927e1205d7aa..b6c73fd9f55a 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -693,6 +693,7 @@ void drm_state_dump(struct drm_device *dev, struct 
> drm_printer *p);
>  (__i)++) 
>   \
> for_each_if ((__state)->connectors[__i].ptr &&
>   \
>  ((connector) = (__state)->connectors[__i].ptr,   
>   \
> +(void)(connector) /* Only to avoid 
> unused-but-set-variable warning */, \
>  (old_connector_state) = 
> (__state)->connectors[__i].old_state,  \
>  (new_connector_state) = 
> (__state)->connectors[__i].new_state, 1))
>
> @@ -714,6 +715,7 @@ void drm_state_dump(struct drm_device *dev, struct 
> drm_printer *p);
>  (__i)++) 
>   \
> for_each_if ((__state)->connectors[__i].ptr &&
>   \
>  ((connector) = (__state)->connectors[__i].ptr,   
>   \
> +(void)(connector) /* Only to avoid 
> unused-but-set-variable warning */, \
>  (old_connector_state) = 
> (__state)->connectors[__i].old_state, 1))
>
>  /**
> @@ -734,7 +736,9 @@ void drm_state_dump(struct drm_device *dev, struct 
> drm_printer *p);
>  (__i)++) 
>   \
> for_each_if ((__state)->connectors[__i].ptr &&
>   \
>  ((connector) = (__state)->connectors[__i].ptr,   
>   \
> -(new_connector_state) = 
> (__state)->connectors[__i].new_state, 1))
> +(void)(connector) /* Only to avoid 
> unused-but-set-variable warning */, \
> +(new_connector_state) = 
> (__state)->connectors[__i].new_state, \
> +(void)(new_connector_state) /* Only to avoid 
> unused-but-set-variable warning */, 1))
>
>  /**
>   * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update
> @@ -754,7 +758,9 @@ void drm_state_dump(struct drm_device *dev, struct 
> drm_printer *p);
>  (__i)++)   \
> for_each_if ((__state)->crtcs[__i].ptr &&   \
>  ((crtc) = (__state)->crtcs[__i].ptr,   \
> + (void)(crtc) /* Only to avoid 
> unused-but-set-variable warning */, \
>  (old_crtc_state) = 
> (__state)->crtcs[__i].old_state, \
> +(void)(old_crtc_state) /* Only to avoid 
> unused-but-set-variable warning */, \
>  (new_crtc_state) = 
> (__state)->crtcs[__i].new_state, 1))
>
>  /**
> @@ -793,7 +799,9 @@ void drm_state_dump(struct drm_device *dev, struct 
> drm_printer *p);
>  (__i)++)   \
> for_each_if ((__state)->crtcs[__i].ptr &&   \
>  ((crtc) = (__state)->crtcs[__i].ptr,   \
> -(new_crtc_state) = 
> (__state)->crtcs[__i].new_state, 1))
> +(void)(crtc) /* Only to avoid 
> unused-but-set-variable warning */, \
> +(new_crtc_state) = 
> (__state)->crtcs[__i].new_state, \
> +(void)(new_crtc_state) /* Only to avoid 
> unused-but-set-variable warning */, 1))
>
>  /**
>   * for_each_oldnew_plane_in_state - iterate over all planes in an atomic 
> update
> @@ -813,6 +821,7 @@ void drm_state_dump(struct drm_device *dev, struct 
> drm_printer *p);
>  (__i)++)   \
> for_each_if ((__state)->planes[__i].ptr &&  \
>  ((plane) = (__state)->planes[__i].ptr,

Re: [PATCH v12 4/5] dma-buf: heaps: Add CMA heap to dmabuf heaps

2019-10-18 Thread Benjamin Gaignard
Le ven. 18 oct. 2019 à 13:21, Brian Starkey  a écrit :
>
> On Fri, Oct 18, 2019 at 05:23:22AM +, John Stultz wrote:
> > This adds a CMA heap, which allows userspace to allocate
> > a dma-buf of contiguous memory out of a CMA region.
> >
> > This code is an evolution of the Android ION implementation, so
> > thanks to its original author and maintainters:
> >   Benjamin Gaignard, Laura Abbott, and others!
> >
> > NOTE: This patch only adds the default CMA heap. We will enable
> > selectively adding other CMA memory regions to the dmabuf heaps
> > interface with a later patch (which requires a dt binding)

Maybe we can use "no-map" DT property to trigger that. If set do not expose the
cma heap.

Benjamin
>
> That'll teach me for reading my email in FIFO order.
>
> This approach makes sense to me.
>
> -Brian
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  1   2   3   4   5   6   7   8   >