From patchwork Mon Oct 8 15:12:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 1566141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id CE75ADF238 for ; Mon, 8 Oct 2012 15:16:14 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TLF0E-0008VQ-GR; Mon, 08 Oct 2012 15:12:18 +0000 Received: from mail-oa0-f49.google.com ([209.85.219.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TLF0B-0008VC-B1 for linux-arm-kernel@lists.infradead.org; Mon, 08 Oct 2012 15:12:16 +0000 Received: by mail-oa0-f49.google.com with SMTP id l10so226500oag.36 for ; Mon, 08 Oct 2012 08:12:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=LgjNrT827YBHJiowcspJLDhQZdbi7P4iWQBMYX1nGLM=; b=zrkcHMl5+7Whez9991VC4fALHdMI8JjFDcmDIhZmjFAtXF2LQJGlft2cqCY5lzpkeY HDcHQ7YqIv3R43jpYLoS1L0g4BLDx2cCkAhhhVEWn4E2YnHQBxgwviSjgHpcGa2o6qWt Sfra1YucEUHzWl4eA3gL17jrNDDpK/zXmc8/OZ9GdhJWckIBkx1pE82S+Y0A9jv1SQaM 5tBMx/dtRs3rokZ7bv5usBLmuHYFpeiOXe4OyF+hTVR5WY+GTlYM3wJFhbuyAf3vDrbw IRtPZDgZbSaQ8nnR+ZG8m4zQHj5TQxns3Z2Jzo3rb35NBbb2AImSSZRtH3lgo3d2jdGm RBxg== MIME-Version: 1.0 Received: by 10.60.170.76 with SMTP id ak12mr13729250oec.22.1349709133005; Mon, 08 Oct 2012 08:12:13 -0700 (PDT) Received: by 10.76.91.41 with HTTP; Mon, 8 Oct 2012 08:12:12 -0700 (PDT) In-Reply-To: <5072A528.8010605@gmail.com> References: <1349473981-15084-1-git-send-email-fabio.estevam@freescale.com> <5072A528.8010605@gmail.com> Date: Mon, 8 Oct 2012 12:12:12 -0300 Message-ID: Subject: Re: [PATCH 2/2] [media]: mx2_camera: Fix regression caused by clock conversion From: Fabio Estevam To: =?UTF-8?Q?Ga=C3=ABtan_Carlier?= X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.219.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Fabio Estevam , mchehab@infradead.org, javier.martin@vista-silicon.com, kernel@pengutronix.de, g.liakhovetski@gmx.de, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Mon, Oct 8, 2012 at 7:04 AM, Gaƫtan Carlier wrote: > > This patch does not apply on linux-next-20121008. I suppose that linux-media > development branch is needed. How can I put linux-media branch on top of Ok, I have just rebased it against linux-next-20121008. See below. It allows ov2640 to probe correctly. However, it does not work with Gstreamer anymore (Friday's linux-next allowed to get the Gstreamer pipeline to work). $ gst-launch v4l2src ! fbdevsink Setting pipeline to PAUSED ...mx2-camera mx2-camera.0: Camera driver attached to camera 0 mx2-camera mx2-camera.0: Camera driver detached from camera 0 ERROR: Pipeline doesn't want to pause. ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to query norm on device '/dev/video0'. Additional debug info: v4l2_calls.c(213): gst_v4l2_fill_lists (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to get attributes for norm 0 on devide '/dev/video0'. (61 - No data available) Setting pipeline to NULL ... Freeing pipeline ... Does anyone have any ideas? Thanks, Fabio Estevam --- drivers/media/platform/soc_camera/mx2_camera.c | 47 +++++++++++++++++------- 1 file changed, 34 insertions(+), 13 deletions(-) writel(0, pcdev->base_emma + PRP_CNTL); @@ -460,7 +462,11 @@ static int mx2_camera_add_device(struct soc_camera_device *icd) if (pcdev->icd) return -EBUSY; - ret = clk_prepare_enable(pcdev->clk_csi); + ret = clk_prepare_enable(pcdev->clk_csi_ahb); + if (ret < 0) + return ret; + + ret = clk_prepare_enable(pcdev->clk_csi_per); if (ret < 0) return ret; @@ -1725,11 +1731,18 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) goto exit; } - pcdev->clk_csi = devm_clk_get(&pdev->dev, "ahb"); - if (IS_ERR(pcdev->clk_csi)) { - dev_err(&pdev->dev, "Could not get csi clock\n"); - err = PTR_ERR(pcdev->clk_csi); - goto exit; + pcdev->clk_csi_ahb = devm_clk_get(&pdev->dev, "ahb"); + if (IS_ERR(pcdev->clk_csi_ahb)) { + dev_err(&pdev->dev, "Could not get csi ahb clock\n"); + err = PTR_ERR(pcdev->clk_csi_ahb); + goto exit; + } + + pcdev->clk_csi_per = devm_clk_get(&pdev->dev, "per"); + if (IS_ERR(pcdev->clk_csi_per)) { + dev_err(&pdev->dev, "Could not get csi per clock\n"); + err = PTR_ERR(pcdev->clk_csi_per); + goto exit_csi_ahb; } pcdev->pdata = pdev->dev.platform_data; @@ -1738,14 +1751,15 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) pcdev->platform_flags = pcdev->pdata->flags; - rate = clk_round_rate(pcdev->clk_csi, pcdev->pdata->clk * 2); + rate = clk_round_rate(pcdev->clk_csi_per, + pcdev->pdata->clk * 2); if (rate <= 0) { err = -ENODEV; - goto exit; + goto exit_csi_per; } - err = clk_set_rate(pcdev->clk_csi, rate); + err = clk_set_rate(pcdev->clk_csi_per, rate); if (err < 0) - goto exit; + goto exit_csi_per; } INIT_LIST_HEAD(&pcdev->capture); @@ -1801,7 +1815,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev) goto exit_free_emma; dev_info(&pdev->dev, "MX2 Camera (CSI) driver probed, clock frequency: %ld\n", - clk_get_rate(pcdev->clk_csi)); + clk_get_rate(pcdev->clk_csi_per)); return 0; @@ -1812,6 +1826,10 @@ eallocctx: clk_disable_unprepare(pcdev->clk_emma_ipg); clk_disable_unprepare(pcdev->clk_emma_ahb); } +exit_csi_per: + clk_disable_unprepare(pcdev->clk_csi_per); +exit_csi_ahb: + clk_disable_unprepare(pcdev->clk_csi_ahb); exit: return err; } @@ -1831,6 +1849,9 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev) clk_disable_unprepare(pcdev->clk_emma_ahb); } + clk_disable_unprepare(pcdev->clk_csi_per); + clk_disable_unprepare(pcdev->clk_csi_ahb); + dev_info(&pdev->dev, "MX2 Camera driver unloaded\n"); return 0; diff --git a/drivers/media/platform/soc_camera/mx2_camera.c b/drivers/media/platform/soc_camera/mx2_camera.c index 403d7f1..9f8c5f0 100644 --- a/drivers/media/platform/soc_camera/mx2_camera.c +++ b/drivers/media/platform/soc_camera/mx2_camera.c @@ -272,7 +272,8 @@ struct mx2_camera_dev { struct device *dev; struct soc_camera_host soc_host; struct soc_camera_device *icd; - struct clk *clk_csi, *clk_emma_ahb, *clk_emma_ipg; + struct clk *clk_emma_ahb, *clk_emma_ipg; + struct clk *clk_csi_ahb, *clk_csi_per; void __iomem *base_csi, *base_emma; @@ -432,7 +433,8 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev) { unsigned long flags; - clk_disable_unprepare(pcdev->clk_csi); + clk_disable_unprepare(pcdev->clk_csi_ahb); + clk_disable_unprepare(pcdev->clk_csi_per); writel(0, pcdev->base_csi + CSICR1); if (cpu_is_mx27()) {