Re: [Freedreno] [PATCH v2 3/7] drm/msm/dpu: support setting up two independent DSI connectors

2021-07-09 Thread abhinavk

On 2021-07-09 16:50, Dmitry Baryshkov wrote:

Move setting up encoders from set_encoder_mode to
_dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
allows us to support not only "single DSI" and "bonded DSI" but also 
"two

independent DSI" configurations. In future this would also help adding
support for multiple DP connectors.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130 ++--
 1 file changed, 79 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1d3a4f395e74..e14eb8f94cd7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -466,17 +466,16 @@ static void dpu_kms_wait_flush(struct msm_kms
*kms, unsigned crtc_mask)
dpu_kms_wait_for_commit_done(kms, crtc);
 }

-static int _dpu_kms_initialize_dsi(struct drm_device *dev,
-   struct msm_drm_private *priv,
-   struct dpu_kms *dpu_kms)
+static int _dpu_kms_initialize_dsi_encoder(struct drm_device *dev,
+  struct msm_drm_private *priv,
+  struct dpu_kms *dpu_kms,
+  int dsi_id, int dsi_id1)
 {
+   struct msm_dsi *dsi = priv->dsi[dsi_id];
struct drm_encoder *encoder = NULL;
-   int i, rc = 0;
-
-   if (!(priv->dsi[0] || priv->dsi[1]))
-   return rc;
+   struct msm_display_info info;
+   int rc = 0;

-   /*TODO: Support two independent DSI connectors */
encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
if (IS_ERR(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");
@@ -485,19 +484,74 @@ static int _dpu_kms_initialize_dsi(struct 
drm_device *dev,


priv->encoders[priv->num_encoders++] = encoder;

-   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-   if (!priv->dsi[i])
-   continue;
+   rc = msm_dsi_modeset_init(dsi, dev, encoder);
+   if (rc) {
+   DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
+ dsi_id, rc);
+   return rc;
+   }
+
+   memset(, 0, sizeof(info));
+   info.intf_type = encoder->encoder_type;
+   info.capabilities = msm_dsi_is_cmd_mode(dsi) ?
+   MSM_DISPLAY_CAP_CMD_MODE :
+   MSM_DISPLAY_CAP_VID_MODE;
+   info.h_tile_instance[info.num_of_h_tiles++] = dsi_id;

-   rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
+   /* For the bonded DSI setup we have second DSI host */
+   if (dsi_id1 >= 0) {
+   struct msm_dsi *dsi1 = priv->dsi[dsi_id1];
+
+   rc = msm_dsi_modeset_init(dsi1, dev, encoder);
if (rc) {
DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
-   i, rc);
-   break;
+ dsi_id1, rc);
+   return rc;
}
+
+   info.h_tile_instance[info.num_of_h_tiles++] = dsi_id1;
}

-   return rc;
+   rc = dpu_encoder_setup(dev, encoder, );
+   if (rc) {
+   DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+ encoder->base.id, rc);
+   return rc;
+   }
+
+   return 0;
+}
+
+static int _dpu_kms_initialize_dsi(struct drm_device *dev,
+   struct msm_drm_private *priv,
+   struct dpu_kms *dpu_kms)
+{
+   int i, rc = 0;
+
+   if (!(priv->dsi[0] || priv->dsi[1]))
+   return rc;
+
+   /*
+* We support following confiurations:
+* - Single DSI host (dsi0 or dsi1)
+* - Two independent DSI hosts
+* - Bonded DSI0 and DSI1 hosts
+*
+*   TODO: Support swapping DSI0 and DSI1 in the bonded setup.
+*/
+	if (priv->dsi[0] && priv->dsi[1] && 
msm_dsi_is_bonded_dsi(priv->dsi[0]))

+   return _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, 0, 
1);
+
+   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
+   if (!priv->dsi[i])
+   continue;
+
+   rc = _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, i, -1);
+   if (rc)
+   return rc;
+   }
+
+   return 0;
 }


Can we simplify this a bit like below?

static int _dpu_kms_initialize_dsi(struct drm_device *dev,
struct msm_drm_private *priv,
struct dpu_kms *dpu_kms)
{
int i, rc = 0;

if (!(priv->dsi[0] || priv->dsi[1]))
return rc;

/*
 * We support following confiurations:
 * - Single DSI host (dsi0 or dsi1)
 * - Two independent DSI 

[Freedreno] [PATCH v2 7/7] drm/msm/kms: drop set_encoder_mode callback

2021-07-09 Thread Dmitry Baryshkov
set_encoder_mode callback is completely unused now. Drop it from
msm_kms_func().

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/msm_kms.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
index 086a2d59b8c8..9484e8b62630 100644
--- a/drivers/gpu/drm/msm/msm_kms.h
+++ b/drivers/gpu/drm/msm/msm_kms.h
@@ -117,9 +117,6 @@ struct msm_kms_funcs {
struct drm_encoder *encoder,
struct drm_encoder *slave_encoder,
bool is_cmd_mode);
-   void (*set_encoder_mode)(struct msm_kms *kms,
-struct drm_encoder *encoder,
-bool cmd_mode);
/* cleanup: */
void (*destroy)(struct msm_kms *kms);
 
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 5/7] drm/msm/dp: stop calling set_encoder_mode callback

2021-07-09 Thread Dmitry Baryshkov
None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dp/dp_display.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index 051c1be1de7e..70b319a8fe83 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -102,8 +102,6 @@ struct dp_display_private {
struct dp_display_mode dp_mode;
struct msm_dp dp_display;
 
-   bool encoder_mode_set;
-
/* wait for audio signaling */
struct completion audio_comp;
 
@@ -283,20 +281,6 @@ static void dp_display_send_hpd_event(struct msm_dp 
*dp_display)
 }
 
 
-static void dp_display_set_encoder_mode(struct dp_display_private *dp)
-{
-   struct msm_drm_private *priv = dp->dp_display.drm_dev->dev_private;
-   struct msm_kms *kms = priv->kms;
-
-   if (!dp->encoder_mode_set && dp->dp_display.encoder &&
-   kms->funcs->set_encoder_mode) {
-   kms->funcs->set_encoder_mode(kms,
-   dp->dp_display.encoder, false);
-
-   dp->encoder_mode_set = true;
-   }
-}
-
 static int dp_display_send_hpd_notification(struct dp_display_private *dp,
bool hpd)
 {
@@ -369,8 +353,6 @@ static void dp_display_host_init(struct dp_display_private 
*dp, int reset)
if (dp->usbpd->orientation == ORIENTATION_CC2)
flip = true;
 
-   dp_display_set_encoder_mode(dp);
-
dp_power_init(dp->power, flip);
dp_ctrl_host_init(dp->ctrl, flip, reset);
dp_aux_init(dp->aux);
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 3/7] drm/msm/dpu: support setting up two independent DSI connectors

2021-07-09 Thread Dmitry Baryshkov
Move setting up encoders from set_encoder_mode to
_dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
allows us to support not only "single DSI" and "bonded DSI" but also "two
independent DSI" configurations. In future this would also help adding
support for multiple DP connectors.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 130 ++--
 1 file changed, 79 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1d3a4f395e74..e14eb8f94cd7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -466,17 +466,16 @@ static void dpu_kms_wait_flush(struct msm_kms *kms, 
unsigned crtc_mask)
dpu_kms_wait_for_commit_done(kms, crtc);
 }
 
-static int _dpu_kms_initialize_dsi(struct drm_device *dev,
-   struct msm_drm_private *priv,
-   struct dpu_kms *dpu_kms)
+static int _dpu_kms_initialize_dsi_encoder(struct drm_device *dev,
+  struct msm_drm_private *priv,
+  struct dpu_kms *dpu_kms,
+  int dsi_id, int dsi_id1)
 {
+   struct msm_dsi *dsi = priv->dsi[dsi_id];
struct drm_encoder *encoder = NULL;
-   int i, rc = 0;
-
-   if (!(priv->dsi[0] || priv->dsi[1]))
-   return rc;
+   struct msm_display_info info;
+   int rc = 0;
 
-   /*TODO: Support two independent DSI connectors */
encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
if (IS_ERR(encoder)) {
DPU_ERROR("encoder init failed for dsi display\n");
@@ -485,19 +484,74 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev,
 
priv->encoders[priv->num_encoders++] = encoder;
 
-   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
-   if (!priv->dsi[i])
-   continue;
+   rc = msm_dsi_modeset_init(dsi, dev, encoder);
+   if (rc) {
+   DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
+ dsi_id, rc);
+   return rc;
+   }
+
+   memset(, 0, sizeof(info));
+   info.intf_type = encoder->encoder_type;
+   info.capabilities = msm_dsi_is_cmd_mode(dsi) ?
+   MSM_DISPLAY_CAP_CMD_MODE :
+   MSM_DISPLAY_CAP_VID_MODE;
+   info.h_tile_instance[info.num_of_h_tiles++] = dsi_id;
 
-   rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
+   /* For the bonded DSI setup we have second DSI host */
+   if (dsi_id1 >= 0) {
+   struct msm_dsi *dsi1 = priv->dsi[dsi_id1];
+
+   rc = msm_dsi_modeset_init(dsi1, dev, encoder);
if (rc) {
DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
-   i, rc);
-   break;
+ dsi_id1, rc);
+   return rc;
}
+
+   info.h_tile_instance[info.num_of_h_tiles++] = dsi_id1;
}
 
-   return rc;
+   rc = dpu_encoder_setup(dev, encoder, );
+   if (rc) {
+   DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+ encoder->base.id, rc);
+   return rc;
+   }
+
+   return 0;
+}
+
+static int _dpu_kms_initialize_dsi(struct drm_device *dev,
+   struct msm_drm_private *priv,
+   struct dpu_kms *dpu_kms)
+{
+   int i, rc = 0;
+
+   if (!(priv->dsi[0] || priv->dsi[1]))
+   return rc;
+
+   /*
+* We support following confiurations:
+* - Single DSI host (dsi0 or dsi1)
+* - Two independent DSI hosts
+* - Bonded DSI0 and DSI1 hosts
+*
+*   TODO: Support swapping DSI0 and DSI1 in the bonded setup.
+*/
+   if (priv->dsi[0] && priv->dsi[1] && msm_dsi_is_bonded_dsi(priv->dsi[0]))
+   return _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, 0, 
1);
+
+   for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
+   if (!priv->dsi[i])
+   continue;
+
+   rc = _dpu_kms_initialize_dsi_encoder(dev, priv, dpu_kms, i, -1);
+   if (rc)
+   return rc;
+   }
+
+   return 0;
 }
 
 static int _dpu_kms_initialize_displayport(struct drm_device *dev,
@@ -505,6 +559,7 @@ static int _dpu_kms_initialize_displayport(struct 
drm_device *dev,
struct dpu_kms *dpu_kms)
 {
struct drm_encoder *encoder = NULL;
+   struct msm_display_info info;
int rc = 0;
 
if (!priv->dp)
@@ -516,6 +571,7 @@ static int _dpu_kms_initialize_displayport(struct 
drm_device *dev,
return PTR_ERR(encoder);
}
 
+  

[Freedreno] [PATCH v2 6/7] drm/msm/dsi: stop calling set_encoder_mode callback

2021-07-09 Thread Dmitry Baryshkov
None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dsi/dsi.c |  2 --
 drivers/gpu/drm/msm/dsi/dsi.h |  1 -
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 12 
 3 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 5201d7eb0490..77c8dba297d8 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -251,8 +251,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct 
drm_device *dev,
goto fail;
}
 
-   msm_dsi_manager_setup_encoder(msm_dsi->id);
-
priv->bridges[priv->num_bridges++]   = msm_dsi->bridge;
priv->connectors[priv->num_connectors++] = msm_dsi->connector;
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 856a532850c0..e0c3c4409377 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -80,7 +80,6 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id);
 struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id);
 int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg);
 bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len);
-void msm_dsi_manager_setup_encoder(int id);
 int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
 void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
 bool msm_dsi_manager_validate_current_config(u8 id);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index a81105633d3c..e7f4e1d8978a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -216,18 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)
return dsi_bridge->id;
 }
 
-void msm_dsi_manager_setup_encoder(int id)
-{
-   struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
-   struct msm_drm_private *priv = msm_dsi->dev->dev_private;
-   struct msm_kms *kms = priv->kms;
-   struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi);
-
-   if (encoder && kms->funcs->set_encoder_mode)
-   kms->funcs->set_encoder_mode(kms, encoder,
-msm_dsi_is_cmd_mode(msm_dsi));
-}
-
 static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 {
struct msm_drm_private *priv = conn->dev->dev_private;
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 4/7] drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init

2021-07-09 Thread Dmitry Baryshkov
Move a call to mdp5_encoder_set_intf_mode() after
msm_dsi_modeset_init(), removing set_encoder_mode callback.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 15aed45022bc..b3b42672b2d4 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -209,13 +209,6 @@ static int mdp5_set_split_display(struct msm_kms *kms,
  slave_encoder);
 }
 
