On 11/11/2020 17:58, Laurent Pinchart wrote: >>>> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c >>>> index 030a8fa140db..1582960f9e90 100644 >>>> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c >>>> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c >>>> @@ -177,27 +177,6 @@ static int dsicm_get_id(struct panel_drv_data *ddata, u8 *id1, u8 *id2, u8 *id3) >>>> return 0; >>>> } >>>> >>>> -static int dsicm_set_update_window(struct panel_drv_data *ddata, >>>> - u16 x, u16 y, u16 w, u16 h) >>>> -{ >>>> - struct mipi_dsi_device *dsi = ddata->dsi; >>>> - int r; >>>> - u16 x1 = x; >>>> - u16 x2 = x + w - 1; >>>> - u16 y1 = y; >>>> - u16 y2 = y + h - 1; >>>> - >>>> - r = mipi_dsi_dcs_set_column_address(dsi, x1, x2); >>>> - if (r < 0) >>>> - return r; >>>> - >>>> - r = mipi_dsi_dcs_set_page_address(dsi, y1, y2); >>>> - if (r < 0) >>>> - return r; >>>> - >>>> - return 0; >>>> -} >>>> - >>> >>> I can't tell whether this is common to all command-mode panels, or if >>> there could be a need for panel-specific update procedures, so I can't >>> really ack this patch. >> >> I can't say either, but all the command mode panels I know need and support this. And, afaik, we >> have only the single cmd mode panel driver which we add in this series. > > Now that I think about it again, isn't it a layering violation ? > Shouldn't the DSI host handle DSI commands transfers, with the panel > driver taking care of specific DSI commands ? Well, the DSI host (the HW) already handles specific DSI commands, as it does the update with DCS Write Start/Continue commands. The update is initiated from omap_crtc, via dssdev->dsi_ops->update(). We could perhaps add a new function to drm_panel_funcs, say, prepare_update, which could then do the above. Although I think the above code is not strictly speaking required, as the panel should remember the column and page address, and as such, they could be set just once at config time. However, I remember debugging issues related to this. And with a quick test, I can see that things break down if I just do the above once in the panel's setup. But things work if I send a DSI NOP instead in the dsi host. So looks to me that either the OMAP DSI or the panel I have need some command transmitted there. It probably has to happen between two frame transfers. There are also other things related to update which I'm not so happy about: 1) the TE gpio irq is handled in the dsi host driver now, even if it's a panel gpio, 2) the dsi host driver snoops the DSI packets sent by the panel, and catches TEAR_ON/OFF packets, and then change internal state accordingly. So... I could change the dsi host driver to only send a NOP, and do the page/column call from the panel's setup. That simplifies the code. Or I could add the new function to drm_panel_funcs, and send a NOP from there. But if this "needs a NOP" is an OMAP DSI feature, the panel driver is not the right place for it. I also think that managing the TE cleanly needs more thought, and probably requires some more interaction between the dsi host and the panel. It might be better to look at both the update callback and the TE at the same time. Tomi -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki