Re: [PATCH v2 2/4] drm/tiny: Add driver for Solomon SSD130X OLED displays

From: Andy Shevchenko
Date: Sat Feb 05 2022 - 08:05:33 EST


On Fri, Feb 04, 2022 at 08:19:12PM +0100, Javier Martinez Canillas wrote:
> On 2/4/22 15:26, Andy Shevchenko wrote:
> > On Fri, Feb 04, 2022 at 02:43:45PM +0100, Javier Martinez Canillas wrote:

...

> >> +struct ssd130x_device {
> >> + struct drm_device drm;
> >> + struct drm_simple_display_pipe pipe;
> >> + struct drm_display_mode mode;
> >> + struct drm_connector connector;
> >
> >
> >> + struct i2c_client *client;
> >
> > Can we logically separate hw protocol vs hw interface from day 1, please?
> > This will allow to add SPI support for this panel much easier.
> >
> > Technically I would like to see here
> >
> > struct device *dev;
> >
> > and probably (I haven't looked into design)
> >
> > struct ssd130x_ops *ops;
> >
> > or something alike.
>
> Sure. I wanted to keep the driver simple, making the writes bus agnostic and
> adding a level of indirection would make it more complex. But I agree that
> it will also make easier to add more buses later. I will do that for v3.

I have SSD1306 display with SPI interface and I'm not able to test your series.
With the above it at least gives me a point to consider helping (coding and
testing) with SPI one.

...

> >> + if (!fb)
> >> + return;
> >
> > Can it happen?
>
> I don't know, but saw that the handler of other drivers checked for this so
> preferred to play safe and do the same.

So, either cargo-cult or indeed it may happen. Somebody may conduct a research
on this...

...

> >> + drm_mode_probed_add(connector, mode);
> >> + drm_set_preferred_mode(connector, mode->hdisplay, mode->vdisplay);
> >> +
> >> + return 1;
> >
> > Positive code, what is the meaning of it?
>
> It's the number of connector modes. The driver only supports 1.

A comment then?

--
With Best Regards,
Andy Shevchenko