-static void mdp5_set_encoder_mode(struct msm_kms *kms,
- struct drm_encoder *encoder,
- bool cmd_mode)
-{
-   mdp5_encoder_set_intf_mode(encoder, cmd_mode);
-}
-
 static void mdp5_kms_destroy(struct msm_kms *kms)
 {
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
@@ -287,7 +280,6 @@ static const struct mdp_kms_funcs kms_funcs = {
.get_format  = mdp_get_format,
.round_pixclk= mdp5_round_pixclk,
.set_split_display = mdp5_set_split_display,
-   .set_encoder_mode = mdp5_set_encoder_mode,
.destroy = mdp5_kms_destroy,
 #ifdef CONFIG_DEBUG_FS
.debugfs_init= mdp5_kms_debugfs_init,
@@ -448,6 +440,9 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms,
}
 
ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, encoder);
+   if (!ret)
+   mdp5_encoder_set_intf_mode(encoder, 
msm_dsi_is_cmd_mode(priv->dsi[dsi_id]));
+
break;
}
default:
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 1/7] drm/msm/dsi: rename dual DSI to bonded DSI

2021-07-09 Thread Dmitry Baryshkov
We are preparing to support two independent DSI hosts in the DSI/DPU
code. To remove possible confusion (as both configurations can be
referenced as dual DSI) let's rename old "dual DSI" (two DSI hosts
driving single device, with clocks being locked) to "bonded DSI".

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dsi/dsi.h |  8 ++--
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c| 30 ++--
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 69 +--
 4 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 9b8e9b07eced..856a532850c0 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -109,7 +109,7 @@ int msm_dsi_host_enable(struct mipi_dsi_host *host);
 int msm_dsi_host_disable(struct mipi_dsi_host *host);
 int msm_dsi_host_power_on(struct mipi_dsi_host *host,
struct msm_dsi_phy_shared_timings *phy_shared_timings,
-   bool is_dual_dsi);
+   bool is_bonded_dsi);
 int msm_dsi_host_power_off(struct mipi_dsi_host *host);
 int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
  const struct drm_display_mode *mode);
@@ -123,7 +123,7 @@ int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host,
 void msm_dsi_host_reset_phy(struct mipi_dsi_host *host);
 void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
struct msm_dsi_phy_clk_request *clk_req,
-   bool is_dual_dsi);
+   bool is_bonded_dsi);
 void msm_dsi_host_destroy(struct mipi_dsi_host *host);
 int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
struct drm_device *dev);
@@ -145,8 +145,8 @@ int dsi_dma_base_get_6g(struct msm_dsi_host *msm_host, 
uint64_t *iova);
 int dsi_dma_base_get_v2(struct msm_dsi_host *msm_host, uint64_t *iova);
 int dsi_clk_init_v2(struct msm_dsi_host *msm_host);
 int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host);
-int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_dual_dsi);
-int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_dual_dsi);
+int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
+int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
 void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct 
mipi_dsi_host *host);
 /* dsi phy */
 struct msm_dsi_phy;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index ade9b609c7d9..2bce00d5a9fc 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -47,7 +47,7 @@ struct msm_dsi_host_cfg_ops {
void* (*tx_buf_get)(struct msm_dsi_host *msm_host);
void (*tx_buf_put)(struct msm_dsi_host *msm_host);
int (*dma_base_get)(struct msm_dsi_host *msm_host, uint64_t *iova);
-   int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool is_dual_dsi);
+   int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool is_bonded_dsi);
 };
 
 struct msm_dsi_cfg_handler {
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index ed504fe5074f..eb988faddbbf 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -679,7 +679,7 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host *msm_host)
clk_disable_unprepare(msm_host->byte_clk);
 }
 
-static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
struct drm_display_mode *mode = msm_host->mode;
u32 pclk_rate;
@@ -692,17 +692,17 @@ static u32 dsi_get_pclk_rate(struct msm_dsi_host 
*msm_host, bool is_dual_dsi)
 * the clock rates have to be split between the two dsi controllers.
 * Adjust the byte and pixel clock rates for each dsi host accordingly.
 */
-   if (is_dual_dsi)
+   if (is_bonded_dsi)
pclk_rate /= 2;
 
return pclk_rate;
 }
 
-static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
u8 lanes = msm_host->lanes;
u32 bpp = dsi_get_bpp(msm_host->format);
-   u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_dual_dsi);
+   u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_bonded_dsi);
u64 pclk_bpp = (u64)pclk_rate * bpp;
 
if (lanes == 0) {
@@ -720,28 +720,28 @@ static void dsi_calc_pclk(struct msm_dsi_host *msm_host, 
bool is_dual_dsi)
 
 }
 
-int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_dual_dsi)
+int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi)
 {
if (!msm_host->mode) {
pr_err("%s: mode not set\n", __func__);
return -EINVAL;
}
 
-  

[Freedreno] [PATCH v2 2/7] drm/msm/dsi: add two helper functions

2021-07-09 Thread Dmitry Baryshkov
Add two helper functions to be used by display drivers for setting up
encoders.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dsi/dsi.c |  7 +++
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 14 ++
 drivers/gpu/drm/msm/msm_drv.h | 12 ++--
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 75afc12a7b25..5201d7eb0490 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -13,6 +13,13 @@ struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi 
*msm_dsi)
return msm_dsi->encoder;
 }
 
+bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+   unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
+
+   return !(host_flags & MIPI_DSI_MODE_VIDEO);
+}
+
 static int dsi_get_phy(struct msm_dsi *msm_dsi)
 {
struct platform_device *pdev = msm_dsi->pdev;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 1173663c6d5d..a81105633d3c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -216,12 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)
return dsi_bridge->id;
 }
 
-static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
-{
-   unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
-   return !(host_flags & MIPI_DSI_MODE_VIDEO);
-}
-
 void msm_dsi_manager_setup_encoder(int id)
 {
struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
@@ -231,7 +225,7 @@ void msm_dsi_manager_setup_encoder(int id)
 
if (encoder && kms->funcs->set_encoder_mode)
kms->funcs->set_encoder_mode(kms, encoder,
-dsi_mgr_is_cmd_mode(msm_dsi));
+msm_dsi_is_cmd_mode(msm_dsi));
 }
 
 static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
@@ -276,7 +270,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector 
*conn, u8 id)
if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) {
kms->funcs->set_split_display(kms, master_dsi->encoder,
  slave_dsi->encoder,
- dsi_mgr_is_cmd_mode(msm_dsi));
+ msm_dsi_is_cmd_mode(msm_dsi));
}
 
 out:
@@ -839,3 +833,7 @@ void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi)
msm_dsim->dsi[msm_dsi->id] = NULL;
 }
 
+bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
+{
+   return IS_BONDED_DSI();
+}
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 1a48a709ffb3..e0528dfd965e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -350,7 +350,8 @@ void __exit msm_dsi_unregister(void);
 int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 struct drm_encoder *encoder);
 void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct msm_dsi 
*msm_dsi);
-
+bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi);
+bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
 #else
 static inline void __init msm_dsi_register(void)
 {
@@ -367,7 +368,14 @@ static inline int msm_dsi_modeset_init(struct msm_dsi 
*msm_dsi,
 static inline void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct 
msm_dsi *msm_dsi)
 {
 }
-
+static inline bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+   return false;
+}
+static bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
+{
+   return false;
+}
 #endif
 
 #ifdef CONFIG_DRM_MSM_DP
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 0/7] drm/msm/dpu: add support for independent DSI config

2021-07-09 Thread Dmitry Baryshkov
This patchseries adds support for independent DSI config to DPU1 display
subdriver. Also drop one of msm_kms_funcs callbacks, made unnecessary
now.

Tested on RB5 (dpu, dsi). Previous iteration was tested by Alexey
Minnekhanov.

Cahanges since v1:
 - Rewrote dsi encoder setup function by separating common code sequence
   and calling it either for the bonded interface or twice for each of
   the DSI hosts.

Changes since RFC:
 - renamed dual DSI to bonded DSI as suggsted by Abhinav
 - added comments to _dpu_kms_initialize_dsi() regarding encoders usage

The following changes since commit e88bbc91849b2bf57683119c339e52916d34433f:

  Revert "drm/msm/mdp5: provide dynamic bandwidth management" (2021-06-23 
14:06:20 -0700)

are available in the Git repository at:

  https://git.linaro.org/people/dmitry.baryshkov/kernel.git 
msm-drm-drop-set-encoder-mode-2

for you to fetch changes up to 3e10b945035d638bdf94f06b3fc86a6deaa41e63:

  drm/msm/kms: drop set_encoder_mode callback (2021-07-10 02:46:00 +0300)


Dmitry Baryshkov (7):
  drm/msm/dsi: rename dual DSI to bonded DSI
  drm/msm/dsi: add two helper functions
  drm/msm/dpu: support setting up two independent DSI connectors
  drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init
  drm/msm/dp: stop calling set_encoder_mode callback
  drm/msm/dsi: stop calling set_encoder_mode callback
  drm/msm/kms: drop set_encoder_mode callback

 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 130 +++
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |  11 +--
 drivers/gpu/drm/msm/dp/dp_display.c  |  18 -
 drivers/gpu/drm/msm/dsi/dsi.c|   9 ++-
 drivers/gpu/drm/msm/dsi/dsi.h|   9 +--
 drivers/gpu/drm/msm/dsi/dsi_cfg.h|   2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c   |  30 +++
 drivers/gpu/drm/msm/dsi/dsi_manager.c|  93 ++
 drivers/gpu/drm/msm/msm_drv.h|  12 ++-
 drivers/gpu/drm/msm/msm_kms.h|   3 -
 10 files changed, 158 insertions(+), 159 deletions(-)

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 5/7] drm/msm/dp: stop calling set_encoder_mode callback

2021-07-09 Thread Dmitry Baryshkov

On 10/07/2021 01:16, abhin...@codeaurora.org wrote:

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov 


The change looks fine,
Reviewed-by: Abhinav Kumar 

But has DP been re-verified with this change by Bjorn?
If not, I can verify this on my board and give my Tested-by


Please test it on your setup.




---
 drivers/gpu/drm/msm/dp/dp_display.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
b/drivers/gpu/drm/msm/dp/dp_display.c
index 051c1be1de7e..70b319a8fe83 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -102,8 +102,6 @@ struct dp_display_private {
 struct dp_display_mode dp_mode;
 struct msm_dp dp_display;

-    bool encoder_mode_set;
-
 /* wait for audio signaling */
 struct completion audio_comp;

@@ -283,20 +281,6 @@ static void dp_display_send_hpd_event(struct
msm_dp *dp_display)
 }


-static void dp_display_set_encoder_mode(struct dp_display_private *dp)
-{
-    struct msm_drm_private *priv = dp->dp_display.drm_dev->dev_private;
-    struct msm_kms *kms = priv->kms;
-
-    if (!dp->encoder_mode_set && dp->dp_display.encoder &&
-    kms->funcs->set_encoder_mode) {
-    kms->funcs->set_encoder_mode(kms,
-    dp->dp_display.encoder, false);
-
-    dp->encoder_mode_set = true;
-    }
-}
-
 static int dp_display_send_hpd_notification(struct dp_display_private 
*dp,

 bool hpd)
 {
@@ -369,8 +353,6 @@ static void dp_display_host_init(struct
dp_display_private *dp, int reset)
 if (dp->usbpd->orientation == ORIENTATION_CC2)
 flip = true;

-    dp_display_set_encoder_mode(dp);
-
 dp_power_init(dp->power, flip);
 dp_ctrl_host_init(dp->ctrl, flip, reset);
 dp_aux_init(dp->aux);



--
With best wishes
Dmitry
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [v8 0/6] drm: Support basic DPCD backlight in panel-simple and add a new panel ATNA33XC20

2021-07-09 Thread Doug Anderson
Hi,

On Fri, Jul 9, 2021 at 1:41 PM Ville Syrjälä
 wrote:
>
> On Fri, Jul 09, 2021 at 06:54:05AM -0700, Doug Anderson wrote:
> > Hi,
> >
> > On Sat, Jun 26, 2021 at 9:52 AM Rajeev Nandan  
> > wrote:
> > >
> > > This series adds the support for the eDP panel that needs the backlight
> > > controlling over the DP AUX channel using DPCD registers of the panel
> > > as per the VESA's standard.
> > >
> > > This series also adds support for the Samsung eDP AMOLED panel that
> > > needs DP AUX to control the backlight, and introduces new delays in the
> > > @panel_desc.delay to support this panel.
> > >
> > > This patch series depends on the following two series:
> > > - Doug's series [1], exposed the DP AUX channel to the panel-simple.
> > > - Lyude's series [2], introduced new drm helper functions for DPCD
> > >   backlight.
> > >
> > > This series is the logical successor to the series [3].
> > >
> > > Changes in v1:
> > > - Created dpcd backlight helper with very basic functionality, added
> > >   backlight registration in the ti-sn65dsi86 bridge driver.
> > >
> > > Changes in v2:
> > > - Created a new DisplayPort aux backlight driver and moved the code from
> > >   drm_dp_aux_backlight.c (v1) to the new driver.
> > >
> > > Changes in v3:
> > > - Fixed module compilation (kernel test bot).
> > >
> > > Changes in v4:
> > > - Added basic DPCD backlight support in panel-simple.
> > > - Added support for a new Samsung panel ATNA33XC20 that needs DPCD
> > >   backlight controlling and has a requirement of delays between enable
> > >   GPIO and regulator.
> > >
> > > Changes in v5:
> > > Addressed review suggestions from Douglas:
> > > - Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
> > > - Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
> > > - panel-simple probe() calls drm_panel_dp_aux_backlight() to create
> > >   backlight when the backlight phandle is not specified in panel DT
> > >   and DP AUX channel is present.
> > > - Added check for drm_edp_backlight_supported() before registering.
> > > - Removed the @uses_dpcd_backlight flag from panel_desc as this
> > >   should be auto-detected.
> > > - Updated comments/descriptions.
> > >
> > > Changes in v6:
> > > - Rebased
> > > - Updated wanrning messages, fixed word wrapping in comments.
> > > - Fixed ordering of memory allocation
> > >
> > > Changes in v7:
> > > - Updated the disable_to_power_off and power_to_enable panel delays
> > > as discovered at  (Douglas)
> > >
> > > Changes in v8:
> > > - Now using backlight_is_blank() to get the backlight blank status (Sam 
> > > Ravnborg)
> > > - Added a new patch #4 to fix the warnings for eDP panel description (Sam 
> > > Ravnborg)
> > >
> > > [1] 
> > > https://lore.kernel.org/dri-devel/20210525000159.3384921-1-diand...@chromium.org/
> > > [2] 
> > > https://lore.kernel.org/dri-devel/20210514181504.565252-1-ly...@redhat.com/
> > > [3] 
> > > https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajee...@codeaurora.org/
> > >
> > > Rajeev Nandan (6):
> > >   drm/panel: add basic DP AUX backlight support
> > >   drm/panel-simple: Support DP AUX backlight
> > >   drm/panel-simple: Support for delays between GPIO & regulator
> > >   drm/panel-simple: Update validation warnings for eDP panel description
> > >   dt-bindings: display: simple: Add Samsung ATNA33XC20
> > >   drm/panel-simple: Add Samsung ATNA33XC20
> > >
> > >  .../bindings/display/panel/panel-simple.yaml   |   2 +
> > >  drivers/gpu/drm/drm_panel.c| 108 
> > > +
> > >  drivers/gpu/drm/panel/panel-simple.c   |  73 +-
> > >  include/drm/drm_panel.h|  15 ++-
> > >  4 files changed, 190 insertions(+), 8 deletions(-)
> >
> > Pushed to drm-misc-next.
> >
> > 4bfe6c8f7c23 drm/panel-simple: Add Samsung ATNA33XC20
> > c20dec193584 dt-bindings: display: simple: Add Samsung ATNA33XC20
> > 13aceea56fd5 drm/panel-simple: Update validation warnings for eDP
> > panel description
> > 18a1488bf1e1 drm/panel-simple: Support for delays between GPIO & regulator
> > bfd451403d70 drm/panel-simple: Support DP AUX backlight
> > 10f7b40e4f30 drm/panel: add basic DP AUX backlight support
>
> depmod: ERROR: Cycle detected: drm_kms_helper -> drm -> drm_kms_helper
>
> Looks to be due to drm_edp_backlight_enable().

