From patchwork Wed Aug 17 01:11:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 9285075 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 F231F600CB for ; Wed, 17 Aug 2016 01:11:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E426C287C7 for ; Wed, 17 Aug 2016 01:11:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D8F9B287CC; Wed, 17 Aug 2016 01:11:56 +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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 943DB287C7 for ; Wed, 17 Aug 2016 01:11:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZpOe-0003Cw-AP; Wed, 17 Aug 2016 01:11:56 +0000 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZpOX-00038Z-RK for linux-rockchip@lists.infradead.org; Wed, 17 Aug 2016 01:11:50 +0000 Received: by mail-pa0-x22b.google.com with SMTP id fi15so31301541pac.1 for ; Tue, 16 Aug 2016 18:11:29 -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:in-reply-to:references; bh=C6rvkO9szwj1HHwC88vxoMaK4u2FSgyuzv26F3Wc8gY=; b=OqkrqPXOpR1zDp/xRVYgXwvjXTnRst+V6p+VzpKSkXyv95EYj1n9RKMF8R9QRErdqR vghXuaDy2M+1hpeqqkJkX8MyxRH5khVubEHzRvtN8xmBX4U16mY04VLkcuPP2mzSUtf3 cSDaKL4JeZOP50Y9t5x6rsMb4fb39pIKHNxds= 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:in-reply-to :references; bh=C6rvkO9szwj1HHwC88vxoMaK4u2FSgyuzv26F3Wc8gY=; b=cMsJY1A/n0zTBUgLyAaxw0UmFqGEU3MQx60n4zI+hsv4o1P03/djIr+bBLTd58ta5f V94Fe9VMNtunNf6LUdAnuvqimtaQ7WJW1liUpc8TGB8YmIAxVgmaAyilopycYatJvaub 7gUnmojiKUqsEWJRat4/yZiv003TOo+dk5UKEDjCaxf0W9BOqXwdDyQmEn+TPDinohQg JThDX9mElxUoyBfq8fGLxqoTtiLiJ9fyWoqAfpShDRVU8StyRa4tQccUr1LHf3BafrWc e73aKGPr0k6niWj+9AeXJyRBy0Z2zR9WS+y/cLeOMXx0qOI9xbUAo/nZlOYIrNzPx+KS hLzg== X-Gm-Message-State: AEkoouuHIKWaqclPlsZ7Om87Dmy0r8Ra2fZ7+FqDaL1Fkzyl0/1vnLWKrlH7/cLkUZpDqT9Z X-Received: by 10.66.51.98 with SMTP id j2mr70638705pao.87.1471396288761; Tue, 16 Aug 2016 18:11:28 -0700 (PDT) Received: from seanpaul0.corp.google.com ([172.22.162.59]) by smtp.gmail.com with ESMTPSA id f6sm42170827pfa.17.2016.08.16.18.11.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Aug 2016 18:11:27 -0700 (PDT) From: Sean Paul To: mark.yao@rock-chips.com, dri-devel@lists.freedesktop.org, ykk@rock-chips.com Subject: [PATCH v2 4/6] drm/rockchip: A couple small fixes to psr Date: Tue, 16 Aug 2016 18:11:14 -0700 Message-Id: <1471396276-8222-5-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1471396276-8222-1-git-send-email-seanpaul@chromium.org> References: <1471396276-8222-1-git-send-email-seanpaul@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160816_181149_960773_5DBAE0F6 X-CRM114-Status: GOOD ( 13.83 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcheu@chromium.org, Sean Paul , dianders@chromium.org, linux-rockchip@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A few things that need tidying up, no functional changes. Signed-off-by: Sean Paul Reviewed-by: Yakir Yang --- Changes in v2: - Introduced drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c index 5bd54f2..c6ac5d0 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c @@ -62,27 +62,25 @@ static void psr_set_state_locked(struct psr_drv *psr, enum psr_state state) * Allowed finite state machine: * * PSR_ENABLE < = = = = = > PSR_FLUSH - * | ^ | - * | | | - * v | | + * | ^ | + * | | | + * v | | * PSR_DISABLE < - - - - - - - - - */ - - /* Forbid no state change */ if (state == psr->state) return; - /* Forbid DISABLE change to FLUSH */ + /* Requesting a flush when disabled is a noop */ if (state == PSR_FLUSH && psr->state == PSR_DISABLE) return; psr->state = state; - /* Allow but no need hardware change, just need assign the state */ + /* Already disabled in flush, change the state, but not the hardware */ if (state == PSR_DISABLE && psr->state == PSR_FLUSH) return; - /* Refact to hardware state change */ + /* Actually commit the state change to hardware */ switch (psr->state) { case PSR_ENABLE: psr->set(psr->encoder, true); @@ -109,10 +107,7 @@ static void psr_flush_handler(unsigned long data) struct psr_drv *psr = (struct psr_drv *)data; unsigned long flags; - if (!psr) - return; - - /* State changed between flush time, then keep it */ + /* If the state has changed since we initiated the flush, do nothing */ spin_lock_irqsave(&psr->lock, flags); if (psr->state == PSR_FLUSH) psr_set_state_locked(psr, PSR_ENABLE);