Re: [PATCH v3 08/56] drm/omap: dsi: unexport specific data transfer functions

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:45PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> After converting all DSI drivers, unexport the specific transfer
> functions.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 12 
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 
>  2 files changed, 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 59a62d1d41cb..2270730b16db 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4949,18 +4949,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>   .release_vc = dsi_release_vc,
>  
>   .transfer = omap_dsi_transfer,
> -
> - .dcs_write = dsi_vc_dcs_write,
> - .dcs_write_nosync = dsi_vc_dcs_write_nosync,
> - .dcs_read = dsi_vc_dcs_read,
> -
> - .gen_write = dsi_vc_generic_write,
> - .gen_write_nosync = dsi_vc_generic_write_nosync,
> - .gen_read = dsi_vc_generic_read,
> -
> - .bta_sync = dsi_vc_send_bta_sync,
> -
> - .set_max_rx_packet_size = dsi_vc_set_max_rx_packet_size,
>   },
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 654618e5a4e5..9ead877cb24c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -310,26 +310,6 @@ struct omapdss_dsi_ops {
>   /* data transfer */
>   ssize_t (*transfer)(struct omap_dss_device *dssdev,
>   const struct mipi_dsi_msg *msg);
> -
> - int (*dcs_write)(struct omap_dss_device *dssdev, int channel,
> - const u8 *data, int len);
> - int (*dcs_write_nosync)(struct omap_dss_device *dssdev, int channel,
> - const u8 *data, int len);
> - int (*dcs_read)(struct omap_dss_device *dssdev, int channel, u8 dcs_cmd,
> - u8 *data, int len);
> -
> - int (*gen_write)(struct omap_dss_device *dssdev, int channel,
> - const u8 *data, int len);
> - int (*gen_write_nosync)(struct omap_dss_device *dssdev, int channel,
> - const u8 *data, int len);
> - int (*gen_read)(struct omap_dss_device *dssdev, int channel,
> - const u8 *reqdata, int reqlen,
> - u8 *data, int len);
> -
> - int (*bta_sync)(struct omap_dss_device *dssdev, int channel);
> -
> - int (*set_max_rx_packet_size)(struct omap_dss_device *dssdev,
> - int channel, u16 plen);
>  };
>  
>  struct omap_dss_device_ops {

-- 
Regards,

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


Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:46PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This drops the virtual channel logic. Afterwards DSI clients
> request their channel number and get the virtual channel with
> the same number or -EBUSY if already in use.

It could be useful to explain the reason for this patch (which, if I
understand the patch correctly, is to replace dynamic allocation of
virtual channels with a fixed allocation by the DSI panel, I assume
because dynamic allocation isn't actually useful ?).

> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 46 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 +-
>  3 files changed, 12 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 8b2e80129bd8..ea76a89d1833 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
>   struct device *dev = &ddata->pdev->dev;
>   int r;
>  
> - r = src->ops->dsi.request_vc(src, &ddata->channel);
> + r = src->ops->dsi.request_vc(src, ddata->channel);
>   if (r) {
>   dev_err(dev, "failed to get virtual channel\n");
>   return r;
>   }
>  
> - r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
> - if (r) {
> - dev_err(dev, "failed to set VC_ID\n");
> - src->ops->dsi.release_vc(src, ddata->channel);
> - return r;
> - }
> -
>   ddata->src = src;
>   return 0;
>  }
> @@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
>   struct display_timing timing;
>   int err;
>  
> + ddata->channel = TCH;

I'd drop the macro, but no big deal.

Reviewed-by: Laurent Pinchart 

> +
>   ddata->reset_gpio = devm_gpiod_get(&pdev->dev, "reset", GPIOD_OUT_LOW);
>   if (IS_ERR(ddata->reset_gpio)) {
>   err = PTR_ERR(ddata->reset_gpio);
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 2270730b16db..348be32505a2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -350,7 +350,6 @@ struct dsi_data {
>   struct omap_dss_device *dssdev;
>   enum fifo_size tx_fifo_size;
>   enum fifo_size rx_fifo_size;
> - int vc_id;
>   } vc[4];
>  
>   struct mutex lock;
> @@ -2579,7 +2578,7 @@ static inline void dsi_vc_write_long_header(struct 
> dsi_data *dsi, int channel,
>  
>   WARN_ON(!dsi_bus_is_locked(dsi));
>  
> - data_id = data_type | dsi->vc[channel].vc_id << 6;
> + data_id = data_type | channel << 6;
>  
>   val = FLD_VAL(data_id, 7, 0) | FLD_VAL(len, 23, 8) |
>   FLD_VAL(ecc, 31, 24);
> @@ -2683,7 +2682,7 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int 
> channel, u8 data_type,
>   return -EINVAL;
>   }
>  
> - data_id = data_type | dsi->vc[channel].vc_id << 6;
> + data_id = data_type | channel << 6;
>  
>   r = (data_id << 0) | (data << 8) | (ecc << 24);
>  
> @@ -4789,45 +4788,19 @@ static enum omap_channel dsi_get_channel(struct 
> dsi_data *dsi)
>   }
>  }
>  
> -static int dsi_request_vc(struct omap_dss_device *dssdev, int *channel)
> +static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> - int i;
> -
> - for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) {
> - if (!dsi->vc[i].dssdev) {
> - dsi->vc[i].dssdev = dssdev;
> - *channel = i;
> - return 0;
> - }
> - }
>  
> - DSSERR("cannot get VC for display %s", dssdev->name);
> - return -ENOSPC;
> -}
> -
> -static int dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int 
> vc_id)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> - if (vc_id < 0 || vc_id > 3) {
> - DSSERR("VC ID out of range\n");
> - return -EINVAL;
> - }
> -
> - if (channel < 0 || channel > 3) {
> - DSSERR("Virtual Channel out of range\n");
> + if (channel < 0 || channel > 3)
>   return -EINVAL;
> - }
>  
> - if (dsi->vc[channel].dssdev != dssdev) {
> - DSSERR("Virtual Channel not allocated to display %s\n",
> - dssdev->name);
> - return -EINVAL;
> + if (dsi->vc[channel].dssdev) {
> + DSSERR("cannot get VC for display %s", dssdev->name);
> + return -EBUSY;
>   }
>  
> - dsi->vc[channel].vc_id = vc_id;
> -
> + dsi->vc[channel].dssdev = dssdev;
>   return

Re: [PATCH v3 10/56] drm/omap: dsi: simplify write function

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:47PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Simplify the write related messages handling by using the functionality
> provided by CONFIG_DRM_MIPI_DSI.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig |   1 +
>  drivers/gpu/drm/omapdrm/dss/dsi.c   | 146 +++-
>  2 files changed, 34 insertions(+), 113 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig 
> b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index 2658c521b702..fd7dfa28ce97 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -95,6 +95,7 @@ config OMAP2_DSS_SDI
>  config OMAP2_DSS_DSI
>   bool "DSI support"
>   default n
> + select DRM_MIPI_DSI
>   help
> MIPI DSI (Display Serial Interface) support.
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 348be32505a2..e1595c0608f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2696,97 +2696,50 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int 
> channel)
>   return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
>  }
>  
> -static int dsi_vc_write_nosync_common(struct dsi_data *dsi, int channel,
> -   const u8 *data, int len,
> -   enum dss_dsi_content_type type)
> -{
> - int r;
> -
> - if (len == 0) {
> - BUG_ON(type == DSS_DSI_CONTENT_DCS);
> - r = dsi_vc_send_short(dsi, channel,
> - MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM, 0, 0);
> - } else if (len == 1) {
> - r = dsi_vc_send_short(dsi, channel,
> - type == DSS_DSI_CONTENT_GENERIC ?
> - MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM :
> - MIPI_DSI_DCS_SHORT_WRITE, data[0], 0);
> - } else if (len == 2) {
> - r = dsi_vc_send_short(dsi, channel,
> - type == DSS_DSI_CONTENT_GENERIC ?
> - MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM :
> - MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> - data[0] | (data[1] << 8), 0);
> - } else {
> - r = dsi_vc_send_long(dsi, channel,
> - type == DSS_DSI_CONTENT_GENERIC ?
> - MIPI_DSI_GENERIC_LONG_WRITE :
> - MIPI_DSI_DCS_LONG_WRITE, data, len, 0);
> - }
> -
> - return r;
> -}
> -
> -static int dsi_vc_dcs_write_nosync(struct omap_dss_device *dssdev, int 
> channel,
> - const u8 *data, int len)
> +static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> +const struct mipi_dsi_msg *msg)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> + struct mipi_dsi_packet packet;
> + int r;
>  
> - return dsi_vc_write_nosync_common(dsi, channel, data, len,
> - DSS_DSI_CONTENT_DCS);
> -}
> + r = mipi_dsi_create_packet(&packet, msg);
> + if (r < 0)
> + return r;
>  
> -static int dsi_vc_generic_write_nosync(struct omap_dss_device *dssdev, int 
> channel,
> - const u8 *data, int len)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> + if (mipi_dsi_packet_format_is_short(msg->type)) {
> + u16 data = packet.header[1] | (packet.header[2] << 8);

packet is only used here, should the variable and
mipi_dsi_create_packet() call be moved to this branch of the if ? Feel
free to ignore if a patch further down the series makes use of packet in
different locations.

Reviewed-by: Laurent Pinchart 

>  
> - return dsi_vc_write_nosync_common(dsi, channel, data, len,
> - DSS_DSI_CONTENT_GENERIC);
> -}
> + r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> + } else {
> + r = dsi_vc_send_long(dsi, msg->channel, msg->type,
> +  msg->tx_buf, msg->tx_len, 0);
> + }
>  
> -static int dsi_vc_write_common(struct omap_dss_device *dssdev,
> -int channel, const u8 *data, int len,
> -enum dss_dsi_content_type type)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> - int r;
> + if (r < 0)
> + return r;
>  
> - r = dsi_vc_write_nosync_common(dsi, channel, data, len, type);
> - if (r)
> - goto err;
> + /*
> +  * TODO: we do not always have to do the BTA sync, for example
> +  * we can improve performance by setting the update window
> +  * information without sending BTA sync between the commands.
> +  * In that case we can return early.
> +  */
>  
> - r = dsi_vc_send_bta_sync(dssdev, c

Re: [PATCH v3 11/56] drm/omap: dsi: simplify read functions

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:48PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Simplify the read related message handling by using the functionality
> provided by CONFIG_DRM_MIPI_DSI.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 110 +-
>  1 file changed, 34 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index e1595c0608f2..bbdc52ee3559 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2742,60 +2742,6 @@ static int dsi_vc_write_common(struct omap_dss_device 
> *dssdev,
>   return 0;
>  }
>  
> -static int dsi_vc_dcs_send_read_request(struct dsi_data *dsi, int channel,
> - u8 dcs_cmd)
> -{
> - int r;
> -
> - if (dsi->debug_read)
> - DSSDBG("dsi_vc_dcs_send_read_request(ch%d, dcs_cmd %x)\n",
> - channel, dcs_cmd);
> -
> - r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
> - if (r) {
> - DSSERR("dsi_vc_dcs_send_read_request(ch %d, cmd 0x%02x)"
> - " failed\n", channel, dcs_cmd);
> - return r;
> - }
> -
> - return 0;
> -}
> -
> -static int dsi_vc_generic_send_read_request(struct dsi_data *dsi, int 
> channel,
> - const u8 *reqdata, int reqlen)
> -{
> - u16 data;
> - u8 data_type;
> - int r;
> -
> - if (dsi->debug_read)
> - DSSDBG("dsi_vc_generic_send_read_request(ch %d, reqlen %d)\n",
> - channel, reqlen);
> -
> - if (reqlen == 0) {
> - data_type = MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM;
> - data = 0;
> - } else if (reqlen == 1) {
> - data_type = MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM;
> - data = reqdata[0];
> - } else if (reqlen == 2) {
> - data_type = MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM;
> - data = reqdata[0] | (reqdata[1] << 8);
> - } else {
> - BUG();
> - return -EINVAL;
> - }
> -
> - r = dsi_vc_send_short(dsi, channel, data_type, data, 0);
> - if (r) {
> - DSSERR("dsi_vc_generic_send_read_request(ch %d, reqlen %d)"
> - " failed\n", channel, reqlen);
> - return r;
> - }
> -
> - return 0;
> -}
> -
>  static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, int channel, u8 *buf,
>  int buflen, enum dss_dsi_content_type type)
>  {
> @@ -2904,13 +2850,18 @@ static int dsi_vc_read_rx_fifo(struct dsi_data *dsi, 
> int channel, u8 *buf,
>   return r;
>  }
>  
> -static int dsi_vc_dcs_read(struct omap_dss_device *dssdev, int channel, u8 
> dcs_cmd,
> - u8 *buf, int buflen)
> +static int dsi_vc_dcs_read(struct omap_dss_device *dssdev,
> +const struct mipi_dsi_msg *msg)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> + u8 dcs_cmd = ((u8 *)msg->tx_buf)[0];
> + u8 channel = msg->channel;
>   int r;
>  
> - r = dsi_vc_dcs_send_read_request(dsi, channel, dcs_cmd);
> + if (dsi->debug_read)
> + DSSDBG("%s(ch %d, cmd %x)\n", __func__, channel, dcs_cmd);
> +
> + r = dsi_vc_send_short(dsi, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0);
>   if (r)
>   goto err;
>  
> @@ -2918,47 +2869,58 @@ static int dsi_vc_dcs_read(struct omap_dss_device 
> *dssdev, int channel, u8 dcs_c
>   if (r)
>   goto err;
>  
> - r = dsi_vc_read_rx_fifo(dsi, channel, buf, buflen,
> + r = dsi_vc_read_rx_fifo(dsi, channel, msg->rx_buf, msg->rx_len,
>   DSS_DSI_CONTENT_DCS);
>   if (r < 0)
>   goto err;
>  
> - if (r != buflen) {
> + if (r != msg->rx_len) {
>   r = -EIO;
>   goto err;
>   }
>  
>   return 0;
>  err:
> - DSSERR("dsi_vc_dcs_read(ch %d, cmd 0x%02x) failed\n", channel, dcs_cmd);
> + DSSERR("%s(ch %d, cmd 0x%02x) failed\n", __func__, msg->channel, 
> dcs_cmd);
>   return r;
>  }
>  
> -static int dsi_vc_generic_read(struct omap_dss_device *dssdev, int channel,
> - const u8 *reqdata, int reqlen, u8 *buf, int buflen)
> +static int dsi_vc_generic_read(struct omap_dss_device *dssdev,
> +const struct mipi_dsi_msg *msg)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> + struct mipi_dsi_packet packet;
> + u16 data;
>   int r;
>  
> - r = dsi_vc_generic_send_read_request(dsi, channel, reqdata, reqlen);
> + r = mipi_dsi_create_packet(&packet, msg);
> + if (r < 0)
> + goto err;
> +
> + data = packet.header[1] | (packet.header[2] << 8);
> +
> + r = dsi_vc_send_short(dsi, msg->channel, msg->type, data, 0);
> 

Re: [PATCH v3 12/56] drm/omap: dsi: switch dsi_vc_send_long/short to mipi_dsi_msg

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:49PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Simplify the DSI encoder by using mipi_dsi_msg for
> dsi_vc_send_long and dsi_vc_send_short. Further improvements
> require cleaning up the channel allocation code first.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 89 ++-
>  1 file changed, 40 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index bbdc52ee3559..6fa7833e32ad 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2599,8 +2599,8 @@ static inline void dsi_vc_write_long_payload(struct 
> dsi_data *dsi, int channel,
>   dsi_write_reg(dsi, DSI_VC_LONG_PACKET_PAYLOAD(channel), val);
>  }
>  
> -static int dsi_vc_send_long(struct dsi_data *dsi, int channel, u8 data_type,
> - const u8 *data, u16 len, u8 ecc)
> +static int dsi_vc_send_long(struct dsi_data *dsi,
> + const struct mipi_dsi_msg *msg)
>  {
>   /*u32 val; */
>   int i;
> @@ -2609,20 +2609,20 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int 
> channel, u8 data_type,
>   u8 b1, b2, b3, b4;
>  
>   if (dsi->debug_write)
> - DSSDBG("dsi_vc_send_long, %d bytes\n", len);
> + DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
>  
>   /* len + header */
> - if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) {
> + if (dsi->vc[msg->channel].tx_fifo_size * 32 * 4 < msg->tx_len + 4) {
>   DSSERR("unable to send long packet: packet too long.\n");
>   return -EINVAL;
>   }
>  
> - dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> + dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
>  
> - dsi_vc_write_long_header(dsi, channel, data_type, len, ecc);
> + dsi_vc_write_long_header(dsi, msg->channel, msg->type, msg->tx_len, 0);
>  
> - p = data;
> - for (i = 0; i < len >> 2; i++) {
> + p = msg->tx_buf;
> + for (i = 0; i < msg->tx_len >> 2; i++) {
>   if (dsi->debug_write)
>   DSSDBG("\tsending full packet %d\n", i);
>  
> @@ -2631,10 +2631,10 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int 
> channel, u8 data_type,
>   b3 = *p++;
>   b4 = *p++;
>  
> - dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, b4);
> + dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, b4);
>   }
>  
> - i = len % 4;
> + i = msg->tx_len % 4;
>   if (i) {
>   b1 = 0; b2 = 0; b3 = 0;
>  
> @@ -2656,65 +2656,64 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int 
> channel, u8 data_type,
>   break;
>   }
>  
> - dsi_vc_write_long_payload(dsi, channel, b1, b2, b3, 0);
> + dsi_vc_write_long_payload(dsi, msg->channel, b1, b2, b3, 0);
>   }
>  
>   return r;
>  }
>  
> -static int dsi_vc_send_short(struct dsi_data *dsi, int channel, u8 data_type,
> -  u16 data, u8 ecc)
> +static int dsi_vc_send_short(struct dsi_data *dsi,
> +  const struct mipi_dsi_msg *msg)
>  {
> + struct mipi_dsi_packet pkt;
>   u32 r;
> - u8 data_id;
> +
> + r = mipi_dsi_create_packet(&pkt, msg);
> + if (r < 0)
> + return r;
>  
>   WARN_ON(!dsi_bus_is_locked(dsi));
>  
>   if (dsi->debug_write)
>   DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
> - channel,
> - data_type, data & 0xff, (data >> 8) & 0xff);
> + msg->channel,
> + msg->type, pkt.header[1], pkt.header[2]);

You could fix the indentation while at it.

Reviewed-by: Laurent Pinchart 

