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: 9614679 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 433C860415 for ; Fri, 10 Mar 2017 04:39:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 352482864A for ; Fri, 10 Mar 2017 04:39:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29E5A286EF; Fri, 10 Mar 2017 04:39:53 +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=unavailable 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 C5DD02864A for ; Fri, 10 Mar 2017 04:39:52 +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=pt2faoJBz97ATTcURhTFnNQgEsX7+arIqAdsTr2isS8=; b=ljRPK7aQf0ByHH cCui4tby8gRIzWhTcZJh7ZXmKxoQkC7kwZMSn0/tFG8eT2MMXG89vXrjlk+wuJTLQk1NIGFhfcizw CXbFn2BlooAZEGNmp/KQnkpog4gmR6vcI4IjskUIWK3lzeI1o19gIcgVSldp92iphFUpIvybHQwB+ t0SCGte98Q3YfYjAkkjgmm3ybDxJdMLy56Hxyh1vr3CZJy3tkaxtG+E7PBqYelWI51+Axhdj/Lg+4 8HUHyfnjsGxPJItHX46rirJprptQp+e+l2bXW0Fehk7dKgkBej+fTEFF5lB2T2yeJi9+lZ85OfQ0g mu1RfJA6EMvpjadAJnkQ==; 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 1cmCLI-0002YU-HD; Fri, 10 Mar 2017 04:39:52 +0000 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmCHM-0000LF-Bw for linux-rockchip@lists.infradead.org; Fri, 10 Mar 2017 04:35:53 +0000 Received: by mail-qk0-x236.google.com with SMTP id y76so152148469qkb.0 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=c+N8remCStT3JilJUBmp3rbeOCL6R3Czp8fsQi2jyfJn3cz8c0y8x15xRlcIW31SHz jrz/Ew4ZUnQ+l7wUOmCxXejUDUr+tHoJPma162MD6p8kCKVyfqb2rlPcB1RcanwKZUKj Z6yOwBkMaX2mItN+FoOtvM8F/lPQt65Nf8LNW8aSaNAlnBL52eMngTyvNpHUQdEW8U+c OrDqu88dFw0ViF3jp6/1bbMEUI1PB/q4hASCOekRGSsNXmdP0caZSgFXRmsSu+5mdWqw HTwaMZ0+l4ypBen8dMM+afuzl9bv4wjO9D08ZIktU4SuWZOT5G6Io4lxo0KqKbFyQ2a3 /8GQ== X-Gm-Message-State: AFeK/H2YUZUcSUGNPrlSxUO711t6hLSp+QlPWqYQYyikw1NUsckU5nH2a0S0ez55lELgIsUq 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_203548_736367_FEEF944F X-CRM114-Status: GOOD ( 12.52 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=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);