[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-30 Thread Laurent Pinchart
Hi Thierry,

On Monday 28 April 2014 23:25:50 Thierry Reding wrote:
> On Mon, Apr 28, 2014 at 05:05:24PM +0200, Laurent Pinchart wrote:
> > On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
> > > On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
> > > > Hi YoungJun,
> > > > 
> > > > Thank you for the patch.
> > > > 
> > > > On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
> > > >> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
> > > >> driver.
> > > >> 
> > > >> Changelog v2:
> > > >> - Declares delay, size properties in probe routine instead of DT
> > > >> Changelog v3:
> > > >> - Moves CPU timings relevant properties from FIMD DT
> > > >> 
> > > >>(commented by Laurent Pinchart, Andrzej Hajda)
> > > >> 
> > > >> Signed-off-by: YoungJun Cho 
> > > >> Acked-by: Inki Dae 
> > > >> Acked-by: Kyungmin Park 
> > > >> ---
> > > >> 
> > > >>   drivers/gpu/drm/panel/Kconfig |7 +
> > > >>   drivers/gpu/drm/panel/Makefile|1 +
> > > >>   drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
> > > >>   3 files changed, 577 insertions(+)
> > > >>   create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
> > > > 
> > > > [snip]
> > > > 
> > > >> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
> > > >> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
> > > >> index 000..1282678
> > > >> --- /dev/null
> > > >> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> > > >> @@ -0,0 +1,569 @@
> > > > 
> > > > [snip]
> > > > 
> > > >> +static int s6e3fa0_get_modes(struct drm_panel *panel)
> > > >> +{
> > > >> +  struct drm_connector *connector = panel->connector;
> > > >> +  struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
> > > >> +  struct drm_display_mode *mode;
> > > >> +
> > > >> +  mode = drm_mode_create(connector->dev);
> > > >> +  if (!mode) {
> > > >> +  DRM_ERROR("failed to create a new display mode\n");
> > > >> +  return 0;
> > > >> +  }
> > > >> +
> > > >> +  drm_display_mode_from_videomode(&ctx->vm, mode);
> > > >> +  mode->width_mm = ctx->width_mm;
> > > >> +  mode->height_mm = ctx->height_mm;
> > > >> +  connector->display_info.width_mm = mode->width_mm;
> > > >> +  connector->display_info.height_mm = mode->height_mm;
> > > >> +
> > > >> +  mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> > > >> +  mode->private = (void *)&ctx->cpu_timings;
> > > > 
> > > > Wouldn't it make sense to create a new get_interface_params (or
> > > > similar)
> > > > operation for drm_panel to query interface configuration parameters
> > > > instead of shoving it in the mode private field ?
> > > 
> > > You mean "new get_interface_params operation" is different from
> > > get_modes() ?
> > > 
> > > Till now, struct drm_display_mode and most of mode relevant APIs are
> > > only for video interface.
> > > And CPU interface also needs video mode configurations.
> > > 
> > > I have a plan to implement the CPU interface relevant APIs like video
> > > mode ones, but I think they should be used under current DRM mode APIs
> > > like fill_modes, get_modes and so on.
> > > So after that implementation, this private field will be replaced by
> > > new ones.
> > > 
> > > Could you explain it in more detail?
> > 
> > The idea is that the interface parameters (RD/WR signals timings in this
> > case, but this could also include MIPI DSI lane configuration or any
> > other kind of physical interface parameters) are distinct from the video
> > modes.
> 
> We already have the lanes field in struct mipi_dsi_device.

Seems I've missed the addition of mipi_dsi_device to DRM.

> I think in general I'd prefer to not spread these parameters around too
> wildly. If this is a general requirement for DBI devices, perhaps what we
> need is struct mipi_dbi_device?

That could be done, but I'm not sure we should expose the nature of the panel 
device (i.e. "I'm a mipi_dsi_device") to the display controller. I would be 
worried about using container_of() on panel->dev to get a mipi_dsi_device 
pointer, as we would then need a strict guarantee that the panel->dev pointer 
is embedded directly in a mipi_dsi_device. This might be doable for DSI, but 
other kind of panels might be connected to different control busses (I'm 
thinking about I2C and SPI in particular) and still need to expose video 
interface parameters to the display controller driver.

-- 
Regards,

Laurent Pinchart
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: 



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-29 Thread YoungJun Cho
Hi Andrzej, Laurent, Thierry.

CCing Steffen Trumtrar,

On 04/29/2014 05:35 PM, YoungJun Cho wrote:
> On 04/29/2014 03:02 PM, YoungJun Cho wrote:
>> Hi Laurent,
>>
>> Thank you for sharing your idea.
>>
>> On 04/29/2014 12:05 AM, Laurent Pinchart wrote:
>>> Hi YoungJun,
>>>
>>> On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
 On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
> Hi YoungJun,
>
> Thank you for the patch.
>
> On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
>> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
>> driver.
>>
>> Changelog v2:
>> - Declares delay, size properties in probe routine instead of DT
>> Changelog v3:
>> - Moves CPU timings relevant properties from FIMD DT
>>
>> (commented by Laurent Pinchart, Andrzej Hajda)
>>
>> Signed-off-by: YoungJun Cho 
>> Acked-by: Inki Dae 
>> Acked-by: Kyungmin Park 
>> ---
>>
>>drivers/gpu/drm/panel/Kconfig |7 +
>>drivers/gpu/drm/panel/Makefile|1 +
>>drivers/gpu/drm/panel/panel-s6e3fa0.c |  569
>> ++
>>3 files changed, 577 insertions(+)
>>create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
>
> [snip]
>
>> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
>> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
>> index 000..1282678
>> --- /dev/null
>> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
>> @@ -0,0 +1,569 @@
>
> [snip]
>
>> +static int s6e3fa0_get_modes(struct drm_panel *panel)
>> +{
>> +struct drm_connector *connector = panel->connector;
>> +struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
>> +struct drm_display_mode *mode;
>> +
>> +mode = drm_mode_create(connector->dev);
>> +if (!mode) {
>> +DRM_ERROR("failed to create a new display mode\n");
>> +return 0;
>> +}
>> +
>> +drm_display_mode_from_videomode(&ctx->vm, mode);
>> +mode->width_mm = ctx->width_mm;
>> +mode->height_mm = ctx->height_mm;
>> +connector->display_info.width_mm = mode->width_mm;
>> +connector->display_info.height_mm = mode->height_mm;
>> +
>> +mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>> +mode->private = (void *)&ctx->cpu_timings;
>
> Wouldn't it make sense to create a new get_interface_params (or
> similar)
> operation for drm_panel to query interface configuration parameters
> instead of shoving it in the mode private field ?

 You mean "new get_interface_params operation" is different from
 get_modes() ?

 Till now, struct drm_display_mode and most of mode relevant APIs are
 only for video interface.
 And CPU interface also needs video mode configurations.

 I have a plan to implement the CPU interface relevant APIs like video
 mode ones, but I think they should be used under current DRM mode APIs
 like fill_modes, get_modes and so on.
 So after that implementation, this private field will be replaced by
 new ones.

 Could you explain it in more detail?
>>>
>>> The idea is that the interface parameters (RD/WR signals timings in
>>> this case,
>>> but this could also include MIPI DSI lane configuration or any other
>>> kind of
>>> physical interface parameters) are distinct from the video modes.
>>
>> Yes. The RD/WR signals timings are distinct from the video modes,
>> but in my opinion, others are covered by video mode already.
>>
>>>
>>> Do you see a need to tie tie interface parameters with
>>> drm_display_mode ? Can
>>> they be mode-specific ? In any case I'd like not to use the private
>>> field of
>>> drm_display_mode. If we need to tie both information together then it
>>> should
>>> be done in a standard way.
>>
>> I think this cpu-mode-timings is in struct drm_display_mode
>> (NOT by *private) and requires drm_display_mode_from_cpumode()
>> because the drm_display_mode_from_videomode() covers only video mode.
>>
>> I'll try implement it as soon as possible.
>>
>
> For your information, there are two modes in MIPI DSI specification,
> which are video mode and command mode.
> And CS, RD/WR timings are related with MIPI DBI specification,
> VSYNC, HSYNC timings are related with MIPI DPI specification.
>
> So I think all things relevant with command mode should be arranged
> the name of command mode(NOT CPU mode, like video mode NOT RGB mode)
> in MIPI DSI, and we don't need to consider MIPI DBI like we do MIPI DPI
> for video mode.
>

First, for MIPI command mode, hactive and vactive are only required.
Sorry Andrzej for confusing reply.
I have to modify exynos fimd pixel clock calculating function.

Second, for generic MIPI command mode timing support, commandmode.c and
of_commandmode.c are required in drivers/video.
And the struct drm_panel_command_mode_

[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-29 Thread YoungJun Cho
On 04/29/2014 03:02 PM, YoungJun Cho wrote:
> Hi Laurent,
>
> Thank you for sharing your idea.
>
> On 04/29/2014 12:05 AM, Laurent Pinchart wrote:
>> Hi YoungJun,
>>
>> On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
>>> On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
 Hi YoungJun,

 Thank you for the patch.

 On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
> driver.
>
> Changelog v2:
> - Declares delay, size properties in probe routine instead of DT
> Changelog v3:
> - Moves CPU timings relevant properties from FIMD DT
>
> (commented by Laurent Pinchart, Andrzej Hajda)
>
> Signed-off-by: YoungJun Cho 
> Acked-by: Inki Dae 
> Acked-by: Kyungmin Park 
> ---
>
>drivers/gpu/drm/panel/Kconfig |7 +
>drivers/gpu/drm/panel/Makefile|1 +
>drivers/gpu/drm/panel/panel-s6e3fa0.c |  569
> ++
>3 files changed, 577 insertions(+)
>create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c

 [snip]

> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
> index 000..1282678
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> @@ -0,0 +1,569 @@

 [snip]

> +static int s6e3fa0_get_modes(struct drm_panel *panel)
> +{
> +struct drm_connector *connector = panel->connector;
> +struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
> +struct drm_display_mode *mode;
> +
> +mode = drm_mode_create(connector->dev);
> +if (!mode) {
> +DRM_ERROR("failed to create a new display mode\n");
> +return 0;
> +}
> +
> +drm_display_mode_from_videomode(&ctx->vm, mode);
> +mode->width_mm = ctx->width_mm;
> +mode->height_mm = ctx->height_mm;
> +connector->display_info.width_mm = mode->width_mm;
> +connector->display_info.height_mm = mode->height_mm;
> +
> +mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> +mode->private = (void *)&ctx->cpu_timings;

 Wouldn't it make sense to create a new get_interface_params (or
 similar)
 operation for drm_panel to query interface configuration parameters
 instead of shoving it in the mode private field ?
>>>
>>> You mean "new get_interface_params operation" is different from
>>> get_modes() ?
>>>
>>> Till now, struct drm_display_mode and most of mode relevant APIs are
>>> only for video interface.
>>> And CPU interface also needs video mode configurations.
>>>
>>> I have a plan to implement the CPU interface relevant APIs like video
>>> mode ones, but I think they should be used under current DRM mode APIs
>>> like fill_modes, get_modes and so on.
>>> So after that implementation, this private field will be replaced by
>>> new ones.
>>>
>>> Could you explain it in more detail?
>>
>> The idea is that the interface parameters (RD/WR signals timings in
>> this case,
>> but this could also include MIPI DSI lane configuration or any other
>> kind of
>> physical interface parameters) are distinct from the video modes.
>
> Yes. The RD/WR signals timings are distinct from the video modes,
> but in my opinion, others are covered by video mode already.
>
>>
>> Do you see a need to tie tie interface parameters with
>> drm_display_mode ? Can
>> they be mode-specific ? In any case I'd like not to use the private
>> field of
>> drm_display_mode. If we need to tie both information together then it
>> should
>> be done in a standard way.
>
> I think this cpu-mode-timings is in struct drm_display_mode
> (NOT by *private) and requires drm_display_mode_from_cpumode()
> because the drm_display_mode_from_videomode() covers only video mode.
>
> I'll try implement it as soon as possible.
>

For your information, there are two modes in MIPI DSI specification,
which are video mode and command mode.
And CS, RD/WR timings are related with MIPI DBI specification,
VSYNC, HSYNC timings are related with MIPI DPI specification.

So I think all things relevant with command mode should be arranged
the name of command mode(NOT CPU mode, like video mode NOT RGB mode)
in MIPI DSI, and we don't need to consider MIPI DBI like we do MIPI DPI 
for video mode.

Thank you.
Best regards YJ

> Thank you,
> Best regards YJ.
>>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-29 Thread YoungJun Cho
Hi Thierry,

Thank you for the comments.

On 04/29/2014 06:25 AM, Thierry Reding wrote:
> On Mon, Apr 28, 2014 at 05:05:24PM +0200, Laurent Pinchart wrote:
>> Hi YoungJun,
>>
>> On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
>>> On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
 Hi YoungJun,

 Thank you for the patch.

 On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
> driver.
>
> Changelog v2:
> - Declares delay, size properties in probe routine instead of DT
> Changelog v3:
> - Moves CPU timings relevant properties from FIMD DT
>
> (commented by Laurent Pinchart, Andrzej Hajda)
>
> Signed-off-by: YoungJun Cho 
> Acked-by: Inki Dae 
> Acked-by: Kyungmin Park 
> ---
>
>drivers/gpu/drm/panel/Kconfig |7 +
>drivers/gpu/drm/panel/Makefile|1 +
>drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
>3 files changed, 577 insertions(+)
>create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c

 [snip]

> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
> index 000..1282678
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> @@ -0,0 +1,569 @@

 [snip]

> +static int s6e3fa0_get_modes(struct drm_panel *panel)
> +{
> + struct drm_connector *connector = panel->connector;
> + struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
> + struct drm_display_mode *mode;
> +
> + mode = drm_mode_create(connector->dev);
> + if (!mode) {
> + DRM_ERROR("failed to create a new display mode\n");
> + return 0;
> + }
> +
> + drm_display_mode_from_videomode(&ctx->vm, mode);
> + mode->width_mm = ctx->width_mm;
> + mode->height_mm = ctx->height_mm;
> + connector->display_info.width_mm = mode->width_mm;
> + connector->display_info.height_mm = mode->height_mm;
> +
> + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> + mode->private = (void *)&ctx->cpu_timings;

 Wouldn't it make sense to create a new get_interface_params (or similar)
 operation for drm_panel to query interface configuration parameters
 instead of shoving it in the mode private field ?
>>>
>>> You mean "new get_interface_params operation" is different from
>>> get_modes() ?
>>>
>>> Till now, struct drm_display_mode and most of mode relevant APIs are
>>> only for video interface.
>>> And CPU interface also needs video mode configurations.
>>>
>>> I have a plan to implement the CPU interface relevant APIs like video
>>> mode ones, but I think they should be used under current DRM mode APIs
>>> like fill_modes, get_modes and so on.
>>> So after that implementation, this private field will be replaced by
>>> new ones.
>>>
>>> Could you explain it in more detail?
>>
>> The idea is that the interface parameters (RD/WR signals timings in this 
>> case,
>> but this could also include MIPI DSI lane configuration or any other kind of
>> physical interface parameters) are distinct from the video modes.
>
> We already have the lanes field in struct mipi_dsi_device. I think in
> general I'd prefer to not spread these parameters around too wildly. If
> this is a general requirement for DBI devices, perhaps what we need is
> struct mipi_dbi_device?
>

Even though it requires CPU mode relevant parameters,
this is also mipi dsi interface.

So I think struct mipi_dsi_device is enough.

Thank you.
Best regards YJ

> Thierry
>



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-29 Thread YoungJun Cho
Hi Laurent,

Thank you for sharing your idea.

On 04/29/2014 12:05 AM, Laurent Pinchart wrote:
> Hi YoungJun,
>
> On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
>> On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
>>> Hi YoungJun,
>>>
>>> Thank you for the patch.
>>>
>>> On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
 This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
 driver.

 Changelog v2:
 - Declares delay, size properties in probe routine instead of DT
 Changelog v3:
 - Moves CPU timings relevant properties from FIMD DT

 (commented by Laurent Pinchart, Andrzej Hajda)

 Signed-off-by: YoungJun Cho 
 Acked-by: Inki Dae 
 Acked-by: Kyungmin Park 
 ---

drivers/gpu/drm/panel/Kconfig |7 +
drivers/gpu/drm/panel/Makefile|1 +
drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
3 files changed, 577 insertions(+)
create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
>>>
>>> [snip]
>>>
 diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
 b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
 index 000..1282678
 --- /dev/null
 +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
 @@ -0,0 +1,569 @@
>>>
>>> [snip]
>>>
 +static int s6e3fa0_get_modes(struct drm_panel *panel)
 +{
 +  struct drm_connector *connector = panel->connector;
 +  struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
 +  struct drm_display_mode *mode;
 +
 +  mode = drm_mode_create(connector->dev);
 +  if (!mode) {
 +  DRM_ERROR("failed to create a new display mode\n");
 +  return 0;
 +  }
 +
 +  drm_display_mode_from_videomode(&ctx->vm, mode);
 +  mode->width_mm = ctx->width_mm;
 +  mode->height_mm = ctx->height_mm;
 +  connector->display_info.width_mm = mode->width_mm;
 +  connector->display_info.height_mm = mode->height_mm;
 +
 +  mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 +  mode->private = (void *)&ctx->cpu_timings;
>>>
>>> Wouldn't it make sense to create a new get_interface_params (or similar)
>>> operation for drm_panel to query interface configuration parameters
>>> instead of shoving it in the mode private field ?
>>
>> You mean "new get_interface_params operation" is different from
>> get_modes() ?
>>
>> Till now, struct drm_display_mode and most of mode relevant APIs are
>> only for video interface.
>> And CPU interface also needs video mode configurations.
>>
>> I have a plan to implement the CPU interface relevant APIs like video
>> mode ones, but I think they should be used under current DRM mode APIs
>> like fill_modes, get_modes and so on.
>> So after that implementation, this private field will be replaced by
>> new ones.
>>
>> Could you explain it in more detail?
>
> The idea is that the interface parameters (RD/WR signals timings in this case,
> but this could also include MIPI DSI lane configuration or any other kind of
> physical interface parameters) are distinct from the video modes.

Yes. The RD/WR signals timings are distinct from the video modes,
but in my opinion, others are covered by video mode already.

>
> Do you see a need to tie tie interface parameters with drm_display_mode ? Can
> they be mode-specific ? In any case I'd like not to use the private field of
> drm_display_mode. If we need to tie both information together then it should
> be done in a standard way.

I think this cpu-mode-timings is in struct drm_display_mode
(NOT by *private) and requires drm_display_mode_from_cpumode()
because the drm_display_mode_from_videomode() covers only video mode.

I'll try implement it as soon as possible.

Thank you,
Best regards YJ.
>



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-28 Thread Thierry Reding
On Mon, Apr 28, 2014 at 05:05:24PM +0200, Laurent Pinchart wrote:
> Hi YoungJun,
> 
> On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
> > On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
> > > Hi YoungJun,
> > > 
> > > Thank you for the patch.
> > > 
> > > On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
> > >> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
> > >> driver.
> > >> 
> > >> Changelog v2:
> > >> - Declares delay, size properties in probe routine instead of DT
> > >> Changelog v3:
> > >> - Moves CPU timings relevant properties from FIMD DT
> > >> 
> > >>(commented by Laurent Pinchart, Andrzej Hajda)
> > >> 
> > >> Signed-off-by: YoungJun Cho 
> > >> Acked-by: Inki Dae 
> > >> Acked-by: Kyungmin Park 
> > >> ---
> > >> 
> > >>   drivers/gpu/drm/panel/Kconfig |7 +
> > >>   drivers/gpu/drm/panel/Makefile|1 +
> > >>   drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
> > >>   3 files changed, 577 insertions(+)
> > >>   create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
> > > 
> > > [snip]
> > > 
> > >> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
> > >> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
> > >> index 000..1282678
> > >> --- /dev/null
> > >> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> > >> @@ -0,0 +1,569 @@
> > > 
> > > [snip]
> > > 
> > >> +static int s6e3fa0_get_modes(struct drm_panel *panel)
> > >> +{
> > >> +struct drm_connector *connector = panel->connector;
> > >> +struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
> > >> +struct drm_display_mode *mode;
> > >> +
> > >> +mode = drm_mode_create(connector->dev);
> > >> +if (!mode) {
> > >> +DRM_ERROR("failed to create a new display mode\n");
> > >> +return 0;
> > >> +}
> > >> +
> > >> +drm_display_mode_from_videomode(&ctx->vm, mode);
> > >> +mode->width_mm = ctx->width_mm;
> > >> +mode->height_mm = ctx->height_mm;
> > >> +connector->display_info.width_mm = mode->width_mm;
> > >> +connector->display_info.height_mm = mode->height_mm;
> > >> +
> > >> +mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> > >> +mode->private = (void *)&ctx->cpu_timings;
> > > 
> > > Wouldn't it make sense to create a new get_interface_params (or similar)
> > > operation for drm_panel to query interface configuration parameters
> > > instead of shoving it in the mode private field ?
> > 
> > You mean "new get_interface_params operation" is different from
> > get_modes() ?
> > 
> > Till now, struct drm_display_mode and most of mode relevant APIs are
> > only for video interface.
> > And CPU interface also needs video mode configurations.
> > 
> > I have a plan to implement the CPU interface relevant APIs like video
> > mode ones, but I think they should be used under current DRM mode APIs
> > like fill_modes, get_modes and so on.
> > So after that implementation, this private field will be replaced by
> > new ones.
> > 
> > Could you explain it in more detail?
> 
> The idea is that the interface parameters (RD/WR signals timings in this 
> case, 
> but this could also include MIPI DSI lane configuration or any other kind of 
> physical interface parameters) are distinct from the video modes.

We already have the lanes field in struct mipi_dsi_device. I think in
general I'd prefer to not spread these parameters around too wildly. If
this is a general requirement for DBI devices, perhaps what we need is
struct mipi_dbi_device?

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-28 Thread Laurent Pinchart
Hi YoungJun,

On Tuesday 22 April 2014 10:24:39 YoungJun Cho wrote:
> On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
> > Hi YoungJun,
> > 
> > Thank you for the patch.
> > 
> > On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
> >> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel
> >> driver.
> >> 
> >> Changelog v2:
> >> - Declares delay, size properties in probe routine instead of DT
> >> Changelog v3:
> >> - Moves CPU timings relevant properties from FIMD DT
> >> 
> >>(commented by Laurent Pinchart, Andrzej Hajda)
> >> 
> >> Signed-off-by: YoungJun Cho 
> >> Acked-by: Inki Dae 
> >> Acked-by: Kyungmin Park 
> >> ---
> >> 
> >>   drivers/gpu/drm/panel/Kconfig |7 +
> >>   drivers/gpu/drm/panel/Makefile|1 +
> >>   drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
> >>   3 files changed, 577 insertions(+)
> >>   create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
> > 
> > [snip]
> > 
> >> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
> >> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
> >> index 000..1282678
> >> --- /dev/null
> >> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> >> @@ -0,0 +1,569 @@
> > 
> > [snip]
> > 
> >> +static int s6e3fa0_get_modes(struct drm_panel *panel)
> >> +{
> >> +  struct drm_connector *connector = panel->connector;
> >> +  struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
> >> +  struct drm_display_mode *mode;
> >> +
> >> +  mode = drm_mode_create(connector->dev);
> >> +  if (!mode) {
> >> +  DRM_ERROR("failed to create a new display mode\n");
> >> +  return 0;
> >> +  }
> >> +
> >> +  drm_display_mode_from_videomode(&ctx->vm, mode);
> >> +  mode->width_mm = ctx->width_mm;
> >> +  mode->height_mm = ctx->height_mm;
> >> +  connector->display_info.width_mm = mode->width_mm;
> >> +  connector->display_info.height_mm = mode->height_mm;
> >> +
> >> +  mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> >> +  mode->private = (void *)&ctx->cpu_timings;
> > 
> > Wouldn't it make sense to create a new get_interface_params (or similar)
> > operation for drm_panel to query interface configuration parameters
> > instead of shoving it in the mode private field ?
> 
> You mean "new get_interface_params operation" is different from
> get_modes() ?
> 
> Till now, struct drm_display_mode and most of mode relevant APIs are
> only for video interface.
> And CPU interface also needs video mode configurations.
> 
> I have a plan to implement the CPU interface relevant APIs like video
> mode ones, but I think they should be used under current DRM mode APIs
> like fill_modes, get_modes and so on.
> So after that implementation, this private field will be replaced by
> new ones.
> 
> Could you explain it in more detail?

The idea is that the interface parameters (RD/WR signals timings in this case, 
but this could also include MIPI DSI lane configuration or any other kind of 
physical interface parameters) are distinct from the video modes.

Do you see a need to tie tie interface parameters with drm_display_mode ? Can 
they be mode-specific ? In any case I'd like not to use the private field of 
drm_display_mode. If we need to tie both information together then it should 
be done in a standard way.

-- 
Regards,

Laurent Pinchart



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-24 Thread YoungJun Cho
Hi Andrzej,

Thank you for kind comments.

On 04/23/2014 07:16 PM, Andrzej Hajda wrote:
> Hi YoungJun,
>
>
> On 04/21/2014 02:28 PM, YoungJun Cho wrote:
>> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel driver.
>>
>> Changelog v2:
>> - Declares delay, size properties in probe routine instead of DT
>> Changelog v3:
>> - Moves CPU timings relevant properties from FIMD DT
>>(commented by Laurent Pinchart, Andrzej Hajda)
>>
>> Signed-off-by: YoungJun Cho 
>> Acked-by: Inki Dae 
>> Acked-by: Kyungmin Park 
>> ---
>>   drivers/gpu/drm/panel/Kconfig |7 +
>>   drivers/gpu/drm/panel/Makefile|1 +
>>   drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 
>> +
>>   3 files changed, 577 insertions(+)
>>   create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
>>
>> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
>> index 4ec874d..be1392e 100644
>> --- a/drivers/gpu/drm/panel/Kconfig
>> +++ b/drivers/gpu/drm/panel/Kconfig
>> @@ -30,4 +30,11 @@ config DRM_PANEL_S6E8AA0
>>  select DRM_MIPI_DSI
>>  select VIDEOMODE_HELPERS
>>
>> +config DRM_PANEL_S6E3FA0
>> +tristate "S6E3FA0 DSI command mode panel"
>> +depends on DRM && DRM_PANEL
>> +depends on OF
>> +select DRM_MIPI_DSI
>> +select VIDEOMODE_HELPERS
>> +
>>   endmenu
>> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
>> index 8b92921..85c6738 100644
>> --- a/drivers/gpu/drm/panel/Makefile
>> +++ b/drivers/gpu/drm/panel/Makefile
>> @@ -1,3 +1,4 @@
>>   obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
>>   obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o
>>   obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o
>> +obj-$(CONFIG_DRM_PANEL_S6E3FA0) += panel-s6e3fa0.o
>> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c 
>> b/drivers/gpu/drm/panel/panel-s6e3fa0.c
>> new file mode 100644
>> index 000..1282678
>> --- /dev/null
>> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
>> @@ -0,0 +1,569 @@
>> +/*
>> + * MIPI-DSI based s6e3fa0 AMOLED LCD 5.7 inch panel driver.
>> + *
>> + * Copyright (c) 2014 Samsung Electronics Co., Ltd
>> + *
>> + * YoungJun Cho 
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> +*/
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#include 
>> +#include 
>
>
> #include  should be enough.

Ok, I'll check.

>
>
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define MTP_ID_LEN  3
>> +#define GAMMA_LEVEL_NUM 30
>> +
>> +struct s6e3fa0 {
>> +struct device   *dev;
>> +struct drm_panelpanel;
>> +
>> +struct regulator_bulk_data  supplies[2];
>> +struct gpio_desc*reset_gpio;
>> +struct gpio_desc*det_gpio;
>> +struct gpio_desc*te_gpio;
>> +struct videomodevm;
>> +struct drm_panel_cpu_timingscpu_timings;
>> +
>> +unsigned intpower_on_delay;
>> +unsigned intreset_delay;
>> +unsigned intinit_delay;
>> +unsigned intwidth_mm;
>> +unsigned intheight_mm;
>> +
>> +unsigned char   id;
>> +unsigned char   vddm;
>> +unsigned intbrightness;
>> +};
>> +
>> +#define panel_to_s6e3fa0(p) container_of(p, struct s6e3fa0, panel)
>> +
>> +static const unsigned char s6e3fa0_vddm_lut[][2] = {
>> +{0x00, 0x0d}, {0x01, 0x0d}, {0x02, 0x0e}, {0x03, 0x0f}, {0x04, 0x10},
>> +{0x05, 0x11}, {0x06, 0x12}, {0x07, 0x13}, {0x08, 0x14}, {0x09, 0x15},
>> +{0x0a, 0x16}, {0x0b, 0x17}, {0x0c, 0x18}, {0x0d, 0x19}, {0x0e, 0x1a},
>> +{0x0f, 0x1b}, {0x10, 0x1c}, {0x11, 0x1d}, {0x12, 0x1e}, {0x13, 0x1f},
>> +{0x14, 0x20}, {0x15, 0x21}, {0x16, 0x22}, {0x17, 0x23}, {0x18, 0x24},
>> +{0x19, 0x25}, {0x1a, 0x26}, {0x1b, 0x27}, {0x1c, 0x28}, {0x1d, 0x29},
>> +{0x1e, 0x2a}, {0x1f, 0x2b}, {0x20, 0x2c}, {0x21, 0x2d}, {0x22, 0x2e},
>> +{0x23, 0x2f}, {0x24, 0x30}, {0x25, 0x31}, {0x26, 0x32}, {0x27, 0x33},
>> +{0x28, 0x34}, {0x29, 0x35}, {0x2a, 0x36}, {0x2b, 0x37}, {0x2c, 0x38},
>> +{0x2d, 0x39}, {0x2e, 0x3a}, {0x2f, 0x3b}, {0x30, 0x3c}, {0x31, 0x3d},
>> +{0x32, 0x3e}, {0x33, 0x3f}, {0x34, 0x3f}, {0x35, 0x3f}, {0x36, 0x3f},
>> +{0x37, 0x3f}, {0x38, 0x3f}, {0x39, 0x3f}, {0x3a, 0x3f}, {0x3b, 0x3f},
>> +{0x3c, 0x3f}, {0x3d, 0x3f}, {0x3e, 0x3f}, {0x3f, 0x3f}, {0x40, 0x0c},
>> +{0x41, 0x0b}, {0x42, 0x0a}, {0x43, 0x09}, {0x44, 0x08}, {0x45, 0x07},
>> +{0x46, 0x06}, {0x47, 0x05}, {0x48, 0x04}, {0x49, 0x03}, {0x4a, 0x02},
>> +{0x4b, 0x01}, {0x4c, 0x40}, {0x4d, 0x41}, {0x4e, 0x42}, {0x4f, 0x43},
>> +{0x50, 0x44}, {0x51, 0x45}, {0x52, 0x46}, {0x53, 0x47}, {0x54, 0x48},
>> +{0x55, 0

[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-23 Thread Andrzej Hajda
Hi YoungJun,


On 04/21/2014 02:28 PM, YoungJun Cho wrote:
> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel driver.
> 
> Changelog v2:
> - Declares delay, size properties in probe routine instead of DT
> Changelog v3:
> - Moves CPU timings relevant properties from FIMD DT
>   (commented by Laurent Pinchart, Andrzej Hajda)
> 
> Signed-off-by: YoungJun Cho 
> Acked-by: Inki Dae 
> Acked-by: Kyungmin Park 
> ---
>  drivers/gpu/drm/panel/Kconfig |7 +
>  drivers/gpu/drm/panel/Makefile|1 +
>  drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 
> +
>  3 files changed, 577 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
> 
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 4ec874d..be1392e 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -30,4 +30,11 @@ config DRM_PANEL_S6E8AA0
>   select DRM_MIPI_DSI
>   select VIDEOMODE_HELPERS
>  
> +config DRM_PANEL_S6E3FA0
> + tristate "S6E3FA0 DSI command mode panel"
> + depends on DRM && DRM_PANEL
> + depends on OF
> + select DRM_MIPI_DSI
> + select VIDEOMODE_HELPERS
> +
>  endmenu
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 8b92921..85c6738 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -1,3 +1,4 @@
>  obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
>  obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o
>  obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o
> +obj-$(CONFIG_DRM_PANEL_S6E3FA0) += panel-s6e3fa0.o
> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c 
> b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> new file mode 100644
> index 000..1282678
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> @@ -0,0 +1,569 @@
> +/*
> + * MIPI-DSI based s6e3fa0 AMOLED LCD 5.7 inch panel driver.
> + *
> + * Copyright (c) 2014 Samsung Electronics Co., Ltd
> + *
> + * YoungJun Cho 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 


#include  should be enough.


> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +#define MTP_ID_LEN   3
> +#define GAMMA_LEVEL_NUM  30
> +
> +struct s6e3fa0 {
> + struct device   *dev;
> + struct drm_panelpanel;
> +
> + struct regulator_bulk_data  supplies[2];
> + struct gpio_desc*reset_gpio;
> + struct gpio_desc*det_gpio;
> + struct gpio_desc*te_gpio;
> + struct videomodevm;
> + struct drm_panel_cpu_timingscpu_timings;
> +
> + unsigned intpower_on_delay;
> + unsigned intreset_delay;
> + unsigned intinit_delay;
> + unsigned intwidth_mm;
> + unsigned intheight_mm;
> +
> + unsigned char   id;
> + unsigned char   vddm;
> + unsigned intbrightness;
> +};
> +
> +#define panel_to_s6e3fa0(p) container_of(p, struct s6e3fa0, panel)
> +
> +static const unsigned char s6e3fa0_vddm_lut[][2] = {
> + {0x00, 0x0d}, {0x01, 0x0d}, {0x02, 0x0e}, {0x03, 0x0f}, {0x04, 0x10},
> + {0x05, 0x11}, {0x06, 0x12}, {0x07, 0x13}, {0x08, 0x14}, {0x09, 0x15},
> + {0x0a, 0x16}, {0x0b, 0x17}, {0x0c, 0x18}, {0x0d, 0x19}, {0x0e, 0x1a},
> + {0x0f, 0x1b}, {0x10, 0x1c}, {0x11, 0x1d}, {0x12, 0x1e}, {0x13, 0x1f},
> + {0x14, 0x20}, {0x15, 0x21}, {0x16, 0x22}, {0x17, 0x23}, {0x18, 0x24},
> + {0x19, 0x25}, {0x1a, 0x26}, {0x1b, 0x27}, {0x1c, 0x28}, {0x1d, 0x29},
> + {0x1e, 0x2a}, {0x1f, 0x2b}, {0x20, 0x2c}, {0x21, 0x2d}, {0x22, 0x2e},
> + {0x23, 0x2f}, {0x24, 0x30}, {0x25, 0x31}, {0x26, 0x32}, {0x27, 0x33},
> + {0x28, 0x34}, {0x29, 0x35}, {0x2a, 0x36}, {0x2b, 0x37}, {0x2c, 0x38},
> + {0x2d, 0x39}, {0x2e, 0x3a}, {0x2f, 0x3b}, {0x30, 0x3c}, {0x31, 0x3d},
> + {0x32, 0x3e}, {0x33, 0x3f}, {0x34, 0x3f}, {0x35, 0x3f}, {0x36, 0x3f},
> + {0x37, 0x3f}, {0x38, 0x3f}, {0x39, 0x3f}, {0x3a, 0x3f}, {0x3b, 0x3f},
> + {0x3c, 0x3f}, {0x3d, 0x3f}, {0x3e, 0x3f}, {0x3f, 0x3f}, {0x40, 0x0c},
> + {0x41, 0x0b}, {0x42, 0x0a}, {0x43, 0x09}, {0x44, 0x08}, {0x45, 0x07},
> + {0x46, 0x06}, {0x47, 0x05}, {0x48, 0x04}, {0x49, 0x03}, {0x4a, 0x02},
> + {0x4b, 0x01}, {0x4c, 0x40}, {0x4d, 0x41}, {0x4e, 0x42}, {0x4f, 0x43},
> + {0x50, 0x44}, {0x51, 0x45}, {0x52, 0x46}, {0x53, 0x47}, {0x54, 0x48},
> + {0x55, 0x49}, {0x56, 0x4a}, {0x57, 0x4b}, {0x58, 0x4c}, {0x59, 0x4d},
> + {0x5a, 0x4e}, {0x5b, 0x4f}, {0x5c, 0x50}, {0x5d, 0x51}, {0x5e, 0x52},
> + {0x5f, 0x53}, {0x60, 0x54}, {0x61, 0x55}, {0x62, 0x56

[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-22 Thread YoungJun Cho
Hi Laurent,

Thank you for the comment.

On 04/22/2014 08:00 AM, Laurent Pinchart wrote:
> Hi YoungJun,
>
> Thank you for the patch.
>
> On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
>> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel driver.
>>
>> Changelog v2:
>> - Declares delay, size properties in probe routine instead of DT
>> Changelog v3:
>> - Moves CPU timings relevant properties from FIMD DT
>>(commented by Laurent Pinchart, Andrzej Hajda)
>>
>> Signed-off-by: YoungJun Cho 
>> Acked-by: Inki Dae 
>> Acked-by: Kyungmin Park 
>> ---
>>   drivers/gpu/drm/panel/Kconfig |7 +
>>   drivers/gpu/drm/panel/Makefile|1 +
>>   drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
>>   3 files changed, 577 insertions(+)
>>   create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c
>
> [snip]
>
>> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
>> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
>> index 000..1282678
>> --- /dev/null
>> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
>> @@ -0,0 +1,569 @@
>
> [snip]
>
>> +static int s6e3fa0_get_modes(struct drm_panel *panel)
>> +{
>> +struct drm_connector *connector = panel->connector;
>> +struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
>> +struct drm_display_mode *mode;
>> +
>> +mode = drm_mode_create(connector->dev);
>> +if (!mode) {
>> +DRM_ERROR("failed to create a new display mode\n");
>> +return 0;
>> +}
>> +
>> +drm_display_mode_from_videomode(&ctx->vm, mode);
>> +mode->width_mm = ctx->width_mm;
>> +mode->height_mm = ctx->height_mm;
>> +connector->display_info.width_mm = mode->width_mm;
>> +connector->display_info.height_mm = mode->height_mm;
>> +
>> +mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
>> +mode->private = (void *)&ctx->cpu_timings;
>
> Wouldn't it make sense to create a new get_interface_params (or similar)
> operation for drm_panel to query interface configuration parameters instead of
> shoving it in the mode private field ?

You mean "new get_interface_params operation" is different from
get_modes() ?

Till now, struct drm_display_mode and most of mode relevant APIs are
only for video interface.
And CPU interface also needs video mode configurations.

I have a plan to implement the CPU interface relevant APIs like video
mode ones, but I think they should be used under current DRM mode APIs
like fill_modes, get_modes and so on.
So after that implementation, this private field will be replaced by
new ones.

Could you explain it in more detail?

Thank you.
Best regards YJ

>
>> +drm_mode_probed_add(connector, mode);
>> +
>> +return 1;
>> +}
>
> [snip]
>



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-22 Thread Laurent Pinchart
Hi YoungJun,

Thank you for the patch.

On Monday 21 April 2014 21:28:37 YoungJun Cho wrote:
> This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel driver.
> 
> Changelog v2:
> - Declares delay, size properties in probe routine instead of DT
> Changelog v3:
> - Moves CPU timings relevant properties from FIMD DT
>   (commented by Laurent Pinchart, Andrzej Hajda)
> 
> Signed-off-by: YoungJun Cho 
> Acked-by: Inki Dae 
> Acked-by: Kyungmin Park 
> ---
>  drivers/gpu/drm/panel/Kconfig |7 +
>  drivers/gpu/drm/panel/Makefile|1 +
>  drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 ++
>  3 files changed, 577 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c

[snip]

> diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c
> b/drivers/gpu/drm/panel/panel-s6e3fa0.c new file mode 100644
> index 000..1282678
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
> @@ -0,0 +1,569 @@

[snip]

> +static int s6e3fa0_get_modes(struct drm_panel *panel)
> +{
> + struct drm_connector *connector = panel->connector;
> + struct s6e3fa0 *ctx = panel_to_s6e3fa0(panel);
> + struct drm_display_mode *mode;
> +
> + mode = drm_mode_create(connector->dev);
> + if (!mode) {
> + DRM_ERROR("failed to create a new display mode\n");
> + return 0;
> + }
> +
> + drm_display_mode_from_videomode(&ctx->vm, mode);
> + mode->width_mm = ctx->width_mm;
> + mode->height_mm = ctx->height_mm;
> + connector->display_info.width_mm = mode->width_mm;
> + connector->display_info.height_mm = mode->height_mm;
> +
> + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> + mode->private = (void *)&ctx->cpu_timings;

Wouldn't it make sense to create a new get_interface_params (or similar) 
operation for drm_panel to query interface configuration parameters instead of 
shoving it in the mode private field ?

> + drm_mode_probed_add(connector, mode);
> +
> + return 1;
> +}

[snip]

-- 
Regards,

Laurent Pinchart



[RFC v2 PATCH v3 10/14] drm/panel: add S6E3FA0 driver

2014-04-21 Thread YoungJun Cho
This patch adds MIPI-DSI command mode based S6E3FA0 AMOLED LCD Panel driver.

Changelog v2:
- Declares delay, size properties in probe routine instead of DT
Changelog v3:
- Moves CPU timings relevant properties from FIMD DT
  (commented by Laurent Pinchart, Andrzej Hajda)

Signed-off-by: YoungJun Cho 
Acked-by: Inki Dae 
Acked-by: Kyungmin Park 
---
 drivers/gpu/drm/panel/Kconfig |7 +
 drivers/gpu/drm/panel/Makefile|1 +
 drivers/gpu/drm/panel/panel-s6e3fa0.c |  569 +
 3 files changed, 577 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-s6e3fa0.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 4ec874d..be1392e 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -30,4 +30,11 @@ config DRM_PANEL_S6E8AA0
select DRM_MIPI_DSI
select VIDEOMODE_HELPERS

+config DRM_PANEL_S6E3FA0
+   tristate "S6E3FA0 DSI command mode panel"
+   depends on DRM && DRM_PANEL
+   depends on OF
+   select DRM_MIPI_DSI
+   select VIDEOMODE_HELPERS
+
 endmenu
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 8b92921..85c6738 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o
 obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o
+obj-$(CONFIG_DRM_PANEL_S6E3FA0) += panel-s6e3fa0.o
diff --git a/drivers/gpu/drm/panel/panel-s6e3fa0.c 
b/drivers/gpu/drm/panel/panel-s6e3fa0.c
new file mode 100644
index 000..1282678
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-s6e3fa0.c
@@ -0,0 +1,569 @@
+/*
+ * MIPI-DSI based s6e3fa0 AMOLED LCD 5.7 inch panel driver.
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd
+ *
+ * YoungJun Cho 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define MTP_ID_LEN 3
+#define GAMMA_LEVEL_NUM30
+
+struct s6e3fa0 {
+   struct device   *dev;
+   struct drm_panelpanel;
+
+   struct regulator_bulk_data  supplies[2];
+   struct gpio_desc*reset_gpio;
+   struct gpio_desc*det_gpio;
+   struct gpio_desc*te_gpio;
+   struct videomodevm;
+   struct drm_panel_cpu_timingscpu_timings;
+
+   unsigned intpower_on_delay;
+   unsigned intreset_delay;
+   unsigned intinit_delay;
+   unsigned intwidth_mm;
+   unsigned intheight_mm;
+
+   unsigned char   id;
+   unsigned char   vddm;
+   unsigned intbrightness;
+};
+
+#define panel_to_s6e3fa0(p) container_of(p, struct s6e3fa0, panel)
+
+static const unsigned char s6e3fa0_vddm_lut[][2] = {
+   {0x00, 0x0d}, {0x01, 0x0d}, {0x02, 0x0e}, {0x03, 0x0f}, {0x04, 0x10},
+   {0x05, 0x11}, {0x06, 0x12}, {0x07, 0x13}, {0x08, 0x14}, {0x09, 0x15},
+   {0x0a, 0x16}, {0x0b, 0x17}, {0x0c, 0x18}, {0x0d, 0x19}, {0x0e, 0x1a},
+   {0x0f, 0x1b}, {0x10, 0x1c}, {0x11, 0x1d}, {0x12, 0x1e}, {0x13, 0x1f},
+   {0x14, 0x20}, {0x15, 0x21}, {0x16, 0x22}, {0x17, 0x23}, {0x18, 0x24},
+   {0x19, 0x25}, {0x1a, 0x26}, {0x1b, 0x27}, {0x1c, 0x28}, {0x1d, 0x29},
+   {0x1e, 0x2a}, {0x1f, 0x2b}, {0x20, 0x2c}, {0x21, 0x2d}, {0x22, 0x2e},
+   {0x23, 0x2f}, {0x24, 0x30}, {0x25, 0x31}, {0x26, 0x32}, {0x27, 0x33},
+   {0x28, 0x34}, {0x29, 0x35}, {0x2a, 0x36}, {0x2b, 0x37}, {0x2c, 0x38},
+   {0x2d, 0x39}, {0x2e, 0x3a}, {0x2f, 0x3b}, {0x30, 0x3c}, {0x31, 0x3d},
+   {0x32, 0x3e}, {0x33, 0x3f}, {0x34, 0x3f}, {0x35, 0x3f}, {0x36, 0x3f},
+   {0x37, 0x3f}, {0x38, 0x3f}, {0x39, 0x3f}, {0x3a, 0x3f}, {0x3b, 0x3f},
+   {0x3c, 0x3f}, {0x3d, 0x3f}, {0x3e, 0x3f}, {0x3f, 0x3f}, {0x40, 0x0c},
+   {0x41, 0x0b}, {0x42, 0x0a}, {0x43, 0x09}, {0x44, 0x08}, {0x45, 0x07},
+   {0x46, 0x06}, {0x47, 0x05}, {0x48, 0x04}, {0x49, 0x03}, {0x4a, 0x02},
+   {0x4b, 0x01}, {0x4c, 0x40}, {0x4d, 0x41}, {0x4e, 0x42}, {0x4f, 0x43},
+   {0x50, 0x44}, {0x51, 0x45}, {0x52, 0x46}, {0x53, 0x47}, {0x54, 0x48},
+   {0x55, 0x49}, {0x56, 0x4a}, {0x57, 0x4b}, {0x58, 0x4c}, {0x59, 0x4d},
+   {0x5a, 0x4e}, {0x5b, 0x4f}, {0x5c, 0x50}, {0x5d, 0x51}, {0x5e, 0x52},
+   {0x5f, 0x53}, {0x60, 0x54}, {0x61, 0x55}, {0x62, 0x56}, {0x63, 0x57},
+   {0x64, 0x58}, {0x65, 0x59}, {0x66, 0x5a}, {0x67, 0x5b}, {0x68, 0x5c},
+   {0x69, 0x5d}, {0x6a, 0x5e}, {0x6b, 0x5f}, {0x6c, 0x60}, {0x6d, 0x61},
+   {0x6e, 0x62}, {0x6f, 0x63}, {0x70, 0x64}, {0x71, 0x65}, {0x72, 0x66}