[PATCH V4] drm/exynos: fimd: calculate the correct address offset

2013-03-07 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers based on exynos4 and exynos5 user manuals.
Also remove VIDOSD_C_SIZE_W0 macro and fix comments about registers for
size and alpha.

Signed-off-by: Leela Krishna Amudala 
Acked-by: Joonyoung Shim 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..f5f2b25 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -38,11 +38,12 @@
 /* position control register for hardware window 0, 2 ~ 4.*/
 #define VIDOSD_A(win)  (VIDOSD_BASE + 0x00 + (win) * 16)
 #define VIDOSD_B(win)  (VIDOSD_BASE + 0x04 + (win) * 16)
-/* size control register for hardware window 0. */
-#define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
-/* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
-/* size control register for hardware window 1 ~ 4. */
+/*
+ * size control register for hardware windows 0 and alpha control register
+ * for hardware windows 1 ~ 4
+ */
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
+/* size control register for hardware windows 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)

 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
@@ -50,9 +51,9 @@
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)

 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))

 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos)
if (win != 3 && win != 4) {
u32 offset = VIDOSD_D(win);
if (win == 0)
-   offset = VIDOSD_C_SIZE_W0;
+   offset = VIDOSD_C(win);
val = win_data->ovl_width * win_data->ovl_height;
writel(val, ctx->regs + offset);

-- 
1.8.0



[PATCH V3] drm/exynos: fimd: calculate the correct address offset

2013-03-07 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers based on exynos4 and exynos5 user manuals.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..f5f2b25 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -38,11 +38,12 @@
 /* position control register for hardware window 0, 2 ~ 4.*/
 #define VIDOSD_A(win)  (VIDOSD_BASE + 0x00 + (win) * 16)
 #define VIDOSD_B(win)  (VIDOSD_BASE + 0x04 + (win) * 16)
-/* size control register for hardware window 0. */
-#define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
-/* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
-/* size control register for hardware window 1 ~ 4. */
+/*
+ * size control register for hardware windows 0 and alpha control register
+ * for hardware windows 1 ~ 4
+ */
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
+/* size control register for hardware windows 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)

 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
@@ -50,9 +51,9 @@
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)

 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))

 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos)
if (win != 3 && win != 4) {
u32 offset = VIDOSD_D(win);
if (win == 0)
-   offset = VIDOSD_C_SIZE_W0;
+   offset = VIDOSD_C(win);
val = win_data->ovl_width * win_data->ovl_height;
writel(val, ctx->regs + offset);

-- 
1.8.0



[PATCH V3] drm/exynos: fimd: calculate the correct address offset

2013-03-07 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers based on exynos4 and exynos5 user manuals.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..f5f2b25 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -38,11 +38,12 @@
 /* position control register for hardware window 0, 2 ~ 4.*/
 #define VIDOSD_A(win)  (VIDOSD_BASE + 0x00 + (win) * 16)
 #define VIDOSD_B(win)  (VIDOSD_BASE + 0x04 + (win) * 16)
-/* size control register for hardware window 0. */
-#define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
-/* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
-/* size control register for hardware window 1 ~ 4. */
+/*
+ * size control register for hardware windows 0 and alpha control register
+ * for hardware windows 1 ~ 4
+ */
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
+/* size control register for hardware windows 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)
 
 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
@@ -50,9 +51,9 @@
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)
 
 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))
 
 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos)
if (win != 3  win != 4) {
u32 offset = VIDOSD_D(win);
if (win == 0)
-   offset = VIDOSD_C_SIZE_W0;
+   offset = VIDOSD_C(win);
val = win_data-ovl_width * win_data-ovl_height;
writel(val, ctx-regs + offset);
 
-- 
1.8.0

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


[PATCH V4] drm/exynos: fimd: calculate the correct address offset

2013-03-07 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers based on exynos4 and exynos5 user manuals.
Also remove VIDOSD_C_SIZE_W0 macro and fix comments about registers for
size and alpha.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
Acked-by: Joonyoung Shim jy0922.s...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..f5f2b25 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -38,11 +38,12 @@
 /* position control register for hardware window 0, 2 ~ 4.*/
 #define VIDOSD_A(win)  (VIDOSD_BASE + 0x00 + (win) * 16)
 #define VIDOSD_B(win)  (VIDOSD_BASE + 0x04 + (win) * 16)
-/* size control register for hardware window 0. */
-#define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
-/* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
-/* size control register for hardware window 1 ~ 4. */
+/*
+ * size control register for hardware windows 0 and alpha control register
+ * for hardware windows 1 ~ 4
+ */
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
+/* size control register for hardware windows 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)
 
 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
@@ -50,9 +51,9 @@
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)
 
 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))
 
 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -581,7 +582,7 @@ static void fimd_win_commit(struct device *dev, int zpos)
if (win != 3  win != 4) {
u32 offset = VIDOSD_D(win);
if (win == 0)
-   offset = VIDOSD_C_SIZE_W0;
+   offset = VIDOSD_C(win);
val = win_data-ovl_width * win_data-ovl_height;
writel(val, ctx-regs + offset);
 
-- 
1.8.0

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


[PATCH] drm/exynos: fimd: calculate the correct address offset

2013-03-06 Thread Leela Krishna Amudala
Hi

On Tue, Mar 5, 2013 at 5:47 PM, Joonyoung Shim  
wrote:
> On 03/05/2013 09:04 PM, Leela Krishna Amudala wrote:
>>
>> Hi,
>>
>> On Tue, Mar 5, 2013 at 5:24 PM, Joonyoung Shim 
>> wrote:
>>>
>>> Hi Leela,
>>>
>>>
>>> On 03/05/2013 08:25 PM, Leela Krishna Amudala wrote:
>>>>
>>>> Calculate the correct address offset values for alpha and color key
>>>> control registers
>>>>
>>>> Signed-off-by: Leela Krishna Amudala 
>>>> ---
>>>>drivers/gpu/drm/exynos/exynos_drm_fimd.c | 9 +
>>>>1 file changed, 5 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>>> index 9537761..71f4176 100644
>>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>>>> @@ -41,7 +41,7 @@
>>>>/* size control register for hardware window 0. */
>>>>#define VIDOSD_C_SIZE_W0  (VIDOSD_BASE + 0x08)
>>>
>>>
>>> How about just use VIDOSD_C(win) instead of this macro for size control
>>> register of windows0?
>>> I think it's better if writes comments properly here.
>>>
>> Then in that case
>> VIDOSD_C(0) will refer to Window 0 Size Control register
>> VIDOSD_C(1) will refer to Window 1 Alpha Control register
>> VIDOSD_C(2) will refer to Window 2 Alpha Control register
>> VIDOSD_C(3) will refer to Window 3 Alpha Control register
>> VIDOSD_C(4) will refer to Window 4 Alpha Control register
>> Which leads to a confusion.
>
>
> Because of confusion, we need correct comments.
>
Added appropriate comments and posted V2

>
>> IMHO keeping VIDOSD_C_SIZE_W0 separate for win 0 is good.
>>
>> Best Wishes,
>> Leela Krishna Amudala
>>
>>>>/* alpha control register for hardware window 1 ~ 4. */
>>>> -#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
>>>> +#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
>>>>/* size control register for hardware window 1 ~ 4. */
>>>>#define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16)
>>>>@@ -50,9 +50,9 @@
>>>>#define VIDWx_BUF_SIZE(win, buf)  (VIDW_BUF_SIZE(buf) + (win) *
>>>> 4)
>>>>  /* color key control register for hardware window 1 ~ 4. */
>>>> -#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
>>>> +#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) *
>>>> 8))
>>>>/* color key value register for hardware window 1 ~ 4. */
>>>> -#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
>>>> +#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) *
>>>> 8))
>>>>  /* FIMD has totally five hardware windows. */
>>>>#define WINDOWS_NR5
>>>> @@ -782,7 +782,8 @@ static void fimd_clear_win(struct fimd_context *ctx,
>>>> int win)
>>>>  writel(0, ctx->regs + WINCON(win));
>>>>  writel(0, ctx->regs + VIDOSD_A(win));
>>>>  writel(0, ctx->regs + VIDOSD_B(win));
>>>> -   writel(0, ctx->regs + VIDOSD_C(win));
>>>> +   if (win != 0)
>>>> +   writel(0, ctx->regs + VIDOSD_C(win));
>
>
> Then you need also to initialize VIDOSD_C_SIZE_W0 register.
>
Initialized and posted V2

Best Wishes,
Leela Krishna Amudala.

>
>>>
>>> If use VIDOSD_C(win) macro for size control register of windows0 then
>>> this
>>> fix will be unnecessary.
>>>
>>> Thanks.
>>>
>>> ___
>>> dri-devel mailing list
>>> dri-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V2] drm/exynos: fimd: calculate the correct address offset

2013-03-06 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers and clear size control register for window 0

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..78bab4a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -38,21 +38,22 @@
 /* position control register for hardware window 0, 2 ~ 4.*/
 #define VIDOSD_A(win)  (VIDOSD_BASE + 0x00 + (win) * 16)
 #define VIDOSD_B(win)  (VIDOSD_BASE + 0x04 + (win) * 16)
+/* size control register is avaliable only for windows 0, 1 and 2. */
 /* size control register for hardware window 0. */
 #define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
-/* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
-/* size control register for hardware window 1 ~ 4. */
+/* size control register for hardware window 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)
+/* alpha control register for hardware window 1 ~ 4. */
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)

 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
 #define VIDWx_BUF_END(win, buf)(VIDW_BUF_END(buf) + (win) * 8)
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)

 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))

 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -782,11 +783,14 @@ static void fimd_clear_win(struct fimd_context *ctx, int 
win)
writel(0, ctx->regs + WINCON(win));
writel(0, ctx->regs + VIDOSD_A(win));
writel(0, ctx->regs + VIDOSD_B(win));
-   writel(0, ctx->regs + VIDOSD_C(win));
+   if (win != 0)
+   writel(0, ctx->regs + VIDOSD_C(win));

if (win == 1 || win == 2)
writel(0, ctx->regs + VIDOSD_D(win));

+   if (win == 0)
+   writel(0, ctx->regs + VIDOSD_C_SIZE_W0);
val = readl(ctx->regs + SHADOWCON);
val &= ~SHADOWCON_WINx_PROTECT(win);
writel(val, ctx->regs + SHADOWCON);
-- 
1.8.0



[PATCH] drm/exynos: fimd: calculate the correct address offset

2013-03-05 Thread Leela Krishna Amudala
Hi,

On Tue, Mar 5, 2013 at 5:24 PM, Joonyoung Shim  
wrote:
> Hi Leela,
>
>
> On 03/05/2013 08:25 PM, Leela Krishna Amudala wrote:
>>
>> Calculate the correct address offset values for alpha and color key
>> control registers
>>
>> Signed-off-by: Leela Krishna Amudala 
>> ---
>>   drivers/gpu/drm/exynos/exynos_drm_fimd.c | 9 +
>>   1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 9537761..71f4176 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -41,7 +41,7 @@
>>   /* size control register for hardware window 0. */
>>   #define VIDOSD_C_SIZE_W0  (VIDOSD_BASE + 0x08)
>
>
> How about just use VIDOSD_C(win) instead of this macro for size control
> register of windows0?
> I think it's better if writes comments properly here.
>

Then in that case
VIDOSD_C(0) will refer to Window 0 Size Control register
VIDOSD_C(1) will refer to Window 1 Alpha Control register
VIDOSD_C(2) will refer to Window 2 Alpha Control register
VIDOSD_C(3) will refer to Window 3 Alpha Control register
VIDOSD_C(4) will refer to Window 4 Alpha Control register
Which leads to a confusion.

IMHO keeping VIDOSD_C_SIZE_W0 separate for win 0 is good.

Best Wishes,
Leela Krishna Amudala

>
>>   /* alpha control register for hardware window 1 ~ 4. */
>> -#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
>> +#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
>>   /* size control register for hardware window 1 ~ 4. */
>>   #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16)
>>   @@ -50,9 +50,9 @@
>>   #define VIDWx_BUF_SIZE(win, buf)  (VIDW_BUF_SIZE(buf) + (win) * 4)
>> /* color key control register for hardware window 1 ~ 4. */
>> -#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
>> +#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) *
>> 8))
>>   /* color key value register for hardware window 1 ~ 4. */
>> -#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
>> +#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) *
>> 8))
>> /* FIMD has totally five hardware windows. */
>>   #define WINDOWS_NR5
>> @@ -782,7 +782,8 @@ static void fimd_clear_win(struct fimd_context *ctx,
>> int win)
>> writel(0, ctx->regs + WINCON(win));
>> writel(0, ctx->regs + VIDOSD_A(win));
>> writel(0, ctx->regs + VIDOSD_B(win));
>> -   writel(0, ctx->regs + VIDOSD_C(win));
>> +   if (win != 0)
>> +   writel(0, ctx->regs + VIDOSD_C(win));
>
>
> If use VIDOSD_C(win) macro for size control register of windows0 then this
> fix will be unnecessary.
>
> Thanks.
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/exynos: fimd: calculate the correct address offset

2013-03-05 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..71f4176 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -41,7 +41,7 @@
 /* size control register for hardware window 0. */
 #define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
 /* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
 /* size control register for hardware window 1 ~ 4. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)

@@ -50,9 +50,9 @@
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)

 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))

 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -782,7 +782,8 @@ static void fimd_clear_win(struct fimd_context *ctx, int 
win)
writel(0, ctx->regs + WINCON(win));
writel(0, ctx->regs + VIDOSD_A(win));
writel(0, ctx->regs + VIDOSD_B(win));
-   writel(0, ctx->regs + VIDOSD_C(win));
+   if (win != 0)
+   writel(0, ctx->regs + VIDOSD_C(win));

if (win == 1 || win == 2)
writel(0, ctx->regs + VIDOSD_D(win));
-- 
1.8.0



[PATCH] drm/exynos: fimd: calculate the correct address offset

2013-03-05 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..71f4176 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -41,7 +41,7 @@
 /* size control register for hardware window 0. */
 #define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
 /* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
 /* size control register for hardware window 1 ~ 4. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)
 
@@ -50,9 +50,9 @@
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)
 
 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))
 
 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -782,7 +782,8 @@ static void fimd_clear_win(struct fimd_context *ctx, int 
win)
writel(0, ctx-regs + WINCON(win));
writel(0, ctx-regs + VIDOSD_A(win));
writel(0, ctx-regs + VIDOSD_B(win));
-   writel(0, ctx-regs + VIDOSD_C(win));
+   if (win != 0)
+   writel(0, ctx-regs + VIDOSD_C(win));
 
if (win == 1 || win == 2)
writel(0, ctx-regs + VIDOSD_D(win));
-- 
1.8.0

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


Re: [PATCH] drm/exynos: fimd: calculate the correct address offset

2013-03-05 Thread Leela Krishna Amudala
Hi,

On Tue, Mar 5, 2013 at 5:24 PM, Joonyoung Shim jy0922.s...@samsung.com wrote:
 Hi Leela,


 On 03/05/2013 08:25 PM, Leela Krishna Amudala wrote:

 Calculate the correct address offset values for alpha and color key
 control registers

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
   drivers/gpu/drm/exynos/exynos_drm_fimd.c | 9 +
   1 file changed, 5 insertions(+), 4 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 9537761..71f4176 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -41,7 +41,7 @@
   /* size control register for hardware window 0. */
   #define VIDOSD_C_SIZE_W0  (VIDOSD_BASE + 0x08)


 How about just use VIDOSD_C(win) instead of this macro for size control
 register of windows0?
 I think it's better if writes comments properly here.


Then in that case
VIDOSD_C(0) will refer to Window 0 Size Control register
VIDOSD_C(1) will refer to Window 1 Alpha Control register
VIDOSD_C(2) will refer to Window 2 Alpha Control register
VIDOSD_C(3) will refer to Window 3 Alpha Control register
VIDOSD_C(4) will refer to Window 4 Alpha Control register
Which leads to a confusion.

IMHO keeping VIDOSD_C_SIZE_W0 separate for win 0 is good.

Best Wishes,
Leela Krishna Amudala


   /* alpha control register for hardware window 1 ~ 4. */
 -#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
 +#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
   /* size control register for hardware window 1 ~ 4. */
   #define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16)
   @@ -50,9 +50,9 @@
   #define VIDWx_BUF_SIZE(win, buf)  (VIDW_BUF_SIZE(buf) + (win) * 4)
 /* color key control register for hardware window 1 ~ 4. */
 -#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
 +#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) *
 8))
   /* color key value register for hardware window 1 ~ 4. */
 -#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
 +#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) *
 8))
 /* FIMD has totally five hardware windows. */
   #define WINDOWS_NR5
 @@ -782,7 +782,8 @@ static void fimd_clear_win(struct fimd_context *ctx,
 int win)
 writel(0, ctx-regs + WINCON(win));
 writel(0, ctx-regs + VIDOSD_A(win));
 writel(0, ctx-regs + VIDOSD_B(win));
 -   writel(0, ctx-regs + VIDOSD_C(win));
 +   if (win != 0)
 +   writel(0, ctx-regs + VIDOSD_C(win));


 If use VIDOSD_C(win) macro for size control register of windows0 then this
 fix will be unnecessary.

 Thanks.

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


Re: [PATCH] drm/exynos: fimd: calculate the correct address offset

2013-03-05 Thread Leela Krishna Amudala
Hi

On Tue, Mar 5, 2013 at 5:47 PM, Joonyoung Shim jy0922.s...@samsung.com wrote:
 On 03/05/2013 09:04 PM, Leela Krishna Amudala wrote:

 Hi,

 On Tue, Mar 5, 2013 at 5:24 PM, Joonyoung Shim jy0922.s...@samsung.com
 wrote:

 Hi Leela,


 On 03/05/2013 08:25 PM, Leela Krishna Amudala wrote:

 Calculate the correct address offset values for alpha and color key
 control registers

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 9 +
1 file changed, 5 insertions(+), 4 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 9537761..71f4176 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -41,7 +41,7 @@
/* size control register for hardware window 0. */
#define VIDOSD_C_SIZE_W0  (VIDOSD_BASE + 0x08)


 How about just use VIDOSD_C(win) instead of this macro for size control
 register of windows0?
 I think it's better if writes comments properly here.

 Then in that case
 VIDOSD_C(0) will refer to Window 0 Size Control register
 VIDOSD_C(1) will refer to Window 1 Alpha Control register
 VIDOSD_C(2) will refer to Window 2 Alpha Control register
 VIDOSD_C(3) will refer to Window 3 Alpha Control register
 VIDOSD_C(4) will refer to Window 4 Alpha Control register
 Which leads to a confusion.


 Because of confusion, we need correct comments.

Added appropriate comments and posted V2


 IMHO keeping VIDOSD_C_SIZE_W0 separate for win 0 is good.

 Best Wishes,
 Leela Krishna Amudala

/* alpha control register for hardware window 1 ~ 4. */
 -#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
 +#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
/* size control register for hardware window 1 ~ 4. */
#define VIDOSD_D(win) (VIDOSD_BASE + 0x0C + (win) * 16)
@@ -50,9 +50,9 @@
#define VIDWx_BUF_SIZE(win, buf)  (VIDW_BUF_SIZE(buf) + (win) *
 4)
  /* color key control register for hardware window 1 ~ 4. */
 -#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
 +#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) *
 8))
/* color key value register for hardware window 1 ~ 4. */
 -#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
 +#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) *
 8))
  /* FIMD has totally five hardware windows. */
#define WINDOWS_NR5
 @@ -782,7 +782,8 @@ static void fimd_clear_win(struct fimd_context *ctx,
 int win)
  writel(0, ctx-regs + WINCON(win));
  writel(0, ctx-regs + VIDOSD_A(win));
  writel(0, ctx-regs + VIDOSD_B(win));
 -   writel(0, ctx-regs + VIDOSD_C(win));
 +   if (win != 0)
 +   writel(0, ctx-regs + VIDOSD_C(win));


 Then you need also to initialize VIDOSD_C_SIZE_W0 register.

Initialized and posted V2

Best Wishes,
Leela Krishna Amudala.



 If use VIDOSD_C(win) macro for size control register of windows0 then
 this
 fix will be unnecessary.

 Thanks.

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


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


[PATCH V2] drm/exynos: fimd: calculate the correct address offset

2013-03-05 Thread Leela Krishna Amudala
Calculate the correct address offset values for alpha and color key
control registers and clear size control register for window 0

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..78bab4a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -38,21 +38,22 @@
 /* position control register for hardware window 0, 2 ~ 4.*/
 #define VIDOSD_A(win)  (VIDOSD_BASE + 0x00 + (win) * 16)
 #define VIDOSD_B(win)  (VIDOSD_BASE + 0x04 + (win) * 16)
+/* size control register is avaliable only for windows 0, 1 and 2. */
 /* size control register for hardware window 0. */
 #define VIDOSD_C_SIZE_W0   (VIDOSD_BASE + 0x08)
-/* alpha control register for hardware window 1 ~ 4. */
-#define VIDOSD_C(win)  (VIDOSD_BASE + 0x18 + (win) * 16)
-/* size control register for hardware window 1 ~ 4. */
+/* size control register for hardware window 1 ~ 2. */
 #define VIDOSD_D(win)  (VIDOSD_BASE + 0x0C + (win) * 16)
+/* alpha control register for hardware window 1 ~ 4. */
+#define VIDOSD_C(win)  (VIDOSD_BASE + 0x08 + (win) * 16)
 
 #define VIDWx_BUF_START(win, buf)  (VIDW_BUF_START(buf) + (win) * 8)
 #define VIDWx_BUF_END(win, buf)(VIDW_BUF_END(buf) + (win) * 8)
 #define VIDWx_BUF_SIZE(win, buf)   (VIDW_BUF_SIZE(buf) + (win) * 4)
 
 /* color key control register for hardware window 1 ~ 4. */
-#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + (x * 8))
+#define WKEYCON0_BASE(x)   ((WKEYCON0 + 0x140) + ((x - 1) * 8))
 /* color key value register for hardware window 1 ~ 4. */
-#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + (x * 8))
+#define WKEYCON1_BASE(x)   ((WKEYCON1 + 0x140) + ((x - 1) * 8))
 
 /* FIMD has totally five hardware windows. */
 #define WINDOWS_NR 5
@@ -782,11 +783,14 @@ static void fimd_clear_win(struct fimd_context *ctx, int 
win)
writel(0, ctx-regs + WINCON(win));
writel(0, ctx-regs + VIDOSD_A(win));
writel(0, ctx-regs + VIDOSD_B(win));
-   writel(0, ctx-regs + VIDOSD_C(win));
+   if (win != 0)
+   writel(0, ctx-regs + VIDOSD_C(win));
 
if (win == 1 || win == 2)
writel(0, ctx-regs + VIDOSD_D(win));
 
+   if (win == 0)
+   writel(0, ctx-regs + VIDOSD_C_SIZE_W0);
val = readl(ctx-regs + SHADOWCON);
val = ~SHADOWCON_WINx_PROTECT(win);
writel(val, ctx-regs + SHADOWCON);
-- 
1.8.0

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


[PATCH 0/1] Adds display-timing node parsing to exynos drm fimd

2013-01-30 Thread Leela Krishna Amudala
Hello Sean,
This patch set will be abandoned and your comments will be addressed
in reply to
http://lists.freedesktop.org/archives/dri-devel/2013-January/034080.html

Thanks,
Leela Krishna Amudala.

On Tue, Jan 29, 2013 at 1:42 PM, Leela Krishna Amudala
 wrote:
> This patch adds display-timing node parsing to drm fimd, this depends on
> the display helper patchset at
> http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html
>
> Patch is based on branch "exynos-drm-next" at
> http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git/
>
> It is tested on Exynos5250 and Exynos4412 board by applying dependent patches 
> available at
> http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html
>
> Leela Krishna Amudala (1):
>   video: drm: exynos: Adds display-timing node parsing using video
> helper function
>
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++
>  1 file changed, 27 insertions(+), 4 deletions(-)
>
> --
> 1.8.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-29 Thread Leela Krishna Amudala
This patch adds display-timing node parsing using video helper function

Signed-off-by: Leela Krishna Amudala 
Tested-by: Vikas Sajjan 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..19dc842 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -876,6 +876,8 @@ static int fimd_probe(struct platform_device *pdev)
struct fimd_context *ctx;
struct exynos_drm_subdrv *subdrv;
struct exynos_drm_fimd_pdata *pdata;
+   struct fb_videomode *fbmode;
+   struct device *disp_dev = >dev;
struct exynos_drm_panel_info *panel;
struct resource *res;
int win;
@@ -883,10 +885,31 @@ static int fimd_probe(struct platform_device *pdev)

DRM_DEBUG_KMS("%s\n", __FILE__);

-   pdata = pdev->dev.platform_data;
-   if (!pdata) {
-   dev_err(dev, "no platform data specified\n");
-   return -EINVAL;
+   if (pdev->dev.of_node) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   DRM_ERROR("memory allocation for pdata failed\n");
+   return -ENOMEM;
+   }
+
+   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
+   if (!fbmode) {
+   DRM_ERROR("memory allocation for fbmode failed\n");
+   return -ENOMEM;
+   }
+
+   ret = of_get_fb_videomode(disp_dev->of_node, fbmode, -1);
+   if (ret) {
+   DRM_ERROR("failed to get fb_videomode\n");
+   return -EINVAL;
+   }
+   pdata->panel.timing = (struct fb_videomode) *fbmode;
+   } else {
+   pdata = pdev->dev.platform_data;
+   if (!pdata) {
+   DRM_ERROR("no platform data specified\n");
+   return -EINVAL;
+   }
}

panel = >panel;
-- 
1.8.0



[PATCH 0/1] Adds display-timing node parsing to exynos drm fimd

2013-01-29 Thread Leela Krishna Amudala
This patch adds display-timing node parsing to drm fimd, this depends on
the display helper patchset at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

Patch is based on branch "exynos-drm-next" at
http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git/

It is tested on Exynos5250 and Exynos4412 board by applying dependent patches 
available at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

Leela Krishna Amudala (1):
  video: drm: exynos: Adds display-timing node parsing using video
helper function

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

-- 
1.8.0



[PATCH 0/1] Adds display-timing node parsing to exynos drm fimd

2013-01-29 Thread Leela Krishna Amudala
This patch adds display-timing node parsing to drm fimd, this depends on
the display helper patchset at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

Patch is based on branch exynos-drm-next at
http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git/

It is tested on Exynos5250 and Exynos4412 board by applying dependent patches 
available at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

Leela Krishna Amudala (1):
  video: drm: exynos: Adds display-timing node parsing using video
helper function

 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

-- 
1.8.0

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


[PATCH 1/1] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-29 Thread Leela Krishna Amudala
This patch adds display-timing node parsing using video helper function

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
Tested-by: Vikas Sajjan vikas.saj...@linaro.org
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 9537761..19dc842 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -876,6 +876,8 @@ static int fimd_probe(struct platform_device *pdev)
struct fimd_context *ctx;
struct exynos_drm_subdrv *subdrv;
struct exynos_drm_fimd_pdata *pdata;
+   struct fb_videomode *fbmode;
+   struct device *disp_dev = pdev-dev;
struct exynos_drm_panel_info *panel;
struct resource *res;
int win;
@@ -883,10 +885,31 @@ static int fimd_probe(struct platform_device *pdev)
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(dev, no platform data specified\n);
-   return -EINVAL;
+   if (pdev-dev.of_node) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   DRM_ERROR(memory allocation for pdata failed\n);
+   return -ENOMEM;
+   }
+
+   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
+   if (!fbmode) {
+   DRM_ERROR(memory allocation for fbmode failed\n);
+   return -ENOMEM;
+   }
+
+   ret = of_get_fb_videomode(disp_dev-of_node, fbmode, -1);
+   if (ret) {
+   DRM_ERROR(failed to get fb_videomode\n);
+   return -EINVAL;
+   }
+   pdata-panel.timing = (struct fb_videomode) *fbmode;
+   } else {
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   DRM_ERROR(no platform data specified\n);
+   return -EINVAL;
+   }
}
 
panel = pdata-panel;
-- 
1.8.0

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


Re: [PATCH 0/1] Adds display-timing node parsing to exynos drm fimd

2013-01-29 Thread Leela Krishna Amudala
Hello Sean,
This patch set will be abandoned and your comments will be addressed
in reply to
http://lists.freedesktop.org/archives/dri-devel/2013-January/034080.html

Thanks,
Leela Krishna Amudala.

On Tue, Jan 29, 2013 at 1:42 PM, Leela Krishna Amudala
l.kris...@samsung.com wrote:
 This patch adds display-timing node parsing to drm fimd, this depends on
 the display helper patchset at
 http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

 Patch is based on branch exynos-drm-next at
 http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git/

 It is tested on Exynos5250 and Exynos4412 board by applying dependent patches 
 available at
 http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

 Leela Krishna Amudala (1):
   video: drm: exynos: Adds display-timing node parsing using video
 helper function

  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++
  1 file changed, 27 insertions(+), 4 deletions(-)

 --
 1.8.0

 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-28 Thread Leela Krishna Amudala
