From patchwork Tue Sep 6 19:12:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9317859 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 F3EB4601C0 for ; Tue, 6 Sep 2016 19:12:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E59E928E76 for ; Tue, 6 Sep 2016 19:12:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9B1928E45; Tue, 6 Sep 2016 19:12:35 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7899A28E45 for ; Tue, 6 Sep 2016 19:12:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE7906E3C8; Tue, 6 Sep 2016 19:12:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-x22d.google.com (mail-qk0-x22d.google.com [IPv6:2607:f8b0:400d:c09::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 159136E3C8 for ; Tue, 6 Sep 2016 19:12:32 +0000 (UTC) Received: by mail-qk0-x22d.google.com with SMTP id z190so228680087qkc.0 for ; Tue, 06 Sep 2016 12:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=U4HjSDii5ho5aCxsJj4j0TBwC5X5jO/hAYAIxfK2pTA=; b=STOJimj6rV4kkX3QbJc1+QaQBs8XFwFG8uCikVwCE+DGKKP7MyxPUK/jiFeI7yEu8y Pm81GMZ7fobd3x+qPvruwYcoE2a/vFPMEthDrCLdU1f2TsHb5d7Q3tGBXAzpcn7OwOu1 bNzzl724qMX2ZjTkdWWQw8Y6tHIkjAToq2YnY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=U4HjSDii5ho5aCxsJj4j0TBwC5X5jO/hAYAIxfK2pTA=; b=PKZfAAXbtyITeiwjpODxiIm2WEuY+85liJh7DQ4hEmWmxiqQRzcykZypIM4QaEPKsk d7z4ST83Z30QzHfiz+kFNixqVhEI7VxymhZZqHu7w8r40KyL1tBY5fF/Owqcs0SjoHZ8 V/MEOd5vvoQwCLfb0w967VhcmZ8ADCkQc0cFjUsJn8edsp/tO8yU9xwSbr1HbKZrddt0 9I6+Pj0ORoFhuNa/SgqURogbzaCJIzfv3HS+64Vh5qERbkOb+eG9faQtaoeUXNrZfh44 WEJT4pI53wyvvIK2N1MgOaA+upnahDi+7hE30fJlfLTdBuqht62jQQtUgXFORCUO14Ma Nteg== X-Gm-Message-State: AE9vXwN/a/sCSGnbWNwfjajT169PSxHlCt2rbNsbAuRLcE7NyFE/YnAtxMd/V51NCCfLc8r1 X-Received: by 10.55.47.135 with SMTP id v129mr48471316qkh.127.1473189150633; Tue, 06 Sep 2016 12:12:30 -0700 (PDT) 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 m13sm18727501qkm.11.2016.09.06.12.12.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Sep 2016 12:12:29 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, mark.yao@rock-chips.com Subject: [PATCH] drm/rockchip: Fix up bug in psr state machine Date: Tue, 6 Sep 2016 15:12:26 -0400 Message-Id: <1473189146-12498-1-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The ->set() callback would always be called when transitioning from FLUSH->DISABLE since we assign state to psr->state right above the skip condition. Reported-by: Daniel Kurtz Signed-off-by: Sean Paul Reviewed-by: Daniel Kurtz --- drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c index c6ac5d0..cb17709 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c @@ -74,11 +74,13 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state) if (state == PSR_FLUSH && psr->state == PSR_DISABLE) return; - psr->state = state; - /* Already disabled in flush, change the state, but not the hardware */ - if (state == PSR_DISABLE && psr->state == PSR_FLUSH) + if (state == PSR_DISABLE && psr->state == PSR_FLUSH) { + psr->state = state; return; + } + + psr->state = state; /* Actually commit the state change to hardware */ switch (psr->state) {