From patchwork Mon Apr 8 12:19:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2408211 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 25D3B3FC71 for ; Mon, 8 Apr 2013 12:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935647Ab3DHMVD (ORCPT ); Mon, 8 Apr 2013 08:21:03 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:61891 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935633Ab3DHMVA (ORCPT ); Mon, 8 Apr 2013 08:21:00 -0400 Received: by mail-pd0-f176.google.com with SMTP id r11so3184642pdi.21 for ; Mon, 08 Apr 2013 05:21:00 -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=RLf3eJto3T71t7NqYQIkRUn9tfT/Uka9TAxrRqYGYspjZ93bhyGmsGmdLxDJC5r9QM hCCWjRbHFbR7S9USupxnL7AW2v8NnzpHhgwZk10h6jDOx601YpupWDS4UMpImze4RKhf qqnWUPnppEVv7dkKEcDVSKOrSiVzUkGxS5xTLA1fAjI/Ls/0x/hO2x9G5fNxdCCQAQGf LuT+oVSDOwtDCuA1+u+Qpr+sxD5+kIQgbfdExqymSpuuISsYKxasdUhdMadMlaaPfX25 6h422T8wMJA7sZAwv9RbStacOfi5ArE1r7aJJi+Lznnls20Aoeal8Ojzhiwf3Ofa+EYl RqpA== X-Received: by 10.66.253.74 with SMTP id zy10mr36110196pac.122.1365423659950; Mon, 08 Apr 2013 05:20:59 -0700 (PDT) Received: from localhost.localdomain ([59.98.240.77]) by mx.google.com with ESMTPS id g8sm36827249pae.7.2013.04.08.05.20.55 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 08 Apr 2013 05:20:59 -0700 (PDT) From: Prabhakar lad To: DLOS , LAK , LMML Cc: LKML , Mauro Carvalho Chehab , Sekhar Nori , "Lad, Prabhakar" Subject: [PATCH v3 2/3] media: davinci: vpbe: venc: move the enabling of vpss clocks to driver Date: Mon, 8 Apr 2013 17:49:12 +0530 Message-Id: <1365423553-12619-3-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1365423553-12619-1-git-send-email-prabhakar.csengg@gmail.com> References: <1365423553-12619-1-git-send-email-prabhakar.csengg@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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);