On Mon, Jan 28, 2013 at 9:24 PM, Sean Paul  wrote:
>
> On Mon, Jan 28, 2013 at 12:45 AM, Vikas Sajjan 
> wrote:
> > This patch adds display-timing node parsing using video helper function
> >
> > Signed-off-by: Leela Krishna Amudala 
> > Signed-off-by: Vikas Sajjan 
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   35
> > --
> >  1 file changed, 33 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > index bf0d9ba..975e7f7 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > @@ -19,6 +19,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >
> >  #include 
> >  #include 
> > @@ -903,21 +904,51 @@ static int __devinit fimd_probe(struct
> > platform_device *pdev)
> > struct device *dev = >dev;
> > struct fimd_context *ctx;
> > struct exynos_drm_subdrv *subdrv;
> > -   struct exynos_drm_fimd_pdata *pdata;
> > +   struct exynos_drm_fimd_pdata *pdata = pdev->dev.platform_data;
> > struct exynos_drm_panel_info *panel;
> > +   struct fb_videomode *fbmode;
> > +   struct device *disp_dev = >dev;
> > +   struct pinctrl *pctrl;
> > struct resource *res;
> > int win;
> > int ret = -EINVAL;
> >
> > DRM_DEBUG_KMS("%s\n", __FILE__);
> >
> > -   pdata = pdev->dev.platform_data;
> > +   if (pdev->dev.of_node) {
> > +   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> > +   if (!pdata) {
> > +   dev_err(dev, "memory allocation for pdata
> > failed\n");
> > +   return -ENOMEM;
> > +   }
> > +
> > +   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
> > +   if (!fbmode) {
> > +   dev_err(dev, "memory allocation for fbmode
> > failed\n");
>
> Why dev_err instead of DRM_ERROR?
>

Will change it to DRM_ERROR

> > +   return -ENOMEM;
> > +   }
> > +
> > +   ret = of_get_fb_videomode(disp_dev->of_node, fbmode,
> > -1);
> > +   if (ret) {
> > +   dev_err(dev, "failed to get fb_videomode\n");
> > +   return -EINVAL;
> > +   }
> > +   pdata->panel.timing = (struct fb_videomode) *fbmode;
> > +   }
> > +
> > if (!pdata) {
>
> This condition is kind of weird, in that it's really checking if
> (!pdev->dev.of_node) implicitly (since you already check the
> allocation of pdata above).
>
Even I thought the same. But kept this check because If DT node is
not available and driver still gets plat data from machine file then the
if (pdev->dev.of_node){} block will be skipped and plat data should be checked.

> Seems like you could make this more clear and save a level of
> indentation by doing the following above:
>
> if (!pdev->dev.of_node) {
> DRM_ERROR("Device tree node was not found\n");
> return -EINVAL;
> }
>
If I return -EINVAL here then this driver will become Full DT based one.
and probe will be failed if DT node is not present.

Will correct the if check and post the next version.

/Leela Krishna Amudala
> Then just get rid of this check and the one wrapping the allocations
> above.
>
> Sean
>
> > dev_err(dev, "no platform data specified\n");
> > return -EINVAL;
> > }
> >
> > +   pctrl = devm_pinctrl_get_select_default(dev);
> > +   if (IS_ERR(pctrl)) {
> > +   dev_err(dev, "no pinctrl data provided.\n");
> > +   return -EINVAL;
> > +   }
> > +
> > panel = >panel;
> > +
> > if (!panel) {
> > dev_err(dev, "panel is null.\n");
> > return -EINVAL;
> > --
> > 1.7.9.5
> >
> > ___
> > dri-devel mailing list
> > dri-devel at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-28 Thread Leela Krishna Amudala
Hello Vikas,

On Mon, Jan 28, 2013 at 11:15 AM, Vikas Sajjan  
wrote:
> This patch adds display-timing node parsing using video helper function
>
> Signed-off-by: Leela Krishna Amudala 
> Signed-off-by: Vikas Sajjan 
> ---
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   35 
> --
>  1 file changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> index bf0d9ba..975e7f7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> @@ -19,6 +19,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>  #include 
> @@ -903,21 +904,51 @@ static int __devinit fimd_probe(struct platform_device 
> *pdev)
> struct device *dev = >dev;
> struct fimd_context *ctx;
> struct exynos_drm_subdrv *subdrv;
> -   struct exynos_drm_fimd_pdata *pdata;
> +   struct exynos_drm_fimd_pdata *pdata = pdev->dev.platform_data;
> struct exynos_drm_panel_info *panel;
> +   struct fb_videomode *fbmode;
> +   struct device *disp_dev = >dev;
> +   struct pinctrl *pctrl;
> struct resource *res;
> int win;
> int ret = -EINVAL;
>
> DRM_DEBUG_KMS("%s\n", __FILE__);
>
> -   pdata = pdev->dev.platform_data;
> +   if (pdev->dev.of_node) {
> +   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> +   if (!pdata) {
> +   dev_err(dev, "memory allocation for pdata failed\n");
> +   return -ENOMEM;
> +   }
> +
> +   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
> +   if (!fbmode) {
> +   dev_err(dev, "memory allocation for fbmode failed\n");
> +   return -ENOMEM;
> +   }
> +
> +   ret = of_get_fb_videomode(disp_dev->of_node, fbmode, -1);
> +   if (ret) {
> +   dev_err(dev, "failed to get fb_videomode\n");
> +   return -EINVAL;
> +   }
> +   pdata->panel.timing = (struct fb_videomode) *fbmode;
> +   }
> +
> if (!pdata) {
> dev_err(dev, "no platform data specified\n");
> return -EINVAL;
> }
>
> +   pctrl = devm_pinctrl_get_select_default(dev);

Where this "pctrl" variable is being used?

> +   if (IS_ERR(pctrl)) {
> +   dev_err(dev, "no pinctrl data provided.\n");
> +   return -EINVAL;
> +   }
> +
> panel = >panel;
> +
> if (!panel) {
> dev_err(dev, "panel is null.\n");
> return -EINVAL;
> --
> 1.7.9.5
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-28 Thread Leela Krishna Amudala
Hello Vikas,

On Mon, Jan 28, 2013 at 11:15 AM, Vikas Sajjan vikas.saj...@linaro.org wrote:
 This patch adds display-timing node parsing using video helper function

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org
 ---
  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   35 
 --
  1 file changed, 33 insertions(+), 2 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index bf0d9ba..975e7f7 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -19,6 +19,7 @@
  #include linux/clk.h
  #include linux/of_device.h
  #include linux/pm_runtime.h
 +#include linux/pinctrl/consumer.h

  #include video/samsung_fimd.h
  #include drm/exynos_drm.h
 @@ -903,21 +904,51 @@ static int __devinit fimd_probe(struct platform_device 
 *pdev)
 struct device *dev = pdev-dev;
 struct fimd_context *ctx;
 struct exynos_drm_subdrv *subdrv;
 -   struct exynos_drm_fimd_pdata *pdata;
 +   struct exynos_drm_fimd_pdata *pdata = pdev-dev.platform_data;
 struct exynos_drm_panel_info *panel;
 +   struct fb_videomode *fbmode;
 +   struct device *disp_dev = pdev-dev;
 +   struct pinctrl *pctrl;
 struct resource *res;
 int win;
 int ret = -EINVAL;

 DRM_DEBUG_KMS(%s\n, __FILE__);

 -   pdata = pdev-dev.platform_data;
 +   if (pdev-dev.of_node) {
 +   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
 +   if (!pdata) {
 +   dev_err(dev, memory allocation for pdata failed\n);
 +   return -ENOMEM;
 +   }
 +
 +   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
 +   if (!fbmode) {
 +   dev_err(dev, memory allocation for fbmode failed\n);
 +   return -ENOMEM;
 +   }
 +
 +   ret = of_get_fb_videomode(disp_dev-of_node, fbmode, -1);
 +   if (ret) {
 +   dev_err(dev, failed to get fb_videomode\n);
 +   return -EINVAL;
 +   }
 +   pdata-panel.timing = (struct fb_videomode) *fbmode;
 +   }
 +
 if (!pdata) {
 dev_err(dev, no platform data specified\n);
 return -EINVAL;
 }

 +   pctrl = devm_pinctrl_get_select_default(dev);

Where this pctrl variable is being used?

 +   if (IS_ERR(pctrl)) {
 +   dev_err(dev, no pinctrl data provided.\n);
 +   return -EINVAL;
 +   }
 +
 panel = pdata-panel;
 +
 if (!panel) {
 dev_err(dev, panel is null.\n);
 return -EINVAL;
 --
 1.7.9.5

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


Re: [PATCH] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-28 Thread Leela Krishna Amudala
On Mon, Jan 28, 2013 at 9:24 PM, Sean Paul seanp...@chromium.org wrote:

 On Mon, Jan 28, 2013 at 12:45 AM, Vikas Sajjan vikas.saj...@linaro.org
 wrote:
  This patch adds display-timing node parsing using video helper function
 
  Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
  Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org
  ---
   drivers/gpu/drm/exynos/exynos_drm_fimd.c |   35
  --
   1 file changed, 33 insertions(+), 2 deletions(-)
 
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  index bf0d9ba..975e7f7 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  @@ -19,6 +19,7 @@
   #include linux/clk.h
   #include linux/of_device.h
   #include linux/pm_runtime.h
  +#include linux/pinctrl/consumer.h
 
   #include video/samsung_fimd.h
   #include drm/exynos_drm.h
  @@ -903,21 +904,51 @@ static int __devinit fimd_probe(struct
  platform_device *pdev)
  struct device *dev = pdev-dev;
  struct fimd_context *ctx;
  struct exynos_drm_subdrv *subdrv;
  -   struct exynos_drm_fimd_pdata *pdata;
  +   struct exynos_drm_fimd_pdata *pdata = pdev-dev.platform_data;
  struct exynos_drm_panel_info *panel;
  +   struct fb_videomode *fbmode;
  +   struct device *disp_dev = pdev-dev;
  +   struct pinctrl *pctrl;
  struct resource *res;
  int win;
  int ret = -EINVAL;
 
  DRM_DEBUG_KMS(%s\n, __FILE__);
 
  -   pdata = pdev-dev.platform_data;
  +   if (pdev-dev.of_node) {
  +   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
  +   if (!pdata) {
  +   dev_err(dev, memory allocation for pdata
  failed\n);
  +   return -ENOMEM;
  +   }
  +
  +   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
  +   if (!fbmode) {
  +   dev_err(dev, memory allocation for fbmode
  failed\n);

 Why dev_err instead of DRM_ERROR?


Will change it to DRM_ERROR

  +   return -ENOMEM;
  +   }
  +
  +   ret = of_get_fb_videomode(disp_dev-of_node, fbmode,
  -1);
  +   if (ret) {
  +   dev_err(dev, failed to get fb_videomode\n);
  +   return -EINVAL;
  +   }
  +   pdata-panel.timing = (struct fb_videomode) *fbmode;
  +   }
  +
  if (!pdata) {

 This condition is kind of weird, in that it's really checking if
 (!pdev-dev.of_node) implicitly (since you already check the
 allocation of pdata above).

Even I thought the same. But kept this check because If DT node is
not available and driver still gets plat data from machine file then the
if (pdev-dev.of_node){} block will be skipped and plat data should be checked.

 Seems like you could make this more clear and save a level of
 indentation by doing the following above:

 if (!pdev-dev.of_node) {
 DRM_ERROR(Device tree node was not found\n);
 return -EINVAL;
 }

If I return -EINVAL here then this driver will become Full DT based one.
and probe will be failed if DT node is not present.

Will correct the if check and post the next version.

/Leela Krishna Amudala
 Then just get rid of this check and the one wrapping the allocations
 above.

 Sean

  dev_err(dev, no platform data specified\n);
  return -EINVAL;
  }
 
  +   pctrl = devm_pinctrl_get_select_default(dev);
  +   if (IS_ERR(pctrl)) {
  +   dev_err(dev, no pinctrl data provided.\n);
  +   return -EINVAL;
  +   }
  +
  panel = pdata-panel;
  +
  if (!panel) {
  dev_err(dev, panel is null.\n);
  return -EINVAL;
  --
  1.7.9.5
 
  ___
  dri-devel mailing list
  dri-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/dri-devel
 ___
 dri-devel mailing list
 dri-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v16 RESEND 0/7] of: add display helper

2013-01-24 Thread Leela Krishna Amudala
Steffen,

You can add my tested-by for this series.. :)
I have been using them for Exynos: smdk5250 board.

On Wed, Jan 23, 2013 at 2:42 PM, Steffen Trumtrar
 wrote:
> On Tue, Jan 22, 2013 at 03:50:48PM -0600, Rob Clark wrote:
>> On Mon, Jan 21, 2013 at 5:07 AM, Steffen Trumtrar
>>  wrote:
>> > Hi!
>> >
>> > There was still no maintainer, that commented, ack'd, nack'd, apply'd the
>> > series. So, this is just a resend.
>> > The patches were tested with:
>> >
>> > - v15 on Tegra by Thierry
>> > - sh-mobile-lcdcfb by Laurent
>> > - MX53QSB by Marek
>> > - Exynos: smdk5250 by Leela
>> > - AM335X EVM & AM335X EVM-SK by Afzal
>> > - imx6q: sabrelite, sabresd by Philipp and me
>> > - imx53: tqma53/mba53 by me
>>
>>
>> btw, you can add my tested-by for this series..  I've been using them
>> for the tilcdc lcd-panel output driver support.
>>
>
> Thanks. The more drivers the merrier ;-)
>
> Steffen
>
>> >
>> >
>> > Changes since v15:
>> > - move include/linux/{videomode,display_timing}.h to include/video
>> > - move include/linux/of_{videomode,display_timing}.h to 
>> > include/video
>> > - reimplement flags: add VESA flags and data flags
>> > - let pixelclock in struct videomode be unsigned long
>> > - rename of_display_timings_exists to of_display_timings_exist
>> > - revise logging/error messages: replace __func__ with 
>> > np->full_name
>> > - rename pixelclk-inverted to pixelclk-active
>> > - revise comments in code
>> >
>> > Changes since v14:
>> > - fix "const struct *" warning
>> > (reported by: Leela Krishna Amudala > > samsung.com>)
>> > - return -EINVAL when htotal or vtotal are zero
>> > - remove unreachable code in of_get_display_timings
>> > - include headers in .c files and not implicit in .h
>> > - sort includes alphabetically
>> > - fix lower/uppercase in binding documentation
>> > - rebase onto v3.7-rc7
>> >
>> > Changes since v13:
>> > - fix "const struct *" warning
>> > (reported by: Laurent Pinchart > > ideasonboard.com>)
>> > - prevent division by zero in fb_videomode_from_videomode
>> >
>> > Changes since v12:
>> > - rename struct display_timing to via_display_timing in via 
>> > subsystem
>> > - fix refreshrate calculation
>> > - fix "const struct *" warnings
>> > (reported by: Manjunathappa, Prakash > > ti.com>)
>> > - some CodingStyle fixes
>> > - rewrite parts of commit messages and display-timings.txt
>> > - let display_timing_get_value get all values instead of just 
>> > typical
>> >
>> > Changes since v11:
>> > - make pointers const where applicable
>> > - add reviewed-by Laurent Pinchart
>> >
>> > Changes since v10:
>> > - fix function name (drm_)display_mode_from_videomode
>> > - add acked-by, reviewed-by, tested-by
>> >
>> > Changes since v9:
>> > - don't leak memory when previous timings were correct
>> > - CodingStyle fixes
>> > - move blank lines around
>> >
>> > Changes since v8:
>> > - fix memory leaks
>> > - change API to be more consistent (foo_from_bar(struct bar, 
>> > struct foo))
>> > - include headers were necessary
>> > - misc minor bugfixes
>> >
>> > Changes since v7:
>> > - move of_xxx to drivers/video
>> > - remove non-binding documentation from display-timings.txt
>> > - squash display_timings and videomode in one patch
>> > - misc minor fixes
>> >
>> > Changes since v6:
>> > - get rid of some empty lines etc.
>> > - move functions to their subsystems
>> > - split of_ from non-of_ functions
>> > - add at least some kerneldoc to some functions
>> >
>> > Changes since v5:
>> > - removed all display stuff and just describe timings
>> >
>> > Changes since v4:
>> > - refactored functions
>> >

Re: [PATCH v16 RESEND 0/7] of: add display helper

2013-01-23 Thread Leela Krishna Amudala
Steffen,

You can add my tested-by for this series.. :)
I have been using them for Exynos: smdk5250 board.

On Wed, Jan 23, 2013 at 2:42 PM, Steffen Trumtrar
s.trumt...@pengutronix.de wrote:
 On Tue, Jan 22, 2013 at 03:50:48PM -0600, Rob Clark wrote:
 On Mon, Jan 21, 2013 at 5:07 AM, Steffen Trumtrar
 s.trumt...@pengutronix.de wrote:
  Hi!
 
  There was still no maintainer, that commented, ack'd, nack'd, apply'd the
  series. So, this is just a resend.
  The patches were tested with:
 
  - v15 on Tegra by Thierry
  - sh-mobile-lcdcfb by Laurent
  - MX53QSB by Marek
  - Exynos: smdk5250 by Leela
  - AM335X EVM  AM335X EVM-SK by Afzal
  - imx6q: sabrelite, sabresd by Philipp and me
  - imx53: tqma53/mba53 by me


 btw, you can add my tested-by for this series..  I've been using them
 for the tilcdc lcd-panel output driver support.


 Thanks. The more drivers the merrier ;-)

 Steffen

 
 
  Changes since v15:
  - move include/linux/{videomode,display_timing}.h to include/video
  - move include/linux/of_{videomode,display_timing}.h to 
  include/video
  - reimplement flags: add VESA flags and data flags
  - let pixelclock in struct videomode be unsigned long
  - rename of_display_timings_exists to of_display_timings_exist
  - revise logging/error messages: replace __func__ with 
  np-full_name
  - rename pixelclk-inverted to pixelclk-active
  - revise comments in code
 
  Changes since v14:
  - fix const struct * warning
  (reported by: Leela Krishna Amudala 
  l.kris...@samsung.com)
  - return -EINVAL when htotal or vtotal are zero
  - remove unreachable code in of_get_display_timings
  - include headers in .c files and not implicit in .h
  - sort includes alphabetically
  - fix lower/uppercase in binding documentation
  - rebase onto v3.7-rc7
 
  Changes since v13:
  - fix const struct * warning
  (reported by: Laurent Pinchart 
  laurent.pinch...@ideasonboard.com)
  - prevent division by zero in fb_videomode_from_videomode
 
  Changes since v12:
  - rename struct display_timing to via_display_timing in via 
  subsystem
  - fix refreshrate calculation
  - fix const struct * warnings
  (reported by: Manjunathappa, Prakash prakash...@ti.com)
  - some CodingStyle fixes
  - rewrite parts of commit messages and display-timings.txt
  - let display_timing_get_value get all values instead of just 
  typical
 
  Changes since v11:
  - make pointers const where applicable
  - add reviewed-by Laurent Pinchart
 
  Changes since v10:
  - fix function name (drm_)display_mode_from_videomode
  - add acked-by, reviewed-by, tested-by
 
  Changes since v9:
  - don't leak memory when previous timings were correct
  - CodingStyle fixes
  - move blank lines around
 
  Changes since v8:
  - fix memory leaks
  - change API to be more consistent (foo_from_bar(struct bar, 
  struct foo))
  - include headers were necessary
  - misc minor bugfixes
 
  Changes since v7:
  - move of_xxx to drivers/video
  - remove non-binding documentation from display-timings.txt
  - squash display_timings and videomode in one patch
  - misc minor fixes
 
  Changes since v6:
  - get rid of some empty lines etc.
  - move functions to their subsystems
  - split of_ from non-of_ functions
  - add at least some kerneldoc to some functions
 
  Changes since v5:
  - removed all display stuff and just describe timings
 
  Changes since v4:
  - refactored functions
 
  Changes since v3:
  - print error messages
  - free alloced memory
  - general cleanup
 
  Changes since v2:
  - use hardware-near property-names
  - provide a videomode structure
  - allow ranges for all properties (min,typ,max)
  - functions to get display_mode or fb_videomode
 
 
  Regards,
  Steffen
 
 
  Steffen Trumtrar (7):
viafb: rename display_timing to via_display_timing
video: add display_timing and videomode
video: add of helper for display timings/videomode
fbmon: add videomode helpers
fbmon: add of_videomode helpers
drm_modes: add videomode helpers
drm_modes: add of_videomode helpers
 
   .../devicetree/bindings/video/display-timing.txt   |  109 +
   drivers/gpu/drm/drm_modes.c|   70 ++
   drivers/video/Kconfig  |   21 ++
   drivers/video/Makefile |4 +
   drivers/video/display_timing.c |   24 ++
   drivers/video/fbmon.c  |   94 
   drivers/video/of_display_timing.c  |  239

[PATCH] [RFC] video: exynos dp: Making Exynos DP Compliant with CDF

2013-01-14 Thread Leela Krishna Amudala
Hello Sean,
Thanks for reviewing the patch.

On Sat, Jan 12, 2013 at 1:30 AM, Sean Paul  wrote:
> On Fri, Jan 11, 2013 at 5:35 AM, Leela Krishna Amudala
>  wrote:
>> The Exynos DP transmitter is treated as an end entity in the display pipeline
>> and made this RFC patch compliant with CDF.
>>
>> Any suggestions are welcome.
>>
>
> A few comments below. It's hard to get too much of an appreciation for
> what you're trying to do since a bunch of the interesting parts are
> stubbed out.
>
>> Signed-off-by: Leela Krishna Amudala 
>> ---
>>  drivers/video/display/display-core.c  |  2 +-
>>  drivers/video/exynos/exynos_dp_core.c | 88 
>> +++
>>  drivers/video/exynos/exynos_dp_core.h |  6 +++
>>  3 files changed, 95 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/video/display/display-core.c 
>> b/drivers/video/display/display-core.c
>> index 5f8be30..dbad7e9 100644
>> --- a/drivers/video/display/display-core.c
>> +++ b/drivers/video/display/display-core.c
>> @@ -15,7 +15,7 @@
>>  #include 
>>  #include 
>>  #include 
>> -#include 
>> +#include 
>>
>>  #include 
>>
>> diff --git a/drivers/video/exynos/exynos_dp_core.c 
>> b/drivers/video/exynos/exynos_dp_core.c
>> index 4ef18e2..0f8de27b 100644
>> --- a/drivers/video/exynos/exynos_dp_core.c
>> +++ b/drivers/video/exynos/exynos_dp_core.c
>> @@ -23,6 +23,9 @@
>>  #include 
>>
>>  #include "exynos_dp_core.h"
>> +#include 
>> +#include 
>> +#define to_panel(p) container_of(p, struct exynos_dp_device, entity)
>>
>>  static int exynos_dp_init_dp(struct exynos_dp_device *dp)
>>  {
>> @@ -1033,6 +1036,81 @@ static void exynos_dp_phy_exit(struct 
>> exynos_dp_device *dp)
>>  }
>>  #endif /* CONFIG_OF */
>>
>> +static int exynos_dp_power_on(struct exynos_dp_device *dp)
>> +{
>> +   struct platform_device *pdev = to_platform_device(dp->dev);
>> +   struct exynos_dp_platdata *pdata = pdev->dev.platform_data;
>> +
>> +   if (dp->dev->of_node) {
>> +   if (dp->phy_addr)
>> +   exynos_dp_phy_init(dp);
>> +   } else {
>> +   if (pdata->phy_init)
>> +   pdata->phy_init();
>> +   }
>> +
>> +   clk_prepare_enable(dp->clock);
>> +   exynos_dp_init_dp(dp);
>> +   enable_irq(dp->irq);
>> +
>> +   return 0;
>> +}
>> +
>> +static int dp_set_state(struct display_entity *entity,
>> +   enum display_entity_state state)
>> +{
>> +   struct exynos_dp_device *dp = to_panel(entity);
>> +   struct platform_device *pdev = to_platform_device(dp->dev);
>> +   int ret = 0;
>> +
>> +   switch (state) {
>> +   case DISPLAY_ENTITY_STATE_OFF:
>> +   case DISPLAY_ENTITY_STATE_STANDBY:
>> +   ret = exynos_dp_remove(pdev);
>
> This is incorrect, that is the module remove function. It seems like
> it works right now since there's nothing permanent happening (like
> platform data being freed), but there's no guarantee that this will
> remain like that in the future.
>
> IMO, you should factor out the common bits from remove and suspend
> into a new function which is called from all three.
>

Yes, I used the module remove function because it works fine with its
current state.
I'll factor out the common things and will create a common function.

>> +   break;
>> +   case DISPLAY_ENTITY_STATE_ON:
>> +   ret = exynos_dp_power_on(dp);
>> +   break;
>> +   }
>> +   return ret;
>> +}
>> +
>> +static int dp_get_modes(struct display_entity *entity,
>> +   const struct videomode **modes)
>> +{
>> +   /* Rework has to be done here*/
>> +   return 1;
>
> Returning 1 here is pretty risky since you didn't actually allocate or
> populate a mode. I'm surprised this isn't causing some weird
> side-effects for you.
>

This current code is a dummy function, That is the reason to mention
"Rework has to be done here"
The current DP driver is not receiving any video mode properties. So I
have to think out how to get the same and will do the implementation.

>> +}
>> +
>> +static int dp_get_size(struct display_entity *entity,
>> +   unsigned int *width, unsigned int *height)
>> +{
>> +   struct exynos_dp_device *dp = to_panel(entity);
>> +  

Re: [PATCH] [RFC] video: exynos dp: Making Exynos DP Compliant with CDF

2013-01-14 Thread Leela Krishna Amudala
Hello Sean,
Thanks for reviewing the patch.

On Sat, Jan 12, 2013 at 1:30 AM, Sean Paul seanp...@chromium.org wrote:
 On Fri, Jan 11, 2013 at 5:35 AM, Leela Krishna Amudala
 l.kris...@samsung.com wrote:
 The Exynos DP transmitter is treated as an end entity in the display pipeline
 and made this RFC patch compliant with CDF.

 Any suggestions are welcome.


 A few comments below. It's hard to get too much of an appreciation for
 what you're trying to do since a bunch of the interesting parts are
 stubbed out.

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
  drivers/video/display/display-core.c  |  2 +-
  drivers/video/exynos/exynos_dp_core.c | 88 
 +++
  drivers/video/exynos/exynos_dp_core.h |  6 +++
  3 files changed, 95 insertions(+), 1 deletion(-)

 diff --git a/drivers/video/display/display-core.c 
 b/drivers/video/display/display-core.c
 index 5f8be30..dbad7e9 100644
 --- a/drivers/video/display/display-core.c
 +++ b/drivers/video/display/display-core.c
 @@ -15,7 +15,7 @@
  #include linux/list.h
  #include linux/module.h
  #include linux/mutex.h
 -#include linux/videomode.h
 +#include video/videomode.h

  #include video/display.h

 diff --git a/drivers/video/exynos/exynos_dp_core.c 
 b/drivers/video/exynos/exynos_dp_core.c
 index 4ef18e2..0f8de27b 100644
 --- a/drivers/video/exynos/exynos_dp_core.c
 +++ b/drivers/video/exynos/exynos_dp_core.c
 @@ -23,6 +23,9 @@
  #include video/exynos_dp.h

  #include exynos_dp_core.h
 +#include video/videomode.h
 +#include video/display.h
 +#define to_panel(p) container_of(p, struct exynos_dp_device, entity)

  static int exynos_dp_init_dp(struct exynos_dp_device *dp)
  {
 @@ -1033,6 +1036,81 @@ static void exynos_dp_phy_exit(struct 
 exynos_dp_device *dp)
  }
  #endif /* CONFIG_OF */

 +static int exynos_dp_power_on(struct exynos_dp_device *dp)
 +{
 +   struct platform_device *pdev = to_platform_device(dp-dev);
 +   struct exynos_dp_platdata *pdata = pdev-dev.platform_data;
 +
 +   if (dp-dev-of_node) {
 +   if (dp-phy_addr)
 +   exynos_dp_phy_init(dp);
 +   } else {
 +   if (pdata-phy_init)
 +   pdata-phy_init();
 +   }
 +
 +   clk_prepare_enable(dp-clock);
 +   exynos_dp_init_dp(dp);
 +   enable_irq(dp-irq);
 +
 +   return 0;
 +}
 +
 +static int dp_set_state(struct display_entity *entity,
 +   enum display_entity_state state)
 +{
 +   struct exynos_dp_device *dp = to_panel(entity);
 +   struct platform_device *pdev = to_platform_device(dp-dev);
 +   int ret = 0;
 +
 +   switch (state) {
 +   case DISPLAY_ENTITY_STATE_OFF:
 +   case DISPLAY_ENTITY_STATE_STANDBY:
 +   ret = exynos_dp_remove(pdev);

 This is incorrect, that is the module remove function. It seems like
 it works right now since there's nothing permanent happening (like
 platform data being freed), but there's no guarantee that this will
 remain like that in the future.

 IMO, you should factor out the common bits from remove and suspend
 into a new function which is called from all three.


Yes, I used the module remove function because it works fine with its
current state.
I'll factor out the common things and will create a common function.

 +   break;
 +   case DISPLAY_ENTITY_STATE_ON:
 +   ret = exynos_dp_power_on(dp);
 +   break;
 +   }
 +   return ret;
 +}
 +
 +static int dp_get_modes(struct display_entity *entity,
 +   const struct videomode **modes)
 +{
 +   /* Rework has to be done here*/
 +   return 1;

 Returning 1 here is pretty risky since you didn't actually allocate or
 populate a mode. I'm surprised this isn't causing some weird
 side-effects for you.


This current code is a dummy function, That is the reason to mention
Rework has to be done here
The current DP driver is not receiving any video mode properties. So I
have to think out how to get the same and will do the implementation.

 +}
 +
 +static int dp_get_size(struct display_entity *entity,
 +   unsigned int *width, unsigned int *height)
 +{
 +   struct exynos_dp_device *dp = to_panel(entity);
 +   struct platform_device *pdev = to_platform_device(dp-dev);
 +   /*getting pdata in older way, rework has to be done  here to
 + parse it from dt node */
 +   struct exynos_dp_platdata *pdata = pdev-dev.platform_data;
 +
 +   /*Rework has to be done here */
 +   *width = 1280;
 +   *height = 800;
 +   return 0;
 +}
 +
 +static int dp_update(struct display_entity *entity,
 +   void (*callback)(int, void *), void *data)
 +{
 +   /*Rework has to be done here*/
 +   return 0;
 +}
 +
 +static const struct display_entity_control_ops dp_control_ops = {
 +   .set_state = dp_set_state,
 +   .get_modes = dp_get_modes,
 +   .get_size = dp_get_size,
 +   .update = dp_update

[PATCH] [RFC] video: exynos dp: Making Exynos DP Compliant with CDF

2013-01-11 Thread Leela Krishna Amudala
The Exynos DP transmitter is treated as an end entity in the display pipeline
and made this RFC patch compliant with CDF.

Any suggestions are welcome.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/video/display/display-core.c  |  2 +-
 drivers/video/exynos/exynos_dp_core.c | 88 +++
 drivers/video/exynos/exynos_dp_core.h |  6 +++
 3 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/drivers/video/display/display-core.c 
b/drivers/video/display/display-core.c
index 5f8be30..dbad7e9 100644
--- a/drivers/video/display/display-core.c
+++ b/drivers/video/display/display-core.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 

 #include 

diff --git a/drivers/video/exynos/exynos_dp_core.c 
b/drivers/video/exynos/exynos_dp_core.c
index 4ef18e2..0f8de27b 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -23,6 +23,9 @@
 #include 

 #include "exynos_dp_core.h"
+#include 
+#include 
+#define to_panel(p) container_of(p, struct exynos_dp_device, entity)

 static int exynos_dp_init_dp(struct exynos_dp_device *dp)
 {
@@ -1033,6 +1036,81 @@ static void exynos_dp_phy_exit(struct exynos_dp_device 
*dp)
 }
 #endif /* CONFIG_OF */

+static int exynos_dp_power_on(struct exynos_dp_device *dp)
+{
+   struct platform_device *pdev = to_platform_device(dp->dev);
+   struct exynos_dp_platdata *pdata = pdev->dev.platform_data;
+
+   if (dp->dev->of_node) {
+   if (dp->phy_addr)
+   exynos_dp_phy_init(dp);
+   } else {
+   if (pdata->phy_init)
+   pdata->phy_init();
+   }
+
+   clk_prepare_enable(dp->clock);
+   exynos_dp_init_dp(dp);
+   enable_irq(dp->irq);
+
+   return 0;
+}
+
+static int dp_set_state(struct display_entity *entity,
+   enum display_entity_state state)
+{
+   struct exynos_dp_device *dp = to_panel(entity);
+   struct platform_device *pdev = to_platform_device(dp->dev);
+   int ret = 0;
+
+   switch (state) {
+   case DISPLAY_ENTITY_STATE_OFF:
+   case DISPLAY_ENTITY_STATE_STANDBY:
+   ret = exynos_dp_remove(pdev);
+   break;
+   case DISPLAY_ENTITY_STATE_ON:
+   ret = exynos_dp_power_on(dp);
+   break;
+   }
+   return ret;
+}
+
+static int dp_get_modes(struct display_entity *entity,
+   const struct videomode **modes)
+{
+   /* Rework has to be done here*/
+   return 1;
+}
+
+static int dp_get_size(struct display_entity *entity,
+   unsigned int *width, unsigned int *height)
+{
+   struct exynos_dp_device *dp = to_panel(entity);
+   struct platform_device *pdev = to_platform_device(dp->dev);
+   /*getting pdata in older way, rework has to be done  here to
+ parse it from dt node */
+   struct exynos_dp_platdata *pdata = pdev->dev.platform_data;
+
+   /*Rework has to be done here */
+   *width = 1280;
+   *height = 800;
+   return 0;
+}
+
+static int dp_update(struct display_entity *entity,
+   void (*callback)(int, void *), void *data)
+{
+   /*Rework has to be done here*/
+   return 0;
+}
+
+static const struct display_entity_control_ops dp_control_ops = {
+   .set_state = dp_set_state,
+   .get_modes = dp_get_modes,
+   .get_size = dp_get_size,
+   .update = dp_update,
+};
+
 static int exynos_dp_probe(struct platform_device *pdev)
 {
struct resource *res;
@@ -,6 +1189,16 @@ static int exynos_dp_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, dp);

+   /* setup panel entity */
+   dp->entity.dev = >dev;
+   dp->entity.release = exynos_dp_remove;
+   dp->entity.ops = _control_ops;
+
+   ret = display_entity_register(>entity);
+   if (ret < 0) {
+   pr_err("failed to register display entity\n");
+   return ret;
+   }
return 0;
 }

diff --git a/drivers/video/exynos/exynos_dp_core.h 
b/drivers/video/exynos/exynos_dp_core.h
index 6c567bb..eb18c10 100644
--- a/drivers/video/exynos/exynos_dp_core.h
+++ b/drivers/video/exynos/exynos_dp_core.h
@@ -13,6 +13,8 @@
 #ifndef _EXYNOS_DP_CORE_H
 #define _EXYNOS_DP_CORE_H

