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: 9285067 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 5CD70600CB for ; Wed, 17 Aug 2016 01:11:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E175287C7 for ; Wed, 17 Aug 2016 01:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42D7F287CC; Wed, 17 Aug 2016 01:11:36 +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 02664287C7 for ; Wed, 17 Aug 2016 01:11:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB2806E786; Wed, 17 Aug 2016 01:11:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-x22a.google.com (mail-pa0-x22a.google.com [IPv6:2607:f8b0:400e:c03::22a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 452A96E787 for ; Wed, 17 Aug 2016 01:11:29 +0000 (UTC) Received: by mail-pa0-x22a.google.com with SMTP id i5so31330589pat.2 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=g71UX9POYRc75on4ihTsm64bSwQy6DyHMjeI1sUcQ8Y13H5Uadw4SJwZ27fXmid7Uj OFcvSDwQuuzFL9mr/QW5ZGrpufGFlb9ynNvyXfwo7DeurnHP6RV3wCpvjQEzMyVYvZ9v WyDI2Eqbi9VLR0dnWM7F67GrIcVJkUmcb+7m5xEXxyNmYi5NKhGl8XvXwcuLBihmRBat nHVO2s+gJ5R9kl0w9J+OJgCKFSaYneDy1q5HEuxraCQYoec/w+QW6Sl5XG5KykT+Fbo5 lWgg9Dg4x9DbK7AfjG5hbrOvjR8PQ/+aQo7OoTRfSgO+sQZSdinjMp8YkfVbWUoTNaqm ImKA== X-Gm-Message-State: AEkooutSzsktAvkTuOLBO8Nvoo/bdqNLUl8uTSAZWBIigDu8Ftfx+DQbtrSOTh7fhfU7AwAr 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> Cc: marcheu@chromium.org, dianders@chromium.org, linux-rockchip@lists.infradead.org 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 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);