From patchwork Mon Jul 21 04:54:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shaik Ameer Basha X-Patchwork-Id: 4593071 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 826CCC0514 for ; Mon, 21 Jul 2014 04:58:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E91FF2010E for ; Mon, 21 Jul 2014 04:57:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74B4F2010B for ; Mon, 21 Jul 2014 04:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbaGUE5s (ORCPT ); Mon, 21 Jul 2014 00:57:48 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:14233 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752472AbaGUE5r (ORCPT ); Mon, 21 Jul 2014 00:57:47 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N91001BBPS91TA0@mailout1.samsung.com> for linux-media@vger.kernel.org; Mon, 21 Jul 2014 13:57:45 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 88.7F.14704.8CD9CC35; Mon, 21 Jul 2014 13:57:44 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-92-53cc9dc84750 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 2C.E7.04943.8CD9CC35; Mon, 21 Jul 2014 13:57:44 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N91002EEPS0I520@mmp1.samsung.com>; Mon, 21 Jul 2014 13:57:44 +0900 (KST) From: Shaik Ameer Basha To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, pawel@osciak.com, shaik.samsung@gmail.com, joshi@samsung.com, Shaik Ameer Basha Subject: [PATCH] [media] exynos-gsc: Remove PM_RUNTIME dependency Date: Mon, 21 Jul 2014 10:24:48 +0530 Message-id: <1405918488-26142-1-git-send-email-shaik.ameer@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsWyRsSkRvfE3DPBBnumS1l83/WF3aJnw1ZW iylvf7JbHH7Tzmpx5OFudot1OyexO7B57Jx1l93j8a+XbB59W1YxenzeJBfAEsVlk5Kak1mW WqRvl8CVsaV/OXvBZZGK1um5DYwzBbsYOTgkBEwk1vXkdzFyApliEhfurWfrYuTiEBJYyijx YNNdFoiEicSbnjYmiMQiRokva6+zQzgTmCQ+HVgCVsUmYCix/d4VVhBbREBe4knvDbBRzALt jBLdaxrYQRLCAo4Svw5fArNZBFQlPjYeBmvmFXCX2LzqCiPESQoScybZgPRKCLxnk7g4fSkb RL2AxLfJh1ggamQlNh1ghrhOUuLgihssExgFFzAyrGIUTS1ILihOSi8y1itOzC0uzUvXS87P 3cQIDNDT/57172C8e8D6EGMy0LiJzFKiyfnAAM8riTc0NjOyMDUxNTYytzQjTVhJnPf+w6Qg IYH0xJLU7NTUgtSi+KLSnNTiQ4xMHJxSDYxymhHctrPkKjMT+L/rXl7G4eb/qet62YcJFbfz 7/rlhvdWhvVsu2rSfZArp+i+YBQvj8HqN5Jb17Yn6/JoZv6UPVAYySp3e8WSBzceLnp19dil 2Nchv7ocqjZcrAwRqnOXfsAbtLJ9+lLt2r2GdzKqn5goLV/99dhsbbPC3hWLufed/BZleESJ pTgj0VCLuag4EQDYXDaSZgIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeLIzCtJLcpLzFFi42I5/e+xgO6JuWeCDTYeE7L4vusLu0XPhq2s FlPe/mS3OPymndXiyMPd7Bbrdk5id2Dz2DnrLrvH418v2Tz6tqxi9Pi8SS6AJaqB0SYjNTEl tUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMHaLuSQlliTilQKCCx uFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCGMWNL/3L2gssiFa3TcxsYZwp2MXJySAiYSLzp aWOCsMUkLtxbz9bFyMUhJLCIUeLL2uvsEM4EJolPB5awgFSxCRhKbL93hRXEFhGQl3jSewOs g1mgnVGie00DO0hCWMBR4tfhS2A2i4CqxMfGw2DNvALuEptXXWHsYuQAWqcgMWeSzQRG7gWM DKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxgiPgmdQOxpUNFocYBTgYlXh4PRjPBAuxJpYV V+YeYpTgYFYS4T2RARTiTUmsrEotyo8vKs1JLT7EaAq0fCKzlGhyPjA680riDY1NzE2NTS1N LEzMLJXEeQ+0WgcKCaQnlqRmp6YWpBbB9DFxcEo1MArM1NU4vPLhgSfhkr0i3lN3aeWs2tET fPbWOy/1d/1ip9lS2M8JBITskp3vOftl3dzl0jqRAa77f2fn6fOxvvll/ofxpXvcPaeD/6N3 96ToPvjudmKuq0O12I1fz/JvdrxYnCBw68085jV5X9ecMWtwZtFuTpRaZPlOZxYb280r1WJy Tcas85RYijMSDbWYi4oTATko82KWAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 1] Currently Gscaler clock is enabled only inside pm_runtime callbacks. If PM_RUNTIME is disabled, driver hangs. This patch removes the PM_RUNTIME dependency by keeping the clock enable/disable functions in m2m start/stop streaming callbacks. 2] For Exynos5420/5800, Gscaler clock has to be Turned ON before powering on/off the Gscaler power domain. This dependency is taken care by this patch at driver level. Signed-off-by: Shaik Ameer Basha Acked-by: Sylwester Nawrocki --- drivers/media/platform/exynos-gsc/gsc-core.c | 10 ++-------- drivers/media/platform/exynos-gsc/gsc-m2m.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 9d0cc04..39c0953 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1132,23 +1132,17 @@ static int gsc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gsc); pm_runtime_enable(dev); - ret = pm_runtime_get_sync(&pdev->dev); - if (ret < 0) - goto err_m2m; /* Initialize continious memory allocator */ gsc->alloc_ctx = vb2_dma_contig_init_ctx(dev); if (IS_ERR(gsc->alloc_ctx)) { ret = PTR_ERR(gsc->alloc_ctx); - goto err_pm; + goto err_m2m; } dev_dbg(dev, "gsc-%d registered successfully\n", gsc->id); - - pm_runtime_put(dev); return 0; -err_pm: - pm_runtime_put(dev); + err_m2m: gsc_unregister_m2m_device(gsc); err_v4l2: diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index e434f1f0..a98462c 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -60,19 +60,32 @@ static void __gsc_m2m_job_abort(struct gsc_ctx *ctx) static int gsc_m2m_start_streaming(struct vb2_queue *q, unsigned int count) { struct gsc_ctx *ctx = q->drv_priv; + struct gsc_dev *gsc = ctx->gsc_dev; int ret; + ret = clk_enable(gsc->clock); + if (ret) + return ret; + ret = pm_runtime_get_sync(&ctx->gsc_dev->pdev->dev); + + if (!pm_runtime_enabled(&gsc->pdev->dev)) { + gsc_hw_set_sw_reset(gsc); + gsc_wait_reset(gsc); + } + return ret > 0 ? 0 : ret; } static void gsc_m2m_stop_streaming(struct vb2_queue *q) { struct gsc_ctx *ctx = q->drv_priv; + struct gsc_dev *gsc = ctx->gsc_dev; __gsc_m2m_job_abort(ctx); pm_runtime_put(&ctx->gsc_dev->pdev->dev); + clk_disable(gsc->clock); } void gsc_m2m_job_finish(struct gsc_ctx *ctx, int vb_state)