Re: [RFCv1 32/42] drm/omap: dsi: convert to drm_panel

2019-11-19 Thread H. Nikolaus Schaller
Hi Sebastian,

> Am 18.11.2019 um 15:51 schrieb H. Nikolaus Schaller :
> 
>> Ok, I tried not to break video mode support, but I do not have any
>> hardware. Make sure to set the MIPI_DSI_MODE_VIDEO flag in the panel
>> driver.
> 
> Indeed, this may be missing (can't look into the code at the moment)...
> Or I did something wrong when refactoring the driver.
> We will find out.

Yes, MIPI_DSI_MODE_VIDEO was indeed missing/wrongly applied and some
more bugs. But I still wasn't able to make it work.

I also tried to fake the panel-orisetech-otm8009a.c DSI driver into
my setup. It should not properly program the panel by DCS command
but it should try to.

Result is the same: I can see it being probed and calling get_modes
but then:

[drm] Cannot find any crtc or sizes

And I don't see calls to .enable or .prepare where DCS commands would
be sent.

BR and thanks,
Nikolaus

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [RFCv1 32/42] drm/omap: dsi: convert to drm_panel

2019-11-19 Thread Sebastian Reichel
Hi Nikolaus,

On Tue, Nov 19, 2019 at 10:42:55AM +0100, H. Nikolaus Schaller wrote:
> > Am 18.11.2019 um 15:51 schrieb H. Nikolaus Schaller :
> > 
> >> Ok, I tried not to break video mode support, but I do not have any
> >> hardware. Make sure to set the MIPI_DSI_MODE_VIDEO flag in the panel
> >> driver.
> > 
> > Indeed, this may be missing (can't look into the code at the moment)...
> > Or I did something wrong when refactoring the driver.
> > We will find out.
> 
> Yes, MIPI_DSI_MODE_VIDEO was indeed missing/wrongly applied and some
> more bugs. But I still wasn't able to make it work.
> 
> I also tried to fake the panel-orisetech-otm8009a.c DSI driver into
> my setup. It should not properly program the panel by DCS command
> but it should try to.
> 
> Result is the same: I can see it being probed and calling get_modes
> but then:
> 
> [drm] Cannot find any crtc or sizes
> 
> And I don't see calls to .enable or .prepare where DCS commands would
> be sent.

You probably want to enable all kind of drm debugging to get more
information. I guess, that some timing check fails, e.g.
dsi_check_timings(). If the timing checks fail, the mode will not
be added as valid mode. When no valid mode is found, the panel
will not be enabled.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [RFCv1 32/42] drm/omap: dsi: convert to drm_panel

2019-11-19 Thread H. Nikolaus Schaller

> Am 18.11.2019 um 15:45 schrieb Sebastian Reichel 
> :
> 
> Hi,
> 
> On Sun, Nov 17, 2019 at 08:23:05PM +0100, H. Nikolaus Schaller wrote:
>>> [...]
>> 
>>> +   drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
>>> +  DRM_MODE_CONNECTOR_DSI);
>>> +
>> 
>> This leads to
>> 
>> drivers/gpu/drm/panel/panel-dsi-cm.c: In function 'dsicm_probe':
>> drivers/gpu/drm/panel/panel-dsi-cm.c:552:2: error: too many arguments to 
>> function 'drm_panel_init'
>>  drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
>>  ^
>> In file included from drivers/gpu/drm/panel/panel-dsi-cm.c:22:0:
>> ./include/drm/drm_panel.h:150:6: note: declared here
>> void drm_panel_init(struct drm_panel *panel);
>>  ^
>> 
>> (when applied to v5.4-rc7)
> 
> The patchset is based on drm-next from
> https://anongit.freedesktop.org/git/drm/drm.git
> 
> For v5.4-rc7 it needs to look like this:
> 
> + drm_panel_init(&ddata->panel);
> + ddata->panel.dev = dev;
> + ddata->panel.funcs = &dsicm_panel_funcs;

Ah, ok. The issue with changed parameters seems
to already be fixed by two patches in linux-next
and therefore soon in v5.5-rc1.

> 
>>> [...] 
>> 
>> Otherwise the patches compile fine and my work-in progress
>> DSI panel driver is probing, but not initializing.
> 
> Ok, I tried not to break video mode support, but I do not have any
> hardware. Make sure to set the MIPI_DSI_MODE_VIDEO flag in the panel
> driver.

Indeed, this may be missing (can't look into the code at the moment)...
Or I did something wrong when refactoring the driver.
We will find out.

BR and thanks for the great work,
Nikolaus


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [RFCv1 32/42] drm/omap: dsi: convert to drm_panel

2019-11-19 Thread Sebastian Reichel
Hi,

On Sun, Nov 17, 2019 at 08:23:05PM +0100, H. Nikolaus Schaller wrote:
> > [...]
>
> > +   drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
> > +  DRM_MODE_CONNECTOR_DSI);
> > +
> 
> This leads to
> 
> drivers/gpu/drm/panel/panel-dsi-cm.c: In function 'dsicm_probe':
> drivers/gpu/drm/panel/panel-dsi-cm.c:552:2: error: too many arguments to 
> function 'drm_panel_init'
>   drm_panel_init(&ddata->panel, dev, &dsicm_panel_funcs,
>   ^
> In file included from drivers/gpu/drm/panel/panel-dsi-cm.c:22:0:
> ./include/drm/drm_panel.h:150:6: note: declared here
>  void drm_panel_init(struct drm_panel *panel);
>   ^
> 
> (when applied to v5.4-rc7)

The patchset is based on drm-next from
https://anongit.freedesktop.org/git/drm/drm.git

For v5.4-rc7 it needs to look like this:

+   drm_panel_init(&ddata->panel);
+   ddata->panel.dev = dev;
+   ddata->panel.funcs = &dsicm_panel_funcs;

> > [...] 
> 
> Otherwise the patches compile fine and my work-in progress
> DSI panel driver is probing, but not initializing.

Ok, I tried not to break video mode support, but I do not have any
hardware. Make sure to set the MIPI_DSI_MODE_VIDEO flag in the panel
driver.

-- Sebastian


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [RFCv1 32/42] drm/omap: dsi: convert to drm_panel

2019-11-18 Thread H. Nikolaus Schaller
Hi,

> Am 17.11.2019 um 03:40 schrieb Sebastian Reichel 
> :
> 
> This converts the DSI module to expect common drm_panel display
> drivers instead of dssdev based ones.
> 
> This commit is WIP. We somehow need to know the panels resolution
> in omap_dsi_host_attach(), so that we can properly configure the
> DSI bus clock before enabling the bus. The control bus must be
> enabled at this point, so that the panel can use it.
> 
> Other drivers run drm_panel_attach() in their dsi host attach,
> which makes it possible to call drm_panel_get_modes() afterwards
> and the get the correct mode from the connector.
> 
> Signed-off-by: Sebastian Reichel 
> ---
> .../gpu/drm/omapdrm/displays/panel-dsi-cm.c   | 217 +++---
> drivers/gpu/drm/omapdrm/dss/dsi.c | 141 ++--
> .../gpu/drm/omapdrm/dss/omapdss-boot-init.c   |   1 -
> drivers/gpu/drm/omapdrm/dss/omapdss.h |  22 +-
> drivers/gpu/drm/omapdrm/omap_crtc.c   |  17 +-
> 5 files changed, 205 insertions(+), 193 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c 
> b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> index 18020ac43a83..84b0e79c025e 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
> @@ -6,8 +6,6 @@
>  * Author: Tomi Valkeinen 
>  */
> 
> -/* #define DEBUG */
> -
> #include 
> #include 
> #include 
> @@ -20,11 +18,14 @@
> #include 
> 
> #include 
> +#include 
> +#include 
> +#include 
> 
> +#include 
> #include 
> #include 
> -
> -#include "../dss/omapdss.h"
> +#include 
> 
> #define DCS_READ_NUM_ERRORS   0x05
> #define DCS_GET_ID1   0xda
> @@ -35,11 +36,8 @@
> 
> struct panel_drv_data {
>   struct mipi_dsi_device *dsi;
> -
> - struct omap_dss_device dssdev;
> - struct omap_dss_device *src;
> -
> - struct videomode vm;
> + struct drm_panel panel;
> + struct drm_display_mode mode;
> 
>   struct mutex lock;
> 
> @@ -71,7 +69,11 @@ struct panel_drv_data {
>   bool ulps_enabled;
> };
> 
> -#define to_panel_data(p) container_of(p, struct panel_drv_data, dssdev)
> +
> +static inline struct panel_drv_data *panel_to_ddata(struct drm_panel *panel)
> +{
> + return container_of(panel, struct panel_drv_data, panel);
> +}
> 
> static int _dsicm_enable_te(struct panel_drv_data *ddata, bool enable);
> 
> @@ -285,10 +287,15 @@ static void dsicm_hw_reset(struct panel_drv_data *ddata)
> 
> static int dsicm_power_on(struct panel_drv_data *ddata)
> {
> - struct omap_dss_device *src = ddata->src;
>   u8 id1, id2, id3;
>   int r;
> 
> + r = regulator_bulk_enable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> + if (r) {
> + dev_err(&ddata->dsi->dev, "failed to enable supplies: %d\n", r);
> + return r;
> + }
> +
>   dsicm_hw_reset(ddata);
> 
>   ddata->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> @@ -322,10 +329,6 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
>   if (r)
>   goto err;
> 
> - r = src->ops->dsi.enable_video_output(src, ddata->dsi->channel);
> - if (r)
> - goto err;
> -
>   ddata->enabled = 1;
> 
>   if (!ddata->intro_printed) {
> @@ -342,18 +345,17 @@ static int dsicm_power_on(struct panel_drv_data *ddata)
> 
>   dsicm_hw_reset(ddata);
> 
> + regulator_bulk_disable(DCS_REGULATOR_SUPPLY_NUM, ddata->supplies);
> +
>   return r;
> }
> 
> -static void dsicm_power_off(struct panel_drv_data *ddata)
> +static int dsicm_power_off(struct panel_drv_data *ddata)
> {
> - struct omap_dss_device *src = ddata->src;
>   int r;
> 
>   ddata->enabled = 0;
> 
> - src->ops->dsi.disable_video_output(src, ddata->dsi->channel);
> -
>   r = mipi_dsi_dcs_set_display_off(ddata->dsi);
>   if (!r)
>   r = dsicm_sleep_in(ddata);
> @@ -363,52 +365,17 @@ static void dsicm_power_off(struct panel_drv_data 
> *ddata)
>   "error disabling panel, issuing HW reset\n");
>   dsicm_hw_reset(ddata);
>   }
> -}
> 
> -static int dsicm_connect(struct omap_dss_device *src,
> -  struct omap_dss_device *dst)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dst);
> -
> - ddata->src = src;
> - return 0;
> -}
> -
> -static void dsicm_disconnect(struct omap_dss_device *src,
> -  struct omap_dss_device *dst)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dst);
> -
> - ddata->src = NULL;
> -}
> -
> -static void dsicm_pre_enable(struct omap_dss_device *dssdev)
> -{
> - struct panel_drv_data *ddata = to_panel_data(dssdev);
> - struct omap_dss_device *src = ddata->src;
> - int r;
> - struct omap_dss_dsi_config dsi_config = {
> - .vm = &ddata->vm,
> - .hs_clk_min = 15000,
> - .hs_clk_max = 3,
> - .lp_clk_min = 700,
> - .lp_clk_max = 1000,
> - };
> -
> - r = regul