Ugh. Thanks for the report! I've taken a schwag at a fix here:

https://lore.kernel.org/lkml/20210709152909.1.I23eb4cc5a680341e7b3e791632a635566fa5806a@changeid/

-Doug
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 7/7] drm/msm/kms: drop set_encoder_mode callback

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

set_encoder_mode callback is completely unused now. Drop it from
msm_kms_func().

Signed-off-by: Dmitry Baryshkov 

Reviewed-by: Abhinav Kumar 

---
 drivers/gpu/drm/msm/msm_kms.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_kms.h 
b/drivers/gpu/drm/msm/msm_kms.h

index 086a2d59b8c8..9484e8b62630 100644
--- a/drivers/gpu/drm/msm/msm_kms.h
+++ b/drivers/gpu/drm/msm/msm_kms.h
@@ -117,9 +117,6 @@ struct msm_kms_funcs {
struct drm_encoder *encoder,
struct drm_encoder *slave_encoder,
bool is_cmd_mode);
-   void (*set_encoder_mode)(struct msm_kms *kms,
-struct drm_encoder *encoder,
-bool cmd_mode);
/* cleanup: */
void (*destroy)(struct msm_kms *kms);

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 6/7] drm/msm/dsi: stop calling set_encoder_mode callback

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov 

Reviewed-by: Abhinav Kumar 

---
 drivers/gpu/drm/msm/dsi/dsi.c |  2 --
 drivers/gpu/drm/msm/dsi/dsi.h |  1 -
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 12 
 3 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c 
b/drivers/gpu/drm/msm/dsi/dsi.c

index 5201d7eb0490..77c8dba297d8 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -251,8 +251,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi,
struct drm_device *dev,
goto fail;
}

-   msm_dsi_manager_setup_encoder(msm_dsi->id);
-
priv->bridges[priv->num_bridges++]   = msm_dsi->bridge;
priv->connectors[priv->num_connectors++] = msm_dsi->connector;

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h 
b/drivers/gpu/drm/msm/dsi/dsi.h

index 856a532850c0..e0c3c4409377 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -80,7 +80,6 @@ struct drm_connector 
*msm_dsi_manager_connector_init(u8 id);

 struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id);
 int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg);
 bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len);
-void msm_dsi_manager_setup_encoder(int id);
 int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
 void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
 bool msm_dsi_manager_validate_current_config(u8 id);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index a81105633d3c..e7f4e1d8978a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -216,18 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge 
*bridge)

return dsi_bridge->id;
 }

-void msm_dsi_manager_setup_encoder(int id)
-{
-   struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
-   struct msm_drm_private *priv = msm_dsi->dev->dev_private;
-   struct msm_kms *kms = priv->kms;
-   struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi);
-
-   if (encoder && kms->funcs->set_encoder_mode)
-   kms->funcs->set_encoder_mode(kms, encoder,
-msm_dsi_is_cmd_mode(msm_dsi));
-}
-
 static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 
id)

 {
struct msm_drm_private *priv = conn->dev->dev_private;

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 5/7] drm/msm/dp: stop calling set_encoder_mode callback

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

None of the display drivers now implement set_encoder_mode callback.
Stop calling it from the modeset init code.

Signed-off-by: Dmitry Baryshkov 


The change looks fine,
Reviewed-by: Abhinav Kumar 

But has DP been re-verified with this change by Bjorn?
If not, I can verify this on my board and give my Tested-by


---
 drivers/gpu/drm/msm/dp/dp_display.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c
b/drivers/gpu/drm/msm/dp/dp_display.c
index 051c1be1de7e..70b319a8fe83 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -102,8 +102,6 @@ struct dp_display_private {
struct dp_display_mode dp_mode;
struct msm_dp dp_display;

-   bool encoder_mode_set;
-
/* wait for audio signaling */
struct completion audio_comp;

@@ -283,20 +281,6 @@ static void dp_display_send_hpd_event(struct
msm_dp *dp_display)
 }


-static void dp_display_set_encoder_mode(struct dp_display_private *dp)
-{
-   struct msm_drm_private *priv = dp->dp_display.drm_dev->dev_private;
-   struct msm_kms *kms = priv->kms;
-
-   if (!dp->encoder_mode_set && dp->dp_display.encoder &&
-   kms->funcs->set_encoder_mode) {
-   kms->funcs->set_encoder_mode(kms,
-   dp->dp_display.encoder, false);
-
-   dp->encoder_mode_set = true;
-   }
-}
-
 static int dp_display_send_hpd_notification(struct dp_display_private 
*dp,

bool hpd)
 {
@@ -369,8 +353,6 @@ static void dp_display_host_init(struct
dp_display_private *dp, int reset)
if (dp->usbpd->orientation == ORIENTATION_CC2)
flip = true;

-   dp_display_set_encoder_mode(dp);
-
dp_power_init(dp->power, flip);
dp_ctrl_host_init(dp->ctrl, flip, reset);
dp_aux_init(dp->aux);

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 4/7] drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

Move a call to mdp5_encoder_set_intf_mode() after
msm_dsi_modeset_init(), removing set_encoder_mode callback.

Signed-off-by: Dmitry Baryshkov 

Reviewed-by: Abhinav Kumar 

---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index 15aed45022bc..b3b42672b2d4 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -209,13 +209,6 @@ static int mdp5_set_split_display(struct msm_kms 
*kms,

  slave_encoder);
 }

-static void mdp5_set_encoder_mode(struct msm_kms *kms,
- struct drm_encoder *encoder,
- bool cmd_mode)
-{
-   mdp5_encoder_set_intf_mode(encoder, cmd_mode);
-}
-
 static void mdp5_kms_destroy(struct msm_kms *kms)
 {
struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
@@ -287,7 +280,6 @@ static const struct mdp_kms_funcs kms_funcs = {
.get_format  = mdp_get_format,
.round_pixclk= mdp5_round_pixclk,
.set_split_display = mdp5_set_split_display,
-   .set_encoder_mode = mdp5_set_encoder_mode,
.destroy = mdp5_kms_destroy,
 #ifdef CONFIG_DEBUG_FS
.debugfs_init= mdp5_kms_debugfs_init,
@@ -448,6 +440,9 @@ static int modeset_init_intf(struct mdp5_kms 
*mdp5_kms,

}

ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, encoder);
+   if (!ret)
+			mdp5_encoder_set_intf_mode(encoder, 
msm_dsi_is_cmd_mode(priv->dsi[dsi_id]));

+
break;
}
default:

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 2/7] drm/msm/dsi: add two helper functions

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

Add two helper functions to be used by display drivers for setting up
encoders.

Signed-off-by: Dmitry Baryshkov 

Reviewed-by: Abhinav Kumar 

---
 drivers/gpu/drm/msm/dsi/dsi.c |  7 +++
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 14 ++
 drivers/gpu/drm/msm/msm_drv.h | 12 ++--
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c 
b/drivers/gpu/drm/msm/dsi/dsi.c

index 75afc12a7b25..5201d7eb0490 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -13,6 +13,13 @@ struct drm_encoder *msm_dsi_get_encoder(struct
msm_dsi *msm_dsi)
return msm_dsi->encoder;
 }

+bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+	unsigned long host_flags = 
msm_dsi_host_get_mode_flags(msm_dsi->host);

+
+   return !(host_flags & MIPI_DSI_MODE_VIDEO);
+}
+
 static int dsi_get_phy(struct msm_dsi *msm_dsi)
 {
struct platform_device *pdev = msm_dsi->pdev;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 1173663c6d5d..a81105633d3c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -216,12 +216,6 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge 
*bridge)

return dsi_bridge->id;
 }

-static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
-{
-	unsigned long host_flags = 
msm_dsi_host_get_mode_flags(msm_dsi->host);

-   return !(host_flags & MIPI_DSI_MODE_VIDEO);
-}
-
 void msm_dsi_manager_setup_encoder(int id)
 {
struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
@@ -231,7 +225,7 @@ void msm_dsi_manager_setup_encoder(int id)

if (encoder && kms->funcs->set_encoder_mode)
kms->funcs->set_encoder_mode(kms, encoder,
-dsi_mgr_is_cmd_mode(msm_dsi));
+msm_dsi_is_cmd_mode(msm_dsi));
 }

 static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 
id)

@@ -276,7 +270,7 @@ static int msm_dsi_manager_panel_init(struct
drm_connector *conn, u8 id)
if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) {
kms->funcs->set_split_display(kms, master_dsi->encoder,
  slave_dsi->encoder,
- dsi_mgr_is_cmd_mode(msm_dsi));
+ msm_dsi_is_cmd_mode(msm_dsi));
}

 out:
@@ -839,3 +833,7 @@ void msm_dsi_manager_unregister(struct msm_dsi 
*msm_dsi)

msm_dsim->dsi[msm_dsi->id] = NULL;
 }

+bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
+{
+   return IS_BONDED_DSI();
+}
diff --git a/drivers/gpu/drm/msm/msm_drv.h 
b/drivers/gpu/drm/msm/msm_drv.h

index 1a48a709ffb3..e0528dfd965e 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -350,7 +350,8 @@ void __exit msm_dsi_unregister(void);
 int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device 
*dev,

 struct drm_encoder *encoder);
 void msm_dsi_snapshot(struct msm_disp_state *disp_state, struct
msm_dsi *msm_dsi);
-
+bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi);
+bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi);
 #else
 static inline void __init msm_dsi_register(void)
 {
@@ -367,7 +368,14 @@ static inline int msm_dsi_modeset_init(struct
msm_dsi *msm_dsi,
 static inline void msm_dsi_snapshot(struct msm_disp_state
*disp_state, struct msm_dsi *msm_dsi)
 {
 }
-
+static inline bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+   return false;
+}
+static bool msm_dsi_is_bonded_dsi(struct msm_dsi *msm_dsi)
+{
+   return false;
+}
 #endif

 #ifdef CONFIG_DRM_MSM_DP

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 1/7] drm/msm/dsi: rename dual DSI to bonded DSI

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

We are preparing to support two independent DSI hosts in the DSI/DPU
code. To remove possible confusion (as both configurations can be
referenced as dual DSI) let's rename old "dual DSI" (two DSI hosts
driving single device, with clocks being locked) to "bonded DSI".

Signed-off-by: Dmitry Baryshkov 

Thanks for renaming this,
Reviewed-by: Abhinav Kumar 

---
 drivers/gpu/drm/msm/dsi/dsi.h |  8 ++--
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c| 30 ++--
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 69 +--
 4 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h 
b/drivers/gpu/drm/msm/dsi/dsi.h

index 9b8e9b07eced..856a532850c0 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -109,7 +109,7 @@ int msm_dsi_host_enable(struct mipi_dsi_host 
*host);

 int msm_dsi_host_disable(struct mipi_dsi_host *host);
 int msm_dsi_host_power_on(struct mipi_dsi_host *host,
struct msm_dsi_phy_shared_timings *phy_shared_timings,
-   bool is_dual_dsi);
+   bool is_bonded_dsi);
 int msm_dsi_host_power_off(struct mipi_dsi_host *host);
 int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host,
  const struct drm_display_mode *mode);
@@ -123,7 +123,7 @@ int msm_dsi_host_set_src_pll(struct mipi_dsi_host 
*host,

 void msm_dsi_host_reset_phy(struct mipi_dsi_host *host);
 void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,
struct msm_dsi_phy_clk_request *clk_req,
-   bool is_dual_dsi);
+   bool is_bonded_dsi);
 void msm_dsi_host_destroy(struct mipi_dsi_host *host);
 int msm_dsi_host_modeset_init(struct mipi_dsi_host *host,
struct drm_device *dev);
@@ -145,8 +145,8 @@ int dsi_dma_base_get_6g(struct msm_dsi_host
*msm_host, uint64_t *iova);
 int dsi_dma_base_get_v2(struct msm_dsi_host *msm_host, uint64_t 
*iova);

 int dsi_clk_init_v2(struct msm_dsi_host *msm_host);
 int dsi_clk_init_6g_v2(struct msm_dsi_host *msm_host);
-int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool 
is_dual_dsi);
-int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
is_dual_dsi);
+int dsi_calc_clk_rate_v2(struct msm_dsi_host *msm_host, bool 
is_bonded_dsi);
+int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
is_bonded_dsi);

 void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct
mipi_dsi_host *host);
 /* dsi phy */
 struct msm_dsi_phy;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index ade9b609c7d9..2bce00d5a9fc 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -47,7 +47,7 @@ struct msm_dsi_host_cfg_ops {
void* (*tx_buf_get)(struct msm_dsi_host *msm_host);
void (*tx_buf_put)(struct msm_dsi_host *msm_host);
int (*dma_base_get)(struct msm_dsi_host *msm_host, uint64_t *iova);
-	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool 
is_dual_dsi);
+	int (*calc_clk_rate)(struct msm_dsi_host *msm_host, bool 
is_bonded_dsi);

 };

 struct msm_dsi_cfg_handler {
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index ed504fe5074f..eb988faddbbf 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -679,7 +679,7 @@ void dsi_link_clk_disable_v2(struct msm_dsi_host 
*msm_host)

clk_disable_unprepare(msm_host->byte_clk);
 }

-static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool 
is_dual_dsi)
+static u32 dsi_get_pclk_rate(struct msm_dsi_host *msm_host, bool 
is_bonded_dsi)

 {
struct drm_display_mode *mode = msm_host->mode;
u32 pclk_rate;
@@ -692,17 +692,17 @@ static u32 dsi_get_pclk_rate(struct msm_dsi_host
*msm_host, bool is_dual_dsi)
 * the clock rates have to be split between the two dsi controllers.
 	 * Adjust the byte and pixel clock rates for each dsi host 
accordingly.

 */
-   if (is_dual_dsi)
+   if (is_bonded_dsi)
pclk_rate /= 2;

return pclk_rate;
 }

-static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool 
is_dual_dsi)
+static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool 
is_bonded_dsi)

 {
u8 lanes = msm_host->lanes;
u32 bpp = dsi_get_bpp(msm_host->format);
-   u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_dual_dsi);
+   u32 pclk_rate = dsi_get_pclk_rate(msm_host, is_bonded_dsi);
u64 pclk_bpp = (u64)pclk_rate * bpp;

if (lanes == 0) {
@@ -720,28 +720,28 @@ static void dsi_calc_pclk(struct msm_dsi_host
*msm_host, bool is_dual_dsi)

 }

-int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
is_dual_dsi)
+int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool 
is_bonded_dsi)

 {
if (!msm_host->mode) {
pr_err("%s: mode 

Re: [Freedreno] [PATCH v1 3/7] drm/msm/dpu: support setting up two independent DSI connectors

2021-07-09 Thread Dmitry Baryshkov

On 10/07/2021 01:09, abhin...@codeaurora.org wrote:

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

Move setting up encoders from set_encoder_mode to
_dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
allows us to support not only "single DSI" and "bonded DSI" but also "two
independent DSI" configurations. In future this would also help adding
support for multiple DP connectors.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 102 +---
 1 file changed, 57 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1d3a4f395e74..8459da36174e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -471,30 +471,68 @@ static int _dpu_kms_initialize_dsi(struct 
drm_device *dev,

 struct dpu_kms *dpu_kms)
 {
 struct drm_encoder *encoder = NULL;
+    struct msm_display_info info;
 int i, rc = 0;

 if (!(priv->dsi[0] || priv->dsi[1]))
 return rc;

-    /*TODO: Support two independent DSI connectors */
-    encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
-    if (IS_ERR(encoder)) {
-    DPU_ERROR("encoder init failed for dsi display\n");
-    return PTR_ERR(encoder);
-    }
-
-    priv->encoders[priv->num_encoders++] = encoder;
-
+    /*
+ * We support following confiurations:
+ * - Single DSI host (dsi0 or dsi1)
+ * - Two independent DSI hosts
+ * - Bonded DSI0 and DSI1 hosts
+ *
+ *   TODO: Support swapping DSI0 and DSI1 in the bonded setup.
+ */
 for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
 if (!priv->dsi[i])
 continue;

+    if (!encoder) {
+    encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
+    if (IS_ERR(encoder)) {
+    DPU_ERROR("encoder init failed for dsi display\n");
+    return PTR_ERR(encoder);
+    }
+
+    priv->encoders[priv->num_encoders++] = encoder;
+
+    memset(, 0, sizeof(info));
+    info.intf_type = encoder->encoder_type;
+    info.capabilities = msm_dsi_is_cmd_mode(priv->dsi[i]) ?
+    MSM_DISPLAY_CAP_CMD_MODE :
+    MSM_DISPLAY_CAP_VID_MODE;
+    }
+
 rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
 if (rc) {
 DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
 i, rc);
 break;
 }
+
+    info.h_tile_instance[info.num_of_h_tiles++] = i;
+
+    /* Register non-bonded encoder here. If the encoder is bonded,
+ * it will be registered later, when both DSI hosts are
+ * initialized.
+ */
+    if (!msm_dsi_is_bonded_dsi(priv->dsi[i])) {
+    rc = dpu_encoder_setup(dev, encoder, );
+    if (rc)
+    DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+  encoder->base.id, rc);
+    encoder = NULL;
Seems like you are using encoder = NULL as a check to distinguish 
whether this is bonded mode or not.


Whether the encoder war setup or not.


+    }
+    }
+
+    /* Register bonded encoder here, when both DSI hosts are 
initialized */

+    if (encoder) {
Why cant we replace this with if (msm_dsi_is_bonded_dsi(priv->dsi[i]) 
and get rid

of the encoder = NULL?


I can. Maybe I should rewrite this to clearly handle bonded mode.


+    rc = dpu_encoder_setup(dev, encoder, );
+    if (rc)
+    DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+  encoder->base.id, rc);
 }

 return rc;
@@ -505,6 +543,7 @@ static int _dpu_kms_initialize_displayport(struct
drm_device *dev,
 struct dpu_kms *dpu_kms)
 {
 struct drm_encoder *encoder = NULL;
+    struct msm_display_info info;
 int rc = 0;

 if (!priv->dp)
@@ -516,6 +555,7 @@ static int _dpu_kms_initialize_displayport(struct
drm_device *dev,
 return PTR_ERR(encoder);
 }

+    memset(, 0, sizeof(info));
 rc = msm_dp_modeset_init(priv->dp, dev, encoder);
 if (rc) {
 DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
@@ -524,6 +564,14 @@ static int _dpu_kms_initialize_displayport(struct
drm_device *dev,
 }

 priv->encoders[priv->num_encoders++] = encoder;
+
+    info.num_of_h_tiles = 1;
+    info.capabilities = MSM_DISPLAY_CAP_VID_MODE;
+    info.intf_type = encoder->encoder_type;
+    rc = dpu_encoder_setup(dev, encoder, );
+    if (rc)
+    DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+  encoder->base.id, rc);
 return rc;
 }

@@ -726,41 +774,6 @@ static void dpu_kms_destroy(struct msm_kms *kms)
 msm_kms_destroy(_kms->base);
 }

