From patchwork Thu Jun 7 11:06:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 137866 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1948445lji; Thu, 7 Jun 2018 04:06:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKInAyA5yr3OI7dNMSJawavO4YtojJXtV5zdfFv+v24RmsfdATz+dMKKxlrwm73PDEcw1jIC X-Received: by 2002:a17:902:b7c4:: with SMTP id v4-v6mr1573765plz.188.1528369588194; Thu, 07 Jun 2018 04:06:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528369588; cv=none; d=google.com; s=arc-20160816; b=gLuU2tYh1TbQovQqv6h9UsQTonPVIVUY8SmuwwuGos79qHilbvG8vCmxxvg0wdAIiX 7adjb3qW+ivhA4ZbQ5siQRWTFqJOlK/wXWD0aqH4Lx9B9J0Geb77bsqhCeMtH1ftD1YU 4rXVufRzhtNTFfvNHypnn6v27E4MYpses8Df4KeNeQi94bElVyVqXIcm3vORGQQTnEBu Rp7t8CPu8oa572O6h2mWSkOPWZqT7I5tb4CKc3RNdgidozfLQb85oQy0SC0dsx/hRH1h FCfe5KKFz14lj3gphKm+vqGsNkPx3rL2OWf+NXpokAPiA5iwvNS2V27ClJklcc5VG0o9 TujA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=a5h1btInhInaM7hq+iKiAihkfGUwsyOAV9vhXUtObFg=; b=OLrhADtd+ANjuBANm5vX5iTx4eKS9fpxRvWs2SOLiC41fj7H1aweBJKLgnZ1mK1n5k eAn7vIXuR1PMfGSEuNIHfdZqRk0egiO7gd9ihr2YxgNoYOZV/i6WQ1lwMyZ957YaA5VD xGiHJNM15gyIO5IjrDIj7pyc9AvInkabGviG8Q2UWRt7RCjlYKZxO/4jMUCFWAyPIjdd 5AwTUA8Vz64AcRxQ42DbT36vIaPT2uQqJ5JzqKi2WUxJnowrhSTz3h8yDfd2kap7sOw0 ZTiUZscJkj/92uX4mAxhZL1G8M446sYbrQZdeUfKpiFyPtTjWEira4ui7vITjzBs+WUY jY0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=LAhs5R6N; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8-v6si15144102pgd.96.2018.06.07.04.06.27; Thu, 07 Jun 2018 04:06:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=LAhs5R6N; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187AbeFGLG1 (ORCPT + 3 others); Thu, 7 Jun 2018 07:06:27 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:44682 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753248AbeFGLGY (ORCPT ); Thu, 7 Jun 2018 07:06:24 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180607110622euoutp01007a98abf08c067b2f5b5a76d28e96be~13AmtyKbd1891918919euoutp01u; Thu, 7 Jun 2018 11:06:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180607110622euoutp01007a98abf08c067b2f5b5a76d28e96be~13AmtyKbd1891918919euoutp01u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528369582; bh=5r7BEaAxe955uiDdFHdPf7B/9BuUIKAvA++ZQGQceRo=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=LAhs5R6Nm+uOT0GYXErRexWIA2ce/iB37ClkyTLWshBSEn4vuDJ3I4n1mlgMchCoA mZu/2Eo3ABMlEGIbG3HE9gDwOfsNWvuGauDra8jyJ+hL7frVcj3Bw2cA8FmX1tmFQx 5mo8j/zz9tx4uyteyEDUzAK8XpO0sTzrKv2hmY3Y= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180607110621eucas1p2780919074a71737f9f058a3c229b979f~13Al8SyZw1744217442eucas1p20; Thu, 7 Jun 2018 11:06:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id CD.43.10409.DA1191B5; Thu, 7 Jun 2018 12:06:21 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180607110620eucas1p232e27feadc19554ba0b344b8059ce337~13AlD9i892643926439eucas1p2k; Thu, 7 Jun 2018 11:06:20 +0000 (GMT) X-AuditID: cbfec7f5-b5fff700000028a9-7c-5b1911ad1f97 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 19.AD.04178.CA1191B5; Thu, 7 Jun 2018 12:06:20 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P9Y0097E9IGLAA0@eusync1.samsung.com>; Thu, 07 Jun 2018 12:06:20 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Bartlomiej Zolnierkiewicz , Andrzej Pietrasiewicz Subject: [PATCH 3/9] drm/exynos: scaler: Reset hardware before starting the operation Date: Thu, 07 Jun 2018 13:06:08 +0200 Message-id: <20180607110614.335-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180607110614.335-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsWy7djPc7prBSWjDU5+FLOY9bKdxWLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr48DtjawFx4Uq9p1eyNLAeIG/i5GTQ0LAROLI1FXsXYxcHEICKxglFp17yQThfGaU 6F44hRmm6tTLnWwQiWWMEk3vHkK1NDBJ3J04lx2kik3AUKLrbRcbiC0i4CbRdHgmK0gRs8Bj Rom1uzeDFQkLhEv8/9ECNpZFQFXix9PtYHFeAWuJo8+uskCsk5dYveEAWA2ngI3E+WWbwG6S EPjJKrHt+Tqom1wk3h58yg5hC0u8Or4FypaR6Ow4CNXQzCjRPmMWO4TTwyixdc4ONogqa4nD xy+ygtjMAnwSk7ZNB5rKARTnlehoE4Io8ZC4veEB1NP9jBJHXh1nnsAouYCRYRWjeGppcW56 arFxXmq5XnFibnFpXrpecn7uJkZgzJ3+d/zrDsZ9f5IOMQpwMCrx8DbcF48WYk0sK67MPcQo wcGsJMKbeEksWog3JbGyKrUoP76oNCe1+BCjNAeLkjhvnEZdlJBAemJJanZqakFqEUyWiYNT qoExzinSWWjlvg92NyU2N7ncmdjKpBi/0GPdSp0rWQdKRaSWaE9fcndR1M2nM55Wzf7xIl19 1uWtpopr3fwPLed9yyCg1OX557OYcl9VtX/rKb9I5sdrufzfrkt4bReRXui58ZzE6mPbS87c 7a41P779d3G4RujpsK3sNsd3vVWZe6r5a3nTpWhtJZbijERDLeai4kQAnweqi7UCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t/xy7prBCWjDW7NMbSY9bKdxWLjjPWs Fle+vmezmHR/AovFjPP7mCzWHrnLbjFj8ks2B3aP+93HmTz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr48DtjawFx4Uq9p1eyNLAeIG/i5GTQ0LAROLUy51sXYxcHEICSxglGpavY4dwmpgk Hi44yApSxSZgKNH1tosNxBYRcJNoOjyTFaSIWeAxo8THbafAioQFwiX+/2hhBrFZBFQlfjzd zg5i8wpYSxx9dpUFYp28xOoNB8BqOAVsJM4v28QEYgsB1bx9cJp9AiPPAkaGVYwiqaXFuem5 xYZ6xYm5xaV56XrJ+bmbGIGhsu3Yz807GC9tDD7EKMDBqMTD23BfPFqINbGsuDL3EKMEB7OS CG/iJbFoId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rznDSqjhATSE0tSs1NTC1KLYLJMHJxSDYxT NPbG3l6TFhdz9vlhXombu2Lj0ieqNmu4Oqw7fIf1xYZ98n7rgg6w9J95pXRgzS4Hn3m8nhfk U63cJ1e/mqzHo1DAHfRCacmFyYxh85pMfp6aLZnj1Wrcz+Glk3+Ocd5uN+FcPsGLurEJaSaX eAv3ymfdf9SmVtn09u1SMYedUranLA7vP67EUpyRaKjFXFScCAA3ryMyEQIAAA== X-CMS-MailID: 20180607110620eucas1p232e27feadc19554ba0b344b8059ce337 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180607110620eucas1p232e27feadc19554ba0b344b8059ce337 References: <20180607110614.335-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Andrzej Pietrasiewicz Ensure that Scaler hardware is properly reset and interrupts are cleared before processing next image. Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_scaler.c | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/exynos/exynos_drm_scaler.c b/drivers/gpu/drm/exynos/exynos_drm_scaler.c index 91d4382343d0..d25069e88186 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_scaler.c +++ b/drivers/gpu/drm/exynos/exynos_drm_scaler.c @@ -30,6 +30,7 @@ #define scaler_write(cfg, offset) writel(cfg, scaler->regs + (offset)) #define SCALER_MAX_CLK 4 #define SCALER_AUTOSUSPEND_DELAY 2000 +#define SCALER_RESET_WAIT_RETRIES 100 struct scaler_data { const char *clk_name[SCALER_MAX_CLK]; @@ -100,6 +101,23 @@ static u32 scaler_get_format(u32 drm_fmt) return 0; } +static inline int scaler_reset(struct scaler_context *scaler) +{ + int retry = SCALER_RESET_WAIT_RETRIES; + + scaler_write(SCALER_CFG_SOFT_RESET, SCALER_CFG); + do { + cpu_relax(); + } while (retry > 1 && + scaler_read(SCALER_CFG) & SCALER_CFG_SOFT_RESET); + do { + cpu_relax(); + scaler_write(1, SCALER_INT_EN); + } while (retry > 0 && scaler_read(SCALER_INT_EN) != 1); + + return retry ? 0 : -EIO; +} + static inline void scaler_enable_int(struct scaler_context *scaler) { u32 val; @@ -354,9 +372,13 @@ static int scaler_commit(struct exynos_drm_ipp *ipp, u32 dst_fmt = scaler_get_format(task->dst.buf.fourcc); struct drm_exynos_ipp_task_rect *dst_pos = &task->dst.rect; - scaler->task = task; - pm_runtime_get_sync(scaler->dev); + if (scaler_reset(scaler)) { + pm_runtime_put(scaler->dev); + return -EIO; + } + + scaler->task = task; scaler_set_src_fmt(scaler, src_fmt); scaler_set_src_base(scaler, &task->src); @@ -394,7 +416,11 @@ static inline void scaler_disable_int(struct scaler_context *scaler) static inline u32 scaler_get_int_status(struct scaler_context *scaler) { - return scaler_read(SCALER_INT_STATUS); + u32 val = scaler_read(SCALER_INT_STATUS); + + scaler_write(val, SCALER_INT_STATUS); + + return val; } static inline int scaler_task_done(u32 val)