Re: [PATCH v3 30/56] drm/omap: dsi: move panel refresh function to host

Sebastian Reichel
2020-11-17T10:04:38Z

[-- Attachment #1: Type: text/plain, Size: 5048 bytes --]

Hi,

On Mon, Nov 16, 2020 at 11:22:53AM +0200, Laurent Pinchart wrote:
> On Thu, Nov 12, 2020 at 10:08:21AM +0200, Tomi Valkeinen wrote:
> > 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.
>
> I'm fine addressing both issues on top of this series. My concern is
> that an incorrect split of responsibilities between the panel driver and
> the DSI host driver will result in panel drivers being compatible only
> with specific DSI hosts. It's a difficult issue, but I think we need to
> extend the DSI API to handle this cleanly.

Just some background info, since I looked into this while moving
the driver to the common drm/dsi infrastructure (I used existing
DSI drivers as reference):

IIRC most DSI host drivers do not seem support command mode at all.
Some seemed to support it from within the host driver, though. I
remember Exynos getting the TE gpio in the host driver and using
the IRQ routine to self-refresh (which would effectively always
refresh wasting lots of power compared to only refreshing on page
flip).

Also there are some command mode panel drivers (can be found by
looking for drivers _not_ setting the MIPI_DSI_MODE_VIDEO flag):

* panel-novatek-nt35510.c
* panel-samsung-s6d16d0.c
* panel-samsung-s6e63j0x03.c
* panel-samsung-s6e3ha2.c
* panel-sharp-lq101r1sx01.c
* panel-sony-acx424akp.c

So extending the DSI API will involve more drivers than omapdrm and
its DSI command mode panel driver and should probably be done in its
own series.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]