-static void _dpu_kms_set_encoder_mode(struct msm_kms *kms,
- struct drm_encoder *encoder,
- bool cmd_mode)
-{
-    struct msm_display_info info;
-    struct msm_drm_private *priv 

Re: [Freedreno] [PATCH v1 3/7] drm/msm/dpu: support setting up two independent DSI connectors

2021-07-09 Thread abhinavk

On 2021-07-08 05:28, Dmitry Baryshkov wrote:

Move setting up encoders from set_encoder_mode to
_dpu_kms_initialize_dsi() / _dpu_kms_initialize_displayport(). This
allows us to support not only "single DSI" and "bonded DSI" but also 
"two

independent DSI" configurations. In future this would also help adding
support for multiple DP connectors.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 102 +---
 1 file changed, 57 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 1d3a4f395e74..8459da36174e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -471,30 +471,68 @@ static int _dpu_kms_initialize_dsi(struct 
drm_device *dev,

struct dpu_kms *dpu_kms)
 {
struct drm_encoder *encoder = NULL;
+   struct msm_display_info info;
int i, rc = 0;

if (!(priv->dsi[0] || priv->dsi[1]))
return rc;

-   /*TODO: Support two independent DSI connectors */
-   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
-   if (IS_ERR(encoder)) {
-   DPU_ERROR("encoder init failed for dsi display\n");
-   return PTR_ERR(encoder);
-   }
-
-   priv->encoders[priv->num_encoders++] = encoder;
-
+   /*
+* We support following confiurations:
+* - Single DSI host (dsi0 or dsi1)
+* - Two independent DSI hosts
+* - Bonded DSI0 and DSI1 hosts
+*
+*   TODO: Support swapping DSI0 and DSI1 in the bonded setup.
+*/
for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
if (!priv->dsi[i])
continue;

+   if (!encoder) {
+   encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
+   if (IS_ERR(encoder)) {
+   DPU_ERROR("encoder init failed for dsi 
display\n");
+   return PTR_ERR(encoder);
+   }
+
+   priv->encoders[priv->num_encoders++] = encoder;
+
+   memset(, 0, sizeof(info));
+   info.intf_type = encoder->encoder_type;
+   info.capabilities = msm_dsi_is_cmd_mode(priv->dsi[i]) ?
+   MSM_DISPLAY_CAP_CMD_MODE :
+   MSM_DISPLAY_CAP_VID_MODE;
+   }
+
rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
if (rc) {
DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
i, rc);
break;
}
+
+   info.h_tile_instance[info.num_of_h_tiles++] = i;
+
+   /* Register non-bonded encoder here. If the encoder is bonded,
+* it will be registered later, when both DSI hosts are
+* initialized.
+*/
+   if (!msm_dsi_is_bonded_dsi(priv->dsi[i])) {
+   rc = dpu_encoder_setup(dev, encoder, );
+   if (rc)
+   DPU_ERROR("failed to setup DPU encoder %d: 
rc:%d\n",
+ encoder->base.id, rc);
+   encoder = NULL;
Seems like you are using encoder = NULL as a check to distinguish 
whether this is bonded mode or not.

+   }
+   }
+
+	/* Register bonded encoder here, when both DSI hosts are initialized 
*/

+   if (encoder) {
Why cant we replace this with if (msm_dsi_is_bonded_dsi(priv->dsi[i]) 
and get rid

of the encoder = NULL?

+   rc = dpu_encoder_setup(dev, encoder, );
+   if (rc)
+   DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n",
+ encoder->base.id, rc);
}

return rc;
@@ -505,6 +543,7 @@ static int _dpu_kms_initialize_displayport(struct
drm_device *dev,
struct dpu_kms *dpu_kms)
 {
struct drm_encoder *encoder = NULL;
+   struct msm_display_info info;
int rc = 0;

if (!priv->dp)
@@ -516,6 +555,7 @@ static int _dpu_kms_initialize_displayport(struct
drm_device *dev,
return PTR_ERR(encoder);
}

+   memset(, 0, sizeof(info));
rc = msm_dp_modeset_init(priv->dp, dev, encoder);
if (rc) {
DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc);
@@ -524,6 +564,14 @@ static int _dpu_kms_initialize_displayport(struct
drm_device *dev,
}

priv->encoders[priv->num_encoders++] = encoder;
+
+   info.num_of_h_tiles = 1;
+   info.capabilities = MSM_DISPLAY_CAP_VID_MODE;
+   info.intf_type = encoder->encoder_type;
+   rc = dpu_encoder_setup(dev, encoder, );
+   if (rc)
+   DPU_ERROR("failed to 

[Freedreno] [PATCH v2 6/8] drm/msm/dsi: stop setting clock parents manually

2021-07-09 Thread Dmitry Baryshkov
There is no reason to set clock parents manually, use device tree to
assign DSI/display clock parents to DSI PHY clocks. Dropping this manual
setup allows us to drop repeating code and to move registration of hw
clock providers to generic place.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dsi/dsi.h |  2 --
 drivers/gpu/drm/msm/dsi/dsi_host.c| 51 ---
 drivers/gpu/drm/msm/dsi/dsi_manager.c |  5 ---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 11 --
 4 files changed, 69 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 9b8e9b07eced..1f0ec78c6b05 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -170,8 +170,6 @@ void msm_dsi_phy_get_shared_timings(struct msm_dsi_phy *phy,
struct msm_dsi_phy_shared_timings *shared_timing);
 void msm_dsi_phy_set_usecase(struct msm_dsi_phy *phy,
 enum msm_dsi_phy_usecase uc);
-int msm_dsi_phy_get_clk_provider(struct msm_dsi_phy *phy,
-   struct clk **byte_clk_provider, struct clk **pixel_clk_provider);
 void msm_dsi_phy_pll_save_state(struct msm_dsi_phy *phy);
 int msm_dsi_phy_pll_restore_state(struct msm_dsi_phy *phy);
 void msm_dsi_phy_snapshot(struct msm_disp_state *disp_state, struct 
msm_dsi_phy *phy);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index ed504fe5074f..1fa6ee12395b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -2219,57 +2219,6 @@ void msm_dsi_host_cmd_xfer_commit(struct mipi_dsi_host 
*host, u32 dma_base,
wmb();
 }
 
-int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host,
-   struct msm_dsi_phy *src_phy)
-{
-   struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
-   struct clk *byte_clk_provider, *pixel_clk_provider;
-   int ret;
-
-   ret = msm_dsi_phy_get_clk_provider(src_phy,
-   _clk_provider, _clk_provider);
-   if (ret) {
-   pr_info("%s: can't get provider from pll, don't set parent\n",
-   __func__);
-   return 0;
-   }
-
-   ret = clk_set_parent(msm_host->byte_clk_src, byte_clk_provider);
-   if (ret) {
-   pr_err("%s: can't set parent to byte_clk_src. ret=%d\n",
-   __func__, ret);
-   goto exit;
-   }
-
-   ret = clk_set_parent(msm_host->pixel_clk_src, pixel_clk_provider);
-   if (ret) {
-   pr_err("%s: can't set parent to pixel_clk_src. ret=%d\n",
-   __func__, ret);
-   goto exit;
-   }
-
-   if (msm_host->dsi_clk_src) {
-   ret = clk_set_parent(msm_host->dsi_clk_src, pixel_clk_provider);
-   if (ret) {
-   pr_err("%s: can't set parent to dsi_clk_src. ret=%d\n",
-   __func__, ret);
-   goto exit;
-   }
-   }
-
-   if (msm_host->esc_clk_src) {
-   ret = clk_set_parent(msm_host->esc_clk_src, byte_clk_provider);
-   if (ret) {
-   pr_err("%s: can't set parent to esc_clk_src. ret=%d\n",
-   __func__, ret);
-   goto exit;
-   }
-   }
-
-exit:
-   return ret;
-}
-
 void msm_dsi_host_reset_phy(struct mipi_dsi_host *host)
 {
struct msm_dsi_host *msm_host = to_msm_dsi_host(host);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 4ebfedc4a9ac..4a17f12b9316 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -78,7 +78,6 @@ static int dsi_mgr_setup_components(int id)
return ret;
 
msm_dsi_phy_set_usecase(msm_dsi->phy, MSM_DSI_PHY_STANDALONE);
-   ret = msm_dsi_host_set_src_pll(msm_dsi->host, msm_dsi->phy);
} else if (!other_dsi) {
ret = 0;
} else {
@@ -105,10 +104,6 @@ static int dsi_mgr_setup_components(int id)
MSM_DSI_PHY_MASTER);
msm_dsi_phy_set_usecase(clk_slave_dsi->phy,
MSM_DSI_PHY_SLAVE);
-   ret = msm_dsi_host_set_src_pll(msm_dsi->host, 
clk_master_dsi->phy);
-   if (ret)
-   return ret;
-   ret = msm_dsi_host_set_src_pll(other_dsi->host, 
clk_master_dsi->phy);
}
 
return ret;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 6ca6bfd4809b..952fd0b95865 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -835,17 +835,6 @@ void msm_dsi_phy_set_usecase(struct msm_dsi_phy *phy,
phy->usecase = uc;
 }
 
-int msm_dsi_phy_get_clk_provider(struct msm_dsi_phy *phy,
-   

[Freedreno] [PATCH v2 7/8] drm/msm/dsi: phy: use of_device_get_match_data

2021-07-09 Thread Dmitry Baryshkov
Use of_device_get_match-data() instead of of_match_node().

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 952fd0b95865..c76a6438ffb9 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -625,17 +625,12 @@ static int dsi_phy_driver_probe(struct platform_device 
*pdev)
 {
struct msm_dsi_phy *phy;
struct device *dev = >dev;
-   const struct of_device_id *match;
int ret;
 
phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
if (!phy)
return -ENOMEM;
 
-   match = of_match_node(dsi_phy_dt_match, dev->of_node);
-   if (!match)
-   return -ENODEV;
-
phy->provided_clocks = devm_kzalloc(dev,
struct_size(phy->provided_clocks, hws, 
NUM_PROVIDED_CLKS),
GFP_KERNEL);
@@ -644,7 +639,10 @@ static int dsi_phy_driver_probe(struct platform_device 
*pdev)
 
phy->provided_clocks->num = NUM_PROVIDED_CLKS;
 
-   phy->cfg = match->data;
+   phy->cfg = of_device_get_match_data(>dev);
+   if (!phy->cfg)
+   return -ENODEV;
+
phy->pdev = pdev;
 
phy->id = dsi_phy_get_id(phy);
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 8/8] drm/msm/dsi: drop msm_dsi_phy_get_shared_timings

2021-07-09 Thread Dmitry Baryshkov
Instead of fetching shared timing through an extra function call, get
them directly from msm_dsi_phy_enable.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 drivers/gpu/drm/msm/dsi/dsi.h |  5 ++---
 drivers/gpu/drm/msm/dsi/dsi_manager.c |  3 +--
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 13 +
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 1f0ec78c6b05..876053ba615b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -164,10 +164,9 @@ struct msm_dsi_phy_clk_request {
 void msm_dsi_phy_driver_register(void);
 void msm_dsi_phy_driver_unregister(void);
 int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
-   struct msm_dsi_phy_clk_request *clk_req);
+   struct msm_dsi_phy_clk_request *clk_req,
+   struct msm_dsi_phy_shared_timings *shared_timings);
 void msm_dsi_phy_disable(struct msm_dsi_phy *phy);
-void msm_dsi_phy_get_shared_timings(struct msm_dsi_phy *phy,
-   struct msm_dsi_phy_shared_timings *shared_timing);
 void msm_dsi_phy_set_usecase(struct msm_dsi_phy *phy,
 enum msm_dsi_phy_usecase uc);
 void msm_dsi_phy_pll_save_state(struct msm_dsi_phy *phy);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c 
b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 4a17f12b9316..6f90d9940e8b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -118,8 +118,7 @@ static int enable_phy(struct msm_dsi *msm_dsi,
 
msm_dsi_host_get_phy_clk_req(msm_dsi->host, _req, is_dual_dsi);
 
-   ret = msm_dsi_phy_enable(msm_dsi->phy, _req);
-   msm_dsi_phy_get_shared_timings(msm_dsi->phy, shared_timings);
+   ret = msm_dsi_phy_enable(msm_dsi->phy, _req, shared_timings);
 
return ret;
 }
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index c76a6438ffb9..f479e37d6428 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -752,7 +752,8 @@ void __exit msm_dsi_phy_driver_unregister(void)
 }
 
 int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
-   struct msm_dsi_phy_clk_request *clk_req)
+   struct msm_dsi_phy_clk_request *clk_req,
+   struct msm_dsi_phy_shared_timings *shared_timings)
 {
struct device *dev = >pdev->dev;
int ret;
@@ -780,6 +781,9 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy,
goto phy_en_fail;
}
 