+#include 
+
 enum dp_irq_type {
DP_IRQ_TYPE_HP_CABLE_IN,
DP_IRQ_TYPE_HP_CABLE_OUT,
@@ -42,6 +44,7 @@ struct exynos_dp_device {
struct video_info   *video_info;
struct link_train   link_train;
struct work_struct  hotplug_work;
+   struct display_entity   entity;
 };

 /* exynos_dp_reg.c */
@@ -133,6 +136,9 @@ void exynos_dp_config_video_slave_mode(struct 
exynos_dp_device *dp);
 void exynos_dp_enable_scrambling(struct exynos_dp_device *dp);
 void exynos_dp_disable_scrambling(struct exynos_dp_device *dp);

+static int exynos_dp_power_on(struct exynos

[PATCH] [RFC] video: exynos dp: Making Exynos DP Compliant with CDF

2013-01-11 Thread Leela Krishna Amudala
The Exynos DP transmitter is treated as an end entity in the display pipeline
and made this RFC patch compliant with CDF.

Any suggestions are welcome.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/video/display/display-core.c  |  2 +-
 drivers/video/exynos/exynos_dp_core.c | 88 +++
 drivers/video/exynos/exynos_dp_core.h |  6 +++
 3 files changed, 95 insertions(+), 1 deletion(-)

diff --git a/drivers/video/display/display-core.c 
b/drivers/video/display/display-core.c
index 5f8be30..dbad7e9 100644
--- a/drivers/video/display/display-core.c
+++ b/drivers/video/display/display-core.c
@@ -15,7 +15,7 @@
 #include linux/list.h
 #include linux/module.h
 #include linux/mutex.h
-#include linux/videomode.h
+#include video/videomode.h
 
 #include video/display.h
 
diff --git a/drivers/video/exynos/exynos_dp_core.c 
b/drivers/video/exynos/exynos_dp_core.c
index 4ef18e2..0f8de27b 100644
--- a/drivers/video/exynos/exynos_dp_core.c
+++ b/drivers/video/exynos/exynos_dp_core.c
@@ -23,6 +23,9 @@
 #include video/exynos_dp.h
 
 #include exynos_dp_core.h
+#include video/videomode.h
+#include video/display.h
+#define to_panel(p) container_of(p, struct exynos_dp_device, entity)
 
 static int exynos_dp_init_dp(struct exynos_dp_device *dp)
 {
@@ -1033,6 +1036,81 @@ static void exynos_dp_phy_exit(struct exynos_dp_device 
*dp)
 }
 #endif /* CONFIG_OF */
 
+static int exynos_dp_power_on(struct exynos_dp_device *dp)
+{
+   struct platform_device *pdev = to_platform_device(dp-dev);
+   struct exynos_dp_platdata *pdata = pdev-dev.platform_data;
+
+   if (dp-dev-of_node) {
+   if (dp-phy_addr)
+   exynos_dp_phy_init(dp);
+   } else {
+   if (pdata-phy_init)
+   pdata-phy_init();
+   }
+
+   clk_prepare_enable(dp-clock);
+   exynos_dp_init_dp(dp);
+   enable_irq(dp-irq);
+
+   return 0;
+}
+
+static int dp_set_state(struct display_entity *entity,
+   enum display_entity_state state)
+{
+   struct exynos_dp_device *dp = to_panel(entity);
+   struct platform_device *pdev = to_platform_device(dp-dev);
+   int ret = 0;
+
+   switch (state) {
+   case DISPLAY_ENTITY_STATE_OFF:
+   case DISPLAY_ENTITY_STATE_STANDBY:
+   ret = exynos_dp_remove(pdev);
+   break;
+   case DISPLAY_ENTITY_STATE_ON:
+   ret = exynos_dp_power_on(dp);
+   break;
+   }
+   return ret;
+}
+
+static int dp_get_modes(struct display_entity *entity,
+   const struct videomode **modes)
+{
+   /* Rework has to be done here*/
+   return 1;
+}
+
+static int dp_get_size(struct display_entity *entity,
+   unsigned int *width, unsigned int *height)
+{
+   struct exynos_dp_device *dp = to_panel(entity);
+   struct platform_device *pdev = to_platform_device(dp-dev);
+   /*getting pdata in older way, rework has to be done  here to
+ parse it from dt node */
+   struct exynos_dp_platdata *pdata = pdev-dev.platform_data;
+
+   /*Rework has to be done here */
+   *width = 1280;
+   *height = 800;
+   return 0;
+}
+
+static int dp_update(struct display_entity *entity,
+   void (*callback)(int, void *), void *data)
+{
+   /*Rework has to be done here*/
+   return 0;
+}
+
+static const struct display_entity_control_ops dp_control_ops = {
+   .set_state = dp_set_state,
+   .get_modes = dp_get_modes,
+   .get_size = dp_get_size,
+   .update = dp_update,
+};
+
 static int exynos_dp_probe(struct platform_device *pdev)
 {
struct resource *res;
@@ -,6 +1189,16 @@ static int exynos_dp_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, dp);
 
+   /* setup panel entity */
+   dp-entity.dev = pdev-dev;
+   dp-entity.release = exynos_dp_remove;
+   dp-entity.ops = dp_control_ops;
+
+   ret = display_entity_register(dp-entity);
+   if (ret  0) {
+   pr_err(failed to register display entity\n);
+   return ret;
+   }
return 0;
 }
 
diff --git a/drivers/video/exynos/exynos_dp_core.h 
b/drivers/video/exynos/exynos_dp_core.h
index 6c567bb..eb18c10 100644
--- a/drivers/video/exynos/exynos_dp_core.h
+++ b/drivers/video/exynos/exynos_dp_core.h
@@ -13,6 +13,8 @@
 #ifndef _EXYNOS_DP_CORE_H
 #define _EXYNOS_DP_CORE_H
 
+#include video/display.h
+
 enum dp_irq_type {
DP_IRQ_TYPE_HP_CABLE_IN,
DP_IRQ_TYPE_HP_CABLE_OUT,
@@ -42,6 +44,7 @@ struct exynos_dp_device {
struct video_info   *video_info;
struct link_train   link_train;
struct work_struct  hotplug_work;
+   struct display_entity   entity;
 };
 
 /* exynos_dp_reg.c */
@@ -133,6 +136,9 @@ void exynos_dp_config_video_slave_mode(struct 
exynos_dp_device *dp);
 void exynos_dp_enable_scrambling(struct exynos_dp_device *dp);
 void

[PATCHv16 0/7] of: add display helper

2013-01-10 Thread Leela Krishna Amudala
Hi Steffen,

On Thu, Jan 10, 2013 at 1:45 AM, Steffen Trumtrar
 wrote:
>
> On Tue, Dec 18, 2012 at 06:04:09PM +0100, Steffen Trumtrar wrote:
> > Hi!
> >
> > Finally, right in time before the end of the world on friday, v16 of the
> > display helpers.
> >
>
> So, any more criticism on the series? Any takers for the series as is?
> I guess it could be merged via the fbdev-tree if David Airlie can agree
> to the DRM patches ?! Does that sound about right?
>
> I think the series was tested at least with
> - imx6q: sabrelite, sabresd
> - imx53: tqma53/mba53
> - omap: DA850 EVM, AM335x EVM, EVM-SK
>
> I don't know what Laurent Pinchart, Marek Vasut and Leela Krishna Amudala
> are using.

I tested V16 patches with Exynos: smdk5250 board and it works fine for me.

> Those are the people I know from the top of my head, that use
> or at least did use the patches in one of its iterations. If I forgot
> anyone, please speak up and possibly add your new HW to the list of tested
> devices.
>
> Thanks,
> Steffen
>
> --
> Pengutronix e.K.   | |
> Industrial Linux Solutions | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
> Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


Re: [PATCHv16 0/7] of: add display helper

2013-01-09 Thread Leela Krishna Amudala
Hi Steffen,

On Thu, Jan 10, 2013 at 1:45 AM, Steffen Trumtrar
s.trumt...@pengutronix.de wrote:

 On Tue, Dec 18, 2012 at 06:04:09PM +0100, Steffen Trumtrar wrote:
  Hi!
 
  Finally, right in time before the end of the world on friday, v16 of the
  display helpers.
 

 So, any more criticism on the series? Any takers for the series as is?
 I guess it could be merged via the fbdev-tree if David Airlie can agree
 to the DRM patches ?! Does that sound about right?

 I think the series was tested at least with
 - imx6q: sabrelite, sabresd
 - imx53: tqma53/mba53
 - omap: DA850 EVM, AM335x EVM, EVM-SK

 I don't know what Laurent Pinchart, Marek Vasut and Leela Krishna Amudala
 are using.

I tested V16 patches with Exynos: smdk5250 board and it works fine for me.

 Those are the people I know from the top of my head, that use
 or at least did use the patches in one of its iterations. If I forgot
 anyone, please speak up and possibly add your new HW to the list of tested
 devices.

 Thanks,
 Steffen

 --
 Pengutronix e.K.   | |
 Industrial Linux Solutions | http://www.pengutronix.de/  |
 Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
 Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] video: drm: exynos: mie bypass enable for fimd

2012-12-28 Thread Leela Krishna Amudala
Hello Inki Dae,

On Thu, Dec 27, 2012 at 11:47 AM, Inki Dae  wrote:
>
> Hi,
>
> DISP1BLK_CFG register is related to GScaler, HDCP and MIXER as well. So
> it's not good that this register is controlled in fimd module. And I think
> the function to control the register should be placed in SoC common file .
> In other words, other drivers should be able to control the register through
> common thing also.
>

Thanks for reviewing the patch.
You mean to say that this functionality should be implemented at arch side
and called by drivers using call back functions ?

If so, then if we moved the driver to full DT version, all the call
backs will be removed.
Then how to make a call to this function?

So I thought other drivers (apart from Fimd) also parses the
appropriate nodes and
program the register as per the need.

Please correct me if my understanding is wrong.

Best Wishes,
Leela Krishna Amudala.


> Thanks,
> Inki Dae
>
> 2012/12/26 Leela Krishna Amudala 
>>
>> Bypasses the mie for fimd by parsing the register and bit offset values
>> from "mie-bypass" node, if "mie-bypass" node is present in the dts file.
>>
>> Signed-off-by: Leela Krishna Amudala 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 55
>> 
>>  1 file changed, 55 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index bf0d9ba..f8ad259 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -118,6 +118,12 @@ static const struct of_device_id
>> fimd_driver_dt_match[] = {
>>  MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
>>  #endif
>>
>> +struct mie_bypass {
>> +   u32 enable_bypass;
>> +   void __iomem*bypass_reg;
>> +   u32 bypass_bit_offset;
>> +};
>> +
>>  static inline struct fimd_driver_data *drm_fimd_get_driver_data(
>> struct platform_device *pdev)
>>  {
>> @@ -133,6 +139,41 @@ static inline struct fimd_driver_data
>> *drm_fimd_get_driver_data(
>> platform_get_device_id(pdev)->driver_data;
>>  }
>>
>> +static struct mie_bypass *parse_mie_bypass_for_fimd(struct device *dev,
>> +   struct device_node
>> *mie_bypass_node)
>> +{
>> +   struct mie_bypass *bypass_data;
>> +   u32 phy_address;
>> +
>> +   bypass_data = devm_kzalloc(dev, sizeof(*bypass_data),
>> GFP_KERNEL);
>> +   if (!bypass_data) {
>> +   dev_err(dev, "memory allocation for bypass data
>> failed\n");
>> +   return ERR_PTR(-ENOMEM);
>> +   }
>> +   of_property_read_u32(mie_bypass_node,
>> "samsung,mie-bypass-enable",
>> +   _data->enable_bypass);
>> +   of_property_read_u32(mie_bypass_node, "samsung,disp1blk-cfg-reg",
>> +   _address);
>> +   of_property_read_u32(mie_bypass_node,
>> "samsung,bypass-bit-offset",
>> +   _data->bypass_bit_offset);
>> +
>> +   bypass_data->bypass_reg = ioremap(phy_address, SZ_4);
>>
>> +   if (!bypass_data->bypass_reg) {
>> +   dev_err(dev, "failed to ioremap phy_address\n");
>> +   return ERR_PTR(-ENOMEM);
>> +   }
>> +   return bypass_data;
>> +}
>>
>> +
>> +static void mie_bypass_for_fimd(struct mie_bypass *bypass_data)
>> +{
>> +   u32 reg;
>> +
>> +   reg = __raw_readl(bypass_data->bypass_reg);
>> +   reg |= (1 << bypass_data->bypass_bit_offset);
>> +   __raw_writel(reg, bypass_data->bypass_reg);
>> +}
>> +
>>  static bool fimd_display_is_connected(struct device *dev)
>>  {
>> DRM_DEBUG_KMS("%s\n", __FILE__);
>> @@ -906,12 +947,26 @@ static int __devinit fimd_probe(struct
>> platform_device *pdev)
>> struct exynos_drm_fimd_pdata *pdata;
>> struct exynos_drm_panel_info *panel;
>> struct resource *res;
>> +   struct device_node *mie_bypass_node;
>> +   struct mie_bypass *bypass_data = NULL;
>> int win;
>> int ret = -EINVAL;
>>
>> DRM_DEBUG_KMS("%s\n", __FILE__);
>>
>> pdata = pdev->dev.platform_data;
>> +   if (pdev->dev.of_node) {
>> +   mie_bypass_node = 

Re: [PATCH] video: drm: exynos: mie bypass enable for fimd

2012-12-27 Thread Leela Krishna Amudala
Hello Inki Dae,

On Thu, Dec 27, 2012 at 11:47 AM, Inki Dae inki@samsung.com wrote:

 Hi,

 DISP1BLK_CFG register is related to GScaler, HDCP and MIXER as well. So
 it's not good that this register is controlled in fimd module. And I think
 the function to control the register should be placed in SoC common file .
 In other words, other drivers should be able to control the register through
 common thing also.


Thanks for reviewing the patch.
You mean to say that this functionality should be implemented at arch side
and called by drivers using call back functions ?

If so, then if we moved the driver to full DT version, all the call
backs will be removed.
Then how to make a call to this function?

So I thought other drivers (apart from Fimd) also parses the
appropriate nodes and
program the register as per the need.

Please correct me if my understanding is wrong.

Best Wishes,
Leela Krishna Amudala.


 Thanks,
 Inki Dae

 2012/12/26 Leela Krishna Amudala l.kris...@samsung.com

 Bypasses the mie for fimd by parsing the register and bit offset values
 from mie-bypass node, if mie-bypass node is present in the dts file.

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 55
 
  1 file changed, 55 insertions(+)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index bf0d9ba..f8ad259 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -118,6 +118,12 @@ static const struct of_device_id
 fimd_driver_dt_match[] = {
  MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
  #endif

 +struct mie_bypass {
 +   u32 enable_bypass;
 +   void __iomem*bypass_reg;
 +   u32 bypass_bit_offset;
 +};
 +
  static inline struct fimd_driver_data *drm_fimd_get_driver_data(
 struct platform_device *pdev)
  {
 @@ -133,6 +139,41 @@ static inline struct fimd_driver_data
 *drm_fimd_get_driver_data(
 platform_get_device_id(pdev)-driver_data;
  }

 +static struct mie_bypass *parse_mie_bypass_for_fimd(struct device *dev,
 +   struct device_node
 *mie_bypass_node)
 +{
 +   struct mie_bypass *bypass_data;
 +   u32 phy_address;
 +
 +   bypass_data = devm_kzalloc(dev, sizeof(*bypass_data),
 GFP_KERNEL);
 +   if (!bypass_data) {
 +   dev_err(dev, memory allocation for bypass data
 failed\n);
 +   return ERR_PTR(-ENOMEM);
 +   }
 +   of_property_read_u32(mie_bypass_node,
 samsung,mie-bypass-enable,
 +   bypass_data-enable_bypass);
 +   of_property_read_u32(mie_bypass_node, samsung,disp1blk-cfg-reg,
 +   phy_address);
 +   of_property_read_u32(mie_bypass_node,
 samsung,bypass-bit-offset,
 +   bypass_data-bypass_bit_offset);
 +
 +   bypass_data-bypass_reg = ioremap(phy_address, SZ_4);

 +   if (!bypass_data-bypass_reg) {
 +   dev_err(dev, failed to ioremap phy_address\n);
 +   return ERR_PTR(-ENOMEM);
 +   }
 +   return bypass_data;
 +}

 +
 +static void mie_bypass_for_fimd(struct mie_bypass *bypass_data)
 +{
 +   u32 reg;
 +
 +   reg = __raw_readl(bypass_data-bypass_reg);
 +   reg |= (1  bypass_data-bypass_bit_offset);
 +   __raw_writel(reg, bypass_data-bypass_reg);
 +}
 +
  static bool fimd_display_is_connected(struct device *dev)
  {
 DRM_DEBUG_KMS(%s\n, __FILE__);
 @@ -906,12 +947,26 @@ static int __devinit fimd_probe(struct
 platform_device *pdev)
 struct exynos_drm_fimd_pdata *pdata;
 struct exynos_drm_panel_info *panel;
 struct resource *res;
 +   struct device_node *mie_bypass_node;
 +   struct mie_bypass *bypass_data = NULL;
 int win;
 int ret = -EINVAL;

 DRM_DEBUG_KMS(%s\n, __FILE__);

 pdata = pdev-dev.platform_data;
 +   if (pdev-dev.of_node) {
 +   mie_bypass_node = of_find_node_by_name(pdev-dev.of_node,
 +   mie-bypass);
 +   if (mie_bypass_node) {
 +   bypass_data =
 parse_mie_bypass_for_fimd(pdev-dev,
 +   mie_bypass_node);

 +   if (IS_ERR(bypass_data))
 +   return PTR_ERR(bypass_data);
 +   if (bypass_data-enable_bypass)
 +   mie_bypass_for_fimd(bypass_data);
 +   }
 +   }
 if (!pdata) {
 dev_err(dev, no platform data specified\n);
 return -EINVAL;
 --
 1.8.0

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

[PATCH] video: drm: exynos: mie bypass enable for fimd

2012-12-26 Thread Leela Krishna Amudala
Bypasses the mie for fimd by parsing the register and bit offset values
from "mie-bypass" node, if "mie-bypass" node is present in the dts file.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 55 
 1 file changed, 55 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index bf0d9ba..f8ad259 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -118,6 +118,12 @@ static const struct of_device_id fimd_driver_dt_match[] = {
 MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
 #endif

+struct mie_bypass {
+   u32 enable_bypass;
+   void __iomem*bypass_reg;
+   u32 bypass_bit_offset;
+};
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
@@ -133,6 +139,41 @@ static inline struct fimd_driver_data 
*drm_fimd_get_driver_data(
platform_get_device_id(pdev)->driver_data;
 }

+static struct mie_bypass *parse_mie_bypass_for_fimd(struct device *dev,
+   struct device_node *mie_bypass_node)
+{
+   struct mie_bypass *bypass_data;
+   u32 phy_address;
+
+   bypass_data = devm_kzalloc(dev, sizeof(*bypass_data), GFP_KERNEL);
+   if (!bypass_data) {
+   dev_err(dev, "memory allocation for bypass data failed\n");
+   return ERR_PTR(-ENOMEM);
+   }
+   of_property_read_u32(mie_bypass_node, "samsung,mie-bypass-enable",
+   _data->enable_bypass);
+   of_property_read_u32(mie_bypass_node, "samsung,disp1blk-cfg-reg",
+   _address);
+   of_property_read_u32(mie_bypass_node, "samsung,bypass-bit-offset",
+   _data->bypass_bit_offset);
+
+   bypass_data->bypass_reg = ioremap(phy_address, SZ_4);
+   if (!bypass_data->bypass_reg) {
+   dev_err(dev, "failed to ioremap phy_address\n");
+   return ERR_PTR(-ENOMEM);
+   }
+   return bypass_data;
+}
+
+static void mie_bypass_for_fimd(struct mie_bypass *bypass_data)
+{
+   u32 reg;
+
+   reg = __raw_readl(bypass_data->bypass_reg);
+   reg |= (1 << bypass_data->bypass_bit_offset);
+   __raw_writel(reg, bypass_data->bypass_reg);
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -906,12 +947,26 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
struct exynos_drm_fimd_pdata *pdata;
struct exynos_drm_panel_info *panel;
struct resource *res;
+   struct device_node *mie_bypass_node;
+   struct mie_bypass *bypass_data = NULL;
int win;
int ret = -EINVAL;

DRM_DEBUG_KMS("%s\n", __FILE__);

pdata = pdev->dev.platform_data;
+   if (pdev->dev.of_node) {
+   mie_bypass_node = of_find_node_by_name(pdev->dev.of_node,
+   "mie-bypass");
+   if (mie_bypass_node) {
+   bypass_data = parse_mie_bypass_for_fimd(>dev,
+   mie_bypass_node);
+   if (IS_ERR(bypass_data))
+   return PTR_ERR(bypass_data);
+   if (bypass_data->enable_bypass)
+   mie_bypass_for_fimd(bypass_data);
+   }
+   }
if (!pdata) {
dev_err(dev, "no platform data specified\n");
return -EINVAL;
-- 
1.8.0



[PATCH] video: drm: exynos: mie bypass enable for fimd

2012-12-26 Thread Leela Krishna Amudala
Bypasses the mie for fimd by parsing the register and bit offset values
from mie-bypass node, if mie-bypass node is present in the dts file.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c | 55 
 1 file changed, 55 insertions(+)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index bf0d9ba..f8ad259 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -118,6 +118,12 @@ static const struct of_device_id fimd_driver_dt_match[] = {
 MODULE_DEVICE_TABLE(of, fimd_driver_dt_match);
 #endif
 
+struct mie_bypass {
+   u32 enable_bypass;
+   void __iomem*bypass_reg;
+   u32 bypass_bit_offset;
+};
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
@@ -133,6 +139,41 @@ static inline struct fimd_driver_data 
*drm_fimd_get_driver_data(
platform_get_device_id(pdev)-driver_data;
 }
 
+static struct mie_bypass *parse_mie_bypass_for_fimd(struct device *dev,
+   struct device_node *mie_bypass_node)
+{
+   struct mie_bypass *bypass_data;
+   u32 phy_address;
+
+   bypass_data = devm_kzalloc(dev, sizeof(*bypass_data), GFP_KERNEL);
+   if (!bypass_data) {
+   dev_err(dev, memory allocation for bypass data failed\n);
+   return ERR_PTR(-ENOMEM);
+   }
+   of_property_read_u32(mie_bypass_node, samsung,mie-bypass-enable,
+   bypass_data-enable_bypass);
+   of_property_read_u32(mie_bypass_node, samsung,disp1blk-cfg-reg,
+   phy_address);
+   of_property_read_u32(mie_bypass_node, samsung,bypass-bit-offset,
+   bypass_data-bypass_bit_offset);
+
+   bypass_data-bypass_reg = ioremap(phy_address, SZ_4);
+   if (!bypass_data-bypass_reg) {
+   dev_err(dev, failed to ioremap phy_address\n);
+   return ERR_PTR(-ENOMEM);
+   }
+   return bypass_data;
+}
+
+static void mie_bypass_for_fimd(struct mie_bypass *bypass_data)
+{
+   u32 reg;
+
+   reg = __raw_readl(bypass_data-bypass_reg);
+   reg |= (1  bypass_data-bypass_bit_offset);
+   __raw_writel(reg, bypass_data-bypass_reg);
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS(%s\n, __FILE__);
@@ -906,12 +947,26 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
struct exynos_drm_fimd_pdata *pdata;
struct exynos_drm_panel_info *panel;
struct resource *res;
+   struct device_node *mie_bypass_node;
+   struct mie_bypass *bypass_data = NULL;
int win;
int ret = -EINVAL;
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
pdata = pdev-dev.platform_data;
+   if (pdev-dev.of_node) {
+   mie_bypass_node = of_find_node_by_name(pdev-dev.of_node,
+   mie-bypass);
+   if (mie_bypass_node) {
+   bypass_data = parse_mie_bypass_for_fimd(pdev-dev,
+   mie_bypass_node);
+   if (IS_ERR(bypass_data))
+   return PTR_ERR(bypass_data);
+   if (bypass_data-enable_bypass)
+   mie_bypass_for_fimd(bypass_data);
+   }
+   }
if (!pdata) {
dev_err(dev, no platform data specified\n);
return -EINVAL;
-- 
1.8.0

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


[PATCHv16 0/7] of: add display helper

2012-12-21 Thread Leela Krishna Amudala
Hello All,
Any comments for this patch set..?

Best Wishes,
Leela Krishna Amudala.

On Tue, Dec 18, 2012 at 10:34 PM, Steffen Trumtrar
 wrote:
>
> Hi!
>
> Finally, right in time before the end of the world on friday, v16 of the
> display helpers.
>
> Changes since v15:
> - move include/linux/{videomode,display_timing}.h to include/video
> - move include/linux/of_{videomode,display_timing}.h to
> include/video
> - reimplement flags: add VESA flags and data flags
> - let pixelclock in struct videomode be unsigned long
> - rename of_display_timings_exists to of_display_timings_exist
> - revise logging/error messages: replace __func__ with
> np->full_name
> - rename pixelclk-inverted to pixelclk-active
> - revise comments in code
>
> Changes since v14:
> - fix "const struct *" warning
> (reported by: Leela Krishna Amudala
> )
> - return -EINVAL when htotal or vtotal are zero
> - remove unreachable code in of_get_display_timings
> - include headers in .c files and not implicit in .h
> - sort includes alphabetically
> - fix lower/uppercase in binding documentation
> - rebase onto v3.7-rc7
>
> Changes since v13:
> - fix "const struct *" warning
> (reported by: Laurent Pinchart
> )
> - prevent division by zero in fb_videomode_from_videomode
>
> Changes since v12:
> - rename struct display_timing to via_display_timing in via
> subsystem
> - fix refreshrate calculation
> - fix "const struct *" warnings
> (reported by: Manjunathappa, Prakash )
> - some CodingStyle fixes
> - rewrite parts of commit messages and display-timings.txt
> - let display_timing_get_value get all values instead of just
> typical
>
> Changes since v11:
> - make pointers const where applicable
> - add reviewed-by Laurent Pinchart
>
> Changes since v10:
> - fix function name (drm_)display_mode_from_videomode
> - add acked-by, reviewed-by, tested-by
>
> Changes since v9:
> - don't leak memory when previous timings were correct
> - CodingStyle fixes
> - move blank lines around
>
> Changes since v8:
> - fix memory leaks
> - change API to be more consistent (foo_from_bar(struct bar,
> struct foo))
> - include headers were necessary
> - misc minor bugfixes
>
> Changes since v7:
> - move of_xxx to drivers/video
> - remove non-binding documentation from display-timings.txt
> - squash display_timings and videomode in one patch
> - misc minor fixes
>
> Changes since v6:
> - get rid of some empty lines etc.
> - move functions to their subsystems
> - split of_ from non-of_ functions
> - add at least some kerneldoc to some functions
>
> Changes since v5:
> - removed all display stuff and just describe timings
>
> Changes since v4:
> - refactored functions
>
> Changes since v3:
> - print error messages
> - free alloced memory
> - general cleanup
>
> Changes since v2:
> - use hardware-near property-names
> - provide a videomode structure
> - allow ranges for all properties (<min,typ,max>)
> - functions to get display_mode or fb_videomode
>
> Regards,
> Steffen
>
>
>
> Steffen Trumtrar (7):
>   viafb: rename display_timing to via_display_timing
>   video: add display_timing and videomode
>   video: add of helper for display timings/videomode
>   fbmon: add videomode helpers
>   fbmon: add of_videomode helpers
>   drm_modes: add videomode helpers
>   drm_modes: add of_videomode helpers
>
>  .../devicetree/bindings/video/display-timing.txt   |  109 +
>  drivers/gpu/drm/drm_modes.c|   70 ++
>  drivers/video/Kconfig  |   21 ++
>  drivers/video/Makefile |4 +
>  drivers/video/display_timing.c |   24 ++
>  drivers/video/fbmon.c  |   94 
>  drivers/video/of_display_timing.c  |  239
> 
>  drivers/video/of_videomode.c   |   54 +
>  drivers/video/via/hw.c |6 +-
>  drivers/video/via/hw.h |2 +-
>  drivers/video/via/lcd.c|2 +-
>  drivers/video/via/share.h  |2 +-
>  drivers/video/via

Re: [PATCHv16 0/7] of: add display helper

2012-12-21 Thread Leela Krishna Amudala
Hello All,
Any comments for this patch set..?

Best Wishes,
Leela Krishna Amudala.

On Tue, Dec 18, 2012 at 10:34 PM, Steffen Trumtrar
s.trumt...@pengutronix.de wrote:

 Hi!

 Finally, right in time before the end of the world on friday, v16 of the
 display helpers.

 Changes since v15:
 - move include/linux/{videomode,display_timing}.h to include/video
 - move include/linux/of_{videomode,display_timing}.h to
 include/video
 - reimplement flags: add VESA flags and data flags
 - let pixelclock in struct videomode be unsigned long
 - rename of_display_timings_exists to of_display_timings_exist
 - revise logging/error messages: replace __func__ with
 np-full_name
 - rename pixelclk-inverted to pixelclk-active
 - revise comments in code

 Changes since v14:
 - fix const struct * warning
 (reported by: Leela Krishna Amudala
 l.kris...@samsung.com)
 - return -EINVAL when htotal or vtotal are zero
 - remove unreachable code in of_get_display_timings
 - include headers in .c files and not implicit in .h
 - sort includes alphabetically
 - fix lower/uppercase in binding documentation
 - rebase onto v3.7-rc7

 Changes since v13:
 - fix const struct * warning
 (reported by: Laurent Pinchart
 laurent.pinch...@ideasonboard.com)
 - prevent division by zero in fb_videomode_from_videomode

 Changes since v12:
 - rename struct display_timing to via_display_timing in via
 subsystem
 - fix refreshrate calculation
 - fix const struct * warnings
 (reported by: Manjunathappa, Prakash prakash...@ti.com)
 - some CodingStyle fixes
 - rewrite parts of commit messages and display-timings.txt
 - let display_timing_get_value get all values instead of just
 typical

 Changes since v11:
 - make pointers const where applicable
 - add reviewed-by Laurent Pinchart

 Changes since v10:
 - fix function name (drm_)display_mode_from_videomode
 - add acked-by, reviewed-by, tested-by

 Changes since v9:
 - don't leak memory when previous timings were correct
 - CodingStyle fixes
 - move blank lines around

 Changes since v8:
 - fix memory leaks
 - change API to be more consistent (foo_from_bar(struct bar,
 struct foo))
 - include headers were necessary
 - misc minor bugfixes

 Changes since v7:
 - move of_xxx to drivers/video
 - remove non-binding documentation from display-timings.txt
 - squash display_timings and videomode in one patch
 - misc minor fixes

 Changes since v6:
 - get rid of some empty lines etc.
 - move functions to their subsystems
 - split of_ from non-of_ functions
 - add at least some kerneldoc to some functions

 Changes since v5:
 - removed all display stuff and just describe timings

 Changes since v4:
 - refactored functions

 Changes since v3:
 - print error messages
 - free alloced memory
 - general cleanup

 Changes since v2:
 - use hardware-near property-names
 - provide a videomode structure
 - allow ranges for all properties (min,typ,max)
 - functions to get display_mode or fb_videomode

 Regards,
 Steffen



 Steffen Trumtrar (7):
   viafb: rename display_timing to via_display_timing
   video: add display_timing and videomode
   video: add of helper for display timings/videomode
   fbmon: add videomode helpers
   fbmon: add of_videomode helpers
   drm_modes: add videomode helpers
   drm_modes: add of_videomode helpers

  .../devicetree/bindings/video/display-timing.txt   |  109 +
  drivers/gpu/drm/drm_modes.c|   70 ++
  drivers/video/Kconfig  |   21 ++
  drivers/video/Makefile |4 +
  drivers/video/display_timing.c |   24 ++
  drivers/video/fbmon.c  |   94 
  drivers/video/of_display_timing.c  |  239
 
  drivers/video/of_videomode.c   |   54 +
  drivers/video/via/hw.c |6 +-
  drivers/video/via/hw.h |2 +-
  drivers/video/via/lcd.c|2 +-
  drivers/video/via/share.h  |2 +-
  drivers/video/via/via_modesetting.c|8 +-
  drivers/video/via/via_modesetting.h|6 +-
  drivers/video/videomode.c  |   39 
  include/drm/drmP.h |9 +
  include/linux/fb.h |8 +
  include/video/display_timing.h |  124 ++
  include/video/of_display_timing.h  |   20 ++
  include/video

[PATCHv15 0/7] of: add display helper

2012-12-05 Thread Leela Krishna Amudala
Hello Steffen,

Any update on version 16 ?

Best Wishes,
Leela Krishna Amudala.

On Mon, Nov 26, 2012 at 2:37 PM, Steffen Trumtrar
 wrote:
> Hi!
>
> Changes since v14:
> - fix "const struct *" warning
>     (reported by: Leela Krishna Amudala  samsung.com>)
> - return -EINVAL when htotal or vtotal are zero
> - remove unreachable code in of_get_display_timings
> - include headers in .c files and not implicit in .h
> - sort includes alphabetically
> - fix lower/uppercase in binding documentation
> - rebase onto v3.7-rc7
>
> Changes since v13:
> - fix "const struct *" warning
> (reported by: Laurent Pinchart  ideasonboard.com>)
> - prevent division by zero in fb_videomode_from_videomode
>
> Changes since v12:
> - rename struct display_timing to via_display_timing in via subsystem
> - fix refreshrate calculation
> - fix "const struct *" warnings
> (reported by: Manjunathappa, Prakash )
> - some CodingStyle fixes
> - rewrite parts of commit messages and display-timings.txt
> - let display_timing_get_value get all values instead of just typical
>
> Changes since v11:
> - make pointers const where applicable
> - add reviewed-by Laurent Pinchart
>
> Changes since v10:
> - fix function name (drm_)display_mode_from_videomode
> - add acked-by, reviewed-by, tested-by
>
> Changes since v9:
> - don't leak memory when previous timings were correct
> - CodingStyle fixes
> - move blank lines around
>
> Changes since v8:
> - fix memory leaks
> - change API to be more consistent (foo_from_bar(struct bar, struct 
> foo))
> - include headers were necessary
> - misc minor bufixe
>
> Changes since v7:
> - move of_xxx to drivers/video
> - remove non-binding documentation from display-timings.txt
> - squash display_timings and videomode in one patch
> - misc minor fixes
>
> Changes since v6:
> - get rid of some empty lines etc.
> - move functions to their subsystems
> - split of_ from non-of_ functions
> - add at least some kerneldoc to some functions
>
> Changes since v5:
> - removed all display stuff and just describe timings
>
> Changes since v4:
> - refactored functions
>
> Changes since v3:
> - print error messages
> - free alloced memory
> - general cleanup
>
> Changes since v2:
> - use hardware-near property-names
> - provide a videomode structure
> - allow ranges for all properties (<min,typ,max>)
> - functions to get display_mode or fb_videomode
>
>
> Steffen Trumtrar (7):
>   viafb: rename display_timing to via_display_timing
>   video: add display_timing and videomode
>   video: add of helper for display timings/videomode
>   fbmon: add videomode helpers
>   fbmon: add of_videomode helpers
>   drm_modes: add videomode helpers
>   drm_modes: add of_videomode helpers
>
>  .../devicetree/bindings/video/display-timing.txt   |  107 ++
>  drivers/gpu/drm/drm_modes.c|   70 +++
>  drivers/video/Kconfig  |   21 ++
>  drivers/video/Makefile |4 +
>  drivers/video/display_timing.c |   24 +++
>  drivers/video/fbmon.c  |   93 +
>  drivers/video/of_display_timing.c  |  219 
> 
>  drivers/video/of_videomode.c   |   54 +
>  drivers/video/via/hw.c |6 +-
>  drivers/video/via/hw.h |2 +-
>  drivers/video/via/lcd.c|2 +-
>  drivers/video/via/share.h  |2 +-
>  drivers/video/via/via_modesetting.c|8 +-
>  drivers/video/via/via_modesetting.h|6 +-
>  drivers/video/videomode.c  |   44 
>  include/drm/drmP.h |   13 ++
>  include/linux/display_timing.h |  104 ++
>  include/linux/fb.h |   12 ++
>  include/linux/of_display_timing.h  |   20 ++
>  include/linux/of_videomode.h   |   18 ++
>  include/linux/videomode.h  |   54 +
>  21 files changed, 870 insertions(+), 13 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/video/display-timing.tx

Re: [PATCHv15 0/7] of: add display helper

2012-12-04 Thread Leela Krishna Amudala
Hello Steffen,

Any update on version 16 ?

Best Wishes,
Leela Krishna Amudala.

On Mon, Nov 26, 2012 at 2:37 PM, Steffen Trumtrar
s.trumt...@pengutronix.de wrote:
 Hi!

 Changes since v14:
 - fix const struct * warning
 (reported by: Leela Krishna Amudala l.kris...@samsung.com)
 - return -EINVAL when htotal or vtotal are zero
 - remove unreachable code in of_get_display_timings
 - include headers in .c files and not implicit in .h
 - sort includes alphabetically
 - fix lower/uppercase in binding documentation
 - rebase onto v3.7-rc7

 Changes since v13:
 - fix const struct * warning
 (reported by: Laurent Pinchart 
 laurent.pinch...@ideasonboard.com)
 - prevent division by zero in fb_videomode_from_videomode

 Changes since v12:
 - rename struct display_timing to via_display_timing in via subsystem
 - fix refreshrate calculation
 - fix const struct * warnings
 (reported by: Manjunathappa, Prakash prakash...@ti.com)
 - some CodingStyle fixes
 - rewrite parts of commit messages and display-timings.txt
 - let display_timing_get_value get all values instead of just typical

 Changes since v11:
 - make pointers const where applicable
 - add reviewed-by Laurent Pinchart

 Changes since v10:
 - fix function name (drm_)display_mode_from_videomode
 - add acked-by, reviewed-by, tested-by

 Changes since v9:
 - don't leak memory when previous timings were correct
 - CodingStyle fixes
 - move blank lines around

 Changes since v8:
 - fix memory leaks
 - change API to be more consistent (foo_from_bar(struct bar, struct 
 foo))
 - include headers were necessary
 - misc minor bufixe

 Changes since v7:
 - move of_xxx to drivers/video
 - remove non-binding documentation from display-timings.txt
 - squash display_timings and videomode in one patch
 - misc minor fixes

 Changes since v6:
 - get rid of some empty lines etc.
 - move functions to their subsystems
 - split of_ from non-of_ functions
 - add at least some kerneldoc to some functions

 Changes since v5:
 - removed all display stuff and just describe timings

 Changes since v4:
 - refactored functions

 Changes since v3:
 - print error messages
 - free alloced memory
 - general cleanup

 Changes since v2:
 - use hardware-near property-names
 - provide a videomode structure
 - allow ranges for all properties (min,typ,max)
 - functions to get display_mode or fb_videomode


 Steffen Trumtrar (7):
   viafb: rename display_timing to via_display_timing
   video: add display_timing and videomode
   video: add of helper for display timings/videomode
   fbmon: add videomode helpers
   fbmon: add of_videomode helpers
   drm_modes: add videomode helpers
   drm_modes: add of_videomode helpers

  .../devicetree/bindings/video/display-timing.txt   |  107 ++
  drivers/gpu/drm/drm_modes.c|   70 +++
  drivers/video/Kconfig  |   21 ++
  drivers/video/Makefile |4 +
  drivers/video/display_timing.c |   24 +++
  drivers/video/fbmon.c  |   93 +
  drivers/video/of_display_timing.c  |  219 
 
  drivers/video/of_videomode.c   |   54 +
  drivers/video/via/hw.c |6 +-
  drivers/video/via/hw.h |2 +-
  drivers/video/via/lcd.c|2 +-
  drivers/video/via/share.h  |2 +-
  drivers/video/via/via_modesetting.c|8 +-
  drivers/video/via/via_modesetting.h|6 +-
  drivers/video/videomode.c  |   44 
  include/drm/drmP.h |   13 ++
  include/linux/display_timing.h |  104 ++
  include/linux/fb.h |   12 ++
  include/linux/of_display_timing.h  |   20 ++
  include/linux/of_videomode.h   |   18 ++
  include/linux/videomode.h  |   54 +
  21 files changed, 870 insertions(+), 13 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/video/display-timing.txt
  create mode 100644 drivers/video/display_timing.c
  create mode 100644 drivers/video/of_display_timing.c
  create mode 100644 drivers/video/of_videomode.c
  create mode 100644 drivers/video/videomode.c
  create mode 100644 include/linux/display_timing.h
  create mode 100644 include/linux/of_display_timing.h
  create mode 100644 include/linux/of_videomode.h
  create mode 100644 include/linux/videomode.h

[PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Leela Krishna Amudala
gt;hsync_len);
> +   ret |= parse_property(np, "vback-porch", >vback_porch);
> +   ret |= parse_property(np, "vfront-porch", >vfront_porch);
> +   ret |= parse_property(np, "vactive", >vactive);
> +   ret |= parse_property(np, "vsync-len", >vsync_len);
> +   ret |= parse_property(np, "clock-frequency", >pixelclock);
> +
> +   of_property_read_u32(np, "vsync-active", >vsync_pol_active);
> +   of_property_read_u32(np, "hsync-active", >hsync_pol_active);
> +   of_property_read_u32(np, "de-active", >de_pol_active);
> +   of_property_read_u32(np, "pixelclk-inverted", >pixelclk_pol);
> +   dt->interlaced = of_property_read_bool(np, "interlaced");
> +   dt->doublescan = of_property_read_bool(np, "doublescan");
> +
> +   if (ret) {
> +   pr_err("%s: error reading timing properties\n", __func__);
> +   kfree(dt);
> +   return NULL;
> +   }
> +
> +   return dt;
> +}
> +
> +/**
> + * of_get_display_timings - parse all display_timing entries from a 
> device_node
> + * @np: device_node with the subnodes
> + **/
> +struct display_timings *of_get_display_timings(struct device_node *np)
> +{
> +   struct device_node *timings_np;
> +   struct device_node *entry;
> +   struct device_node *native_mode;
> +   struct display_timings *disp;
> +
> +   if (!np) {
> +   pr_err("%s: no devicenode given\n", __func__);
> +   return NULL;
> +   }
> +
> +   timings_np = of_find_node_by_name(np, "display-timings");
> +   if (!timings_np) {
> +   pr_err("%s: could not find display-timings node\n", __func__);
> +   return NULL;
> +   }
> +
> +   disp = kzalloc(sizeof(*disp), GFP_KERNEL);
> +   if (!disp) {
> +   pr_err("%s: could not allocate struct disp'\n", __func__);
> +   goto dispfail;
> +   }
> +
> +   entry = of_parse_phandle(timings_np, "native-mode", 0);
> +   /* assume first child as native mode if none provided */
> +   if (!entry)
> +   entry = of_get_next_child(np, NULL);
> +   /* if there is no child, it is useless to go on */
> +   if (!entry) {
> +   pr_err("%s: no timing specifications given\n", __func__);
> +   goto entryfail;
> +   }
> +
> +   pr_info("%s: using %s as default timing\n", __func__, entry->name);
> +
> +   native_mode = entry;
> +
> +   disp->num_timings = of_get_child_count(timings_np);
> +   if (disp->num_timings == 0) {
> +   /* should never happen, as entry was already found above */
> +   pr_err("%s: no timings specified\n", __func__);
> +   goto entryfail;
> +   }
> +
> +   disp->timings = kzalloc(sizeof(struct display_timing *) * 
> disp->num_timings,
> +   GFP_KERNEL);
> +   if (!disp->timings) {
> +   pr_err("%s: could not allocate timings array\n", __func__);
> +   goto entryfail;
> +   }
> +
> +   disp->num_timings = 0;
> +   disp->native_mode = 0;
> +
> +   for_each_child_of_node(timings_np, entry) {
> +   struct display_timing *dt;
> +
> +   dt = of_get_display_timing(entry);
> +   if (!dt) {
> +   /*
> +* to not encourage wrong devicetrees, fail in case of
> +* an error
> +*/
> +   pr_err("%s: error in timing %d\n", __func__,
> +  disp->num_timings + 1);
> +   goto timingfail;
> +   }
> +
> +   if (native_mode == entry)
> +   disp->native_mode = disp->num_timings;
> +
> +   disp->timings[disp->num_timings] = dt;
> +   disp->num_timings++;
> +   }
> +   of_node_put(timings_np);
> +   /*
> +* native_mode points to the device_node returned by of_parse_phandle
> +* therefore call of_node_put on it
> +*/
> +   of_node_put(native_mode);
> +
> +   if (disp->num_timings > 0)
> +   pr_info("%s: got %d timings. Using timing #%d as default\n",
> +   __func__, disp->num_timings, disp->native_mode + 1);
> +   else {
> + 

Re: [PATCHv14 3/7] video: add of helper for display timings/videomode

2012-11-23 Thread Leela Krishna Amudala
 *' 
Please take care of it.

Best Wishes,
Leela Krishna Amudala

 +   if (!timings_np)
 +   return -EINVAL;
 +
 +   of_node_put(timings_np);
 +   return 1;
 +}
 +EXPORT_SYMBOL_GPL(of_display_timings_exists);
 diff --git a/drivers/video/of_videomode.c b/drivers/video/of_videomode.c
 new file mode 100644
 index 000..358aa56
 --- /dev/null
 +++ b/drivers/video/of_videomode.c
 @@ -0,0 +1,48 @@
 +/*
 + * generic videomode helper
 + *
 + * Copyright (c) 2012 Steffen Trumtrar s.trumt...@pengutronix.de, 
 Pengutronix
 + *
 + * This file is released under the GPLv2
 + */
 +#include linux/of.h
 +#include linux/of_display_timings.h
 +#include linux/of_videomode.h
 +#include linux/export.h
 +
 +/**
 + * of_get_videomode - get the videomode #index from devicetree
 + * @np - devicenode with the display_timings
 + * @vm - set to return value
 + * @index - index into list of display_timings
 + * DESCRIPTION:
 + * Get a list of all display timings and put the one
 + * specified by index into *vm. This function should only be used, if
 + * only one videomode is to be retrieved. A driver that needs to work
 + * with multiple/all videomodes should work with
 + * of_get_display_timings instead.
 + **/
 +int of_get_videomode(struct device_node *np, struct videomode *vm,
 +int index)
 +{
 +   struct display_timings *disp;
 +   int ret;
 +
 +   disp = of_get_display_timings(np);
 +   if (!disp) {
 +   pr_err(%s: no timings specified\n, __func__);
 +   return -EINVAL;
 +   }
 +
 +   if (index == OF_USE_NATIVE_MODE)
 +   index = disp-native_mode;
 +
 +   ret = videomode_from_timing(disp, vm, index);
 +   if (ret)
 +   return ret;
 +
 +   display_timings_release(disp);
 +
 +   return 0;
 +}
 +EXPORT_SYMBOL_GPL(of_get_videomode);
 diff --git a/include/linux/of_display_timings.h 
 b/include/linux/of_display_timings.h
 new file mode 100644
 index 000..b3e3455
 --- /dev/null
 +++ b/include/linux/of_display_timings.h
 @@ -0,0 +1,20 @@
 +/*
 + * Copyright 2012 Steffen Trumtrar s.trumt...@pengutronix.de
 + *
 + * display timings of helpers
 + *
 + * This file is released under the GPLv2
 + */
 +
 +#ifndef __LINUX_OF_DISPLAY_TIMINGS_H
 +#define __LINUX_OF_DISPLAY_TIMINGS_H
 +
 +#include linux/display_timing.h
 +#include linux/of.h
 +
 +#define OF_USE_NATIVE_MODE -1
 +
 +struct display_timings *of_get_display_timings(struct device_node *np);
 +int of_display_timings_exists(const struct device_node *np);
 +
 +#endif
 diff --git a/include/linux/of_videomode.h b/include/linux/of_videomode.h
 new file mode 100644
 index 000..a72ad78
 --- /dev/null
 +++ b/include/linux/of_videomode.h
 @@ -0,0 +1,18 @@
 +/*
 + * Copyright 2012 Steffen Trumtrar s.trumt...@pengutronix.de
 + *
 + * videomode of-helpers
 + *
 + * This file is released under the GPLv2
 + */
 +
 +#ifndef __LINUX_OF_VIDEOMODE_H
 +#define __LINUX_OF_VIDEOMODE_H
 +
 +#include linux/videomode.h
 +#include linux/of.h
 +
 +int of_get_videomode(struct device_node *np, struct videomode *vm,
 +int index);
 +
 +#endif /* __LINUX_OF_VIDEOMODE_H */
 --
 1.7.10.4

 --
 To unsubscribe from this list: send the line unsubscribe linux-fbdev in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v12 3/6] fbmon: add videomode helpers

2012-11-21 Thread Leela Krishna Amudala
Yes,
Even I got the same build error.
later I fixed it by including "#include "

Best Wishes,
Leela Krishna.

On Wed, Nov 21, 2012 at 3:39 PM, Manjunathappa, Prakash
 wrote:
> Hi Steffen,
>
> I am trying to add DT support for da8xx-fb driver on top of your patches.
> Encountered below build error. Sorry for reporting it late.
>
> On Tue, Nov 20, 2012 at 21:24:53, Steffen Trumtrar wrote:
>> Add a function to convert from the generic videomode to a fb_videomode.
>>
>> Signed-off-by: Steffen Trumtrar 
>> Reviewed-by: Thierry Reding 
>> Acked-by: Thierry Reding 
>> Tested-by: Thierry Reding 
>> Tested-by: Philipp Zabel 
>> Reviewed-by: Laurent Pinchart 
>> ---
>>  drivers/video/fbmon.c |   46 ++
>>  include/linux/fb.h|6 ++
>>  2 files changed, 52 insertions(+)
>>
>> diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
>> index cef6557..c1939a6 100644
>> --- a/drivers/video/fbmon.c
>> +++ b/drivers/video/fbmon.c
>> @@ -31,6 +31,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #ifdef CONFIG_PPC_OF
>>  #include 
>>  #include 
>> @@ -1373,6 +1374,51 @@ int fb_get_mode(int flags, u32 val, struct 
>> fb_var_screeninfo *var, struct fb_inf
>>   kfree(timings);
>>   return err;
>>  }
>> +
>> +#if IS_ENABLED(CONFIG_VIDEOMODE)
>> +int fb_videomode_from_videomode(const struct videomode *vm,
>> + struct fb_videomode *fbmode)
>> +{
>> + unsigned int htotal, vtotal;
>> +
>> + fbmode->xres = vm->hactive;
>> + fbmode->left_margin = vm->hback_porch;
>> + fbmode->right_margin = vm->hfront_porch;
>> + fbmode->hsync_len = vm->hsync_len;
>> +
>> + fbmode->yres = vm->vactive;
>> + fbmode->upper_margin = vm->vback_porch;
>> + fbmode->lower_margin = vm->vfront_porch;
>> + fbmode->vsync_len = vm->vsync_len;
>> +
>> + fbmode->pixclock = KHZ2PICOS(vm->pixelclock / 1000);
>> +
>> + fbmode->sync = 0;
>> + fbmode->vmode = 0;
>> + if (vm->hah)
>> + fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
>> + if (vm->vah)
>> + fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
>> + if (vm->interlaced)
>> + fbmode->vmode |= FB_VMODE_INTERLACED;
>> + if (vm->doublescan)
>> + fbmode->vmode |= FB_VMODE_DOUBLE;
>> + if (vm->de)
>> + fbmode->sync |= FB_SYNC_DATA_ENABLE_HIGH_ACT;
>
> "FB_SYNC_DATA_ENABLE_HIGH_ACT" seems to be mxsfb specific flag, I am getting
> build error on this. Please let me know if I am missing something.
>
> Thanks,
> Prakash
>
>> + fbmode->flag = 0;
>> +
>> + htotal = vm->hactive + vm->hfront_porch + vm->hback_porch +
>> +  vm->hsync_len;
>> + vtotal = vm->vactive + vm->vfront_porch + vm->vback_porch +
>> +  vm->vsync_len;
>> + fbmode->refresh = (vm->pixelclock * 1000) / (htotal * vtotal);
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
>> +#endif
>> +
>> +
>>  #else
>>  int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
>>  {
>> diff --git a/include/linux/fb.h b/include/linux/fb.h
>> index c7a9571..920cbe3 100644
>> --- a/include/linux/fb.h
>> +++ b/include/linux/fb.h
>> @@ -14,6 +14,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>
>>  struct vm_area_struct;
>>  struct fb_info;
>> @@ -714,6 +715,11 @@ extern void fb_destroy_modedb(struct fb_videomode 
>> *modedb);
>>  extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
>>  extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);
>>
>> +#if IS_ENABLED(CONFIG_VIDEOMODE)
>> +extern int fb_videomode_from_videomode(const struct videomode *vm,
>> +struct fb_videomode *fbmode);
>> +#endif
>> +
>>  /* drivers/video/modedb.c */
>>  #define VESA_MODEDB_SIZE 34
>>  extern void fb_var_to_videomode(struct fb_videomode *mode,
>> --
>> 1.7.10.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
>> the body of a message to majordomo at vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
> ___
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH v12 3/6] fbmon: add videomode helpers

2012-11-21 Thread Leela Krishna Amudala
Yes,
Even I got the same build error.
later I fixed it by including #include linux/mxsfb.h

Best Wishes,
Leela Krishna.

On Wed, Nov 21, 2012 at 3:39 PM, Manjunathappa, Prakash
prakash...@ti.com wrote:
 Hi Steffen,

 I am trying to add DT support for da8xx-fb driver on top of your patches.
 Encountered below build error. Sorry for reporting it late.

 On Tue, Nov 20, 2012 at 21:24:53, Steffen Trumtrar wrote:
 Add a function to convert from the generic videomode to a fb_videomode.

 Signed-off-by: Steffen Trumtrar s.trumt...@pengutronix.de
 Reviewed-by: Thierry Reding thierry.red...@avionic-design.de
 Acked-by: Thierry Reding thierry.red...@avionic-design.de
 Tested-by: Thierry Reding thierry.red...@avionic-design.de
 Tested-by: Philipp Zabel p.za...@pengutronix.de
 Reviewed-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  drivers/video/fbmon.c |   46 ++
  include/linux/fb.h|6 ++
  2 files changed, 52 insertions(+)

 diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
 index cef6557..c1939a6 100644
 --- a/drivers/video/fbmon.c
 +++ b/drivers/video/fbmon.c
 @@ -31,6 +31,7 @@
  #include linux/pci.h
  #include linux/slab.h
  #include video/edid.h
 +#include linux/videomode.h
  #ifdef CONFIG_PPC_OF
  #include asm/prom.h
  #include asm/pci-bridge.h
 @@ -1373,6 +1374,51 @@ int fb_get_mode(int flags, u32 val, struct 
 fb_var_screeninfo *var, struct fb_inf
   kfree(timings);
   return err;
  }
 +
 +#if IS_ENABLED(CONFIG_VIDEOMODE)
 +int fb_videomode_from_videomode(const struct videomode *vm,
 + struct fb_videomode *fbmode)
 +{
 + unsigned int htotal, vtotal;
 +
 + fbmode-xres = vm-hactive;
 + fbmode-left_margin = vm-hback_porch;
 + fbmode-right_margin = vm-hfront_porch;
 + fbmode-hsync_len = vm-hsync_len;
 +
 + fbmode-yres = vm-vactive;
 + fbmode-upper_margin = vm-vback_porch;
 + fbmode-lower_margin = vm-vfront_porch;
 + fbmode-vsync_len = vm-vsync_len;
 +
 + fbmode-pixclock = KHZ2PICOS(vm-pixelclock / 1000);
 +
 + fbmode-sync = 0;
 + fbmode-vmode = 0;
 + if (vm-hah)
 + fbmode-sync |= FB_SYNC_HOR_HIGH_ACT;
 + if (vm-vah)
 + fbmode-sync |= FB_SYNC_VERT_HIGH_ACT;
 + if (vm-interlaced)
 + fbmode-vmode |= FB_VMODE_INTERLACED;
 + if (vm-doublescan)
 + fbmode-vmode |= FB_VMODE_DOUBLE;
 + if (vm-de)
 + fbmode-sync |= FB_SYNC_DATA_ENABLE_HIGH_ACT;

 FB_SYNC_DATA_ENABLE_HIGH_ACT seems to be mxsfb specific flag, I am getting
 build error on this. Please let me know if I am missing something.

 Thanks,
 Prakash

 + fbmode-flag = 0;
 +
 + htotal = vm-hactive + vm-hfront_porch + vm-hback_porch +
 +  vm-hsync_len;
 + vtotal = vm-vactive + vm-vfront_porch + vm-vback_porch +
 +  vm-vsync_len;
 + fbmode-refresh = (vm-pixelclock * 1000) / (htotal * vtotal);
 +
 + return 0;
 +}
 +EXPORT_SYMBOL_GPL(fb_videomode_from_videomode);
 +#endif
 +
 +
  #else
  int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
  {
 diff --git a/include/linux/fb.h b/include/linux/fb.h
 index c7a9571..920cbe3 100644
 --- a/include/linux/fb.h
 +++ b/include/linux/fb.h
 @@ -14,6 +14,7 @@
  #include linux/backlight.h
  #include linux/slab.h
  #include asm/io.h
 +#include linux/videomode.h

  struct vm_area_struct;
  struct fb_info;
 @@ -714,6 +715,11 @@ extern void fb_destroy_modedb(struct fb_videomode 
 *modedb);
  extern int fb_find_mode_cvt(struct fb_videomode *mode, int margins, int rb);
  extern unsigned char *fb_ddc_read(struct i2c_adapter *adapter);

 +#if IS_ENABLED(CONFIG_VIDEOMODE)
 +extern int fb_videomode_from_videomode(const struct videomode *vm,
 +struct fb_videomode *fbmode);
 +#endif
 +
  /* drivers/video/modedb.c */
  #define VESA_MODEDB_SIZE 34
  extern void fb_var_to_videomode(struct fb_videomode *mode,
 --
 1.7.10.4

 --
 To unsubscribe from this list: send the line unsubscribe linux-fbdev in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html


 ___
 devicetree-discuss mailing list
 devicetree-disc...@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/devicetree-discuss
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled

2012-11-07 Thread Leela Krishna Amudala
Hello Rahul,

On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma  
wrote:
> This patch adds iommu support for hdmi driver with device tree based
> search. It searches for sysmmu property in hdmi dt node to get tv
> iommu device pointer which will be used to configure iommu hw interface.
>
> This patch is based on "exynos-drm-next-iommu" branch at
> http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git
>
> This patch is having dependency on  linux-samsung-soc patchset named
> "add dt based support for iommu for hdmi"
>
> Signed-off-by: Rahul Sharma 
> Signed-off-by: Prathyush K 
> ---
>  drivers/gpu/drm/exynos/exynos_hdmi.c |   35 
> ++
>  1 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
> b/drivers/gpu/drm/exynos/exynos_hdmi.c
> index d1a1d71..ee110c9 100644
> --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
> +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
> @@ -34,7 +34,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>
>  #include 
>
> @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client 
> *hdmiphy)
>  }
>
>  #ifdef CONFIG_OF
> +
> +static int drm_hdmi_dt_init_iommu(struct device *dev)
> +{
> +   struct platform_device *pds;
> +   struct device_node *dn, *dns;
> +   const __be32 *parp;
> +
> +   dn = dev->of_node;
> +   parp = of_get_property(dn, "sysmmu", NULL);
> +   if (parp == NULL) {
> +   dev_err(dev, "failed to find sysmmu property\n");
> +   return -EINVAL;
> +   }
> +   dns = of_find_node_by_phandle(be32_to_cpup(parp));
> +   if (dns == NULL) {
> +   dev_err(dev, "failed to find sysmmu node\n");
> +   return -EINVAL;
> +   }
> +   pds = of_find_device_by_node(dns);
> +   if (pds == NULL) {
> +   dev_err(dev, "failed to find sysmmu platform device\n");
> +   return -EINVAL;
> +   }
> +
> +   platform_set_sysmmu(>dev, dev);
> +   return 0;
> +}
> +

As a part of adding iommu support to FIMD driver, we have to implement
the same function in FIMD driver also, which makes code replication.
So, it would be better to move this function out of this file and put
it in a common drm file so that FIMD also can use it.

Best Wishes,
Leela Krishna Amudala.

>  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
> (struct device *dev)
>  {
> @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data 
> *drm_hdmi_dt_parse_pdata
> goto err_data;
> }
>
> +   if (drm_hdmi_dt_init_iommu(dev)){
> +   DRM_ERROR("no sysmmu property found\n");
> +   goto err_data;
> +   }
> +
> pd->hpd_gpio = of_get_named_gpio_flags(np, "hpd-gpio", 0, );
>
> return pd;
> --
> 1.7.0.4
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: exynos: add iommu support in hdmi driver with dt enabled

2012-11-06 Thread Leela Krishna Amudala
Hello Rahul,

On Mon, Nov 5, 2012 at 2:32 PM, Rahul Sharma rahul.sha...@samsung.com wrote:
 This patch adds iommu support for hdmi driver with device tree based
 search. It searches for sysmmu property in hdmi dt node to get tv
 iommu device pointer which will be used to configure iommu hw interface.

 This patch is based on exynos-drm-next-iommu branch at
 http://git.kernel.org/?p=linux/kernel/git/daeinki/drm-exynos.git

 This patch is having dependency on  linux-samsung-soc patchset named
 add dt based support for iommu for hdmi

 Signed-off-by: Rahul Sharma rahul.sha...@samsung.com
 Signed-off-by: Prathyush K prathyus...@samsung.com
 ---
  drivers/gpu/drm/exynos/exynos_hdmi.c |   35 
 ++
  1 files changed, 35 insertions(+), 0 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
 b/drivers/gpu/drm/exynos/exynos_hdmi.c
 index d1a1d71..ee110c9 100644
 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c
 +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
 @@ -34,7 +34,9 @@
  #include linux/regulator/consumer.h
  #include linux/io.h
  #include linux/of_gpio.h
 +#include linux/of_platform.h
  #include plat/gpio-cfg.h
 +#include mach/sysmmu.h

  #include drm/exynos_drm.h

 @@ -2275,6 +2277,34 @@ void hdmi_attach_hdmiphy_client(struct i2c_client 
 *hdmiphy)
  }

  #ifdef CONFIG_OF
 +
 +static int drm_hdmi_dt_init_iommu(struct device *dev)
 +{
 +   struct platform_device *pds;
 +   struct device_node *dn, *dns;
 +   const __be32 *parp;
 +
 +   dn = dev-of_node;
 +   parp = of_get_property(dn, sysmmu, NULL);
 +   if (parp == NULL) {
 +   dev_err(dev, failed to find sysmmu property\n);
 +   return -EINVAL;
 +   }
 +   dns = of_find_node_by_phandle(be32_to_cpup(parp));
 +   if (dns == NULL) {
 +   dev_err(dev, failed to find sysmmu node\n);
 +   return -EINVAL;
 +   }
 +   pds = of_find_device_by_node(dns);
 +   if (pds == NULL) {
 +   dev_err(dev, failed to find sysmmu platform device\n);
 +   return -EINVAL;
 +   }
 +
 +   platform_set_sysmmu(pds-dev, dev);
 +   return 0;
 +}
 +

As a part of adding iommu support to FIMD driver, we have to implement
the same function in FIMD driver also, which makes code replication.
So, it would be better to move this function out of this file and put
it in a common drm file so that FIMD also can use it.

Best Wishes,
Leela Krishna Amudala.

  static struct s5p_hdmi_platform_data *drm_hdmi_dt_parse_pdata
 (struct device *dev)
  {
 @@ -2294,6 +2324,11 @@ static struct s5p_hdmi_platform_data 
 *drm_hdmi_dt_parse_pdata
 goto err_data;
 }

 +   if (drm_hdmi_dt_init_iommu(dev)){
 +   DRM_ERROR(no sysmmu property found\n);
 +   goto err_data;
 +   }
 +
 pd-hpd_gpio = of_get_named_gpio_flags(np, hpd-gpio, 0, flags);

 return pd;
 --
 1.7.0.4

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


[PATCH v7 2/8] of: add helper to parse display timings

2012-11-02 Thread Leela Krishna Amudala
t;
> +
> +   dt = of_get_display_timing(entry);
> +   if (!dt) {
> +       /* to not encourage wrong devicetrees, fail in case 
> of an error */
> +   pr_err("%s: error in timing %d\n", __func__, 
> disp->num_timings+1);
> +   return NULL;
> +   }
> +
> +   if (native_mode == entry)
> +   disp->native_mode = disp->num_timings;
> +
> +   disp->timings[disp->num_timings] = dt;
> +   disp->num_timings++;
> +   }
> +   of_node_put(timings_np);
> +
> +   if (disp->num_timings > 0)
> +   pr_info("%s: got %d timings. Using timing #%d as default\n", 
> __func__,
> +   disp->num_timings , disp->native_mode + 1);
> +   else {
> +   pr_err("%s: no valid timings specified\n", __func__);
> +   return NULL;
> +   }
> +   return disp;
> +}
> +EXPORT_SYMBOL_GPL(of_get_display_timing_list);
> +
> +/**
> + * of_display_timings_exists - check if a display-timings node is provided
> + * @np: device_node with the timing
> + **/
> +int of_display_timings_exists(struct device_node *np)
> +{
> +   struct device_node *timings_np;
> +   struct device_node *default_np;
> +
> +   if (!np)
> +   return -EINVAL;
> +
> +   timings_np = of_parse_phandle(np, "display-timings", 0);
> +   if (!timings_np)
> +   return -EINVAL;
> +
> +   return -EINVAL;

Here it should return success instead of -EINVAL.

And one query.. are the binding properties names and "display-timings"
node structure template  finalized..?

Best Wishes,
Leela Krishna Amudala.

> +}
> +EXPORT_SYMBOL_GPL(of_display_timings_exists);
> diff --git a/include/linux/of_display_timings.h 
> b/include/linux/of_display_timings.h
> new file mode 100644
> index 000..e4e1f22
> --- /dev/null
> +++ b/include/linux/of_display_timings.h
> @@ -0,0 +1,20 @@
> +/*
> + * Copyright 2012 Steffen Trumtrar 
> + *
> + * display timings of helpers
> + *
> + * This file is released under the GPLv2
> + */
> +
> +#ifndef __LINUX_OF_DISPLAY_TIMINGS_H
> +#define __LINUX_OF_DISPLAY_TIMINGS_H
> +
> +#include 
> +
> +#define OF_USE_NATIVE_MODE -1
> +
> +struct display_timings *of_get_display_timing_list(struct device_node *np);
> +struct display_timing *of_get_display_timing(struct device_node *np);
> +int of_display_timings_exists(struct device_node *np);
> +
> +#endif
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 2/8] of: add helper to parse display timings

2012-11-02 Thread Leela Krishna Amudala
: device_node with the properties
 + **/
 +struct display_timing *of_get_display_timing(struct device_node *np)
 +{
 +   struct display_timing *dt;
 +   int ret = 0;
 +
 +   dt = kzalloc(sizeof(*dt), GFP_KERNEL);
 +   if (!dt) {
 +   pr_err(%s: could not allocate display_timing struct\n, 
 __func__);
 +   return NULL;
 +   }
 +
 +   ret |= parse_property(np, hback-porch, dt-hback_porch);
 +   ret |= parse_property(np, hfront-porch, dt-hfront_porch);
 +   ret |= parse_property(np, hactive, dt-hactive);
 +   ret |= parse_property(np, hsync-len, dt-hsync_len);
 +   ret |= parse_property(np, vback-porch, dt-vback_porch);
 +   ret |= parse_property(np, vfront-porch, dt-vfront_porch);
 +   ret |= parse_property(np, vactive, dt-vactive);
 +   ret |= parse_property(np, vsync-len, dt-vsync_len);
 +   ret |= parse_property(np, clock-frequency, dt-pixelclock);
 +
 +   of_property_read_u32(np, vsync-active, dt-vsync_pol_active);
 +   of_property_read_u32(np, hsync-active, dt-hsync_pol_active);
 +   of_property_read_u32(np, de-active, dt-de_pol_active);
 +   of_property_read_u32(np, pixelclk-inverted, dt-pixelclk_pol);
 +   dt-interlaced = of_property_read_bool(np, interlaced);
 +   dt-doublescan = of_property_read_bool(np, doublescan);
 +
 +   if (ret) {
 +   pr_err(%s: error reading timing properties\n, __func__);
 +   return NULL;
 +   }
 +
 +   return dt;
 +}
 +EXPORT_SYMBOL_GPL(of_get_display_timing);
 +
 +/**
 + * of_get_display_timing_list - parse all display_timing entries from a 
 device_node
 + * @np: device_node with the subnodes
 + **/
 +struct display_timings *of_get_display_timing_list(struct device_node *np)
 +{
 +   struct device_node *timings_np;
 +   struct device_node *entry;
 +   struct device_node *native_mode;
 +   struct display_timings *disp;
 +
 +   if (!np) {
 +   pr_err(%s: no devicenode given\n, __func__);
 +   return NULL;
 +   }
 +
 +   timings_np = of_find_node_by_name(np, display-timings);
 +   if (!timings_np) {
 +   pr_err(%s: could not find display-timings node\n, __func__);
 +   return NULL;
 +   }
 +
 +   disp = kzalloc(sizeof(*disp), GFP_KERNEL);
 +
 +   entry = of_parse_phandle(timings_np, native-mode, 0);
 +   /* assume first child as native mode if none provided */
 +   if (!entry)
 +   entry = of_get_next_child(np, NULL);
 +   if (!entry) {
 +   pr_err(%s: no timing specifications given\n, __func__);
 +   return NULL;
 +   }
 +
 +   pr_info(%s: using %s as default timing\n, __func__, entry-name);
 +
 +   native_mode = entry;
 +
 +   disp-num_timings = of_get_child_count(timings_np);
 +   disp-timings = kzalloc(sizeof(struct display_timing 
 *)*disp-num_timings,
 +   GFP_KERNEL);
 +   disp-num_timings = 0;
 +   disp-native_mode = 0;
 +
 +   for_each_child_of_node(timings_np, entry) {
 +   struct display_timing *dt;
 +
 +   dt = of_get_display_timing(entry);
 +   if (!dt) {
 +   /* to not encourage wrong devicetrees, fail in case 
 of an error */
 +   pr_err(%s: error in timing %d\n, __func__, 
 disp-num_timings+1);
 +   return NULL;
 +   }
 +
 +   if (native_mode == entry)
 +   disp-native_mode = disp-num_timings;
 +
 +   disp-timings[disp-num_timings] = dt;
 +   disp-num_timings++;
 +   }
 +   of_node_put(timings_np);
 +
 +   if (disp-num_timings  0)
 +   pr_info(%s: got %d timings. Using timing #%d as default\n, 
 __func__,
 +   disp-num_timings , disp-native_mode + 1);
 +   else {
 +   pr_err(%s: no valid timings specified\n, __func__);
 +   return NULL;
 +   }
 +   return disp;
 +}
 +EXPORT_SYMBOL_GPL(of_get_display_timing_list);
 +
 +/**
 + * of_display_timings_exists - check if a display-timings node is provided
 + * @np: device_node with the timing
 + **/
 +int of_display_timings_exists(struct device_node *np)
 +{
 +   struct device_node *timings_np;
 +   struct device_node *default_np;
 +
 +   if (!np)
 +   return -EINVAL;
 +
 +   timings_np = of_parse_phandle(np, display-timings, 0);
 +   if (!timings_np)
 +   return -EINVAL;
 +
 +   return -EINVAL;

Here it should return success instead of -EINVAL.

And one query.. are the binding properties names and display-timings
node structure template  finalized..?

Best Wishes,
Leela Krishna Amudala.

 +}
 +EXPORT_SYMBOL_GPL(of_display_timings_exists);
 diff --git a/include/linux/of_display_timings.h 
 b/include/linux/of_display_timings.h
 new file mode 100644
 index 000..e4e1f22
 --- /dev/null
 +++ b/include

[PATCH 0/2 v6] of: add display helper

2012-10-15 Thread Leela Krishna Amudala
Hello Steffen,

To which version of the kernel we can expect this patch set to be merged into?
Because I'm waiting for this from long time to add DT support for my
display controller :)

Best Wishes,
Leela Krishna Amudala.

On Thu, Oct 4, 2012 at 11:29 PM, Steffen Trumtrar
 wrote:
>
> Hi!
>
> In accordance with Stepehn Warren, I downsized the binding.
> Now, just the display-timing is described, as I think, it is way easier to
> agree
> on those and have a complete binding.
>
> Regards,
> Steffen
>
> Steffen Trumtrar (2):
>   of: add helper to parse display timings
>   of: add generic videomode description
>
>  .../devicetree/bindings/video/display-timings.txt  |  222
> 
>  drivers/of/Kconfig |   10 +
>  drivers/of/Makefile|2 +
>  drivers/of/of_display_timings.c|  183
> 
>  drivers/of/of_videomode.c  |  212
> +++
>  include/linux/of_display_timings.h |   85 
>  include/linux/of_videomode.h   |   41 
>  7 files changed, 755 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/video/display-timings.txt
>  create mode 100644 drivers/of/of_display_timings.c
>  create mode 100644 drivers/of/of_videomode.c
>  create mode 100644 include/linux/of_display_timings.h
>  create mode 100644 include/linux/of_videomode.h
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2 v6] of: add display helper

2012-10-15 Thread Leela Krishna Amudala
Hello Steffen,

To which version of the kernel we can expect this patch set to be merged into?
Because I'm waiting for this from long time to add DT support for my
display controller :)

Best Wishes,
Leela Krishna Amudala.

On Thu, Oct 4, 2012 at 11:29 PM, Steffen Trumtrar
s.trumt...@pengutronix.de wrote:

 Hi!

 In accordance with Stepehn Warren, I downsized the binding.
 Now, just the display-timing is described, as I think, it is way easier to
 agree
 on those and have a complete binding.

 Regards,
 Steffen

 Steffen Trumtrar (2):
   of: add helper to parse display timings
   of: add generic videomode description

  .../devicetree/bindings/video/display-timings.txt  |  222
 
  drivers/of/Kconfig |   10 +
  drivers/of/Makefile|2 +
  drivers/of/of_display_timings.c|  183
 
  drivers/of/of_videomode.c  |  212
 +++
  include/linux/of_display_timings.h |   85 
  include/linux/of_videomode.h   |   41 
  7 files changed, 755 insertions(+)
  create mode 100644
 Documentation/devicetree/bindings/video/display-timings.txt
  create mode 100644 drivers/of/of_display_timings.c
  create mode 100644 drivers/of/of_videomode.c
  create mode 100644 include/linux/of_display_timings.h
  create mode 100644 include/linux/of_videomode.h

 --
 1.7.10.4

 --
 To unsubscribe from this list: send the line unsubscribe linux-fbdev in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V6 2/2] video: drm: exynos: Add device tree support

2012-10-03 Thread Leela Krishna Amudala
On Mon, Oct 1, 2012 at 9:50 PM, Stephen Warren  wrote:
> On 09/30/2012 11:29 PM, Leela Krishna Amudala wrote:
>> Hello Stephen Warren,
>>
>> The binding names that I use in my dts file should match with the
>> names given in 
>> http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html
>> right?
>
> I don't think so; the binding in that link is for example:
>
>> + - xres, yres: Display resolution
>> + - left-margin, right-margin, hsync-len: Horizontal Display timing 
>> parameters
>> +   in pixels
>> +   upper-margin, lower-margin, vsync-len: Vertical display timing 
>> parameters in
>> +   lines
>> + - clock: displayclock in Hz
>
> i.e. a bunch of separate properties, one for each value needed to
> describe the display timing. However, your patch contains:
>

I mean to say that even I have to use separate properties for each one
instead of grouping them.
Also the names should match with the ones given in the example..?

>>>> + - samsung,fimd-display: This property should specify the phandle of the
>>>> +   display device node which holds the video interface timing with the
>>>> +   below mentioned properties.
>>>> +
>>>> +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
>>>> + horizontal timing includes four parameters in the following order.
>>>> +
>>>> + - horizontal back porch (in number of lcd clocks)
>>>> + - horizontal front porch (in number of lcd clocks)
>>>> + - hsync pulse width (in number of lcd clocks)
>>>> + - Display panels X resolution.
>
> A single lcd-htiming property, which contains 4 values. (and a similar
> construct for the vertical timing).
>
> That seems entirely different to me...
> ___
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH V6 2/2] video: drm: exynos: Add device tree support

2012-10-02 Thread Leela Krishna Amudala
On Mon, Oct 1, 2012 at 9:50 PM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 09/30/2012 11:29 PM, Leela Krishna Amudala wrote:
 Hello Stephen Warren,

 The binding names that I use in my dts file should match with the
 names given in 
 http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html
 right?

 I don't think so; the binding in that link is for example:

 + - xres, yres: Display resolution
 + - left-margin, right-margin, hsync-len: Horizontal Display timing 
 parameters
 +   in pixels
 +   upper-margin, lower-margin, vsync-len: Vertical display timing 
 parameters in
 +   lines
 + - clock: displayclock in Hz

 i.e. a bunch of separate properties, one for each value needed to
 describe the display timing. However, your patch contains:


I mean to say that even I have to use separate properties for each one
instead of grouping them.
Also the names should match with the ones given in the example..?

 + - samsung,fimd-display: This property should specify the phandle of the
 +   display device node which holds the video interface timing with the
 +   below mentioned properties.
 +
 +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
 + horizontal timing includes four parameters in the following order.
 +
 + - horizontal back porch (in number of lcd clocks)
 + - horizontal front porch (in number of lcd clocks)
 + - hsync pulse width (in number of lcd clocks)
 + - Display panels X resolution.

 A single lcd-htiming property, which contains 4 values. (and a similar
 construct for the vertical timing).

 That seems entirely different to me...
 ___
 devicetree-discuss mailing list
 devicetree-disc...@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/devicetree-discuss
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V6 2/2] video: drm: exynos: Add device tree support

2012-10-01 Thread Leela Krishna Amudala
Hello Stephen Warren,

The binding names that I use in my dts file should match with the
names given in 
http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html
right?
I think that is the only thing I have to take care, and as I'm not
using "struct drm_display_mode"  in my driver its my wish whether to
use the helper function or not.
Please clarify me if I miss something.

Best Regards,
Leela Krishna Amudala.

On Fri, Sep 21, 2012 at 10:44 AM, Stephen Warren  
wrote:
> On 09/21/2012 05:22 AM, Leela Krishna Amudala wrote:
>> This patch adds device tree based discovery support for exynos DRM-FIMD
>> driver which includes driver modification to handle platform data in
>> both the cases with DT and non-DT, Also adds the documentation for bindings.
>
>> diff --git a/Documentation/devicetree/bindings/drm/exynos/fimd.txt 
>> b/Documentation/devicetree/bindings/drm/exynos/fimd.txt
> ...
>> + - samsung,fimd-display: This property should specify the phandle of the
>> +   display device node which holds the video interface timing with the
>> +   below mentioned properties.
>> +
>> +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
>> + horizontal timing includes four parameters in the following order.
>> +
>> + - horizontal back porch (in number of lcd clocks)
>> + - horizontal front porch (in number of lcd clocks)
>> + - hsync pulse width (in number of lcd clocks)
>> + - Display panels X resolution.
>> +
>> +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
>> + vertical timing includes four parameters in the following order.
>> +
>> + - vertical back porch (in number of lcd lines)
>> + - vertical front porch (in number of lcd lines)
>> + - vsync pulse width (in number of lcd clocks)
>> + - Display panels Y resolution.
>
> Should this not use the new videomode timings that are under discussion at:
>
> http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V6 2/2] video: drm: exynos: Add device tree support

2012-10-01 Thread Leela Krishna Amudala
Hello Stephen Warren,

The binding names that I use in my dts file should match with the
names given in 
http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html
right?
I think that is the only thing I have to take care, and as I'm not
using struct drm_display_mode  in my driver its my wish whether to
use the helper function or not.
Please clarify me if I miss something.

Best Regards,
Leela Krishna Amudala.

On Fri, Sep 21, 2012 at 10:44 AM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 09/21/2012 05:22 AM, Leela Krishna Amudala wrote:
 This patch adds device tree based discovery support for exynos DRM-FIMD
 driver which includes driver modification to handle platform data in
 both the cases with DT and non-DT, Also adds the documentation for bindings.

 diff --git a/Documentation/devicetree/bindings/drm/exynos/fimd.txt 
 b/Documentation/devicetree/bindings/drm/exynos/fimd.txt
 ...
 + - samsung,fimd-display: This property should specify the phandle of the
 +   display device node which holds the video interface timing with the
 +   below mentioned properties.
 +
 +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
 + horizontal timing includes four parameters in the following order.
 +
 + - horizontal back porch (in number of lcd clocks)
 + - horizontal front porch (in number of lcd clocks)
 + - hsync pulse width (in number of lcd clocks)
 + - Display panels X resolution.
 +
 +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
 + vertical timing includes four parameters in the following order.
 +
 + - vertical back porch (in number of lcd lines)
 + - vertical front porch (in number of lcd lines)
 + - vsync pulse width (in number of lcd clocks)
 + - Display panels Y resolution.

 Should this not use the new videomode timings that are under discussion at:

 http://lists.freedesktop.org/archives/dri-devel/2012-July/024875.html
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V2] drm/exynos: Add match table for drm platform device

2012-09-22 Thread Leela Krishna Amudala
This patch is a part of moving the driver to support DT style probing
of exynos drm device. The compatible name should match with the
entry in the dtsi file.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d070719..495be89 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -294,12 +294,23 @@ static int exynos_drm_platform_remove(struct 
platform_device *pdev)
return 0;
 }

+#ifdef CONFIG_OF
+static const struct of_device_id drm_device_dt_match[] = {
+   { .compatible = "samsung,exynos-drm-device"},
+   {},
+};
+MODULE_DEVICE_TABLE(of, drm_device_dt_match);
+#else
+#define drm_device_dt_match NULL
+#endif
+
 static struct platform_driver exynos_drm_platform_driver = {
.probe  = exynos_drm_platform_probe,
.remove = __devexit_p(exynos_drm_platform_remove),
.driver = {
.owner  = THIS_MODULE,
.name   = "exynos-drm",
+   .of_match_table = of_match_ptr(drm_device_dt_match),
},
 };

-- 
1.7.0.4



[PATCH V6 2/2] video: drm: exynos: Add device tree support

2012-09-21 Thread Leela Krishna Amudala
This patch adds device tree based discovery support for exynos DRM-FIMD
driver which includes driver modification to handle platform data in
both the cases with DT and non-DT, Also adds the documentation for bindings.

Signed-off-by: Leela Krishna Amudala 
---
 .../devicetree/bindings/drm/exynos/fimd.txt|   80 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |   95 +++-
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/exynos/fimd.txt

diff --git a/Documentation/devicetree/bindings/drm/exynos/fimd.txt 
b/Documentation/devicetree/bindings/drm/exynos/fimd.txt
new file mode 100644
index 000..e94120c
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/exynos/fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be "samsung,exynos5-fimd" or "samsung,exynos4-fimd" for
+   fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = "samsung,exynos5-fimd";
+   interrupt-parent = <>;
+   reg = <0x1440 0x4>;
+   interrupts = <18 5>, <18 4>, <18 6>;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = <4 4 4 480>;
+   lcd-vtiming = <4 4 4 320>;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = <_fimd0>;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = <60>;
+   samsung,default-window = <0>;
+   samsung,fimd-win-bpp = <32>;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 1ad10b6..b2d22ac 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static const struct of_device_id fimd_dt_match[];
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_ptr(fimd_dt_match);
+   return (struct fimd_driver_data *)match->data;
+   }
+#endif
return (struct fimd_driver_data *)
platform_get_device_id(pdev)->driver_data;
 }
@@ -809,12 +819,77 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }

