Received: by 10.192.165.156 with SMTP id m28csp507612imm; Mon, 16 Apr 2018 04:17:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/0ioZENuz2/zEN+MdLZ+cP1mdWDi9mqDfoFD+WzefLXuQwjAbLaVfUiKKriMVUDy8DjXZF X-Received: by 2002:a17:902:b7c9:: with SMTP id v9-v6mr8293599plz.35.1523877445365; Mon, 16 Apr 2018 04:17:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523877445; cv=none; d=google.com; s=arc-20160816; b=un1akoWufr3rbiNlfX28nY/9WZDVnAouguI9NLNwNdMnSPpQUmsEUcJKYC3ZQuQ9ke L4Cerdfdw0jxOn02kLn9xU95nqPrKkwQsKzSF3g8kMR3lagBM+w/ApIfrrwRqW6Z/4EU ne4D4zGkhF1Nha4ah6p7Vfix3siM3BqmLCSrVK+ULW6AwqiSI9+Qb3zVC6cWn1xftb4K +Q16x+77C6CxgDDVlWNuFFONZdk1zYNVlpVHUMKGNX2NrX5jBJj/EdeDOSj0PGXXyI7H /N1v8c9qhdd3Vcg3/utODmCJQzw5gpkcXiLippbLVZp0kxsYy/TWy/ppTaNk4oS6imgN pR/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter :arc-authentication-results; bh=pzvh6QOx2BPrY3giFHlWGo2A0Uttd6T7NgvNROUgNmI=; b=vzxxG34REGFoNRmmWMySvLtdayhDDsmujaXqg5pxIsSyee1tuOnFaanJOnrsFRGB/y yqRBvfQStWL0BKXXoxp58Wqt7WaXeWLDuDGfqBlqqe/hWW7yL6IZXb/TVL6s44iRBK1r z3xsLKDaY0VD2/C8e4VLb9C3R+twtRGkBhx1fRFXHwt5FUxMJVm7ioDqYVDo7XOh7ltz q37hd6nwkC5evk7RZWDeMgI6oApjVuOHByDhn3iflT6omTwhrbcwh36mUtiVlnckkaj8 TpFXnfTFyDqb3Rc/aJ5qzW62QrlzRGewpX2ZUXDtd98L/oCzodSEenN2ALtBGFUy67iV eQ6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bdVTxT6+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3si9438033pgc.452.2018.04.16.04.17.10; Mon, 16 Apr 2018 04:17:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=bdVTxT6+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbeDPJ52 (ORCPT + 99 others); Mon, 16 Apr 2018 05:57:28 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:34819 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbeDPJ5Z (ORCPT ); Mon, 16 Apr 2018 05:57:25 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180416095722euoutp022c2ba670925bcef288339c184615a43b~l4hhMvnYr1787917879euoutp021; Mon, 16 Apr 2018 09:57:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180416095722euoutp022c2ba670925bcef288339c184615a43b~l4hhMvnYr1787917879euoutp021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523872643; bh=pzvh6QOx2BPrY3giFHlWGo2A0Uttd6T7NgvNROUgNmI=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=bdVTxT6+fU/Sr/g456DQiKz6ujXgl7Lz7Ot7jACw0rqXjVCZEqNEEP1F7Lj9Kw2Ae Y9EbDkF+lMxyVMjo6O+cjPWR1011Z+ntECQY489Qww85UKT2KjoYPS3x3TeXL9tH1t kkAm/uJv5PbMgH2Uz22So99+qNYo3bczW5qrL2tA= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180416095721eucas1p2e0f20001aa11872fd5bf3cfb481924d4~l4hf6ccP_0315903159eucas1p2O; Mon, 16 Apr 2018 09:57:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 46.42.05700.08374DA5; Mon, 16 Apr 2018 10:57:20 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20180416095719eucas1p13fc38ada2e3029b899f5740ebbfc7b64~l4heRacUf2308523085eucas1p1i; Mon, 16 Apr 2018 09:57:19 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20180416095719eusmtrp2babf96d372236f3f0fd9fa3d6ebcb6f3~l4hdsERQn3178231782eusmtrp2M; Mon, 16 Apr 2018 09:57:19 +0000 (GMT) X-AuditID: cbfec7f2-5ffe19c000011644-bb-5ad47380c964 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id ED.6B.04178.F7374DA5; Mon, 16 Apr 2018 10:57:19 +0100 (BST) Received: from [106.120.43.17] (unknown [106.120.43.17]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20180416095717eusmtip20de56077e62a75919d43f3afe0093078~l4hcLU6Ru0703607036eusmtip2q; Mon, 16 Apr 2018 09:57:17 +0000 (GMT) Subject: Re: [PATCH v6 28/30] drm/rockchip: Disable PSR from reboot notifier To: Enric Balletbo i Serra , architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, ykk@rock-chips.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, linux-input@vger.kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org From: Andrzej Hajda Message-ID: Date: Mon, 16 Apr 2018 11:57:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180405095000.9756-29-enric.balletbo@collabora.com> Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0yTZxTH97zXlqzupQg9umXGGowaL9PM5GRzzF0+vNv8oJ9mmNnsxhsk pdW14lDnLN2UgtB1QBwUrSYwVghzFSoFvIDV2aG2gIATWIUgRgU7Fm4bLspo3yzj2++c/7n8 z5NHQauHucWKDONeyWTUZWq5OKbh2kxojcXcnfrK2aaNWBhqo9Bqi7AYrLrMYffUGIe1/X6C s0OjLJ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AA X-CMS-MailID: 20180416095719eucas1p13fc38ada2e3029b899f5740ebbfc7b64 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-MTR: 20180416095719eucas1p13fc38ada2e3029b899f5740ebbfc7b64 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180405095117epcas2p2093448b49aab2abd6684bf689f8888d5 X-RootMTR: 20180405095117epcas2p2093448b49aab2abd6684bf689f8888d5 References: <20180405095000.9756-1-enric.balletbo@collabora.com> <20180405095000.9756-29-enric.balletbo@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.04.2018 11:49, Enric Balletbo i Serra wrote: > From: Tomasz Figa > > It looks like the driver subsystem detaches devices from power domains > at shutdown without consent of the drivers. It looks bit strange. Could you elaborate more on it. Could you show the code performing the detach? Regards Andrzej > This means that we might have > our power domain turned off behind our back and the only way to avoid > problems is to stop doing any hardware programming at some point before > the power is cut. A reboot notifier, despite being a misnomer and > handling shutdowns as well, is a good place to do it. > Signed-off-by: Tomasz Figa > Signed-off-by: Thierry Escande > Signed-off-by: Enric Balletbo i Serra > Tested-by: Marek Szyprowski > --- > > drivers/gpu/drm/rockchip/rockchip_drm_psr.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > index e7e16d92d5a1..1bf5cba9a64d 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_psr.c > @@ -13,6 +13,7 @@ > */ > > #include > +#include > > #include > #include > @@ -33,6 +34,7 @@ struct psr_drv { > struct delayed_work flush_work; > struct work_struct disable_work; > > + struct notifier_block reboot_nb; > struct input_handler input_handler; > > int (*set)(struct drm_encoder *encoder, bool enable); > @@ -309,6 +311,24 @@ static const struct input_device_id psr_ids[] = { > { }, > }; > > +static int rockchip_drm_psr_reboot_notifier(struct notifier_block *nb, > + unsigned long action, void *data) > +{ > + struct psr_drv *psr = container_of(nb, struct psr_drv, reboot_nb); > + > + /* > + * It looks like the driver subsystem detaches devices from power > + * domains at shutdown without consent of the drivers. This means > + * that we might have our power domain turned off behind our back > + * and the only way to avoid problems is to stop doing any hardware > + * programming after this point, which is achieved by the unbalanced > + * call below. > + */ > + rockchip_drm_psr_inhibit_get(psr->encoder); > + > + return 0; > +} > + > /** > * rockchip_drm_psr_register - register encoder to psr driver > * @encoder: encoder that obtain the PSR function > @@ -361,6 +381,9 @@ int rockchip_drm_psr_register(struct drm_encoder *encoder, > if (error) > goto err1; > > + psr->reboot_nb.notifier_call = rockchip_drm_psr_reboot_notifier; > + register_reboot_notifier(&psr->reboot_nb); > + > mutex_lock(&drm_drv->psr_list_lock); > list_add_tail(&psr->list, &drm_drv->psr_list); > mutex_unlock(&drm_drv->psr_list_lock); > @@ -403,6 +426,7 @@ void rockchip_drm_psr_unregister(struct drm_encoder *encoder) > WARN_ON(psr->inhibit_count != 1); > > list_del(&psr->list); > + unregister_reboot_notifier(&psr->reboot_nb); > input_unregister_handler(&psr->input_handler); > kfree(psr->input_handler.name); > kfree(psr);