>  
> - dsi_vc_config_source(dsi, channel, DSI_VC_SOURCE_L4);
> + dsi_vc_config_source(dsi, msg->channel, DSI_VC_SOURCE_L4);
>  
> - if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(channel)), 16, 16)) {
> + if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(msg->channel)), 16, 16)) {
>   DSSERR("ERROR FIFO FULL, aborting transfer\n");
>   return -EINVAL;
>   }
>  
> - data_id = data_type | channel << 6;
> -
> - r = (data_id << 0) | (data << 8) | (ecc << 24);
> + r = pkt.header[3] << 24 | pkt.header[2] << 16 | pkt.header[1] << 8 |
> + pkt.header[0];
>  
> - dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(channel), r);
> + dsi_write_reg(dsi, DSI_VC_SHORT_PACKET_HEADER(msg->channel), r);
>  
>   return 0;
>  }
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel)
>  {
> - return dsi_vc_send_long(dsi, channel, MIPI_DSI_NULL_PACKET, NULL, 0, 0);
> + const struct mipi_dsi_msg msg = {
> +   

Re: [PATCH v3 13/56] drm/omap: dsi: introduce mipi_dsi_host

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:50PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This moves from custom platform driver infrastructure to mipi_dsi_host
> and mipi_dsi_device. Note, that this is a graduate step and the driver
> only uses the devices types and transfer function, but not yet the new
> device binding style or drm_panel.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 121 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c |  54 ++--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   4 -
>  3 files changed, 103 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ea76a89d1833..c3190223d192 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -14,7 +14,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -39,13 +38,13 @@
>  #define DCS_GET_ID3  0xdc
>  
>  struct panel_drv_data {
> + struct mipi_dsi_device *dsi;
> +
>   struct omap_dss_device dssdev;
>   struct omap_dss_device *src;
>  
>   struct videomode vm;
>  
> - struct platform_device *pdev;
> -
>   struct mutex lock;
>  
>   struct backlight_device *bldev;
> @@ -139,7 +138,7 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> *data)
>  {
> - struct omap_dss_device *src = ddata->src;
> + struct mipi_dsi_device *dsi = ddata->dsi;
>   const struct mipi_dsi_msg msg = {
>   .channel = ddata->channel,
>   .type = MIPI_DSI_DCS_READ,
> @@ -149,12 +148,12 @@ static int dsicm_dcs_read_1(struct panel_drv_data 
> *ddata, u8 dcs_cmd, u8 *data)
>   .rx_buf = data
>   };
>  
> - return src->ops->dsi.transfer(src, &msg);
> + return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
>  {
> - struct omap_dss_device *src = ddata->src;
> + struct mipi_dsi_device *dsi = ddata->dsi;
>   const struct mipi_dsi_msg msg = {
>   .channel = ddata->channel,
>   .type = MIPI_DSI_DCS_SHORT_WRITE,
> @@ -162,12 +161,12 @@ static int dsicm_dcs_write_0(struct panel_drv_data 
> *ddata, u8 dcs_cmd)
>   .tx_len = 1,
>   };
>  
> - return src->ops->dsi.transfer(src, &msg);
> + return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> param)
>  {
> - struct omap_dss_device *src = ddata->src;
> + struct mipi_dsi_device *dsi = ddata->dsi;
>   const u8 buf[] = { dcs_cmd, param };
>   const struct mipi_dsi_msg msg = {
>   .channel = ddata->channel,
> @@ -176,13 +175,13 @@ static int dsicm_dcs_write_1(struct panel_drv_data 
> *ddata, u8 dcs_cmd, u8 param)
>   .tx_len = 2,
>   };
>  
> - return src->ops->dsi.transfer(src, &msg);
> + return dsi->host->ops->transfer(dsi->host, &msg);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> - struct omap_dss_device *src = ddata->src;
> + struct mipi_dsi_device *dsi = ddata->dsi;
>   int r;
>   const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
>   const struct mipi_dsi_msg msg = {
> @@ -194,7 +193,7 @@ static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>   hw_guard_wait(ddata);
>  
> - r = src->ops->dsi.transfer(src, &msg);
> + r = dsi->host->ops->transfer(dsi->host, &msg);
>   if (r)
>   return r;
>  
> @@ -242,7 +241,7 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
> *id1, u8 *id2, u8 *id3)
>  static int dsicm_set_update_window(struct panel_drv_data *ddata,
>   u16 x, u16 y, u16 w, u16 h)
>  {
> - struct omap_dss_device *src = ddata->src;
> + struct mipi_dsi_device *dsi = ddata->dsi;
>   int r;
>   u16 x1 = x;
>   u16 x2 = x + w - 1;
> @@ -279,11 +278,11 @@ static int dsicm_set_update_window(struct 
> panel_drv_data *ddata,
>   .tx_len = 5,
>   };
>  
> - r = src->ops->dsi.transfer(src, &msgX);
> + r = dsi->host->ops->transfer(dsi->host, &msgX);
>   if (r)
>   return r;
>  
> - r = src->ops->dsi.transfer(src, &msgY);
> + r = dsi->host->ops->transfer(dsi->host, &msgY);
>   if (r)
>   return r;
>  
> @@ -326,7 +325,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>   return 0;
>  
>  err:
> - dev_err(&ddata->pdev->dev, "enter ULPS failed");
> + dev_err(&ddata->dsi->dev, "enter ULPS failed");
>   dsicm_panel_reset(ddata);
>  
>   ddata->ulps_enabled = false;
> @@ -349,7 +348,7 @@ static int dsicm_

Re: [PATCH/RFC v2] video: fbdev: atari: Fix TT High video mode

2020-11-09 Thread Geert Uytterhoeven
Hi Andreas,

On Sun, Nov 1, 2020 at 1:47 PM Andreas Schwab  wrote:
> On Nov 01 2020, Sam Ravnborg wrote:
> > On Sun, Nov 01, 2020 at 11:29:41AM +0100, Geert Uytterhoeven wrote:
> >> The horizontal resolution (640) for the TT High video mode (1280x960) is
> >> definitely bogus.  While fixing that, correct the timings to match the
> >> TTM195 service manual.
> >>
> >> Signed-off-by: Geert Uytterhoeven 

> >> --- a/drivers/video/fbdev/atafb.c
> >> +++ b/drivers/video/fbdev/atafb.c
> >> @@ -495,8 +495,8 @@ static struct fb_videomode atafb_modedb[] __initdata = 
> >> {
> >>  "tt-mid", 60, 640, 480, 31041, 120, 100, 8, 16, 140, 30,
> >>  0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
> >>  }, {
> >> -/* 1280x960, 29 kHz, 60 Hz (TT high) */
> >> -"tt-high", 57, 640, 960, 31041, 120, 100, 8, 16, 140, 30,
> >> +/* 1280x960, 72 kHz, 72 Hz (TT high) */
> >> +"tt-high", 57, 1280, 960, 7761, 260, 60, 36, 4, 192, 4,
> >>  0, FB_VMODE_NONINTERLACED | FB_VMODE_YWRAP
> >
> > Well-spotted. The change of 640 => 1280 is surely right.
> > I have a harder time understanding why the change of pixclock from 31041
> > to 7761 is correct. All other modes have a pixclock close to or equal
> > to 32000 - so it looks strange this one is off.
>
> According to the Profibuch the pixclock should be about 95000.

Please have a look at the paragraph on p. 1052, and realize that it
fails to take into account horizontal black/sync (the actual scan line
length is 1792 not 1280 pixels) (thanks, Michael!).

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 14/56] drm/omap: panel-dsi-cm: use DSI helpers

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:51PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> After converting the driver to mipi_dsi_device we can use the generic
> message helpers to simplify the driver a lot.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 125 +++---
>  1 file changed, 18 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index c3190223d192..ec36e62ddc3a 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -138,62 +138,22 @@ static void hw_guard_wait(struct panel_drv_data *ddata)
>  
>  static int dsicm_dcs_read_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> *data)
>  {
> - struct mipi_dsi_device *dsi = ddata->dsi;
> - const struct mipi_dsi_msg msg = {
> - .channel = ddata->channel,
> - .type = MIPI_DSI_DCS_READ,
> - .tx_len = 1,
> - .tx_buf = &dcs_cmd,
> - .rx_len = 1,
> - .rx_buf = data
> - };
> -
> - return dsi->host->ops->transfer(dsi->host, &msg);
> -}
> -
> -static int dsicm_dcs_write_0(struct panel_drv_data *ddata, u8 dcs_cmd)
> -{
> - struct mipi_dsi_device *dsi = ddata->dsi;
> - const struct mipi_dsi_msg msg = {
> - .channel = ddata->channel,
> - .type = MIPI_DSI_DCS_SHORT_WRITE,
> - .tx_buf = &dcs_cmd,
> - .tx_len = 1,
> - };
> -
> - return dsi->host->ops->transfer(dsi->host, &msg);
> + return mipi_dsi_dcs_read(ddata->dsi, dcs_cmd, data, 1);
>  }
>  
>  static int dsicm_dcs_write_1(struct panel_drv_data *ddata, u8 dcs_cmd, u8 
> param)
>  {
> - struct mipi_dsi_device *dsi = ddata->dsi;
> - const u8 buf[] = { dcs_cmd, param };
> - const struct mipi_dsi_msg msg = {
> - .channel = ddata->channel,
> - .type = MIPI_DSI_DCS_SHORT_WRITE_PARAM,
> - .tx_buf = &buf,
> - .tx_len = 2,
> - };
> -
> - return dsi->host->ops->transfer(dsi->host, &msg);
> + return mipi_dsi_dcs_write(ddata->dsi, dcs_cmd, ¶m, 1);
>  }
>  
>  static int dsicm_sleep_in(struct panel_drv_data *ddata)
>  
>  {
> - struct mipi_dsi_device *dsi = ddata->dsi;
>   int r;
> - const u8 cmd = MIPI_DCS_ENTER_SLEEP_MODE;
> - const struct mipi_dsi_msg msg = {
> - .channel = ddata->channel,
> - .type = MIPI_DSI_DCS_SHORT_WRITE,
> - .tx_buf = &cmd,
> - .tx_len = 1,
> - };
>  
>   hw_guard_wait(ddata);
>  
> - r = dsi->host->ops->transfer(dsi->host, &msg);
> + r = mipi_dsi_dcs_enter_sleep_mode(ddata->dsi);
>   if (r)
>   return r;
>  
> @@ -210,7 +170,7 @@ static int dsicm_sleep_out(struct panel_drv_data *ddata)
>  
>   hw_guard_wait(ddata);
>  
> - r = dsicm_dcs_write_0(ddata, MIPI_DCS_EXIT_SLEEP_MODE);
> + r = mipi_dsi_dcs_exit_sleep_mode(ddata->dsi);
>   if (r)
>   return r;
>  
> @@ -248,45 +208,15 @@ static int dsicm_set_update_window(struct 
> panel_drv_data *ddata,
>   u16 y1 = y;
>   u16 y2 = y + h - 1;
>  
> - const u8 paramX[] = {
> - MIPI_DCS_SET_COLUMN_ADDRESS,
> - (x1 >> 8) & 0xff,
> - (x1 >> 0) & 0xff,
> - (x2 >> 8) & 0xff,
> - (x2 >> 0) & 0xff,
> - };
> -
> - const struct mipi_dsi_msg msgX = {
> - .channel = ddata->channel,
> - .type = MIPI_DSI_GENERIC_LONG_WRITE,
> - .tx_buf = paramX,
> - .tx_len = 5,
> - };
> -
> - const u8 paramY[] = {
> - MIPI_DCS_SET_PAGE_ADDRESS,
> - (y1 >> 8) & 0xff,
> - (y1 >> 0) & 0xff,
> - (y2 >> 8) & 0xff,
> - (y2 >> 0) & 0xff,
> - };
> -
> - const struct mipi_dsi_msg msgY = {
> - .channel = ddata->channel,
> - .type = MIPI_DSI_GENERIC_LONG_WRITE,
> - .tx_buf = paramY,
> - .tx_len = 5,
> - };
> -
> - r = dsi->host->ops->transfer(dsi->host, &msgX);
> - if (r)
> + r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> + if (r < 0)
>   return r;
>  
> - r = dsi->host->ops->transfer(dsi->host, &msgY);
> - if (r)
> + r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> + if (r < 0)
>   return r;
>  
> - return r;
> + return 0;
>  }
>  
>  static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
> @@ -680,12 +610,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> - r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_PIXEL_FORMAT,
> - MIPI_DCS_PIXEL_FMT_24BIT);
> + r = mipi_dsi_dcs_set_pixel_format(ddata->dsi, MIPI_DCS_PI

Re: [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:52PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Drop custom request_vc/release_vc callbacks by using the
> generic mipi_dsi_attach/mipi_dsi_detach functions.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 61 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 -
>  3 files changed, 41 insertions(+), 47 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index ec36e62ddc3a..b1ca9b34ce17 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
>struct omap_dss_device *dst)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dst);
> - struct device *dev = &ddata->dsi->dev;
> - int r;
> -
> - r = src->ops->dsi.request_vc(src, ddata->channel);
> - if (r) {
> - dev_err(dev, "failed to get virtual channel\n");
> - return r;
> - }
>  
>   ddata->src = src;
>   return 0;
> @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>  {
>   struct panel_drv_data *ddata = to_panel_data(dst);
>  
> - src->ops->dsi.release_vc(src, ddata->channel);
>   ddata->src = NULL;
>  }
>  
> @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   goto err_bl;
>   }
>  
> + dsi->lanes = 3;
> + dsi->format = MIPI_DSI_FMT_RGB888;
> + dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
> +   MIPI_DSI_MODE_EOT_PACKET;
> + dsi->hs_rate = 3;
> + dsi->lp_rate = 1000;

Should this change be explained in the commit message ?

> +
> + r = mipi_dsi_attach(dsi);
> + if (r < 0)
> + goto err_dsi_attach;
> +
>   return 0;
>  
> +err_dsi_attach:
> + sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>  err_bl:
>   destroy_workqueue(ddata->workqueue);
>  err_reg:
> @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device 
> *dsi)
>  
>   dev_dbg(&dsi->dev, "remove\n");
>  
> + mipi_dsi_detach(dsi);
> +
>   omapdss_device_unregister(dssdev);
>  
>   if (omapdss_device_is_enabled(dssdev))
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d1187a8af37f..a16427f3bc23 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -349,7 +349,7 @@ struct dsi_data {
>  
>   struct {
>   enum dsi_vc_source source;
> - struct omap_dss_device *dssdev;
> + struct mipi_dsi_device *dest;

How about naming this dsidev ?

Reviewed-by: Laurent Pinchart 

>   enum fifo_size tx_fifo_size;
>   enum fifo_size rx_fifo_size;
>   } vc[4];
> @@ -4692,32 +4692,6 @@ static enum omap_channel dsi_get_channel(struct 
> dsi_data *dsi)
>   }
>  }
>  
> -static int dsi_request_vc(struct omap_dss_device *dssdev, int channel)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> - if (channel < 0 || channel > 3)
> - return -EINVAL;
> -
> - if (dsi->vc[channel].dssdev) {
> - DSSERR("cannot get VC for display %s", dssdev->name);
> - return -EBUSY;
> - }
> -
> - dsi->vc[channel].dssdev = dssdev;
> - return 0;
> -}
> -
> -static void dsi_release_vc(struct omap_dss_device *dssdev, int channel)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> - if ((channel >= 0 && channel <= 3) &&
> - dsi->vc[channel].dssdev == dssdev) {
> - dsi->vc[channel].dssdev = NULL;
> - }
> -}
> -
>  static ssize_t omap_dsi_host_transfer(struct mipi_dsi_host *host,
> const struct mipi_dsi_msg *msg)
>  {
> @@ -4794,23 +4768,40 @@ static const struct omap_dss_device_ops dsi_ops = {
>   .update = dsi_update,
>  
>   .enable_te = dsi_enable_te,
> -
> - .request_vc = dsi_request_vc,
> - .release_vc = dsi_release_vc,
>   },
>  };
>  
>  static int omap_dsi_host_attach(struct mipi_dsi_host *host,
> -  struct mipi_dsi_device *dsi)
> + struct mipi_dsi_device *client)
>  {
> - /* TODO: convert driver from custom binding method to this one */
> + struct dsi_data *dsi = host_to_omap(host);
> + unsigned int channel = client->channel;
> +
> + if (channel > 3)
> + return -EINVAL;
> +
> + if (dsi->vc[channel].dest) {
> + DSSERR("cannot get VC for display %s", dev_name(&client->dev));
> + return -EBUSY;
> + }
> +
> + dsi->vc[channel]

Re: [PATCH v3 16/56] drm/omap: panel-dsi-cm: drop hardcoded VC

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:53PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Use dsi->channel everywhere, which originates from DT.

I'm not sure DT is the right place to provide this information, but
that's an issue broader than this patch series.

Reviewed-by: Laurent Pinchart 

> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 20 +++
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index b1ca9b34ce17..25183744a61d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -27,9 +27,6 @@
>  
>  #include "../dss/omapdss.h"
>  
> -/* DSI Virtual channel. Hardcoded for now. */
> -#define TCH 0
> -
>  #define DCS_READ_NUM_ERRORS  0x05
>  #define DCS_BRIGHTNESS   0x51
>  #define DCS_CTRL_DISPLAY 0x53
> @@ -73,7 +70,6 @@ struct panel_drv_data {
>   bool te_enabled;
>  
>   atomic_t do_update;
> - int channel;
>  
>   struct delayed_work te_timeout_work;
>  
> @@ -274,7 +270,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>   return 0;
>  
>   src->ops->enable(src);
> - src->ops->dsi.enable_hs(src, ddata->channel, true);
> + src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
>  
>   r = _dsicm_enable_te(ddata, true);
>   if (r) {
> @@ -591,7 +587,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>   dsicm_hw_reset(ddata);
>  
> - src->ops->dsi.enable_hs(src, ddata->channel, false);
> + src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
>  
>   r = dsicm_sleep_out(ddata);
>   if (r)
> @@ -622,7 +618,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> - r = src->ops->dsi.enable_video_output(src, ddata->channel);
> + r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
>   if (r)
>   goto err;
>  
> @@ -634,7 +630,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   ddata->intro_printed = true;
>   }
>  
> - src->ops->dsi.enable_hs(src, ddata->channel, true);
> + src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
>  
>   return 0;
>  err:
> @@ -658,7 +654,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>   struct omap_dss_device *src = ddata->src;
>   int r;
>  
> - src->ops->dsi.disable_video_output(src, ddata->channel);
> + src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>  
>   r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>   if (!r)
> @@ -777,7 +773,7 @@ static irqreturn_t dsicm_te_isr(int irq, void *data)
>   if (old) {
>   cancel_delayed_work(&ddata->te_timeout_work);
>  
> - r = src->ops->dsi.update(src, ddata->channel, 
> dsicm_framedone_cb,
> + r = src->ops->dsi.update(src, ddata->dsi->channel, 
> dsicm_framedone_cb,
>   ddata);
>   if (r)
>   goto err;
> @@ -834,7 +830,7 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>   msecs_to_jiffies(250));
>   atomic_set(&ddata->do_update, 1);
>   } else {
> - r = src->ops->dsi.update(src, ddata->channel, 
> dsicm_framedone_cb,
> + r = src->ops->dsi.update(src, ddata->dsi->channel, 
> dsicm_framedone_cb,
>   ddata);
>   if (r)
>   goto err;
> @@ -1110,8 +1106,6 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>   struct display_timing timing;
>   int err;
>  
> - ddata->channel = TCH;
> -
>   ddata->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW);
>   if (IS_ERR(ddata->reset_gpio)) {
>   err = PTR_ERR(ddata->reset_gpio);

-- 
Regards,

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


Re: [PATCH v3 17/56] drm/omap: panel-dsi-cm: use common MIPI DCS 1.3 defines

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:54PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Drop local definition of common MIPI DCS 1.3 defines.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 25183744a61d..a7236d9c3046 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -28,8 +28,6 @@
>  #include "../dss/omapdss.h"
>  
>  #define DCS_READ_NUM_ERRORS  0x05
> -#define DCS_BRIGHTNESS   0x51
> -#define DCS_CTRL_DISPLAY 0x53
>  #define DCS_GET_ID1  0xda
>  #define DCS_GET_ID2  0xdb
>  #define DCS_GET_ID3  0xdc
> @@ -333,8 +331,10 @@ static int dsicm_bl_update_status(struct 
> backlight_device *dev)
>   src->ops->dsi.bus_lock(src);
>  
>   r = dsicm_wake_up(ddata);
> - if (!r)
> - r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, level);
> + if (!r) {
> + r = dsicm_dcs_write_1(ddata,
> + MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> + }

Weird indentation, and no need for curly brackets, but no big deal.

Reviewed-by: Laurent Pinchart 

>  
>   src->ops->dsi.bus_unlock(src);
>   }
> @@ -597,11 +597,11 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> - r = dsicm_dcs_write_1(ddata, DCS_BRIGHTNESS, 0xff);
> + r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0xff);
>   if (r)
>   goto err;
>  
> - r = dsicm_dcs_write_1(ddata, DCS_CTRL_DISPLAY,
> + r = dsicm_dcs_write_1(ddata, MIPI_DCS_WRITE_CONTROL_DISPLAY,
>   (1<<2) | (1<<5));   /* BL | BCTRL */
>   if (r)
>   goto err;

-- 
Regards,

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


Re: [PATCH v3 18/56] drm/omap: dsi: drop unused memory_read()

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:55PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> memory_read is not used, so we can drop the code.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 93 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 -
>  2 files changed, 97 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index a7236d9c3046..dd9112ca76ba 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -931,97 +931,6 @@ static int dsicm_get_te(struct omap_dss_device *dssdev)
>   return r;
>  }
>  
> -static int dsicm_set_max_rx_packet_size(struct omap_dss_device *dssdev,
> - u16 size)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct mipi_dsi_device *dsi = ddata->dsi;
> -
> - return mipi_dsi_set_maximum_return_packet_size(dsi, size);
> -}
> -
> -static int dsicm_memory_read(struct omap_dss_device *dssdev,
> - void *buf, size_t size,
> - u16 x, u16 y, u16 w, u16 h)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct mipi_dsi_device *dsi = ddata->dsi;
> - struct omap_dss_device *src = ddata->src;
> - int r;
> - int first = 1;
> - int plen;
> - unsigned int buf_used = 0;
> -
> - if (size < w * h * 3)
> - return -ENOMEM;
> -
> - mutex_lock(&ddata->lock);
> -
> - if (!ddata->enabled) {
> - r = -ENODEV;
> - goto err1;
> - }
> -
> - size = min((u32)w * h * 3,
> -ddata->vm.hactive * ddata->vm.vactive * 3);
> -
> - src->ops->dsi.bus_lock(src);
> -
> - r = dsicm_wake_up(ddata);
> - if (r)
> - goto err2;
> -
> - /* plen 1 or 2 goes into short packet. until checksum error is fixed,
> -  * use short packets. plen 32 works, but bigger packets seem to cause
> -  * an error. */
> - if (size % 2)
> - plen = 1;
> - else
> - plen = 2;
> -
> - dsicm_set_update_window(ddata, x, y, w, h);
> -
> - r = dsicm_set_max_rx_packet_size(dssdev, plen);
> - if (r)
> - goto err2;
> -
> - while (buf_used < size) {
> - u8 dcs_cmd = first ? 0x2e : 0x3e;
> - first = 0;
> -
> - r = mipi_dsi_dcs_read(dsi, dcs_cmd,
> -   buf + buf_used, size - buf_used);
> - if (r < 0) {
> - dev_err(dssdev->dev, "read error\n");
> - goto err3;
> - }
> -
> - buf_used += r;
> -
> - if (r < plen) {
> - dev_err(&ddata->dsi->dev, "short read\n");
> - break;
> - }
> -
> - if (signal_pending(current)) {
> - dev_err(&ddata->dsi->dev, "signal pending, "
> - "aborting memory read\n");
> - r = -ERESTARTSYS;
> - goto err3;
> - }
> - }
> -
> - r = buf_used;
> -
> -err3:
> - dsicm_set_max_rx_packet_size(dssdev, 1);
> -err2:
> - src->ops->dsi.bus_unlock(src);
> -err1:
> - mutex_unlock(&ddata->lock);
> - return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>   struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -1094,8 +1003,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>  
>   .enable_te  = dsicm_enable_te,
>   .get_te = dsicm_get_te,
> -
> - .memory_read= dsicm_memory_read,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 78041ef922cc..e67928373560 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -389,10 +389,6 @@ struct omap_dss_driver {
>  
>   int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>   int (*get_te)(struct omap_dss_device *dssdev);
> -
> - int (*memory_read)(struct omap_dss_device *dssdev,
> - void *buf, size_t size,
> - u16 x, u16 y, u16 w, u16 h);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

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


Re: [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:56PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The get_te() callback is not used, so we can drop the
> custom API.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

You could squash this with the previous and next patches.

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 13 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  1 -
>  2 files changed, 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index dd9112ca76ba..92ac90035fec 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -919,18 +919,6 @@ static int dsicm_enable_te(struct omap_dss_device 
> *dssdev, bool enable)
>   return r;
>  }
>  
> -static int dsicm_get_te(struct omap_dss_device *dssdev)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - int r;
> -
> - mutex_lock(&ddata->lock);
> - r = ddata->te_enabled;
> - mutex_unlock(&ddata->lock);
> -
> - return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>   struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -1002,7 +990,6 @@ static const struct omap_dss_driver dsicm_dss_driver = {
>   .sync   = dsicm_sync,
>  
>   .enable_te  = dsicm_enable_te,
> - .get_te = dsicm_get_te,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index e67928373560..aa307f5ab9cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -388,7 +388,6 @@ struct omap_dss_driver {
>   int (*sync)(struct omap_dss_device *dssdev);
>  
>   int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
> - int (*get_te)(struct omap_dss_device *dssdev);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

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


Re: [PATCH v3 20/56] drm/omap: dsi: drop unused enable_te()

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:57PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> enable_te() is not used, so the custom API can be dropped.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 39 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 -
>  2 files changed, 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 92ac90035fec..f59775cabe2d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -882,43 +882,6 @@ static int _dsicm_enable_te(struct panel_drv_data 
> *ddata, bool enable)
>   return r;
>  }
>  
> -static int dsicm_enable_te(struct omap_dss_device *dssdev, bool enable)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *src = ddata->src;
> - int r;
> -
> - mutex_lock(&ddata->lock);
> -
> - if (ddata->te_enabled == enable)
> - goto end;
> -
> - src->ops->dsi.bus_lock(src);
> -
> - if (ddata->enabled) {
> - r = dsicm_wake_up(ddata);
> - if (r)
> - goto err;
> -
> - r = _dsicm_enable_te(ddata, enable);
> - if (r)
> - goto err;
> - }
> -
> - ddata->te_enabled = enable;
> -
> - src->ops->dsi.bus_unlock(src);
> -end:
> - mutex_unlock(&ddata->lock);
> -
> - return 0;
> -err:
> - src->ops->dsi.bus_unlock(src);
> - mutex_unlock(&ddata->lock);
> -
> - return r;
> -}
> -
>  static void dsicm_ulps_work(struct work_struct *work)
>  {
>   struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> @@ -988,8 +951,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  static const struct omap_dss_driver dsicm_dss_driver = {
>   .update = dsicm_update,
>   .sync   = dsicm_sync,
> -
> - .enable_te  = dsicm_enable_te,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index aa307f5ab9cf..55d5bca59f81 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -386,8 +386,6 @@ struct omap_dss_driver {
>   int (*update)(struct omap_dss_device *dssdev,
>  u16 x, u16 y, u16 w, u16 h);
>   int (*sync)(struct omap_dss_device *dssdev);
> -
> - int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);

-- 
Regards,

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


Re: [PATCH v3 21/56] drm/omap: dsi: drop useless sync()

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:58PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The DSI sync() function only locks the bus and then releases
> it again. Currently the only invocation is directly before
> update(), which locks the bus anyways.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c| 18 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
>  drivers/gpu/drm/omapdrm/omap_crtc.c|  3 ---
>  3 files changed, 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index f59775cabe2d..a9609eed6bfa 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -845,23 +845,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>   return r;
>  }
>  
> -static int dsicm_sync(struct omap_dss_device *dssdev)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *src = ddata->src;
> -
> - dev_dbg(&ddata->dsi->dev, "sync\n");
> -
> - mutex_lock(&ddata->lock);
> - src->ops->dsi.bus_lock(src);
> - src->ops->dsi.bus_unlock(src);
> - mutex_unlock(&ddata->lock);
> -
> - dev_dbg(&ddata->dsi->dev, "sync done\n");
> -
> - return 0;
> -}
> -
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>   struct omap_dss_device *src = ddata->src;
> @@ -950,7 +933,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>  
>  static const struct omap_dss_driver dsicm_dss_driver = {
>   .update = dsicm_update,
> - .sync   = dsicm_sync,
>  };
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 55d5bca59f81..9bbd2c0f3187 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -385,7 +385,6 @@ struct omap_dss_device {
>  struct omap_dss_driver {
>   int (*update)(struct omap_dss_device *dssdev,
>  u16 x, u16 y, u16 w, u16 h);
> - int (*sync)(struct omap_dss_device *dssdev);
>  };
>  
>  struct dss_device *omapdss_get_dss(void);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
> b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 328a4a74f534..dac9ccda98df 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -379,9 +379,6 @@ static void omap_crtc_manual_display_update(struct 
> work_struct *data)
>   return;
>   }
>  
> - if (dssdrv->sync)
> - dssdrv->sync(dssdev);
> -
>   ret = dssdrv->update(dssdev, 0, 0, mode->hdisplay, mode->vdisplay);
>   if (ret < 0) {
>   spin_lock_irq(&dev->event_lock);

-- 
Regards,

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


Re: [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:02:59PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> In order to reduce the amount of custom functionality, this moves
> handling of pixel format and DSI mode from set_config() to dsi
> attach.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 31 ---
>  2 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index a9609eed6bfa..2e9de33fc8d4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   u8 id1, id2, id3;
>   int r;
>   struct omap_dss_dsi_config dsi_config = {
> - .mode = OMAP_DSS_DSI_CMD_MODE,
> - .pixel_format = MIPI_DSI_FMT_RGB888,
>   .vm = &ddata->vm,
>   .hs_clk_min = 15000,
>   .hs_clk_max = 3,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index a16427f3bc23..e341aca92462 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device 
> *dssdev,
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
>   struct dsi_clk_calc_ctx ctx;
> + struct omap_dss_dsi_config cfg = *config;
>   bool ok;
>   int r;
>  
>   mutex_lock(&dsi->lock);
>  
> - dsi->pix_fmt = config->pixel_format;
> - dsi->mode = config->mode;
> + cfg.mode = dsi->mode;
> + cfg.pixel_format = dsi->pix_fmt;
>  
> - if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
> - DSSERR("invalid pixel format\n");
> - r = -EINVAL;
> - goto err;
> - }
> -
> - if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
> - ok = dsi_vm_calc(dsi, config, &ctx);
> + if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
> + ok = dsi_vm_calc(dsi, &cfg, &ctx);
>   else
> - ok = dsi_cm_calc(dsi, config, &ctx);
> + ok = dsi_cm_calc(dsi, &cfg, &ctx);
>  
>   if (!ok) {
>   DSSERR("failed to find suitable DSI clock settings\n");
> @@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device 
> *dssdev,
>   dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
>  
>   r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
> - config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
> + cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
>   if (r) {
>   DSSERR("failed to find suitable DSI LP clock settings\n");
>   goto err;
> @@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host 
> *host,
>   return -EBUSY;
>   }
>  
> + if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
> + DSSERR("invalid pixel format\n");
> + return -EINVAL;
> + }
> +
>   dsi->vc[channel].dest = client;
> +
> + dsi->pix_fmt = client->format;

Does this mean that all clients must use the same pixel format ? Do we
even support multiple clients ? If no the VC allocation could be
simplified.

> + if (client->mode_flags & MIPI_DSI_MODE_VIDEO)
> + dsi->mode = OMAP_DSS_DSI_VIDEO_MODE;
> + else
> + dsi->mode = OMAP_DSS_DSI_CMD_MODE;
> +
>   return 0;
>  }
>  

-- 
Regards,

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


Re: [PATCH v3 23/56] drm/omap: panel-dsi-cm: use bulk regulator API

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:00PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Use bulk regulator API to simplify the code. This also switches
> from _optional variant to normal variant, which will provide a
> dummy regulator (i.e. if some always-enabled regulator is not
> described in DT).
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 65 ++-
>  1 file changed, 21 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 2e9de33fc8d4..1e742cf798b6 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -32,6 +32,8 @@
>  #define DCS_GET_ID2  0xdb
>  #define DCS_GET_ID3  0xdc
>  
> +#define DCS_REGULATOR_SUPPLY_NUM 2
> +
>  struct panel_drv_data {
>   struct mipi_dsi_device *dsi;
>  
> @@ -54,8 +56,7 @@ struct panel_drv_data {
>   struct gpio_desc *reset_gpio;
>   struct gpio_desc *ext_te_gpio;
>  
> - struct regulator *vpnl;
> - struct regulator *vddi;
> + struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
>   bool use_dsi_backlight;
>  
> @@ -557,28 +558,16 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   .lp_clk_max = 1000,
>   };
>  
> - if (ddata->vpnl) {
> - r = regulator_enable(ddata->vpnl);
> - if (r) {
> - dev_err(&ddata->dsi->dev,
> - "failed to enable VPNL: %d\n", r);
> - return r;
> - }
> - }
> -
> - if (ddata->vddi) {
> - r = regulator_enable(ddata->vddi);
> - if (r) {
> - dev_err(&ddata->dsi->dev,
> - "failed to enable VDDI: %d\n", r);
> - goto err_vpnl;
> - }
> + r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);

I'd use ARRAY_SIZE(data->supplies) to replace DCS_REGULATOR_SUPPLY_NUM,
and drop the DCS_REGULATOR_SUPPLY_NUM macro.

> + if (r) {
> + dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> + return r;
>   }
>  
>   r = src->ops->dsi.set_config(src, &dsi_config);
>   if (r) {
>   dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> - goto err_vddi;
> + goto err_regulators;
>   }
>  
>   src->ops->enable(src);
> @@ -637,12 +626,10 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   dsicm_hw_reset(ddata);
>  
>   src->ops->dsi.disable(src, true, false);
> -err_vddi:
> - if (ddata->vddi)
> - regulator_disable(ddata->vddi);
> -err_vpnl:
> - if (ddata->vpnl)
> - regulator_disable(ddata->vpnl);
> +err_regulators:
> + r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> + if (r)
> + dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", 
> r);

Not sure if the error message is needed, but I suppose it doesn't hurt.

Reviewed-by: Laurent Pinchart 

>  
>   return r;
>  }
> @@ -666,10 +653,9 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>  
>   src->ops->dsi.disable(src, true, false);
>  
> - if (ddata->vddi)
> - regulator_disable(ddata->vddi);
> - if (ddata->vpnl)
> - regulator_disable(ddata->vpnl);
> + r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> + if (r)
> + dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", 
> r);
>  
>   ddata->enabled = false;
>  }
> @@ -973,21 +959,12 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>   ddata->height_mm = 0;
>   of_property_read_u32(node, "height-mm", &ddata->height_mm);
>  
> - ddata->vpnl = devm_regulator_get_optional(&dsi->dev, "vpnl");
> - if (IS_ERR(ddata->vpnl)) {
> - err = PTR_ERR(ddata->vpnl);
> - if (err == -EPROBE_DEFER)
> - return err;
> - ddata->vpnl = NULL;
> - }
> -
> - ddata->vddi = devm_regulator_get_optional(&dsi->dev, "vddi");
> - if (IS_ERR(ddata->vddi)) {
> - err = PTR_ERR(ddata->vddi);
> - if (err == -EPROBE_DEFER)
> - return err;
> - ddata->vddi = NULL;
> - }
> + ddata->supplies[0].supply = "vpnl";
> + ddata->supplies[1].supply = "vddi";
> + err = devm_regulator_bulk_get(&dsi->dev, DCS_REGULATOR_SUPPLY_NUM,
> +   ddata->supplies);
> + if (err)
> + return err;
>  
>   backlight = devm_of_find_backlight(&dsi->dev);
>   if (IS_ERR(backlight))

-- 
Regards,

Laurent Pinchart
___
dri-devel mailing list
dri-

Re: [PATCH v1 00/30] Introduce core voltage scaling for NVIDIA Tegra20/30 SoCs

2020-11-09 Thread Viresh Kumar
On 09-11-20, 08:10, Dmitry Osipenko wrote:
> 09.11.2020 07:47, Dmitry Osipenko пишет:
> > 09.11.2020 07:43, Viresh Kumar пишет:
> >> On 08-11-20, 15:19, Dmitry Osipenko wrote:
> >>> I took a detailed look at the GENPD and tried to implement it. Here is
> >>> what was found:
> >>>
> >>> 1. GENPD framework doesn't aggregate performance requests from the
> >>> attached devices. This means that if deviceA requests performance state
> >>> 10 and then deviceB requests state 3, then framework will set domain's
> >>> state to 3 instead of 10.
> >>
> >> It does. Look at _genpd_reeval_performance_state().
> >>
> > 
> > Thanks, I probably had a bug in the quick prototype and then overlooked
> > that function.
> > 
> 
> If a non-hardware device-tree node is okay to have for the domain, then
> I can try again.
> 
> What I also haven't mentioned is that GENPD adds some extra complexity
> to some drivers (3d, video decoder) because we will need to handle both
> new GENPD and legacy Tegra specific pre-genpd era domains.
> 
> I'm also not exactly sure how the topology of domains should look like
> because Tegra has a power-controller (PMC) which manages power rail of a
> few hardware units. Perhaps it should be
> 
>   device -> PMC domain -> CORE domain
> 
> but not exactly sure for now.

I am also confused on if it should be a domain or regulator, but that
is for Ulf to tell :)

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


Re: [PATCH v1 00/30] Introduce core voltage scaling for NVIDIA Tegra20/30 SoCs

2020-11-09 Thread Dmitry Osipenko
09.11.2020 07:47, Dmitry Osipenko пишет:
> 09.11.2020 07:43, Viresh Kumar пишет:
>> On 08-11-20, 15:19, Dmitry Osipenko wrote:
>>> I took a detailed look at the GENPD and tried to implement it. Here is
>>> what was found:
>>>
>>> 1. GENPD framework doesn't aggregate performance requests from the
>>> attached devices. This means that if deviceA requests performance state
>>> 10 and then deviceB requests state 3, then framework will set domain's
>>> state to 3 instead of 10.
>>
>> It does. Look at _genpd_reeval_performance_state().
>>
> 
> Thanks, I probably had a bug in the quick prototype and then overlooked
> that function.
> 

If a non-hardware device-tree node is okay to have for the domain, then
I can try again.

What I also haven't mentioned is that GENPD adds some extra complexity
to some drivers (3d, video decoder) because we will need to handle both
new GENPD and legacy Tegra specific pre-genpd era domains.

I'm also not exactly sure how the topology of domains should look like
because Tegra has a power-controller (PMC) which manages power rail of a
few hardware units. Perhaps it should be

  device -> PMC domain -> CORE domain

but not exactly sure for now.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Viresh Kumar
On 09-11-20, 08:08, Dmitry Osipenko wrote:
> 09.11.2020 08:00, Viresh Kumar пишет:
> > On 06-11-20, 21:41, Frank Lee wrote:
> >> On Fri, Nov 6, 2020 at 9:18 PM Dmitry Osipenko  wrote:
> >>>
> >>> 06.11.2020 09:15, Viresh Kumar пишет:
>  Setting regulators for count as 0 doesn't sound good to me.
> 
>  But, I understand that you don't want to have that if (have_regulator)
>  check, and it is a fair request. What I will instead do is, allow all
>  dev_pm_opp_put*() API to start accepting a NULL pointer for the OPP
>  table and fail silently. And so you won't be required to have this
>  unwanted check. But you will be required to save the pointer returned
>  back by dev_pm_opp_set_regulators(), which is the right thing to do
>  anyways.
> >>>
> >>> Perhaps even a better variant could be to add a devm versions of the OPP
> >>> API functions, then drivers won't need to care about storing the
> >>> opp_table pointer if it's unused by drivers.
> >>
> >> I think so. The consumer may not be so concerned about the status of
> >> these OPP tables.
> >> If the driver needs to manage the release, it needs to add a pointer
> >> to their driver global structure.
> >>
> >> Maybe it's worth having these devm interfaces for opp.
> > 
> > Sure if there are enough users of this, I am all for it. I was fine
> > with the patches you sent, just that there were not a lot of users of
> > it and so I pushed them back. If we find that we have more users of it
> > now, we can surely get that back.
> > 
> 
> There was already attempt to add the devm? Could you please give me a
> link to the patches?
> 
> I already prepared a patch which adds the devm helpers. It helps to keep
> code cleaner and readable.

https://lore.kernel.org/lkml/20201012135517.19468-1-fr...@allwinnertech.com/

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


[PATCH] drivers: amdgpu: amdgpu_display.c: Fix a spelling doens\'t to doesn\'t

2020-11-09 Thread Bhaskar Chowdhury
s/doens't/doesn't/p