+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev->of_node;
+   struct device_n

[PATCH V6 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd

2012-09-21 Thread Leela Krishna Amudala
Two device ids are created for exynos4-fb and exynos5-fb.
Also, added driver data for exynos4 and exynos5 to pick the timing base address
at runtime to write data into appropriate register address.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   43 +++---
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index d96db5e..1ad10b6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@

 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))

+struct fimd_driver_data {
+   unsigned int timing_base;
+};
+
+struct fimd_driver_data exynos4_fimd_driver_data = {
+   .timing_base = 0x0,
+};
+
+struct fimd_driver_data exynos5_fimd_driver_data = {
+   .timing_base = 0x2,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static inline struct fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct fimd_driver_data *)
+   platform_get_device_id(pdev)->driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx->panel;
struct fb_videomode *timing = >timing;
+   struct fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;

+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx->suspended)
return;

DRM_DEBUG_KMS("%s\n", __FILE__);

/* setup polarity values from machine code. */
-   writel(ctx->vidcon1, ctx->regs + VIDCON1);
+   writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);

/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing->upper_margin - 1) |
   VIDTCON0_VFPD(timing->lower_margin - 1) |
   VIDTCON0_VSPW(timing->vsync_len - 1);
-   writel(val, ctx->regs + VIDTCON0);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);

