Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569191 > unrolled thread
| Started by | John Keeping <john@metanate.com> |
|---|---|
| First post | 2017-01-29 15:10 +0100 |
| Last post | 2017-01-31 20:30 +0100 |
| Articles | 20 on this page of 42 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v3 00/24] drm/rockchip: MIPI fixes & improvements John Keeping <john@metanate.com> - 2017-01-29 15:10 +0100
[PATCH v3 08/24] drm/rockchip: dw-mipi-dsi: respect message flags John Keeping <john@metanate.com> - 2017-01-29 15:10 +0100
Re: [PATCH v3 08/24] drm/rockchip: dw-mipi-dsi: respect message flags Sean Paul <seanpaul@chromium.org> - 2017-01-30 19:30 +0100
[PATCH v3 01/24] drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI John Keeping <john@metanate.com> - 2017-01-29 15:10 +0100
Re: [PATCH v3 01/24] drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI Sean Paul <seanpaul@chromium.org> - 2017-01-30 16:40 +0100
[PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands Sean Paul <seanpaul@chromium.org> - 2017-01-30 16:40 +0100
Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands John Keeping <john@metanate.com> - 2017-01-30 19:40 +0100
Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands Sean Paul <seanpaul@chromium.org> - 2017-01-30 21:20 +0100
Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands John Keeping <john@metanate.com> - 2017-01-31 13:50 +0100
Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands Sean Paul <seanpaul@chromium.org> - 2017-01-31 15:50 +0100
[PATCH v3 11/24] drm/rockchip: dw-mipi-dsi: prepare panel after phy init John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 11/24] drm/rockchip: dw-mipi-dsi: prepare panel after phy init Sean Paul <seanpaul@chromium.org> - 2017-01-30 21:20 +0100
[PATCH v3 05/24] drm/rockchip: dw-mipi-dsi: fix generic packet status check John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 05/24] drm/rockchip: dw-mipi-dsi: fix generic packet status check Sean Paul <seanpaul@chromium.org> - 2017-01-30 19:30 +0100
[PATCH v3 07/24] drm/rockchip: dw-mipi-dsi: include bad value in error message John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 07/24] drm/rockchip: dw-mipi-dsi: include bad value in error message Sean Paul <seanpaul@chromium.org> - 2017-01-30 19:10 +0100
[PATCH v3 20/24] drm/rockchip: vop: test for P{H,V}SYNC John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 20/24] drm/rockchip: vop: test for P{H,V}SYNC Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:20 +0100
[PATCH v3 12/24] drm/rockchip: dw-mipi-dsi: allow commands in panel_disable John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 12/24] drm/rockchip: dw-mipi-dsi: allow commands in panel_disable Sean Paul <seanpaul@chromium.org> - 2017-01-30 21:30 +0100
Re: [PATCH v3 12/24] drm/rockchip: dw-mipi-dsi: allow commands in panel_disable John Keeping <john@metanate.com> - 2017-01-31 13:30 +0100
[PATCH v3 13/24] drm/rockchip: dw-mipi-dsi: fix escape clock rate John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 13/24] drm/rockchip: dw-mipi-dsi: fix escape clock rate Sean Paul <seanpaul@chromium.org> - 2017-01-30 21:30 +0100
Re: [PATCH v3 13/24] drm/rockchip: dw-mipi-dsi: fix escape clock rate John Keeping <john@metanate.com> - 2017-02-01 18:30 +0100
[PATCH v3 18/24] drm/rockchip: dw-mipi-dsi: use specific poll helper John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 18/24] drm/rockchip: dw-mipi-dsi: use specific poll helper Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:00 +0100
[PATCH v3 04/24] drm/rockchip: dw-mipi-dsi: fix command header writes John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 04/24] drm/rockchip: dw-mipi-dsi: fix command header writes Sean Paul <seanpaul@chromium.org> - 2017-01-30 17:00 +0100
[PATCH v3 15/24] drm/rockchip: dw-mipi-dsi: configure PHY before enabling John Keeping <john@metanate.com> - 2017-01-29 15:50 +0100
Re: [PATCH v3 15/24] drm/rockchip: dw-mipi-dsi: configure PHY before enabling Sean Paul <seanpaul@chromium.org> - 2017-01-30 21:30 +0100
Re: [PATCH v3 15/24] drm/rockchip: dw-mipi-dsi: configure PHY before enabling John Keeping <john@metanate.com> - 2017-01-31 13:40 +0100
[PATCH v3 19/24] drm/rockchip: dw-mipi-dsi: use positive check for N{H,V}SYNC John Keeping <john@metanate.com> - 2017-01-29 16:20 +0100
Re: [PATCH v3 19/24] drm/rockchip: dw-mipi-dsi: use positive check for N{H, V}SYNC Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:20 +0100
[PATCH v3 17/24] drm/rockchip: dw-mipi-dsi: improve PLL configuration John Keeping <john@metanate.com> - 2017-01-29 16:20 +0100
Re: [PATCH v3 17/24] drm/rockchip: dw-mipi-dsi: improve PLL configuration Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:20 +0100
[PATCH v3 23/24] drm/rockchip: dw-mipi-dsi: add reset control John Keeping <john@metanate.com> - 2017-01-29 16:30 +0100
Re: [PATCH v3 23/24] drm/rockchip: dw-mipi-dsi: add reset control Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:30 +0100
[PATCH v3 03/24] drm/rockchip: dw-mipi-dsi: remove mode_set hook John Keeping <john@metanate.com> - 2017-01-29 16:30 +0100
Re: [PATCH v3 03/24] drm/rockchip: dw-mipi-dsi: remove mode_set hook Sean Paul <seanpaul@chromium.org> - 2017-01-30 16:50 +0100
[PATCH v3 22/24] drm/rockchip: dw-mipi-dsi: support non-burst modes John Keeping <john@metanate.com> - 2017-01-29 16:30 +0100
Re: [PATCH v3 22/24] drm/rockchip: dw-mipi-dsi: support non-burst modes Sean Paul <seanpaul@chromium.org> - 2017-01-31 20:30 +0100
Page 1 of 3 [1] 2 3 Next page →
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:10 +0100 |
| Subject | [PATCH v3 00/24] drm/rockchip: MIPI fixes & improvements |
| Message-ID | <t4Yl3-811-7@gated-at.bofh.it> |
This re-roll mostly just gather up reviewed-by tags, although I have
also wrapped some long lines and squashed together some commits as
suggested by Chris Zhong.
Version 2 was posted here:
https://www.spinics.net/lists/arm-kernel/msg556683.html
John Keeping (24):
drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for
MIPI
drm/rockchip: dw-mipi-dsi: pass mode in where needed
drm/rockchip: dw-mipi-dsi: remove mode_set hook
drm/rockchip: dw-mipi-dsi: fix command header writes
drm/rockchip: dw-mipi-dsi: fix generic packet status check
drm/rockchip: dw-mipi-dsi: avoid out-of-bounds read on tx_buf
drm/rockchip: dw-mipi-dsi: include bad value in error message
drm/rockchip: dw-mipi-dsi: respect message flags
drm/rockchip: dw-mipi-dsi: only request HS clock when required
drm/rockchip: dw-mipi-dsi: don't assume buffer is aligned
drm/rockchip: dw-mipi-dsi: prepare panel after phy init
drm/rockchip: dw-mipi-dsi: allow commands in panel_disable
drm/rockchip: dw-mipi-dsi: fix escape clock rate
drm/rockchip: dw-mipi-dsi: ensure PHY is reset
drm/rockchip: dw-mipi-dsi: configure PHY before enabling
drm/rockchip: dw-mipi-dsi: properly configure PHY timing
drm/rockchip: dw-mipi-dsi: improve PLL configuration
drm/rockchip: dw-mipi-dsi: use specific poll helper
drm/rockchip: dw-mipi-dsi: use positive check for N{H,V}SYNC
drm/rockchip: vop: test for P{H,V}SYNC
drm/rockchip: dw-mipi-dsi: defer probe if panel is not loaded
drm/rockchip: dw-mipi-dsi: support non-burst modes
drm/rockchip: dw-mipi-dsi: add reset control
drm/rockchip: dw-mipi-dsi: support read commands
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 348 +++++++++++++++++++---------
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 +-
2 files changed, 245 insertions(+), 107 deletions(-)
--
2.11.0.197.gb556de5.dirty
[toc] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:10 +0100 |
| Subject | [PATCH v3 08/24] drm/rockchip: dw-mipi-dsi: respect message flags |
| Message-ID | <t4Yl4-811-29@gated-at.bofh.it> |
| In reply to | #1569191 |
Instead of always sending commands in LP mode, respect the
MIPI_DSI_MSG_USE_LPM flag to decide how to send each message. Also
request acks if MIPI_DSI_MSG_REQ_ACK is set.
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
---
v3:
- Add Chris' Reviewed-by
Unchanged in v2
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 92dbc3e56603..15d33c3c8cb7 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -542,6 +542,19 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
return 0;
}
+static void dw_mipi_message_config(struct dw_mipi_dsi *dsi,
+ const struct mipi_dsi_msg *msg)
+{
+ u32 val = 0;
+
+ if (msg->flags & MIPI_DSI_MSG_REQ_ACK)
+ val |= EN_ACK_RQST;
+ if (msg->flags & MIPI_DSI_MSG_USE_LPM)
+ val |= CMD_MODE_ALL_LP;
+
+ dsi_write(dsi, DSI_CMD_MODE_CFG, val);
+}
+
static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val)
{
int ret;
@@ -634,6 +647,8 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
struct dw_mipi_dsi *dsi = host_to_dsi(host);
int ret;
+ dw_mipi_message_config(dsi, msg);
+
switch (msg->type) {
case MIPI_DSI_DCS_SHORT_WRITE:
case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
@@ -745,7 +760,6 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)
{
dsi_write(dsi, DSI_TO_CNT_CFG, HSTX_TO_CNT(1000) | LPRX_TO_CNT(1000));
dsi_write(dsi, DSI_BTA_TO_CNT, 0xd00);
- dsi_write(dsi, DSI_CMD_MODE_CFG, CMD_MODE_ALL_LP);
dsi_write(dsi, DSI_MODE_CFG, ENABLE_CMD_MODE);
}
--
2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 19:30 +0100 |
| Subject | Re: [PATCH v3 08/24] drm/rockchip: dw-mipi-dsi: respect message flags |
| Message-ID | <t5oSf-7ij-37@gated-at.bofh.it> |
| In reply to | #1569192 |
On Sun, Jan 29, 2017 at 01:24:28PM +0000, John Keeping wrote:
> Instead of always sending commands in LP mode, respect the
> MIPI_DSI_MSG_USE_LPM flag to decide how to send each message. Also
> request acks if MIPI_DSI_MSG_REQ_ACK is set.
>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: John Keeping <john@metanate.com>
> Reviewed-by: Chris Zhong <zyw@rock-chips.com>
> ---
> v3:
> - Add Chris' Reviewed-by
> Unchanged in v2
>
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index 92dbc3e56603..15d33c3c8cb7 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -542,6 +542,19 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
> return 0;
> }
>
> +static void dw_mipi_message_config(struct dw_mipi_dsi *dsi,
> + const struct mipi_dsi_msg *msg)
> +{
> + u32 val = 0;
> +
> + if (msg->flags & MIPI_DSI_MSG_REQ_ACK)
> + val |= EN_ACK_RQST;
> + if (msg->flags & MIPI_DSI_MSG_USE_LPM)
> + val |= CMD_MODE_ALL_LP;
> +
> + dsi_write(dsi, DSI_CMD_MODE_CFG, val);
> +}
> +
> static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val)
> {
> int ret;
> @@ -634,6 +647,8 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
> struct dw_mipi_dsi *dsi = host_to_dsi(host);
> int ret;
>
> + dw_mipi_message_config(dsi, msg);
> +
> switch (msg->type) {
> case MIPI_DSI_DCS_SHORT_WRITE:
> case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
> @@ -745,7 +760,6 @@ static void dw_mipi_dsi_command_mode_config(struct dw_mipi_dsi *dsi)
> {
> dsi_write(dsi, DSI_TO_CNT_CFG, HSTX_TO_CNT(1000) | LPRX_TO_CNT(1000));
> dsi_write(dsi, DSI_BTA_TO_CNT, 0xd00);
> - dsi_write(dsi, DSI_CMD_MODE_CFG, CMD_MODE_ALL_LP);
> dsi_write(dsi, DSI_MODE_CFG, ENABLE_CMD_MODE);
> }
>
> --
> 2.11.0.197.gb556de5.dirty
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:10 +0100 |
| Subject | [PATCH v3 01/24] drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI |
| Message-ID | <t4Yl4-811-27@gated-at.bofh.it> |
| In reply to | #1569191 |
With atomic modesetting the hardware will be powered off when the
mode_set function is called. We should configure the hardware in the
enable function, which is the atomic version of "commit" so let's use
the enable hook rather than commit while we're at it.
Signed-off-by: John Keeping <john@metanate.com>
---
v3:
- Squash together with the commit to s/commit/enable/
Unchanged in v2
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 49 +++++++++++++++-------------------
1 file changed, 21 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index d9aa382bb629..bbd992299f73 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -819,34 +819,8 @@ static void dw_mipi_dsi_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *adjusted_mode)
{
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
- int ret;
dsi->mode = adjusted_mode;
-
- ret = dw_mipi_dsi_get_lane_bps(dsi);
- if (ret < 0)
- return;
-
- if (clk_prepare_enable(dsi->pclk)) {
- dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
- return;
- }
-
- dw_mipi_dsi_init(dsi);
- dw_mipi_dsi_dpi_config(dsi, mode);
- dw_mipi_dsi_packet_handler_config(dsi);
- dw_mipi_dsi_video_mode_config(dsi);
- dw_mipi_dsi_video_packet_config(dsi, mode);
- dw_mipi_dsi_command_mode_config(dsi);
- dw_mipi_dsi_line_timer_config(dsi);
- dw_mipi_dsi_vertical_timing_config(dsi);
- dw_mipi_dsi_dphy_timing_config(dsi);
- dw_mipi_dsi_dphy_interface_config(dsi);
- dw_mipi_dsi_clear_err(dsi);
- if (drm_panel_prepare(dsi->panel))
- dev_err(dsi->dev, "failed to prepare panel\n");
-
- clk_disable_unprepare(dsi->pclk);
}
static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder)
@@ -875,17 +849,36 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder)
clk_disable_unprepare(dsi->pclk);
}
-static void dw_mipi_dsi_encoder_commit(struct drm_encoder *encoder)
+static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder)
{
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
int mux = drm_of_encoder_active_endpoint_id(dsi->dev->of_node, encoder);
u32 val;
+ int ret;
+
+ ret = dw_mipi_dsi_get_lane_bps(dsi);
+ if (ret < 0)
+ return;
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
}
+ dw_mipi_dsi_init(dsi);
+ dw_mipi_dsi_dpi_config(dsi, dsi->mode);
+ dw_mipi_dsi_packet_handler_config(dsi);
+ dw_mipi_dsi_video_mode_config(dsi);
+ dw_mipi_dsi_video_packet_config(dsi, dsi->mode);
+ dw_mipi_dsi_command_mode_config(dsi);
+ dw_mipi_dsi_line_timer_config(dsi);
+ dw_mipi_dsi_vertical_timing_config(dsi);
+ dw_mipi_dsi_dphy_timing_config(dsi);
+ dw_mipi_dsi_dphy_interface_config(dsi);
+ dw_mipi_dsi_clear_err(dsi);
+ if (drm_panel_prepare(dsi->panel))
+ dev_err(dsi->dev, "failed to prepare panel\n");
+
dw_mipi_dsi_phy_init(dsi);
dw_mipi_dsi_wait_for_two_frames(dsi);
@@ -933,7 +926,7 @@ dw_mipi_dsi_encoder_atomic_check(struct drm_encoder *encoder,
static struct drm_encoder_helper_funcs
dw_mipi_dsi_encoder_helper_funcs = {
- .commit = dw_mipi_dsi_encoder_commit,
+ .enable = dw_mipi_dsi_encoder_enable,
.mode_set = dw_mipi_dsi_encoder_mode_set,
.disable = dw_mipi_dsi_encoder_disable,
.atomic_check = dw_mipi_dsi_encoder_atomic_check,
--
2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 16:40 +0100 |
| Subject | Re: [PATCH v3 01/24] drm/rockchip: dw-mipi-dsi: don't configure hardware in mode_set for MIPI |
| Message-ID | <t5mdI-5F2-19@gated-at.bofh.it> |
| In reply to | #1569193 |
On Sun, Jan 29, 2017 at 01:24:21PM +0000, John Keeping wrote:
> With atomic modesetting the hardware will be powered off when the
> mode_set function is called. We should configure the hardware in the
> enable function, which is the atomic version of "commit" so let's use
> the enable hook rather than commit while we're at it.
>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> v3:
> - Squash together with the commit to s/commit/enable/
> Unchanged in v2
>
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 49 +++++++++++++++-------------------
> 1 file changed, 21 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index d9aa382bb629..bbd992299f73 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -819,34 +819,8 @@ static void dw_mipi_dsi_encoder_mode_set(struct drm_encoder *encoder,
> struct drm_display_mode *adjusted_mode)
> {
> struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
> - int ret;
>
> dsi->mode = adjusted_mode;
> -
> - ret = dw_mipi_dsi_get_lane_bps(dsi);
> - if (ret < 0)
> - return;
> -
> - if (clk_prepare_enable(dsi->pclk)) {
> - dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
> - return;
> - }
> -
> - dw_mipi_dsi_init(dsi);
> - dw_mipi_dsi_dpi_config(dsi, mode);
> - dw_mipi_dsi_packet_handler_config(dsi);
> - dw_mipi_dsi_video_mode_config(dsi);
> - dw_mipi_dsi_video_packet_config(dsi, mode);
> - dw_mipi_dsi_command_mode_config(dsi);
> - dw_mipi_dsi_line_timer_config(dsi);
> - dw_mipi_dsi_vertical_timing_config(dsi);
> - dw_mipi_dsi_dphy_timing_config(dsi);
> - dw_mipi_dsi_dphy_interface_config(dsi);
> - dw_mipi_dsi_clear_err(dsi);
> - if (drm_panel_prepare(dsi->panel))
> - dev_err(dsi->dev, "failed to prepare panel\n");
> -
> - clk_disable_unprepare(dsi->pclk);
> }
>
> static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder)
> @@ -875,17 +849,36 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder)
> clk_disable_unprepare(dsi->pclk);
> }
>
> -static void dw_mipi_dsi_encoder_commit(struct drm_encoder *encoder)
> +static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder)
> {
> struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
> int mux = drm_of_encoder_active_endpoint_id(dsi->dev->of_node, encoder);
> u32 val;
> + int ret;
> +
> + ret = dw_mipi_dsi_get_lane_bps(dsi);
> + if (ret < 0)
> + return;
>
> if (clk_prepare_enable(dsi->pclk)) {
> dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
> return;
> }
>
> + dw_mipi_dsi_init(dsi);
> + dw_mipi_dsi_dpi_config(dsi, dsi->mode);
> + dw_mipi_dsi_packet_handler_config(dsi);
> + dw_mipi_dsi_video_mode_config(dsi);
> + dw_mipi_dsi_video_packet_config(dsi, dsi->mode);
> + dw_mipi_dsi_command_mode_config(dsi);
> + dw_mipi_dsi_line_timer_config(dsi);
> + dw_mipi_dsi_vertical_timing_config(dsi);
> + dw_mipi_dsi_dphy_timing_config(dsi);
> + dw_mipi_dsi_dphy_interface_config(dsi);
> + dw_mipi_dsi_clear_err(dsi);
> + if (drm_panel_prepare(dsi->panel))
> + dev_err(dsi->dev, "failed to prepare panel\n");
> +
> dw_mipi_dsi_phy_init(dsi);
> dw_mipi_dsi_wait_for_two_frames(dsi);
>
> @@ -933,7 +926,7 @@ dw_mipi_dsi_encoder_atomic_check(struct drm_encoder *encoder,
>
> static struct drm_encoder_helper_funcs
> dw_mipi_dsi_encoder_helper_funcs = {
> - .commit = dw_mipi_dsi_encoder_commit,
> + .enable = dw_mipi_dsi_encoder_enable,
> .mode_set = dw_mipi_dsi_encoder_mode_set,
> .disable = dw_mipi_dsi_encoder_disable,
> .atomic_check = dw_mipi_dsi_encoder_atomic_check,
> --
> 2.11.0.197.gb556de5.dirty
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:50 +0100 |
| Subject | [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands |
| Message-ID | <t4YXL-8ez-1@gated-at.bofh.it> |
| In reply to | #1569191 |
I haven't found any method for getting the length of a response, so this
just uses the requested rx_len
Signed-off-by: John Keeping <john@metanate.com>
---
v3:
- Fix checkpatch warnings
Unchanged in v2
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 56 ++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index cf3ca6b0cbdb..cc58ada75425 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -678,6 +678,56 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
return dw_mipi_dsi_gen_pkt_hdr_write(dsi, hdr_val);
}
+static int dw_mipi_dsi_dcs_read(struct dw_mipi_dsi *dsi,
+ const struct mipi_dsi_msg *msg)
+{
+ const u8 *tx_buf = msg->tx_buf;
+ u8 *rx_buf = msg->rx_buf;
+ size_t i;
+ int ret, val;
+
+ dsi_write(dsi, DSI_PCKHDL_CFG, EN_CRC_RX | EN_ECC_RX | EN_BTA);
+ dsi_write(dsi, DSI_GEN_HDR,
+ GEN_HDATA(tx_buf[0]) | GEN_HTYPE(msg->type));
+
+ ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
+ val, !(val & GEN_RD_CMD_BUSY), 1000,
+ CMD_PKT_STATUS_TIMEOUT_US);
+ if (ret < 0) {
+ dev_err(dsi->dev, "failed to read command response\n");
+ return ret;
+ }
+
+ for (i = 0; i < msg->rx_len;) {
+ u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
+
+ while (i < msg->rx_len) {
+ rx_buf[i] = pld & 0xff;
+ pld >>= 8;
+ i++;
+ }
+ }
+
+ return msg->rx_len;
+}
+
+static int dw_mipi_dsi_set_max_return_packet_size(struct dw_mipi_dsi *dsi,
+ size_t len)
+{
+ u8 val[] = { len & 0xff, (len >> 8) & 0xff };
+ struct mipi_dsi_msg msg = {
+ .channel = dsi->channel,
+ .type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
+ .tx_buf = val,
+ .tx_len = 2,
+ };
+
+ if (len > 0xffff)
+ return -EINVAL;
+
+ return dw_mipi_dsi_dcs_short_write(dsi, &msg);
+}
+
static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
const struct mipi_dsi_msg *msg)
{
@@ -695,6 +745,12 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
case MIPI_DSI_DCS_LONG_WRITE:
ret = dw_mipi_dsi_dcs_long_write(dsi, msg);
break;
+ case MIPI_DSI_DCS_READ:
+ ret = dw_mipi_dsi_set_max_return_packet_size(dsi, msg->rx_len);
+ if (ret < 0)
+ return ret;
+ ret = dw_mipi_dsi_dcs_read(dsi, msg);
+ break;
default:
dev_err(dsi->dev, "unsupported message type 0x%02x\n",
msg->type);
--
2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 16:40 +0100 |
| Subject | Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands |
| Message-ID | <t5mdI-5F2-21@gated-at.bofh.it> |
| In reply to | #1569195 |
On Sun, Jan 29, 2017 at 01:24:44PM +0000, John Keeping wrote:
> I haven't found any method for getting the length of a response, so this
> just uses the requested rx_len
>
> Signed-off-by: John Keeping <john@metanate.com>
> ---
> v3:
> - Fix checkpatch warnings
> Unchanged in v2
>
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 56 ++++++++++++++++++++++++++++++++++
> 1 file changed, 56 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index cf3ca6b0cbdb..cc58ada75425 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -678,6 +678,56 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
> return dw_mipi_dsi_gen_pkt_hdr_write(dsi, hdr_val);
> }
>
> +static int dw_mipi_dsi_dcs_read(struct dw_mipi_dsi *dsi,
> + const struct mipi_dsi_msg *msg)
> +{
> + const u8 *tx_buf = msg->tx_buf;
> + u8 *rx_buf = msg->rx_buf;
> + size_t i;
> + int ret, val;
> +
> + dsi_write(dsi, DSI_PCKHDL_CFG, EN_CRC_RX | EN_ECC_RX | EN_BTA);
> + dsi_write(dsi, DSI_GEN_HDR,
> + GEN_HDATA(tx_buf[0]) | GEN_HTYPE(msg->type));
> +
> + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
> + val, !(val & GEN_RD_CMD_BUSY), 1000,
> + CMD_PKT_STATUS_TIMEOUT_US);
> + if (ret < 0) {
> + dev_err(dsi->dev, "failed to read command response\n");
> + return ret;
> + }
> +
> + for (i = 0; i < msg->rx_len;) {
> + u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> +
> + while (i < msg->rx_len) {
> + rx_buf[i] = pld & 0xff;
> + pld >>= 8;
> + i++;
> + }
> + }
AFAICT, the outer for loop just initializes i and ensures msg->rx_len is
non-zero?
I think the following would be easier to read (and safe against the case where
msg->rx_len > sizeof(pld) (even though this shouldn't happen according to DCS
spec)).
if (msg->rx_len > 0) {
u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
memcpy(rx_buf, &pld, MIN(msg->rx_len, sizeof(pld));
}
> +
> + return msg->rx_len;
> +}
> +
> +static int dw_mipi_dsi_set_max_return_packet_size(struct dw_mipi_dsi *dsi,
> + size_t len)
> +{
> + u8 val[] = { len & 0xff, (len >> 8) & 0xff };
> + struct mipi_dsi_msg msg = {
> + .channel = dsi->channel,
> + .type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
> + .tx_buf = val,
> + .tx_len = 2,
> + };
> +
> + if (len > 0xffff)
> + return -EINVAL;
> +
> + return dw_mipi_dsi_dcs_short_write(dsi, &msg);
> +}
> +
> static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
> const struct mipi_dsi_msg *msg)
> {
> @@ -695,6 +745,12 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host,
> case MIPI_DSI_DCS_LONG_WRITE:
> ret = dw_mipi_dsi_dcs_long_write(dsi, msg);
> break;
> + case MIPI_DSI_DCS_READ:
> + ret = dw_mipi_dsi_set_max_return_packet_size(dsi, msg->rx_len);
> + if (ret < 0)
> + return ret;
> + ret = dw_mipi_dsi_dcs_read(dsi, msg);
> + break;
> default:
> dev_err(dsi->dev, "unsupported message type 0x%02x\n",
> msg->type);
> --
> 2.11.0.197.gb556de5.dirty
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-30 19:40 +0100 |
| Subject | Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands |
| Message-ID | <t5p1T-7lw-21@gated-at.bofh.it> |
| In reply to | #1569842 |
On Mon, 30 Jan 2017 10:26:11 -0500, Sean Paul wrote:
> On Sun, Jan 29, 2017 at 01:24:44PM +0000, John Keeping wrote:
> > I haven't found any method for getting the length of a response, so this
> > just uses the requested rx_len
> >
> > Signed-off-by: John Keeping <john@metanate.com>
> > ---
> > v3:
> > - Fix checkpatch warnings
> > Unchanged in v2
> >
> > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 56 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 56 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > index cf3ca6b0cbdb..cc58ada75425 100644
> > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > @@ -678,6 +678,56 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
> > return dw_mipi_dsi_gen_pkt_hdr_write(dsi, hdr_val);
> > }
> >
> > +static int dw_mipi_dsi_dcs_read(struct dw_mipi_dsi *dsi,
> > + const struct mipi_dsi_msg *msg)
> > +{
> > + const u8 *tx_buf = msg->tx_buf;
> > + u8 *rx_buf = msg->rx_buf;
> > + size_t i;
> > + int ret, val;
> > +
> > + dsi_write(dsi, DSI_PCKHDL_CFG, EN_CRC_RX | EN_ECC_RX | EN_BTA);
> > + dsi_write(dsi, DSI_GEN_HDR,
> > + GEN_HDATA(tx_buf[0]) | GEN_HTYPE(msg->type));
> > +
> > + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
> > + val, !(val & GEN_RD_CMD_BUSY), 1000,
> > + CMD_PKT_STATUS_TIMEOUT_US);
> > + if (ret < 0) {
> > + dev_err(dsi->dev, "failed to read command response\n");
> > + return ret;
> > + }
> > +
> > + for (i = 0; i < msg->rx_len;) {
> > + u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > +
> > + while (i < msg->rx_len) {
> > + rx_buf[i] = pld & 0xff;
> > + pld >>= 8;
> > + i++;
> > + }
> > + }
>
> AFAICT, the outer for loop just initializes i and ensures msg->rx_len is
> non-zero?
>
> I think the following would be easier to read (and safe against the case where
> msg->rx_len > sizeof(pld) (even though this shouldn't happen according to DCS
> spec)).
>
> if (msg->rx_len > 0) {
> u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> memcpy(rx_buf, &pld, MIN(msg->rx_len, sizeof(pld));
> }
I think the intent was to handle rx_len > 4, but the patch is obvously
completely broken regarding that. As far as I can tell, rx_len is
limited by the maximum return packet size which can be any value up to
the maximum size of a long packet, so we may need to read from the FIFO
multiple times.
The loop should be something like this:
for (i = 0; i < msg->rx_len;) {
u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
int j;
for (j = 0; j < 4 && i < msg->rx_len; i++, j++) {
rx_buf[i] = pld & 0xff;
pld >>= 8;
}
}
I have successfully read 5 bytes from a DSI display using this code, but
I'm tempted to just drop this patch since I only used it for debugging
while bringing up a new panel.
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 21:20 +0100 |
| Subject | Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands |
| Message-ID | <t5qAG-8qt-5@gated-at.bofh.it> |
| In reply to | #1570000 |
On Mon, Jan 30, 2017 at 06:14:27PM +0000, John Keeping wrote:
> On Mon, 30 Jan 2017 10:26:11 -0500, Sean Paul wrote:
>
> > On Sun, Jan 29, 2017 at 01:24:44PM +0000, John Keeping wrote:
> > > I haven't found any method for getting the length of a response, so this
> > > just uses the requested rx_len
> > >
> > > Signed-off-by: John Keeping <john@metanate.com>
> > > ---
> > > v3:
> > > - Fix checkpatch warnings
> > > Unchanged in v2
> > >
> > > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 56 ++++++++++++++++++++++++++++++++++
> > > 1 file changed, 56 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > index cf3ca6b0cbdb..cc58ada75425 100644
> > > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > @@ -678,6 +678,56 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
> > > return dw_mipi_dsi_gen_pkt_hdr_write(dsi, hdr_val);
> > > }
> > >
> > > +static int dw_mipi_dsi_dcs_read(struct dw_mipi_dsi *dsi,
> > > + const struct mipi_dsi_msg *msg)
> > > +{
> > > + const u8 *tx_buf = msg->tx_buf;
> > > + u8 *rx_buf = msg->rx_buf;
> > > + size_t i;
> > > + int ret, val;
> > > +
> > > + dsi_write(dsi, DSI_PCKHDL_CFG, EN_CRC_RX | EN_ECC_RX | EN_BTA);
> > > + dsi_write(dsi, DSI_GEN_HDR,
> > > + GEN_HDATA(tx_buf[0]) | GEN_HTYPE(msg->type));
> > > +
> > > + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
> > > + val, !(val & GEN_RD_CMD_BUSY), 1000,
> > > + CMD_PKT_STATUS_TIMEOUT_US);
> > > + if (ret < 0) {
> > > + dev_err(dsi->dev, "failed to read command response\n");
> > > + return ret;
> > > + }
> > > +
> > > + for (i = 0; i < msg->rx_len;) {
> > > + u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > > +
> > > + while (i < msg->rx_len) {
> > > + rx_buf[i] = pld & 0xff;
> > > + pld >>= 8;
> > > + i++;
> > > + }
> > > + }
> >
> > AFAICT, the outer for loop just initializes i and ensures msg->rx_len is
> > non-zero?
> >
> > I think the following would be easier to read (and safe against the case where
> > msg->rx_len > sizeof(pld) (even though this shouldn't happen according to DCS
> > spec)).
> >
> > if (msg->rx_len > 0) {
> > u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > memcpy(rx_buf, &pld, MIN(msg->rx_len, sizeof(pld));
> > }
>
> I think the intent was to handle rx_len > 4, but the patch is obvously
> completely broken regarding that. As far as I can tell, rx_len is
> limited by the maximum return packet size which can be any value up to
> the maximum size of a long packet, so we may need to read from the FIFO
> multiple times.
>
> The loop should be something like this:
>
> for (i = 0; i < msg->rx_len;) {
> u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> int j;
>
> for (j = 0; j < 4 && i < msg->rx_len; i++, j++) {
> rx_buf[i] = pld & 0xff;
> pld >>= 8;
> }
> }
Short packets should never exceed 32 bits, so I don't think you need to add the
nested loop.
Sean
>
> I have successfully read 5 bytes from a DSI display using this code, but
> I'm tempted to just drop this patch since I only used it for debugging
> while bringing up a new panel.
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-31 13:50 +0100 |
| Subject | Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands |
| Message-ID | <t5G2J-Kr-9@gated-at.bofh.it> |
| In reply to | #1570087 |
On Mon, 30 Jan 2017 15:16:09 -0500, Sean Paul wrote:
> On Mon, Jan 30, 2017 at 06:14:27PM +0000, John Keeping wrote:
> > On Mon, 30 Jan 2017 10:26:11 -0500, Sean Paul wrote:
> >
> > > On Sun, Jan 29, 2017 at 01:24:44PM +0000, John Keeping wrote:
> > > > I haven't found any method for getting the length of a response, so this
> > > > just uses the requested rx_len
> > > >
> > > > Signed-off-by: John Keeping <john@metanate.com>
> > > > ---
> > > > v3:
> > > > - Fix checkpatch warnings
> > > > Unchanged in v2
> > > >
> > > > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 56 ++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 56 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > > index cf3ca6b0cbdb..cc58ada75425 100644
> > > > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > > @@ -678,6 +678,56 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
> > > > return dw_mipi_dsi_gen_pkt_hdr_write(dsi, hdr_val);
> > > > }
> > > >
> > > > +static int dw_mipi_dsi_dcs_read(struct dw_mipi_dsi *dsi,
> > > > + const struct mipi_dsi_msg *msg)
> > > > +{
> > > > + const u8 *tx_buf = msg->tx_buf;
> > > > + u8 *rx_buf = msg->rx_buf;
> > > > + size_t i;
> > > > + int ret, val;
> > > > +
> > > > + dsi_write(dsi, DSI_PCKHDL_CFG, EN_CRC_RX | EN_ECC_RX | EN_BTA);
> > > > + dsi_write(dsi, DSI_GEN_HDR,
> > > > + GEN_HDATA(tx_buf[0]) | GEN_HTYPE(msg->type));
> > > > +
> > > > + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
> > > > + val, !(val & GEN_RD_CMD_BUSY), 1000,
> > > > + CMD_PKT_STATUS_TIMEOUT_US);
> > > > + if (ret < 0) {
> > > > + dev_err(dsi->dev, "failed to read command response\n");
> > > > + return ret;
> > > > + }
> > > > +
> > > > + for (i = 0; i < msg->rx_len;) {
> > > > + u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > > > +
> > > > + while (i < msg->rx_len) {
> > > > + rx_buf[i] = pld & 0xff;
> > > > + pld >>= 8;
> > > > + i++;
> > > > + }
> > > > + }
> > >
> > > AFAICT, the outer for loop just initializes i and ensures msg->rx_len is
> > > non-zero?
> > >
> > > I think the following would be easier to read (and safe against the case where
> > > msg->rx_len > sizeof(pld) (even though this shouldn't happen according to DCS
> > > spec)).
> > >
> > > if (msg->rx_len > 0) {
> > > u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > > memcpy(rx_buf, &pld, MIN(msg->rx_len, sizeof(pld));
> > > }
> >
> > I think the intent was to handle rx_len > 4, but the patch is obvously
> > completely broken regarding that. As far as I can tell, rx_len is
> > limited by the maximum return packet size which can be any value up to
> > the maximum size of a long packet, so we may need to read from the FIFO
> > multiple times.
> >
> > The loop should be something like this:
> >
> > for (i = 0; i < msg->rx_len;) {
> > u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > int j;
> >
> > for (j = 0; j < 4 && i < msg->rx_len; i++, j++) {
> > rx_buf[i] = pld & 0xff;
> > pld >>= 8;
> > }
> > }
>
> Short packets should never exceed 32 bits, so I don't think you need to add the
> nested loop.
The read response is not restricted to a short packet. I have a panel
that documents a read request that returns up to 64KiB, admittedly with
a continuation command and the panels I have seem to only be programmed
to return 5 bytes of meaningful data, but they do return all of those
bytes in a single read response.
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-31 15:50 +0100 |
| Subject | Re: [PATCH v3 24/24] drm/rockchip: dw-mipi-dsi: support read commands |
| Message-ID | <t5HUS-1S1-27@gated-at.bofh.it> |
| In reply to | #1570690 |
On Tue, Jan 31, 2017 at 12:41:47PM +0000, John Keeping wrote:
> On Mon, 30 Jan 2017 15:16:09 -0500, Sean Paul wrote:
>
> > On Mon, Jan 30, 2017 at 06:14:27PM +0000, John Keeping wrote:
> > > On Mon, 30 Jan 2017 10:26:11 -0500, Sean Paul wrote:
> > >
> > > > On Sun, Jan 29, 2017 at 01:24:44PM +0000, John Keeping wrote:
> > > > > I haven't found any method for getting the length of a response, so this
> > > > > just uses the requested rx_len
> > > > >
> > > > > Signed-off-by: John Keeping <john@metanate.com>
> > > > > ---
> > > > > v3:
> > > > > - Fix checkpatch warnings
> > > > > Unchanged in v2
> > > > >
> > > > > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 56 ++++++++++++++++++++++++++++++++++
> > > > > 1 file changed, 56 insertions(+)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > > > index cf3ca6b0cbdb..cc58ada75425 100644
> > > > > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > > > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> > > > > @@ -678,6 +678,56 @@ static int dw_mipi_dsi_dcs_long_write(struct dw_mipi_dsi *dsi,
> > > > > return dw_mipi_dsi_gen_pkt_hdr_write(dsi, hdr_val);
> > > > > }
> > > > >
> > > > > +static int dw_mipi_dsi_dcs_read(struct dw_mipi_dsi *dsi,
> > > > > + const struct mipi_dsi_msg *msg)
> > > > > +{
> > > > > + const u8 *tx_buf = msg->tx_buf;
> > > > > + u8 *rx_buf = msg->rx_buf;
> > > > > + size_t i;
> > > > > + int ret, val;
> > > > > +
> > > > > + dsi_write(dsi, DSI_PCKHDL_CFG, EN_CRC_RX | EN_ECC_RX | EN_BTA);
> > > > > + dsi_write(dsi, DSI_GEN_HDR,
> > > > > + GEN_HDATA(tx_buf[0]) | GEN_HTYPE(msg->type));
> > > > > +
> > > > > + ret = readl_poll_timeout(dsi->base + DSI_CMD_PKT_STATUS,
> > > > > + val, !(val & GEN_RD_CMD_BUSY), 1000,
> > > > > + CMD_PKT_STATUS_TIMEOUT_US);
> > > > > + if (ret < 0) {
> > > > > + dev_err(dsi->dev, "failed to read command response\n");
> > > > > + return ret;
> > > > > + }
> > > > > +
> > > > > + for (i = 0; i < msg->rx_len;) {
> > > > > + u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > > > > +
> > > > > + while (i < msg->rx_len) {
> > > > > + rx_buf[i] = pld & 0xff;
> > > > > + pld >>= 8;
> > > > > + i++;
> > > > > + }
> > > > > + }
> > > >
> > > > AFAICT, the outer for loop just initializes i and ensures msg->rx_len is
> > > > non-zero?
> > > >
> > > > I think the following would be easier to read (and safe against the case where
> > > > msg->rx_len > sizeof(pld) (even though this shouldn't happen according to DCS
> > > > spec)).
> > > >
> > > > if (msg->rx_len > 0) {
> > > > u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > > > memcpy(rx_buf, &pld, MIN(msg->rx_len, sizeof(pld));
> > > > }
> > >
> > > I think the intent was to handle rx_len > 4, but the patch is obvously
> > > completely broken regarding that. As far as I can tell, rx_len is
> > > limited by the maximum return packet size which can be any value up to
> > > the maximum size of a long packet, so we may need to read from the FIFO
> > > multiple times.
> > >
> > > The loop should be something like this:
> > >
> > > for (i = 0; i < msg->rx_len;) {
> > > u32 pld = dsi_read(dsi, DSI_GEN_PLD_DATA);
> > > int j;
> > >
> > > for (j = 0; j < 4 && i < msg->rx_len; i++, j++) {
> > > rx_buf[i] = pld & 0xff;
> > > pld >>= 8;
> > > }
> > > }
> >
> > Short packets should never exceed 32 bits, so I don't think you need to add the
> > nested loop.
>
> The read response is not restricted to a short packet. I have a panel
> that documents a read request that returns up to 64KiB, admittedly with
> a continuation command and the panels I have seem to only be programmed
> to return 5 bytes of meaningful data, but they do return all of those
> bytes in a single read response.
Ah, apologies for the misunderstanding. In that case, I think you can get away
with replacing the inner loop in your snippet with a memcpy and call it a day.
Sean
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:50 +0100 |
| Subject | [PATCH v3 11/24] drm/rockchip: dw-mipi-dsi: prepare panel after phy init |
| Message-ID | <t4YXL-8ez-5@gated-at.bofh.it> |
| In reply to | #1569191 |
Some panels need to be configured with commands sent over the MIPI link, which they will do in the prepare hook. Call this after the PHY has been initialized so that we are able to send commands to the panel. Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Chris Zhong <zyw@rock-chips.com> --- v3: - Add Chris' Reviewed-by Unchanged in v2 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index ddbc037e7ced..7ada6d8ed143 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -896,12 +896,14 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) dw_mipi_dsi_dphy_timing_config(dsi); dw_mipi_dsi_dphy_interface_config(dsi); dw_mipi_dsi_clear_err(dsi); - if (drm_panel_prepare(dsi->panel)) - dev_err(dsi->dev, "failed to prepare panel\n"); dw_mipi_dsi_phy_init(dsi); dw_mipi_dsi_wait_for_two_frames(mode); + dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE); + if (drm_panel_prepare(dsi->panel)) + dev_err(dsi->dev, "failed to prepare panel\n"); + dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE); drm_panel_enable(dsi->panel); -- 2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 21:20 +0100 |
| Subject | Re: [PATCH v3 11/24] drm/rockchip: dw-mipi-dsi: prepare panel after phy init |
| Message-ID | <t5qAG-8qt-19@gated-at.bofh.it> |
| In reply to | #1569196 |
On Sun, Jan 29, 2017 at 01:24:31PM +0000, John Keeping wrote: > Some panels need to be configured with commands sent over the MIPI link, > which they will do in the prepare hook. Call this after the PHY has > been initialized so that we are able to send commands to the panel. > Reviewed-by: Sean Paul <seanpaul@chromium.org> > Signed-off-by: John Keeping <john@metanate.com> > Reviewed-by: Chris Zhong <zyw@rock-chips.com> > --- > v3: > - Add Chris' Reviewed-by > Unchanged in v2 > > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > index ddbc037e7ced..7ada6d8ed143 100644 > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > @@ -896,12 +896,14 @@ static void dw_mipi_dsi_encoder_enable(struct drm_encoder *encoder) > dw_mipi_dsi_dphy_timing_config(dsi); > dw_mipi_dsi_dphy_interface_config(dsi); > dw_mipi_dsi_clear_err(dsi); > - if (drm_panel_prepare(dsi->panel)) > - dev_err(dsi->dev, "failed to prepare panel\n"); > > dw_mipi_dsi_phy_init(dsi); > dw_mipi_dsi_wait_for_two_frames(mode); > > + dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE); > + if (drm_panel_prepare(dsi->panel)) > + dev_err(dsi->dev, "failed to prepare panel\n"); > + > dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE); > drm_panel_enable(dsi->panel); > > -- > 2.11.0.197.gb556de5.dirty > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:50 +0100 |
| Subject | [PATCH v3 05/24] drm/rockchip: dw-mipi-dsi: fix generic packet status check |
| Message-ID | <t4YXL-8ez-9@gated-at.bofh.it> |
| In reply to | #1569191 |
We want to check that both the GEN_CMD_EMPTY and GEN_PLD_W_EMPTY bits
are set so we can't just check "val & mask" because that will be true if
either bit is set.
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
---
v3:
- Add Chris' Reviewed-by
Unchanged in v2
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 4cbbbcb619b7..4be1ff3a42bb 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -545,7 +545,7 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val)
{
int ret;
- u32 val;
+ u32 val, mask;
ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
val, !(val & GEN_CMD_FULL), 1000,
@@ -557,8 +557,9 @@ static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val)
dsi_write(dsi, DSI_GEN_HDR, hdr_val);
+ mask = GEN_CMD_EMPTY | GEN_PLD_W_EMPTY;
ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
- val, val & (GEN_CMD_EMPTY | GEN_PLD_W_EMPTY),
+ val, (val & mask) == mask,
1000, CMD_PKT_STATUS_TIMEOUT_US);
if (ret < 0) {
dev_err(dsi->dev, "failed to write command FIFO\n");
--
2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 19:30 +0100 |
| Subject | Re: [PATCH v3 05/24] drm/rockchip: dw-mipi-dsi: fix generic packet status check |
| Message-ID | <t5oSe-7ij-25@gated-at.bofh.it> |
| In reply to | #1569197 |
On Sun, Jan 29, 2017 at 01:24:25PM +0000, John Keeping wrote:
> We want to check that both the GEN_CMD_EMPTY and GEN_PLD_W_EMPTY bits
> are set so we can't just check "val & mask" because that will be true if
> either bit is set.
>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: John Keeping <john@metanate.com>
> Reviewed-by: Chris Zhong <zyw@rock-chips.com>
> ---
> v3:
> - Add Chris' Reviewed-by
> Unchanged in v2
>
> drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> index 4cbbbcb619b7..4be1ff3a42bb 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -545,7 +545,7 @@ static int dw_mipi_dsi_host_detach(struct mipi_dsi_host *host,
> static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val)
> {
> int ret;
> - u32 val;
> + u32 val, mask;
>
> ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
> val, !(val & GEN_CMD_FULL), 1000,
> @@ -557,8 +557,9 @@ static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 hdr_val)
>
> dsi_write(dsi, DSI_GEN_HDR, hdr_val);
>
> + mask = GEN_CMD_EMPTY | GEN_PLD_W_EMPTY;
> ret = readx_poll_timeout(readl, dsi->base + DSI_CMD_PKT_STATUS,
> - val, val & (GEN_CMD_EMPTY | GEN_PLD_W_EMPTY),
> + val, (val & mask) == mask,
> 1000, CMD_PKT_STATUS_TIMEOUT_US);
> if (ret < 0) {
> dev_err(dsi->dev, "failed to write command FIFO\n");
> --
> 2.11.0.197.gb556de5.dirty
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:50 +0100 |
| Subject | [PATCH v3 07/24] drm/rockchip: dw-mipi-dsi: include bad value in error message |
| Message-ID | <t4YXL-8ez-11@gated-at.bofh.it> |
| In reply to | #1569191 |
As an aid to debugging. Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Chris Zhong <zyw@rock-chips.com> --- v3: - Add Chris' Reviewed-by Unchanged in v2 drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 2e6ad4591ebf..92dbc3e56603 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -644,7 +644,8 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, ret = dw_mipi_dsi_dcs_long_write(dsi, msg); break; default: - dev_err(dsi->dev, "unsupported message type\n"); + dev_err(dsi->dev, "unsupported message type 0x%02x\n", + msg->type); ret = -EINVAL; } -- 2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-30 19:10 +0100 |
| Subject | Re: [PATCH v3 07/24] drm/rockchip: dw-mipi-dsi: include bad value in error message |
| Message-ID | <t5oyT-7bL-59@gated-at.bofh.it> |
| In reply to | #1569198 |
On Sun, Jan 29, 2017 at 01:24:27PM +0000, John Keeping wrote: > As an aid to debugging. Reviewed-by: Sean Paul <seanpaul@chromium.org> > > Signed-off-by: John Keeping <john@metanate.com> > Reviewed-by: Chris Zhong <zyw@rock-chips.com> > --- > v3: > - Add Chris' Reviewed-by > Unchanged in v2 > > drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > index 2e6ad4591ebf..92dbc3e56603 100644 > --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c > @@ -644,7 +644,8 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, > ret = dw_mipi_dsi_dcs_long_write(dsi, msg); > break; > default: > - dev_err(dsi->dev, "unsupported message type\n"); > + dev_err(dsi->dev, "unsupported message type 0x%02x\n", > + msg->type); > ret = -EINVAL; > } > > -- > 2.11.0.197.gb556de5.dirty > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:50 +0100 |
| Subject | [PATCH v3 20/24] drm/rockchip: vop: test for P{H,V}SYNC |
| Message-ID | <t4YXM-8ez-23@gated-at.bofh.it> |
| In reply to | #1569191 |
When connected to the MIPI DSI output, we need to use N{H,V}SYNC for the
internal connection but these flags are meaningless for DSI panels.
Switch the test so that we do not set the P{H,V}SYNC bits unless the
mode requires it.
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Mark Yao <mark.yao@rock-chips.com>
---
v3:
- Add Mark's Reviewed-by
Unchanged in v2
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c7eba305c488..67aefc6d4e9a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -933,8 +933,8 @@ static void vop_crtc_enable(struct drm_crtc *crtc)
}
pin_pol = 0x8;
- pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ? 0 : 1;
- pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ? 0 : (1 << 1);
+ pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
+ pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) ? (1 << 1) : 0;
VOP_CTRL_SET(vop, pin_pol, pin_pol);
switch (s->output_type) {
--
2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
| From | Sean Paul <seanpaul@chromium.org> |
|---|---|
| Date | 2017-01-31 20:20 +0100 |
| Subject | Re: [PATCH v3 20/24] drm/rockchip: vop: test for P{H,V}SYNC |
| Message-ID | <t5M8a-4ww-23@gated-at.bofh.it> |
| In reply to | #1569199 |
On Sun, Jan 29, 2017 at 01:24:40PM +0000, John Keeping wrote:
> When connected to the MIPI DSI output, we need to use N{H,V}SYNC for the
> internal connection but these flags are meaningless for DSI panels.
> Switch the test so that we do not set the P{H,V}SYNC bits unless the
> mode requires it.
>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: John Keeping <john@metanate.com>
> Reviewed-by: Mark Yao <mark.yao@rock-chips.com>
> ---
> v3:
> - Add Mark's Reviewed-by
> Unchanged in v2
>
> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index c7eba305c488..67aefc6d4e9a 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -933,8 +933,8 @@ static void vop_crtc_enable(struct drm_crtc *crtc)
> }
>
> pin_pol = 0x8;
> - pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ? 0 : 1;
> - pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ? 0 : (1 << 1);
> + pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
> + pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) ? (1 << 1) : 0;
> VOP_CTRL_SET(vop, pin_pol, pin_pol);
>
> switch (s->output_type) {
> --
> 2.11.0.197.gb556de5.dirty
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
[toc] | [prev] | [next] | [standalone]
| From | John Keeping <john@metanate.com> |
|---|---|
| Date | 2017-01-29 15:50 +0100 |
| Subject | [PATCH v3 12/24] drm/rockchip: dw-mipi-dsi: allow commands in panel_disable |
| Message-ID | <t4YXL-8ez-13@gated-at.bofh.it> |
| In reply to | #1569191 |
Panel drivers may want to sent commands during the disable function, for
example MIPI_DCS_SET_DISPLAY_OFF before the video signal ends. In order
to send commands we need to write to registers, so pclk must be enabled.
While changing this, remove the unnecessary code after the panel
unprepare call which seems to be a workaround for a specific panel and
thus belongs in the panel driver.
Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Chris Zhong <zyw@rock-chips.com>
---
v3:
- Add Chris' Reviewed-by
Unchanged in v2
drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
index 7ada6d8ed143..290282e86d16 100644
--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
@@ -846,24 +846,16 @@ static void dw_mipi_dsi_encoder_disable(struct drm_encoder *encoder)
{
struct dw_mipi_dsi *dsi = encoder_to_dsi(encoder);
- drm_panel_disable(dsi->panel);
-
if (clk_prepare_enable(dsi->pclk)) {
dev_err(dsi->dev, "%s: Failed to enable pclk\n", __func__);
return;
}
+ drm_panel_disable(dsi->panel);
+
dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE);
drm_panel_unprepare(dsi->panel);
- dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_VID_MODE);
- /*
- * This is necessary to make sure the peripheral will be driven
- * normally when the display is enabled again later.
- */
- msleep(120);
-
- dw_mipi_dsi_set_mode(dsi, DW_MIPI_DSI_CMD_MODE);
dw_mipi_dsi_disable(dsi);
clk_disable_unprepare(dsi->pclk);
}
--
2.11.0.197.gb556de5.dirty
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.kernel
csiph-web