Signed-off-by: Bhaskar Chowdhury 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 7cc7af2a6822..a92cb137293a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -512,7 +512,7 @@ uint32_t amdgpu_display_supported_domains(struct 
amdgpu_device *adev,
 * to avoid hang caused by placement of scanout BO in GTT on certain
 * APUs. So force the BO placement to VRAM in case this architecture
 * will not allow USWC mappings.
-* Also, don't allow GTT domain if the BO doens't have USWC falg set.
+* Also, don't allow GTT domain if the BO doesn't have USWC falg set.
 */
if ((bo_flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) &&
amdgpu_bo_support_uswc(bo_flags) &&
--
2.26.2

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


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Dmitry Osipenko
09.11.2020 08:35, Viresh Kumar пишет:
> On 09-11-20, 08:19, Dmitry Osipenko wrote:
>> Thanks, I made it in a different way by simply adding helpers to the
>> pm_opp.h which use devm_add_action_or_reset(). This doesn't require to
>> add new kernel symbols.
> 
> I will prefer to add it in core.c itself, and yes
> devm_add_action_or_reset() looks better. But I am still not sure for
> which helpers do we need the devm_*() variants, as this is only useful
> for non-CPU devices. But if we have users that we can add right now,
> why not.

All current non-CPU drivers (devfreq, mmc, memory, etc) can benefit from it.

For Tegra drivers we need these variants:

devm_pm_opp_set_supported_hw()
devm_pm_opp_set_regulators() [if we won't use GENPD]
devm_pm_opp_set_clkname()
devm_pm_opp_of_add_table()
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 05/15] mm/frame-vector: Use FOLL_LONGTERM

2020-11-09 Thread Thomas Hellström
On Fri, 2020-11-06 at 08:55 -0400, Jason Gunthorpe wrote:
> On Fri, Nov 06, 2020 at 11:27:59AM +0100, Daniel Vetter wrote:
> > On Fri, Nov 6, 2020 at 11:01 AM Daniel Vetter 
> > wrote:
> > > On Fri, Nov 6, 2020 at 5:08 AM John Hubbard 
> > > wrote:
> > > > On 11/5/20 4:49 AM, Jason Gunthorpe wrote:
> > > > > On Thu, Nov 05, 2020 at 10:25:24AM +0100, Daniel Vetter
> > > > > wrote:
> > > > > > > /*
> > > > > > >   * If we can't determine whether or not a pte is
> > > > > > > special, then fail immediately
> > > > > > >   * for ptes. Note, we can still pin HugeTLB and THP as
> > > > > > > these are guaranteed not
> > > > > > >   * to be special.
> > > > > > >   *
> > > > > > >   * For a futex to be placed on a THP tail page,
> > > > > > > get_futex_key requires a
> > > > > > >   * get_user_pages_fast_only implementation that can pin
> > > > > > > pages. Thus it's still
> > > > > > >   * useful to have gup_huge_pmd even if we can't operate
> > > > > > > on ptes.
> > > > > > >   */
> > > > > > 
> > > > > > We support hugepage faults in gpu drivers since recently,
> > > > > > and I'm not
> > > > > > seeing a pud_mkhugespecial anywhere. So not sure this
> > > > > > works, but probably
> > > > > > just me missing something again.
> > > > > 
> > > > > It means ioremap can't create an IO page PUD, it has to be
> > > > > broken up.
> > > > > 
> > > > > Does ioremap even create anything larger than PTEs?
> > > 
> > > gpu drivers also tend to use vmf_insert_pfn* directly, so we can
> > > do
> > > on-demand paging and move buffers around. From what I glanced for
> > > lowest level we to the pte_mkspecial correctly (I think I
> > > convinced
> > > myself that vm_insert_pfn does that), but for pud/pmd levels it
> > > seems
> > > just yolo.
> > 
> > So I dug around a bit more and ttm sets PFN_DEV | PFN_MAP to get
> > past
> > the various pft_t_devmap checks (see e.g.
> > vmf_insert_pfn_pmd_prot()).
> > x86-64 has ARCH_HAS_PTE_DEVMAP, and gup.c seems to handle these
> > specially, but frankly I got totally lost in what this does.
> 
> The fact vmf_insert_pfn_pmd_prot() has all those BUG_ON's to prevent
> putting VM_PFNMAP pages into the page tables seems like a big red
> flag.
> 
> The comment seems to confirm what we are talking about here:
> 
>   /*
>* If we had pmd_special, we could avoid all these
> restrictions,
>* but we need to be consistent with PTEs and architectures
> that
>* can't support a 'special' bit.
>*/
> 
> ie without the ability to mark special we can't block fast gup and
> anyone who does O_DIRECT on these ranges will crash the kernel when
> it
> tries to convert a IO page into a struct page.
> 
> Should be easy enough to directly test?
> 
> Putting non-struct page PTEs into a VMA without setting VM_PFNMAP
> just
> seems horribly wrong to me.

Although core mm special huge-page support is currently quite limited,
some time ago, I extended the pre-existing vma_is_dax() to
vma_is_special_huge():

/**
 * vma_is_special_huge - Are transhuge page-table entries considered
special?
 * @vma: Pointer to the struct vm_area_struct to consider
 *
 * Whether transhuge page-table entries are considered "special"
following
 * the definition in vm_normal_page().
 *
 * Return: true if transhuge page-table entries should be considered
special,
 * false otherwise.
 */
static inline bool vma_is_special_huge(const struct vm_area_struct
*vma)
{
return vma_is_dax(vma) || (vma->vm_file &&
   (vma->vm_flags & (VM_PFNMAP |
VM_MIXEDMAP)));
}

meaning that currently all transhuge page-table-entries in a PFNMAP or
MIXEDMAP vma are considered "special". The number of calls to this
function (mainly in the page-splitting code) is quite limited so
replacing it with a more elaborate per-page-table-entry scheme would, I
guess, definitely be possible. Although all functions using it would
need to require a fallback path for architectures not supporting it.

/Thomas



> 
> Jason

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


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Viresh Kumar
On 06-11-20, 21:41, Frank Lee wrote:
> On Fri, Nov 6, 2020 at 9:18 PM Dmitry Osipenko  wrote:
> >
> > 06.11.2020 09:15, Viresh Kumar пишет:
> > > Setting regulators for count as 0 doesn't sound good to me.
> > >
> > > But, I understand that you don't want to have that if (have_regulator)
> > > check, and it is a fair request. What I will instead do is, allow all
> > > dev_pm_opp_put*() API to start accepting a NULL pointer for the OPP
> > > table and fail silently. And so you won't be required to have this
> > > unwanted check. But you will be required to save the pointer returned
> > > back by dev_pm_opp_set_regulators(), which is the right thing to do
> > > anyways.
> >
> > Perhaps even a better variant could be to add a devm versions of the OPP
> > API functions, then drivers won't need to care about storing the
> > opp_table pointer if it's unused by drivers.
> 
> I think so. The consumer may not be so concerned about the status of
> these OPP tables.
> If the driver needs to manage the release, it needs to add a pointer
> to their driver global structure.
> 
> Maybe it's worth having these devm interfaces for opp.

Sure if there are enough users of this, I am all for it. I was fine
with the patches you sent, just that there were not a lot of users of
it and so I pushed them back. If we find that we have more users of it
now, we can surely get that back.

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


Re: [PATCH v1 00/30] Introduce core voltage scaling for NVIDIA Tegra20/30 SoCs

2020-11-09 Thread Dmitry Osipenko
09.11.2020 07:43, Viresh Kumar пишет:
> On 08-11-20, 15:19, Dmitry Osipenko wrote:
>> I took a detailed look at the GENPD and tried to implement it. Here is
>> what was found:
>>
>> 1. GENPD framework doesn't aggregate performance requests from the
>> attached devices. This means that if deviceA requests performance state
>> 10 and then deviceB requests state 3, then framework will set domain's
>> state to 3 instead of 10.
> 
> It does. Look at _genpd_reeval_performance_state().
> 

Thanks, I probably had a bug in the quick prototype and then overlooked
that function.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Dmitry Osipenko
09.11.2020 08:10, Viresh Kumar пишет:
> On 09-11-20, 08:08, Dmitry Osipenko wrote:
>> 09.11.2020 08:00, Viresh Kumar пишет:
>>> On 06-11-20, 21:41, Frank Lee wrote:
 On Fri, Nov 6, 2020 at 9:18 PM Dmitry Osipenko  wrote:
>
> 06.11.2020 09:15, Viresh Kumar пишет:
>> Setting regulators for count as 0 doesn't sound good to me.
>>
>> But, I understand that you don't want to have that if (have_regulator)
>> check, and it is a fair request. What I will instead do is, allow all
>> dev_pm_opp_put*() API to start accepting a NULL pointer for the OPP
>> table and fail silently. And so you won't be required to have this
>> unwanted check. But you will be required to save the pointer returned
>> back by dev_pm_opp_set_regulators(), which is the right thing to do
>> anyways.
>
> Perhaps even a better variant could be to add a devm versions of the OPP
> API functions, then drivers won't need to care about storing the
> opp_table pointer if it's unused by drivers.

 I think so. The consumer may not be so concerned about the status of
 these OPP tables.
 If the driver needs to manage the release, it needs to add a pointer
 to their driver global structure.

 Maybe it's worth having these devm interfaces for opp.
>>>
>>> Sure if there are enough users of this, I am all for it. I was fine
>>> with the patches you sent, just that there were not a lot of users of
>>> it and so I pushed them back. If we find that we have more users of it
>>> now, we can surely get that back.
>>>
>>
>> There was already attempt to add the devm? Could you please give me a
>> link to the patches?
>>
>> I already prepared a patch which adds the devm helpers. It helps to keep
>> code cleaner and readable.
> 
> https://lore.kernel.org/lkml/20201012135517.19468-1-fr...@allwinnertech.com/
> 

Thanks, I made it in a different way by simply adding helpers to the
pm_opp.h which use devm_add_action_or_reset(). This doesn't require to
add new kernel symbols.

static inline int devm_pm_opp_of_add_table(struct device *dev)
{
int err;

err = dev_pm_opp_of_add_table(dev);
if (err)
return err;

err = devm_add_action_or_reset(dev, (void*)dev_pm_opp_remove_table,
   dev);
if (err)
return err;

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


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Viresh Kumar
On 09-11-20, 08:44, Dmitry Osipenko wrote:
> 09.11.2020 08:35, Viresh Kumar пишет:
> > On 09-11-20, 08:19, Dmitry Osipenko wrote:
> >> Thanks, I made it in a different way by simply adding helpers to the
> >> pm_opp.h which use devm_add_action_or_reset(). This doesn't require to
> >> add new kernel symbols.
> > 
> > I will prefer to add it in core.c itself, and yes
> > devm_add_action_or_reset() looks better. But I am still not sure for
> > which helpers do we need the devm_*() variants, as this is only useful
> > for non-CPU devices. But if we have users that we can add right now,
> > why not.
> 
> All current non-CPU drivers (devfreq, mmc, memory, etc) can benefit from it.
> 
> For Tegra drivers we need these variants:
> 
> devm_pm_opp_set_supported_hw()
> devm_pm_opp_set_regulators() [if we won't use GENPD]
> devm_pm_opp_set_clkname()
> devm_pm_opp_of_add_table()

I tried to look earlier for the stuff already merged in and didn't
find a lot of stuff where the devm_* could be used, maybe I missed
some of it.

Frank, would you like to refresh your series based on suggestions from
Dmitry and make other drivers adapt to the new APIs ?

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


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Dmitry Osipenko
09.11.2020 08:00, Viresh Kumar пишет:
> On 06-11-20, 21:41, Frank Lee wrote:
>> On Fri, Nov 6, 2020 at 9:18 PM Dmitry Osipenko  wrote:
>>>
>>> 06.11.2020 09:15, Viresh Kumar пишет:
 Setting regulators for count as 0 doesn't sound good to me.

 But, I understand that you don't want to have that if (have_regulator)
 check, and it is a fair request. What I will instead do is, allow all
 dev_pm_opp_put*() API to start accepting a NULL pointer for the OPP
 table and fail silently. And so you won't be required to have this
 unwanted check. But you will be required to save the pointer returned
 back by dev_pm_opp_set_regulators(), which is the right thing to do
 anyways.
>>>
>>> Perhaps even a better variant could be to add a devm versions of the OPP
>>> API functions, then drivers won't need to care about storing the
>>> opp_table pointer if it's unused by drivers.
>>
>> I think so. The consumer may not be so concerned about the status of
>> these OPP tables.
>> If the driver needs to manage the release, it needs to add a pointer
>> to their driver global structure.
>>
>> Maybe it's worth having these devm interfaces for opp.
> 
> Sure if there are enough users of this, I am all for it. I was fine
> with the patches you sent, just that there were not a lot of users of
> it and so I pushed them back. If we find that we have more users of it
> now, we can surely get that back.
> 

There was already attempt to add the devm? Could you please give me a
link to the patches?

I already prepared a patch which adds the devm helpers. It helps to keep
code cleaner and readable.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 17/30] mmc: sdhci-tegra: Support OPP and core voltage scaling

2020-11-09 Thread Viresh Kumar
On 09-11-20, 08:19, Dmitry Osipenko wrote:
> Thanks, I made it in a different way by simply adding helpers to the
> pm_opp.h which use devm_add_action_or_reset(). This doesn't require to
> add new kernel symbols.

I will prefer to add it in core.c itself, and yes
devm_add_action_or_reset() looks better. But I am still not sure for
which helpers do we need the devm_*() variants, as this is only useful
for non-CPU devices. But if we have users that we can add right now,
why not.

> static inline int devm_pm_opp_of_add_table(struct device *dev)
> {
>   int err;
> 
>   err = dev_pm_opp_of_add_table(dev);
>   if (err)
>   return err;
> 
>   err = devm_add_action_or_reset(dev, (void*)dev_pm_opp_remove_table,
>  dev);
>   if (err)
>   return err;
> 
>   return 0;
> }

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


Re: [PATCH v3 24/56] drm/omap: dsi: lp/hs switching support for transfer()

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:01PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Integrate low-power / high-speed bus switching into transfer
> function and drop the omapdrm specific enable_hs() callback.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  6 +++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c   | 10 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  2 --
>  3 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 1e742cf798b6..8890ee2ba830 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -269,7 +269,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>   return 0;
>  
>   src->ops->enable(src);
> - src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
> + ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>   r = _dsicm_enable_te(ddata, true);
>   if (r) {
> @@ -574,7 +574,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>   dsicm_hw_reset(ddata);
>  
> - src->ops->dsi.enable_hs(src, ddata->dsi->channel, false);
> + ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
>  
>   r = dsicm_sleep_out(ddata);
>   if (r)
> @@ -617,7 +617,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   ddata->intro_printed = true;
>   }
>  
> - src->ops->dsi.enable_hs(src, ddata->dsi->channel, true);
> + ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>   return 0;
>  err:
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index e341aca92462..003d26cead5a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -329,6 +329,7 @@ struct dsi_data {
>   int irq;
>  
>   bool is_enabled;
> + bool in_lp_mode;
>  
>   struct clk *dss_clk;
>   struct regmap *syscon;
> @@ -2431,6 +2432,8 @@ static void dsi_vc_enable_hs(struct omap_dss_device 
> *dssdev, int channel,
>   /* start the DDR clock by sending a NULL packet */
>   if (dsi->vm_timings.ddr_clk_always_on && enable)
>   dsi_vc_send_null(dsi, channel);
> +
> + dsi->in_lp_mode = !enable;
>  }
>  
>  static void dsi_vc_flush_long_data(struct dsi_data *dsi, int channel)
> @@ -4693,6 +4696,11 @@ static ssize_t omap_dsi_host_transfer(struct 
> mipi_dsi_host *host,
>   struct dsi_data *dsi = host_to_omap(host);
>   struct omap_dss_device *dssdev = &dsi->output;
>  
> + if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
> + dsi_vc_enable_hs(dssdev, msg->channel,
> +  !(msg->flags & MIPI_DSI_MSG_USE_LPM));
> + }

No need for curly brackets.

Reviewed-by: Laurent Pinchart 

> +
>   switch (msg->type) {
>   case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
>   case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> @@ -4753,8 +4761,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>  
>   .disable = dsi_display_disable,
>  
> - .enable_hs = dsi_vc_enable_hs,
> -
>   .set_config = dsi_set_config,
>  
>   .enable_video_output = dsi_enable_video_output,
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 9bbd2c0f3187..2d44a8e32fcc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
>   int (*set_config)(struct omap_dss_device *dssdev,
>   const struct omap_dss_dsi_config *cfg);
>  
> - void (*enable_hs)(struct omap_dss_device *dssdev, int channel,
> - bool enable);
>   int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
>  
>   int (*update)(struct omap_dss_device *dssdev, int channel,

-- 
Regards,

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


Re: [PATCHv7 0/7] System Cache support for GPU and required SMMU support

2020-11-09 Thread Sai Prakash Ranjan

On 2020-10-30 14:53, Sai Prakash Ranjan wrote:

Some hardware variants contain a system cache or the last level
cache(llc). This cache is typically a large block which is shared
by multiple clients on the SOC. GPU uses the system cache to cache
both the GPU data buffers(like textures) as well the SMMU pagetables.
This helps with improved render performance as well as lower power
consumption by reducing the bus traffic to the system memory.

The system cache architecture allows the cache to be split into slices
which then be used by multiple SOC clients. This patch series is an
effort to enable and use two of those slices preallocated for the GPU,
one for the GPU data buffers and another for the GPU SMMU hardware
pagetables.

Patch 1 - Patch 5 adds system cache support in SMMU and GPU driver.
Patch 6 and 7 are minor cleanups for arm-smmu impl.

Changes in v7:
 * Squash Jordan's patch to support MMU500 targets
 * Rebase on top of for-joerg/arm-smmu/updates and Jordan's short
series for adreno-smmu impl

Changes in v6:
 * Move table to arm-smmu-qcom (Robin)

Changes in v5:
 * Drop cleanup of blank lines since it was intentional (Robin)
 * Rebase again on top of msm-next-pgtables as it moves pretty fast

Changes in v4:
 * Drop IOMMU_SYS_CACHE prot flag
 * Rebase on top of
https://gitlab.freedesktop.org/drm/msm/-/tree/msm-next-pgtables

Changes in v3:
 * Fix domain attribute setting to before iommu_attach_device()
 * Fix few code style and checkpatch warnings
 * Rebase on top of Jordan's latest split pagetables and per-instance
   pagetables support

Changes in v2:
 * Addressed review comments and rebased on top of Jordan's split
   pagetables series

Jordan Crouse (1):
  drm/msm/a6xx: Add support for using system cache on MMU500 based
targets

Sai Prakash Ranjan (4):
  iommu/io-pgtable-arm: Add support to use system cache
  iommu/arm-smmu: Add domain attribute for system cache
  iommu: arm-smmu-impl: Use table to list QCOM implementations
  iommu: arm-smmu-impl: Add a space before open parenthesis

Sharat Masetty (2):
  drm/msm: rearrange the gpu_rmw() function
  drm/msm/a6xx: Add support for using system cache(LLC)



Hi,

Gentle Ping!

Thanks,
Sai

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a 
member

of Code Aurora Forum, hosted by The Linux Foundation
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v1 00/30] Introduce core voltage scaling for NVIDIA Tegra20/30 SoCs

2020-11-09 Thread Viresh Kumar
On 08-11-20, 15:19, Dmitry Osipenko wrote:
> I took a detailed look at the GENPD and tried to implement it. Here is
> what was found:
> 
> 1. GENPD framework doesn't aggregate performance requests from the
> attached devices. This means that if deviceA requests performance state
> 10 and then deviceB requests state 3, then framework will set domain's
> state to 3 instead of 10.

It does. Look at _genpd_reeval_performance_state().

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


Re: [PATCH 3/3] MAINTAINERS: add files for Mediatek DRM drivers

2020-11-09 Thread Chunfeng Yun
On Sun, 2020-11-08 at 11:04 +0800, Chun-Kuang Hu wrote:
> + Vinod:
> 
> Hi, Chunfeng:
> 
> Chun-Kuang Hu  於 2020年10月29日 週四 下午11:28寫道:
> >
> > Mediatek MIPI DSI phy driver is moved from drivers/gpu/drm/mediatek to
> > drivers/phy/mediatek, so add the new folder to the Mediatek DRM drivers'
> > information.
> 
> Would you like this patch? If so, you could give an acked-by tag on
> this patch, so I could applied the whole series into my tree.
Acked-by: Chunfeng Yun 

Thanks

> 
> Regards,
> Chun-Kuang.
> 
> >
> > Signed-off-by: Chun-Kuang Hu 
> > ---
> >  MAINTAINERS | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index e73636b75f29..14f5018c01b6 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -5867,6 +5867,7 @@ S:Supported
> >  F: Documentation/devicetree/bindings/display/mediatek/
> >  F: drivers/gpu/drm/mediatek/
> >  F: drivers/phy/mediatek/phy-mtk-hdmi*
> > +F: drivers/phy/mediatek/phy-mtk-mipi*
> >
> >  DRM DRIVERS FOR NVIDIA TEGRA
> >  M: Thierry Reding 
> > --
> > 2.17.1
> >

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


Re: [PATCH v2 00/23] Rid W=1 warnings in MTD

2020-11-09 Thread Miquel Raynal
Hi Lee,

Lee Jones  wrote on Fri,  6 Nov 2020 21:36:32
+:

> This set is part of a larger effort attempting to clean-up W=1
> kernel builds, which are currently overwhelmingly riddled with
> niggly little warnings.
> 
> v1 => v2:
>   - Added tags
>   - Satisfied Miquel's review comments
> 

You probably missed my request to update the titles. That's why I
wanted the entire series to be resent. Anyway, as I forgot a few,
please find below the prefixes that should be used:

> Lee Jones (23):
>   mtd: mtdpart: Fix misdocumented function parameter 'mtd'
>   mtd: devices: phram: File headers are not good candidates for
> kernel-doc
>   mtd: nand: onenand: onenand_base: Fix expected kernel-doc formatting

mtd: onenand: Fix...

>   mtd: devices: docg3: Fix kernel-doc 'bad line' and 'excessive doc'
> issues
>   mtd: mtdcore: Fix misspelled function parameter 'section'

mtd: Fix...

>   mtd: nand: onenand: onenand_bbt: Fix expected kernel-doc formatting

mtd: onenand: Fix...

>   mtd: spi-nor: controllers: hisi-sfc: Demote non-conformant kernel-doc

mtd: spi-nor: hisi-sfc: Demote...

>   mtd: ubi: build: Document 'ubi_num' in struct mtd_dev_param
>   mtd: nand: spi: toshiba: Demote non-conformant kernel-doc header

mtd: spinand: toshiba: Demote...

>   mtd: ubi: kapi: Correct documentation for 'ubi_leb_read_sg's 'sgl'
> parameter
>   mtd: ubi: eba: Fix a couple of misdocumentation issues
>   mtd: ubi: wl: Fix a couple of kernel-doc issues
>   mtd: nand: raw: brcmnand: brcmnand: Demote non-conformant kernel-doc
> headers

mtd: rawnand: brcmnand: Demote...

>   mtd: ubi: gluebi: Fix misnamed function parameter documentation
>   mtd: nand: raw: diskonchip: Marking unused variables as
> __always_unused

mtd: rawnand: diskonchip: Marking...

>   mtd: nand: raw: cafe_nand: Remove superfluous param doc and add
> another

mtd: rawnand: cafe: Remove

>   mtd: nand: raw: s3c2410: Add documentation for 2 missing struct
> members

mtd: rawnand: s3c2410: Add...

>   mtd: nand: raw: omap_elm: Finish half populated function header,
> demote empty ones

mtd: rawnand: omap_elm: Finish

>   mtd: nand: raw: omap2: Fix a bunch of kernel-doc misdemeanours

mtd:r rawnand: omap2: Fix

>   mtd: nand: raw: sunxi_nand: Document 'sunxi_nfc's 'caps' member

mtd: rawnand: sunxi: Document

>   mtd: nand: raw: arasan-nand-controller: Document 'anfc_op's 'buf'
> member

mtd: rawnand: arasan: Document

>   mtd: nand: onenand: onenand_base: Fix some kernel-doc misdemeanours

mtd: onenand: Fix

>   mtd: devices: powernv_flash: Add function names to headers and fix
> 'dev'

Otherwise the content of the series looks good to me.

Thanks,
Miquèl
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/gma500: Remove unused function psb_gem_get_aperture()

2020-11-09 Thread Patrik Jakobsson
On Fri, Nov 6, 2020 at 1:42 PM Thomas Zimmermann  wrote:
>
> Apparently, the function was never used at all.
>
> Signed-off-by: Thomas Zimmermann 

Thanks Thomas,

As agreed, please apply to drm-misc-next

-Patrik

> ---
>  drivers/gpu/drm/gma500/gem.c | 6 --
>  drivers/gpu/drm/gma500/psb_drv.h | 2 --
>  2 files changed, 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/gma500/gem.c b/drivers/gpu/drm/gma500/gem.c
> index 8f07de83b6fb..db827e591403 100644
> --- a/drivers/gpu/drm/gma500/gem.c
> +++ b/drivers/gpu/drm/gma500/gem.c
> @@ -32,12 +32,6 @@ static void psb_gem_free_object(struct drm_gem_object *obj)
> psb_gtt_free_range(obj->dev, gtt);
>  }
>
> -int psb_gem_get_aperture(struct drm_device *dev, void *data,
> -   struct drm_file *file)
> -{
> -   return -EINVAL;
> -}
> -
>  static const struct vm_operations_struct psb_gem_vm_ops = {
> .fault = psb_gem_fault,
> .open = drm_gem_vm_open,
> diff --git a/drivers/gpu/drm/gma500/psb_drv.h 
> b/drivers/gpu/drm/gma500/psb_drv.h
> index c71a5a4e912c..ce6aae4b1bb2 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.h
> +++ b/drivers/gpu/drm/gma500/psb_drv.h
> @@ -735,8 +735,6 @@ extern const struct drm_connector_helper_funcs
>  extern const struct drm_connector_funcs psb_intel_lvds_connector_funcs;
>
>  /* gem.c */
> -extern int psb_gem_get_aperture(struct drm_device *dev, void *data,
> -   struct drm_file *file);
>  extern int psb_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
> struct drm_mode_create_dumb *args);
>
> --
> 2.29.0
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/4] drm/ttm: add multihop infrastrucutre (v2)

2020-11-09 Thread Christian König

Am 09.11.20 um 01:54 schrieb Dave Airlie:

From: Dave Airlie 

Currently drivers get called to move a buffer, but if they have to
move it temporarily through another space (SYSTEM->VRAM via TT)
then they can end up with a lot of ttm->driver->ttm call stacks,
if the temprorary space moves requires eviction.

Instead of letting the driver do all the placement/space for the
temporary, allow it to report back (-EMULTIHOP) and a placement (hop)
to the move code, which will then do the temporary move, and the
correct placement move afterwards.

This removes a lot of code from drivers, at the expense of
adding some midlayering. I've some further ideas on how to turn
it inside out, but I think this is a good solution to the call
stack problems.

v2: separate out the driver patches, add WARN for getting
MULTHOP in paths we shouldn't (Daniel)

Signed-off-by: Dave Airlie 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c|  3 +-
  drivers/gpu/drm/drm_gem_vram_helper.c  |  3 +-
  drivers/gpu/drm/nouveau/nouveau_bo.c   |  3 +-
  drivers/gpu/drm/qxl/qxl_ttm.c  |  3 +-
  drivers/gpu/drm/radeon/radeon_ttm.c|  3 +-
  drivers/gpu/drm/ttm/ttm_bo.c   | 68 +++---
  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c |  3 +-
  include/drm/ttm/ttm_bo_driver.h|  7 ++-
  8 files changed, 77 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index c01c060e4ac5..ce0d82802333 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -656,7 +656,8 @@ static bool amdgpu_mem_visible(struct amdgpu_device *adev,
   */
  static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
  struct ttm_operation_ctx *ctx,
- struct ttm_resource *new_mem)
+ struct ttm_resource *new_mem,
+ struct ttm_place *hop)
  {
struct amdgpu_device *adev;
struct amdgpu_bo *abo;
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c 
b/drivers/gpu/drm/drm_gem_vram_helper.c
index 16d68c04ea5d..2cec7b1482b8 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -964,7 +964,8 @@ static void bo_driver_delete_mem_notify(struct 
ttm_buffer_object *bo)
  static int bo_driver_move(struct ttm_buffer_object *bo,
  bool evict,
  struct ttm_operation_ctx *ctx,
- struct ttm_resource *new_mem)
+ struct ttm_resource *new_mem,
+ struct ttm_place *hop)
  {
struct drm_gem_vram_object *gbo;
  
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c

index 8133377d865d..fee07b9d19ed 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1023,7 +1023,8 @@ nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo,
  static int
  nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
struct ttm_operation_ctx *ctx,
-   struct ttm_resource *new_reg)
+   struct ttm_resource *new_reg,
+   struct ttm_place *hop)
  {
struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
struct nouveau_bo *nvbo = nouveau_bo(bo);
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index a80d59634143..128c38c8a837 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -140,7 +140,8 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
  
  static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,

   struct ttm_operation_ctx *ctx,
-  struct ttm_resource *new_mem)
+  struct ttm_resource *new_mem,
+  struct ttm_place *hop)
  {
struct ttm_resource *old_mem = &bo->mem;
int ret;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index 95038ac3382e..29062dbea299 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -303,7 +303,8 @@ static int radeon_move_ram_vram(struct ttm_buffer_object 
*bo,
  
  static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,

  struct ttm_operation_ctx *ctx,
- struct ttm_resource *new_mem)
+ struct ttm_resource *new_mem,
+ struct ttm_place *hop)
  {
struct radeon_device *rdev;
struct radeon_bo *rbo;
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index e2a124b3affb..9f840f2a7836 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -231,7 +231,8 @@ EXPORT_SYMBOL(ttm_bo_bulk_move_lru_tail);
  
  static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,

  s

Re: [PATCH 2/4] drm/amdgpu/ttm: use multihop

2020-11-09 Thread Christian König

Am 09.11.20 um 01:54 schrieb Dave Airlie:

From: Dave Airlie 

This removes the code to move resources directly between
SYSTEM and VRAM in favour of using the core ttm mulithop code.

Signed-off-by: Dave Airlie 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 136 +++-
  1 file changed, 13 insertions(+), 123 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index ce0d82802333..e1458d575aa9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -512,119 +512,6 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
return r;
  }
  