/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing->left_margin - 1) |
   VIDTCON1_HFPD(timing->right_margin - 1) |
   VIDTCON1_HSPW(timing->hsync_len - 1);
-   writel(val, ctx->regs + VIDTCON1);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);

/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing->yres - 1) |
   VIDTCON2_HOZVAL(timing->xres - 1);
-   writel(val, ctx->regs + VIDTCON2);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);

/* setup clock source, clock divider, enable dma. */
val = ctx->vidcon0;
@@ -977,6 +999,18 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif

+static struct platform_device_id fimd_driver_ids[] = {
+   {
+   .name   = "exynos4-fb",
+   .driver_data= (unsigned long)_fimd_driver_data,
+   }, {
+   .name   = "exynos5-fb",
+   .driver_data= (unsigned long)_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -985,6 +1019,7 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = fimd_driver_ids,
.driver = {
.name   = "exynos4-fb",
.owner  = THIS_MODULE,
-- 
1.7.0.4



[PATCH V6 0/2] video: drm: Add Device tree support to exynos DRM-FIMD

2012-09-21 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos4 and exynos5 devices.

This patchset is based and tested on top of v3.6-rc4 on smdk5250 board
Also depends on below patchset
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V5:
- Moved the documentation file to appropriate location.
- Given more description in the commit message to the patch 
  video: drm: exynos: Add device tree support

Changes since V4:
- Changed the compatible string from "samsung,exynos4-fb" to
  "samsung,exynos4-fimd".

Changes since V3:
- Removed the fimd version from driver data and using timing base
  address instead
- Removed the drm_ prefixes to the structures and fucntions

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for drm fimd
  video: drm: exynos: Add device tree support

 .../devicetree/bindings/drm/exynos/fimd.txt|   80 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |  138 +++-
 2 files changed, 212 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/exynos/fimd.txt



[PATCH V6 0/2] video: drm: Add Device tree support to exynos DRM-FIMD

2012-09-21 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos4 and exynos5 devices.

This patchset is based and tested on top of v3.6-rc4 on smdk5250 board
Also depends on below patchset
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V5:
- Moved the documentation file to appropriate location.
- Given more description in the commit message to the patch 
  video: drm: exynos: Add device tree support

Changes since V4:
- Changed the compatible string from samsung,exynos4-fb to
  samsung,exynos4-fimd.

Changes since V3:
- Removed the fimd version from driver data and using timing base
  address instead
- Removed the drm_ prefixes to the structures and fucntions

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for drm fimd
  video: drm: exynos: Add device tree support

 .../devicetree/bindings/drm/exynos/fimd.txt|   80 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |  138 +++-
 2 files changed, 212 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/exynos/fimd.txt

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


[PATCH V6 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd

2012-09-21 Thread Leela Krishna Amudala
Two device ids are created for exynos4-fb and exynos5-fb.
Also, added driver data for exynos4 and exynos5 to pick the timing base address
at runtime to write data into appropriate register address.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   43 +++---
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index d96db5e..1ad10b6 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@
 
 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))
 
+struct fimd_driver_data {
+   unsigned int timing_base;
+};
+
+struct fimd_driver_data exynos4_fimd_driver_data = {
+   .timing_base = 0x0,
+};
+
+struct fimd_driver_data exynos5_fimd_driver_data = {
+   .timing_base = 0x2,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static inline struct fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct fimd_driver_data *)
+   platform_get_device_id(pdev)-driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS(%s\n, __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx-panel;
struct fb_videomode *timing = panel-timing;
+   struct fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;
 
+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx-suspended)
return;
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
/* setup polarity values from machine code. */
-   writel(ctx-vidcon1, ctx-regs + VIDCON1);
+   writel(ctx-vidcon1, ctx-regs + driver_data-timing_base + VIDCON1);
 
/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing-upper_margin - 1) |
   VIDTCON0_VFPD(timing-lower_margin - 1) |
   VIDTCON0_VSPW(timing-vsync_len - 1);
-   writel(val, ctx-regs + VIDTCON0);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON0);
 
/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing-left_margin - 1) |
   VIDTCON1_HFPD(timing-right_margin - 1) |
   VIDTCON1_HSPW(timing-hsync_len - 1);
-   writel(val, ctx-regs + VIDTCON1);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON1);
 
/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing-yres - 1) |
   VIDTCON2_HOZVAL(timing-xres - 1);
-   writel(val, ctx-regs + VIDTCON2);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON2);
 
/* setup clock source, clock divider, enable dma. */
val = ctx-vidcon0;
@@ -977,6 +999,18 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif
 
+static struct platform_device_id fimd_driver_ids[] = {
+   {
+   .name   = exynos4-fb,
+   .driver_data= (unsigned long)exynos4_fimd_driver_data,
+   }, {
+   .name   = exynos5-fb,
+   .driver_data= (unsigned long)exynos5_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -985,6 +1019,7 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = fimd_driver_ids,
.driver = {
.name   = exynos4-fb,
.owner  = THIS_MODULE,
-- 
1.7.0.4

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


[PATCH V6 2/2] video: drm: exynos: Add device tree support

2012-09-21 Thread Leela Krishna Amudala
This patch adds device tree based discovery support for exynos DRM-FIMD
driver which includes driver modification to handle platform data in
both the cases with DT and non-DT, Also adds the documentation for bindings.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 .../devicetree/bindings/drm/exynos/fimd.txt|   80 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c   |   95 +++-
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/drm/exynos/fimd.txt

diff --git a/Documentation/devicetree/bindings/drm/exynos/fimd.txt 
b/Documentation/devicetree/bindings/drm/exynos/fimd.txt
new file mode 100644
index 000..e94120c
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/exynos/fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be samsung,exynos5-fimd or samsung,exynos4-fimd for
+   fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = samsung,exynos5-fimd;
+   interrupt-parent = combiner;
+   reg = 0x1440 0x4;
+   interrupts = 18 5, 18 4, 18 6;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = 4 4 4 480;
+   lcd-vtiming = 4 4 4 320;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = lcd_fimd0;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = 60;
+   samsung,default-window = 0;
+   samsung,fimd-win-bpp = 32;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 1ad10b6..b2d22ac 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include linux/platform_device.h
 #include linux/clk.h
 #include linux/pm_runtime.h
+#include linux/of.h
 
 #include video/samsung_fimd.h
 #include drm/exynos_drm.h
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static const struct of_device_id fimd_dt_match[];
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev-dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_ptr(fimd_dt_match);
+   return (struct fimd_driver_data *)match-data;
+   }
+#endif
return (struct fimd_driver_data *)
platform_get_device_id(pdev)-driver_data;
 }
@@ -809,12 +819,77 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }
 
+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev-of_node;
+   struct device_node

[PATCH V2] drm/exynos: Add match table for drm platform device

2012-09-21 Thread Leela Krishna Amudala
This patch is a part of moving the driver to support DT style probing
of exynos drm device. The compatible name should match with the
entry in the dtsi file.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |   11 +++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d070719..495be89 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -294,12 +294,23 @@ static int exynos_drm_platform_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id drm_device_dt_match[] = {
+   { .compatible = samsung,exynos-drm-device},
+   {},
+};
+MODULE_DEVICE_TABLE(of, drm_device_dt_match);
+#else
+#define drm_device_dt_match NULL
+#endif
+
 static struct platform_driver exynos_drm_platform_driver = {
.probe  = exynos_drm_platform_probe,
.remove = __devexit_p(exynos_drm_platform_remove),
.driver = {
.owner  = THIS_MODULE,
.name   = exynos-drm,
+   .of_match_table = of_match_ptr(drm_device_dt_match),
},
 };
 
-- 
1.7.0.4

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


[PATCH V4 2/2] video: drm: exynos: Add device tree support

2012-09-20 Thread Leela Krishna Amudala
Hello Inki Dae,

On Thu, Sep 20, 2012 at 11:59 AM, Inki Dae  wrote:
> Hi,
>
> I had merged this patch set but I realizes this patch has no
> descriptions enough so please add the descriptions what is this patch.
>

Will give more description and post the next version.

>
> 2012/9/6 Leela Krishna Amudala :
>> Add device tree based discovery support for DRM-FIMD driver.
>>
>> Signed-off-by: Leela Krishna Amudala 
>> ---
>>  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
>
> and, how about making drm folder instead of fb? so like below;
>  Documentation/devicetree/bindings/drm/exynos/fimd.txt
>

Okay, will move it to the drm folder.

Best Wishes,
Leela Krishna Amudala.

