Re: [PATCH 1/4] drm/i915: Add more dev ops for MIPI sub encoder

Jani Nikula
2013-10-22T11:51:57Z

On Tue, 22 Oct 2013, Shobhit Kumar <shobhit.kumar@intel.com> wrote:
> On 10/21/2013 6:57 PM, Jani Nikula wrote:
>>
>> Hi Shobhit -
>>
>> On Mon, 21 Oct 2013, Shobhit Kumar <shobhit.kumar@intel.com> wrote:
>>> Also add new fields in intel_dsi to have all dphy related parameters.
>>> These will be useful even when we go for pure generic MIPI design
>>
>> I feel like we have a different idea of what the ideal generic design
>> is. For me, the goal is that we change the struct intel_dsi_device to
>> struct drm_bridge, and those drm_bridge drivers are all about the panel,
>> and have as few details about i915 or our hardware as possible. Having
>> the bridge drivers fill in register values to be written by the core DSI
>> code does not fit that. Yes, I had some of those in my bridge conversion
>> patches too, but I did not intend we'd keep adding more.
>>
>> I'd rather we provide generic helpers the bridge driver can call.
>
> Yeah, look like our ideas are different. In your goal with drm_bridge
> architecture, we will still end up having multiple bridge drivers for
> each different panel. But my goal is to have a single driver which can
> work for multiple panels.

I'm trying to look one or two steps further, and what it will mean to
the driver. Here's the long term goal in upstream as I see it: There
will be a framework in place that allows one to write a (DSI) panel
driver once, using generic APIs, and use that panel driver with any SoC
(that implements the other side of the framework).

We are obviously far away from that goal at the moment. But IMHO we
should keep that in mind as a guide to what we are doing now. Moving
towards a model with a clearly defined API between the DSI core and the
panels, where the panel specific things are abstracted away from the
core, or towards a model where the core and panel driver depend on the
implementation of each other, communicating via variables.

> Since we already have enabled some panels with sub-encoder
> architecture for completeness I was planning to maintain generic
> driver as one sub-encoder.

Nothing prevents you from doing that, as long as the separation between
the core and the panel drivers remains clear.

> But actually we can do away with all sub-encoder and do not need even
> drm_bridge and all implementation will be in intel_dsi.c. Panel
> specific configurations or sequences will come from VBT which I have
> tried to convert as parameters.

With this model it is all too easy to forget what is the panel driver
and what is the SoC driver. They *are* two separate things, and should
not be mixed. It will be all too easy to keep adding new parameters and
conditions in the code as new panel drivers appear to need them. It will
lead to code that is very difficult to understand and maintain.

A model similar to what I'm proposing has also been tried and tested,
with several panels: drivers/video/omap2/. It's not DRM, and the control
is in the panel drivers, but the separation is extremely clear (panel
drivers are separate kernel modules).

No doubt the clear separation between the core and the panel drivers
will be harder and more work in the short term, but it will pay off in
the long term. And it doesn't all have to happen at once, as long as we
work *towards* that goal, not away from it.

BR,
Jani.

--
Jani Nikula, Intel Open Source Technology Center