Commit 9a2985e7 authored by Laurent Pinchart's avatar Laurent Pinchart

fbdev: sh_mobile_lcdc: Handle HDMI/MIPI transmitter device directly

Pass a pointer to the transmitter device through platform data, retrieve
the corresponding sh_mobile_lcdc_entity structure in the probe method
and call the transmitter display_on/off methods directly.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
parent 732bbcc4
...@@ -339,6 +339,11 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch) ...@@ -339,6 +339,11 @@ static void sh_mobile_lcdc_display_on(struct sh_mobile_lcdc_chan *ch)
{ {
struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg; struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
if (ch->tx_dev) {
if (ch->tx_dev->ops->display_on(ch->tx_dev, ch->info) < 0)
return;
}
/* HDMI must be enabled before LCDC configuration */ /* HDMI must be enabled before LCDC configuration */
if (board_cfg->display_on && try_module_get(board_cfg->owner)) { if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
board_cfg->display_on(board_cfg->board_data, ch->info); board_cfg->display_on(board_cfg->board_data, ch->info);
...@@ -354,6 +359,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch) ...@@ -354,6 +359,9 @@ static void sh_mobile_lcdc_display_off(struct sh_mobile_lcdc_chan *ch)
board_cfg->display_off(board_cfg->board_data); board_cfg->display_off(board_cfg->board_data);
module_put(board_cfg->owner); module_put(board_cfg->owner);
} }
if (ch->tx_dev)
ch->tx_dev->ops->display_off(ch->tx_dev);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
...@@ -1490,18 +1498,21 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) ...@@ -1490,18 +1498,21 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
sh_mobile_lcdc_stop(priv); sh_mobile_lcdc_stop(priv);
for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
info = priv->ch[i].info; struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
info = ch->info;
if (!info || !info->device) if (!info || !info->device)
continue; continue;
if (priv->ch[i].sglist) if (ch->tx_dev)
vfree(priv->ch[i].sglist); module_put(ch->cfg.tx_dev->dev.driver->owner);
if (ch->sglist)
vfree(ch->sglist);
if (info->screen_base) if (info->screen_base)
dma_free_coherent(&pdev->dev, info->fix.smem_len, dma_free_coherent(&pdev->dev, info->fix.smem_len,
info->screen_base, info->screen_base, ch->dma_handle);
priv->ch[i].dma_handle);
fb_dealloc_cmap(&info->cmap); fb_dealloc_cmap(&info->cmap);
framebuffer_release(info); framebuffer_release(info);
} }
...@@ -1595,6 +1606,16 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, ...@@ -1595,6 +1606,16 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
info->pseudo_palette = &ch->pseudo_palette; info->pseudo_palette = &ch->pseudo_palette;
info->flags = FBINFO_FLAG_DEFAULT; info->flags = FBINFO_FLAG_DEFAULT;
if (cfg->tx_dev) {
if (!cfg->tx_dev->dev.driver ||
!try_module_get(cfg->tx_dev->dev.driver->owner)) {
dev_warn(priv->dev,
"unable to get transmitter device\n");
return -EINVAL;
}
ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
}
/* Iterate through the modes to validate them and find the highest /* Iterate through the modes to validate them and find the highest
* resolution. * resolution.
*/ */
......
...@@ -41,6 +41,8 @@ struct sh_mobile_lcdc_entity { ...@@ -41,6 +41,8 @@ struct sh_mobile_lcdc_entity {
*/ */
struct sh_mobile_lcdc_chan { struct sh_mobile_lcdc_chan {
struct sh_mobile_lcdc_priv *lcdc; struct sh_mobile_lcdc_priv *lcdc;
struct sh_mobile_lcdc_entity *tx_dev;
unsigned long *reg_offs; unsigned long *reg_offs;
unsigned long ldmt1r_value; unsigned long ldmt1r_value;
unsigned long enabled; /* ME and SE in LDCNT2R */ unsigned long enabled; /* ME and SE in LDCNT2R */
......
...@@ -186,6 +186,8 @@ struct sh_mobile_lcdc_chan_cfg { ...@@ -186,6 +186,8 @@ struct sh_mobile_lcdc_chan_cfg {
struct sh_mobile_lcdc_bl_info bl_info; struct sh_mobile_lcdc_bl_info bl_info;
struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
struct sh_mobile_meram_cfg *meram_cfg; struct sh_mobile_meram_cfg *meram_cfg;
struct platform_device *tx_dev; /* HDMI/DSI transmitter device */
}; };
struct sh_mobile_lcdc_info { struct sh_mobile_lcdc_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment