Skip to content

Commit

Permalink
drm: exynos: dsi: Handle proper host initialization
Browse files Browse the repository at this point in the history
Host transfer() in the DSI master will invoke only when the DSI commands
are sent from DSI devices like DSI Panel or DSI bridges and this host
the transfer wouldn't invoke for I2C-based-DSI bridge drivers.

Handling DSI host initialization in transfer calls misses the controller
setup for I2C configured DSI bridges.

This patch updates the DSI host initialization by calling host to init
from bridge pre_enable as the bridge pre_enable API is invoked by core
as it is common across all classes of DSI device drivers.

The host init during pre_enable is conditional and not invoked for Exynos
as existing downstream drm panels and bridges in Exynos are expecting
the host initialization during DSI transfer.

Reviewed-by: Marek Vasut <[email protected]>
Reviewed-by: Frieder Schrempf <[email protected]>
Signed-off-by: Marek Szyprowski <[email protected]>
Signed-off-by: Jagan Teki <[email protected]>
Signed-off-by: Inki Dae <[email protected]>
  • Loading branch information
mszyprow authored and daeinki committed Mar 28, 2023
1 parent 7e9f0d3 commit bb57453
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions drivers/gpu/drm/exynos/exynos_drm_dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ struct exynos_dsi_transfer {
#define DSIM_STATE_CMD_LPM BIT(2)
#define DSIM_STATE_VIDOUT_AVAILABLE BIT(3)

#define exynos_dsi_hw_is_exynos(hw) \
((hw) >= DSIM_TYPE_EXYNOS3250 && (hw) <= DSIM_TYPE_EXYNOS5433)

enum exynos_dsi_type {
DSIM_TYPE_EXYNOS3250,
DSIM_TYPE_EXYNOS4210,
Expand Down Expand Up @@ -1343,6 +1346,9 @@ static int exynos_dsi_init(struct exynos_dsi *dsi)
{
const struct exynos_dsi_driver_data *driver_data = dsi->driver_data;

if (dsi->state & DSIM_STATE_INITIALIZED)
return 0;

exynos_dsi_reset(dsi);
exynos_dsi_enable_irq(dsi);

Expand All @@ -1355,6 +1361,8 @@ static int exynos_dsi_init(struct exynos_dsi *dsi)
exynos_dsi_set_phy_ctrl(dsi);
exynos_dsi_init_link(dsi);

dsi->state |= DSIM_STATE_INITIALIZED;

return 0;
}

Expand Down Expand Up @@ -1410,6 +1418,16 @@ static void exynos_dsi_atomic_pre_enable(struct drm_bridge *bridge,
}

dsi->state |= DSIM_STATE_ENABLED;

/*
* For Exynos-DSIM the downstream bridge, or panel are expecting
* the host initialization during DSI transfer.
*/
if (!exynos_dsi_hw_is_exynos(dsi->plat_data->hw_type)) {
ret = exynos_dsi_init(dsi);
if (ret)
return;
}
}

static void exynos_dsi_atomic_enable(struct drm_bridge *bridge,
Expand Down Expand Up @@ -1601,12 +1619,9 @@ static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host,
if (!(dsi->state & DSIM_STATE_ENABLED))
return -EINVAL;

if (!(dsi->state & DSIM_STATE_INITIALIZED)) {
ret = exynos_dsi_init(dsi);
if (ret)
return ret;
dsi->state |= DSIM_STATE_INITIALIZED;
}
ret = exynos_dsi_init(dsi);
if (ret)
return ret;

ret = mipi_dsi_create_packet(&xfer.packet, msg);
if (ret < 0)
Expand Down

0 comments on commit bb57453

Please sign in to comment.