From patchwork Fri Mar 22 07:53:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2318381 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork1.kernel.org (Postfix) with ESMTP id 64A133FD8C for ; Fri, 22 Mar 2013 07:58:12 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2M7rubA004863; Fri, 22 Mar 2013 02:53:57 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2M7rum3026566; Fri, 22 Mar 2013 02:53:56 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Fri, 22 Mar 2013 02:53:56 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2M7ruG9025978; Fri, 22 Mar 2013 02:53:56 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 5411680627; Fri, 22 Mar 2013 01:53:56 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id DF23C80627 for ; Fri, 22 Mar 2013 01:53:53 -0600 (CST) Received: from red.ext.ti.com (red.ext.ti.com [192.94.93.37]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2M7rrWv011130 for ; Fri, 22 Mar 2013 02:53:53 -0500 (CDT) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2M7rrx2003800 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 22 Mar 2013 02:53:53 -0500 Received: from [216.82.242.131:41337] by server-12.bemta-8.messagelabs.com id 48/2B-01647-11E0C415; Fri, 22 Mar 2013 07:53:53 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-13.tower-76.messagelabs.com!1363938831!30716433!1 X-Originating-IP: [209.85.160.43] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1308 invoked from network); 22 Mar 2013 07:53:52 -0000 Received: from mail-pb0-f43.google.com (HELO mail-pb0-f43.google.com) (209.85.160.43) by server-13.tower-76.messagelabs.com with RC4-SHA encrypted SMTP; 22 Mar 2013 07:53:52 -0000 Received: by mail-pb0-f43.google.com with SMTP id md12so2890710pbc.2 for ; Fri, 22 Mar 2013 00:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=LSwfoeAtPlwiqZLxMtYZhhIKT8gqZsW7cnS3Y+g04t0=; b=DYUHbRuWRYbtGR4Zo0T928QHBBj7pmoovvKlHCg/D/Y0n+/aj602wA+KLoh4ayU4T3 7bgob6bANFps0peKRayE44DbJBIc26wOdr2qkAQ+cCsKl/4/5zGNItpaIcjpEm1kRmrG DL+RMWwerMuYvjFsbS1hd+1JOpmOA7my5ycWoRmZwKSQWEe8FYz+aOiuGpjhFb7/XXHv deoR9lv+NDDfD0eVPQVcaHIIhodPA4EQpbaHxz2UwwHL7HtIRLX3alb78kzWv/u8+7g3 6ybjWiw3Wz1XWS9qW+6EJLUSQAsH6fC03P3XXfJjCG/wEfh5k2Or8gjYWhAYSeYmLpWF Dugg== X-Received: by 10.68.125.169 with SMTP id mr9mr1192286pbb.74.1363938831167; Fri, 22 Mar 2013 00:53:51 -0700 (PDT) Received: from localhost.localdomain ([59.98.241.192]) by mx.google.com with ESMTPS id xc4sm1442935pbc.41.2013.03.22.00.53.46 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 Mar 2013 00:53:50 -0700 (PDT) From: Prabhakar lad To: LMML , DLOS , LAK , Sekhar Nori Subject: [PATCH 2/2] media: davinci: vpbe: venc: move the enabling of vpss clocks to driver Date: Fri, 22 Mar 2013 13:23:13 +0530 Message-ID: <1363938793-22246-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1363938793-22246-1-git-send-email-prabhakar.csengg@gmail.com> References: <1363938793-22246-1-git-send-email-prabhakar.csengg@gmail.com> CC: LKML , Mauro Carvalho Chehab X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Lad, Prabhakar 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 --- 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(-) 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);