> Thanks,
> Inki Dae
>
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 
>> -
>>  2 files changed, 173 insertions(+), 2 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt
>>
>> diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
>> b/Documentation/devicetree/bindings/fb/drm-fimd.txt
>> new file mode 100644
>> index 000..4ff1829
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
>> @@ -0,0 +1,80 @@
>> +* Samsung Display Controller using DRM frame work
>> +
>> +The display controller is used to transfer image data from memory to an
>> +external LCD driver interface. It supports various color formats such as
>> +rgb and yuv.
>> +
>> +Required properties:
>> + - compatible: Should be "samsung,exynos5-fimd" or "samsung,exynos4-fb" for
>> +   fimd using DRM frame work.
>> + - reg: physical base address of the controller and length of memory
>> +   mapped region.
>> + - interrupts: Three interrupts should be specified. The interrupts should 
>> be
>> +   specified in the following order.
>> +   - VSYNC interrupt
>> +   - FIFO level interrupt
>> +   - FIMD System Interrupt
>> +
>> + - samsung,fimd-display: This property should specify the phandle of the
>> +   display device node which holds the video interface timing with the
>> +   below mentioned properties.
>> +
>> +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
>> + horizontal timing includes four parameters in the following order.
>> +
>> + - horizontal back porch (in number of lcd clocks)
>> + - horizontal front porch (in number of lcd clocks)
>> + - hsync pulse width (in number of lcd clocks)
>> + - Display panels X resolution.
>> +
>> +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
>> + vertical timing includes four parameters in the following order.
>> +
>> + - vertical back porch (in number of lcd lines)
>> + - vertical front porch (in number of lcd lines)
>> + - vsync pulse width (in number of lcd clocks)
>> + - Display panels Y resolution.
>> +
>> +
>> + - samsung,default-window: Specifies the default window number of the fimd 
>> controller.
>> +
>> + - samsung,fimd-win-bpp: Specifies the bits per pixel.
>> +
>> +Optional properties:
>> + - samsung,fimd-vidout-rgb: Video output format is RGB.
>> + - samsung,fimd-inv-vclk: invert video clock polarity.
>> + - samsung,fimd-frame-rate: Number of video frames per second.
>> +
>> +Example:
>> +
>> +   The following is an example for the fimd controller is split into
>> +   two portions. The SoC specific portion can be specified in the SoC
>> +   specific dts file. The board specific portion can be specified in the
>> +   board specific dts file.
>> +
>> +   - SoC Specific portion
>> +
>> +   fimd {
>> +   compatible = "samsung,exynos5-fimd";
>> +   interrupt-parent = <>;
>> +   reg = <0x1440 0x4>;
>> +   interrupts = <18 5>, <18 4>, <18 6>;
>> +   };
>> +
>> +   - Board Specific portion
>> +
>> +   lcd_fimd0: lcd_panel0 {
>> +   lcd-htiming = <4 4 4 480>;
>> +   lcd-vtiming = <4 4 4 320>;
>> +   supports-mipi-panel;
>> +   };
>> +
>> +   fimd {
>> +   samsung,fimd-display = <_fimd0>;
>> +   samsung,fimd-vidout-rgb;
>> +   samsung,fimd-inv-vclk;
>> +   samsung,fimd-frame-rate = <60>;
>> +   samsung,def

Re: [PATCH V4 2/2] video: drm: exynos: Add device tree support

2012-09-20 Thread Leela Krishna Amudala
Hello Inki Dae,

On Thu, Sep 20, 2012 at 11:59 AM, Inki Dae inki@samsung.com wrote:
 Hi,

 I had merged this patch set but I realizes this patch has no
 descriptions enough so please add the descriptions what is this patch.


Will give more description and post the next version.


 2012/9/6 Leela Krishna Amudala l.kris...@samsung.com:
 Add device tree based discovery support for DRM-FIMD driver.

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +

 and, how about making drm folder instead of fb? so like below;
  Documentation/devicetree/bindings/drm/exynos/fimd.txt


Okay, will move it to the drm folder.

Best Wishes,
Leela Krishna Amudala.

 Thanks,
 Inki Dae

  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 
 -
  2 files changed, 173 insertions(+), 2 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

 diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
 b/Documentation/devicetree/bindings/fb/drm-fimd.txt
 new file mode 100644
 index 000..4ff1829
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
 @@ -0,0 +1,80 @@
 +* Samsung Display Controller using DRM frame work
 +
 +The display controller is used to transfer image data from memory to an
 +external LCD driver interface. It supports various color formats such as
 +rgb and yuv.
 +
 +Required properties:
 + - compatible: Should be samsung,exynos5-fimd or samsung,exynos4-fb for
 +   fimd using DRM frame work.
 + - reg: physical base address of the controller and length of memory
 +   mapped region.
 + - interrupts: Three interrupts should be specified. The interrupts should 
 be
 +   specified in the following order.
 +   - VSYNC interrupt
 +   - FIFO level interrupt
 +   - FIMD System Interrupt
 +
 + - samsung,fimd-display: This property should specify the phandle of the
 +   display device node which holds the video interface timing with the
 +   below mentioned properties.
 +
 +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
 + horizontal timing includes four parameters in the following order.
 +
 + - horizontal back porch (in number of lcd clocks)
 + - horizontal front porch (in number of lcd clocks)
 + - hsync pulse width (in number of lcd clocks)
 + - Display panels X resolution.
 +
 +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
 + vertical timing includes four parameters in the following order.
 +
 + - vertical back porch (in number of lcd lines)
 + - vertical front porch (in number of lcd lines)
 + - vsync pulse width (in number of lcd clocks)
 + - Display panels Y resolution.
 +
 +
 + - samsung,default-window: Specifies the default window number of the fimd 
 controller.
 +
 + - samsung,fimd-win-bpp: Specifies the bits per pixel.
 +
 +Optional properties:
 + - samsung,fimd-vidout-rgb: Video output format is RGB.
 + - samsung,fimd-inv-vclk: invert video clock polarity.
 + - samsung,fimd-frame-rate: Number of video frames per second.
 +
 +Example:
 +
 +   The following is an example for the fimd controller is split into
 +   two portions. The SoC specific portion can be specified in the SoC
 +   specific dts file. The board specific portion can be specified in the
 +   board specific dts file.
 +
 +   - SoC Specific portion
 +
 +   fimd {
 +   compatible = samsung,exynos5-fimd;
 +   interrupt-parent = combiner;
 +   reg = 0x1440 0x4;
 +   interrupts = 18 5, 18 4, 18 6;
 +   };
 +
 +   - Board Specific portion
 +
 +   lcd_fimd0: lcd_panel0 {
 +   lcd-htiming = 4 4 4 480;
 +   lcd-vtiming = 4 4 4 320;
 +   supports-mipi-panel;
 +   };
 +
 +   fimd {
 +   samsung,fimd-display = lcd_fimd0;
 +   samsung,fimd-vidout-rgb;
 +   samsung,fimd-inv-vclk;
 +   samsung,fimd-frame-rate = 60;
 +   samsung,default-window = 0;
 +   samsung,fimd-win-bpp = 32;
 +   };
 +
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 3701fbe..a4fa8e9 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -18,6 +18,7 @@
  #include linux/platform_device.h
  #include linux/clk.h
  #include linux/pm_runtime.h
 +#include linux/of.h

  #include video/samsung_fimd.h
  #include drm/exynos_drm.h
 @@ -103,9 +104,18 @@ struct fimd_context {
 struct exynos_drm_panel_info *panel;
  };

 +static const struct of_device_id fimd_dt_match[];
 +
  static inline struct fimd_driver_data *drm_fimd_get_driver_data(
 struct platform_device *pdev)
  {
 +#ifdef CONFIG_OF
 +   if (pdev-dev.of_node) {
 +   const struct of_device_id *match

[PATCH] video: drm: Add match table for drm platform device

2012-09-19 Thread Leela Krishna Amudala
This patch adds match table for drm platform device.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d070719..18abdcc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -294,12 +294,21 @@ static int exynos_drm_platform_remove(struct 
platform_device *pdev)
return 0;
 }

+#ifdef CONFIG_OF
+static const struct of_device_id drm_device_dt_match[] = {
+   { .compatible = "samsung,exynos-drm-device"},
+   {},
+};
+MODULE_DEVICE_TABLE(of, drm_device_dt_match);
+#endif
+
 static struct platform_driver exynos_drm_platform_driver = {
.probe  = exynos_drm_platform_probe,
.remove = __devexit_p(exynos_drm_platform_remove),
.driver = {
.owner  = THIS_MODULE,
.name   = "exynos-drm",
+   .of_match_table = of_match_ptr(drm_device_dt_match),
},
 };

-- 
1.7.0.4



[PATCH] video: drm: Add match table for drm platform device

2012-09-18 Thread Leela Krishna Amudala
This patch adds match table for drm platform device.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c 
b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index d070719..18abdcc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -294,12 +294,21 @@ static int exynos_drm_platform_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id drm_device_dt_match[] = {
+   { .compatible = samsung,exynos-drm-device},
+   {},
+};
+MODULE_DEVICE_TABLE(of, drm_device_dt_match);
+#endif
+
 static struct platform_driver exynos_drm_platform_driver = {
.probe  = exynos_drm_platform_probe,
.remove = __devexit_p(exynos_drm_platform_remove),
.driver = {
.owner  = THIS_MODULE,
.name   = exynos-drm,
+   .of_match_table = of_match_ptr(drm_device_dt_match),
},
 };
 
-- 
1.7.0.4

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


[PATCH V5 2/2] video: drm: exynos: Add device tree support

2012-09-07 Thread Leela Krishna Amudala
Add device tree based discovery support for DRM-FIMD driver.

Signed-off-by: Leela Krishna Amudala 
---
 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 -
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
b/Documentation/devicetree/bindings/fb/drm-fimd.txt
new file mode 100644
index 000..bf94cd6
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be "samsung,exynos5-fimd" or "samsung,exynos4-fimd" for 
+   fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = "samsung,exynos5-fimd";
+   interrupt-parent = <>;
+   reg = <0x1440 0x4>;
+   interrupts = <18 5>, <18 4>, <18 6>;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = <4 4 4 480>;
+   lcd-vtiming = <4 4 4 320>;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = <_fimd0>;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = <60>;
+   samsung,default-window = <0>;
+   samsung,fimd-win-bpp = <32>;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 65e927b..cd1b841 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static const struct of_device_id fimd_dt_match[];
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_ptr(fimd_dt_match);
+   return (struct fimd_driver_data *)match->data;
+   }
+#endif
return (struct fimd_driver_data *)
platform_get_device_id(pdev)->driver_data;
 }
@@ -809,12 +819,77 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }

+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev->of_node;
+   struct device_node *disp_np;
+   struct exynos_drm_fimd_pdata *pd;
+   u32 data[4];
+
+   pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
+   if (!pd) {

[PATCH V5 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd

2012-09-07 Thread Leela Krishna Amudala
Two device ids are created for exynos4-fb and exynos5-fb.
Also, added driver data for exynos4 and exynos5 to pick the timing base address
at runtime to write data into appropriate register address.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   43 +++---
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 24c0bd4..65e927b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@

 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))

+struct fimd_driver_data {
+   unsigned int timing_base;
+};
+
+struct fimd_driver_data exynos4_fimd_driver_data = {
+   .timing_base = 0x0,
+};
+
+struct fimd_driver_data exynos5_fimd_driver_data = {
+   .timing_base = 0x2,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static inline struct fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct fimd_driver_data *)
+   platform_get_device_id(pdev)->driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx->panel;
struct fb_videomode *timing = >timing;
+   struct fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;

+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx->suspended)
return;

DRM_DEBUG_KMS("%s\n", __FILE__);

/* setup polarity values from machine code. */
-   writel(ctx->vidcon1, ctx->regs + VIDCON1);
+   writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);

/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing->upper_margin - 1) |
   VIDTCON0_VFPD(timing->lower_margin - 1) |
   VIDTCON0_VSPW(timing->vsync_len - 1);
-   writel(val, ctx->regs + VIDTCON0);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);

/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing->left_margin - 1) |
   VIDTCON1_HFPD(timing->right_margin - 1) |
   VIDTCON1_HSPW(timing->hsync_len - 1);
-   writel(val, ctx->regs + VIDTCON1);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);

/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing->yres - 1) |
   VIDTCON2_HOZVAL(timing->xres - 1);
-   writel(val, ctx->regs + VIDTCON2);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);

/* setup clock source, clock divider, enable dma. */
val = ctx->vidcon0;
@@ -982,6 +1004,18 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif

+static struct platform_device_id fimd_driver_ids[] = {
+   {
+   .name   = "exynos4-fb",
+   .driver_data= (unsigned long)_fimd_driver_data,
+   }, {
+   .name   = "exynos5-fb",
+   .driver_data= (unsigned long)_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -990,6 +1024,7 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = fimd_driver_ids,
.driver = {
.name   = "exynos4-fb",
.owner  = THIS_MODULE,
-- 
1.7.0.4



[PATCH V5 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-09-07 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos4 and exynos5 devices.

This patchset is based and tested on top of v3.6-rc4 on smdk5250 board
Also depends on below patchset
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V4:
- Changed the compatible string from "samsung,exynos4-fb" to
  "samsung,exynos4-fimd".

Changes since V3:
- Removed the fimd version from driver data and using timing base
  address instead
- Removed the drm_ prefixes to the structures and fucntions

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for drm fimd
  video: drm: exynos: Add device tree support

 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  138 -
 2 files changed, 212 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt



[PATCH V4 2/2] video: drm: exynos: Add device tree support

2012-09-07 Thread Leela Krishna Amudala
Hi,

On Thu, Sep 6, 2012 at 4:35 PM, Sylwester Nawrocki
 wrote:
> Hi,
>
> On 09/06/2012 09:21 AM, InKi Dae wrote:
 +Required properties:
 + - compatible: Should be "samsung,exynos5-fimd" or "samsung,exynos4-fb" 
 for
>>> Doesn't better to use single word? fimd or fb?. I think 'fb' is used
>>> for framebuffer historically.
>>> but now it's used both fb and drm, so fimd is neutral and architecture
>>> specific.
>>>
>>> To do this, Modify arch-exynos first and update it at each drivers it 
>>> properly.
>>>
>>> Thank you,
>>> Kyungmin Park
>>>
>>
>> I agree with Kyungmin but I'd like to use as is. the reason we used
>> 'exynos4-fb' as device name, is for that it uses fimd driver's
>> platform device commonly and gets fimd clock. so I think that dts file
>> should be defined with hardware specific name but not driver name such
>> as 'exynos4-fb'. but with this, we can't get fimd clock with device's
>> name because 'exynos4-fb' is used as device name of fimd clock. so to
>> use 'exynos4-fimd', we should modify the device name of fimd clock
>> from 'exynos4-fb'  to 'exynos4-fimd' and also ids definitions of
>> s3c-fb and drm fimd driver. so my conclusion is that it merges this
>
> I think it's good moment to put those things in order, i.e. use uniform
> 'compatible' names: "samsung,exynos4-fimd", "samsung,exynos5-fimd".
> Platform device names are separate issue, but could perhaps be unified
> at this time as well.

Yes, Platform device name is independent of compatible string.
Will change the compatible string to "samsung,exynos4-fimd" and will keep the
device name as exynos4-fb for now. Will change the platform device
names to exynosX-fimd
later.

>
>> patch set as is and then let's modify related things later.
>> any opinions, welcome~ anytime.
>>
>> Thanks.
>> Inki Dae
>
> --
>
> Regards,
> Sylwester
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" 
> in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V5 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-09-07 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos4 and exynos5 devices.

This patchset is based and tested on top of v3.6-rc4 on smdk5250 board
Also depends on below patchset
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V4:
- Changed the compatible string from samsung,exynos4-fb to
  samsung,exynos4-fimd.

Changes since V3:
- Removed the fimd version from driver data and using timing base
  address instead
- Removed the drm_ prefixes to the structures and fucntions

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for drm fimd
  video: drm: exynos: Add device tree support

 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  138 -
 2 files changed, 212 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

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


[PATCH V5 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd

2012-09-07 Thread Leela Krishna Amudala
Two device ids are created for exynos4-fb and exynos5-fb.
Also, added driver data for exynos4 and exynos5 to pick the timing base address
at runtime to write data into appropriate register address.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   43 +++---
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 24c0bd4..65e927b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@
 
 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))
 
+struct fimd_driver_data {
+   unsigned int timing_base;
+};
+
+struct fimd_driver_data exynos4_fimd_driver_data = {
+   .timing_base = 0x0,
+};
+
+struct fimd_driver_data exynos5_fimd_driver_data = {
+   .timing_base = 0x2,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static inline struct fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct fimd_driver_data *)
+   platform_get_device_id(pdev)-driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS(%s\n, __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx-panel;
struct fb_videomode *timing = panel-timing;
+   struct fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;
 
+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx-suspended)
return;
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
/* setup polarity values from machine code. */
-   writel(ctx-vidcon1, ctx-regs + VIDCON1);
+   writel(ctx-vidcon1, ctx-regs + driver_data-timing_base + VIDCON1);
 
/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing-upper_margin - 1) |
   VIDTCON0_VFPD(timing-lower_margin - 1) |
   VIDTCON0_VSPW(timing-vsync_len - 1);
-   writel(val, ctx-regs + VIDTCON0);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON0);
 
/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing-left_margin - 1) |
   VIDTCON1_HFPD(timing-right_margin - 1) |
   VIDTCON1_HSPW(timing-hsync_len - 1);
-   writel(val, ctx-regs + VIDTCON1);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON1);
 
/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing-yres - 1) |
   VIDTCON2_HOZVAL(timing-xres - 1);
-   writel(val, ctx-regs + VIDTCON2);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON2);
 
/* setup clock source, clock divider, enable dma. */
val = ctx-vidcon0;
@@ -982,6 +1004,18 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif
 
+static struct platform_device_id fimd_driver_ids[] = {
+   {
+   .name   = exynos4-fb,
+   .driver_data= (unsigned long)exynos4_fimd_driver_data,
+   }, {
+   .name   = exynos5-fb,
+   .driver_data= (unsigned long)exynos5_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -990,6 +1024,7 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = fimd_driver_ids,
.driver = {
.name   = exynos4-fb,
.owner  = THIS_MODULE,
-- 
1.7.0.4

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


[PATCH V5 2/2] video: drm: exynos: Add device tree support

2012-09-07 Thread Leela Krishna Amudala
Add device tree based discovery support for DRM-FIMD driver.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 -
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
b/Documentation/devicetree/bindings/fb/drm-fimd.txt
new file mode 100644
index 000..bf94cd6
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be samsung,exynos5-fimd or samsung,exynos4-fimd for 
+   fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = samsung,exynos5-fimd;
+   interrupt-parent = combiner;
+   reg = 0x1440 0x4;
+   interrupts = 18 5, 18 4, 18 6;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = 4 4 4 480;
+   lcd-vtiming = 4 4 4 320;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = lcd_fimd0;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = 60;
+   samsung,default-window = 0;
+   samsung,fimd-win-bpp = 32;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 65e927b..cd1b841 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include linux/platform_device.h
 #include linux/clk.h
 #include linux/pm_runtime.h
+#include linux/of.h
 
 #include video/samsung_fimd.h
 #include drm/exynos_drm.h
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static const struct of_device_id fimd_dt_match[];
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev-dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_ptr(fimd_dt_match);
+   return (struct fimd_driver_data *)match-data;
+   }
+#endif
return (struct fimd_driver_data *)
platform_get_device_id(pdev)-driver_data;
 }
@@ -809,12 +819,77 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }
 
+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev-of_node;
+   struct device_node *disp_np;
+   struct exynos_drm_fimd_pdata *pd;
+   u32 data[4];
+
+   pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
+   if (!pd) {
+   dev_err

Re: Re: [PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-09-06 Thread Leela Krishna Amudala
Hi Tomasz,
Please find the inline comments.
Will post the next version today.

Thanks.
Leela Krishna Amudala.
--- Original Message ---
Sender : Tomasz Figat.f...@samsung.com Junior Software Engineer/SPRC-Linux 
Platform (SSD)/Samsung Electronics
Date : Sep 05, 2012 13:22 (GMT+05:30)
Title : Re: [PATCH V3 1/2] drm/exynos: add platform_device_id table and driver 
data for exynos5 drm fimd

Hi Leela,

See my comments inline.

On Thursday 16 of August 2012 12:08:08 Leela Krishna Amudala wrote:
 +enum fimd_version_type {
 + VERSION_8, /* FIMD_VERSION8 */
 +};
 +
 +struct drm_fimd_driver_data {
 + enum fimd_version_type fimd_ver;
 +};
 +
 +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
 + .fimd_ver = VERSION_8,
 +};

I think that the approach with timing_base, as suggested by Joonyoung Shim, 
would be much cleaner.

Leela: Okay, will go with timing_base approach only

 +static struct platform_device_id exynos_drm_fimd_driver_ids[] = {
 + {
 + .name = exynos4-fb,
 + }, {
 + .name = exynos5-drm-fimd,
 + .driver_data = (unsigned long)exynos5_drm_fimd_driver_data,
 + },
 + {},
 +};
 +MODULE_DEVICE_TABLE(platform, exynos_drm_fimd_driver_ids);

If I see correctly, this will crash on a null pointer dereference on 
Exynos4 without DT, because of NULL driver_data.

Leela: yes, you are right, will take care of this

P.S. I think you should CC linux-arm-kernel and linux-samsung-soc lists 
when submitting patches related to ARM and Samsung SoCs.

Leela: Okay, will do it next time.

Best regards,
-- 
Tomasz Figa
Samsung Poland RD Center
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V4 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-09-06 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos4 and exynos5 devices.

This patchset is based and tested on top of v3.6-rc4
Also depends on below patchset
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V3:
- Removed the fimd version from driver data and using timing base
  address instead
- Removed the drm_ prefixes to the structures and fucntions

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for drm fimd
  video: drm: exynos: Add device tree support

 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  140 +++-
 2 files changed, 213 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

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


[PATCH V4 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd

2012-09-06 Thread Leela Krishna Amudala
The name of the exynos drm fimd device is renamed to exynos-drm-fimd
and two device ids are created for exynos4-fb and exynos5-fb.
Also, added driver data for exynos4 and exynos5 to pick the timing base address
at runtime to write data into appropriate register address.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   45 ++---
 1 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 24c0bd4..3701fbe 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@
 
 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))
 
+struct fimd_driver_data {
+   unsigned int timing_base;
+};
+
+struct fimd_driver_data exynos4_fimd_driver_data = {
+   .timing_base = 0x0,
+};
+
+struct fimd_driver_data exynos5_fimd_driver_data = {
+   .timing_base = 0x2,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static inline struct fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct fimd_driver_data *)
+   platform_get_device_id(pdev)-driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS(%s\n, __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx-panel;
struct fb_videomode *timing = panel-timing;
+   struct fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;
 
+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx-suspended)
return;
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
/* setup polarity values from machine code. */
-   writel(ctx-vidcon1, ctx-regs + VIDCON1);
+   writel(ctx-vidcon1, ctx-regs + driver_data-timing_base + VIDCON1);
 
/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing-upper_margin - 1) |
   VIDTCON0_VFPD(timing-lower_margin - 1) |
   VIDTCON0_VSPW(timing-vsync_len - 1);
-   writel(val, ctx-regs + VIDTCON0);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON0);
 
/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing-left_margin - 1) |
   VIDTCON1_HFPD(timing-right_margin - 1) |
   VIDTCON1_HSPW(timing-hsync_len - 1);
-   writel(val, ctx-regs + VIDTCON1);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON1);
 
/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing-yres - 1) |
   VIDTCON2_HOZVAL(timing-xres - 1);
-   writel(val, ctx-regs + VIDTCON2);
+   writel(val, ctx-regs + driver_data-timing_base + VIDTCON2);
 
/* setup clock source, clock divider, enable dma. */
val = ctx-vidcon0;
@@ -982,6 +1004,18 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif
 
+static struct platform_device_id fimd_driver_ids[] = {
+   {
+   .name   = exynos4-fb,
+   .driver_data= (unsigned long)exynos4_fimd_driver_data,
+   }, {
+   .name   = exynos5-fb,
+   .driver_data= (unsigned long)exynos5_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -990,8 +1024,9 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = fimd_driver_ids,
.driver = {
-   .name   = exynos4-fb,
+   .name   = exynos-drm-fimd,
.owner  = THIS_MODULE,
.pm = fimd_pm_ops,
},
-- 
1.7.0.4

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


[PATCH V4 2/2] video: drm: exynos: Add device tree support

2012-09-06 Thread Leela Krishna Amudala
Add device tree based discovery support for DRM-FIMD driver.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 -
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
b/Documentation/devicetree/bindings/fb/drm-fimd.txt
new file mode 100644
index 000..4ff1829
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be samsung,exynos5-fimd or samsung,exynos4-fb for
+   fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = samsung,exynos5-fimd;
+   interrupt-parent = combiner;
+   reg = 0x1440 0x4;
+   interrupts = 18 5, 18 4, 18 6;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = 4 4 4 480;
+   lcd-vtiming = 4 4 4 320;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = lcd_fimd0;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = 60;
+   samsung,default-window = 0;
+   samsung,fimd-win-bpp = 32;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 3701fbe..a4fa8e9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include linux/platform_device.h
 #include linux/clk.h
 #include linux/pm_runtime.h
+#include linux/of.h
 
 #include video/samsung_fimd.h
 #include drm/exynos_drm.h
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static const struct of_device_id fimd_dt_match[];
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev-dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_ptr(fimd_dt_match);
+   return (struct fimd_driver_data *)match-data;
+   }
+#endif
return (struct fimd_driver_data *)
platform_get_device_id(pdev)-driver_data;
 }
@@ -809,12 +819,77 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }
 
+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev-of_node;
+   struct device_node *disp_np;
+   struct exynos_drm_fimd_pdata *pd;
+   u32 data[4];
+
+   pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
+   if (!pd) {
+   dev_err(dev

Re: [PATCH V4 2/2] video: drm: exynos: Add device tree support

2012-09-06 Thread Leela Krishna Amudala
Hi,

On Thu, Sep 6, 2012 at 4:35 PM, Sylwester Nawrocki
s.nawro...@samsung.com wrote:
 Hi,

 On 09/06/2012 09:21 AM, InKi Dae wrote:
 +Required properties:
 + - compatible: Should be samsung,exynos5-fimd or samsung,exynos4-fb 
 for
 Doesn't better to use single word? fimd or fb?. I think 'fb' is used
 for framebuffer historically.
 but now it's used both fb and drm, so fimd is neutral and architecture
 specific.

 To do this, Modify arch-exynos first and update it at each drivers it 
 properly.

 Thank you,
 Kyungmin Park


 I agree with Kyungmin but I'd like to use as is. the reason we used
 'exynos4-fb' as device name, is for that it uses fimd driver's
 platform device commonly and gets fimd clock. so I think that dts file
 should be defined with hardware specific name but not driver name such
 as 'exynos4-fb'. but with this, we can't get fimd clock with device's
 name because 'exynos4-fb' is used as device name of fimd clock. so to
 use 'exynos4-fimd', we should modify the device name of fimd clock
 from 'exynos4-fb'  to 'exynos4-fimd' and also ids definitions of
 s3c-fb and drm fimd driver. so my conclusion is that it merges this

 I think it's good moment to put those things in order, i.e. use uniform
 'compatible' names: samsung,exynos4-fimd, samsung,exynos5-fimd.
 Platform device names are separate issue, but could perhaps be unified
 at this time as well.

Yes, Platform device name is independent of compatible string.
Will change the compatible string to samsung,exynos4-fimd and will keep the
device name as exynos4-fb for now. Will change the platform device
names to exynosX-fimd
later.


 patch set as is and then let's modify related things later.
 any opinions, welcome~ anytime.

 Thanks.
 Inki Dae

 --

 Regards,
 Sylwester
 --
 To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 
 in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V4 2/2] video: drm: exynos: Add device tree support

2012-09-05 Thread Leela Krishna Amudala
Add device tree based discovery support for DRM-FIMD driver.

Signed-off-by: Leela Krishna Amudala 
---
 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 -
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
b/Documentation/devicetree/bindings/fb/drm-fimd.txt
new file mode 100644
index 000..4ff1829
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be "samsung,exynos5-fimd" or "samsung,exynos4-fb" for
+   fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = "samsung,exynos5-fimd";
+   interrupt-parent = <>;
+   reg = <0x1440 0x4>;
+   interrupts = <18 5>, <18 4>, <18 6>;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = <4 4 4 480>;
+   lcd-vtiming = <4 4 4 320>;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = <_fimd0>;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = <60>;
+   samsung,default-window = <0>;
+   samsung,fimd-win-bpp = <32>;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 3701fbe..a4fa8e9 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static const struct of_device_id fimd_dt_match[];
+
 static inline struct fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_ptr(fimd_dt_match);
+   return (struct fimd_driver_data *)match->data;
+   }
+#endif
return (struct fimd_driver_data *)
platform_get_device_id(pdev)->driver_data;
 }
@@ -809,12 +819,77 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }

+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev->of_node;
+   struct device_node *disp_np;
+   struct exynos_drm_fimd_pdata *pd;
+   u32 data[4];
+
+   pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
+   if (!pd) {

[PATCH V4 1/2] drm/exynos: add platform_device_id table and driver data for drm fimd

2012-09-05 Thread Leela Krishna Amudala
The name of the exynos drm fimd device is renamed to exynos-drm-fimd
and two device ids are created for exynos4-fb and exynos5-fb.
Also, added driver data for exynos4 and exynos5 to pick the timing base address
at runtime to write data into appropriate register address.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   45 ++---
 1 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 24c0bd4..3701fbe 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@

 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))

+struct fimd_driver_data {
+   unsigned int timing_base;
+};
+
+struct fimd_driver_data exynos4_fimd_driver_data = {
+   .timing_base = 0x0,
+};
+
+struct fimd_driver_data exynos5_fimd_driver_data = {
+   .timing_base = 0x2,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static inline struct fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct fimd_driver_data *)
+   platform_get_device_id(pdev)->driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -194,32 +213,35 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx->panel;
struct fb_videomode *timing = >timing;
+   struct fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;

+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx->suspended)
return;

DRM_DEBUG_KMS("%s\n", __FILE__);

/* setup polarity values from machine code. */
-   writel(ctx->vidcon1, ctx->regs + VIDCON1);
+   writel(ctx->vidcon1, ctx->regs + driver_data->timing_base + VIDCON1);

/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing->upper_margin - 1) |
   VIDTCON0_VFPD(timing->lower_margin - 1) |
   VIDTCON0_VSPW(timing->vsync_len - 1);
-   writel(val, ctx->regs + VIDTCON0);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON0);

/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing->left_margin - 1) |
   VIDTCON1_HFPD(timing->right_margin - 1) |
   VIDTCON1_HSPW(timing->hsync_len - 1);
-   writel(val, ctx->regs + VIDTCON1);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);

/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing->yres - 1) |
   VIDTCON2_HOZVAL(timing->xres - 1);
-   writel(val, ctx->regs + VIDTCON2);
+   writel(val, ctx->regs + driver_data->timing_base + VIDTCON2);

/* setup clock source, clock divider, enable dma. */
val = ctx->vidcon0;
@@ -982,6 +1004,18 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif

+static struct platform_device_id fimd_driver_ids[] = {
+   {
+   .name   = "exynos4-fb",
+   .driver_data= (unsigned long)_fimd_driver_data,
+   }, {
+   .name   = "exynos5-fb",
+   .driver_data= (unsigned long)_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -990,8 +1024,9 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = fimd_driver_ids,
.driver = {
-   .name   = "exynos4-fb",
+   .name   = "exynos-drm-fimd",
.owner  = THIS_MODULE,
.pm = _pm_ops,
},
-- 
1.7.0.4



[PATCH V4 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-09-05 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos4 and exynos5 devices.

This patchset is based and tested on top of v3.6-rc4
Also depends on below patchset
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V3:
- Removed the fimd version from driver data and using timing base
  address instead
- Removed the drm_ prefixes to the structures and fucntions

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for drm fimd
  video: drm: exynos: Add device tree support

 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  140 +++-
 2 files changed, 213 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt



[PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-09-05 Thread Leela Krishna Amudala
Hi Tomasz,
Please find the inline comments.
Will post the next version today.

Thanks.
Leela Krishna Amudala.
--- Original Message ---
Sender : Tomasz Figa Junior Software Engineer/SPRC-Linux 
Platform (SSD)/Samsung Electronics
Date : Sep 05, 2012 13:22 (GMT+05:30)
Title : Re: [PATCH V3 1/2] drm/exynos: add platform_device_id table and driver 
data for exynos5 drm fimd

Hi Leela,

See my comments inline.

On Thursday 16 of August 2012 12:08:08 Leela Krishna Amudala wrote:
> +enum fimd_version_type {
> + VERSION_8, /* FIMD_VERSION8 */
> +};
> +
> +struct drm_fimd_driver_data {
> + enum fimd_version_type fimd_ver;
> +};
> +
> +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
> + .fimd_ver = VERSION_8,
> +};

I think that the approach with timing_base, as suggested by Joonyoung Shim, 
would be much cleaner.

Leela: Okay, will go with timing_base approach only

> +static struct platform_device_id exynos_drm_fimd_driver_ids[] = {
> + {
> + .name = "exynos4-fb",
> + }, {
> + .name = "exynos5-drm-fimd",
> + .driver_data = (unsigned long)_drm_fimd_driver_data,
> + },
> + {},
> +};
> +MODULE_DEVICE_TABLE(platform, exynos_drm_fimd_driver_ids);

If I see correctly, this will crash on a null pointer dereference on 
Exynos4 without DT, because of NULL driver_data.

Leela: yes, you are right, will take care of this

P.S. I think you should CC linux-arm-kernel and linux-samsung-soc lists 
when submitting patches related to ARM and Samsung SoCs.

Leela: Okay, will do it next time.

Best regards,
-- 
Tomasz Figa
Samsung Poland R Center


[PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-09-04 Thread Leela Krishna Amudala
Hello Inki Dae,

On Tue, Sep 4, 2012 at 7:45 PM, InKi Dae  wrote:
> 2012/8/16 Leela Krishna Amudala :
>> The name of the exynos drm fimd device is renamed to exynos-drm-fimd
>> and two device ids are created for exynos4-fb and exynos5-drm-fimd.
>> Also, added driver data for exynos5 to pick the fimd version at runtime and
>> to choose the VIDTCON register offsets accordingly.
>>
>> Signed-off-by: Leela Krishna Amudala 
>> ---
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   56 
>> +++---
>>  1 files changed, 51 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
>> b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> index 24c0bd4..8379c59 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
>> @@ -57,6 +57,18 @@
>>
>>  #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))
>>
>> +enum fimd_version_type {
>> +   VERSION_8, /* FIMD_VERSION8 */
>> +};
>> +
>> +struct drm_fimd_driver_data {
>> +   enum fimd_version_type fimd_ver;
>> +};
>> +
>> +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
>> +   .fimd_ver = VERSION_8,
>> +};
>> +
>>  struct fimd_win_data {
>> unsigned intoffset_x;
>> unsigned intoffset_y;
>> @@ -91,6 +103,13 @@ struct fimd_context {
>> struct exynos_drm_panel_info *panel;
>>  };
>>
>> +static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
>> +   struct platform_device *pdev)
>> +{
>> +   return (struct drm_fimd_driver_data *)
>> +   platform_get_device_id(pdev)->driver_data;
>> +}
>> +
>>  static bool fimd_display_is_connected(struct device *dev)
>>  {
>> DRM_DEBUG_KMS("%s\n", __FILE__);
>> @@ -194,32 +213,47 @@ static void fimd_commit(struct device *dev)
>> struct fimd_context *ctx = get_fimd_context(dev);
>> struct exynos_drm_panel_info *panel = ctx->panel;
>> struct fb_videomode *timing = >timing;
>> +   struct drm_fimd_driver_data *driver_data;
>> +   struct platform_device *pdev = to_platform_device(dev);
>> u32 val;
>>
>> +   driver_data = drm_fimd_get_driver_data(pdev);
>> if (ctx->suspended)
>> return;
>>
>> DRM_DEBUG_KMS("%s\n", __FILE__);
>>
>> /* setup polarity values from machine code. */
>> -   writel(ctx->vidcon1, ctx->regs + VIDCON1);
>> +   if (driver_data->fimd_ver == VERSION_8)
>> +   writel(ctx->vidcon1, ctx->regs + FIMD_V8_VIDCON1);
>
> where are FIMD_V8_VIDCON0/1/2 defined? it seems like that you missed some 
> codes.
>

Details are given in [PATCH V3 0/2] video: drm: Add Device tree
support to DRM-FIMD
This patch set depends on
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html,
which is already merged into Kukjin's for-next branch.

>> +   else
>> +   writel(ctx->vidcon1, ctx->regs + VIDCON1);
>>
>> /* setup vertical timing values. */
>> val = VIDTCON0_VBPD(timing->upper_margin - 1) |
>>VIDTCON0_VFPD(timing->lower_margin - 1) |
>>VIDTCON0_VSPW(timing->vsync_len - 1);
>> -   writel(val, ctx->regs + VIDTCON0);
>> +   if (driver_data->fimd_ver == VERSION_8)
>> +   writel(val, ctx->regs + FIMD_V8_VIDTCON0);
>> +   else
>> +   writel(val, ctx->regs + VIDTCON0);
>>
>> /* setup horizontal timing values.  */
>> val = VIDTCON1_HBPD(timing->left_margin - 1) |
>>VIDTCON1_HFPD(timing->right_margin - 1) |
>>VIDTCON1_HSPW(timing->hsync_len - 1);
>> -   writel(val, ctx->regs + VIDTCON1);
>> +   if (driver_data->fimd_ver == VERSION_8)
>> +   writel(val, ctx->regs + FIMD_V8_VIDTCON1);
>> +   else
>> +   writel(val, ctx->regs + VIDTCON1);
>>
>> /* setup horizontal and vertical display size. */
>> val = VIDTCON2_LINEVAL(timing->yres - 1) |
>>VIDTCON2_HOZVAL(timing->xres - 1);
>> -   writel(val, ctx->regs + VIDTCON2);
>> +   if (driver_data->fimd_ver == VERSION_8)
>> +   writel(val, ctx->regs + FIMD_V8_VIDTCON2);
>> +   else
>> +   writel(val, ctx-&

[PATCH V3 2/2] video: drm: exynos: Add device tree support

2012-09-04 Thread Leela Krishna Amudala
Hello Inki Dae,

On Tue, Sep 4, 2012 at 7:42 PM, InKi Dae  wrote:
>
> 2012/8/16 Leela Krishna Amudala :
> > Add device tree based discovery support for DRM-FIMD driver.
> >
> > Signed-off-by: Leela Krishna Amudala 
> > ---
> >  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80
> > +
> >  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95
> > -
> >  2 files changed, 173 insertions(+), 2 deletions(-)
> >  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt
> >
> > diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt
> > b/Documentation/devicetree/bindings/fb/drm-fimd.txt
> > new file mode 100644
> > index 000..8ad8814
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
> > @@ -0,0 +1,80 @@
> > +* Samsung Display Controller using DRM frame work
> > +
> > +The display controller is used to transfer image data from memory to an
> > +external LCD driver interface. It supports various color formats such
> > as
> > +rgb and yuv.
> > +
> > +Required properties:
> > + - compatible: Should be "samsung,exynos5-drm" for fimd using DRM frame
> > work.
> > + - reg: physical base address of the controller and length of memory
> > +   mapped region.
> > + - interrupts: Three interrupts should be specified. The interrupts
> > should be
> > +   specified in the following order.
> > +   - VSYNC interrupt
> > +   - FIFO level interrupt
> > +   - FIMD System Interrupt
> > +
> > + - samsung,fimd-display: This property should specify the phandle of
> > the
> > +   display device node which holds the video interface timing with the
> > +   below mentioned properties.
> > +
> > +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
> > + horizontal timing includes four parameters in the following order.
> > +
> > + - horizontal back porch (in number of lcd clocks)
> > + - horizontal front porch (in number of lcd clocks)
> > + - hsync pulse width (in number of lcd clocks)
> > + - Display panels X resolution.
> > +
> > +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
> > + vertical timing includes four parameters in the following order.
> > +
> > + - vertical back porch (in number of lcd lines)
> > + - vertical front porch (in number of lcd lines)
> > + - vsync pulse width (in number of lcd clocks)
> > + - Display panels Y resolution.
> > +
> > +
> > + - samsung,default-window: Specifies the default window number of the
> > fimd controller.
> > +
> > + - samsung,fimd-win-bpp: Specifies the bits per pixel.
> > +
> > +Optional properties:
> > + - supports-mipi-panel: Specifies the lcd is mipi panel type
> > + - samsung,fimd-vidout-rgb: Video output format is RGB.
> > + - samsung,fimd-inv-vclk: invert video clock polarity.
> > + - samsung,fimd-frame-rate: Number of video frames per second.
> > +
> > +Example:
> > +
> > +   The following is an example for the fimd controller is split
> > into
> > +   two portions. The SoC specific portion can be specified in the
> > SoC
> > +   specific dts file. The board specific portion can be specified
> > in the
> > +   board specific dts file.
> > +
> > +   - SoC Specific portion
> > +
> > +   fimd {
> > +   compatible = "samsung,exynos5-drm";
> > +   interrupt-parent = <>;
> > +   reg = <0x1440 0x4>;
> > +   interrupts = <18 5>, <18 4>, <18 6>;
> > +   };
> > +
> > +   - Board Specific portion
> > +
> > +   lcd_fimd0: lcd_panel0 {
> > +   lcd-htiming = <4 4 4 480>;
> > +   lcd-vtiming = <4 4 4 320>;
> > +   supports-mipi-panel;
> > +   };
> > +
> > +   fimd {
> > +   samsung,fimd-display = <_fimd0>;
> > +   samsung,fimd-vidout-rgb;
> > +   samsung,fimd-inv-vclk;
> > +   samsung,fimd-frame-rate = <60>;
> > +   samsung,default-window = <0>;
> > +   samsung,fimd-win-bpp = <32>;
> > +   };
> > +
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > index 8379c59..1753846 100644
> > --- a/drive

Re: [PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-09-04 Thread Leela Krishna Amudala
Hello Inki Dae,

On Tue, Sep 4, 2012 at 7:45 PM, InKi Dae inki@samsung.com wrote:
 2012/8/16 Leela Krishna Amudala l.kris...@samsung.com:
 The name of the exynos drm fimd device is renamed to exynos-drm-fimd
 and two device ids are created for exynos4-fb and exynos5-drm-fimd.
 Also, added driver data for exynos5 to pick the fimd version at runtime and
 to choose the VIDTCON register offsets accordingly.

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   56 
 +++---
  1 files changed, 51 insertions(+), 5 deletions(-)

 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 24c0bd4..8379c59 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -57,6 +57,18 @@

  #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))

 +enum fimd_version_type {
 +   VERSION_8, /* FIMD_VERSION8 */
 +};
 +
 +struct drm_fimd_driver_data {
 +   enum fimd_version_type fimd_ver;
 +};
 +
 +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
 +   .fimd_ver = VERSION_8,
 +};
 +
  struct fimd_win_data {
 unsigned intoffset_x;
 unsigned intoffset_y;
 @@ -91,6 +103,13 @@ struct fimd_context {
 struct exynos_drm_panel_info *panel;
  };

 +static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
 +   struct platform_device *pdev)
 +{
 +   return (struct drm_fimd_driver_data *)
 +   platform_get_device_id(pdev)-driver_data;
 +}
 +
  static bool fimd_display_is_connected(struct device *dev)
  {
 DRM_DEBUG_KMS(%s\n, __FILE__);
 @@ -194,32 +213,47 @@ static void fimd_commit(struct device *dev)
 struct fimd_context *ctx = get_fimd_context(dev);
 struct exynos_drm_panel_info *panel = ctx-panel;
 struct fb_videomode *timing = panel-timing;
 +   struct drm_fimd_driver_data *driver_data;
 +   struct platform_device *pdev = to_platform_device(dev);
 u32 val;

 +   driver_data = drm_fimd_get_driver_data(pdev);
 if (ctx-suspended)
 return;

 DRM_DEBUG_KMS(%s\n, __FILE__);

 /* setup polarity values from machine code. */
 -   writel(ctx-vidcon1, ctx-regs + VIDCON1);
 +   if (driver_data-fimd_ver == VERSION_8)
 +   writel(ctx-vidcon1, ctx-regs + FIMD_V8_VIDCON1);

 where are FIMD_V8_VIDCON0/1/2 defined? it seems like that you missed some 
 codes.


Details are given in [PATCH V3 0/2] video: drm: Add Device tree
support to DRM-FIMD
This patch set depends on
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html,
which is already merged into Kukjin's for-next branch.

 +   else
 +   writel(ctx-vidcon1, ctx-regs + VIDCON1);

 /* setup vertical timing values. */
 val = VIDTCON0_VBPD(timing-upper_margin - 1) |
VIDTCON0_VFPD(timing-lower_margin - 1) |
VIDTCON0_VSPW(timing-vsync_len - 1);
 -   writel(val, ctx-regs + VIDTCON0);
 +   if (driver_data-fimd_ver == VERSION_8)
 +   writel(val, ctx-regs + FIMD_V8_VIDTCON0);
 +   else
 +   writel(val, ctx-regs + VIDTCON0);

 /* setup horizontal timing values.  */
 val = VIDTCON1_HBPD(timing-left_margin - 1) |
VIDTCON1_HFPD(timing-right_margin - 1) |
VIDTCON1_HSPW(timing-hsync_len - 1);
 -   writel(val, ctx-regs + VIDTCON1);
 +   if (driver_data-fimd_ver == VERSION_8)
 +   writel(val, ctx-regs + FIMD_V8_VIDTCON1);
 +   else
 +   writel(val, ctx-regs + VIDTCON1);

 /* setup horizontal and vertical display size. */
 val = VIDTCON2_LINEVAL(timing-yres - 1) |
VIDTCON2_HOZVAL(timing-xres - 1);
 -   writel(val, ctx-regs + VIDTCON2);
 +   if (driver_data-fimd_ver == VERSION_8)
 +   writel(val, ctx-regs + FIMD_V8_VIDTCON2);
 +   else
 +   writel(val, ctx-regs + VIDTCON2);

 /* setup clock source, clock divider, enable dma. */
 val = ctx-vidcon0;
 @@ -982,6 +1016,17 @@ static int fimd_runtime_resume(struct device *dev)
  }
  #endif

 +static struct platform_device_id exynos_drm_fimd_driver_ids[] = {
 +   {
 +   .name   = exynos4-fb,
 +   }, {
 +   .name   = exynos5-drm-fimd,
 +   .driver_data= (unsigned 
 long)exynos5_drm_fimd_driver_data,
 +   },
 +   {},
 +};
 +MODULE_DEVICE_TABLE(platform, exynos_drm_fimd_driver_ids);
 +
  static const struct dev_pm_ops fimd_pm_ops = {
 SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
 SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
 @@ -990,8 +1035,9 @@ static const struct dev_pm_ops fimd_pm_ops = {
  struct platform_driver fimd_driver = {
 .probe  = fimd_probe

[PATCH V3 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-08-27 Thread Leela Krishna Amudala
Hello Mr. Inki Dae,
Can you please review this patch set once.

Best Wishes,
Leela Krishna Amudala.

On Thu, Aug 16, 2012 at 3:38 PM, Leela Krishna Amudala
 wrote:
>
> This patch set adds device tree support for DRM-FIMD for Samsung's
> Exynos5250.
> It includes parsing platform data from dts file. Also, adds the driver
> data
> for exynos5 device.
>
> This patchset is based and tested on top of v3.6-rc1
> Also depends on below patchset
> http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html
>
> Changes since V2:
> - Added driver data to exynos5-drm-fimd as per Marek Szyprowski
> suggestion
>
> Changes since V1:
> - Corrected typo errors and changed compatibility string
>
> Leela Krishna Amudala (2):
>   drm/exynos: add platform_device_id table and driver data for exynos5
> drm fimd
>   video: drm: exynos: Add device tree support
>
>  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +++
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  151
> -
>  2 files changed, 224 insertions(+), 7 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt
>
> ___
> devicetree-discuss mailing list
> devicetree-discuss at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss


Re: [PATCH V3 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-08-27 Thread Leela Krishna Amudala
Hello Mr. Inki Dae,
Can you please review this patch set once.

Best Wishes,
Leela Krishna Amudala.

On Thu, Aug 16, 2012 at 3:38 PM, Leela Krishna Amudala
l.kris...@samsung.com wrote:

 This patch set adds device tree support for DRM-FIMD for Samsung's
 Exynos5250.
 It includes parsing platform data from dts file. Also, adds the driver
 data
 for exynos5 device.

 This patchset is based and tested on top of v3.6-rc1
 Also depends on below patchset
 http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

 Changes since V2:
 - Added driver data to exynos5-drm-fimd as per Marek Szyprowski
 suggestion

 Changes since V1:
 - Corrected typo errors and changed compatibility string

 Leela Krishna Amudala (2):
   drm/exynos: add platform_device_id table and driver data for exynos5
 drm fimd
   video: drm: exynos: Add device tree support

  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +++
  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  151
 -
  2 files changed, 224 insertions(+), 7 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

 ___
 devicetree-discuss mailing list
 devicetree-disc...@lists.ozlabs.org
 https://lists.ozlabs.org/listinfo/devicetree-discuss
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH V3 2/2] video: drm: exynos: Add device tree support

2012-08-17 Thread Leela Krishna Amudala
Hello,

On Fri, Aug 17, 2012 at 6:55 AM, Joonyoung Shim  wrote:
> Hi,
>
> 2012/8/16 Leela Krishna Amudala :
>> Add device tree based discovery support for DRM-FIMD driver.
>>
>> Signed-off-by: Leela Krishna Amudala 
>> ---
>>  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
>>  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 
>> -
>>  2 files changed, 173 insertions(+), 2 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt
>>
>> diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
>> b/Documentation/devicetree/bindings/fb/drm-fimd.txt
>> new file mode 100644
>> index 000..8ad8814
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
>> @@ -0,0 +1,80 @@
>> +* Samsung Display Controller using DRM frame work
>> +
>> +The display controller is used to transfer image data from memory to an
>> +external LCD driver interface. It supports various color formats such as
>> +rgb and yuv.
>> +
>> +Required properties:
>> + - compatible: Should be "samsung,exynos5-drm" for fimd using DRM frame 
>> work.
>
> Just use "samsung,exynos5-fb" and add to support exynos4-fb
>

In the first version of this patch set I used "samsung,exynos5-fb",
but as per Kyungmin Park's suggestion changed it to exynos5-drm.

>> + - reg: physical base address of the controller and length of memory
>> +   mapped region.
>> + - interrupts: Three interrupts should be specified. The interrupts should 
>> be
>> +   specified in the following order.
>> +   - VSYNC interrupt
>> +   - FIFO level interrupt
>> +   - FIMD System Interrupt
>> +
>> + - samsung,fimd-display: This property should specify the phandle of the
>> +   display device node which holds the video interface timing with the
>> +   below mentioned properties.
>> +
>> +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
>> + horizontal timing includes four parameters in the following order.
>> +
>> + - horizontal back porch (in number of lcd clocks)
>> + - horizontal front porch (in number of lcd clocks)
>> + - hsync pulse width (in number of lcd clocks)
>> + - Display panels X resolution.
>> +
>> +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
>> + vertical timing includes four parameters in the following order.
>> +
>> + - vertical back porch (in number of lcd lines)
>> + - vertical front porch (in number of lcd lines)
>> + - vsync pulse width (in number of lcd clocks)
>> + - Display panels Y resolution.
>> +
>> +
>> + - samsung,default-window: Specifies the default window number of the fimd 
>> controller.
>> +
>> + - samsung,fimd-win-bpp: Specifies the bits per pixel.
>> +
>> +Optional properties:
>> + - supports-mipi-panel: Specifies the lcd is mipi panel type
>
> How is this property used?
>
As this driver can be interfaced through MIPI or eDP, Arch side code
will check whether this property is available or not, if it is
available then it assumes mipi panel is connected and certain clock
rate will be set to fimd clock, otherwise assumes other panel is
connected and other clock rate will be set at arch side.

>> + - samsung,fimd-vidout-rgb: Video output format is RGB.
>> + - samsung,fimd-inv-vclk: invert video clock polarity.
>> + - samsung,fimd-frame-rate: Number of video frames per second.
>> +
>> +Example:
>> +
>> +   The following is an example for the fimd controller is split into
>> +   two portions. The SoC specific portion can be specified in the SoC
>> +   specific dts file. The board specific portion can be specified in the
>> +   board specific dts file.
>> +
>> +   - SoC Specific portion
>> +
>> +   fimd {
>> +   compatible = "samsung,exynos5-drm";
>> +   interrupt-parent = <>;
>> +   reg = <0x1440 0x4>;
>> +   interrupts = <18 5>, <18 4>, <18 6>;
>> +   };
>> +
>> +   - Board Specific portion
>> +
>> +   lcd_fimd0: lcd_panel0 {
>> +   lcd-htiming = <4 4 4 480>;
>> +   lcd-vtiming = <4 4 4 320>;
>> +   supports-mipi-panel;
>> +   };
>> +
>> +   fimd {
>> +   samsung,fimd-display = <_fimd0>;
>> +   samsung,fimd-vidout-

[PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-08-17 Thread Leela Krishna Amudala
Hello,

On Fri, Aug 17, 2012 at 6:18 AM, Joonyoung Shim  wrote:
>
> Hi Leela.
>
> 2012/8/16 Leela Krishna Amudala :
> > The name of the exynos drm fimd device is renamed to exynos-drm-fimd
> > and two device ids are created for exynos4-fb and exynos5-drm-fimd.
> > Also, added driver data for exynos5 to pick the fimd version at runtime
> > and
> > to choose the VIDTCON register offsets accordingly.
> >
> > Signed-off-by: Leela Krishna Amudala 
> > ---
> >  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   56
> > +++---
> >  1 files changed, 51 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > index 24c0bd4..8379c59 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
> > @@ -57,6 +57,18 @@
> >
> >  #define get_fimd_context(dev)
> > platform_get_drvdata(to_platform_device(dev))
> >
> > +enum fimd_version_type {
> > +   VERSION_8, /* FIMD_VERSION8 */
> > +};
> > +
> > +struct drm_fimd_driver_data {
>
> Don't use drm_ prefix for code consistency.
>

Ok, I'll remove the drm_prefix

> > +   enum fimd_version_type fimd_ver;
>
> I don't prefer to check using version, it needs many if statement.
> Refer s3c-fb driver and how about use changed base address?
>
> struct fimd_driverdata {
>unsigned inttiming_base;
> };
>
> static struct fimd_driverdata exynos5_fimd_data = {
>.timing_base= 0x2,
> };
>

Ok, If I use the above structure as driver data for exynos5, then the
register write calls look this way

writel(val, ctx->regs + driver_data->timing_base + VIDTCON1);
[driver_data->timing_base = 0x2 in case of exynos5 and 0 in case
of exynos4]
and only one statement is enough for both exynos4 and exynos5.

I had put some effort for the patch set
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html
that contains macro definitions for FIMD_V8_VIDCONX and is already
merged to kgene's for-next branch.
If I go with the approach that you suggested then these macros will not be used.

If other reviewers also accepted to use timing_base as driver data,
then will go for it other wise will keep the code same :) .

> > +};
> > +
> > +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
> > +   .fimd_ver = VERSION_8,
> > +};
> > +
> >  struct fimd_win_data {
> > unsigned intoffset_x;
> > unsigned intoffset_y;
> > @@ -91,6 +103,13 @@ struct fimd_context {
> > struct exynos_drm_panel_info *panel;
> >  };
> >
> > +static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
> > +   struct platform_device *pdev)
> > +{
> > +   return (struct drm_fimd_driver_data *)
> > +   platform_get_device_id(pdev)->driver_data;
> > +}
> > +
> >  static bool fimd_display_is_connected(struct device *dev)
> >  {
> > DRM_DEBUG_KMS("%s\n", __FILE__);
> > @@ -194,32 +213,47 @@ static void fimd_commit(struct device *dev)
> > struct fimd_context *ctx = get_fimd_context(dev);
> > struct exynos_drm_panel_info *panel = ctx->panel;
> > struct fb_videomode *timing = >timing;
> > +   struct drm_fimd_driver_data *driver_data;
> > +   struct platform_device *pdev = to_platform_device(dev);
> > u32 val;
> >
> > +   driver_data = drm_fimd_get_driver_data(pdev);
> > if (ctx->suspended)
> > return;
> >
> > DRM_DEBUG_KMS("%s\n", __FILE__);
> >
> > /* setup polarity values from machine code. */
> > -   writel(ctx->vidcon1, ctx->regs + VIDCON1);
> > +   if (driver_data->fimd_ver == VERSION_8)
> > +   writel(ctx->vidcon1, ctx->regs + FIMD_V8_VIDCON1);
> > +   else
> > +   writel(ctx->vidcon1, ctx->regs + VIDCON1);
> >
> > /* setup vertical timing values. */
> > val = VIDTCON0_VBPD(timing->upper_margin - 1) |
> >VIDTCON0_VFPD(timing->lower_margin - 1) |
> >VIDTCON0_VSPW(timing->vsync_len - 1);
> > -   writel(val, ctx->regs + VIDTCON0);
> > +   if (driver_data->fimd_ver == VERSION_8)
> > +   writel(val, ctx->regs + FIMD_V8_VIDTCON0);
> > +   else
> > +   writel(val, ctx->regs + VIDTCON0);
> >
> > /* setup horizontal 

[PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-08-17 Thread Leela Krishna Amudala
The name of the exynos drm fimd device is renamed to exynos-drm-fimd
and two device ids are created for exynos4-fb and exynos5-drm-fimd.
Also, added driver data for exynos5 to pick the fimd version at runtime and
to choose the VIDTCON register offsets accordingly.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   56 +++---
 1 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 24c0bd4..8379c59 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@
 
 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))
 
+enum fimd_version_type {
+   VERSION_8, /* FIMD_VERSION8 */
+};
+
+struct drm_fimd_driver_data {
+   enum fimd_version_type fimd_ver;
+};
+
+struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
+   .fimd_ver = VERSION_8,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct drm_fimd_driver_data *)
+   platform_get_device_id(pdev)-driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS(%s\n, __FILE__);
@@ -194,32 +213,47 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx-panel;
struct fb_videomode *timing = panel-timing;
+   struct drm_fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;
 
+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx-suspended)
return;
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
/* setup polarity values from machine code. */
-   writel(ctx-vidcon1, ctx-regs + VIDCON1);
+   if (driver_data-fimd_ver == VERSION_8)
+   writel(ctx-vidcon1, ctx-regs + FIMD_V8_VIDCON1);
+   else
+   writel(ctx-vidcon1, ctx-regs + VIDCON1);
 
/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing-upper_margin - 1) |
   VIDTCON0_VFPD(timing-lower_margin - 1) |
   VIDTCON0_VSPW(timing-vsync_len - 1);
-   writel(val, ctx-regs + VIDTCON0);
+   if (driver_data-fimd_ver == VERSION_8)
+   writel(val, ctx-regs + FIMD_V8_VIDTCON0);
+   else
+   writel(val, ctx-regs + VIDTCON0);
 
/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing-left_margin - 1) |
   VIDTCON1_HFPD(timing-right_margin - 1) |
   VIDTCON1_HSPW(timing-hsync_len - 1);
-   writel(val, ctx-regs + VIDTCON1);
+   if (driver_data-fimd_ver == VERSION_8)
+   writel(val, ctx-regs + FIMD_V8_VIDTCON1);
+   else
+   writel(val, ctx-regs + VIDTCON1);
 
/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing-yres - 1) |
   VIDTCON2_HOZVAL(timing-xres - 1);
-   writel(val, ctx-regs + VIDTCON2);
+   if (driver_data-fimd_ver == VERSION_8)
+   writel(val, ctx-regs + FIMD_V8_VIDTCON2);
+   else
+   writel(val, ctx-regs + VIDTCON2);
 
/* setup clock source, clock divider, enable dma. */
val = ctx-vidcon0;
@@ -982,6 +1016,17 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif
 
+static struct platform_device_id exynos_drm_fimd_driver_ids[] = {
+   {
+   .name   = exynos4-fb,
+   }, {
+   .name   = exynos5-drm-fimd,
+   .driver_data= (unsigned long)exynos5_drm_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, exynos_drm_fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -990,8 +1035,9 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = exynos_drm_fimd_driver_ids,
.driver = {
-   .name   = exynos4-fb,
+   .name   = exynos-drm-fimd,
.owner  = THIS_MODULE,
.pm = fimd_pm_ops,
},
-- 
1.7.0.4

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


[PATCH V3 2/2] video: drm: exynos: Add device tree support

2012-08-17 Thread Leela Krishna Amudala
Add device tree based discovery support for DRM-FIMD driver.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 -
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
b/Documentation/devicetree/bindings/fb/drm-fimd.txt
new file mode 100644
index 000..8ad8814
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be samsung,exynos5-drm for fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - supports-mipi-panel: Specifies the lcd is mipi panel type
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = samsung,exynos5-drm;
+   interrupt-parent = combiner;
+   reg = 0x1440 0x4;
+   interrupts = 18 5, 18 4, 18 6;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = 4 4 4 480;
+   lcd-vtiming = 4 4 4 320;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = lcd_fimd0;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = 60;
+   samsung,default-window = 0;
+   samsung,fimd-win-bpp = 32;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 8379c59..1753846 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include linux/platform_device.h
 #include linux/clk.h
 #include linux/pm_runtime.h
+#include linux/of.h
 
 #include video/samsung_fimd.h
 #include drm/exynos_drm.h
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };
 
+static const struct of_device_id drm_fimd_dt_match[];
+
 static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev-dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_node(drm_fimd_dt_match, pdev-dev.of_node);
+   return (struct drm_fimd_driver_data *)match-data;
+   }
+#endif
return (struct drm_fimd_driver_data *)
platform_get_device_id(pdev)-driver_data;
 }
@@ -821,12 +831,79 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }
 
+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev-of_node;
+   struct device_node *disp_np;
+   struct exynos_drm_fimd_pdata *pd;
+   u32 data[4];
+
+   pd = devm_kzalloc(dev

[PATCH V3 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-08-17 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos5 device.

This patchset is based and tested on top of v3.6-rc1
Also depends on below patchset 
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for exynos5
drm fimd
  video: drm: exynos: Add device tree support

 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  151 -
 2 files changed, 224 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

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


Re: [PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-08-17 Thread Leela Krishna Amudala
Hello,

On Fri, Aug 17, 2012 at 6:18 AM, Joonyoung Shim dofm...@gmail.com wrote:

 Hi Leela.

 2012/8/16 Leela Krishna Amudala l.kris...@samsung.com:
  The name of the exynos drm fimd device is renamed to exynos-drm-fimd
  and two device ids are created for exynos4-fb and exynos5-drm-fimd.
  Also, added driver data for exynos5 to pick the fimd version at runtime
  and
  to choose the VIDTCON register offsets accordingly.
 
  Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
  ---
   drivers/gpu/drm/exynos/exynos_drm_fimd.c |   56
  +++---
   1 files changed, 51 insertions(+), 5 deletions(-)
 
  diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  index 24c0bd4..8379c59 100644
  --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
  @@ -57,6 +57,18 @@
 
   #define get_fimd_context(dev)
  platform_get_drvdata(to_platform_device(dev))
 
  +enum fimd_version_type {
  +   VERSION_8, /* FIMD_VERSION8 */
  +};
  +
  +struct drm_fimd_driver_data {

 Don't use drm_ prefix for code consistency.


Ok, I'll remove the drm_prefix

  +   enum fimd_version_type fimd_ver;

 I don't prefer to check using version, it needs many if statement.
 Refer s3c-fb driver and how about use changed base address?

 struct fimd_driverdata {
unsigned inttiming_base;
 };

 static struct fimd_driverdata exynos5_fimd_data = {
.timing_base= 0x2,
 };


Ok, If I use the above structure as driver data for exynos5, then the
register write calls look this way

writel(val, ctx-regs + driver_data-timing_base + VIDTCON1);
[driver_data-timing_base = 0x2 in case of exynos5 and 0 in case
of exynos4]
and only one statement is enough for both exynos4 and exynos5.

I had put some effort for the patch set
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html
that contains macro definitions for FIMD_V8_VIDCONX and is already
merged to kgene's for-next branch.
If I go with the approach that you suggested then these macros will not be used.

If other reviewers also accepted to use timing_base as driver data,
then will go for it other wise will keep the code same :) .

  +};
  +
  +struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
  +   .fimd_ver = VERSION_8,
  +};
  +
   struct fimd_win_data {
  unsigned intoffset_x;
  unsigned intoffset_y;
  @@ -91,6 +103,13 @@ struct fimd_context {
  struct exynos_drm_panel_info *panel;
   };
 
  +static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
  +   struct platform_device *pdev)
  +{
  +   return (struct drm_fimd_driver_data *)
  +   platform_get_device_id(pdev)-driver_data;
  +}
  +
   static bool fimd_display_is_connected(struct device *dev)
   {
  DRM_DEBUG_KMS(%s\n, __FILE__);
  @@ -194,32 +213,47 @@ static void fimd_commit(struct device *dev)
  struct fimd_context *ctx = get_fimd_context(dev);
  struct exynos_drm_panel_info *panel = ctx-panel;
  struct fb_videomode *timing = panel-timing;
  +   struct drm_fimd_driver_data *driver_data;
  +   struct platform_device *pdev = to_platform_device(dev);
  u32 val;
 
  +   driver_data = drm_fimd_get_driver_data(pdev);
  if (ctx-suspended)
  return;
 
  DRM_DEBUG_KMS(%s\n, __FILE__);
 
  /* setup polarity values from machine code. */
  -   writel(ctx-vidcon1, ctx-regs + VIDCON1);
  +   if (driver_data-fimd_ver == VERSION_8)
  +   writel(ctx-vidcon1, ctx-regs + FIMD_V8_VIDCON1);
  +   else
  +   writel(ctx-vidcon1, ctx-regs + VIDCON1);
 
  /* setup vertical timing values. */
  val = VIDTCON0_VBPD(timing-upper_margin - 1) |
 VIDTCON0_VFPD(timing-lower_margin - 1) |
 VIDTCON0_VSPW(timing-vsync_len - 1);
  -   writel(val, ctx-regs + VIDTCON0);
  +   if (driver_data-fimd_ver == VERSION_8)
  +   writel(val, ctx-regs + FIMD_V8_VIDTCON0);
  +   else
  +   writel(val, ctx-regs + VIDTCON0);
 
  /* setup horizontal timing values.  */
  val = VIDTCON1_HBPD(timing-left_margin - 1) |
 VIDTCON1_HFPD(timing-right_margin - 1) |
 VIDTCON1_HSPW(timing-hsync_len - 1);
  -   writel(val, ctx-regs + VIDTCON1);
  +   if (driver_data-fimd_ver == VERSION_8)
  +   writel(val, ctx-regs + FIMD_V8_VIDTCON1);
  +   else
  +   writel(val, ctx-regs + VIDTCON1);
 
  /* setup horizontal and vertical display size. */
  val = VIDTCON2_LINEVAL(timing-yres - 1) |
 VIDTCON2_HOZVAL(timing-xres - 1);
  -   writel(val, ctx-regs + VIDTCON2);
  +   if (driver_data-fimd_ver == VERSION_8)
  +   writel(val, ctx-regs + FIMD_V8_VIDTCON2);
  +   else
  +   writel(val, ctx-regs + VIDTCON2

Re: [PATCH V3 2/2] video: drm: exynos: Add device tree support

2012-08-17 Thread Leela Krishna Amudala
Hello,

On Fri, Aug 17, 2012 at 6:55 AM, Joonyoung Shim dofm...@gmail.com wrote:
 Hi,

 2012/8/16 Leela Krishna Amudala l.kris...@samsung.com:
 Add device tree based discovery support for DRM-FIMD driver.

 Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
 ---
  Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
  drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 
 -
  2 files changed, 173 insertions(+), 2 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

 diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
 b/Documentation/devicetree/bindings/fb/drm-fimd.txt
 new file mode 100644
 index 000..8ad8814
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
 @@ -0,0 +1,80 @@
 +* Samsung Display Controller using DRM frame work
 +
 +The display controller is used to transfer image data from memory to an
 +external LCD driver interface. It supports various color formats such as
 +rgb and yuv.
 +
 +Required properties:
 + - compatible: Should be samsung,exynos5-drm for fimd using DRM frame 
 work.

 Just use samsung,exynos5-fb and add to support exynos4-fb


In the first version of this patch set I used samsung,exynos5-fb,
but as per Kyungmin Park's suggestion changed it to exynos5-drm.

 + - reg: physical base address of the controller and length of memory
 +   mapped region.
 + - interrupts: Three interrupts should be specified. The interrupts should 
 be
 +   specified in the following order.
 +   - VSYNC interrupt
 +   - FIFO level interrupt
 +   - FIMD System Interrupt
 +
 + - samsung,fimd-display: This property should specify the phandle of the
 +   display device node which holds the video interface timing with the
 +   below mentioned properties.
 +
 +   - lcd-htiming: Specifies the horizontal timing for the overlay. The
 + horizontal timing includes four parameters in the following order.
 +
 + - horizontal back porch (in number of lcd clocks)
 + - horizontal front porch (in number of lcd clocks)
 + - hsync pulse width (in number of lcd clocks)
 + - Display panels X resolution.
 +
 +   - lcd-vtiming: Specifies the vertical timing for the overlay. The
 + vertical timing includes four parameters in the following order.
 +
 + - vertical back porch (in number of lcd lines)
 + - vertical front porch (in number of lcd lines)
 + - vsync pulse width (in number of lcd clocks)
 + - Display panels Y resolution.
 +
 +
 + - samsung,default-window: Specifies the default window number of the fimd 
 controller.
 +
 + - samsung,fimd-win-bpp: Specifies the bits per pixel.
 +
 +Optional properties:
 + - supports-mipi-panel: Specifies the lcd is mipi panel type

 How is this property used?

As this driver can be interfaced through MIPI or eDP, Arch side code
will check whether this property is available or not, if it is
available then it assumes mipi panel is connected and certain clock
rate will be set to fimd clock, otherwise assumes other panel is
connected and other clock rate will be set at arch side.

 + - samsung,fimd-vidout-rgb: Video output format is RGB.
 + - samsung,fimd-inv-vclk: invert video clock polarity.
 + - samsung,fimd-frame-rate: Number of video frames per second.
 +
 +Example:
 +
 +   The following is an example for the fimd controller is split into
 +   two portions. The SoC specific portion can be specified in the SoC
 +   specific dts file. The board specific portion can be specified in the
 +   board specific dts file.
 +
 +   - SoC Specific portion
 +
 +   fimd {
 +   compatible = samsung,exynos5-drm;
 +   interrupt-parent = combiner;
 +   reg = 0x1440 0x4;
 +   interrupts = 18 5, 18 4, 18 6;
 +   };
 +
 +   - Board Specific portion
 +
 +   lcd_fimd0: lcd_panel0 {
 +   lcd-htiming = 4 4 4 480;
 +   lcd-vtiming = 4 4 4 320;
 +   supports-mipi-panel;
 +   };
 +
 +   fimd {
 +   samsung,fimd-display = lcd_fimd0;
 +   samsung,fimd-vidout-rgb;
 +   samsung,fimd-inv-vclk;
 +   samsung,fimd-frame-rate = 60;
 +   samsung,default-window = 0;
 +   samsung,fimd-win-bpp = 32;
 +   };
 +
 diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
 b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 index 8379c59..1753846 100644
 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
 @@ -18,6 +18,7 @@
  #include linux/platform_device.h
  #include linux/clk.h
  #include linux/pm_runtime.h
 +#include linux/of.h

  #include video/samsung_fimd.h
  #include drm/exynos_drm.h
 @@ -103,9 +104,18 @@ struct fimd_context {
 struct exynos_drm_panel_info *panel;
  };

 +static const struct of_device_id drm_fimd_dt_match[];
 +

 Please remove drm_ prefix over all.


Ok, will do

[PATCH V3 2/2] video: drm: exynos: Add device tree support

2012-08-16 Thread Leela Krishna Amudala
Add device tree based discovery support for DRM-FIMD driver.

Signed-off-by: Leela Krishna Amudala 
---
 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |   95 -
 2 files changed, 173 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt

diff --git a/Documentation/devicetree/bindings/fb/drm-fimd.txt 
b/Documentation/devicetree/bindings/fb/drm-fimd.txt
new file mode 100644
index 000..8ad8814
--- /dev/null
+++ b/Documentation/devicetree/bindings/fb/drm-fimd.txt
@@ -0,0 +1,80 @@
+* Samsung Display Controller using DRM frame work
+
+The display controller is used to transfer image data from memory to an
+external LCD driver interface. It supports various color formats such as
+rgb and yuv.
+
+Required properties:
+ - compatible: Should be "samsung,exynos5-drm" for fimd using DRM frame work.
+ - reg: physical base address of the controller and length of memory
+   mapped region.
+ - interrupts: Three interrupts should be specified. The interrupts should be
+   specified in the following order.
+   - VSYNC interrupt
+   - FIFO level interrupt
+   - FIMD System Interrupt
+
+ - samsung,fimd-display: This property should specify the phandle of the
+   display device node which holds the video interface timing with the
+   below mentioned properties.
+
+   - lcd-htiming: Specifies the horizontal timing for the overlay. The
+ horizontal timing includes four parameters in the following order.
+
+ - horizontal back porch (in number of lcd clocks)
+ - horizontal front porch (in number of lcd clocks)
+ - hsync pulse width (in number of lcd clocks)
+ - Display panels X resolution.
+
+   - lcd-vtiming: Specifies the vertical timing for the overlay. The
+ vertical timing includes four parameters in the following order.
+
+ - vertical back porch (in number of lcd lines)
+ - vertical front porch (in number of lcd lines)
+ - vsync pulse width (in number of lcd clocks)
+ - Display panels Y resolution.
+
+
+ - samsung,default-window: Specifies the default window number of the fimd 
controller.
+
+ - samsung,fimd-win-bpp: Specifies the bits per pixel.
+
+Optional properties:
+ - supports-mipi-panel: Specifies the lcd is mipi panel type
+ - samsung,fimd-vidout-rgb: Video output format is RGB.
+ - samsung,fimd-inv-vclk: invert video clock polarity.
+ - samsung,fimd-frame-rate: Number of video frames per second.
+
+Example:
+
+   The following is an example for the fimd controller is split into
+   two portions. The SoC specific portion can be specified in the SoC
+   specific dts file. The board specific portion can be specified in the
+   board specific dts file.
+
+   - SoC Specific portion
+
+   fimd {
+   compatible = "samsung,exynos5-drm";
+   interrupt-parent = <>;
+   reg = <0x1440 0x4>;
+   interrupts = <18 5>, <18 4>, <18 6>;
+   };
+
+   - Board Specific portion
+
+   lcd_fimd0: lcd_panel0 {
+   lcd-htiming = <4 4 4 480>;
+   lcd-vtiming = <4 4 4 320>;
+   supports-mipi-panel;
+   };
+
+   fimd {
+   samsung,fimd-display = <_fimd0>;
+   samsung,fimd-vidout-rgb;
+   samsung,fimd-inv-vclk;
+   samsung,fimd-frame-rate = <60>;
+   samsung,default-window = <0>;
+   samsung,fimd-win-bpp = <32>;
+   };
+
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 8379c59..1753846 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -103,9 +104,18 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static const struct of_device_id drm_fimd_dt_match[];
+
 static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
struct platform_device *pdev)
 {
+#ifdef CONFIG_OF
+   if (pdev->dev.of_node) {
+   const struct of_device_id *match;
+   match = of_match_node(drm_fimd_dt_match, pdev->dev.of_node);
+   return (struct drm_fimd_driver_data *)match->data;
+   }
+#endif
return (struct drm_fimd_driver_data *)
platform_get_device_id(pdev)->driver_data;
 }
@@ -821,12 +831,79 @@ static int fimd_power_on(struct fimd_context *ctx, bool 
enable)
return 0;
 }

+#ifdef CONFIG_OF
+static struct exynos_drm_fimd_pdata *drm_fimd_dt_parse_pdata(struct device 
*dev)
+{
+   struct device_node *np = dev->of_node;
+   struct device_node *disp_np;
+   struct exynos_drm_fimd_pdata *pd;
+   u32 data[4];
+
+   pd = devm_kzal

[PATCH V3 1/2] drm/exynos: add platform_device_id table and driver data for exynos5 drm fimd

2012-08-16 Thread Leela Krishna Amudala
The name of the exynos drm fimd device is renamed to exynos-drm-fimd
and two device ids are created for exynos4-fb and exynos5-drm-fimd.
Also, added driver data for exynos5 to pick the fimd version at runtime and
to choose the VIDTCON register offsets accordingly.

Signed-off-by: Leela Krishna Amudala 
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   56 +++---
 1 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 24c0bd4..8379c59 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -57,6 +57,18 @@

 #define get_fimd_context(dev)  platform_get_drvdata(to_platform_device(dev))

+enum fimd_version_type {
+   VERSION_8, /* FIMD_VERSION8 */
+};
+
+struct drm_fimd_driver_data {
+   enum fimd_version_type fimd_ver;
+};
+
+struct drm_fimd_driver_data exynos5_drm_fimd_driver_data = {
+   .fimd_ver = VERSION_8,
+};
+
 struct fimd_win_data {
unsigned intoffset_x;
unsigned intoffset_y;
@@ -91,6 +103,13 @@ struct fimd_context {
struct exynos_drm_panel_info *panel;
 };

+static inline struct drm_fimd_driver_data *drm_fimd_get_driver_data(
+   struct platform_device *pdev)
+{
+   return (struct drm_fimd_driver_data *)
+   platform_get_device_id(pdev)->driver_data;
+}
+
 static bool fimd_display_is_connected(struct device *dev)
 {
DRM_DEBUG_KMS("%s\n", __FILE__);
@@ -194,32 +213,47 @@ static void fimd_commit(struct device *dev)
struct fimd_context *ctx = get_fimd_context(dev);
struct exynos_drm_panel_info *panel = ctx->panel;
struct fb_videomode *timing = >timing;
+   struct drm_fimd_driver_data *driver_data;
+   struct platform_device *pdev = to_platform_device(dev);
u32 val;

+   driver_data = drm_fimd_get_driver_data(pdev);
if (ctx->suspended)
return;

DRM_DEBUG_KMS("%s\n", __FILE__);

/* setup polarity values from machine code. */
-   writel(ctx->vidcon1, ctx->regs + VIDCON1);
+   if (driver_data->fimd_ver == VERSION_8)
+   writel(ctx->vidcon1, ctx->regs + FIMD_V8_VIDCON1);
+   else
+   writel(ctx->vidcon1, ctx->regs + VIDCON1);

/* setup vertical timing values. */
val = VIDTCON0_VBPD(timing->upper_margin - 1) |
   VIDTCON0_VFPD(timing->lower_margin - 1) |
   VIDTCON0_VSPW(timing->vsync_len - 1);
-   writel(val, ctx->regs + VIDTCON0);
+   if (driver_data->fimd_ver == VERSION_8)
+   writel(val, ctx->regs + FIMD_V8_VIDTCON0);
+   else
+   writel(val, ctx->regs + VIDTCON0);

/* setup horizontal timing values.  */
val = VIDTCON1_HBPD(timing->left_margin - 1) |
   VIDTCON1_HFPD(timing->right_margin - 1) |
   VIDTCON1_HSPW(timing->hsync_len - 1);
-   writel(val, ctx->regs + VIDTCON1);
+   if (driver_data->fimd_ver == VERSION_8)
+   writel(val, ctx->regs + FIMD_V8_VIDTCON1);
+   else
+   writel(val, ctx->regs + VIDTCON1);

/* setup horizontal and vertical display size. */
val = VIDTCON2_LINEVAL(timing->yres - 1) |
   VIDTCON2_HOZVAL(timing->xres - 1);
-   writel(val, ctx->regs + VIDTCON2);
+   if (driver_data->fimd_ver == VERSION_8)
+   writel(val, ctx->regs + FIMD_V8_VIDTCON2);
+   else
+   writel(val, ctx->regs + VIDTCON2);

/* setup clock source, clock divider, enable dma. */
val = ctx->vidcon0;
@@ -982,6 +1016,17 @@ static int fimd_runtime_resume(struct device *dev)
 }
 #endif

+static struct platform_device_id exynos_drm_fimd_driver_ids[] = {
+   {
+   .name   = "exynos4-fb",
+   }, {
+   .name   = "exynos5-drm-fimd",
+   .driver_data= (unsigned long)_drm_fimd_driver_data,
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(platform, exynos_drm_fimd_driver_ids);
+
 static const struct dev_pm_ops fimd_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume)
SET_RUNTIME_PM_OPS(fimd_runtime_suspend, fimd_runtime_resume, NULL)
@@ -990,8 +1035,9 @@ static const struct dev_pm_ops fimd_pm_ops = {
 struct platform_driver fimd_driver = {
.probe  = fimd_probe,
.remove = __devexit_p(fimd_remove),
+   .id_table   = exynos_drm_fimd_driver_ids,
.driver = {
-   .name   = "exynos4-fb",
+   .name   = "exynos-drm-fimd",
.owner  = THIS_MODULE,
.pm = _pm_ops,
},
-- 
1.7.0.4



[PATCH V3 0/2] video: drm: Add Device tree support to DRM-FIMD

2012-08-16 Thread Leela Krishna Amudala
This patch set adds device tree support for DRM-FIMD for Samsung's Exynos5250.
It includes parsing platform data from dts file. Also, adds the driver data
for exynos5 device.

This patchset is based and tested on top of v3.6-rc1
Also depends on below patchset 
http://lists.freedesktop.org/archives/dri-devel/2012-August/026076.html

Changes since V2:
- Added driver data to exynos5-drm-fimd as per Marek Szyprowski 
suggestion

Changes since V1:
- Corrected typo errors and changed compatibility string

Leela Krishna Amudala (2):
  drm/exynos: add platform_device_id table and driver data for exynos5
drm fimd
  video: drm: exynos: Add device tree support

 Documentation/devicetree/bindings/fb/drm-fimd.txt |   80 +++
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  |  151 -
 2 files changed, 224 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/fb/drm-fimd.txt



[PATCH V3 1/5] include/video: Add samsung FIMD register header

2012-08-08 Thread Leela Krishna Amudala
This patch copies the contents from regs-fb-v4.h and regs-fb.h to
include/video/samsung_fimd.h

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 include/video/samsung_fimd.h |  526 ++
 1 files changed, 526 insertions(+), 0 deletions(-)
 create mode 100644 include/video/samsung_fimd.h

diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
new file mode 100644
index 000..e979f42
--- /dev/null
+++ b/include/video/samsung_fimd.h
@@ -0,0 +1,526 @@
+/* include/video/samsung_fimd.h
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *  http://armlinux.simtec.co.uk/
+ *  Ben Dooks b...@simtec.co.uk
+ *
+ * S3C Platform - new-style fimd and framebuffer register definitions
+ *
+ * This is the register set for the fimd and new style framebuffer interface
+ * found from the S3C2443 onwards into the S3C2416, S3C2450 and the
+ * S3C64XX series such as the S3C6400 and S3C6410.
+ *
+ * The file does not contain the cpu specific items which are based on
+ * whichever architecture is selected, it only contains the core of the
+ * register set. See mach/regs-fb.h to get the specifics.
+ *
+ * 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.
+*/
+
+/* VIDCON0 */
+
+#define VIDCON0(0x00)
+#define VIDCON0_INTERLACE  (1  29)
+#define VIDCON0_VIDOUT_MASK(0x3  26)
+#define VIDCON0_VIDOUT_SHIFT   (26)
+#define VIDCON0_VIDOUT_RGB (0x0  26)
+#define VIDCON0_VIDOUT_TV  (0x1  26)
+#define VIDCON0_VIDOUT_I80_LDI0(0x2  26)
+#define VIDCON0_VIDOUT_I80_LDI1(0x3  26)
+
+#define VIDCON0_L1_DATA_MASK   (0x7  23)
+#define VIDCON0_L1_DATA_SHIFT  (23)
+#define VIDCON0_L1_DATA_16BPP  (0x0  23)
+#define VIDCON0_L1_DATA_18BPP16(0x1  23)
+#define VIDCON0_L1_DATA_18BPP9 (0x2  23)
+#define VIDCON0_L1_DATA_24BPP  (0x3  23)
+#define VIDCON0_L1_DATA_18BPP  (0x4  23)
+#define VIDCON0_L1_DATA_16BPP8 (0x5  23)
+
+#define VIDCON0_L0_DATA_MASK   (0x7  20)
+#define VIDCON0_L0_DATA_SHIFT  (20)
+#define VIDCON0_L0_DATA_16BPP  (0x0  20)
+#define VIDCON0_L0_DATA_18BPP16(0x1  20)
+#define VIDCON0_L0_DATA_18BPP9 (0x2  20)
+#define VIDCON0_L0_DATA_24BPP  (0x3  20)
+#define VIDCON0_L0_DATA_18BPP  (0x4  20)
+#define VIDCON0_L0_DATA_16BPP8 (0x5  20)
+
+#define VIDCON0_PNRMODE_MASK   (0x3  17)
+#define VIDCON0_PNRMODE_SHIFT  (17)
+#define VIDCON0_PNRMODE_RGB(0x0  17)
+#define VIDCON0_PNRMODE_BGR(0x1  17)
+#define VIDCON0_PNRMODE_SERIAL_RGB (0x2  17)
+#define VIDCON0_PNRMODE_SERIAL_BGR (0x3  17)
+
+#define VIDCON0_CLKVALUP   (1  16)
+#define VIDCON0_CLKVAL_F_MASK  (0xff  6)
+#define VIDCON0_CLKVAL_F_SHIFT (6)
+#define VIDCON0_CLKVAL_F_LIMIT (0xff)
+#define VIDCON0_CLKVAL_F(_x)   ((_x)  6)
+#define VIDCON0_VLCKFREE   (1  5)
+#define VIDCON0_CLKDIR (1  4)
+
+#define VIDCON0_CLKSEL_MASK(0x3  2)
+#define VIDCON0_CLKSEL_SHIFT   (2)
+#define VIDCON0_CLKSEL_HCLK(0x0  2)
+#define VIDCON0_CLKSEL_LCD (0x1  2)
+#define VIDCON0_CLKSEL_27M (0x3  2)
+
+#define VIDCON0_ENVID  (1  1)
+#define VIDCON0_ENVID_F(1  0)
+
+#define VIDCON1(0x04)
+#define VIDCON1_LINECNT_MASK   (0x7ff  16)
+#define VIDCON1_LINECNT_SHIFT  (16)
+#define VIDCON1_LINECNT_GET(_v)(((_v)  16)  0x7ff)
+#define VIDCON1_VSTATUS_MASK   (0x3  13)
+#define VIDCON1_VSTATUS_SHIFT  (13)
+#define VIDCON1_VSTATUS_VSYNC  (0x0  13)
+#define VIDCON1_VSTATUS_BACKPORCH  (0x1  13)
+#define VIDCON1_VSTATUS_ACTIVE (0x2  13)
+#define VIDCON1_VSTATUS_FRONTPORCH (0x0  13)
+#define VIDCON1_VCLK_MASK  (0x3  9)
+#define VIDCON1_VCLK_HOLD  (0x0  9)
+#define VIDCON1_VCLK_RUN   (0x1  9)
+
+#define VIDCON1_INV_VCLK   (1  7)
+#define VIDCON1_INV_HSYNC  (1  6)
+#define VIDCON1_INV_VSYNC  (1  5)
+#define VIDCON1_INV_VDEN   (1  4)
+
+/* VIDCON2 */
+
+#define VIDCON2

[PATCH V3 2/5] include/video: Add Exynos5 specific FIMD register offsets

2012-08-08 Thread Leela Krishna Amudala
Exynos5 has VIDTCON and VIDCON registers at different offsets
from the previous SOCs. Hence, adding the macros.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 include/video/samsung_fimd.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
index e979f42..7ae6c07 100644
--- a/include/video/samsung_fimd.h
+++ b/include/video/samsung_fimd.h
@@ -524,3 +524,10 @@
  * 1110-none-   -none-   -none-   -none--none-
  * -none-   -none-   -none-   -none--none-
 */
+
+/* FIMD Version 8 register offset definitions */
+#define FIMD_V8_VIDTCON0   (0x20010)
+#define FIMD_V8_VIDTCON1   (0x20014)
+#define FIMD_V8_VIDTCON2   (0x20018)
+#define FIMD_V8_VIDTCON3   (0x2001C)
+#define FIMD_V8_VIDCON1(0x20004)
-- 
1.7.0.4

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


[PATCH V3 0/5] arm: samsung: Move FIMD headers to include/video/

2012-08-08 Thread Leela Krishna Amudala
This patchset moves the contents of regs-fb-v4.h and regs-fb.h from arch side
to include/video/samsung_fimd.h

This patchset is created and rebased against master branch of torvalds tree.
Tested on smdk5250 board, build tested for other boards.

Changes from version 2:
- Changed the EXYNOS5_xxx macro name to FIMD_V8_xxx
- Moved the header inclusion under same kind

Changes from version 1:
- Split the patches as per Sylwester comments
- Changed FIMD_V8_xxx macro to EXYNOS5_xxx  

Leela Krishna Amudala (5):
  include/video: Add samsung FIMD register header
  include/video: Add Exynos5 specific FIMD register offsets
  arm: samsung: Include the modified FIMD header file
  driver: Include the modified FIMD header file
  arm: samsung: delete frame buffer header files from platform

 arch/arm/mach-exynos/mach-nuri.c|2 +-
 arch/arm/mach-exynos/mach-origen.c  |2 +-
 arch/arm/mach-exynos/mach-smdk4x12.c|2 +-
 arch/arm/mach-exynos/mach-smdkv310.c|2 +-
 arch/arm/mach-exynos/mach-universal_c210.c  |2 +-
 arch/arm/mach-exynos/setup-fimd0.c  |2 +-
 arch/arm/mach-s3c24xx/mach-smdk2416.c   |2 +-
 arch/arm/mach-s3c64xx/mach-anw6410.c|2 +-
 arch/arm/mach-s3c64xx/mach-crag6410.c   |2 +-
 arch/arm/mach-s3c64xx/mach-hmt.c|2 +-
 arch/arm/mach-s3c64xx/mach-mini6410.c   |2 +-
 arch/arm/mach-s3c64xx/mach-ncp.c|2 +-
 arch/arm/mach-s3c64xx/mach-real6410.c   |2 +-
 arch/arm/mach-s3c64xx/mach-smartq5.c|2 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c|2 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c   |2 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c   |2 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c   |2 +-
 arch/arm/mach-s5pc100/mach-smdkc100.c   |2 +-
 arch/arm/mach-s5pv210/mach-aquila.c |2 +-
 arch/arm/mach-s5pv210/mach-goni.c   |2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c   |2 +-
 arch/arm/plat-samsung/include/plat/regs-fb-v4.h |  159 ---
 arch/arm/plat-samsung/include/plat/regs-fb.h|  403 -
 drivers/gpu/drm/exynos/exynos_drm_fimd.c|2 +-
 drivers/video/s3c-fb.c  |2 +-
 include/video/samsung_fimd.h|  533 +++
 27 files changed, 557 insertions(+), 586 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-fb-v4.h
 delete mode 100644 arch/arm/plat-samsung/include/plat/regs-fb.h
 create mode 100644 include/video/samsung_fimd.h

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


[PATCH V3 3/5] arm: samsung: Include the modified FIMD header file

2012-08-08 Thread Leela Krishna Amudala
The fimd register headers have been moved to include/video/
hence, modifying the machine files accordingly.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 arch/arm/mach-exynos/mach-nuri.c   |2 +-
 arch/arm/mach-exynos/mach-origen.c |2 +-
 arch/arm/mach-exynos/mach-smdk4x12.c   |2 +-
 arch/arm/mach-exynos/mach-smdkv310.c   |2 +-
 arch/arm/mach-exynos/mach-universal_c210.c |2 +-
 arch/arm/mach-exynos/setup-fimd0.c |2 +-
 arch/arm/mach-s3c24xx/mach-smdk2416.c  |2 +-
 arch/arm/mach-s3c64xx/mach-anw6410.c   |2 +-
 arch/arm/mach-s3c64xx/mach-crag6410.c  |2 +-
 arch/arm/mach-s3c64xx/mach-hmt.c   |2 +-
 arch/arm/mach-s3c64xx/mach-mini6410.c  |2 +-
 arch/arm/mach-s3c64xx/mach-ncp.c   |2 +-
 arch/arm/mach-s3c64xx/mach-real6410.c  |2 +-
 arch/arm/mach-s3c64xx/mach-smartq5.c   |2 +-
 arch/arm/mach-s3c64xx/mach-smartq7.c   |2 +-
 arch/arm/mach-s3c64xx/mach-smdk6410.c  |2 +-
 arch/arm/mach-s5p64x0/mach-smdk6440.c  |2 +-
 arch/arm/mach-s5p64x0/mach-smdk6450.c  |2 +-
 arch/arm/mach-s5pc100/mach-smdkc100.c  |2 +-
 arch/arm/mach-s5pv210/mach-aquila.c|2 +-
 arch/arm/mach-s5pv210/mach-goni.c  |2 +-
 arch/arm/mach-s5pv210/mach-smdkv210.c  |2 +-
 22 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index ea785fc..90d8daa 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -29,6 +29,7 @@
 #include drm/exynos_drm.h
 
 #include video/platform_lcd.h
+#include video/samsung_fimd.h
 #include media/m5mols.h
 #include media/s5k6aa.h
 #include media/s5p_fimc.h
@@ -39,7 +40,6 @@
 #include asm/mach-types.h
 
 #include plat/adc.h
-#include plat/regs-fb-v4.h
 #include plat/regs-serial.h
 #include plat/cpu.h
 #include plat/devs.h
diff --git a/arch/arm/mach-exynos/mach-origen.c 
b/arch/arm/mach-exynos/mach-origen.c
index 5ca8030..4e245f1 100644
--- a/arch/arm/mach-exynos/mach-origen.c
+++ b/arch/arm/mach-exynos/mach-origen.c
@@ -29,9 +29,9 @@
 #include asm/mach-types.h
 
 #include video/platform_lcd.h
+#include video/samsung_fimd.h
 
 #include plat/regs-serial.h
-#include plat/regs-fb-v4.h
 #include plat/cpu.h
 #include plat/devs.h
 #include plat/sdhci.h
diff --git a/arch/arm/mach-exynos/mach-smdk4x12.c 
b/arch/arm/mach-exynos/mach-smdk4x12.c
index b26beb1..ee069b4 100644
--- a/arch/arm/mach-exynos/mach-smdk4x12.c
+++ b/arch/arm/mach-exynos/mach-smdk4x12.c
@@ -26,6 +26,7 @@
 #include asm/hardware/gic.h
 #include asm/mach-types.h
 
+#include video/samsung_fimd.h
 #include plat/backlight.h
 #include plat/clock.h
 #include plat/cpu.h
@@ -35,7 +36,6 @@
 #include plat/iic.h
 #include plat/keypad.h
 #include plat/mfc.h
-#include plat/regs-fb.h
 #include plat/regs-serial.h
 #include plat/sdhci.h
 
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c 
b/arch/arm/mach-exynos/mach-smdkv310.c
index 3cfa688..b1c50da 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -26,9 +26,9 @@
 #include asm/mach-types.h
 
 #include video/platform_lcd.h
+#include video/samsung_fimd.h
 #include plat/regs-serial.h
 #include plat/regs-srom.h
-#include plat/regs-fb-v4.h
 #include plat/cpu.h
 #include plat/devs.h
 #include plat/fb.h
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c 
b/arch/arm/mach-exynos/mach-universal_c210.c
index 4d1f40d..8139cd2 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -30,6 +30,7 @@
 #include asm/hardware/gic.h
 #include asm/mach-types.h
 
+#include video/samsung_fimd.h
 #include plat/regs-serial.h
 #include plat/clock.h
 #include plat/cpu.h
@@ -39,7 +40,6 @@
 #include plat/fb.h
 #include plat/mfc.h
 #include plat/sdhci.h
-#include plat/regs-fb-v4.h
 #include plat/fimc-core.h
 #include plat/s5p-time.h
 #include plat/camport.h
diff --git a/arch/arm/mach-exynos/setup-fimd0.c 
b/arch/arm/mach-exynos/setup-fimd0.c
index 07a6dbe..5665bb4 100644
--- a/arch/arm/mach-exynos/setup-fimd0.c
+++ b/arch/arm/mach-exynos/setup-fimd0.c
@@ -13,8 +13,8 @@
 #include linux/fb.h
 #include linux/gpio.h
 
+#include video/samsung_fimd.h
 #include plat/gpio-cfg.h
-#include plat/regs-fb-v4.h
 
 #include mach/map.h
 
diff --git a/arch/arm/mach-s3c24xx/mach-smdk2416.c 
b/arch/arm/mach-s3c24xx/mach-smdk2416.c
index c3100a0..96478f0 100644
--- a/arch/arm/mach-s3c24xx/mach-smdk2416.c
+++ b/arch/arm/mach-s3c24xx/mach-smdk2416.c
@@ -29,6 +29,7 @@
 #include asm/mach/map.h
 #include asm/mach/irq.h
 
+#include video/samsung_fimd.h
 #include mach/hardware.h
 #include asm/irq.h
 #include asm/mach-types.h
@@ -52,7 +53,6 @@
 #include plat/udc.h
 #include linux/platform_data/s3c-hsudc.h
 
-#include plat/regs-fb-v4.h
 #include plat/fb.h
 
 #include plat/common-smdk.h
diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c 
b/arch/arm/mach-s3c64xx/mach

[PATCH V3 4/5] driver: Include the modified FIMD header file

2012-08-08 Thread Leela Krishna Amudala
The fimd register headers have been moved to include/video/
hence, modifying the driver files accordingly.

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |2 +-
 drivers/video/s3c-fb.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index a68d2b3..24c0bd4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -19,8 +19,8 @@
 #include linux/clk.h
 #include linux/pm_runtime.h
 
+#include video/samsung_fimd.h
 #include drm/exynos_drm.h
-#include plat/regs-fb-v4.h
 
 #include exynos_drm_drv.h
 #include exynos_drm_fbdev.h
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index 69bf9d0..901729e 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -25,8 +25,8 @@
 #include linux/interrupt.h
 #include linux/pm_runtime.h
 
+#include video/samsung_fimd.h
 #include mach/map.h
-#include plat/regs-fb-v4.h
 #include plat/fb.h
 
 /* This driver will export a number of framebuffer interfaces depending
-- 
1.7.0.4

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


  1   2   >