From patchwork Fri Mar 10 04:32:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9614649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 939DF60414 for ; Fri, 10 Mar 2017 04:37:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86B7828649 for ; Fri, 10 Mar 2017 04:37:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B50A28653; Fri, 10 Mar 2017 04:37:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 294F828649 for ; Fri, 10 Mar 2017 04:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IvFcOyaLmJru4Cyll57sVKme4TKkGHAMx5Y1DR2wj1E=; b=TaXIcyNeAxLQ0J MdIFwEuyaCEMIQBMLDp7Zn1ZbQdMDea4CkuPKAqWxSzLbtBQfYyTxfTmqm7q2/RPh5Us8SAdnwgAo EzMKZo956IO3vEfr6vD1rNJ2VtVLFF+q8XQkRZdtI8zLItSk/9sLvn0Q7K2m/mR+50KvVsCfd+SfX rCYPrK8huId9G9hX7AaZeCMk/+KbpXCRISaBgQsEFuHSlhu3zCilOxZxQvNLANBok5daIP7pmS3IC BmgmD9eIqcganmEdEZ6QBeoUipgMH9k6gtuWW0yzt4XDU3jUMPEfYoDw44Uo9A/xjWscG00NGjW2X Peu26OTUvhzBrOn5E1Qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cmCIx-0001iD-UG; Fri, 10 Mar 2017 04:37:27 +0000 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCHF-0000LG-W1 for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2017 04:35:48 +0000 Received: by mail-qk0-x22b.google.com with SMTP id v125so148884186qkh.2 for ; Thu, 09 Mar 2017 20:35:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gwzSkcHQlKSHkERNPnyu+KyYgRbgghrrfG+3IGy+l8k=; b=G0d/JzJLWJuJP5TyS/Elz3JXLm5a3LzgtxgNs/Ijc9f42Fd8h8SKUIZZVsdVNdcGZ3 JMiGYqYulzloRbtdf6DK1E1eDMgE14xyuFgdp21l/K71/0BJGNtGoSOkpJSmDBap50tb yhp02WvCuLsYuOOYh1vBMB//GxZkpfJlNRQgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gwzSkcHQlKSHkERNPnyu+KyYgRbgghrrfG+3IGy+l8k=; b=Y3giy4OUTaB4Bogq+EHM/VZAlDsAyPY/j66Ire+EaVjzReL4qhGyiaifXvNsKIazbY 31m9v98DBmg9G6jCSjTb5Xa0xZh5i/8GF7d2CwMzHvdwIA8cwWG7z6NNVBRNZSuPJ7uq 3GK31huiP47N020OyAs4AdMTv11eMkUG+8F7Air6m/nt7yxhpoRFv/Msgb4qZ1feGkYd fugT8wMuxffoem2cOMnog08VQaUXuuFuESGEqx/1rIh1oFz9If53KLyJQ/odOOxYSsvA uItiq4Ydw6rFKWIUp2/5gp2OMbKvHW5nsKprU2qplmu3TYOqN+z057ycix1pOXzjgiGf 5qxA== X-Gm-Message-State: AFeK/H3G109MsbEgfLNKR+stmjL23j9wN8UTt3qJpHdhg88fGFUx1+5juAeXnLbuFH5O5GGB X-Received: by 10.55.16.157 with SMTP id 29mr16378482qkq.247.1489120526849; Thu, 09 Mar 2017 20:35:26 -0800 (PST) Received: from boxwood.roam.corp.google.com (cpe-75-189-128-87.nc.res.rr.com. [75.189.128.87]) by smtp.gmail.com with ESMTPSA id n19sm5697731qtn.35.2017.03.09.20.35.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 20:35:25 -0800 (PST) From: Sean Paul To: linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH 09/41] drm/rockchip: Remove analogix psr worker Date: Thu, 9 Mar 2017 23:32:24 -0500 Message-Id: <20170310043305.17216-10-seanpaul@chromium.org> X-Mailer: git-send-email 2.12.0.246.ga2ecc84866-goog In-Reply-To: <20170310043305.17216-1-seanpaul@chromium.org> References: <20170310043305.17216-1-seanpaul@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_203542_429132_DD0272EC X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?=E5=BE=81=E5=A2=9E=20=E7=8E=8B?= , Heiko Stuebner , David Airlie , Sean Paul , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , linux-arm-kernel@lists.infradead.org, Mark Yao Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that the spinlocks and timers are gone, we can remove the psr worker located in rockchip's analogix driver and do the enable/disable directly. This should simplify the code and remove races on disable. Cc: 征增 王 Cc: Stéphane Marchesin Signed-off-by: Sean Paul --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 38 ++++--------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 90eb7908e2e5..64e7e2c0bc58 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -71,10 +71,6 @@ struct rockchip_dp_device { struct regmap *grf; struct reset_control *rst; - struct work_struct psr_work; - struct mutex psr_lock; - unsigned int psr_state; - const struct rockchip_dp_chip_data *data; struct analogix_dp_plat_data plat_data; @@ -83,30 +79,14 @@ struct rockchip_dp_device { static void analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled) { struct rockchip_dp_device *dp = to_dp(encoder); + struct drm_crtc *crtc = dp->encoder.crtc; + int vact_end; + int ret; if (!analogix_dp_psr_supported(dp->dev)) return; - dev_dbg(dp->dev, "%s PSR...\n", enabled ? "Entry" : "Exit"); - - mutex_lock(&dp->psr_lock); - if (enabled) - dp->psr_state = EDP_VSC_PSR_STATE_ACTIVE; - else - dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE; - - schedule_work(&dp->psr_work); - mutex_unlock(&dp->psr_lock); -} - -static void analogix_dp_psr_work(struct work_struct *work) -{ - struct rockchip_dp_device *dp = - container_of(work, typeof(*dp), psr_work); - struct drm_crtc *crtc = dp->encoder.crtc; - int psr_state = dp->psr_state; - int vact_end; - int ret; + dev_dbg(dp->dev, "%s PSR...\n", enabled ? "enable" : "disable"); if (!crtc) return; @@ -120,12 +100,10 @@ static void analogix_dp_psr_work(struct work_struct *work) return; } - mutex_lock(&dp->psr_lock); - if (psr_state == EDP_VSC_PSR_STATE_ACTIVE) + if (enabled) analogix_dp_enable_psr(dp->dev); else analogix_dp_disable_psr(dp->dev); - mutex_unlock(&dp->psr_lock); } static int rockchip_dp_pre_init(struct rockchip_dp_device *dp) @@ -142,8 +120,6 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) struct rockchip_dp_device *dp = to_dp(plat_data); int ret; - cancel_work_sync(&dp->psr_work); - ret = clk_prepare_enable(dp->pclk); if (ret < 0) { dev_err(dp->dev, "failed to enable pclk %d\n", ret); @@ -404,10 +380,6 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, dp->plat_data.power_off = rockchip_dp_powerdown; dp->plat_data.get_modes = rockchip_dp_get_modes; - mutex_init(&dp->psr_lock); - dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE; - INIT_WORK(&dp->psr_work, analogix_dp_psr_work); - rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set); return analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);