From patchwork Tue Apr 2 11:44:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2377511 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id 4F1A53FDDA for ; Tue, 2 Apr 2013 11:50:21 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r32BkfI3000306; Tue, 2 Apr 2013 06:46:41 -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 r32BkfJI029651; Tue, 2 Apr 2013 06:46:41 -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; Tue, 2 Apr 2013 06:46:40 -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 r32Bke6c025291; Tue, 2 Apr 2013 06:46:40 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C35B980628; Tue, 2 Apr 2013 05:46:40 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 371F980628 for ; Tue, 2 Apr 2013 05:44:34 -0600 (CST) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id r32BiYDD017979 for ; Tue, 2 Apr 2013 06:44:34 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r32BiXgT017691 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Apr 2013 06:44:33 -0500 Received: from [216.82.253.147:34213] by server-3.bemta-7.messagelabs.com id 91/B6-12019-1A4CA515; Tue, 02 Apr 2013 11:44:33 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-11.tower-165.messagelabs.com!1364903072!10965079!1 X-Originating-IP: [209.85.210.48] 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 21641 invoked from network); 2 Apr 2013 11:44:32 -0000 Received: from mail-da0-f48.google.com (HELO mail-da0-f48.google.com) (209.85.210.48) by server-11.tower-165.messagelabs.com with RC4-SHA encrypted SMTP; 2 Apr 2013 11:44:32 -0000 Received: by mail-da0-f48.google.com with SMTP id p8so156416dan.21 for ; Tue, 02 Apr 2013 04:44:32 -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=FdTOH42YQETAAfFvtxB0GuybKcmjLhyouxpfyqF8RUw=; b=kgDY3BWMNw0p54JpFRxTGWGyARAWOmsbiufNTJAfSYo6npOjMOKEcYTv7yCkG7M1GW 2namyWncu126+m6a/v0rE6nih19znchYqI2zb40ocpC2nBF4PtkNiGkVunW5myHmsG7E MSd2/JkidqFMyhMtCgZUUOQLt1orlzuGMGTeaGvEXkOPbFzOcVcbabsQkH4Ql2fDuNgN BwE0CefzX7F0kpPjqpkffMe8RuibB00GjxLDf3nc+R8gm6AjjSk5HLYIbr3xHyxx3KjG K8jbc8EVvEfI6MJGsAldggzRs0QaiHlhFBXfKGemo2hmxqBILG2JIE0oX9i797/8OH/w y4Dg== X-Received: by 10.68.194.170 with SMTP id hx10mr16836603pbc.104.1364903072171; Tue, 02 Apr 2013 04:44:32 -0700 (PDT) Received: from localhost.localdomain ([59.98.242.90]) by mx.google.com with ESMTPS id kt5sm1443082pbc.30.2013.04.02.04.44.27 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Apr 2013 04:44:31 -0700 (PDT) From: Prabhakar lad To: DLOS , LAK , Sekhar Nori , Mauro Carvalho Chehab , LMML Subject: [PATCH v2 2/3] media: davinci: vpbe: venc: move the enabling of vpss clocks to driver Date: Tue, 2 Apr 2013 17:14:03 +0530 Message-ID: <1364903044-13752-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1364903044-13752-1-git-send-email-prabhakar.csengg@gmail.com> References: <1364903044-13752-1-git-send-email-prabhakar.csengg@gmail.com> CC: LKML 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 --- drivers/media/platform/davinci/vpbe_venc.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_venc.c b/drivers/media/platform/davinci/vpbe_venc.c index f15f211..91d0272 100644 --- a/drivers/media/platform/davinci/vpbe_venc.c +++ b/drivers/media/platform/davinci/vpbe_venc.c @@ -202,6 +202,25 @@ 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 +239,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 +285,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 +340,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 +388,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 +429,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 +458,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);