+   memcpy(shared_timings, >timing.shared_timings,
+  sizeof(*shared_timings));
+
/*
 * Resetting DSI PHY silently changes its PLL registers to reset status,
 * which will confuse clock driver and result in wrong output rate of
@@ -819,13 +823,6 @@ void msm_dsi_phy_disable(struct msm_dsi_phy *phy)
dsi_phy_disable_resource(phy);
 }
 
-void msm_dsi_phy_get_shared_timings(struct msm_dsi_phy *phy,
-   struct msm_dsi_phy_shared_timings *shared_timings)
-{
-   memcpy(shared_timings, >timing.shared_timings,
-  sizeof(*shared_timings));
-}
-
 void msm_dsi_phy_set_usecase(struct msm_dsi_phy *phy,
 enum msm_dsi_phy_usecase uc)
 {
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 5/8] arm64: dts: qcom: sm8250: assign DSI clock source parents

2021-07-09 Thread Dmitry Baryshkov
Assign DSI clock source parents to DSI PHY clocks.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 arch/arm64/boot/dts/qcom/sm8250.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi 
b/arch/arm64/boot/dts/qcom/sm8250.dtsi
index 4c0de12aaba6..69bf2e90cbce 100644
--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
@@ -2491,6 +2491,9 @@ dsi0: dsi@ae94000 {
  "iface",
  "bus";
 
+   assigned-clocks = < 
DISP_CC_MDSS_BYTE0_CLK_SRC>, < DISP_CC_MDSS_PCLK0_CLK_SRC>;
+   assigned-clock-parents = <_phy 0>, 
<_phy 1>;
+
operating-points-v2 = <_opp_table>;
power-domains = < SM8250_MMCX>;
 
@@ -2558,6 +2561,9 @@ dsi1: dsi@ae96000 {
  "iface",
  "bus";
 
+   assigned-clocks = < 
DISP_CC_MDSS_BYTE1_CLK_SRC>, < DISP_CC_MDSS_PCLK1_CLK_SRC>;
+   assigned-clock-parents = <_phy 0>, 
<_phy 1>;
+
operating-points-v2 = <_opp_table>;
power-domains = < SM8250_MMCX>;
 
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 4/8] arm64: dts: qcom: sdm845-mtp: assign DSI clock source parents

2021-07-09 Thread Dmitry Baryshkov
Assign DSI clock source parents to DSI PHY clocks.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 
b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
index 1372fe8601f5..9e550e3ad678 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
@@ -413,6 +413,9 @@  {
 
qcom,dual-dsi-mode;
 
+   /* DSI1 is slave, so use DSI0 clocks */
+   assigned-clock-parents = <_phy 0>, <_phy 1>;
+
ports {
port@1 {
endpoint {
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 3/8] arm64: dts: qcom: sdm845: assign DSI clock source parents

2021-07-09 Thread Dmitry Baryshkov
Assign DSI clock source parents to DSI PHY clocks.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 0a86fe71a66d..e13097ef271a 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -4260,6 +4260,9 @@ dsi0: dsi@ae94000 {
  "core",
  "iface",
  "bus";
+   assigned-clocks = < 
DISP_CC_MDSS_BYTE0_CLK_SRC>, < DISP_CC_MDSS_PCLK0_CLK_SRC>;
+   assigned-clock-parents = <_phy 0>, 
<_phy 1>;
+
operating-points-v2 = <_opp_table>;
power-domains = < SDM845_CX>;
 
@@ -4326,6 +4329,9 @@ dsi1: dsi@ae96000 {
  "core",
  "iface",
  "bus";
+   assigned-clocks = < 
DISP_CC_MDSS_BYTE1_CLK_SRC>, < DISP_CC_MDSS_PCLK1_CLK_SRC>;
+   assigned-clock-parents = <_phy 0>, 
<_phy 1>;
+
operating-points-v2 = <_opp_table>;
power-domains = < SDM845_CX>;
 
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 1/8] dt-bindings: display: msm: dsi-controller-main: restore assigned-clocks

2021-07-09 Thread Dmitry Baryshkov
Restore the assgined-clocks and assigned-clock-parents properties that
were lost during the txt -> YAML conversion.

Signed-off-by: Dmitry Baryshkov 
---
 .../display/msm/dsi-controller-main.yaml| 17 +
 1 file changed, 17 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index 76348b71f736..760eec6b0db1 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -64,6 +64,18 @@ properties:
   Indicates if the DSI controller is driving a panel which needs
   2 DSI links.
 
+  assigned-clocks:
+minItems: 2
+maxItems: 2
+description: |
+  Parents of "byte" and "pixel" for the given platform.
+
+  assigned-clock-parents:
+minItems: 2
+maxItems: 2
+description: |
+  The Byte clock and Pixel clock PLL outputs provided by a DSI PHY block.
+
   power-domains:
 maxItems: 1
 
@@ -119,6 +131,8 @@ required:
   - clock-names
   - phys
   - phy-names
+  - assigned-clocks
+  - assigned-clock-parents
   - power-domains
   - operating-points-v2
   - ports
@@ -159,6 +173,9 @@ examples:
phys = <_phy>;
phy-names = "dsi";
 
+   assigned-clocks = < DISP_CC_MDSS_BYTE0_CLK_SRC>, < 
DISP_CC_MDSS_PCLK0_CLK_SRC>;
+   assigned-clock-parents = <_phy 0>, <_phy 1>;
+
power-domains = < SC7180_CX>;
operating-points-v2 = <_opp_table>;
 
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 2/8] arm64: dts: qcom: sc7180: assign DSI clock source parents

2021-07-09 Thread Dmitry Baryshkov
Assign DSI clock source parents to DSI PHY clocks.

Signed-off-by: Dmitry Baryshkov 
Reviewed-by: Abhinav Kumar 
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 6228ba2d8513..bc765598d24e 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -3081,6 +3081,9 @@ dsi0: dsi@ae94000 {
  "iface",
  "bus";
 
+   assigned-clocks = < 
DISP_CC_MDSS_BYTE0_CLK_SRC>, < DISP_CC_MDSS_PCLK0_CLK_SRC>;
+   assigned-clock-parents = <_phy 0>, 
<_phy 1>;
+
operating-points-v2 = <_opp_table>;
power-domains = < SC7180_CX>;
 
-- 
2.30.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 0/8] dsi: rework clock parents and timing handling

2021-07-09 Thread Dmitry Baryshkov
This patch series brings back several patches targeting assigning dispcc
clock parents, that were removed from the massive dsi rework patchset
earlier.

Few notes:
 - assign-clock-parents is a mandatory proprety according to the current
   dsi.txt description.
 - There is little point in duplicating this functionality with the ad-hoc
   implementation in the dsi code.

On top of that come few minor cleanups for the DSI PHY drivers.

I'd kindly ask to bring all dts changes also through the drm tree, so
that there won't be any breakage of the functionality.

The patchset was tested on RB3 (single DSI), RB5 (single DSI, two
independent DSI, bonded DSI, two last configs require additional patches
which do not concern the DSI timings code).

Changes since v1:
 - add dt-bindings change
 - drop the patch removing msm_dsi_dphy_timing

The following changes since commit e88bbc91849b2bf57683119c339e52916d34433f:

  Revert "drm/msm/mdp5: provide dynamic bandwidth management" (2021-06-23 
14:06:20 -0700)

are available in the Git repository at:

  https://git.linaro.org/people/dmitry.baryshkov/kernel.git dsi-phy-update

for you to fetch changes up to a79d84d8eac721a7ebaf3cfc65b200077b1d6947:

  drm/msm/dsi: drop msm_dsi_phy_get_shared_timings (2021-07-10 00:02:18 +0300)


Dmitry Baryshkov (8):
  dt-bindings: display: msm: dsi-controller-main: restore assigned-clocks
  arm64: dts: qcom: sc7180: assign DSI clock source parents
  arm64: dts: qcom: sdm845: assign DSI clock source parents
  arm64: dts: qcom: sdm845-mtp: assign DSI clock source parents
  arm64: dts: qcom: sm8250: assign DSI clock source parents
  drm/msm/dsi: stop setting clock parents manually
  drm/msm/dsi: phy: use of_device_get_match_data
  drm/msm/dsi: drop msm_dsi_phy_get_shared_timings

 .../bindings/display/msm/dsi-controller-main.yaml  | 17 
 arch/arm64/boot/dts/qcom/sc7180.dtsi   |  3 ++
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts|  3 ++
 arch/arm64/boot/dts/qcom/sdm845.dtsi   |  6 +++
 arch/arm64/boot/dts/qcom/sm8250.dtsi   |  6 +++
 drivers/gpu/drm/msm/dsi/dsi.h  |  7 +--
 drivers/gpu/drm/msm/dsi/dsi_host.c | 51 --
 drivers/gpu/drm/msm/dsi/dsi_manager.c  |  8 +---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  | 34 ---
 9 files changed, 47 insertions(+), 88 deletions(-)


___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [v8 0/6] drm: Support basic DPCD backlight in panel-simple and add a new panel ATNA33XC20

2021-07-09 Thread Ville Syrjälä
On Fri, Jul 09, 2021 at 06:54:05AM -0700, Doug Anderson wrote:
> Hi,
> 
> On Sat, Jun 26, 2021 at 9:52 AM Rajeev Nandan  wrote:
> >
> > This series adds the support for the eDP panel that needs the backlight
> > controlling over the DP AUX channel using DPCD registers of the panel
> > as per the VESA's standard.
> >
> > This series also adds support for the Samsung eDP AMOLED panel that
> > needs DP AUX to control the backlight, and introduces new delays in the
> > @panel_desc.delay to support this panel.
> >
> > This patch series depends on the following two series:
> > - Doug's series [1], exposed the DP AUX channel to the panel-simple.
> > - Lyude's series [2], introduced new drm helper functions for DPCD
> >   backlight.
> >
> > This series is the logical successor to the series [3].
> >
> > Changes in v1:
> > - Created dpcd backlight helper with very basic functionality, added
> >   backlight registration in the ti-sn65dsi86 bridge driver.
> >
> > Changes in v2:
> > - Created a new DisplayPort aux backlight driver and moved the code from
> >   drm_dp_aux_backlight.c (v1) to the new driver.
> >
> > Changes in v3:
> > - Fixed module compilation (kernel test bot).
> >
> > Changes in v4:
> > - Added basic DPCD backlight support in panel-simple.
> > - Added support for a new Samsung panel ATNA33XC20 that needs DPCD
> >   backlight controlling and has a requirement of delays between enable
> >   GPIO and regulator.
> >
> > Changes in v5:
> > Addressed review suggestions from Douglas:
> > - Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
> > - Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
> > - panel-simple probe() calls drm_panel_dp_aux_backlight() to create
> >   backlight when the backlight phandle is not specified in panel DT
> >   and DP AUX channel is present.
> > - Added check for drm_edp_backlight_supported() before registering.
> > - Removed the @uses_dpcd_backlight flag from panel_desc as this
> >   should be auto-detected.
> > - Updated comments/descriptions.
> >
> > Changes in v6:
> > - Rebased
> > - Updated wanrning messages, fixed word wrapping in comments.
> > - Fixed ordering of memory allocation
> >
> > Changes in v7:
> > - Updated the disable_to_power_off and power_to_enable panel delays
> > as discovered at  (Douglas)
> >
> > Changes in v8:
> > - Now using backlight_is_blank() to get the backlight blank status (Sam 
> > Ravnborg)
> > - Added a new patch #4 to fix the warnings for eDP panel description (Sam 
> > Ravnborg)
> >
> > [1] 
> > https://lore.kernel.org/dri-devel/20210525000159.3384921-1-diand...@chromium.org/
> > [2] 
> > https://lore.kernel.org/dri-devel/20210514181504.565252-1-ly...@redhat.com/
> > [3] 
> > https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajee...@codeaurora.org/
> >
> > Rajeev Nandan (6):
> >   drm/panel: add basic DP AUX backlight support
> >   drm/panel-simple: Support DP AUX backlight
> >   drm/panel-simple: Support for delays between GPIO & regulator
> >   drm/panel-simple: Update validation warnings for eDP panel description
> >   dt-bindings: display: simple: Add Samsung ATNA33XC20
> >   drm/panel-simple: Add Samsung ATNA33XC20
> >
> >  .../bindings/display/panel/panel-simple.yaml   |   2 +
> >  drivers/gpu/drm/drm_panel.c| 108 
> > +
> >  drivers/gpu/drm/panel/panel-simple.c   |  73 +-
> >  include/drm/drm_panel.h|  15 ++-
> >  4 files changed, 190 insertions(+), 8 deletions(-)
> 
> Pushed to drm-misc-next.
> 
> 4bfe6c8f7c23 drm/panel-simple: Add Samsung ATNA33XC20
> c20dec193584 dt-bindings: display: simple: Add Samsung ATNA33XC20
> 13aceea56fd5 drm/panel-simple: Update validation warnings for eDP
> panel description
> 18a1488bf1e1 drm/panel-simple: Support for delays between GPIO & regulator
> bfd451403d70 drm/panel-simple: Support DP AUX backlight
> 10f7b40e4f30 drm/panel: add basic DP AUX backlight support

depmod: ERROR: Cycle detected: drm_kms_helper -> drm -> drm_kms_helper

Looks to be due to drm_edp_backlight_enable().

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


Re: [Freedreno] [PATCH 5/7] drm/msm/dp: return correct edid checksum after corrupted edid checksum read

2021-07-09 Thread khsieh

On 2021-07-08 00:14, Stephen Boyd wrote:

Quoting Kuogee Hsieh (2021-07-06 10:20:18)
Response with correct edid checksum saved at connector after corrupted 
edid

checksum read. This fixes Link Layer CTS cases 4.2.2.3, 4.2.2.6.

Signed-off-by: Kuogee Hsieh 
---
 drivers/gpu/drm/msm/dp/dp_panel.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c 
b/drivers/gpu/drm/msm/dp/dp_panel.c

index 88196f7..0fdb551 100644
--- a/drivers/gpu/drm/msm/dp/dp_panel.c
+++ b/drivers/gpu/drm/msm/dp/dp_panel.c
@@ -271,7 +271,7 @@ static u8 dp_panel_get_edid_checksum(struct edid 
*edid)

 {
struct edid *last_block;
u8 *raw_edid;
-   bool is_edid_corrupt;
+   bool is_edid_corrupt = false;

if (!edid) {
DRM_ERROR("invalid edid input\n");
@@ -303,7 +303,12 @@ void dp_panel_handle_sink_request(struct dp_panel 
*dp_panel)
panel = container_of(dp_panel, struct dp_panel_private, 
dp_panel);


if (panel->link->sink_request & DP_TEST_LINK_EDID_READ) {
-   u8 checksum = 
dp_panel_get_edid_checksum(dp_panel->edid);

+   u8 checksum;
+
+   if (dp_panel->edid)
+   checksum = 
dp_panel_get_edid_checksum(dp_panel->edid);

+   else
+   checksum = 
dp_panel->connector->real_edid_checksum;


dp_link_send_edid_checksum(panel->link, checksum);


It looks like this can be drm_dp_send_real_edid_checksum()? Then we
don't have to look at the connector internals sometimes and can drop
dp_panel_get_edid_checksum() entirely?
you still need to pass read edid checksum into 
drm_dp_send_real_edid_checksum().



dp_link_send_test_response(panel->link);

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 2/7] drm/msm/dp: reduce link rate if failed at link training 1

2021-07-09 Thread khsieh

On 2021-07-08 00:33, Stephen Boyd wrote:

Quoting Kuogee Hsieh (2021-07-06 10:20:15)

Reduce link rate and re start link training if link training 1
failed due to loss of clock recovery done to fix Link Layer
CTS case 4.3.1.7.  Also only update voltage and pre-emphasis
swing level after link training started to fix Link Layer CTS
case 4.3.1.6.

Signed-off-by: Kuogee Hsieh 
---
 drivers/gpu/drm/msm/dp/dp_ctrl.c | 86 
++--

 1 file changed, 56 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c 
b/drivers/gpu/drm/msm/dp/dp_ctrl.c

index 27fb0f0..6f8443d 100644
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
@@ -83,13 +83,6 @@ struct dp_ctrl_private {
struct completion video_comp;
 };

-struct dp_cr_status {
-   u8 lane_0_1;
-   u8 lane_2_3;
-};
-
-#define DP_LANE0_1_CR_DONE 0x11
-
 static int dp_aux_link_configure(struct drm_dp_aux *aux,
struct dp_link_info *link)
 {
@@ -1080,7 +1073,7 @@ static int dp_ctrl_read_link_status(struct 
dp_ctrl_private *ctrl,

 }

 static int dp_ctrl_link_train_1(struct dp_ctrl_private *ctrl,
-   struct dp_cr_status *cr, int *training_step)
+   u8 *cr, int *training_step)
 {
int tries, old_v_level, ret = 0;
u8 link_status[DP_LINK_STATUS_SIZE];
@@ -1109,8 +1102,8 @@ static int dp_ctrl_link_train_1(struct 
dp_ctrl_private *ctrl,

if (ret)
return ret;

-   cr->lane_0_1 = link_status[0];
-   cr->lane_2_3 = link_status[1];
+   cr[0] = link_status[0];
+   cr[1] = link_status[1];

if (drm_dp_clock_recovery_ok(link_status,
ctrl->link->link_params.num_lanes)) {
@@ -1188,7 +1181,7 @@ static void 
dp_ctrl_clear_training_pattern(struct dp_ctrl_private *ctrl)

 }

 static int dp_ctrl_link_train_2(struct dp_ctrl_private *ctrl,
-   struct dp_cr_status *cr, int *training_step)
+   u8 *cr, int *training_step)
 {
int tries = 0, ret = 0;
char pattern;
@@ -1204,10 +1197,6 @@ static int dp_ctrl_link_train_2(struct 
dp_ctrl_private *ctrl,

else
pattern = DP_TRAINING_PATTERN_2;

-   ret = dp_ctrl_update_vx_px(ctrl);
-   if (ret)
-   return ret;
-
ret = dp_catalog_ctrl_set_pattern(ctrl->catalog, pattern);
if (ret)
return ret;
@@ -1220,8 +1209,8 @@ static int dp_ctrl_link_train_2(struct 
dp_ctrl_private *ctrl,

ret = dp_ctrl_read_link_status(ctrl, link_status);
if (ret)
return ret;
-   cr->lane_0_1 = link_status[0];
-   cr->lane_2_3 = link_status[1];
+   cr[0] = link_status[0];
+   cr[1] = link_status[1];

if (drm_dp_channel_eq_ok(link_status,
ctrl->link->link_params.num_lanes)) {
@@ -1241,7 +1230,7 @@ static int dp_ctrl_link_train_2(struct 
dp_ctrl_private *ctrl,
 static int dp_ctrl_reinitialize_mainlink(struct dp_ctrl_private 
*ctrl);


 static int dp_ctrl_link_train(struct dp_ctrl_private *ctrl,
-   struct dp_cr_status *cr, int *training_step)
+   u8 *cr, int *training_step)
 {
int ret = 0;
u8 encoding = DP_SET_ANSI_8B10B;
@@ -1282,7 +1271,7 @@ static int dp_ctrl_link_train(struct 
dp_ctrl_private *ctrl,

 }

 static int dp_ctrl_setup_main_link(struct dp_ctrl_private *ctrl,
-   struct dp_cr_status *cr, int *training_step)
+   u8 *cr, int *training_step)
 {
int ret = 0;

@@ -1496,14 +1485,14 @@ static int 
dp_ctrl_deinitialize_mainlink(struct dp_ctrl_private *ctrl)

 static int dp_ctrl_link_maintenance(struct dp_ctrl_private *ctrl)
 {
int ret = 0;
-   struct dp_cr_status cr;
+   u8 cr_status[2];
int training_step = DP_TRAINING_NONE;

dp_ctrl_push_idle(>dp_ctrl);

ctrl->dp_ctrl.pixel_rate = 
ctrl->panel->dp_mode.drm_mode.clock;


-   ret = dp_ctrl_setup_main_link(ctrl, , _step);
+   ret = dp_ctrl_setup_main_link(ctrl, cr_status, 
_step);

if (ret)
goto end;


Do we need to extract the link status information from deep in these
functions? Why not read it again when we need to?



@@ -1634,6 +1623,41 @@ void dp_ctrl_handle_sink_request(struct dp_ctrl 
*dp_ctrl)

}
 }

+static bool dp_ctrl_any_lane_cr_done(struct dp_ctrl_private *ctrl,
+   u8 *cr_status)
+
+{
+   int i;
+   u8 status;
+   int lane = ctrl->link->link_params.num_lanes;
+
+   for (i = 0; i < lane; i++) {
+   status = cr_status[i / 2];
+   status >>= ((i % 2) * 4);
+   if (status & DP_LANE_CR_DONE)
+   return true;
+   }
+
+   return false;
+}
+
+static bool dp_ctrl_any_lane_cr_lose(struct dp_ctrl_private 

Re: [Freedreno] [PATCH 7/7] drm/msm/dp: retrain link when loss of symbol lock detected

2021-07-09 Thread khsieh

On 2021-07-08 00:21, Stephen Boyd wrote:

Quoting Kuogee Hsieh (2021-07-06 10:20:20)

Main link symbol locked is achieved at end of link training 2. Some
dongle main link symbol may become unlocked again if host did not end
link training soon enough after completion of link training 2. Host
have to re train main link if loss of symbol lock detected before
end link training so that the coming video stream can be transmitted
to sink properly.

Signed-off-by: Kuogee Hsieh 


I guess this is a fix for the original driver, so it should be tagged
with Fixes appropriately.
Actually, this is fix on patch #6 : drm/msm/dp: do not end dp link 
training until video is ready

Should i merge patch #6 and #7 together?
Or can you suggest what should I do?



---
 drivers/gpu/drm/msm/dp/dp_ctrl.c | 34 
++

 1 file changed, 34 insertions(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c 
b/drivers/gpu/drm/msm/dp/dp_ctrl.c

index 0cb01a9..e616ab2 100644
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
@@ -1661,6 +1661,25 @@ static bool dp_ctrl_any_lane_cr_lose(struct 
dp_ctrl_private *ctrl,

return false;
 }

+static bool dp_ctrl_loss_symbol_lock(struct dp_ctrl_private *ctrl)
+{
+   u8 link_status[6];


Can we use link_status[DP_LINK_STATUS_SIZE] instead?


+   u8 status;
+   int i;
+   int lane = ctrl->link->link_params.num_lanes;


s/lane/num_lanes/

would make the code easier to read


+
+   dp_ctrl_read_link_status(ctrl, link_status);
+
+   for (i = 0; i < lane; i++) {
+   status = link_status[i / 2];
+   status >>= ((i % 2) * 4);
+   if (!(status & DP_LANE_SYMBOL_LOCKED))
+   return true;
+   }
+
+   return false;
+}
+
 int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
 {
int rc = 0;
@@ -1777,6 +1796,17 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
return rc;
 }

+static int dp_ctrl_link_retrain(struct dp_ctrl_private *ctrl)
+{
+   int ret = 0;


Please drop init of ret.


+   u8 cr_status[2];
+   int training_step = DP_TRAINING_NONE;
+
+   ret = dp_ctrl_setup_main_link(ctrl, cr_status, 
_step);


as it is assigned here.


+
+   return ret;


And indeed, it could be 'return dp_ctrl_setup_main_link()' instead.


+}
+
 int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)
 {
int ret = 0;
@@ -1802,6 +1832,10 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl)
}
}

+   /* if loss symbol lock happen, then retaining the link */


retain or retrain? The comment seems to be saying what the code says 
"if

loss retrain", so the comment is not very useful.


+   if (dp_ctrl_loss_symbol_lock(ctrl))
+   dp_ctrl_link_retrain(ctrl);
+
/* stop txing train pattern to end link training */
dp_ctrl_clear_training_pattern(ctrl);


___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [v8 0/6] drm: Support basic DPCD backlight in panel-simple and add a new panel ATNA33XC20

2021-07-09 Thread Doug Anderson
Hi,

On Sat, Jun 26, 2021 at 9:52 AM Rajeev Nandan  wrote:
>
> This series adds the support for the eDP panel that needs the backlight
> controlling over the DP AUX channel using DPCD registers of the panel
> as per the VESA's standard.
>
> This series also adds support for the Samsung eDP AMOLED panel that
> needs DP AUX to control the backlight, and introduces new delays in the
> @panel_desc.delay to support this panel.
>
> This patch series depends on the following two series:
> - Doug's series [1], exposed the DP AUX channel to the panel-simple.
> - Lyude's series [2], introduced new drm helper functions for DPCD
>   backlight.
>
> This series is the logical successor to the series [3].
>
> Changes in v1:
> - Created dpcd backlight helper with very basic functionality, added
>   backlight registration in the ti-sn65dsi86 bridge driver.
>
> Changes in v2:
> - Created a new DisplayPort aux backlight driver and moved the code from
>   drm_dp_aux_backlight.c (v1) to the new driver.
>
> Changes in v3:
> - Fixed module compilation (kernel test bot).
>
> Changes in v4:
> - Added basic DPCD backlight support in panel-simple.
> - Added support for a new Samsung panel ATNA33XC20 that needs DPCD
>   backlight controlling and has a requirement of delays between enable
>   GPIO and regulator.
>
> Changes in v5:
> Addressed review suggestions from Douglas:
> - Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
> - Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
> - panel-simple probe() calls drm_panel_dp_aux_backlight() to create
>   backlight when the backlight phandle is not specified in panel DT
>   and DP AUX channel is present.
> - Added check for drm_edp_backlight_supported() before registering.
> - Removed the @uses_dpcd_backlight flag from panel_desc as this
>   should be auto-detected.
> - Updated comments/descriptions.
>
> Changes in v6:
> - Rebased
> - Updated wanrning messages, fixed word wrapping in comments.
> - Fixed ordering of memory allocation
>
> Changes in v7:
> - Updated the disable_to_power_off and power_to_enable panel delays
> as discovered at  (Douglas)
>
> Changes in v8:
> - Now using backlight_is_blank() to get the backlight blank status (Sam 
> Ravnborg)
> - Added a new patch #4 to fix the warnings for eDP panel description (Sam 
> Ravnborg)
>
> [1] 
> https://lore.kernel.org/dri-devel/20210525000159.3384921-1-diand...@chromium.org/
> [2] 
> https://lore.kernel.org/dri-devel/20210514181504.565252-1-ly...@redhat.com/
> [3] 
> https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajee...@codeaurora.org/
>
> Rajeev Nandan (6):
>   drm/panel: add basic DP AUX backlight support
>   drm/panel-simple: Support DP AUX backlight
>   drm/panel-simple: Support for delays between GPIO & regulator
>   drm/panel-simple: Update validation warnings for eDP panel description
>   dt-bindings: display: simple: Add Samsung ATNA33XC20
>   drm/panel-simple: Add Samsung ATNA33XC20
>
>  .../bindings/display/panel/panel-simple.yaml   |   2 +
>  drivers/gpu/drm/drm_panel.c| 108 
> +
>  drivers/gpu/drm/panel/panel-simple.c   |  73 +-
>  include/drm/drm_panel.h|  15 ++-
>  4 files changed, 190 insertions(+), 8 deletions(-)

Pushed to drm-misc-next.

4bfe6c8f7c23 drm/panel-simple: Add Samsung ATNA33XC20
c20dec193584 dt-bindings: display: simple: Add Samsung ATNA33XC20
13aceea56fd5 drm/panel-simple: Update validation warnings for eDP
panel description
18a1488bf1e1 drm/panel-simple: Support for delays between GPIO & regulator
bfd451403d70 drm/panel-simple: Support DP AUX backlight
10f7b40e4f30 drm/panel: add basic DP AUX backlight support

-Doug
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v1 0/7] drm/msm/dpu: add support for idependent DSI config

2021-07-09 Thread Alexey Minnekhanov

08.07.2021 15:28, Dmitry Baryshkov wrote:

This patchseries adds support for independent DSI config to DPU1 display
subdriver. Also drop one of msm_kms_funcs callbacks, made unnecessary
now.

Tested on RB5 (dpu, dsi). Previous iteration was tested by Alexey
Minnekhanov.

Changes since v1:
  - renamed dual DSI to bonded DSI as suggsted by Abhinav
  - added comments to _dpu_kms_initialize_dsi() regarding encoders usage

The following changes since commit e88bbc91849b2bf57683119c339e52916d34433f:

   Revert "drm/msm/mdp5: provide dynamic bandwidth management" (2021-06-23 
14:06:20 -0700)

are available in the Git repository at:

   https://git.linaro.org/people/dmitry.baryshkov/kernel.git 
msm-drm-drop-set-encoder-mode-1

for you to fetch changes up to 142f79dfc41271576731a49516d63ad47a56e1ca:

   drm/msm/kms: drop set_encoder_mode callback (2021-07-08 15:20:52 +0300)


Dmitry Baryshkov (7):
   drm/msm/dsi: rename dual DSI to bonded DSI
   drm/msm/dsi: add two helper functions
   drm/msm/dpu: support setting up two independent DSI connectors
   drm/msm/mdp5: move mdp5_encoder_set_intf_mode after msm_dsi_modeset_init
   drm/msm/dp: stop calling set_encoder_mode callback
   drm/msm/dsi: stop calling set_encoder_mode callback
   drm/msm/kms: drop set_encoder_mode callback

  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c  | 102 +--
  drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c |  11 +---
  drivers/gpu/drm/msm/dp/dp_display.c  |  18 --
  drivers/gpu/drm/msm/dsi/dsi.c|   9 ++-
  drivers/gpu/drm/msm/dsi/dsi.h|   9 ++-
  drivers/gpu/drm/msm/dsi/dsi_cfg.h|   2 +-
  drivers/gpu/drm/msm/dsi/dsi_host.c   |  30 -
  drivers/gpu/drm/msm/dsi/dsi_manager.c|  93 
  drivers/gpu/drm/msm/msm_drv.h|  12 +++-
  drivers/gpu/drm/msm/msm_kms.h|   3 -
  10 files changed, 136 insertions(+), 153 deletions(-)



I've tested these patches (again), on msm8974 samsung-klte device with 
MDP5 and nothing is broken.


Tested-by: Alexey Minnekhanov 

--
Regards
Alexey Minnekhanov
postmarketOS developer
https://www.postmarketos.org
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [v1] drm/msm/disp/dpu1: add safe lut config in dpu driver

2021-07-09 Thread Dmitry Baryshkov
On Fri, 9 Jul 2021 at 13:41, Kalyan Thota  wrote:
>
> Add safe lut configuration for all the targets in dpu
> driver as per QOS recommendation.
>
> Issue reported on SC7280:
>
> With wait-for-safe feature in smmu enabled, RT client
> buffer levels are checked to be safe before smmu invalidation.
> Since display was always set to unsafe it was delaying the
> invalidaiton process thus impacting the performance on NRT clients
> such as eMMC and NVMe.
>
> Validated this change on SC7280, With this change eMMC performance
> has improved significantly.

Reviewed-by: Dmitry Baryshkov 

It might be a good option to push it to the stable tree also.

>
> Signed-off-by: Kalyan Thota 
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> index d01c4c9..2e482cd 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> @@ -974,6 +974,7 @@ static const struct dpu_perf_cfg sdm845_perf_data = {
> .amortizable_threshold = 25,
> .min_prefill_lines = 24,
> .danger_lut_tbl = {0xf, 0x, 0x0},
> +   .safe_lut_tbl = {0xfff0, 0xf000, 0x},
> .qos_lut_tbl = {
> {.nentry = ARRAY_SIZE(sdm845_qos_linear),
> .entries = sdm845_qos_linear
> @@ -1001,6 +1002,7 @@ static const struct dpu_perf_cfg sc7180_perf_data = {
> .min_dram_ib = 160,
> .min_prefill_lines = 24,
> .danger_lut_tbl = {0xff, 0x, 0x0},
> +   .safe_lut_tbl = {0xfff0, 0xff00, 0x},
> .qos_lut_tbl = {
> {.nentry = ARRAY_SIZE(sc7180_qos_linear),
> .entries = sc7180_qos_linear
> @@ -1028,6 +1030,7 @@ static const struct dpu_perf_cfg sm8150_perf_data = {
> .min_dram_ib = 80,
> .min_prefill_lines = 24,
> .danger_lut_tbl = {0xf, 0x, 0x0},
> +   .safe_lut_tbl = {0xfff8, 0xf000, 0x},
> .qos_lut_tbl = {
> {.nentry = ARRAY_SIZE(sm8150_qos_linear),
> .entries = sm8150_qos_linear
> @@ -1056,6 +1059,7 @@ static const struct dpu_perf_cfg sm8250_perf_data = {
> .min_dram_ib = 80,
> .min_prefill_lines = 35,
> .danger_lut_tbl = {0xf, 0x, 0x0},
> +   .safe_lut_tbl = {0xfff0, 0xff00, 0x},
> .qos_lut_tbl = {
> {.nentry = ARRAY_SIZE(sc7180_qos_linear),
> .entries = sc7180_qos_linear
> @@ -1084,6 +1088,7 @@ static const struct dpu_perf_cfg sc7280_perf_data = {
> .min_dram_ib = 160,
> .min_prefill_lines = 24,
> .danger_lut_tbl = {0x, 0x, 0x0},
> +   .safe_lut_tbl = {0xff00, 0xff00, 0x},
> .qos_lut_tbl = {
> {.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
> .entries = sc7180_qos_macrotile
> --
> 2.7.4
>


-- 
With best wishes
Dmitry
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH] drm/msm: Fix display fault handling

2021-07-09 Thread Yassine Oudjana



On Wed, Jul 7 2021 at 21:57:05 +0400, Rob Clark  
wrote:
> From: Rob Clark 
> 
> It turns out that when the display is enabled by the bootloader, we 
> can
> get some transient iommu faults from the display.  Which doesn't go 
> over
> too well when we install a fault handler that is gpu specific.  To 
> avoid
> this, defer installing the fault handler until we get around to 
> setting
> up per-process pgtables (which is adreno_smmu specific).  The arm-smmu
> fallback error reporting is sufficient for reporting display related
> faults (and in fact was all we had prior to 
> f8f934c180f629bb927a04fd90d)
> 
> Reported-by: Dmitry Baryshkov 
> Reported-by: Yassine Oudjana 
> Fixes: 2a574cc05d38 ("drm/msm: Improve the a6xx page fault handler")
> Signed-off-by: Rob Clark 
> Tested-by: John Stultz 
> ---
>  drivers/gpu/drm/msm/msm_iommu.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_iommu.c 
> b/drivers/gpu/drm/msm/msm_iommu.c
> index eed2a762e9dd..bcaddbba564d 100644
> --- a/drivers/gpu/drm/msm/msm_iommu.c
> +++ b/drivers/gpu/drm/msm/msm_iommu.c
> @@ -142,6 +142,9 @@ static const struct iommu_flush_ops null_tlb_ops 
> = {
>   .tlb_add_page = msm_iommu_tlb_add_page,
>  };
> 
> +static int msm_fault_handler(struct iommu_domain *domain, struct 
> device *dev,
> + unsigned long iova, int flags, void *arg);
> +
>  struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent)
>  {
>   struct adreno_smmu_priv *adreno_smmu = dev_get_drvdata(parent->dev);
> @@ -157,6 +160,13 @@ struct msm_mmu 
> *msm_iommu_pagetable_create(struct msm_mmu *parent)
>   if (!ttbr1_cfg)
>   return ERR_PTR(-ENODEV);
> 
> + /*
> +  * Defer setting the fault handler until we have a valid adreno_smmu
> +  * to avoid accidentially installing a GPU specific fault handler 
> for
> +  * the display's iommu
> +  */
> + iommu_set_fault_handler(iommu->domain, msm_fault_handler, iommu);
> +
>   pagetable = kzalloc(sizeof(*pagetable), GFP_KERNEL);
>   if (!pagetable)
>   return ERR_PTR(-ENOMEM);
> @@ -300,7 +310,6 @@ struct msm_mmu *msm_iommu_new(struct device *dev, 
> struct iommu_domain *domain)
> 
>   iommu->domain = domain;
>   msm_mmu_init(>base, dev, , MSM_MMU_IOMMU);
> - iommu_set_fault_handler(domain, msm_fault_handler, iommu);
> 
>   atomic_set(>pagetables, 0);
> 
> --
> 2.31.1
> 

Tested-by: Yassine Oudjana 



___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [v1] drm/msm/disp/dpu1: add safe lut config in dpu driver

2021-07-09 Thread Kalyan Thota
Add safe lut configuration for all the targets in dpu
driver as per QOS recommendation.

Issue reported on SC7280:

With wait-for-safe feature in smmu enabled, RT client
buffer levels are checked to be safe before smmu invalidation.
Since display was always set to unsafe it was delaying the
invalidaiton process thus impacting the performance on NRT clients
such as eMMC and NVMe.

Validated this change on SC7280, With this change eMMC performance
has improved significantly.

Signed-off-by: Kalyan Thota 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index d01c4c9..2e482cd 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -974,6 +974,7 @@ static const struct dpu_perf_cfg sdm845_perf_data = {
.amortizable_threshold = 25,
.min_prefill_lines = 24,
.danger_lut_tbl = {0xf, 0x, 0x0},
+   .safe_lut_tbl = {0xfff0, 0xf000, 0x},
.qos_lut_tbl = {
{.nentry = ARRAY_SIZE(sdm845_qos_linear),
.entries = sdm845_qos_linear
@@ -1001,6 +1002,7 @@ static const struct dpu_perf_cfg sc7180_perf_data = {
.min_dram_ib = 160,
.min_prefill_lines = 24,
.danger_lut_tbl = {0xff, 0x, 0x0},
+   .safe_lut_tbl = {0xfff0, 0xff00, 0x},
.qos_lut_tbl = {
{.nentry = ARRAY_SIZE(sc7180_qos_linear),
.entries = sc7180_qos_linear
@@ -1028,6 +1030,7 @@ static const struct dpu_perf_cfg sm8150_perf_data = {
.min_dram_ib = 80,
.min_prefill_lines = 24,
.danger_lut_tbl = {0xf, 0x, 0x0},
+   .safe_lut_tbl = {0xfff8, 0xf000, 0x},
.qos_lut_tbl = {
{.nentry = ARRAY_SIZE(sm8150_qos_linear),
.entries = sm8150_qos_linear
@@ -1056,6 +1059,7 @@ static const struct dpu_perf_cfg sm8250_perf_data = {
.min_dram_ib = 80,
.min_prefill_lines = 35,
.danger_lut_tbl = {0xf, 0x, 0x0},
+   .safe_lut_tbl = {0xfff0, 0xff00, 0x},
.qos_lut_tbl = {
{.nentry = ARRAY_SIZE(sc7180_qos_linear),
.entries = sc7180_qos_linear
@@ -1084,6 +1088,7 @@ static const struct dpu_perf_cfg sc7280_perf_data = {
.min_dram_ib = 160,
.min_prefill_lines = 24,
.danger_lut_tbl = {0x, 0x, 0x0},
+   .safe_lut_tbl = {0xff00, 0xff00, 0x},
.qos_lut_tbl = {
{.nentry = ARRAY_SIZE(sc7180_qos_macrotile),
.entries = sc7180_qos_macrotile
-- 
2.7.4

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v3 16/20] drm/msm: always wait for the exclusive fence

2021-07-09 Thread Daniel Vetter
On Fri, Jul 9, 2021 at 10:48 AM Christian König
 wrote:
> Am 08.07.21 um 19:37 schrieb Daniel Vetter:
> > From: Christian König 
> >
> > Drivers also need to to sync to the exclusive fence when
> > a shared one is present.
> >
> > Signed-off-by: Christian König 
> > [danvet: Not that hard to compile-test on arm ...]
> > Signed-off-by: Daniel Vetter 
> > Cc: Rob Clark 
> > Cc: Sean Paul 
> > Cc: linux-arm-...@vger.kernel.org
> > Cc: freedreno@lists.freedesktop.org
>
> Wondering a bit why you have that in this patch set now.
>
> But any objections that we push this now?

Cover letter of the first one version explained that I just wanted to
have all the msm fixes in this series, for completeness. But yeah I
thought I put an r-b on your series for this? There was one patch
where I was unhappy with the docs, but there's a new patch for that
now here.
-Daniel

> Thanks,
> Christian.
>
> > ---
> >   drivers/gpu/drm/msm/msm_gem.c | 16 +++-
> >   1 file changed, 7 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> > index 141178754231..d9c4f1deeafb 100644
> > --- a/drivers/gpu/drm/msm/msm_gem.c
> > +++ b/drivers/gpu/drm/msm/msm_gem.c
> > @@ -812,17 +812,15 @@ int msm_gem_sync_object(struct drm_gem_object *obj,
> >   struct dma_fence *fence;
> >   int i, ret;
> >
> > - fobj = dma_resv_shared_list(obj->resv);
> > - if (!fobj || (fobj->shared_count == 0)) {
> > - fence = dma_resv_excl_fence(obj->resv);
> > - /* don't need to wait on our own fences, since ring is fifo */
> > - if (fence && (fence->context != fctx->context)) {
> > - ret = dma_fence_wait(fence, true);
> > - if (ret)
> > - return ret;
> > - }
> > + fence = dma_resv_excl_fence(obj->resv);
> > + /* don't need to wait on our own fences, since ring is fifo */
> > + if (fence && (fence->context != fctx->context)) {
> > + ret = dma_fence_wait(fence, true);
> > + if (ret)
> > + return ret;
> >   }
> >
> > + fobj = dma_resv_shared_list(obj->resv);
> >   if (!exclusive || !fobj)
> >   return 0;
> >
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v3 16/20] drm/msm: always wait for the exclusive fence

2021-07-09 Thread Christian König

Am 08.07.21 um 19:37 schrieb Daniel Vetter:

From: Christian König 

Drivers also need to to sync to the exclusive fence when
a shared one is present.

Signed-off-by: Christian König 
[danvet: Not that hard to compile-test on arm ...]
Signed-off-by: Daniel Vetter 
Cc: Rob Clark 
Cc: Sean Paul 
Cc: linux-arm-...@vger.kernel.org
Cc: freedreno@lists.freedesktop.org


Wondering a bit why you have that in this patch set now.

But any objections that we push this now?

Thanks,
Christian.


---
  drivers/gpu/drm/msm/msm_gem.c | 16 +++-
  1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 141178754231..d9c4f1deeafb 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -812,17 +812,15 @@ int msm_gem_sync_object(struct drm_gem_object *obj,
struct dma_fence *fence;
int i, ret;
  
-	fobj = dma_resv_shared_list(obj->resv);

-   if (!fobj || (fobj->shared_count == 0)) {
-   fence = dma_resv_excl_fence(obj->resv);
-   /* don't need to wait on our own fences, since ring is fifo */
-   if (fence && (fence->context != fctx->context)) {
-   ret = dma_fence_wait(fence, true);
-   if (ret)
-   return ret;
-   }
+   fence = dma_resv_excl_fence(obj->resv);
+   /* don't need to wait on our own fences, since ring is fifo */
+   if (fence && (fence->context != fctx->context)) {
+   ret = dma_fence_wait(fence, true);
+   if (ret)
+   return ret;
}
  
+	fobj = dma_resv_shared_list(obj->resv);

if (!exclusive || !fobj)
return 0;
  


___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH v2] drm/msm/dp: add logs across DP driver for ease of debugging

2021-07-09 Thread kernel test robot
Hi maitreye,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-tip/drm-tip drm-exynos/exynos-drm-next 
tegra-drm/drm/tegra/for-next linus/master v5.13 next-20210709]
[cannot apply to drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/maitreye/drm-msm-dp-add-logs-across-DP-driver-for-ease-of-debugging/20210709-031606
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm-randconfig-r005-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
8d69635ed9ecf36fd0ca85906bfde17949671cbe)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# 
https://github.com/0day-ci/linux/commit/4600296e3781e89ddd188cadf6f62b587a8f4eb9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
maitreye/drm-msm-dp-add-logs-across-DP-driver-for-ease-of-debugging/20210709-031606
git checkout 4600296e3781e89ddd188cadf6f62b587a8f4eb9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/msm/dp/dp_display.c:499:36: warning: variable 'sink_request' 
>> is uninitialized when used here [-Wuninitialized]
   DRM_DEBUG_DP("sink_request:%d\n", sink_request);
 ^~~~
   include/drm/drm_print.h:525:31: note: expanded from macro 'DRM_DEBUG_DP'
   __drm_dbg(DRM_UT_DP, fmt, ## __VA_ARGS__)
^~~
   drivers/gpu/drm/msm/dp/dp_display.c:492:18: note: initialize the variable 
'sink_request' to silence this warning
   u32 sink_request;
   ^
= 0
   drivers/gpu/drm/msm/dp/dp_display.c:1030:21: warning: variable 'drm' set but 
not used [-Wunused-but-set-variable]
   struct drm_device *drm;
  ^
   2 warnings generated.


vim +/sink_request +499 drivers/gpu/drm/msm/dp/dp_display.c

   488  
   489  static int dp_display_usbpd_attention_cb(struct device *dev)
   490  {
   491  int rc = 0;
   492  u32 sink_request;
   493  struct dp_display_private *dp;
   494  
   495  if (!dev) {
   496  DRM_ERROR("invalid dev\n");
   497  return -EINVAL;
   498  }
 > 499  DRM_DEBUG_DP("sink_request:%d\n", sink_request);
   500  
   501  dp = container_of(g_dp_display,
   502  struct dp_display_private, dp_display);
   503  
   504  /* check for any test request issued by sink */
   505  rc = dp_link_process_request(dp->link);
   506  if (!rc) {
   507  sink_request = dp->link->sink_request;
   508  DRM_DEBUG_DP("hpd_state=%d sink_count=%d\n", 
dp->hpd_state, sink_request);
   509  if (sink_request & DS_PORT_STATUS_CHANGED)
   510  rc = dp_display_handle_port_ststus_changed(dp);
   511  else
   512  rc = dp_display_handle_irq_hpd(dp);
   513  }
   514  
   515  return rc;
   516  }
   517  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno