diff mbox

[2/2] media: davinci: vpbe: venc: move the enabling of vpss clocks to driver

Message ID 1363938793-22246-3-git-send-email-prabhakar.csengg@gmail.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Lad, Prabhakar March 22, 2013, 7:53 a.m. UTC
From: Lad, Prabhakar <prabhakar.csengg@gmail.com>

The vpss clocks were enabled by calling a exported function from a driver
in a machine code. calling driver code from platform code is incorrect way.

This patch fixes this issue and calls the function from driver code itself.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 Note: This patch is based on the comment from Sekhar
      (https://patchwork-mail1.kernel.org/patch/2278441/).
      Shekar I haven't completely removed the callback, I just added
      the function calls after the callback. As you mentioned just to
      pass the VPSS_CLK_CTRL as a resource to venc but the VPSS_CLK_CTRL
      is already being used by VPSS driver. I'll take this cleanup task later
      point of time.

 drivers/media/platform/davinci/vpbe_venc.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

Comments

Sekhar Nori March 25, 2013, 5:39 a.m. UTC | #1
On 3/22/2013 1:23 PM, Prabhakar lad wrote:
> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> 
> The vpss clocks were enabled by calling a exported function from a driver
> in a machine code. calling driver code from platform code is incorrect way.
> 
> This patch fixes this issue and calls the function from driver code itself.
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
>  Note: This patch is based on the comment from Sekhar
>       (https://patchwork-mail1.kernel.org/patch/2278441/).
>       Shekar I haven't completely removed the callback, I just added
>       the function calls after the callback. As you mentioned just to
>       pass the VPSS_CLK_CTRL as a resource to venc but the VPSS_CLK_CTRL
>       is already being used by VPSS driver. I'll take this cleanup task later
>       point of time.

Fine by me.

Thanks,
Sekhar
Lad, Prabhakar March 25, 2013, 10:15 a.m. UTC | #2
Hi Sekhar,

On Mon, Mar 25, 2013 at 11:09 AM, Sekhar Nori <nsekhar@ti.com> wrote:
> On 3/22/2013 1:23 PM, Prabhakar lad wrote:
>> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>>
>> The vpss clocks were enabled by calling a exported function from a driver
>> in a machine code. calling driver code from platform code is incorrect way.
>>
>> This patch fixes this issue and calls the function from driver code itself.
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>> ---
>>  Note: This patch is based on the comment from Sekhar
>>       (https://patchwork-mail1.kernel.org/patch/2278441/).
>>       Shekar I haven't completely removed the callback, I just added
>>       the function calls after the callback. As you mentioned just to
>>       pass the VPSS_CLK_CTRL as a resource to venc but the VPSS_CLK_CTRL
>>       is already being used by VPSS driver. I'll take this cleanup task later
>>       point of time.
>
> Fine by me.
>
Can I have your ACK on this patch ?

Regards,
--Prabhakar

> Thanks,
> Sekhar
Sekhar Nori March 25, 2013, 11:18 a.m. UTC | #3
On 3/25/2013 3:45 PM, Prabhakar Lad wrote:
> Hi Sekhar,
> 
> On Mon, Mar 25, 2013 at 11:09 AM, Sekhar Nori <nsekhar@ti.com> wrote:
>> On 3/22/2013 1:23 PM, Prabhakar lad wrote:
>>> From: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>>>
>>> The vpss clocks were enabled by calling a exported function from a driver
>>> in a machine code. calling driver code from platform code is incorrect way.
>>>
>>> This patch fixes this issue and calls the function from driver code itself.
>>>
>>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>>> ---
>>>  Note: This patch is based on the comment from Sekhar
>>>       (https://patchwork-mail1.kernel.org/patch/2278441/).
>>>       Shekar I haven't completely removed the callback, I just added
>>>       the function calls after the callback. As you mentioned just to
>>>       pass the VPSS_CLK_CTRL as a resource to venc but the VPSS_CLK_CTRL
>>>       is already being used by VPSS driver. I'll take this cleanup task later
>>>       point of time.
>>
>> Fine by me.
>>
> Can I have your ACK on this patch ?

The 'fine' from me was for the approach, not not patch ;). Seriously
though, since this patch is only touching media/ I haven't really done a
detailed enough review of it. In any case, it should be OK to merge this
without my ack.

Thanks,
Sekhar
diff mbox

Patch

diff --git a/drivers/media/platform/davinci/vpbe_venc.c b/drivers/media/platform/davinci/vpbe_venc.c
index f15f211..26bdf9b 100644
--- a/drivers/media/platform/davinci/vpbe_venc.c
+++ b/drivers/media/platform/davinci/vpbe_venc.c
@@ -202,6 +202,26 @@  static void venc_enabledigitaloutput(struct v4l2_subdev *sd, int benable)
 	}
 }
 
+static void
+venc_enable_vpss_clock(int venc_type,
+		       enum vpbe_enc_timings_type type,
+		       unsigned int pclock)
+{
+	if (venc_type == VPBE_VERSION_1)
+		return;
+
+	if (venc_type == VPBE_VERSION_2 && (type == VPBE_ENC_STD ||
+	    (type == VPBE_ENC_DV_TIMINGS && pclock <= 27000000))) {
+		vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 1);
+		vpss_enable_clock(VPSS_VPBE_CLOCK, 1);
+		return;
+	}
+
+	if (venc_type == VPBE_VERSION_3 && type == VPBE_ENC_STD)
+		vpss_enable_clock(VPSS_VENC_CLOCK_SEL, 0);
+
+}
+
 #define VDAC_CONFIG_SD_V3	0x0E21A6B6
 #define VDAC_CONFIG_SD_V2	0x081141CF
 /*
@@ -220,6 +240,7 @@  static int venc_set_ntsc(struct v4l2_subdev *sd)
 	if (pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_525_60) < 0)
 		return -EINVAL;
 
+	venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_STD, V4L2_STD_525_60);
 	venc_enabledigitaloutput(sd, 0);
 
 	if (venc->venc_type == VPBE_VERSION_3) {
@@ -265,6 +286,7 @@  static int venc_set_pal(struct v4l2_subdev *sd)
 	if (venc->pdata->setup_clock(VPBE_ENC_STD, V4L2_STD_625_50) < 0)
 		return -EINVAL;
 
+	venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_STD, V4L2_STD_625_50);
 	venc_enabledigitaloutput(sd, 0);
 
 	if (venc->venc_type == VPBE_VERSION_3) {
@@ -319,6 +341,7 @@  static int venc_set_480p59_94(struct v4l2_subdev *sd)
 	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0)
 		return -EINVAL;
 
+	venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 27000000);
 	venc_enabledigitaloutput(sd, 0);
 
 	if (venc->venc_type == VPBE_VERSION_2)
@@ -366,6 +389,7 @@  static int venc_set_576p50(struct v4l2_subdev *sd)
 	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 27000000) < 0)
 		return -EINVAL;
 
+	venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 27000000);
 	venc_enabledigitaloutput(sd, 0);
 
 	if (venc->venc_type == VPBE_VERSION_2)
@@ -406,6 +430,7 @@  static int venc_set_720p60_internal(struct v4l2_subdev *sd)
 	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0)
 		return -EINVAL;
 
+	venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 74250000);
 	venc_enabledigitaloutput(sd, 0);
 
 	venc_write(sd, VENC_OSDCLK0, 0);
@@ -434,6 +459,7 @@  static int venc_set_1080i30_internal(struct v4l2_subdev *sd)
 	if (pdata->setup_clock(VPBE_ENC_DV_TIMINGS, 74250000) < 0)
 		return -EINVAL;
 
+	venc_enable_vpss_clock(venc->venc_type, VPBE_ENC_DV_TIMINGS, 74250000);
 	venc_enabledigitaloutput(sd, 0);
 
 	venc_write(sd, VENC_OSDCLK0, 0);