-/**

- * amdgpu_move_vram_ram - Copy VRAM buffer to RAM buffer
- *
- * Called by amdgpu_bo_move().
- */
-static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
-   struct ttm_operation_ctx *ctx,
-   struct ttm_resource *new_mem)
-{
-   struct ttm_resource *old_mem = &bo->mem;
-   struct ttm_resource tmp_mem;
-   struct ttm_place placements;
-   struct ttm_placement placement;
-   int r;
-
-   /* create space/pages for new_mem in GTT space */
-   tmp_mem = *new_mem;
-   tmp_mem.mm_node = NULL;
-   placement.num_placement = 1;
-   placement.placement = &placements;
-   placement.num_busy_placement = 1;
-   placement.busy_placement = &placements;
-   placements.fpfn = 0;
-   placements.lpfn = 0;
-   placements.mem_type = TTM_PL_TT;
-   placements.flags = 0;
-   r = ttm_bo_mem_space(bo, &placement, &tmp_mem, ctx);
-   if (unlikely(r)) {
-   pr_err("Failed to find GTT space for blit from VRAM\n");
-   return r;
-   }
-
-   r = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
-   if (unlikely(r))
-   goto out_cleanup;
-
-   /* Bind the memory to the GTT space */
-   r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, &tmp_mem);
-   if (unlikely(r)) {
-   goto out_cleanup;
-   }
-
-   /* blit VRAM to GTT */
-   r = amdgpu_move_blit(bo, evict, &tmp_mem, old_mem);
-   if (unlikely(r)) {
-   goto out_cleanup;
-   }
-
-   r = ttm_bo_wait_ctx(bo, ctx);
-   if (unlikely(r))
-   goto out_cleanup;
-
-   amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm);
-   ttm_resource_free(bo, &bo->mem);
-   ttm_bo_assign_mem(bo, new_mem);
-out_cleanup:
-   ttm_resource_free(bo, &tmp_mem);
-   return r;
-}
-
-/**
- * amdgpu_move_ram_vram - Copy buffer from RAM to VRAM
- *
- * Called by amdgpu_bo_move().
- */
-static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict,
-   struct ttm_operation_ctx *ctx,
-   struct ttm_resource *new_mem)
-{
-   struct ttm_resource *old_mem = &bo->mem;
-   struct ttm_resource tmp_mem;
-   struct ttm_placement placement;
-   struct ttm_place placements;
-   int r;
-
-   /* make space in GTT for old_mem buffer */
-   tmp_mem = *new_mem;
-   tmp_mem.mm_node = NULL;
-   placement.num_placement = 1;
-   placement.placement = &placements;
-   placement.num_busy_placement = 1;
-   placement.busy_placement = &placements;
-   placements.fpfn = 0;
-   placements.lpfn = 0;
-   placements.mem_type = TTM_PL_TT;
-   placements.flags = 0;
-   r = ttm_bo_mem_space(bo, &placement, &tmp_mem, ctx);
-   if (unlikely(r)) {
-   pr_err("Failed to find GTT space for blit to VRAM\n");
-   return r;
-   }
-
-   /* move/bind old memory to GTT space */
-   r = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
-   if (unlikely(r))
-   return r;
-
-   r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, &tmp_mem);
-   if (unlikely(r)) {
-   goto out_cleanup;
-   }
-
-   ttm_bo_assign_mem(bo, &tmp_mem);
-   /* copy to VRAM */
-   r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
-   if (unlikely(r)) {
-   goto out_cleanup;
-   }
-out_cleanup:
-   ttm_resource_free(bo, &tmp_mem);
-   return r;
-}
-
  /**
   * amdgpu_mem_visible - Check that memory can be accessed by 
ttm_bo_move_memcpy
   *
@@ -664,6 +551,17 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, 
bool evict,
struct ttm_resource *old_mem = &bo->mem;
int r;
  
+	if ((old_mem->mem_type == TTM_PL_SYSTEM &&

+new_mem->mem_type == TTM_PL_VRAM) ||
+   (old_mem->mem_type == TTM_PL_VRAM &&
+new_mem->mem_type == TTM_PL_SYSTEM)) {
+   hop->fpfn = 0;
+   hop->lpfn = 0;
+   hop->mem_type = TTM_PL_TT;
+   hop->flags = 0;
+   return -EMULTIHOP;
+   }
+
if (new_mem->mem_type == TTM_PL_TT) {
r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, new_mem);
if (r)
@@ -717

Re: [PATCH 6/7] drm/panfrost: dev_pm_opp_put_*() accepts NULL argument

2020-11-09 Thread Steven Price

On 06/11/2020 07:03, Viresh Kumar wrote:

The dev_pm_opp_put_*() APIs now accepts a NULL opp_table pointer and so
there is no need for us to carry the extra check. Drop them.

Signed-off-by: Viresh Kumar 


Reviewed-by: Steven Price 


---
  drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c 
b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index 8ab025d0035f..97b5abc7c188 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -170,10 +170,8 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev)
pfdevfreq->opp_of_table_added = false;
}
  
-	if (pfdevfreq->regulators_opp_table) {

-   dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
-   pfdevfreq->regulators_opp_table = NULL;
-   }
+   dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
+   pfdevfreq->regulators_opp_table = NULL;
  }
  
  void panfrost_devfreq_resume(struct panfrost_device *pfdev)




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


Re: [PATCH v3 25/56] drm/omap: dsi: move TE GPIO handling into core

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:02PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> In preparation for removing custom DSS calls from the DSI
> panel driver, this moves support for external tearing event
> GPIOs into the DSI host driver. This way tearing events are
> always handled in the core resulting in simplification of
> the panel drivers.
> 
> The TE GPIO acquisition follows works in the same way as the
> exynos DSI implementation.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 101 +
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 138 --
>  2 files changed, 133 insertions(+), 106 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 8890ee2ba830..43f63b5a120b 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -54,7 +54,6 @@ struct panel_drv_data {
>  
>   /* panel HW configuration from DT or platform data */
>   struct gpio_desc *reset_gpio;
> - struct gpio_desc *ext_te_gpio;
>  
>   struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
> @@ -68,10 +67,6 @@ struct panel_drv_data {
>  
>   bool te_enabled;
>  
> - atomic_t do_update;
> -
> - struct delayed_work te_timeout_work;
> -
>   bool intro_printed;
>  
>   struct workqueue_struct *workqueue;
> @@ -83,8 +78,6 @@ struct panel_drv_data {
>  
>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>  
> -static irqreturn_t dsicm_te_isr(int irq, void *data);
> -static void dsicm_te_timeout_work_callback(struct work_struct *work);
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
>  static int dsicm_panel_reset(struct panel_drv_data *ddata);
> @@ -240,9 +233,6 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> - if (ddata->ext_te_gpio)
> - disable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> -
>   src->ops->dsi.disable(src, false, true);
>  
>   ddata->ulps_enabled = true;
> @@ -271,15 +261,12 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>   src->ops->enable(src);
>   ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
> - r = _dsicm_enable_te(ddata, true);
> + r = _dsicm_enable_te(ddata, ddata->te_enabled);
>   if (r) {
>   dev_err(&ddata->dsi->dev, "failed to re-enable TE");
>   goto err2;
>   }
>  
> - if (ddata->ext_te_gpio)
> - enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> -
>   dsicm_queue_ulps_work(ddata);
>  
>   ddata->ulps_enabled = false;
> @@ -290,11 +277,8 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>   dev_err(&ddata->dsi->dev, "failed to exit ULPS");
>  
>   r = dsicm_panel_reset(ddata);
> - if (!r) {
> - if (ddata->ext_te_gpio)
> - enable_irq(gpiod_to_irq(ddata->ext_te_gpio));
> + if (!r)
>   ddata->ulps_enabled = false;
> - }
>  
>   dsicm_queue_ulps_work(ddata);
>  
> @@ -745,43 +729,6 @@ static void dsicm_framedone_cb(int err, void *data)
>   src->ops->dsi.bus_unlock(src);
>  }
>  
> -static irqreturn_t dsicm_te_isr(int irq, void *data)
> -{
> - struct panel_drv_data *ddata = data;
> - struct omap_dss_device *src = ddata->src;
> - int old;
> - int r;
> -
> - old = atomic_cmpxchg(&ddata->do_update, 1, 0);
> -
> - if (old) {
> - cancel_delayed_work(&ddata->te_timeout_work);
> -
> - r = src->ops->dsi.update(src, ddata->dsi->channel, 
> dsicm_framedone_cb,
> - ddata);
> - if (r)
> - goto err;
> - }
> -
> - return IRQ_HANDLED;
> -err:
> - dev_err(&ddata->dsi->dev, "start update failed\n");
> - src->ops->dsi.bus_unlock(src);
> - return IRQ_HANDLED;
> -}
> -
> -static void dsicm_te_timeout_work_callback(struct work_struct *work)
> -{
> - struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> - te_timeout_work.work);
> - struct omap_dss_device *src = ddata->src;
> -
> - dev_err(&ddata->dsi->dev, "TE not received for 250ms!\n");
> -
> - atomic_set(&ddata->do_update, 0);
> - src->ops->dsi.bus_unlock(src);
> -}
> -
>  static int dsicm_update(struct omap_dss_device *dssdev,
>   u16 x, u16 y, u16 w, u16 h)
>  {
> @@ -809,16 +756,10 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>   if (r)
>   goto err;
>  
> - if (ddata->te_enabled && ddata->ext_te_gpio) {
> - schedule_delayed_work(&ddata->te_timeout_work,
> - msecs_to_jiffies(250));
> - atomic_set(&ddata->do_u

Re: [PATCH v3 26/56] drm/omap: dsi: drop custom enable_te() API

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:03PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Instead of using the custon enable_te() API, this automatically

s/custon/custom/

> enables/disables TE core support when a matching packet is send

s/send/sent/

> to the panel.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  3 --
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 34 ++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 --
>  3 files changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 43f63b5a120b..dc2c045cc6b0 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -772,7 +772,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
> - struct omap_dss_device *src = ddata->src;
>   struct mipi_dsi_device *dsi = ddata->dsi;
>   int r;
>  
> @@ -781,8 +780,6 @@ static int _dsicm_enable_te(struct panel_drv_data *ddata, 
> bool enable)
>   else
>   r = mipi_dsi_dcs_set_tear_off(dsi);
>  
> - src->ops->dsi.enable_te(src, enable);
> -
>   /* possible panel bug */
>   msleep(100);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 921e7a1e1014..41431ca34568 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4110,10 +4110,8 @@ static void dsi_display_disable(struct omap_dss_device 
> *dssdev,
>   mutex_unlock(&dsi->lock);
>  }
>  
> -static int dsi_enable_te(struct omap_dss_device *dssdev, bool enable)
> +static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
>   dsi->te_enabled = enable;
>  
>   if (dsi->te_gpio) {
> @@ -4723,6 +4721,7 @@ static ssize_t omap_dsi_host_transfer(struct 
> mipi_dsi_host *host,
>  {
>   struct dsi_data *dsi = host_to_omap(host);
>   struct omap_dss_device *dssdev = &dsi->output;
> + int r;
>  
>   if (!!(msg->flags & MIPI_DSI_MSG_USE_LPM) != dsi->in_lp_mode) {
>   dsi_vc_enable_hs(dssdev, msg->channel,
> @@ -4739,16 +4738,35 @@ static ssize_t omap_dsi_host_transfer(struct 
> mipi_dsi_host *host,
>   case MIPI_DSI_DCS_LONG_WRITE:
>   case MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE:
>   case MIPI_DSI_NULL_PACKET:
> - return dsi_vc_write_common(dssdev, msg);
> + r = dsi_vc_write_common(dssdev, msg);
> + break;
>   case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>   case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
>   case MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM:
> - return dsi_vc_generic_read(dssdev, msg);
> + r = dsi_vc_generic_read(dssdev, msg);
> + break;
>   case MIPI_DSI_DCS_READ:
> - return dsi_vc_dcs_read(dssdev, msg);
> + r = dsi_vc_dcs_read(dssdev, msg);
> + break;
> + default:
> + r = -EINVAL;
> + break;
>   }
>  
> - return -EINVAL;
> + if (r < 0)
> + return r;
> +
> + if (msg->type == MIPI_DSI_DCS_SHORT_WRITE ||
> + msg->type == MIPI_DSI_DCS_SHORT_WRITE_PARAM) {
> + u8 cmd = ((u8 *)msg->tx_buf)[0];
> +
> + if (cmd == MIPI_DCS_SET_TEAR_OFF)
> + dsi_enable_te(dsi, false);
> + else if (cmd == MIPI_DCS_SET_TEAR_ON)
> + dsi_enable_te(dsi, true);
> + }
> +
> + return 0;
>  }
>  
>  static int dsi_get_clocks(struct dsi_data *dsi)
> @@ -4795,8 +4813,6 @@ static const struct omap_dss_device_ops dsi_ops = {
>   .disable_video_output = dsi_disable_video_output,
>  
>   .update = dsi_update,
> -
> - .enable_te = dsi_enable_te,
>   },
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 2d44a8e32fcc..1520a5f752b7 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -288,8 +288,6 @@ struct omapdss_dsi_ops {
>   int (*set_config)(struct omap_dss_device *dssdev,
>   const struct omap_dss_dsi_config *cfg);
>  
> - int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
> -
>   int (*update)(struct omap_dss_device *dssdev, int channel,
>   void (*callback)(int, void *), void *data);
>  

-- 
Regards,

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


[PATCH] drm/ast: Create chip AST2600

2020-11-09 Thread KuoHsiang Chou
[New] Support AST2600

Signed-off-by: KuoHsiang Chou 
---
 drivers/gpu/drm/ast/ast_drv.h  | 1 +
 drivers/gpu/drm/ast/ast_main.c | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 467049ca8430..6b9e3b94a712 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -63,6 +63,7 @@ enum ast_chip {
AST2300,
AST2400,
AST2500,
+   AST2600,
 };

 enum ast_tx_chip {
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 77066bca8793..4ec6884f6c65 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -143,7 +143,10 @@ static int ast_detect_chip(struct drm_device *dev, bool 
*need_post)
ast_detect_config_mode(dev, &scu_rev);

/* Identify chipset */
-   if (dev->pdev->revision >= 0x40) {
+   if (dev->pdev->revision >= 0x50) {
+   ast->chip = AST2600;
+   drm_info(dev, "AST 2600 detected\n");
+   } else if (dev->pdev->revision >= 0x40) {
ast->chip = AST2500;
drm_info(dev, "AST 2500 detected\n");
} else if (dev->pdev->revision >= 0x30) {
--
2.18.4

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


Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This moves the bus locking into the host driver and unexports
> the custom API in preparation for drm_panel support.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 46 +--
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 33 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 --
>  3 files changed, 23 insertions(+), 59 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index dc2c045cc6b0..4be0c9dbcc43 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -298,7 +298,6 @@ static int dsicm_wake_up(struct panel_drv_data *ddata)
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> - struct omap_dss_device *src = ddata->src;
>   int r = 0;
>   int level;
>  
> @@ -313,15 +312,11 @@ static int dsicm_bl_update_status(struct 
> backlight_device *dev)
>   mutex_lock(&ddata->lock);
>  
>   if (ddata->enabled) {
> - src->ops->dsi.bus_lock(src);
> -
>   r = dsicm_wake_up(ddata);
>   if (!r) {
>   r = dsicm_dcs_write_1(ddata,
>   MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
>   }
> -
> - src->ops->dsi.bus_unlock(src);
>   }
>  
>   mutex_unlock(&ddata->lock);
> @@ -347,21 +342,16 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
> - struct omap_dss_device *src = ddata->src;
>   u8 errors = 0;
>   int r;
>  
>   mutex_lock(&ddata->lock);
>  
>   if (ddata->enabled) {
> - src->ops->dsi.bus_lock(src);
> -
>   r = dsicm_wake_up(ddata);
>   if (!r)
>   r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
>   &errors);
> -
> - src->ops->dsi.bus_unlock(src);
>   } else {
>   r = -ENODEV;
>   }
> @@ -378,20 +368,15 @@ static ssize_t dsicm_hw_revision_show(struct device 
> *dev,
>   struct device_attribute *attr, char *buf)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
> - struct omap_dss_device *src = ddata->src;
>   u8 id1, id2, id3;
>   int r;
>  
>   mutex_lock(&ddata->lock);
>  
>   if (ddata->enabled) {
> - src->ops->dsi.bus_lock(src);
> -
>   r = dsicm_wake_up(ddata);
>   if (!r)
>   r = dsicm_get_id(ddata, &id1, &id2, &id3);
> -
> - src->ops->dsi.bus_unlock(src);
>   } else {
>   r = -ENODEV;
>   }
> @@ -409,7 +394,6 @@ static ssize_t dsicm_store_ulps(struct device *dev,
>   const char *buf, size_t count)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
> - struct omap_dss_device *src = ddata->src;
>   unsigned long t;
>   int r;
>  
> @@ -420,14 +404,10 @@ static ssize_t dsicm_store_ulps(struct device *dev,
>   mutex_lock(&ddata->lock);
>  
>   if (ddata->enabled) {
> - src->ops->dsi.bus_lock(src);
> -
>   if (t)
>   r = dsicm_enter_ulps(ddata);
>   else
>   r = dsicm_wake_up(ddata);
> -
> - src->ops->dsi.bus_unlock(src);
>   }
>  
>   mutex_unlock(&ddata->lock);
> @@ -457,7 +437,6 @@ static ssize_t dsicm_store_ulps_timeout(struct device 
> *dev,
>   const char *buf, size_t count)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
> - struct omap_dss_device *src = ddata->src;
>   unsigned long t;
>   int r;
>  
> @@ -470,9 +449,7 @@ static ssize_t dsicm_store_ulps_timeout(struct device 
> *dev,
>  
>   if (ddata->enabled) {
>   /* dsicm_wake_up will restart the timer */
> - src->ops->dsi.bus_lock(src);
>   r = dsicm_wake_up(ddata);
> - src->ops->dsi.bus_unlock(src);
>   }
>  
>   mutex_unlock(&ddata->lock);
> @@ -673,17 +650,11 @@ static void dsicm_disconnect(struct omap_dss_device 
> *src,
>  static void dsicm_enable(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *src = ddata->src;
>   int r;
>  
>   mutex_lock(&ddata->lock);
>  
> - src->ops->dsi.bus_lock(src);
> -
>   r = dsicm_power_on(ddata);
> -
> - src->ops->dsi.bus_unlock(src);
> -
>   if (r)
>   goto err;
>  
> @@ -700,7 +671,6 @@ static void dsicm_enable(struct omap_dss_device *dssdev)
>  s

Re: [PATCH v3 28/56] drm/omap: dsi: untangle ulps ops from enable/disable

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:05PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Create a custom function pointer for ULPS and use it instead of
> reusing disable/enable functions for ULPS mode switch. This allows
> us to use the common disable/enable functions pointers for DSI.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  8 ++--
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 42 ++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  5 +--
>  3 files changed, 38 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 4be0c9dbcc43..78247dcb1848 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -233,7 +233,7 @@ static int dsicm_enter_ulps(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> - src->ops->dsi.disable(src, false, true);
> + src->ops->dsi.ulps(src, true);
>  
>   ddata->ulps_enabled = true;
>  
> @@ -258,7 +258,7 @@ static int dsicm_exit_ulps(struct panel_drv_data *ddata)
>   if (!ddata->ulps_enabled)
>   return 0;
>  
> - src->ops->enable(src);
> + src->ops->dsi.ulps(src, false);
>   ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
>  
>   r = _dsicm_enable_te(ddata, ddata->te_enabled);
> @@ -586,7 +586,7 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>   dsicm_hw_reset(ddata);
>  
> - src->ops->dsi.disable(src, true, false);
> + src->ops->disable(src);
>  err_regulators:
>   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>   if (r)
> @@ -612,7 +612,7 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>   dsicm_hw_reset(ddata);
>   }
>  
> - src->ops->dsi.disable(src, true, false);
> + src->ops->disable(src);
>  
>   r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>   if (r)
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d54b743c2b48..937362ade4b4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4055,13 +4055,10 @@ static void dsi_display_uninit_dsi(struct dsi_data 
> *dsi, bool disconnect_lanes,
>   }
>  }
>  
> -static void dsi_display_enable(struct omap_dss_device *dssdev)
> +static void dsi_display_ulps_enable(struct dsi_data *dsi)
>  {
> - struct dsi_data *dsi = to_dsi_data(dssdev);
>   int r;
>  
> - DSSDBG("dsi_display_enable\n");
> -
>   WARN_ON(!dsi_bus_is_locked(dsi));
>  
>   mutex_lock(&dsi->lock);
> @@ -4084,16 +4081,19 @@ static void dsi_display_enable(struct omap_dss_device 
> *dssdev)
>   dsi_runtime_put(dsi);
>  err_get_dsi:
>   mutex_unlock(&dsi->lock);
> - DSSDBG("dsi_display_enable FAILED\n");
> + DSSDBG("dsi_display_ulps_enable FAILED\n");
>  }
>  
> -static void dsi_display_disable(struct omap_dss_device *dssdev,
> - bool disconnect_lanes, bool enter_ulps)
> +static void dsi_display_enable(struct omap_dss_device *dssdev)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
> + DSSDBG("dsi_display_enable\n");
> + dsi_display_ulps_enable(dsi);
> +}
>  
> - DSSDBG("dsi_display_disable\n");
> -
> +static void dsi_display_ulps_disable(struct dsi_data *dsi,
> + bool disconnect_lanes, bool enter_ulps)
> +{
>   WARN_ON(!dsi_bus_is_locked(dsi));
>  
>   mutex_lock(&dsi->lock);
> @@ -4110,6 +4110,27 @@ static void dsi_display_disable(struct omap_dss_device 
> *dssdev,
>   mutex_unlock(&dsi->lock);
>  }
>  
> +static void dsi_display_disable(struct omap_dss_device *dssdev)
> +{
> + struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> + DSSDBG("dsi_display_disable\n");
> +
> + dsi_display_ulps_disable(dsi, true, false);
> +}
> +
> +static void dsi_ulps(struct omap_dss_device *dssdev, bool enable)
> +{
> + struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> + DSSDBG("dsi_ulps\n");
> +
> + if (enable)
> + dsi_display_ulps_disable(dsi, false, true);
> + else
> + dsi_display_ulps_enable(dsi);

The names are fairly confusing. I would expect
dsi_display_ulps_disable() to disable ULPS mode.

> +}
> +
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
>   dsi->te_enabled = enable;
> @@ -4812,9 +4833,10 @@ static const struct omap_dss_device_ops dsi_ops = {
>   .connect = dsi_connect,
>   .disconnect = dsi_disconnect,
>   .enable = dsi_display_enable,
> + .disable = dsi_display_disable,
>  
>   .dsi = {
> - .disable = dsi_display_disable,
> + .ulps = dsi_ulps,
>  
>   .set_config = dsi_set_config,
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/dri

Re: [PATCH v3 29/56] drm/omap: dsi: do ULPS in host driver

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:06PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Move ULPS handling into the DSI host controller, so that we
> no longer need a custom API for the DSI client.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 273 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.c |  63 +++-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   2 -
>  3 files changed, 62 insertions(+), 276 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 78247dcb1848..030a8fa140db 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -16,7 +16,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  
> @@ -69,21 +68,13 @@ struct panel_drv_data {
>  
>   bool intro_printed;
>  
> - struct workqueue_struct *workqueue;
> -
>   bool ulps_enabled;
> - unsigned int ulps_timeout;
> - struct delayed_work ulps_work;
>  };
>  
>  #define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
> -static int dsicm_panel_reset(struct panel_drv_data *ddata);
> -
> -static void dsicm_ulps_work(struct work_struct *work);
> -
>  static void dsicm_bl_power(struct panel_drv_data *ddata, bool enable)
>  {
>   struct backlight_device *backlight;
> @@ -207,94 +198,6 @@ static int dsicm_set_update_window(struct panel_drv_data 
> *ddata,
>   return 0;
>  }
>  
> -static void dsicm_queue_ulps_work(struct panel_drv_data *ddata)
> -{
> - if (ddata->ulps_timeout > 0)
> - queue_delayed_work(ddata->workqueue, &ddata->ulps_work,
> - msecs_to_jiffies(ddata->ulps_timeout));
> -}
> -
> -static void dsicm_cancel_ulps_work(struct panel_drv_data *ddata)
> -{
> - cancel_delayed_work(&ddata->ulps_work);
> -}
> -
> -static int dsicm_enter_ulps(struct panel_drv_data *ddata)
> -{
> - struct omap_dss_device *src = ddata->src;
> - int r;
> -
> - if (ddata->ulps_enabled)
> - return 0;
> -
> - dsicm_cancel_ulps_work(ddata);
> -
> - r = _dsicm_enable_te(ddata, false);
> - if (r)
> - goto err;
> -
> - src->ops->dsi.ulps(src, true);
> -
> - ddata->ulps_enabled = true;
> -
> - return 0;
> -
> -err:
> - dev_err(&ddata->dsi->dev, "enter ULPS failed");
> - dsicm_panel_reset(ddata);
> -
> - ddata->ulps_enabled = false;
> -
> - dsicm_queue_ulps_work(ddata);
> -
> - return r;
> -}
> -
> -static int dsicm_exit_ulps(struct panel_drv_data *ddata)
> -{
> - struct omap_dss_device *src = ddata->src;
> - int r;
> -
> - if (!ddata->ulps_enabled)
> - return 0;
> -
> - src->ops->dsi.ulps(src, false);
> - ddata->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> -
> - r = _dsicm_enable_te(ddata, ddata->te_enabled);
> - if (r) {
> - dev_err(&ddata->dsi->dev, "failed to re-enable TE");
> - goto err2;
> - }
> -
> - dsicm_queue_ulps_work(ddata);
> -
> - ddata->ulps_enabled = false;
> -
> - return 0;
> -
> -err2:
> - dev_err(&ddata->dsi->dev, "failed to exit ULPS");
> -
> - r = dsicm_panel_reset(ddata);
> - if (!r)
> - ddata->ulps_enabled = false;
> -
> - dsicm_queue_ulps_work(ddata);
> -
> - return r;
> -}
> -
> -static int dsicm_wake_up(struct panel_drv_data *ddata)
> -{
> - if (ddata->ulps_enabled)
> - return dsicm_exit_ulps(ddata);
> -
> - dsicm_cancel_ulps_work(ddata);
> - dsicm_queue_ulps_work(ddata);
> - return 0;
> -}
> -
>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> @@ -312,11 +215,8 @@ static int dsicm_bl_update_status(struct 
> backlight_device *dev)
>   mutex_lock(&ddata->lock);
>  
>   if (ddata->enabled) {
> - r = dsicm_wake_up(ddata);
> - if (!r) {
> - r = dsicm_dcs_write_1(ddata,
> - MIPI_DCS_SET_DISPLAY_BRIGHTNESS, level);
> - }
> + r = dsicm_dcs_write_1(ddata, MIPI_DCS_SET_DISPLAY_BRIGHTNESS,
> +   level);
>   }
>  
>   mutex_unlock(&ddata->lock);
> @@ -343,18 +243,12 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
>   u8 errors = 0;
> - int r;
> + int r = -ENODEV;
>  
>   mutex_lock(&ddata->lock);
>  
> - if (ddata->enabled) {
> - r = dsicm_wake_up(ddata);
> - if (!r)
> - r = dsicm_dcs_read_1(ddata, DCS_READ_NUM_ERRORS,
> - &errors);
> -  

Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:07PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This moves the panel refresh/update function from the panel
> driver into the DSI host driver to prepare for common drm_panel
> support.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  68 
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 101 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  13 +--
>  drivers/gpu/drm/omapdrm/omap_crtc.c   |  11 +-
>  4 files changed, 97 insertions(+), 96 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 030a8fa140db..1582960f9e90 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 
> *id1, u8 *id2, u8 *id3)
>   return 0;
>  }
>  
> -static int dsicm_set_update_window(struct panel_drv_data *ddata,
> - u16 x, u16 y, u16 w, u16 h)
> -{
> - struct mipi_dsi_device *dsi = ddata->dsi;
> - int r;
> - u16 x1 = x;
> - u16 x2 = x + w - 1;
> - u16 y1 = y;
> - u16 y2 = y + h - 1;
> -
> - r = mipi_dsi_dcs_set_column_address(dsi, x1, x2);
> - if (r < 0)
> - return r;
> -
> - r = mipi_dsi_dcs_set_page_address(dsi, y1, y2);
> - if (r < 0)
> - return r;
> -
> - return 0;
> -}
> -

I can't tell whether this is common to all command-mode panels, or if
there could be a need for panel-specific update procedures, so I can't
really ack this patch.

>  static int dsicm_bl_update_status(struct backlight_device *dev)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(&dev->dev);
> @@ -470,48 +449,6 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>   mutex_unlock(&ddata->lock);
>  }
>  
> -static void dsicm_framedone_cb(int err, void *data)
> -{
> - struct panel_drv_data *ddata = data;
> -
> - dev_dbg(&ddata->dsi->dev, "framedone, err %d\n", err);
> - mutex_unlock(&ddata->lock);
> -}
> -
> -static int dsicm_update(struct omap_dss_device *dssdev,
> - u16 x, u16 y, u16 w, u16 h)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *src = ddata->src;
> - int r;
> -
> - dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> -
> - mutex_lock(&ddata->lock);
> -
> - if (!ddata->enabled) {
> - r = 0;
> - goto err;
> - }
> -
> - /* XXX no need to send this every frame, but dsi break if not done */
> - r = dsicm_set_update_window(ddata, 0, 0, ddata->vm.hactive,
> - ddata->vm.vactive);
> - if (r)
> - goto err;
> -
> - r = src->ops->dsi.update(src, ddata->dsi->channel, dsicm_framedone_cb,
> - ddata);
> - if (r)
> - goto err;
> -
> - /* note: no unlock here. unlock is src framedone_cb */
> - return 0;
> -err:
> - mutex_unlock(&ddata->lock);
> - return r;
> -}
> -
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>   struct mipi_dsi_device *dsi = ddata->dsi;
> @@ -572,10 +509,6 @@ static const struct omap_dss_device_ops dsicm_ops = {
>   .check_timings  = dsicm_check_timings,
>  };
>  
> -static const struct omap_dss_driver dsicm_dss_driver = {
> - .update = dsicm_update,
> -};
> -
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
>   struct device_node *node = dsi->dev.of_node;
> @@ -658,7 +591,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   dssdev = &ddata->dssdev;
>   dssdev->dev = dev;
>   dssdev->ops = &dsicm_ops;
> - dssdev->driver = &dsicm_dss_driver;
>   dssdev->type = OMAP_DISPLAY_TYPE_DSI;
>   dssdev->display = true;
>   dssdev->owner = THIS_MODULE;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0f264654792d..0aa0d21cf896 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -214,6 +214,9 @@ static void dsi_display_uninit_dispc(struct dsi_data 
> *dsi);
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int channel);
>  
> +static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi,
> +const struct mipi_dsi_msg *msg);
> +
>  /* DSI PLL HSDIV indices */
>  #define HSDIV_DISPC  0
>  #define HSDIV_DSI1
> @@ -383,9 +386,6 @@ struct dsi_data {
>  
>   struct delayed_work ulps_work;
>  
> - void (*framedone_callback)(int, void *);
> - void *framedone_data;
> -
>   struct delayed_work framedone_timeout_work;
>  
>  #ifdef DSI_CATCH_MISSING_TE
> @@ -3802,8 +3802,6 @@ static void dsi_handle_framedo

Re: [PATCH v3 31/56] drm/omap: dsi: Reverse direction of the DSS device enable/disable operations

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:08PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Complete the direction reversal of the DSS device enable/disable
> operations started by 19b4200d8f4b ("drm/omap: Reverse direction
> of the DSS device enable/disable operations").
> 
> This effectively drops the requirement of calling DSS specific
> code from the DSI panel driver moving it a bit further to a
> standard drm_panel driver.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 74 +--
>  drivers/gpu/drm/omapdrm/omap_encoder.c| 24 ++
>  2 files changed, 45 insertions(+), 53 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 1582960f9e90..45d417870498 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -288,27 +288,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   struct omap_dss_device *src = ddata->src;
>   u8 id1, id2, id3;
>   int r;
> - struct omap_dss_dsi_config dsi_config = {
> - .vm = &ddata->vm,
> - .hs_clk_min = 15000,
> - .hs_clk_max = 3,
> - .lp_clk_min = 700,
> - .lp_clk_max = 1000,
> - };
> -
> - r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> - if (r) {
> - dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> - return r;
> - }
> -
> - r = src->ops->dsi.set_config(src, &dsi_config);
> - if (r) {
> - dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> - goto err_regulators;
> - }
> -
> - src->ops->enable(src);
>  
>   dsicm_hw_reset(ddata);
>  
> @@ -363,12 +342,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>  
>   dsicm_hw_reset(ddata);
>  
> - src->ops->disable(src);
> -err_regulators:
> - r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> - if (r)
> - dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", 
> r);
> -
>   return r;
>  }
>  
> @@ -377,6 +350,8 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>   struct omap_dss_device *src = ddata->src;
>   int r;
>  
> + ddata->enabled = false;
> +
>   src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
>  
>   r = mipi_dsi_dcs_set_display_off(ddata->dsi);
> @@ -388,14 +363,6 @@ static void dsicm_power_off(struct panel_drv_data *ddata)
>   "error disabling panel, issuing HW reset\n");
>   dsicm_hw_reset(ddata);
>   }
> -
> - src->ops->disable(src);
> -
> - r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> - if (r)
> - dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", 
> r);
> -
> - ddata->enabled = false;
>  }
>  
>  static int dsicm_connect(struct omap_dss_device *src,
> @@ -415,6 +382,29 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>   ddata->src = NULL;
>  }
>  
> +static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> +{
> + struct panel_drv_data *ddata = to_panel_data(dssdev);
> + struct omap_dss_device *src = ddata->src;
> + int r;
> + struct omap_dss_dsi_config dsi_config = {
> + .vm = &ddata->vm,
> + .hs_clk_min = 15000,
> + .hs_clk_max = 3,
> + .lp_clk_min = 700,
> + .lp_clk_max = 1000,
> + };
> +
> + r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> + if (r)
> + dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> +
> + r = src->ops->dsi.set_config(src, &dsi_config);
> + if (r) {
> + dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> + }
> +}
> +
>  static void dsicm_enable(struct omap_dss_device *dssdev)
>  {
>   struct panel_drv_data *ddata = to_panel_data(dssdev);
> @@ -449,6 +439,16 @@ static void dsicm_disable(struct omap_dss_device *dssdev)
>   mutex_unlock(&ddata->lock);
>  }
>  
> +static void dsicm_post_disable(struct omap_dss_device *dssdev)
> +{
> + struct panel_drv_data *ddata = to_panel_data(dssdev);
> + int r;
> +
> + r = regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> + if (r)
> + dev_err(&ddata->dsi->dev, "failed to disable supplies: %d\n", 
> r);
> +}
> +
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable)
>  {
>   struct mipi_dsi_device *dsi = ddata->dsi;
> @@ -502,8 +502,10 @@ static const struct omap_dss_device_ops dsicm_ops = {
>   .connect= dsicm_connect,
>   .disconnect = dsicm_disconnect,
>  
> + .pre_enable = dsicm_pre_e

Re: [PATCH] drm/ast: Fixed 1920x1080 sync. polarity issue

2020-11-09 Thread Thomas Zimmermann
Hi

Am 05.11.20 um 10:47 schrieb KuoHsiang Chou:
> [Bug] Change the vertical synchroous polary of 1920x1080 @60Hz
>   from  Negtive to Positive
> 
> Signed-off-by: KuoHsiang Chou 

I've merged this patch. Thanks!

Best regards
Thomas

> ---
>  drivers/gpu/drm/ast/ast_tables.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_tables.h 
> b/drivers/gpu/drm/ast/ast_tables.h
> index 8414e543f260..51efc5b4a55c 100644
> --- a/drivers/gpu/drm/ast/ast_tables.h
> +++ b/drivers/gpu/drm/ast/ast_tables.h
> @@ -295,10 +295,10 @@ static const struct ast_vbios_enhtable res_1600x900[] = 
> {
> 
>  static const struct ast_vbios_enhtable res_1920x1080[] = {
>   {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
> -  (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
> +  (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
> AST2500PreCatchCRT), 60, 1, 0x38 },
>   {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5,   /* 60Hz */
> -  (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
> +  (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo |
> AST2500PreCatchCRT), 0xFF, 1, 0x38 },
>  };
> 
> --
> 2.18.4
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 32/56] drm/omap: dsi: drop custom panel capability support

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:09PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Due to previous changes the DSI encoder gets the capabilities
> via DSI client's mode_flags and no longer needs the omapdss
> specific caps. The core code now checks if the DSI encoder
> is actually configured into command mode instead of just checking
> the panel capabilities.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c |  3 ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c   |  8 
>  drivers/gpu/drm/omapdrm/dss/omapdss.h   |  8 +---
>  drivers/gpu/drm/omapdrm/omap_crtc.c | 17 -
>  4 files changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 45d417870498..d9b3444b4faf 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -599,9 +599,6 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   dssdev->of_port = 0;
>   dssdev->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>  
> - dssdev->caps = OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE |
> - OMAP_DSS_DISPLAY_CAP_TEAR_ELIM;
> -
>   omapdss_display_init(dssdev);
>   omapdss_device_register(dssdev);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0aa0d21cf896..620cef8bb1f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -4727,6 +4727,13 @@ static bool dsi_vm_calc(struct dsi_data *dsi,
>   dsi_vm_calc_pll_cb, ctx);
>  }
>  
> +static bool dsi_is_video_mode(struct omap_dss_device *dssdev)
> +{
> + struct dsi_data *dsi = to_dsi_data(dssdev);
> +
> + return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);

No need for parentheses.

Reviewed-by: Laurent Pinchart 

> +}
> +
>  static int dsi_set_config(struct omap_dss_device *dssdev,
>   const struct omap_dss_dsi_config *config)
>  {
> @@ -4947,6 +4954,7 @@ static const struct omap_dss_device_ops dsi_ops = {
>   .disable_video_output = dsi_disable_video_output,
>  
>   .update = dsi_update_all,
> + .is_video_mode = dsi_is_video_mode,
>   },
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index de4c779c358a..4200611525d5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
>   OMAP_DSS_DSI_VIDEO_MODE,
>  };
>  
> -enum omap_display_caps {
> - OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE  = 1 << 0,
> - OMAP_DSS_DISPLAY_CAP_TEAR_ELIM  = 1 << 1,
> -};
> -
>  enum omap_dss_display_state {
>   OMAP_DSS_DISPLAY_DISABLED = 0,
>   OMAP_DSS_DISPLAY_ACTIVE,
> @@ -282,6 +277,7 @@ struct omap_dss_writeback_info {
>  
>  struct omapdss_dsi_ops {
>   int (*update)(struct omap_dss_device *dssdev);
> + bool (*is_video_mode)(struct omap_dss_device *dssdev);
>  
>   /* legacy API used by omapdss panels */
>   int (*set_config)(struct omap_dss_device *dssdev,
> @@ -354,8 +350,6 @@ struct omap_dss_device {
>   unsigned long ops_flags;
>   u32 bus_flags;
>  
> - enum omap_display_caps caps;
> -
>   enum omap_dss_display_state state;
>  
>   /* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
> b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 3068e4fffa16..f6b968060cf0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -496,8 +496,7 @@ static enum drm_mode_status omap_crtc_mode_valid(struct 
> drm_crtc *crtc,
>* valid DISPC mode. DSI will calculate and configure the
>* proper DISPC mode later.
>*/
> - if (omap_crtc->pipe->output->next == NULL ||
> - omap_crtc->pipe->output->next->type != OMAP_DISPLAY_TYPE_DSI) {
> + if (omap_crtc->pipe->output->type != OMAP_DISPLAY_TYPE_DSI) {
>   r = priv->dispc_ops->mgr_check_timings(priv->dispc,
>  omap_crtc->channel,
>  &vm);
> @@ -549,17 +548,17 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc 
> *crtc)
>  static bool omap_crtc_is_manually_updated(struct drm_crtc *crtc)
>  {
>   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> - struct omap_dss_device *display = omap_crtc->pipe->output->next;
> + struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  
> - if (!display)
> + if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
> + !dssdev->ops->dsi.is_video_mode)
>   return false;
>  
> - if (display->caps & OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE) {
> - DBG

Re: [PATCH] drm/ast: Create chip AST2600

2020-11-09 Thread Thomas Zimmermann
Hi

Am 09.11.20 um 10:38 schrieb KuoHsiang Chou:
> [New] Support AST2600

A style issue: better write a nice sentence than these tags.  For the
patch at hand, I'd preferred something like: "Only add an id for
supporting AST2600. No functional changes are required."

I assume that there areno further changes required for AST2600.

> 
> Signed-off-by: KuoHsiang Chou 

Reviewed-by: Thomas Zimmermann 

I'll add the patch to drm-misc-next. Thanks!

Best regards
Thomas

> ---
>  drivers/gpu/drm/ast/ast_drv.h  | 1 +
>  drivers/gpu/drm/ast/ast_main.c | 5 -
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> index 467049ca8430..6b9e3b94a712 100644
> --- a/drivers/gpu/drm/ast/ast_drv.h
> +++ b/drivers/gpu/drm/ast/ast_drv.h
> @@ -63,6 +63,7 @@ enum ast_chip {
>   AST2300,
>   AST2400,
>   AST2500,
> + AST2600,
>  };
> 
>  enum ast_tx_chip {
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index 77066bca8793..4ec6884f6c65 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -143,7 +143,10 @@ static int ast_detect_chip(struct drm_device *dev, bool 
> *need_post)
>   ast_detect_config_mode(dev, &scu_rev);
> 
>   /* Identify chipset */
> - if (dev->pdev->revision >= 0x40) {
> + if (dev->pdev->revision >= 0x50) {
> + ast->chip = AST2600;
> + drm_info(dev, "AST 2600 detected\n");
> + } else if (dev->pdev->revision >= 0x40) {
>   ast->chip = AST2500;
>   drm_info(dev, "AST 2500 detected\n");
>   } else if (dev->pdev->revision >= 0x30) {
> --
> 2.18.4
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/2] drm/mediatek: Use struct dma_buf_map in GEM vmap ops

2020-11-09 Thread Thomas Zimmermann
Fixes a build failure with mediatek.

This change was supposed to be part of commit 49a3f51dfeee ("drm/gem:
Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but
mediatek was forgotten.

Signed-off-by: Thomas Zimmermann 
Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and 
convert GEM backends")
Cc: Thomas Zimmermann 
Cc: Christian König 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Dave Airlie 
Cc: Lucas Stach 
Cc: Russell King 
Cc: Christian Gmeiner 
Cc: Qiang Yu 
Cc: Ben Skeggs 
Cc: Rob Herring 
Cc: Tomeu Vizoso 
Cc: Steven Price 
Cc: Alyssa Rosenzweig 
Cc: Gerd Hoffmann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Sandy Huang 
Cc: "Heiko Stübner" 
Cc: Hans de Goede 
Cc: Sean Paul 
Cc: Eric Anholt 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: Haneen Mohammed 
Cc: Oleksandr Andrushchenko 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Marek Szyprowski 
Cc: Arunpravin 
Cc: Huang Rui 
Cc: Luben Tuikov 
Cc: Madhav Chauhan 
Cc: Nirmoy Das 
Cc: Jason Gunthorpe 
Cc: Sam Ravnborg 
Cc: Chris Wilson 
Cc: dri-devel@lists.freedesktop.org
Cc: etna...@lists.freedesktop.org
Cc: l...@lists.freedesktop.org
Cc: nouv...@lists.freedesktop.org
Cc: virtualizat...@lists.linux-foundation.org
Cc: spice-de...@lists.freedesktop.org
Cc: amd-...@lists.freedesktop.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-rockc...@lists.infradead.org
Cc: xen-de...@lists.xenproject.org
---
 drivers/gpu/drm/mediatek/mtk_drm_gem.c | 20 
 drivers/gpu/drm/mediatek/mtk_drm_gem.h |  4 ++--
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c 
b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
index cdd1a6e61564..28a2ee1336ef 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c
@@ -240,23 +240,25 @@ struct drm_gem_object 
*mtk_gem_prime_import_sg_table(struct drm_device *dev,
return &mtk_gem->base;
 }
 
-void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
+int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
 {
struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
-   struct sg_table *sgt;
+   struct sg_table *sgt = NULL;
unsigned int npages;
 
if (mtk_gem->kvaddr)
-   return mtk_gem->kvaddr;
+   goto out;
 
sgt = mtk_gem_prime_get_sg_table(obj);
if (IS_ERR(sgt))
-   return NULL;
+   return PTR_ERR(sgt);
 
npages = obj->size >> PAGE_SHIFT;
mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL);
-   if (!mtk_gem->pages)
-   goto out;
+   if (!mtk_gem->pages) {
+   kfree(sgt);
+   return -ENOMEM;
+   }
 
drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages);
 
@@ -265,13 +267,15 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj)
 
 out:
kfree(sgt);
+   dma_buf_map_set_vaddr(map, mtk_gem->kvaddr);
 
-   return mtk_gem->kvaddr;
+   return 0;
 }
 
-void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map 
*map)
 {
struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj);
+   void *vaddr = map->vaddr;
 
if (!mtk_gem->pages)
return;
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h 
b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
index ff9f976d9807..6da5ccb4b933 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h
@@ -45,7 +45,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,
 struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj);
 struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg);
-void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj);
-void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
+int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map 
*map);
+void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map 
*map);
 
 #endif
-- 
2.29.2

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


[PATCH 0/2] drm: Build fixes for msm and mediatek

2020-11-09 Thread Thomas Zimmermann
Commit 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and
convert GEM backends") changed DRM's internal GEM vmap callbacks. Msm and
mediatek were forgotten during the conversion.

Thomas Zimmermann (2):
  drm/msm: Use struct dma_buf_map in GEM vmap ops
  drm/mediatek: Use struct dma_buf_map in GEM vmap ops

 drivers/gpu/drm/mediatek/mtk_drm_gem.c | 20 
 drivers/gpu/drm/mediatek/mtk_drm_gem.h |  4 ++--
 drivers/gpu/drm/msm/msm_drv.h  |  4 ++--
 drivers/gpu/drm/msm/msm_gem_prime.c| 13 ++---
 4 files changed, 26 insertions(+), 15 deletions(-)

--
2.29.2

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


[PATCH 1/2] drm/msm: Use struct dma_buf_map in GEM vmap ops

2020-11-09 Thread Thomas Zimmermann
Fixes a build failure with msm.

This change was supposed to be part of commit 49a3f51dfeee ("drm/gem:
Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but
msm was forgotten.

Signed-off-by: Thomas Zimmermann 
Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and 
convert GEM backends")
Cc: Thomas Zimmermann 
Cc: Christian König 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Maarten Lankhorst 
Cc: Maxime Ripard 
Cc: Dave Airlie 
Cc: Lucas Stach 
Cc: Russell King 
Cc: Christian Gmeiner 
Cc: Qiang Yu 
Cc: Ben Skeggs 
Cc: Rob Herring 
Cc: Tomeu Vizoso 
Cc: Steven Price 
Cc: Alyssa Rosenzweig 
Cc: Gerd Hoffmann 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: Sandy Huang 
Cc: "Heiko Stübner" 
Cc: Hans de Goede 
Cc: Sean Paul 
Cc: Eric Anholt 
Cc: Rodrigo Siqueira 
Cc: Melissa Wen 
Cc: Haneen Mohammed 
Cc: Oleksandr Andrushchenko 
Cc: Sumit Semwal 
Cc: Emil Velikov 
Cc: Luben Tuikov 
Cc: Marek Szyprowski 
Cc: Arunpravin 
Cc: Huang Rui 
Cc: Madhav Chauhan 
Cc: Jason Gunthorpe 
Cc: Sam Ravnborg 
Cc: Chris Wilson 
Cc: Qinglang Miao 
Cc: dri-devel@lists.freedesktop.org
Cc: etna...@lists.freedesktop.org
Cc: l...@lists.freedesktop.org
Cc: nouv...@lists.freedesktop.org
Cc: virtualizat...@lists.linux-foundation.org
Cc: spice-de...@lists.freedesktop.org
Cc: amd-...@lists.freedesktop.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-rockc...@lists.infradead.org
Cc: xen-de...@lists.xenproject.org
---
 drivers/gpu/drm/msm/msm_drv.h   |  4 ++--
 drivers/gpu/drm/msm/msm_gem_prime.c | 13 ++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index c45789f36e48..a6aef687bc6e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -295,8 +295,8 @@ int msm_gem_dumb_create(struct drm_file *file, struct 
drm_device *dev,
 int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
uint32_t handle, uint64_t *offset);
 struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
-void *msm_gem_prime_vmap(struct drm_gem_object *obj);
-void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
+int msm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map);
+void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map);
 int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma);
 struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev,
struct dma_buf_attachment *attach, struct sg_table *sg);
diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c 
b/drivers/gpu/drm/msm/msm_gem_prime.c
index 515ef80816a0..9880348a4dc7 100644
--- a/drivers/gpu/drm/msm/msm_gem_prime.c
+++ b/drivers/gpu/drm/msm/msm_gem_prime.c
@@ -22,12 +22,19 @@ struct sg_table *msm_gem_prime_get_sg_table(struct 
drm_gem_object *obj)
return drm_prime_pages_to_sg(obj->dev, msm_obj->pages, npages);
 }
 
-void *msm_gem_prime_vmap(struct drm_gem_object *obj)
+int msm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
 {
-   return msm_gem_get_vaddr(obj);
+   void *vaddr;
+
+   vaddr = msm_gem_get_vaddr(obj);
+   if (IS_ERR(vaddr))
+   return PTR_ERR(vaddr);
+   dma_buf_map_set_vaddr(map, vaddr);
+
+   return 0;
 }
 
-void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
+void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map)
 {
msm_gem_put_vaddr(obj);
 }
-- 
2.29.2

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


Re: [PATCH v3 33/56] drm/omap: dsi: convert to drm_panel

2020-11-09 Thread Laurent Pinchart
On Thu, Nov 05, 2020 at 02:03:10PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This converts the DSI module to expect common drm_panel display
> drivers instead of dssdev based ones.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 204 +++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 133 ++--
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   8 -
>  4 files changed, 189 insertions(+), 157 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index d9b3444b4faf..3668b3f0aff2 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -6,8 +6,6 @@
>   * Author: Tomi Valkeinen 
>   */
>  
> -/* #define DEBUG */
> -
>  #include 
>  #include 
>  #include 
> @@ -20,11 +18,14 @@
>  #include 
>  
>  #include 
> +#include 
> +#include 
> +#include 

Alphabetically ordered please.

>  
> +#include 
>  #include 
>  #include 
> -
> -#include "../dss/omapdss.h"
> +#include 
>  
>  #define DCS_READ_NUM_ERRORS  0x05
>  #define DCS_GET_ID1  0xda
> @@ -35,11 +36,8 @@
>  
>  struct panel_drv_data {
>   struct mipi_dsi_device *dsi;
> -
> - struct omap_dss_device dssdev;
> - struct omap_dss_device *src;
> -
> - struct videomode vm;
> + struct drm_panel panel;
> + struct drm_display_mode mode;
>  
>   struct mutex lock;
>  
> @@ -71,7 +69,11 @@ struct panel_drv_data {
>   bool ulps_enabled;
>  };
>  
> -#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
> +

A single blank line is enough.

> +static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
> +{
> + return container_of(panel, struct panel_drv_data, panel);
> +}
>  
>  static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
>  
> @@ -285,7 +287,6 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
>  
>  static int dsicm_power_on(struct panel_drv_data *ddata)
>  {
> - struct omap_dss_device *src = ddata->src;
>   u8 id1, id2, id3;
>   int r;
>  
> @@ -322,10 +323,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
>  
> - r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
> - if (r)
> - goto err;
> -
>   ddata->enabled = true;
>  
>   if (!ddata->intro_printed) {
> @@ -345,15 +342,12 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   return r;
>  }
>  
> -static void dsicm_power_off(struct panel_drv_data *ddata)
> +static int dsicm_power_off(struct panel_drv_data *ddata)
>  {
> - struct omap_dss_device *src = ddata->src;
>   int r;
>  
>   ddata->enabled = false;
>  
> - src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
> -
>   r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>   if (!r)
>   r = dsicm_sleep_in(ddata);
> @@ -363,51 +357,25 @@ static void dsicm_power_off(struct panel_drv_data 
> *ddata)
>   "error disabling panel, issuing HW reset\n");
>   dsicm_hw_reset(ddata);
>   }
> -}
> -
> -static int dsicm_connect(struct omap_dss_device *src,
> -  struct omap_dss_device *dst)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dst);
> -
> - ddata->src = src;
> - return 0;
> -}
> -
> -static void dsicm_disconnect(struct omap_dss_device *src,
> -  struct omap_dss_device *dst)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dst);
>  
> - ddata->src = NULL;
> + return r;
>  }
>  
> -static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> +static int dsicm_prepare(struct drm_panel *panel)
>  {
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *src = ddata->src;
> + struct panel_drv_data *ddata = panel_to_ddata(panel);
>   int r;
> - struct omap_dss_dsi_config dsi_config = {
> - .vm = &ddata->vm,
> - .hs_clk_min = 15000,
> - .hs_clk_max = 3,
> - .lp_clk_min = 700,
> - .lp_clk_max = 1000,
> - };
>  
>   r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
>   if (r)
>   dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
>  
> - r = src->ops->dsi.set_config(src, &dsi_config);
> - if (r) {
> - dev_err(&ddata->dsi->dev, "failed to configure DSI\n");
> - }
> + return r;
>  }
>  
> -static void dsicm_enable(struct omap_dss_device *dssdev)
> +static int dsicm_enable(struct drm_panel *panel)
>  {
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> + struct panel_drv_data *ddata = panel_to_ddata(panel);
>   int r;
>  
>   mute

Re: [PATCH v3 34/56] drm/omap: drop omapdss-boot-init

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:11PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The table of compatible values needed to be prefixed with "omapdss,"
> is empty, so all of this code is doing nothing now. Let's drop it.

\o/

> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Warmly-welcomed-by: Laurent Pinchart 
Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/Kconfig   |   4 -
>  drivers/gpu/drm/omapdrm/dss/Makefile  |   2 -
>  .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   | 228 --
>  3 files changed, 234 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig 
> b/drivers/gpu/drm/omapdrm/dss/Kconfig
> index fd7dfa28ce97..6ec80771af3d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig
> @@ -1,7 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> -config OMAP2_DSS_INIT
> - bool
> -
>  config OMAP_DSS_BASE
>   tristate
>  
> @@ -9,7 +6,6 @@ menuconfig OMAP2_DSS
>   tristate "OMAP2+ Display Subsystem support"
>   select OMAP_DSS_BASE
>   select VIDEOMODE_HELPERS
> - select OMAP2_DSS_INIT
>   select HDMI
>   help
> OMAP2+ Display Subsystem support.
> diff --git a/drivers/gpu/drm/omapdrm/dss/Makefile 
> b/drivers/gpu/drm/omapdrm/dss/Makefile
> index f967e6948f2e..811966cd7468 100644
> --- a/drivers/gpu/drm/omapdrm/dss/Makefile
> +++ b/drivers/gpu/drm/omapdrm/dss/Makefile
> @@ -1,6 +1,4 @@
>  # SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_OMAP2_DSS_INIT) += omapdss-boot-init.o
> -
>  obj-$(CONFIG_OMAP_DSS_BASE) += omapdss-base.o
>  omapdss-base-y := base.o display.o output.o
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c 
> b/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> deleted file mode 100644
> index 18560ca4bbb0..
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss-boot-init.c
> +++ /dev/null
> @@ -1,228 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Tomi Valkeinen 
> - */
> -
> -/*
> - * As omapdss panel drivers are omapdss specific, but we want to define the
> - * DT-data in generic manner, we convert the compatible strings of the panel 
> and
> - * encoder nodes from "panel-foo" to "omapdss,panel-foo". This way we can 
> have
> - * both correct DT data and omapdss specific drivers.
> - *
> - * When we get generic panel drivers to the kernel, this file will be 
> removed.
> - */
> -
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> -
> -static struct list_head dss_conv_list __initdata;
> -
> -static const char prefix[] __initconst = "omapdss,";
> -
> -struct dss_conv_node {
> - struct list_head list;
> - struct device_node *node;
> - bool root;
> -};
> -
> -static int __init omapdss_count_strings(const struct property *prop)
> -{
> - const char *p = prop->value;
> - int l = 0, total = 0;
> - int i;
> -
> - for (i = 0; total < prop->length; total += l, p += l, i++)
> - l = strlen(p) + 1;
> -
> - return i;
> -}
> -
> -static void __init omapdss_update_prop(struct device_node *node, char 
> *compat,
> - int len)
> -{
> - struct property *prop;
> -
> - prop = kzalloc(sizeof(*prop), GFP_KERNEL);
> - if (!prop)
> - return;
> -
> - prop->name = "compatible";
> - prop->value = compat;
> - prop->length = len;
> -
> - of_update_property(node, prop);
> -}
> -
> -static void __init omapdss_prefix_strcpy(char *dst, int dst_len,
> - const char *src, int src_len)
> -{
> - size_t total = 0;
> -
> - while (total < src_len) {
> - size_t l = strlen(src) + 1;
> -
> - strcpy(dst, prefix);
> - dst += strlen(prefix);
> -
> - strcpy(dst, src);
> - dst += l;
> -
> - src += l;
> - total += l;
> - }
> -}
> -
> -/* prepend compatible property strings with "omapdss," */
> -static void __init omapdss_omapify_node(struct device_node *node)
> -{
> - struct property *prop;
> - char *new_compat;
> - int num_strs;
> - int new_len;
> -
> - prop = of_find_property(node, "compatible", NULL);
> -
> - if (!prop || !prop->value)
> - return;
> -
> - if (strnlen(prop->value, prop->length) >= prop->length)
> - return;
> -
> - /* is it already prefixed? */
> - if (strncmp(prefix, prop->value, strlen(prefix)) == 0)
> - return;
> -
> - num_strs = omapdss_count_strings(prop);
> -
> - new_len = prop->length + strlen(prefix) * num_strs;
> - new_compat = kmalloc(new_len, GFP_KERNEL);
> -
> - omapdss_prefix_strcpy(new_compat, new_len, prop->value, prop->length);
> -
> - omapdss_update_prop(node, new_compat, new_len);
> -}
> -
> -static v

Re: [PATCH v3 35/56] drm/omap: dsi: implement check timings

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:12PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Implement check timings, which will check if its possible to

s/its/it's/

> configure the clocks for the provided mode using the same code
> as the set_config() hook.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 70 +++
>  1 file changed, 44 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index a1a867a7d91d..f643321434e9 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -280,6 +280,11 @@ struct dsi_isr_tables {
>   struct dsi_isr_data isr_table_cio[DSI_MAX_NR_ISRS];
>  };
>  
> +struct dsi_lp_clock_info {
> + unsigned long lp_clk;
> + u16 lp_clk_div;
> +};
> +
>  struct dsi_clk_calc_ctx {
>   struct dsi_data *dsi;
>   struct dss_pll *pll;
> @@ -294,16 +299,12 @@ struct dsi_clk_calc_ctx {
>  
>   struct dss_pll_clock_info dsi_cinfo;
>   struct dispc_clock_info dispc_cinfo;
> + struct dsi_lp_clock_info user_lp_cinfo;

Any reason for the user_ prefix here ?

Reviewed-by: Laurent Pinchart 

>  
>   struct videomode vm;
>   struct omap_dss_dsi_videomode_timings dsi_vm;
>  };
>  
> -struct dsi_lp_clock_info {
> - unsigned long lp_clk;
> - u16 lp_clk_div;
> -};
> -
>  struct dsi_module_id_data {
>   u32 address;
>   int id;
> @@ -4789,44 +4790,55 @@ static bool dsi_is_video_mode(struct omap_dss_device 
> *dssdev)
>   return (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE);
>  }
>  
> -static int dsi_set_config(struct omap_dss_device *dssdev,
> - const struct drm_display_mode *mode)
> +static int __dsi_calc_config(struct dsi_data *dsi,
> + const struct drm_display_mode *mode,
> + struct dsi_clk_calc_ctx *ctx)
>  {
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> - struct dsi_clk_calc_ctx ctx;
> - struct videomode vm;
>   struct omap_dss_dsi_config cfg = dsi->config;
> + struct videomode vm;
>   bool ok;
>   int r;
>  
>   drm_display_mode_to_videomode(mode, &vm);
> - cfg.vm = &vm;
> -
> - mutex_lock(&dsi->lock);
>  
> + cfg.vm = &vm;
>   cfg.mode = dsi->mode;
>   cfg.pixel_format = dsi->pix_fmt;
>  
>   if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
> - ok = dsi_vm_calc(dsi, &cfg, &ctx);
> + ok = dsi_vm_calc(dsi, &cfg, ctx);
>   else
> - ok = dsi_cm_calc(dsi, &cfg, &ctx);
> + ok = dsi_cm_calc(dsi, &cfg, ctx);
>  
> - if (!ok) {
> - DSSERR("failed to find suitable DSI clock settings\n");
> - r = -EINVAL;
> - goto err;
> - }
> + if (!ok)
> + return -EINVAL;
> +
> + dsi_pll_calc_dsi_fck(dsi, &ctx->dsi_cinfo);
>  
> - dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
> + r = dsi_lp_clock_calc(ctx->dsi_cinfo.clkout[HSDIV_DSI],
> + cfg.lp_clk_min, cfg.lp_clk_max, &ctx->user_lp_cinfo);
> + if (r)
> + return r;
> +
> + return 0;
> +}
>  
> - r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
> - cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
> +static int dsi_set_config(struct omap_dss_device *dssdev,
> + const struct drm_display_mode *mode)
> +{
> + struct dsi_data *dsi = to_dsi_data(dssdev);
> + struct dsi_clk_calc_ctx ctx;
> + int r;
> +
> + mutex_lock(&dsi->lock);
> +
> + r = __dsi_calc_config(dsi, mode, &ctx);
>   if (r) {
> - DSSERR("failed to find suitable DSI LP clock settings\n");
> + DSSERR("failed to find suitable DSI clock settings\n");
>   goto err;
>   }
>  
> + dsi->user_lp_cinfo = ctx.user_lp_cinfo;
>   dsi->user_dsi_cinfo = ctx.dsi_cinfo;
>   dsi->user_dispc_cinfo = ctx.dispc_cinfo;
>  
> @@ -5004,11 +5016,17 @@ static void dsi_set_timings(struct omap_dss_device 
> *dssdev,
>  static int dsi_check_timings(struct omap_dss_device *dssdev,
>struct drm_display_mode *mode)
>  {
> + struct dsi_data *dsi = to_dsi_data(dssdev);
> + struct dsi_clk_calc_ctx ctx;
> + int r;
> +
>   DSSDBG("dsi_check_timings\n");
>  
> - /* TODO */
> + mutex_lock(&dsi->lock);
> + r = __dsi_calc_config(dsi, mode, &ctx);
> + mutex_unlock(&dsi->lock);
>  
> - return 0;
> + return r;
>  }
>  
>  static int dsi_connect(struct omap_dss_device *src,

-- 
Regards,

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


Re: [PATCH v3 36/56] drm/omap: panel-dsi-cm: use DEVICE_ATTR_RO

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:13PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR,
> which makes the code a bit shorter and easier to read.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---

Reviewed-by: Laurent Pinchart 

>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 3668b3f0aff2..5159dd51a353 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -219,7 +219,7 @@ static const struct backlight_ops dsicm_bl_ops = {
>   .update_status  = dsicm_bl_update_status,
>  };
>  
> -static ssize_t dsicm_num_errors_show(struct device *dev,
> +static ssize_t num_dsi_errors_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
> @@ -239,7 +239,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,
>   return snprintf(buf, PAGE_SIZE, "%d\n", errors);
>  }
>  
> -static ssize_t dsicm_hw_revision_show(struct device *dev,
> +static ssize_t hw_revision_show(struct device *dev,
>   struct device_attribute *attr, char *buf)
>  {
>   struct panel_drv_data *ddata = dev_get_drvdata(dev);
> @@ -259,8 +259,8 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,
>   return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x\n", id1, id2, id3);
>  }
>  
> -static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
> -static DEVICE_ATTR(hw_revision, S_IRUGO, dsicm_hw_revision_show, NULL);
> +static DEVICE_ATTR_RO(num_dsi_errors);
> +static DEVICE_ATTR_RO(hw_revision);
>  
>  static struct attribute *dsicm_attrs[] = {
>   &dev_attr_num_dsi_errors.attr,

-- 
Regards,

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


Re: [PATCH v3 37/56] drm/omap: panel-dsi-cm: support unbinding

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

On Thu, Nov 05, 2020 at 02:03:14PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Now, that the driver implements the common DRM panel API
> the unbind no longer needs to be suppressed.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Acked-by: Laurent Pinchart 

I'd be curious to know what happens when you try to unbind through sysfs
though...

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 5159dd51a353..086c7d71fe17 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -607,7 +607,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   return r;
>  }
>  
> -static int __exit dsicm_remove(struct mipi_dsi_device *dsi)
> +static int dsicm_remove(struct mipi_dsi_device *dsi)
>  {
>   struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
>  
> @@ -637,11 +637,10 @@ MODULE_DEVICE_TABLE(of, dsicm_of_match);
>  
>  static struct mipi_dsi_driver dsicm_driver = {
>   .probe = dsicm_probe,
> - .remove = __exit_p(dsicm_remove),
> + .remove = dsicm_remove,
>   .driver = {
>   .name = "panel-dsi-cm",
>   .of_match_table = dsicm_of_match,
> - .suppress_bind_attrs = true,
>   },
>  };
>  module_mipi_dsi_driver(dsicm_driver);

-- 
Regards,

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


Re: [PATCH v3 38/56] drm/omap: panel-dsi-cm: fix remove()

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:15PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Do not try to reset the panel after DSI has been
> detached, since the DSI clocks may have been disabled
> at this point. The panel will be disabled and unprepared
> before being removed and a reset will be done when being
> probed again.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 086c7d71fe17..795db22d148d 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -622,9 +622,6 @@ static int dsicm_remove(struct mipi_dsi_device *dsi)
>   if (ddata->extbldev)
>   put_device(&ddata->extbldev->dev);
>  
> - /* reset, to be sure that the panel is in a valid state */
> - dsicm_hw_reset(ddata);
> -
>   return 0;
>  }
>  

-- 
Regards,

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


Re: [PATCH v3 39/56] drm/omap: remove global dss_device variable

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:16PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> We can simply provide the device to the omapdrm driver
> via pdata. omapdss_is_initialized() is no longer required
> (even before this patch), since omapdrm device is only
> registered after the pointer is initialized.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c| 14 --
>  drivers/gpu/drm/omapdrm/dss/dss.c |  9 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  9 +++--
>  drivers/gpu/drm/omapdrm/omap_drv.c|  6 ++
>  4 files changed, 9 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 455b410f7401..8e08c49b4f97 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -16,20 +16,6 @@
>  #include "dss.h"
>  #include "omapdss.h"
>  
> -static struct dss_device *dss_device;
> -
> -struct dss_device *omapdss_get_dss(void)
> -{
> - return dss_device;
> -}
> -EXPORT_SYMBOL(omapdss_get_dss);
> -
> -void omapdss_set_dss(struct dss_device *dss)
> -{
> - dss_device = dss;
> -}
> -EXPORT_SYMBOL(omapdss_set_dss);
> -
>  struct dispc_device *dispc_get_dispc(struct dss_device *dss)
>  {
>   return dss->dispc;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6ccbc29c4ce4..6e86f4e67a2c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1305,6 +1305,7 @@ static int dss_bind(struct device *dev)
>  {
>   struct dss_device *dss = dev_get_drvdata(dev);
>   struct platform_device *drm_pdev;
> + struct dss_pdata pdata;
>   int r;
>  
>   r = component_bind_all(dev, NULL);
> @@ -1313,9 +1314,9 @@ static int dss_bind(struct device *dev)
>  
>   pm_set_vt_switch(0);
>  
> - omapdss_set_dss(dss);
> -
> - drm_pdev = platform_device_register_simple("omapdrm", 0, NULL, 0);
> + pdata.dss = dss;
> + drm_pdev = platform_device_register_data(NULL, "omapdrm", 0,
> +  &pdata, sizeof(pdata));
>   if (IS_ERR(drm_pdev)) {
>   component_unbind_all(dev, NULL);
>   return PTR_ERR(drm_pdev);
> @@ -1332,8 +1333,6 @@ static void dss_unbind(struct device *dev)
>  
>   platform_device_unregister(dss->drm_pdev);
>  
> - omapdss_set_dss(NULL);
> -
>   component_unbind_all(dev, NULL);
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 3ee3063b6a2d..42d1ec3aaf0c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -356,12 +356,9 @@ struct omap_dss_device {
>   unsigned int of_port;
>  };
>  
> -struct dss_device *omapdss_get_dss(void);
> -void omapdss_set_dss(struct dss_device *dss);
> -static inline bool omapdss_is_initialized(void)
> -{
> - return !!omapdss_get_dss();
> -}
> +struct dss_pdata {
> + struct dss_device *dss;
> +};
>  
>  void omapdss_display_init(struct omap_dss_device *dssdev);
>  int omapdss_display_get_modes(struct drm_connector *connector,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 53d5e184ee77..b342f5b6ced0 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -577,6 +577,7 @@ static const struct soc_device_attribute 
> omapdrm_soc_devices[] = {
>  static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  {
>   const struct soc_device_attribute *soc;
> + struct dss_pdata *pdata = dev->platform_data;
>   struct drm_device *ddev;
>   int ret;
>  
> @@ -591,7 +592,7 @@ static int omapdrm_init(struct omap_drm_private *priv, 
> struct device *dev)
>   ddev->dev_private = priv;
>  
>   priv->dev = dev;
> - priv->dss = omapdss_get_dss();
> + priv->dss = pdata->dss;
>   priv->dispc = dispc_get_dispc(priv->dss);
>   priv->dispc_ops = dispc_get_ops(priv->dss);
>  
> @@ -686,9 +687,6 @@ static int pdev_probe(struct platform_device *pdev)
>   struct omap_drm_private *priv;
>   int ret;
>  
> - if (omapdss_is_initialized() == false)
> - return -EPROBE_DEFER;
> -
>   ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
>   if (ret) {
>   dev_err(&pdev->dev, "Failed to set the DMA mask\n");

-- 
Regards,

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


Re: [PATCH v3 40/56] drm/panel: Move OMAP's DSI command mode panel driver

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:17PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The panel driver is no longer using any OMAP specific APIs, so
> let's move it into the generic panel directory.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> Cc: Thierry Reding 
> Cc: Sam Ravnborg 

Acked-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/Kconfig|  1 -
>  drivers/gpu/drm/omapdrm/Makefile   |  1 -
>  drivers/gpu/drm/omapdrm/displays/Kconfig   | 10 --
>  drivers/gpu/drm/omapdrm/displays/Makefile  |  2 --
>  drivers/gpu/drm/panel/Kconfig  |  9 +
>  drivers/gpu/drm/panel/Makefile |  1 +
>  .../gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c |  0
>  7 files changed, 10 insertions(+), 14 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/displays/Makefile
>  rename drivers/gpu/drm/{omapdrm/displays => panel}/panel-dsi-cm.c (100%)
> 
> diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
> index 5417e7a47072..cea3f44ea6d4 100644
> --- a/drivers/gpu/drm/omapdrm/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/Kconfig
> @@ -12,6 +12,5 @@ config DRM_OMAP
>  if DRM_OMAP
>  
>  source "drivers/gpu/drm/omapdrm/dss/Kconfig"
> -source "drivers/gpu/drm/omapdrm/displays/Kconfig"
>  
>  endif
> diff --git a/drivers/gpu/drm/omapdrm/Makefile 
> b/drivers/gpu/drm/omapdrm/Makefile
> index f115253115c5..66a73eae6f7c 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -5,7 +5,6 @@
>  #
>  
>  obj-y += dss/
> -obj-y += displays/
>  
>  omapdrm-y := omap_drv.o \
>   omap_irq.o \
> diff --git a/drivers/gpu/drm/omapdrm/displays/Kconfig 
> b/drivers/gpu/drm/omapdrm/displays/Kconfig
> deleted file mode 100644
> index f2be594c7eff..
> --- a/drivers/gpu/drm/omapdrm/displays/Kconfig
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0-only
> -menu "OMAPDRM External Display Device Drivers"
> -
> -config DRM_OMAP_PANEL_DSI_CM
> - tristate "Generic DSI Command Mode Panel"
> - depends on BACKLIGHT_CLASS_DEVICE
> - help
> -   Driver for generic DSI command mode panels.
> -
> -endmenu
> diff --git a/drivers/gpu/drm/omapdrm/displays/Makefile 
> b/drivers/gpu/drm/omapdrm/displays/Makefile
> deleted file mode 100644
> index 488ddf153613..
> --- a/drivers/gpu/drm/omapdrm/displays/Makefile
> +++ /dev/null
> @@ -1,2 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0
> -obj-$(CONFIG_DRM_OMAP_PANEL_DSI_CM) += panel-dsi-cm.o
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index b9dbedf8f15e..a71f95afc52e 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -48,6 +48,15 @@ config DRM_PANEL_BOE_TV101WUM_NL6
> Say Y here if you want to support for BOE TV101WUM and AUO KD101N80
> 45NA WUXGA PANEL DSI Video Mode panel
>  
> +config DRM_PANEL_DSI_CM
> + tristate "Generic DSI command mode panels"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + depends on BACKLIGHT_CLASS_DEVICE
> + help
> +   DRM panel driver for DSI command mode panels with support for
> +   embedded and external backlights.
> +
>  config DRM_PANEL_LVDS
>   tristate "Generic LVDS panel driver"
>   depends on OF
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 2ba560bca61d..c553e968e9a9 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -3,6 +3,7 @@ obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
>  obj-$(CONFIG_DRM_PANEL_ASUS_Z00T_TM5P5_NT35596) += 
> panel-asus-z00t-tm5p5-n35596.o
>  obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
>  obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o
> +obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o
>  obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
>  obj-$(CONFIG_DRM_PANEL_ELIDA_KD35T133) += panel-elida-kd35t133.o
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> similarity index 100%
> rename from drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> rename to drivers/gpu/drm/panel/panel-dsi-cm.c

-- 
Regards,

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


Re: [PATCH v3 41/56] drm/omap: dsi: Register a drm_bridge

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:18PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> In order to integrate with a chain of drm_bridge, the internal DSI
> output has to expose its operations through the drm_bridge API.
> Register a bridge at initialisation time to do so and remove the
> omap_dss_device operations that are now unused.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 134 --
>  1 file changed, 89 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index f643321434e9..bbcdb62e1571 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -35,6 +35,7 @@
>  #include 
>  #include 
>  
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -437,6 +438,7 @@ struct dsi_data {
>   struct omap_dss_dsi_videomode_timings vm_timings;
>  
>   struct omap_dss_device output;
> + struct drm_bridge bridge;
>  };
>  
>  struct dsi_packet_sent_handler_data {
> @@ -449,6 +451,9 @@ static bool dsi_perf;
>  module_param(dsi_perf, bool, 0644);
>  #endif
>  
> +#define drm_bridge_to_dsi(bridge) \
> + container_of(bridge, struct dsi_data, bridge)
> +
>  static inline struct dsi_data *to_dsi_data(struct omap_dss_device *dssdev)
>  {
>   return dev_get_drvdata(dssdev->dev);
> @@ -5006,50 +5011,7 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>   return 0;
>  }
>  
> -static void dsi_set_timings(struct omap_dss_device *dssdev,
> - const struct drm_display_mode *mode)
> -{
> - DSSDBG("dsi_set_timings\n");
> - dsi_set_config(dssdev, mode);
> -}
> -
> -static int dsi_check_timings(struct omap_dss_device *dssdev,
> -  struct drm_display_mode *mode)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> - struct dsi_clk_calc_ctx ctx;
> - int r;
> -
> - DSSDBG("dsi_check_timings\n");
> -
> - mutex_lock(&dsi->lock);
> - r = __dsi_calc_config(dsi, mode, &ctx);
> - mutex_unlock(&dsi->lock);
> -
> - return r;
> -}
> -
> -static int dsi_connect(struct omap_dss_device *src,
> -struct omap_dss_device *dst)
> -{
> - return omapdss_device_connect(dst->dss, dst, dst->next);
> -}
> -
> -static void dsi_disconnect(struct omap_dss_device *src,
> -struct omap_dss_device *dst)
> -{
> - omapdss_device_disconnect(dst, dst->next);
> -}
> -
>  static const struct omap_dss_device_ops dsi_ops = {
> - .connect = dsi_connect,
> - .disconnect = dsi_disconnect,
> - .enable = dsi_enable_video_outputs,
> - .disable = dsi_disable_video_outputs,
> -
> - .check_timings = dsi_check_timings,
> - .set_timings = dsi_set_timings,
> -
>   .dsi = {
>   .update = dsi_update_all,
>   .is_video_mode = dsi_is_video_mode,
> @@ -5393,6 +5355,83 @@ static const struct component_ops dsi_component_ops = {
>   .unbind = dsi_unbind,
>  };
>  
> +/* 
> -
> + * DRM Bridge Operations
> + */
> +
> +static int dsi_bridge_attach(struct drm_bridge *bridge,
> +  enum drm_bridge_attach_flags flags)
> +{
> + struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR))
> + return -EINVAL;
> +
> + return drm_bridge_attach(bridge->encoder, dsi->output.next_bridge,
> +  bridge, flags);
> +}
> +
> +static enum drm_mode_status
> +dsi_bridge_mode_valid(struct drm_bridge *bridge,
> +   const struct drm_display_info *info,
> +   const struct drm_display_mode *mode)
> +{
> + struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> + struct dsi_clk_calc_ctx ctx;
> + int r;
> +
> + mutex_lock(&dsi->lock);
> + r = __dsi_calc_config(dsi, mode, &ctx);
> + mutex_unlock(&dsi->lock);
> +
> + return r ? MODE_CLOCK_RANGE : MODE_OK;
> +}
> +
> +static void dsi_bridge_mode_set(struct drm_bridge *bridge,
> + const struct drm_display_mode *mode,
> + const struct drm_display_mode *adjusted_mode)
> +{
> + struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> + dsi_set_config(&dsi->output, adjusted_mode);
> +}
> +
> +static void dsi_bridge_enable(struct drm_bridge *bridge)
> +{
> + struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> + dsi_enable_video_outputs(&dsi->output);
> +}
> +
> +static void dsi_bridge_disable(struct drm_bridge *bridge)
> +{
> + struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> +
> + dsi_disable_video_outputs(&dsi->output);
> +}
> +
> +static const struct drm_bridge_funcs dsi_bridge_funcs = {
> + .attach = dsi_bridge_attach,
> + .m

Re: [PATCH v3 42/56] drm/omap: remove legacy DSS device operations

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:19PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> All DSS devices have been converted to bridge API, so
> the device operations are always NULL. This removes
> the device ops function pointers and all code using it.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c   | 66 
>  drivers/gpu/drm/omapdrm/dss/dss.c|  8 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h| 34 
>  drivers/gpu/drm/omapdrm/omap_connector.c | 29 ---
>  drivers/gpu/drm/omapdrm/omap_encoder.c   | 40 --
>  5 files changed, 177 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 8e08c49b4f97..c2791305c332 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -161,8 +161,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  struct omap_dss_device *src,
>  struct omap_dss_device *dst)
>  {
> - int ret;
> -
>   dev_dbg(&dss->pdev->dev, "connect(%s, %s)\n",
>   src ? dev_name(src->dev) : "NULL",
>   dst ? dev_name(dst->dev) : "NULL");
> @@ -181,14 +179,6 @@ int omapdss_device_connect(struct dss_device *dss,
>  
>   dst->dss = dss;
>  
> - if (dst->ops && dst->ops->connect) {
> - ret = dst->ops->connect(src, dst);
> - if (ret < 0) {
> - dst->dss = NULL;
> - return ret;
> - }
> - }
> -
>   return 0;
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_connect);
> @@ -212,66 +202,10 @@ void omapdss_device_disconnect(struct omap_dss_device 
> *src,
>   return;
>   }
>  
> - WARN_ON(dst->state != OMAP_DSS_DISPLAY_DISABLED);
> -
> - if (dst->ops && dst->ops->disconnect)
> - dst->ops->disconnect(src, dst);
>   dst->dss = NULL;
>  }
>  EXPORT_SYMBOL_GPL(omapdss_device_disconnect);
>  
> -void omapdss_device_pre_enable(struct omap_dss_device *dssdev)
> -{
> - if (!dssdev)
> - return;
> -
> - omapdss_device_pre_enable(dssdev->next);
> -
> - if (dssdev->ops && dssdev->ops->pre_enable)
> - dssdev->ops->pre_enable(dssdev);
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_pre_enable);
> -
> -void omapdss_device_enable(struct omap_dss_device *dssdev)
> -{
> - if (!dssdev)
> - return;
> -
> - if (dssdev->ops && dssdev->ops->enable)
> - dssdev->ops->enable(dssdev);
> -
> - omapdss_device_enable(dssdev->next);
> -
> - dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_enable);
> -
> -void omapdss_device_disable(struct omap_dss_device *dssdev)
> -{
> - if (!dssdev)
> - return;
> -
> - omapdss_device_disable(dssdev->next);
> -
> - if (dssdev->ops && dssdev->ops->disable)
> - dssdev->ops->disable(dssdev);
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_disable);
> -
> -void omapdss_device_post_disable(struct omap_dss_device *dssdev)
> -{
> - if (!dssdev)
> - return;
> -
> - if (dssdev->ops && dssdev->ops->post_disable)
> - dssdev->ops->post_disable(dssdev);
> -
> - omapdss_device_post_disable(dssdev->next);
> -
> - dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
> -}
> -EXPORT_SYMBOL_GPL(omapdss_device_post_disable);
> -
>  /* 
> -
>   * Components Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c 
> b/drivers/gpu/drm/omapdrm/dss/dss.c
> index 6e86f4e67a2c..6a160138bf88 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -1565,15 +1565,7 @@ static int dss_remove(struct platform_device *pdev)
>  
>  static void dss_shutdown(struct platform_device *pdev)
>  {
> - struct omap_dss_device *dssdev = NULL;
> -
>   DSSDBG("shutdown\n");
> -
> - for_each_dss_output(dssdev) {
> - if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE &&
> - dssdev->ops && dssdev->ops->disable)
> - dssdev->ops->disable(dssdev);
> - }
>  }

Should we call drm_atomic_helper_shutdown() here (in another patch) ?

>  
>  static int dss_runtime_suspend(struct device *dev)
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 42d1ec3aaf0c..5d6edec5a427 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -123,11 +123,6 @@ enum omap_dss_dsi_mode {
>   OMAP_DSS_DSI_VIDEO_MODE,
>  };
>  
> -enum omap_dss_display_state {
> - OMAP_DSS_DISPLAY_DISABLED = 0,
> - OMAP_DSS_DISPLAY_ACTIVE,
> -};
> -
>  enum omap_dss_rotation_type {
>   OMAP_DSS_ROT_NONE   = 0,
>   OMAP_DSS_ROT_TILER  = 1 << 0,
> @@ -281,24 +

Re: [PATCH v3 43/56] drm/omap: remove unused omap_connector

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:20PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Remove unused code. Connectors are now created via drm_bridge_connector_init()
> and no longer OMAP specific.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/Makefile |   1 -
>  drivers/gpu/drm/omapdrm/omap_connector.c | 128 ---
>  drivers/gpu/drm/omapdrm/omap_connector.h |  28 -
>  drivers/gpu/drm/omapdrm/omap_drv.c   |  19 ++--
>  drivers/gpu/drm/omapdrm/omap_drv.h   |   1 -
>  drivers/gpu/drm/omapdrm/omap_encoder.c   |  11 --
>  6 files changed, 6 insertions(+), 182 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.c
>  delete mode 100644 drivers/gpu/drm/omapdrm/omap_connector.h
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile 
> b/drivers/gpu/drm/omapdrm/Makefile
> index 66a73eae6f7c..2a404e045b78 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -12,7 +12,6 @@ omapdrm-y := omap_drv.o \
>   omap_crtc.o \
>   omap_plane.o \
>   omap_encoder.o \
> - omap_connector.o \
>   omap_fb.o \
>   omap_gem.o \
>   omap_gem_dmabuf.o \
> diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c 
> b/drivers/gpu/drm/omapdrm/omap_connector.c
> deleted file mode 100644
> index c6d9b4268841..
> --- a/drivers/gpu/drm/omapdrm/omap_connector.c
> +++ /dev/null
> @@ -1,128 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
> - * Author: Rob Clark 
> - */
> -
> -#include 
> -#include 
> -#include 
> -
> -#include "omap_drv.h"
> -
> -/*
> - * connector funcs
> - */
> -
> -#define to_omap_connector(x) container_of(x, struct omap_connector, base)
> -
> -struct omap_connector {
> - struct drm_connector base;
> - struct omap_dss_device *output;
> -};
> -
> -static enum drm_connector_status omap_connector_detect(
> - struct drm_connector *connector, bool force)
> -{
> - return connector_status_connected;
> -}
> -
> -static void omap_connector_destroy(struct drm_connector *connector)
> -{
> - struct omap_connector *omap_connector = to_omap_connector(connector);
> -
> - DBG("%s", connector->name);
> -
> - drm_connector_unregister(connector);
> - drm_connector_cleanup(connector);
> -
> - omapdss_device_put(omap_connector->output);
> -
> - kfree(omap_connector);
> -}
> -
> -static int omap_connector_get_modes(struct drm_connector *connector)
> -{
> - DBG("%s", connector->name);
> -
> - /* We can't retrieve modes. The KMS core will add the default modes. */
> - return 0;
> -}
> -
> -enum drm_mode_status omap_connector_mode_fixup(struct omap_dss_device 
> *dssdev,
> - const struct drm_display_mode *mode,
> - struct drm_display_mode *adjusted_mode)
> -{
> - return MODE_OK;
> -}
> -
> -static enum drm_mode_status omap_connector_mode_valid(struct drm_connector 
> *connector,
> -  struct drm_display_mode *mode)
> -{
> - struct omap_connector *omap_connector = to_omap_connector(connector);
> - struct drm_display_mode new_mode = {};
> - enum drm_mode_status status;
> -
> - status = omap_connector_mode_fixup(omap_connector->output, mode,
> -&new_mode);
> - if (status != MODE_OK)
> - goto done;
> -
> - /* Check if vrefresh is still valid. */
> - if (drm_mode_vrefresh(mode) != drm_mode_vrefresh(&new_mode))
> - status = MODE_NOCLOCK;
> -
> -done:
> - DBG("connector: mode %s: " DRM_MODE_FMT,
> - (status == MODE_OK) ? "valid" : "invalid",
> - DRM_MODE_ARG(mode));
> -
> - return status;
> -}
> -
> -static const struct drm_connector_funcs omap_connector_funcs = {
> - .reset = drm_atomic_helper_connector_reset,
> - .detect = omap_connector_detect,
> - .fill_modes = drm_helper_probe_single_connector_modes,
> - .destroy = omap_connector_destroy,
> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> -};
> -
> -static const struct drm_connector_helper_funcs omap_connector_helper_funcs = 
> {
> - .get_modes = omap_connector_get_modes,
> - .mode_valid = omap_connector_mode_valid,
> -};
> -
> -/* initialize connector */
> -struct drm_connector *omap_connector_init(struct drm_device *dev,
> -   struct omap_dss_device *output,
> -   struct drm_encoder *encoder)
> -{
> - struct drm_connector *connector = NULL;
> - struct omap_connector *omap_connector;
> -
> - DBG("%s", output->name);
> -
> - omap_connector = kzalloc(sizeof(*omap

Re: [PATCH v3 44/56] drm/omap: simplify omap_display_id

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:21PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> We no longer need to check for the DSS API, since all encoders,
> panels and connectors have been converted to the bridge API.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c 
> b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 20b5b4e9071c..dbb8e95234b3 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -206,14 +206,7 @@ static int omap_display_id(struct omap_dss_device 
> *output)
>  {
>   struct device_node *node = NULL;
>  
> - if (output->next) {
> - struct omap_dss_device *display = output;
> -
> - while (display->next)
> - display = display->next;
> -
> - node = display->dev->of_node;
> - } else if (output->bridge) {
> + if (output->bridge) {
>   struct drm_bridge *bridge = output->bridge;
>  
>   while (drm_bridge_get_next_bridge(bridge))
> 

-- 
Regards,

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


Re: [PATCH v3 45/56] drm/omap: drop unused DSS next pointer

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:22PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Since all encoders and panels are using the bridge API now,
> we next pointer is no longer useful and can be dropped.

I would squash this with the previous patch.

> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/base.c |  2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h  |  1 -
>  drivers/gpu/drm/omapdrm/dss/output.c   | 13 +
>  drivers/gpu/drm/omapdrm/omap_encoder.c |  4 
>  4 files changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index c2791305c332..d62713b241d2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -135,7 +135,7 @@ struct omap_dss_device *omapdss_device_next_output(struct 
> omap_dss_device *from)
>   goto done;
>   }
>  
> - if (dssdev->id && (dssdev->next || dssdev->bridge))
> + if (dssdev->id && (dssdev->bridge))

No need for the inner parentheses.

Reviewed-by: Laurent Pinchart 

>   goto done;
>   }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 5d6edec5a427..1f02d3e406dc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -293,7 +293,6 @@ struct omap_dss_device {
>   struct module *owner;
>  
>   struct dss_device *dss;
> - struct omap_dss_device *next;
>   struct drm_bridge *bridge;
>   struct drm_bridge *next_bridge;
>   struct drm_panel *panel;
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index ce21c798cca6..40cb353572f6 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -30,7 +30,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>   return 0;
>   }
>  
> - out->next = omapdss_find_device_by_node(remote_node);
>   out->bridge = of_drm_find_bridge(remote_node);
>   out->panel = of_drm_find_panel(remote_node);
>   if (IS_ERR(out->panel))
> @@ -38,12 +37,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  
>   of_node_put(remote_node);
>  
> - if (out->next && out->type != out->next->type) {
> - dev_err(out->dev, "output type and display type don't match\n");
> - ret = -EINVAL;
> - goto error;
> - }
> -
>   if (out->panel) {
>   struct drm_bridge *bridge;
>  
> @@ -69,7 +62,7 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>   out->bridge = local_bridge;
>   }
>  
> - if (!out->next && !out->bridge) {
> + if (!out->bridge) {
>   ret = -EPROBE_DEFER;
>   goto error;
>   }
> @@ -78,7 +71,6 @@ int omapdss_device_init_output(struct omap_dss_device *out,
>  
>  error:
>   omapdss_device_cleanup_output(out);
> - out->next = NULL;
>   return ret;
>  }
>  EXPORT_SYMBOL(omapdss_device_init_output);
> @@ -88,9 +80,6 @@ void omapdss_device_cleanup_output(struct omap_dss_device 
> *out)
>   if (out->bridge && out->panel)
>   drm_panel_bridge_remove(out->next_bridge ?
>   out->next_bridge : out->bridge);
> -
> - if (out->next)
> - omapdss_device_put(out->next);
>  }
>  EXPORT_SYMBOL(omapdss_device_cleanup_output);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 610c5a2f2771..5f5fa01240a7 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -75,7 +75,6 @@ static void omap_encoder_mode_set(struct drm_encoder 
> *encoder,
>  {
>   struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
>   struct omap_dss_device *output = omap_encoder->output;
> - struct omap_dss_device *dssdev;
>   struct drm_device *dev = encoder->dev;
>   struct drm_connector *connector;
>   struct drm_bridge *bridge;
> @@ -98,9 +97,6 @@ static void omap_encoder_mode_set(struct drm_encoder 
> *encoder,
>*
>* A better solution is to use DRM's bus-flags through the whole driver.
>*/
> - for (dssdev = output; dssdev; dssdev = dssdev->next)
> - omap_encoder_update_videomode_flags(&vm, dssdev->bus_flags);
> -
>   for (bridge = output->bridge; bridge;
>bridge = drm_bridge_get_next_bridge(bridge)) {
>   if (!bridge->timings)

-- 
Regards,

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


Re: [PATCH v3 46/56] drm/omap: drop empty omap_encoder helper functions

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:23PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Cleanup empty functions for encoder enable, disable and atomic check.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/omap_encoder.c | 28 --
>  1 file changed, 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c 
> b/drivers/gpu/drm/omapdrm/omap_encoder.c
> index 5f5fa01240a7..e24411fb9dac 100644
> --- a/drivers/gpu/drm/omapdrm/omap_encoder.c
> +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c
> @@ -113,36 +113,8 @@ static void omap_encoder_mode_set(struct drm_encoder 
> *encoder,
>   dss_mgr_set_timings(output, &vm);
>  }
>  
> -static void omap_encoder_disable(struct drm_encoder *encoder)
> -{
> - struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> - struct omap_dss_device *dssdev = omap_encoder->output;
> - struct drm_device *dev = encoder->dev;
> -
> - dev_dbg(dev->dev, "disable(%s)\n", dssdev->name);
> -}
> -
> -static void omap_encoder_enable(struct drm_encoder *encoder)
> -{
> - struct omap_encoder *omap_encoder = to_omap_encoder(encoder);
> - struct omap_dss_device *dssdev = omap_encoder->output;
> - struct drm_device *dev = encoder->dev;
> -
> - dev_dbg(dev->dev, "enable(%s)\n", dssdev->name);
> -}
> -
> -static int omap_encoder_atomic_check(struct drm_encoder *encoder,
> -  struct drm_crtc_state *crtc_state,
> -  struct drm_connector_state *conn_state)
> -{
> - return 0;
> -}
> -
>  static const struct drm_encoder_helper_funcs omap_encoder_helper_funcs = {
>   .mode_set = omap_encoder_mode_set,
> - .disable = omap_encoder_disable,
> - .enable = omap_encoder_enable,
> - .atomic_check = omap_encoder_atomic_check,
>  };
>  
>  /* initialize encoder */

-- 
Regards,

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


Re: [PATCH v3 47/56] drm/omap: drop DSS ops_flags

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:24PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The omapdss device's ops_flags field is no longer
> used and can be dropped.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 9 -
>  drivers/gpu/drm/omapdrm/dss/venc.c| 1 -
>  2 files changed, 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 1f02d3e406dc..916c55101629 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -279,14 +279,6 @@ struct omap_dss_device_ops {
>   const struct omapdss_dsi_ops dsi;
>  };
>  
> -/**
> - * enum omap_dss_device_ops_flag - Indicates which device ops are supported
> - * @OMAP_DSS_DEVICE_OP_MODES: The device supports reading modes
> - */
> -enum omap_dss_device_ops_flag {
> - OMAP_DSS_DEVICE_OP_MODES = BIT(3),
> -};
> -
>  struct omap_dss_device {
>   struct device *dev;
>  
> @@ -315,7 +307,6 @@ struct omap_dss_device {
>   const char *name;
>  
>   const struct omap_dss_device_ops *ops;
> - unsigned long ops_flags;
>   u32 bus_flags;
>  
>   /* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
> b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 5c027c81760f..6e418a0f7572 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -732,7 +732,6 @@ static int venc_init_output(struct venc_device *venc)
>   out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
>   out->owner = THIS_MODULE;
>   out->of_port = 0;
> - out->ops_flags = OMAP_DSS_DEVICE_OP_MODES;
>  
>   r = omapdss_device_init_output(out, &venc->bridge);
>   if (r < 0) {

-- 
Regards,

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


Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Lee Jones
On Sat, 07 Nov 2020, Sam Ravnborg wrote:

> Hi Lee,
> 
> On Fri, Nov 06, 2020 at 09:49:40PM +, Lee Jones wrote:
> > Unfortunately, a suitable one didn't already exist.
> > 
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/radeon/radeon_device.c:637:6: warning: no previous 
> > prototype for ‘radeon_device_is_virtual’ [-Wmissing-prototypes]
> >  637 | bool radeon_device_is_virtual(void)
> >  | ^~~~
> > 
> > Cc: Alex Deucher 
> > Cc: "Christian König" 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Sumit Semwal 
> > Cc: amd-...@lists.freedesktop.org
> > Cc: dri-devel@lists.freedesktop.org
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > Signed-off-by: Lee Jones 
> > ---
> >  drivers/gpu/drm/radeon/radeon_device.c |  1 +
> >  drivers/gpu/drm/radeon/radeon_device.h | 32 ++
> >  drivers/gpu/drm/radeon/radeon_drv.c|  3 +--
> >  3 files changed, 34 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/gpu/drm/radeon/radeon_device.h
> 
> Other public functions in radeon_device.c have their prototype in
> radeon.h - for example radeon_is_px()
> 
> Add radeon_device_is_virtual() there so we avoiid this new header.

Oh yes, I remember why this wasn't a suitable solution now:

The macro "radeon_init" in radeon.h clashes with the init function of
the same name in radeon_drv.c:

  In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
  drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or ‘(’ 
before ‘void’
  620 | static int __init radeon_init(void)
  | ^~~~
  drivers/gpu/drm/radeon/radeon.h:2705:28: note: in definition of macro 
‘radeon_init’
  2705 | #define radeon_init(rdev) (rdev)->asic->init((rdev))
  | ^~~~
  In file included from drivers/gpu/drm/radeon/radeon_drv.c:35:
  drivers/gpu/drm/radeon/radeon_drv.c: In function ‘__inittest’:
  drivers/gpu/drm/radeon/radeon_drv.c:653:13: error: ‘radeon_init’ undeclared 
(first use in this function); did you mean ‘radeon_exit’?
  653 | module_init(radeon_init);
  | ^~~
  include/linux/module.h:133:11: note: in definition of macro ‘module_init’
  133 | { return initfn; } | ^~
  drivers/gpu/drm/radeon/radeon_drv.c:653:13: note: each undeclared identifier 
is reported only once for each function it appears in
  653 | module_init(radeon_init);
  | ^~~
  include/linux/module.h:133:11: note: in definition of macro ‘module_init’
  133 | { return initfn; } | ^~
  In file included from include/linux/compiler_types.h:65,
  from :
  drivers/gpu/drm/radeon/radeon_drv.c: At top level:
  drivers/gpu/drm/radeon/radeon_drv.c:653:13: error: ‘radeon_init’ undeclared 
here (not in a function); did you mean ‘radeon_exit’?
  653 | module_init(radeon_init);
  | ^~~
  include/linux/compiler_attributes.h:109:65: note: in definition of macro 
‘__copy’
  109 | # define __copy(symbol) __attribute__((__copy__(symbol)))
  | ^~
  drivers/gpu/drm/radeon/radeon_drv.c:653:1: note: in expansion of macro 
‘module_init’
  653 | module_init(radeon_init);
  | ^~~
  In file included from drivers/gpu/drm/radeon/radeon_drv.c:35:
  include/linux/module.h:134:6: error: ‘init_module’ aliased to undefined 
symbol ‘radeon_init’
  134 | int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
  | ^~~
  drivers/gpu/drm/radeon/radeon_drv.c:653:1: note: in expansion of macro 
‘module_init’
  653 | module_init(radeon_init);
  | ^~~

How would you like me to move forward?

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


Re: [PATCH v3 48/56] drm/omap: drop dssdev display field

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:25PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> All displays are using drm_panel instead off dssdev

drm_panel or a drm_bridge that models the connected.

> now, so this field is always 0 and can be dropped.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c| 2 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 6 --
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index d62713b241d2..d9a5e7b9d401 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -198,7 +198,7 @@ void omapdss_device_disconnect(struct omap_dss_device 
> *src,
>   }
>  
>   if (!dst->id && !omapdss_device_is_connected(dst)) {
> - WARN_ON(!dst->display);
> + WARN_ON(1);
>   return;
>   }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 916c55101629..c2199c4946ec 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -298,12 +298,6 @@ struct omap_dss_device {
>*/
>   enum omap_display_type type;
>  
> - /*
> -  * True if the device is a display (panel or connector) at the end of
> -  * the pipeline, false otherwise.
> -  */
> - bool display;
> -
>   const char *name;
>  
>   const struct omap_dss_device_ops *ops;

-- 
Regards,

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


Re: [PATCH v3 49/56] drm/omap: simplify DSI manual update code

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:26PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Move dsi_ops into the main structure, since all other ops
> are gone. Instead of checking the device type we can simply
> check if dsi_ops are set.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 10 --
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 +-
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 16 
>  3 files changed, 9 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index bbcdb62e1571..f47d7e3bb631 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5011,11 +5011,9 @@ static int dsi_get_clocks(struct dsi_data *dsi)
>   return 0;
>  }
>  
> -static const struct omap_dss_device_ops dsi_ops = {
> - .dsi = {
> - .update = dsi_update_all,
> - .is_video_mode = dsi_is_video_mode,
> - },
> +static const struct omapdss_dsi_ops dsi_ops = {
> + .update = dsi_update_all,
> + .is_video_mode = dsi_is_video_mode,
>  };
>  
>  static irqreturn_t omap_dsi_te_irq_handler(int irq, void *dev_id)
> @@ -5450,7 +5448,7 @@ static int dsi_init_output(struct dsi_data *dsi)
>   out->type = OMAP_DISPLAY_TYPE_DSI;
>   out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
>   out->dispc_channel = dsi_get_channel(dsi);
> - out->ops = &dsi_ops;
> + out->dsi_ops = &dsi_ops;
>   out->owner = THIS_MODULE;
>   out->of_port = 0;
>   out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index c2199c4946ec..a1236b8ef7ea 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -275,10 +275,6 @@ struct omapdss_dsi_ops {
>   bool (*is_video_mode)(struct omap_dss_device *dssdev);
>  };
>  
> -struct omap_dss_device_ops {
> - const struct omapdss_dsi_ops dsi;
> -};
> -
>  struct omap_dss_device {
>   struct device *dev;
>  
> @@ -300,7 +296,7 @@ struct omap_dss_device {
>  
>   const char *name;
>  
> - const struct omap_dss_device_ops *ops;
> + const struct omapdss_dsi_ops *dsi_ops;
>   u32 bus_flags;
>  
>   /* OMAP DSS output specific fields */
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
> b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index f6b968060cf0..5ab557c477ef 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -366,17 +366,10 @@ static void omap_crtc_manual_display_update(struct 
> work_struct *data)
>   struct drm_device *dev = omap_crtc->base.dev;
>   int ret;
>  
> - if (!dssdev) {
> - dev_err_once(dev->dev, "missing display dssdev!");
> + if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->update)
>   return;
> - }
> -
> - if (dssdev->type != OMAP_DISPLAY_TYPE_DSI || !dssdev->ops->dsi.update) {
> - dev_err_once(dev->dev, "no DSI update callback found!");
> - return;
> - }
>  
> - ret = dssdev->ops->dsi.update(dssdev);
> + ret = dssdev->dsi_ops->update(dssdev);
>   if (ret < 0) {
>   spin_lock_irq(&dev->event_lock);
>   omap_crtc->pending = false;
> @@ -550,11 +543,10 @@ static bool omap_crtc_is_manually_updated(struct 
> drm_crtc *crtc)
>   struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
>   struct omap_dss_device *dssdev = omap_crtc->pipe->output;
>  
> - if (dssdev->type != OMAP_DISPLAY_TYPE_DSI ||
> - !dssdev->ops->dsi.is_video_mode)
> + if (!dssdev || !dssdev->dsi_ops || !dssdev->dsi_ops->is_video_mode)
>   return false;
>  
> - if (dssdev->ops->dsi.is_video_mode(dssdev))
> + if (dssdev->dsi_ops->is_video_mode(dssdev))
>   return false;
>  
>   DBG("detected manually updated display!");

-- 
Regards,

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


Re: [PATCH v3 50/56] drm/omap: dsi: simplify pin config

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:27PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> Simplify DSI pin config, which always originates from DT
> nowadays. With the code being fully contained in the DSI
> encoder, we can drop the public structure.
> 
> Since the function is no longer exposed, it now directly
> takes the private DSI data pointer. This drop a pointless

s/drop/drops/

> conversion and means the pins can be configured earlier.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 33 +--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 
>  2 files changed, 11 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index f47d7e3bb631..76e4f607d8cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3568,12 +3568,9 @@ static void dsi_proto_timings(struct dsi_data *dsi)
>   }
>  }
>  
> -static int dsi_configure_pins(struct omap_dss_device *dssdev,
> - const struct omap_dsi_pin_config *pin_cfg)
> +static int dsi_configure_pins(struct dsi_data *dsi,
> + int num_pins, const u32 *pins)
>  {
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> - int num_pins;
> - const int *pins;
>   struct dsi_lane_config lanes[DSI_MAX_NR_LANES];
>   int num_lanes;
>   int i;
> @@ -3586,9 +3583,6 @@ static int dsi_configure_pins(struct omap_dss_device 
> *dssdev,
>   DSI_LANE_DATA4,
>   };
>  
> - num_pins = pin_cfg->num_pins;
> - pins = pin_cfg->pins;
> -
>   if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2
>   || num_pins % 2 != 0)
>   return -EINVAL;
> @@ -3600,7 +3594,7 @@ static int dsi_configure_pins(struct omap_dss_device 
> *dssdev,
>  
>   for (i = 0; i < num_pins; i += 2) {
>   u8 lane, pol;
> - int dx, dy;
> + u32 dx, dy;

Is this change needed ?

Reviewed-by: Laurent Pinchart 

>  
>   dx = pins[i];
>   dy = pins[i + 1];
> @@ -5481,9 +5475,8 @@ static int dsi_probe_of(struct dsi_data *dsi)
>   struct property *prop;
>   u32 lane_arr[10];
>   int len, num_pins;
> - int r, i;
> + int r;
>   struct device_node *ep;
> - struct omap_dsi_pin_config pin_cfg;
>  
>   ep = of_graph_get_endpoint_by_regs(node, 0, 0);
>   if (!ep)
> @@ -5511,11 +5504,7 @@ static int dsi_probe_of(struct dsi_data *dsi)
>   goto err;
>   }
>  
> - pin_cfg.num_pins = num_pins;
> - for (i = 0; i < num_pins; ++i)
> - pin_cfg.pins[i] = (int)lane_arr[i];
> -
> - r = dsi_configure_pins(&dsi->output, &pin_cfg);
> + r = dsi_configure_pins(dsi, num_pins, lane_arr);
>   if (r) {
>   dev_err(dsi->dev, "failed to configure pins");
>   goto err;
> @@ -5728,6 +5717,12 @@ static int dsi_probe(struct platform_device *pdev)
>   dsi->host.ops = &omap_dsi_host_ops;
>   dsi->host.dev = &pdev->dev;
>  
> + r = dsi_probe_of(dsi);
> + if (r) {
> + DSSERR("Invalid DSI DT data\n");
> + goto err_pm_disable;
> + }
> +
>   r = mipi_dsi_host_register(&dsi->host);
>   if (r < 0) {
>   dev_err(&pdev->dev, "failed to register DSI host: %d\n", r);
> @@ -5738,12 +5733,6 @@ static int dsi_probe(struct platform_device *pdev)
>   if (r)
>   goto err_dsi_host_unregister;
>  
> - r = dsi_probe_of(dsi);
> - if (r) {
> - DSSERR("Invalid DSI DT data\n");
> - goto err_uninit_output;
> - }
> -
>   r = component_add(&pdev->dev, &dsi_component_ops);
>   if (r)
>   goto err_uninit_output;
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a1236b8ef7ea..4a0826c8fed5 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -243,21 +243,6 @@ struct omap_overlay_manager_info {
>   struct omap_dss_cpr_coefs cpr_coefs;
>  };
>  
> -/* 22 pins means 1 clk lane and 10 data lanes */
> -#define OMAP_DSS_MAX_DSI_PINS 22
> -
> -struct omap_dsi_pin_config {
> - int num_pins;
> - /*
> -  * pin numbers in the following order:
> -  * clk+, clk-
> -  * data1+, data1-
> -  * data2+, data2-
> -  * ...
> -  */
> - int pins[OMAP_DSS_MAX_DSI_PINS];
> -};
> -
>  struct omap_dss_writeback_info {
>   u32 paddr;
>   u32 p_uv_addr;

-- 
Regards,

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


Re: [PATCH v3 51/56] ARM: omap2plus_defconfig: Update for moved DSI command mode panel

2020-11-09 Thread Laurent Pinchart
Hi Tomi and Sebastian,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:28PM +0200, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> The DSI command mode panel is no longer specific
> to OMAP and thus the config option has been renamed
> slightly.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> Cc: Tony Lindgren 
> ---
>  arch/arm/configs/omap2plus_defconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/configs/omap2plus_defconfig 
> b/arch/arm/configs/omap2plus_defconfig
> index 34793aabdb65..d329d0829fce 100644
> --- a/arch/arm/configs/omap2plus_defconfig
> +++ b/arch/arm/configs/omap2plus_defconfig
> @@ -369,7 +369,7 @@ CONFIG_DRM_OMAP=m
>  CONFIG_OMAP5_DSS_HDMI=y
>  CONFIG_OMAP2_DSS_SDI=y
>  CONFIG_OMAP2_DSS_DSI=y
> -CONFIG_DRM_OMAP_PANEL_DSI_CM=m
> +CONFIG_DRM_PANEL_DSI_CM=m

Is thi the right location, have you regenerated the defconfig from a
.config, or just renamed the option ? With the location fixed if needed,

Reviewed-by: Laurent Pinchart 

>  CONFIG_DRM_TILCDC=m
>  CONFIG_DRM_PANEL_SIMPLE=m
>  CONFIG_DRM_PANEL_LG_LB035Q02=m

-- 
Regards,

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


[PATCH][next] drm/kmb: fix spelling mistakes in drm_info and drm_dbg messages

2020-11-09 Thread Colin King
From: Colin Ian King 

There are two spelling mistakes of the word sync in drm_info
and drm_dbg messages. Fix these.

Signed-off-by: Colin Ian King 
---
 drivers/gpu/drm/kmb/kmb_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/kmb/kmb_crtc.c b/drivers/gpu/drm/kmb/kmb_crtc.c
index dd54b03f7f84..44327bc629ca 100644
--- a/drivers/gpu/drm/kmb/kmb_crtc.c
+++ b/drivers/gpu/drm/kmb/kmb_crtc.c
@@ -77,7 +77,7 @@ static void kmb_crtc_set_mode(struct drm_crtc *crtc)
/* Initialize mipi */
kmb_dsi_mode_set(kmb->kmb_dsi, m, kmb->sys_clk_mhz);
drm_info(dev,
-"vfp= %d vbp= %d vsyc_len=%d hfp=%d hbp=%d hsync_len=%d\n",
+"vfp= %d vbp= %d vsync_len=%d hfp=%d hbp=%d hsync_len=%d\n",
 m->crtc_vsync_start - m->crtc_vdisplay,
 m->crtc_vtotal - m->crtc_vsync_end,
 m->crtc_vsync_end - m->crtc_vsync_start,
@@ -94,7 +94,7 @@ static void kmb_crtc_set_mode(struct drm_crtc *crtc)
vm.hback_porch = 0;
vm.hsync_len = 28;
 
-   drm_dbg(dev, "%s : %dactive height= %d vbp=%d vfp=%d vsync-w=%d 
h-active=%d h-bp=%d h-fp=%d hysnc-l=%d",
+   drm_dbg(dev, "%s : %dactive height= %d vbp=%d vfp=%d vsync-w=%d 
h-active=%d h-bp=%d h-fp=%d hsync-l=%d",
__func__, __LINE__,
m->crtc_vdisplay, vm.vback_porch, vm.vfront_porch,
vm.vsync_len, m->crtc_hdisplay, vm.hback_porch,
-- 
2.28.0

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


Re: [PATCH v3 53/56] drm/omap: remove unused display.c

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:30PM +0200, Tomi Valkeinen wrote:
> The functions in display.c are not used, so drop the file.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/Makefile  |  2 +-
>  drivers/gpu/drm/omapdrm/dss/display.c | 58 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 --
>  3 files changed, 1 insertion(+), 63 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/display.c
> 
> diff --git a/drivers/gpu/drm/omapdrm/Makefile 
> b/drivers/gpu/drm/omapdrm/Makefile
> index 33fe7e937680..21e8277ff88f 100644
> --- a/drivers/gpu/drm/omapdrm/Makefile
> +++ b/drivers/gpu/drm/omapdrm/Makefile
> @@ -18,7 +18,7 @@ omapdrm-y := omap_drv.o \
>  
>  omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
>  
> -omapdrm-y += dss/base.o dss/display.o dss/output.o dss/dss.o dss/dispc.o \
> +omapdrm-y += dss/base.o dss/output.o dss/dss.o dss/dispc.o \
>   dss/dispc_coefs.o dss/pll.o dss/video-pll.o
>  omapdrm-$(CONFIG_OMAP2_DSS_DPI) += dss/dpi.o
>  omapdrm-$(CONFIG_OMAP2_DSS_VENC) += dss/venc.o
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c 
> b/drivers/gpu/drm/omapdrm/dss/display.c
> deleted file mode 100644
> index 7b7ee2019eae..
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ /dev/null
> @@ -1,58 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-only
> -/*
> - * Copyright (C) 2009 Nokia Corporation
> - * Author: Tomi Valkeinen 
> - *
> - * Some code and ideas taken from drivers/video/omap/ driver
> - * by Imre Deak.
> - */
> -
> -#define DSS_SUBSYS_NAME "DISPLAY"
> -
> -#include 
> -#include 
> -
> -#include 
> -#include 
> -
> -#include "omapdss.h"
> -
> -static int disp_num_counter;
> -
> -void omapdss_display_init(struct omap_dss_device *dssdev)
> -{
> - int id;
> -
> - /*
> -  * Note: this presumes that all displays either have an DT alias, or
> -  * none has.
> -  */
> - id = of_alias_get_id(dssdev->dev->of_node, "display");
> - if (id < 0)
> - id = disp_num_counter++;
> -
> - /* Use 'label' property for name, if it exists */
> - of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
> -
> - if (dssdev->name == NULL)
> - dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
> -   "display%u", id);
> -}
> -
> -int omapdss_display_get_modes(struct drm_connector *connector,
> -   const struct videomode *vm)
> -{
> - struct drm_display_mode *mode;
> -
> - mode = drm_mode_create(connector->dev);
> - if (!mode)
> - return 0;
> -
> - drm_display_mode_from_videomode(vm, mode);
> -
> - mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> - drm_mode_set_name(mode);
> - drm_mode_probed_add(connector, mode);
> -
> - return 1;
> -}
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 4e7ae164de4f..90e41c635e45 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -300,10 +300,6 @@ struct dss_pdata {
>   struct dss_device *dss;
>  };
>  
> -void omapdss_display_init(struct omap_dss_device *dssdev);
> -int omapdss_display_get_modes(struct drm_connector *connector,
> -   const struct videomode *vm);
> -
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
>  struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev);

-- 
Regards,

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


Re: [PATCH v3 52/56] drm/omap: squash omapdrm sub-modules into one

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:29PM +0200, Tomi Valkeinen wrote:
> At the moment we have three different modules: omapdss-base, omapdss,
> omapdrm. This setup is finally obsolete, as the last omapdrm specific
> panel has been converted to DRM panel.
> 
> We can thus remove omapdss-base and omapdss, and just compile everything
> into omapdrm.ko.
> 
> Signed-off-by: Tomi Valkeinen 
> ---
>  drivers/gpu/drm/omapdrm/Kconfig   | 119 ++-
>  drivers/gpu/drm/omapdrm/Makefile  |  17 +++-
>  drivers/gpu/drm/omapdrm/dss/Kconfig   | 132 --
>  drivers/gpu/drm/omapdrm/dss/Makefile  |  18 
>  drivers/gpu/drm/omapdrm/dss/base.c|  23 +
>  drivers/gpu/drm/omapdrm/dss/display.c |   2 -
>  drivers/gpu/drm/omapdrm/dss/dss.c |  11 +--
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |   3 +
>  drivers/gpu/drm/omapdrm/dss/output.c  |  11 ---
>  drivers/gpu/drm/omapdrm/omap_drv.c|  12 ++-
>  10 files changed, 148 insertions(+), 200 deletions(-)
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Kconfig
>  delete mode 100644 drivers/gpu/drm/omapdrm/dss/Makefile
> 
> diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
> index cea3f44ea6d4..e7281da5bc6a 100644
> --- a/drivers/gpu/drm/omapdrm/Kconfig
> +++ b/drivers/gpu/drm/omapdrm/Kconfig
> @@ -5,12 +5,129 @@ config DRM_OMAP
>   depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
>   select OMAP2_DSS
>   select DRM_KMS_HELPER
> + select VIDEOMODE_HELPERS
> + select HDMI
>   default n
>   help
> DRM display driver for OMAP2/3/4 based boards.
>  
>  if DRM_OMAP
>  
> -source "drivers/gpu/drm/omapdrm/dss/Kconfig"
> +config OMAP2_DSS_DEBUG
> + bool "Debug support"
> + default n
> + help
> +   This enables printing of debug messages. Alternatively, debug messages
> +   can also be enabled by setting CONFIG_DYNAMIC_DEBUG and then setting
> +   appropriate flags in /dynamic_debug/control.
> +
> +config OMAP2_DSS_DEBUGFS
> + bool "Debugfs filesystem support"
> + depends on DEBUG_FS
> + default n
> + help
> +   This enables debugfs for OMAPDSS at /omapdss. This enables
> +   querying about clock configuration and register configuration of dss,
> +   dispc, dsi, hdmi and rfbi.
> +
> +config OMAP2_DSS_COLLECT_IRQ_STATS
> + bool "Collect DSS IRQ statistics"
> + depends on OMAP2_DSS_DEBUGFS
> + default n
> + help
> +   Collect DSS IRQ statistics, printable via debugfs.
> +
> +   The statistics can be found from
> +   /omapdss/dispc_irq for DISPC interrupts, and
> +   /omapdss/dsi_irq for DSI interrupts.
> +
> +config OMAP2_DSS_DPI
> + bool "DPI support"
> + default y
> + help
> +   DPI Interface. This is the Parallel Display Interface.
> +
> +config OMAP2_DSS_VENC
> + bool "VENC support"
> + default y
> + help
> +   OMAP Video Encoder support for S-Video and composite TV-out.
> +
> +config OMAP2_DSS_HDMI_COMMON
> + bool
> +
> +config OMAP4_DSS_HDMI
> + bool "HDMI support for OMAP4"
> + default y
> + select OMAP2_DSS_HDMI_COMMON
> + help
> +   HDMI support for OMAP4 based SoCs.
> +
> +config OMAP4_DSS_HDMI_CEC
> + bool "Enable HDMI CEC support for OMAP4"
> + depends on OMAP4_DSS_HDMI
> + select CEC_CORE
> + default y
> + help
> +   When selected the HDMI transmitter will support the CEC feature.
> +
> +config OMAP5_DSS_HDMI
> + bool "HDMI support for OMAP5"
> + default n
> + select OMAP2_DSS_HDMI_COMMON
> + help
> +   HDMI Interface for OMAP5 and similar cores. This adds the High
> +   Definition Multimedia Interface. See http://www.hdmi.org/ for HDMI
> +   specification.
> +
> +config OMAP2_DSS_SDI
> + bool "SDI support"
> + default n
> + help
> +   SDI (Serial Display Interface) support.
> +
> +   SDI is a high speed one-way display serial bus between the host
> +   processor and a display.
> +
> +config OMAP2_DSS_DSI
> + bool "DSI support"
> + default n
> + select DRM_MIPI_DSI
> + help
> +   MIPI DSI (Display Serial Interface) support.
> +
> +   DSI is a high speed half-duplex serial interface between the host
> +   processor and a peripheral, such as a display or a framebuffer chip.
> +
> +   See http://www.mipi.org/ for DSI specifications.
> +
> +config OMAP2_DSS_MIN_FCK_PER_PCK
> + int "Minimum FCK/PCK ratio (for scaling)"
> + range 0 32
> + default 0
> + help
> +   This can be used to adjust the minimum FCK/PCK ratio.
> +
> +   With this you can make sure that DISPC FCK is at least
> +   n x PCK. Video plane scaling requires higher FCK than
> +   normally.
> +
> +   If this is set to 0, there's no extra constraint on the
> +   DISPC FCK. However, the FCK will at minimum be
> +   2xPCK (if active matrix) or 3xPCK (if passive matrix).
> +
> +   Ma

Re: [PATCH v3 54/56] drm/omap: drop unused owner field

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:31PM +0200, Tomi Valkeinen wrote:
> dssdev->owner is set, but never used. We can drop the field.
> 
> Signed-off-by: Tomi Valkeinen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dpi.c | 1 -
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi4.c   | 1 -
>  drivers/gpu/drm/omapdrm/dss/hdmi5.c   | 1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 --
>  drivers/gpu/drm/omapdrm/dss/sdi.c | 1 -
>  drivers/gpu/drm/omapdrm/dss/venc.c| 1 -
>  7 files changed, 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c 
> b/drivers/gpu/drm/omapdrm/dss/dpi.c
> index 1d2992daef40..030f997eccd0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dpi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c
> @@ -641,7 +641,6 @@ static int dpi_init_output_port(struct dpi_data *dpi, 
> struct device_node *port)
>   out->type = OMAP_DISPLAY_TYPE_DPI;
>   out->dispc_channel = dpi_get_channel(dpi);
>   out->of_port = port_num;
> - out->owner = THIS_MODULE;
>  
>   r = omapdss_device_init_output(out, &dpi->bridge);
>   if (r < 0) {
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 76e4f607d8cf..22718a771d6d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -5443,7 +5443,6 @@ static int dsi_init_output(struct dsi_data *dsi)
>   out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1";
>   out->dispc_channel = dsi_get_channel(dsi);
>   out->dsi_ops = &dsi_ops;
> - out->owner = THIS_MODULE;
>   out->of_port = 0;
>   out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE
>  | DRM_BUS_FLAG_DE_HIGH
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> index a14fbf06cb30..13701571d59b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
> @@ -707,7 +707,6 @@ static int hdmi4_init_output(struct omap_hdmi *hdmi)
>   out->type = OMAP_DISPLAY_TYPE_HDMI;
>   out->name = "hdmi.0";
>   out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> - out->owner = THIS_MODULE;
>   out->of_port = 0;
>  
>   r = omapdss_device_init_output(out, &hdmi->bridge);
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c 
> b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> index b738d9750686..5d627caf90f2 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
> @@ -681,7 +681,6 @@ static int hdmi5_init_output(struct omap_hdmi *hdmi)
>   out->type = OMAP_DISPLAY_TYPE_HDMI;
>   out->name = "hdmi.0";
>   out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> - out->owner = THIS_MODULE;
>   out->of_port = 0;
>  
>   r = omapdss_device_init_output(out, &hdmi->bridge);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index 90e41c635e45..4442e49ffc5c 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -263,8 +263,6 @@ struct omapdss_dsi_ops {
>  struct omap_dss_device {
>   struct device *dev;
>  
> - struct module *owner;
> -
>   struct dss_device *dss;
>   struct drm_bridge *bridge;
>   struct drm_bridge *next_bridge;
> diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c 
> b/drivers/gpu/drm/omapdrm/dss/sdi.c
> index 033fd30074b0..35827b4487bd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/sdi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c
> @@ -314,7 +314,6 @@ static int sdi_init_output(struct sdi_device *sdi)
>   out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
>   /* We have SDI only on OMAP3, where it's on port 1 */
>   out->of_port = 1;
> - out->owner = THIS_MODULE;
>   out->bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE /* 15.5.9.1.2 */
>  | DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE;
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c 
> b/drivers/gpu/drm/omapdrm/dss/venc.c
> index 6e418a0f7572..8ecffe5bbd29 100644
> --- a/drivers/gpu/drm/omapdrm/dss/venc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/venc.c
> @@ -730,7 +730,6 @@ static int venc_init_output(struct venc_device *venc)
>   out->type = OMAP_DISPLAY_TYPE_VENC;
>   out->name = "venc.0";
>   out->dispc_channel = OMAP_DSS_CHANNEL_DIGIT;
> - out->owner = THIS_MODULE;
>   out->of_port = 0;
>  
>   r = omapdss_device_init_output(out, &venc->bridge);

-- 
Regards,

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


Re: [PATCH v3 55/56] drm/omap: remove dispc_ops

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:32PM +0200, Tomi Valkeinen wrote:
> dispc_ops was created to help with the multi-module architecture and
> giving us the possibility of multiple dispc implementations. Neither of
> these is valid anymore, and we can remove dispc_ops and use direct
> calls to dispc.
> 
> Signed-off-by: Tomi Valkeinen 

Acked-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/base.c|   6 --
>  drivers/gpu/drm/omapdrm/dss/dispc.c   | 101 +++---
>  drivers/gpu/drm/omapdrm/dss/dss.h |  71 +-
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  71 --
>  drivers/gpu/drm/omapdrm/omap_crtc.c   |  30 
>  drivers/gpu/drm/omapdrm/omap_drv.c|  15 ++--
>  drivers/gpu/drm/omapdrm/omap_drv.h|   2 +-
>  drivers/gpu/drm/omapdrm/omap_irq.c|  34 -
>  drivers/gpu/drm/omapdrm/omap_plane.c  |  12 +--
>  9 files changed, 143 insertions(+), 199 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c 
> b/drivers/gpu/drm/omapdrm/dss/base.c
> index 08c7c5024896..0aff16bf6edb 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -21,12 +21,6 @@ struct dispc_device *dispc_get_dispc(struct dss_device 
> *dss)
>   return dss->dispc;
>  }
>  
> -const struct dispc_ops *dispc_get_ops(struct dss_device *dss)
> -{
> - return dss->dispc_ops;
> -}
> -
> -
>  /* 
> -
>   * OMAP DSS Devices Handling
>   */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
> b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 48593932bddf..509bac99cb57 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -351,8 +351,6 @@ static unsigned long dispc_plane_pclk_rate(struct 
> dispc_device *dispc,
>  static unsigned long dispc_plane_lclk_rate(struct dispc_device *dispc,
>  enum omap_plane_id plane);
>  
> -static void dispc_clear_irqstatus(struct dispc_device *dispc, u32 mask);
> -
>  static inline void dispc_write_reg(struct dispc_device *dispc, u16 idx, u32 
> val)
>  {
>   __raw_writel(val, dispc->base + idx);
> @@ -379,12 +377,12 @@ static void mgr_fld_write(struct dispc_device *dispc, 
> enum omap_channel channel,
>   REG_FLD_MOD(dispc, rfld->reg, val, rfld->high, rfld->low);
>  }
>  
> -static int dispc_get_num_ovls(struct dispc_device *dispc)
> +int dispc_get_num_ovls(struct dispc_device *dispc)
>  {
>   return dispc->feat->num_ovls;
>  }
>  
> -static int dispc_get_num_mgrs(struct dispc_device *dispc)
> +int dispc_get_num_mgrs(struct dispc_device *dispc)
>  {
>   return dispc->feat->num_mgrs;
>  }
> @@ -667,13 +665,13 @@ void dispc_runtime_put(struct dispc_device *dispc)
>   WARN_ON(r < 0 && r != -ENOSYS);
>  }
>  
> -static u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_vsync_irq(struct dispc_device *dispc,
>  enum omap_channel channel)
>  {
>   return mgr_desc[channel].vsync_irq;
>  }
>  
> -static u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_framedone_irq(struct dispc_device *dispc,
>  enum omap_channel channel)
>  {
>   if (channel == OMAP_DSS_CHANNEL_DIGIT && dispc->feat->no_framedone_tv)
> @@ -682,18 +680,18 @@ static u32 dispc_mgr_get_framedone_irq(struct 
> dispc_device *dispc,
>   return mgr_desc[channel].framedone_irq;
>  }
>  
> -static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
> +u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc,
>  enum omap_channel channel)
>  {
>   return mgr_desc[channel].sync_lost_irq;
>  }
>  
> -static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
> +u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc)
>  {
>   return DISPC_IRQ_FRAMEDONEWB;
>  }
>  
> -static void dispc_mgr_enable(struct dispc_device *dispc,
> +void dispc_mgr_enable(struct dispc_device *dispc,
>enum omap_channel channel, bool enable)
>  {
>   mgr_fld_write(dispc, channel, DISPC_MGR_FLD_ENABLE, enable);
> @@ -707,13 +705,13 @@ static bool dispc_mgr_is_enabled(struct dispc_device 
> *dispc,
>   return !!mgr_fld_read(dispc, channel, DISPC_MGR_FLD_ENABLE);
>  }
>  
> -static bool dispc_mgr_go_busy(struct dispc_device *dispc,
> +bool dispc_mgr_go_busy(struct dispc_device *dispc,
> enum omap_channel channel)
>  {
>   return mgr_fld_read(dispc, channel, DISPC_MGR_FLD_GO) == 1;
>  }
>  
> -static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel 
> channel)
> +void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel)
>  {
>   WARN_ON(!dispc_mgr_is_enabled(dispc, channel));
>   WARN_ON(dispc_mgr_go_busy(dispc, channel));
> @@ -723,12 +721,12 @@ static void dis

Re: [PATCH v3 56/56] drm/omap: remove dss_mgr_ops

2020-11-09 Thread Laurent Pinchart
Hi Tomi,

Thank you for the patch.

On Thu, Nov 05, 2020 at 02:03:33PM +0200, Tomi Valkeinen wrote:
> dss_mgr_ops was needed with the multi-module architecture, but is no
> longer needed. We can thus remove it and use direct calls.
> 
> Signed-off-by: Tomi Valkeinen 

Acked-by: Laurent Pinchart 

> ---
>  drivers/gpu/drm/omapdrm/dss/dss.h |  1 -
>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 42 +++
>  drivers/gpu/drm/omapdrm/dss/output.c  | 33 +
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 38 +---
>  drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 --
>  drivers/gpu/drm/omapdrm/omap_drv.c|  4 +--
>  6 files changed, 33 insertions(+), 87 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h 
> b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 96f702314c8c..a547527bb2f3 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -257,7 +257,6 @@ struct dss_device {
>   struct dss_pll  *video2_pll;
>  
>   struct dispc_device *dispc;
> - const struct dss_mgr_ops *mgr_ops;
>   struct omap_drm_private *mgr_ops_priv;
>  };
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h 
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index fba5f05e5e48..9df322ca467d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -338,31 +338,23 @@ enum dss_writeback_channel {
>   DSS_WB_LCD3_MGR =   7,
>  };
>  
> -struct dss_mgr_ops {
> - void (*start_update)(struct omap_drm_private *priv,
> -  enum omap_channel channel);
> - int (*enable)(struct omap_drm_private *priv,
> -   enum omap_channel channel);
> - void (*disable)(struct omap_drm_private *priv,
> - enum omap_channel channel);
> - void (*set_timings)(struct omap_drm_private *priv,
> - enum omap_channel channel,
> - const struct videomode *vm);
> - void (*set_lcd_config)(struct omap_drm_private *priv,
> -enum omap_channel channel,
> -const struct dss_lcd_mgr_config *config);
> - int (*register_framedone_handler)(struct omap_drm_private *priv,
> - enum omap_channel channel,
> - void (*handler)(void *), void *data);
> - void (*unregister_framedone_handler)(struct omap_drm_private *priv,
> - enum omap_channel channel,
> - void (*handler)(void *), void *data);
> -};
> -
> -int dss_install_mgr_ops(struct dss_device *dss,
> - const struct dss_mgr_ops *mgr_ops,
> - struct omap_drm_private *priv);
> -void dss_uninstall_mgr_ops(struct dss_device *dss);
> +void omap_crtc_dss_start_update(struct omap_drm_private *priv,
> +enum omap_channel channel);
> +void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable);
> +int omap_crtc_dss_enable(struct omap_drm_private *priv, enum omap_channel 
> channel);
> +void omap_crtc_dss_disable(struct omap_drm_private *priv, enum omap_channel 
> channel);
> +void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
> + enum omap_channel channel,
> + const struct videomode *vm);
> +void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
> + enum omap_channel channel,
> + const struct dss_lcd_mgr_config *config);
> +int omap_crtc_dss_register_framedone(
> + struct omap_drm_private *priv, enum omap_channel channel,
> + void (*handler)(void *), void *data);
> +void omap_crtc_dss_unregister_framedone(
> + struct omap_drm_private *priv, enum omap_channel channel,
> + void (*handler)(void *), void *data);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>   const struct videomode *vm);
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
> b/drivers/gpu/drm/omapdrm/dss/output.c
> index 7a14d2b5b2f7..2121c947947b 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -81,54 +81,35 @@ void omapdss_device_cleanup_output(struct omap_dss_device 
> *out)
>   out->next_bridge : out->bridge);
>  }
>  
> -int dss_install_mgr_ops(struct dss_device *dss,
> - const struct dss_mgr_ops *mgr_ops,
> - struct omap_drm_private *priv)
> -{
> - if (dss->mgr_ops)
> - return -EBUSY;
> -
> - dss->mgr_ops = mgr_ops;
> - dss->mgr_ops_priv = priv;
> -
> - return 0;
> -}
> -
> -void dss_uninstall_mgr_ops(struct dss_device *dss)
> -{
> - dss->mgr_ops = NULL;
> - dss->mgr_ops_priv = NULL;
> -}
> -
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>const struct videomode *vm)
>  {
> - dssdev->dss->mgr_ops->set_timings(dssdev->dss->mgr_ops_priv,

Re: [git pull] drm next pull for 5.10-rc1

2020-11-09 Thread Kirill A. Shutemov
On Wed, Nov 04, 2020 at 04:58:14PM -0500, Lyude Paul wrote:
> ACK, I will send out a patch for this asap

Any update. AFAICS, v5.10-rc3 is still buggy.

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


Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-09 Thread Tomi Valkeinen
On 07/11/2020 14:19, H. Nikolaus Schaller wrote:

> I have set up based on our complete letux-5.10-rc2 tree and maybe using our 
> private config makes
> the difference. Anyways, the driver is now probed and I can see the call to 
> w677l_get_modes().
> 
> I have still no image and no calls to prepare/unprepare etc. but now I can 
> start to debug on omap5.
> And hopefully we are close to push the panel driver for review. And in a 
> second step some device
> tree for the Pyra.
> 
> The new tree is here: 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel

Ok, good. Do you have a link the previous driver that works (omapdrm specific 
panel driver)? I think
it's good to have that as a reference.

 Tomi

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


Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic

2020-11-09 Thread Tomi Valkeinen
On 05/11/2020 14:02, Tomi Valkeinen wrote:
> From: Sebastian Reichel 
> 
> This drops the virtual channel logic. Afterwards DSI clients
> request their channel number and get the virtual channel with
> the same number or -EBUSY if already in use.
> 
> Signed-off-by: Sebastian Reichel 
> Signed-off-by: Tomi Valkeinen 
> ---
>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>  drivers/gpu/drm/omapdrm/dss/dsi.c | 46 ---
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 +-
>  3 files changed, 12 insertions(+), 49 deletions(-)

A comment about this (and other virtual channel logic changes): When Sebastian 
sent the series in
Feb, I commented that the VC change is not correct. That's still true, and I 
did not fix it as I'm
not sure how to fix it, and however it is fixed has to be fully inside dsi.c 
(so it doesn't affect
e.g. the panel drivers).

However, it works just fine. The case where things will break is when we need 
to use multiple VCs
(OMAP DSI's "configuration blocks", not virtual channel ID numbers). Command 
mode panels don't need
this. Video mode panels might need it, but it's not quite clear to me if it's 
strictly needed, or is
it just an optimization.

I hope to get a board with video mode panel soonish, or help Nikolaus to debug 
this.

 Tomi

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


Re: [PATCH v3 09/56] drm/omap: dsi: drop virtual channel logic

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 10:14, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:46PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel 
>>
>> This drops the virtual channel logic. Afterwards DSI clients
>> request their channel number and get the virtual channel with
>> the same number or -EBUSY if already in use.
> 
> It could be useful to explain the reason for this patch (which, if I
> understand the patch correctly, is to replace dynamic allocation of
> virtual channels with a fixed allocation by the DSI panel, I assume
> because dynamic allocation isn't actually useful ?).

Yes, I can elaborate on that in v4. I also just sent a separate mail about it.

>> Signed-off-by: Sebastian Reichel 
>> Signed-off-by: Tomi Valkeinen 
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 11 ++---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c | 46 ---
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  4 +-
>>  3 files changed, 12 insertions(+), 49 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
>> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index 8b2e80129bd8..ea76a89d1833 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -768,19 +768,12 @@ static int dsicm_connect(struct omap_dss_device *src,
>>  struct device *dev = &ddata->pdev->dev;
>>  int r;
>>  
>> -r = src->ops->dsi.request_vc(src, &ddata->channel);
>> +r = src->ops->dsi.request_vc(src, ddata->channel);
>>  if (r) {
>>  dev_err(dev, "failed to get virtual channel\n");
>>  return r;
>>  }
>>  
>> -r = src->ops->dsi.set_vc_id(src, ddata->channel, TCH);
>> -if (r) {
>> -dev_err(dev, "failed to set VC_ID\n");
>> -src->ops->dsi.release_vc(src, ddata->channel);
>> -return r;
>> -}
>> -
>>  ddata->src = src;
>>  return 0;
>>  }
>> @@ -1215,6 +1208,8 @@ static int dsicm_probe_of(struct platform_device *pdev)
>>  struct display_timing timing;
>>  int err;
>>  
>> +ddata->channel = TCH;
> 
> I'd drop the macro, but no big deal.
> 
> Reviewed-by: Laurent Pinchart 

It's dropped in a later patch.

 Tomi

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


Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver

2020-11-09 Thread Sebastian Reichel
Hi,

On Mon, Nov 09, 2020 at 12:08:33PM +0200, Tomi Valkeinen wrote:
> On 09/11/2020 11:52, Laurent Pinchart wrote:
> > Hi Tomi,
> > 
> > Thank you for the patch.
> > 
> > On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
> >> From: Sebastian Reichel 
> >>
> >> This moves the bus locking into the host driver and unexports
> >> the custom API in preparation for drm_panel support.
> >>
> >> Signed-off-by: Sebastian Reichel 
> >> Signed-off-by: Tomi Valkeinen 
> 
> 
> 
> >>  static int dsicm_update(struct omap_dss_device *dssdev,
> >> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
> >>dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
> >>  
> >>mutex_lock(&ddata->lock);
> >> -  src->ops->dsi.bus_lock(src);
> >>  
> >>r = dsicm_wake_up(ddata);
> >>if (r)
> >> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device 
> >> *dssdev,
> >>if (r)
> >>goto err;
> >>  
> >> -  /* note: no bus_unlock here. unlock is src framedone_cb */
> >> -  mutex_unlock(&ddata->lock);
> >> +  /* note: no unlock here. unlock is src framedone_cb */
> > 
> > This change isn't described in the commit message. Could you explain why
> > it's needed ? Locking a mutex in a function and unlocking it elsewhere
> > always scares me.
> 
> Good catch. I don't know why it is needed. I don't think it is, as
> the dsi driver handles the bus lock.
> 
> Sebastian, what was the reason for this lock?
> 
> Note that this goes away in the series, and there's no such lock
> in the end.

It's not really a change. What this patch basically does is to fold
src->ops->dsi.bus_lock(src) into mutex_lock(&ddata->lock), so that
there is only a single locking mechanism. This function previously
had a matching pair of mutex_lock/unlock for ddata->lock, but the
bus was not locked paired. So after conversion the lock must not be
free'd here.

My understanding is, that this is because the bus must not be used
until the update has been done.

-- Sebastian

> >>return 0;
> >>  err:
> >> -  src->ops->dsi.bus_unlock(src);
> >>mutex_unlock(&ddata->lock);
> >>return r;
> >>  }
> >> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
> >>struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
> >>ulps_work.work);
> >>struct omap_dss_device *dssdev = &ddata->dssdev;
> >> -  struct omap_dss_device *src = ddata->src;
> >>  
> >>mutex_lock(&ddata->lock);
> >>  
> >> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
> >>return;
> >>}
> >>  
> >> -  src->ops->dsi.bus_lock(src);
> >> -
> >>dsicm_enter_ulps(ddata);
> >>  
> >> -  src->ops->dsi.bus_unlock(src);
> >>mutex_unlock(&ddata->lock);
> >>  }
> >>  
> >> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> >> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> index 41431ca34568..d54b743c2b48 100644
> >> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> >> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, 
> >> const struct dsi_reg idx)
> >>return __raw_readl(base + idx.idx);
> >>  }
> >>  
> >> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
> >> +static void dsi_bus_lock(struct dsi_data *dsi)
> >>  {
> >> -  struct dsi_data *dsi = to_dsi_data(dssdev);
> >> -
> >>down(&dsi->bus_lock);
> > 
> > Nothing to be addressed in this patch, but is there a reason to use a
> > semaphore instead of a mutex ?
> 
> It's been a long time, but I think the reason was that mutex gave a warning 
> after being locked for a
> bit longer time, and semaphore didn't. The resource is reserved while a DSI 
> transfer is active, so
> it could be almost 2 frames (wait for vsync and then transfer frame). Or 
> reading the frame buffer
> back from the panel, which could take a long time (seconds).
> 
> There are better ways to implement it (after this series =).
> 
>  Tomi
> 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


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


Re: [PATCH v3 22/56] drm/omap: dsi: use pixel-format and mode from attach

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 10:49, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:59PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel 
>>
>> In order to reduce the amount of custom functionality, this moves
>> handling of pixel format and DSI mode from set_config() to dsi
>> attach.
>>
>> Signed-off-by: Sebastian Reichel 
>> Signed-off-by: Tomi Valkeinen 
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   |  2 --
>>  drivers/gpu/drm/omapdrm/dss/dsi.c | 31 ---
>>  2 files changed, 19 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
>> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index a9609eed6bfa..2e9de33fc8d4 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -550,8 +550,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>>  u8 id1, id2, id3;
>>  int r;
>>  struct omap_dss_dsi_config dsi_config = {
>> -.mode = OMAP_DSS_DSI_CMD_MODE,
>> -.pixel_format = MIPI_DSI_FMT_RGB888,
>>  .vm = &ddata->vm,
>>  .hs_clk_min = 15000,
>>  .hs_clk_max = 3,
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
>> b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index a16427f3bc23..e341aca92462 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -4579,24 +4579,19 @@ static int dsi_set_config(struct omap_dss_device 
>> *dssdev,
>>  {
>>  struct dsi_data *dsi = to_dsi_data(dssdev);
>>  struct dsi_clk_calc_ctx ctx;
>> +struct omap_dss_dsi_config cfg = *config;
>>  bool ok;
>>  int r;
>>  
>>  mutex_lock(&dsi->lock);
>>  
>> -dsi->pix_fmt = config->pixel_format;
>> -dsi->mode = config->mode;
>> +cfg.mode = dsi->mode;
>> +cfg.pixel_format = dsi->pix_fmt;
>>  
>> -if (mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) < 0) {
>> -DSSERR("invalid pixel format\n");
>> -r = -EINVAL;
>> -goto err;
>> -}
>> -
>> -if (config->mode == OMAP_DSS_DSI_VIDEO_MODE)
>> -ok = dsi_vm_calc(dsi, config, &ctx);
>> +if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE)
>> +ok = dsi_vm_calc(dsi, &cfg, &ctx);
>>  else
>> -ok = dsi_cm_calc(dsi, config, &ctx);
>> +ok = dsi_cm_calc(dsi, &cfg, &ctx);
>>  
>>  if (!ok) {
>>  DSSERR("failed to find suitable DSI clock settings\n");
>> @@ -4607,7 +4602,7 @@ static int dsi_set_config(struct omap_dss_device 
>> *dssdev,
>>  dsi_pll_calc_dsi_fck(dsi, &ctx.dsi_cinfo);
>>  
>>  r = dsi_lp_clock_calc(ctx.dsi_cinfo.clkout[HSDIV_DSI],
>> -config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo);
>> +cfg.lp_clk_min, cfg.lp_clk_max, &dsi->user_lp_cinfo);
>>  if (r) {
>>  DSSERR("failed to find suitable DSI LP clock settings\n");
>>  goto err;
>> @@ -4785,7 +4780,19 @@ static int omap_dsi_host_attach(struct mipi_dsi_host 
>> *host,
>>  return -EBUSY;
>>  }
>>  
>> +if (mipi_dsi_pixel_format_to_bpp(client->format) < 0) {
>> +DSSERR("invalid pixel format\n");
>> +return -EINVAL;
>> +}
>> +
>>  dsi->vc[channel].dest = client;
>> +
>> +dsi->pix_fmt = client->format;
> 
> Does this mean that all clients must use the same pixel format ? Do we
> even support multiple clients ? If no the VC allocation could be
> simplified.

The driver does not (and has not) support multiple DSI peripherals, even if the 
plumbing has been
there. Yes, the VC handling can be made simpler. I would prefer to do that 
after this series.

As I see it, the main point of this series is to move to DRM model while 
keeping the current
mainline drivers working (dsi and panel-dsi-cm). That will enable many cleanups 
also outside the dsi
driver. The series adds some shortcuts in places where they don't affect the 
supported setup.

When we get to the end, we'll be using DRM bridge and panel model, and 
re-writing the VC handling
(and some other parts) should fall into place much more neatly than doing them 
either before the
series (on top of omapdrm's custom APIs) or inside the series.

 Tomi

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


Re: [PATCH v3 19/56] drm/omap: dsi: drop unused get_te()

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 10:45, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:56PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel 
>>
>> The get_te() callback is not used, so we can drop the
>> custom API.
>>
>> Signed-off-by: Sebastian Reichel 
>> Signed-off-by: Tomi Valkeinen 
> 
> You could squash this with the previous and next patches.

I'd rather keep them separate. They are independent changes, and managing 
conflicts is easier when
the patches do only a single thing.

 Tomi

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


Re: [PATCH v3 27/56] drm/omap: dsi: do bus locking in host driver

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 11:52, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:03:04PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel 
>>
>> This moves the bus locking into the host driver and unexports
>> the custom API in preparation for drm_panel support.
>>
>> Signed-off-by: Sebastian Reichel 
>> Signed-off-by: Tomi Valkeinen 



>>  static int dsicm_update(struct omap_dss_device *dssdev,
>> @@ -739,7 +704,6 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  dev_dbg(&ddata->dsi->dev, "update %d, %d, %d x %d\n", x, y, w, h);
>>  
>>  mutex_lock(&ddata->lock);
>> -src->ops->dsi.bus_lock(src);
>>  
>>  r = dsicm_wake_up(ddata);
>>  if (r)
>> @@ -761,11 +725,9 @@ static int dsicm_update(struct omap_dss_device *dssdev,
>>  if (r)
>>  goto err;
>>  
>> -/* note: no bus_unlock here. unlock is src framedone_cb */
>> -mutex_unlock(&ddata->lock);
>> +/* note: no unlock here. unlock is src framedone_cb */
> 
> This change isn't described in the commit message. Could you explain why
> it's needed ? Locking a mutex in a function and unlocking it elsewhere
> always scares me.

Good catch. I don't know why it is needed. I don't think it is, as the dsi 
driver handles the bus lock.

Sebastian, what was the reason for this lock?

Note that this goes away in the series, and there's no such lock in the end.

>>  return 0;
>>  err:
>> -src->ops->dsi.bus_unlock(src);
>>  mutex_unlock(&ddata->lock);
>>  return r;
>>  }
>> @@ -791,7 +753,6 @@ static void dsicm_ulps_work(struct work_struct *work)
>>  struct panel_drv_data *ddata = container_of(work, struct panel_drv_data,
>>  ulps_work.work);
>>  struct omap_dss_device *dssdev = &ddata->dssdev;
>> -struct omap_dss_device *src = ddata->src;
>>  
>>  mutex_lock(&ddata->lock);
>>  
>> @@ -800,11 +761,8 @@ static void dsicm_ulps_work(struct work_struct *work)
>>  return;
>>  }
>>  
>> -src->ops->dsi.bus_lock(src);
>> -
>>  dsicm_enter_ulps(ddata);
>>  
>> -src->ops->dsi.bus_unlock(src);
>>  mutex_unlock(&ddata->lock);
>>  }
>>  
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
>> b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index 41431ca34568..d54b743c2b48 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -476,17 +476,13 @@ static inline u32 dsi_read_reg(struct dsi_data *dsi, 
>> const struct dsi_reg idx)
>>  return __raw_readl(base + idx.idx);
>>  }
>>  
>> -static void dsi_bus_lock(struct omap_dss_device *dssdev)
>> +static void dsi_bus_lock(struct dsi_data *dsi)
>>  {
>> -struct dsi_data *dsi = to_dsi_data(dssdev);
>> -
>>  down(&dsi->bus_lock);
> 
> Nothing to be addressed in this patch, but is there a reason to use a
> semaphore instead of a mutex ?

It's been a long time, but I think the reason was that mutex gave a warning 
after being locked for a
bit longer time, and semaphore didn't. The resource is reserved while a DSI 
transfer is active, so
it could be almost 2 frames (wait for vsync and then transfer frame). Or 
reading the frame buffer
back from the panel, which could take a long time (seconds).

There are better ways to implement it (after this series =).

 Tomi

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


Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
> 
>> Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen :
>>
>> On 07/11/2020 14:19, H. Nikolaus Schaller wrote:
>>
>>> I have set up based on our complete letux-5.10-rc2 tree and maybe using our 
>>> private config makes
>>> the difference. Anyways, the driver is now probed and I can see the call to 
>>> w677l_get_modes().
>>>
>>> I have still no image and no calls to prepare/unprepare etc. but now I can 
>>> start to debug on omap5.
>>> And hopefully we are close to push the panel driver for review. And in a 
>>> second step some device
>>> tree for the Pyra.
>>>
>>> The new tree is here: 
>>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel
>>
>> Ok, good. Do you have a link the previous driver that works (omapdrm 
>> specific panel driver)? I think
>> it's good to have that as a reference.
> 
> Yes, here:
> 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels

Ok. The old driver uses two separate VC configurations (request_vc calls), so 
it may not work with
this series. I think we need to implement logic to the dsi driver to somehow 
handle this kind of setup.

 Tomi

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


Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 12:31, H. Nikolaus Schaller wrote:
> 
>> Am 09.11.2020 um 11:22 schrieb Tomi Valkeinen :
>>
>> On 09/11/2020 11:30, H. Nikolaus Schaller wrote:
>>>
 Am 09.11.2020 um 09:04 schrieb Tomi Valkeinen :

 On 07/11/2020 14:19, H. Nikolaus Schaller wrote:

> I have set up based on our complete letux-5.10-rc2 tree and maybe using 
> our private config makes
> the difference. Anyways, the driver is now probed and I can see the call 
> to w677l_get_modes().
>
> I have still no image and no calls to prepare/unprepare etc. but now I 
> can start to debug on omap5.
> And hopefully we are close to push the panel driver for review. And in a 
> second step some device
> tree for the Pyra.
>
> The new tree is here: 
> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/work-pyra-panel

 Ok, good. Do you have a link the previous driver that works (omapdrm 
 specific panel driver)? I think
 it's good to have that as a reference.
>>>
>>> Yes, here:
>>>
>>> https://git.goldelico.com/?p=letux-kernel.git;a=shortlog;h=refs/heads/letux/panels
>>
>> Ok. The old driver uses two separate VC configurations (request_vc calls),
> 
> yes indeed. I was not sure how to handle this with the new omapdrm drivers.
> 
>> so it may not work with
>> this series. I think we need to implement logic to the dsi driver to somehow 
>> handle this kind of setup.
> 
> I see.
> Anyways there is missing some simple thing which makes the driver not 
> prepared/enabled.
> Or is this related to VC?

No, that's not related to the VC.

 Tomi

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


Re: [PATCH v3 19/20] drm/tegra: Implement new UAPI

2020-11-09 Thread Mikko Perttunen

On 10/31/20 1:13 AM, Dmitry Osipenko wrote:

28.10.2020 12:54, Mikko Perttunen пишет:

On 10/27/20 9:06 PM, Dmitry Osipenko wrote:

26.10.2020 12:11, Mikko Perttunen пишет:


The first patches should be the ones that are relevant to the existing
userspace code, like support for the waits.


Can you elaborate what you mean by this?


All features that don't have an immediate real use-case should be placed
later in the series because we may defer merging of those patches until
we will see userspace that uses those features since we can't really
decide whether these are decisions that we won't regret later on, only
practical application can confirm the correctness.


I was more referring to the "support for waits" part, should have
clarified that.


The "support for waits" is support for the WAIT_SYNCPT command exposed
to userspace, which we could utilize right now.


Partial mappings should be a separate feature because it's a
questionable feature that needs to be proved by a real userspace first.
Maybe it would be even better to drop it for the starter, to ease
reviewing.


Considering that the "no-op" support for it (map the whole buffer but
just keep track of the starting offset) is only a couple of lines, I'd
like to keep it in.


There is no tracking in the current code which prevents the duplicated
mappings, will we need to care about it? This a bit too questionable
feature for now, IMO. I'd like to see it as a separate patch.


I don't think there is any need to special case duplicated mappings. I
think this is a pretty obvious feature to have, but I can rename them to
reserved0 and reserved1 and require that reserved0 is zero and reserved1
is the size of the passed GEM object.


I'm now concerned about the reserved fields after seeing this reply from
Daniel Vetter:

https://www.mail-archive.com/nouveau@lists.freedesktop.org/msg36324.html

If DRM IOCTL structs are zero-extended, then perhaps we won't need to
reserve anything?


I guess for the channel_map we can drop the offset/length, I just think 
it's fairly obvious that an IOMMU mapping API lets you specify from 
where and how much you want to map. Sure, it's not a functionality 
blocker as it can simply be implemented in userspace by shifting the 
reloc offset / IOVA equivalently, but it will reduce IO address space 
usage and prevent access to memory that was not intended to be mapped to 
the engine. The latter becomes a major PITA if you need to create safety 
documentation at this level -- don't know if this is relevant on Linux 
or not..





...

I'd like to see the DRM_SCHED and syncobj support. I can help you with
it if it's out of yours scope for now.



I already wrote some code for syncobj I can probably pull in. Regarding
DRM_SCHED, help is accepted. However, we should keep using the hardware
scheduler, and considering it's a bigger piece of work, let's not block
this series on it.


I'd like to see all the custom IOCTLs to be deprecated and replaced with
the generic DRM API wherever possible. Hence, I think it should be a
mandatory features that we need to focus on. The current WIP userspace
already uses and relies on DRM_SCHED.



 From my point of view, the ABI needs to be designed such that it can
replace what we have downstream, i.e. it needs to support the usecases
the downstream nvhost ABI supports currently. Otherwise there is no
migration path to upstream and it's not worth it for me to work on this.


The downstream needs should be irrelevant for the upstream, please read
this:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements

It may happen that some of the downstream features could become useful
for upstream, but we don't know until we will see the full userspace code.

We don't have a comprehensive userspace which could utilize all the new
features and that's why upstream driver has been stagnated for many
years now. The grate-drivers would greatly benefit from the updated ABI,
but I think that we need at least a usable mesa driver first, that's why
I haven't bothered to upstream anything from the WIP UAPI v2.

In order to upstream new UAPI features we will need:

   1. Hardware specs (from vendor or reverse-engineered).
   2. Regression tests.
   3. A non-toy opensource userspace. >

Although, I don't see what this ABI is missing that your userspace would
rely on. Does it submit jobs in reverse order that would deadlock if
drm_sched didn't reorder them based on prefences, or something?


It's the opposite, we don't have userspace which needs majority of the
proposed ABI. This needs to be fixed before we could seriously consider
merging the new features.

I'm pretty sure that you was already aware about all the upstreaming
requirements and we will see the usable opensource userspace at some
point, correct?


I am well aware of that. I'm not saying that we should copy the 
downstream stack. I am saying that when designing an ABI, we should 
consider all information available on what

Re: [PATCH 1/4] drm/ttm: add multihop infrastrucutre (v2)

2020-11-09 Thread Ville Syrjälä
On Wed, Nov 11, 2020 at 06:13:02PM +0100, Christian König wrote:
> Am 09.11.20 um 01:54 schrieb Dave Airlie:
> > @@ -1432,15 +1479,18 @@ int ttm_bo_swapout(struct ttm_operation_ctx *ctx)
> > if (bo->mem.mem_type != TTM_PL_SYSTEM) {
> > struct ttm_operation_ctx ctx = { false, false };
> > struct ttm_resource evict_mem;
> > +   struct ttm_place hop = {};
> 
> Please always use memset() if you want to zero initialize something in 
> the kernel, we had enough trouble with that.

What trouble is that? I've not heard of anything, and we use
={} quite extensively in drm land.

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 15/56] drm/omap: dsi: request VC via mipi_dsi_attach

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 10:42, Laurent Pinchart wrote:
> Hi Tomi and Sebastian,
> 
> Thank you for the patch.
> 
> On Thu, Nov 05, 2020 at 02:02:52PM +0200, Tomi Valkeinen wrote:
>> From: Sebastian Reichel 
>>
>> Drop custom request_vc/release_vc callbacks by using the
>> generic mipi_dsi_attach/mipi_dsi_detach functions.
>>
>> Signed-off-by: Sebastian Reichel 
>> Signed-off-by: Tomi Valkeinen 
>> ---
>>  .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 24 +---
>>  drivers/gpu/drm/omapdrm/dss/dsi.c | 61 ---
>>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  3 -
>>  3 files changed, 41 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
>> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> index ec36e62ddc3a..b1ca9b34ce17 100644
>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
>> @@ -693,14 +693,6 @@ static int dsicm_connect(struct omap_dss_device *src,
>>   struct omap_dss_device *dst)
>>  {
>>  struct panel_drv_data *ddata = to_panel_data(dst);
>> -struct device *dev = &ddata->dsi->dev;
>> -int r;
>> -
>> -r = src->ops->dsi.request_vc(src, ddata->channel);
>> -if (r) {
>> -dev_err(dev, "failed to get virtual channel\n");
>> -return r;
>> -}
>>  
>>  ddata->src = src;
>>  return 0;
>> @@ -711,7 +703,6 @@ static void dsicm_disconnect(struct omap_dss_device *src,
>>  {
>>  struct panel_drv_data *ddata = to_panel_data(dst);
>>  
>> -src->ops->dsi.release_vc(src, ddata->channel);
>>  ddata->src = NULL;
>>  }
>>  
>> @@ -1276,8 +1267,21 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>>  goto err_bl;
>>  }
>>  
>> +dsi->lanes = 3;
>> +dsi->format = MIPI_DSI_FMT_RGB888;
>> +dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS |
>> +  MIPI_DSI_MODE_EOT_PACKET;
>> +dsi->hs_rate = 3;
>> +dsi->lp_rate = 1000;
> 
> Should this change be explained in the commit message ?

I added:

To use mipi_dsi_attach() we need to fill in the mipi_dsi_device fields,
and some of these fields overlap with the fields in omap_dss_dsi_config.
In later patches the latter will get dropped.

>> +
>> +r = mipi_dsi_attach(dsi);
>> +if (r < 0)
>> +goto err_dsi_attach;
>> +
>>  return 0;
>>  
>> +err_dsi_attach:
>> +sysfs_remove_group(&dsi->dev.kobj, &dsicm_attr_group);
>>  err_bl:
>>  destroy_workqueue(ddata->workqueue);
>>  err_reg:
>> @@ -1294,6 +1298,8 @@ static int __exit dsicm_remove(struct mipi_dsi_device 
>> *dsi)
>>  
>>  dev_dbg(&dsi->dev, "remove\n");
>>  
>> +mipi_dsi_detach(dsi);
>> +
>>  omapdss_device_unregister(dssdev);
>>  
>>  if (omapdss_device_is_enabled(dssdev))
>> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
>> b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> index d1187a8af37f..a16427f3bc23 100644
>> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
>> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
>> @@ -349,7 +349,7 @@ struct dsi_data {
>>  
>>  struct {
>>  enum dsi_vc_source source;
>> -struct omap_dss_device *dssdev;
>> +struct mipi_dsi_device *dest;
> 
> How about naming this dsidev ?

Maybe, but... dsidev was used to refer to the DSI host not that long ago. While 
going through these
patches, I thought about renaming "dest", but then I decided that "dest" a new 
name and perhaps a
good one to have during this transition period.

 Tomi

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


Re: [PATCH 14/19] gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct drm_dp_sideband_msg_req_body' onto the heap

2020-11-09 Thread Ville Syrjälä
On Thu, Nov 05, 2020 at 02:45:12PM +, Lee Jones wrote:
> The stack is too full.
> 
> Fixes the following W=1 kernel build warning(s):
> 
>  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c: In function 
> ‘sideband_msg_req_encode_decode’:
>  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:161:1: warning: the frame 
> size of 1176 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Lyude Paul 
> Cc: David Francis 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Lee Jones 
> ---
>  .../drm/selftests/test-drm_dp_mst_helper.c| 29 ---
>  1 file changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c 
> b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> index 1d696ec001cff..0a539456f6864 100644
> --- a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> +++ b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> @@ -120,44 +120,51 @@ sideband_msg_req_equal(const struct 
> drm_dp_sideband_msg_req_body *in,
>  static bool
>  sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
>  {
> - struct drm_dp_sideband_msg_req_body out = {0};
> + struct drm_dp_sideband_msg_req_body *out;

How big is it? And why is it that big?

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Sam Ravnborg
Hi Lee,
> > 
> > Other public functions in radeon_device.c have their prototype in
> > radeon.h - for example radeon_is_px()
> > 
> > Add radeon_device_is_virtual() there so we avoiid this new header.
> 
> Oh yes, I remember why this wasn't a suitable solution now:
> 
> The macro "radeon_init" in radeon.h clashes with the init function of
> the same name in radeon_drv.c:
> 
>   In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
>   drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or 
> ‘(’ before ‘void’
>   620 | static int __init radeon_init(void)
...
> 
> How would you like me to move forward?

Fix the thousand of warnings in other places :-)
I will take a look at radeon and post a new series based on your work
with all W=1 warnings fixed.

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


Re: [PATCH v3 00/56] Convert DSI code to use drm_mipi_dsi and drm_panel

2020-11-09 Thread Tomi Valkeinen
On 09/11/2020 13:09, H. Nikolaus Schaller wrote:

>>> I see.
>>> Anyways there is missing some simple thing which makes the driver not 
>>> prepared/enabled.
>>> Or is this related to VC?
>>
>> No, that's not related to the VC.
> 
> Ok, then it is worth searching for that independently. Any idea/hint what 
> could be missing?

Well, if I had to guess, I would go for either 1) some registration or such is 
missing from the
panel driver, or 2) some config value is invalid, which makes the DRM framework 
or the DSI driver
fail before calling prepare or enable.

 Tomi

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


Re: [PATCH 2/5] drm/tidss: Set bus_format correctly from bridge/connector

2020-11-09 Thread Nikhil Devshatwar
On 00:57-20201030, Laurent Pinchart wrote:
> Hi Nikhil,
> 
> Thank you for the patch.
> 
> On Fri, Oct 16, 2020 at 04:09:14PM +0530, Nikhil Devshatwar wrote:
> > When there is a chain of bridges attached to the encoder,
> > the bus_format should be ideally set from the input format of the
> > first bridge in the chain.
> > 
> > Use the bridge state to get the negotiated bus_format.
> > If the bridge does not support format negotiation, error out
> > and fail.
> > 
> > Signed-off-by: Nikhil Devshatwar 
> > ---
> >  drivers/gpu/drm/tidss/tidss_encoder.c | 16 +++-
> >  1 file changed, 11 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c 
> > b/drivers/gpu/drm/tidss/tidss_encoder.c
> > index e278a9c89476..ae7f134754b7 100644
> > --- a/drivers/gpu/drm/tidss/tidss_encoder.c
> > +++ b/drivers/gpu/drm/tidss/tidss_encoder.c
> > @@ -22,6 +22,7 @@ static int tidss_encoder_atomic_check(struct drm_encoder 
> > *encoder,
> > struct drm_device *ddev = encoder->dev;
> > struct tidss_crtc_state *tcrtc_state = to_tidss_crtc_state(crtc_state);
> > struct drm_display_info *di = &conn_state->connector->display_info;
> > +   struct drm_bridge_state *bstate;
> > struct drm_bridge *bridge;
> > bool bus_flags_set = false;
> >  
> > @@ -41,14 +42,19 @@ static int tidss_encoder_atomic_check(struct 
> > drm_encoder *encoder,
> > break;
> > }
> >  
> > -   if (!di->bus_formats || di->num_bus_formats == 0)  {
> > -   dev_err(ddev->dev, "%s: No bus_formats in connected display\n",
> > -   __func__);
> > +   /* Copy the bus_format from the input_bus_format of first bridge */
> > +   bridge = drm_bridge_chain_get_first_bridge(encoder);
> > +   bstate = drm_atomic_get_new_bridge_state(crtc_state->state, bridge);
> > +   if (bstate)
> > +   tcrtc_state->bus_format = bstate->input_bus_cfg.format;
> > +
> > +   if (tcrtc_state->bus_format == 0 ||
> > +   tcrtc_state->bus_format == MEDIA_BUS_FMT_FIXED) {
> > +
> > +   dev_err(ddev->dev, "Bridge connected to the encoder did not 
> > specify media bus format\n");
> > return -EINVAL;
> > }
> >  
> > -   // XXX any cleaner way to set bus format and flags?
> > -   tcrtc_state->bus_format = di->bus_formats[0];
> > if (!bus_flags_set)
> > tcrtc_state->bus_flags = di->bus_flags;
> 
> Shouldn't the flags also be retrieved from the bridge state ?

Yes, the code does that above, not covered in the diff context.
When no bridges have reported the timings,
it uses the display_info as fallback (when bus_flags_set is false)

Nikhil D

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


Re: [PATCH] drm/ttm: fix missing NULL check in the new page pool

2020-11-09 Thread Alex Deucher
On Fri, Nov 6, 2020 at 9:10 AM Christian König
 wrote:
>
> The pool parameter can be NULL if we free through the shrinker.
>
> Signed-off-by: Christian König 

Does this fix:
https://gitlab.freedesktop.org/drm/amd/-/issues/1362

Acked-by: Alex Deucher 



> ---
>  drivers/gpu/drm/ttm/ttm_pool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
> index 44ec41aa78d6..1b96780b4989 100644
> --- a/drivers/gpu/drm/ttm/ttm_pool.c
> +++ b/drivers/gpu/drm/ttm/ttm_pool.c
> @@ -135,7 +135,7 @@ static void ttm_pool_free_page(struct ttm_pool *pool, 
> enum ttm_caching caching,
> set_pages_wb(p, 1 << order);
>  #endif
>
> -   if (!pool->use_dma_alloc) {
> +   if (!pool || !pool->use_dma_alloc) {
> __free_pages(p, order);
> return;
> }
> --
> 2.25.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 1/4] drm/ttm: add multihop infrastrucutre (v2)

2020-11-09 Thread Christian König

Am 09.11.20 um 16:16 schrieb Ville Syrjälä:

On Wed, Nov 11, 2020 at 06:13:02PM +0100, Christian König wrote:

Am 09.11.20 um 01:54 schrieb Dave Airlie:

@@ -1432,15 +1479,18 @@ int ttm_bo_swapout(struct ttm_operation_ctx *ctx)
if (bo->mem.mem_type != TTM_PL_SYSTEM) {
struct ttm_operation_ctx ctx = { false, false };
struct ttm_resource evict_mem;
+   struct ttm_place hop = {};

Please always use memset() if you want to zero initialize something in
the kernel, we had enough trouble with that.

What trouble is that? I've not heard of anything, and we use
={} quite extensively in drm land.


={} initializes only named fields, not padding.

The result is that for example when doing a hash or CRC of a structure 
you can come up with different results depending on the architecture 
and/or structure layout.


Another problem are information leaks from the kernel to userspace 
because of this.


Because of this Mesa for example strongly discourages using ={} for 
zeroing a structure.


Regards,
Christian.

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


Re: [PATCH 10/19] drm/radeon/radeon: Move prototype into shared header

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Sam Ravnborg wrote:

> Hi Lee,
> > > 
> > > Other public functions in radeon_device.c have their prototype in
> > > radeon.h - for example radeon_is_px()
> > > 
> > > Add radeon_device_is_virtual() there so we avoiid this new header.
> > 
> > Oh yes, I remember why this wasn't a suitable solution now:
> > 
> > The macro "radeon_init" in radeon.h clashes with the init function of
> > the same name in radeon_drv.c:
> > 
> >   In file included from drivers/gpu/drm/radeon/radeon_drv.c:53:
> >   drivers/gpu/drm/radeon/radeon_drv.c:620:31: error: expected identifier or 
> > ‘(’ before ‘void’
> >   620 | static int __init radeon_init(void)
> ...
> > 
> > How would you like me to move forward?
> 
> Fix the thousand of warnings in other places :-)
> I will take a look at radeon and post a new series based on your work
> with all W=1 warnings fixed.

I'll drop this patch and carry on ploughing through the rest of them.

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


Re: [PATCH 14/19] gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct drm_dp_sideband_msg_req_body' onto the heap

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Ville Syrjälä wrote:

> On Thu, Nov 05, 2020 at 02:45:12PM +, Lee Jones wrote:
> > The stack is too full.
> > 
> > Fixes the following W=1 kernel build warning(s):
> > 
> >  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c: In function 
> > ‘sideband_msg_req_encode_decode’:
> >  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:161:1: warning: the 
> > frame size of 1176 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> > 
> > Cc: David Airlie 
> > Cc: Daniel Vetter 
> > Cc: Lyude Paul 
> > Cc: David Francis 
> > Cc: dri-devel@lists.freedesktop.org
> > Signed-off-by: Lee Jones 
> > ---
> >  .../drm/selftests/test-drm_dp_mst_helper.c| 29 ---
> >  1 file changed, 18 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c 
> > b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> > index 1d696ec001cff..0a539456f6864 100644
> > --- a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> > +++ b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> > @@ -120,44 +120,51 @@ sideband_msg_req_equal(const struct 
> > drm_dp_sideband_msg_req_body *in,
> >  static bool
> >  sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
> >  {
> > -   struct drm_dp_sideband_msg_req_body out = {0};
> > +   struct drm_dp_sideband_msg_req_body *out;
> 
> How big is it? And why is it that big?

It's a struct of a union of structs.

And it's all allocated on the stack.  Bad news!

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


Re: [PATCH 14/19] gpu: drm: selftests: test-drm_dp_mst_helper: Place 'struct drm_dp_sideband_msg_req_body' onto the heap

2020-11-09 Thread Lee Jones
On Mon, 09 Nov 2020, Lee Jones wrote:

> On Mon, 09 Nov 2020, Ville Syrjälä wrote:
> 
> > On Thu, Nov 05, 2020 at 02:45:12PM +, Lee Jones wrote:
> > > The stack is too full.
> > > 
> > > Fixes the following W=1 kernel build warning(s):
> > > 
> > >  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c: In function 
> > > ‘sideband_msg_req_encode_decode’:
> > >  drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c:161:1: warning: the 
> > > frame size of 1176 bytes is larger than 1024 bytes [-Wframe-larger-than=]
> > > 
> > > Cc: David Airlie 
> > > Cc: Daniel Vetter 
> > > Cc: Lyude Paul 
> > > Cc: David Francis 
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Lee Jones 
> > > ---
> > >  .../drm/selftests/test-drm_dp_mst_helper.c| 29 ---
> > >  1 file changed, 18 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c 
> > > b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> > > index 1d696ec001cff..0a539456f6864 100644
> > > --- a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> > > +++ b/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
> > > @@ -120,44 +120,51 @@ sideband_msg_req_equal(const struct 
> > > drm_dp_sideband_msg_req_body *in,
> > >  static bool
> > >  sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)
> > >  {
> > > - struct drm_dp_sideband_msg_req_body out = {0};
> > > + struct drm_dp_sideband_msg_req_body *out;
> > 
> > How big is it? And why is it that big?
> 
> It's a struct of a union of structs.
> 
> And it's all allocated on the stack.  Bad news!

FYI, I have a v2 of this patch.  Just waiting to send it.

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


  1   2   3   >