Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1128642ybi; Sun, 30 Jun 2019 08:03:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqySOjfBI6ELTzI4ToW598lUYRyswYj2KGaQxfkhCe7t0cI9HWh/ZiiNq2gPMguhi0ikmOIa X-Received: by 2002:a63:2249:: with SMTP id t9mr19752739pgm.149.1561907028207; Sun, 30 Jun 2019 08:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561907028; cv=none; d=google.com; s=arc-20160816; b=oX0yxV8HU0vDvlOyDJSZ+KErLWWgLZ4Z757eWAncIcYOtBy+BZOul5+C2wIhGsZJHD /2/qgSerOHKG194v1STieKH02n8bB09RNk5Nf1mztZvpU7+3B96qsb7i+DWkYNdATofe 63vPfo3gxUEO9uSgve4tSjCQY1eN71Y6wRxJfzL1NNyiWBlXkq2rOj3D486OC1/8TOMD 7yhnXSkjy9RERPlRh/kYixnMSXiXrM3LzrqDXa+Ir3himqttQn47E6H+9PdGEVmdRQTb dO9e4v6/nYMUhVyVmZFyQQjgRasQFJePhRn0sEtM+kcbWaqCu7EhEJ42WaSytpFIj6KK Y2RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QyVCRwDG/FzMILKy+0D6jsU2j8VALwyqKuHip6bg8Vc=; b=ZjNlgKOZKpflXF1bGNC+1RW4H+SWqCYDKA01lnZBjywTQmZqImNnPs7WpDluZTHw8L M/PlPzGkLh7N+WonxA4Lv+KXf3o0TxRyuHbbtyVOEmw4042Uw0Xz/vAKSF9UWuRbStFa SC0mNy9XtlZbySZse9Jm7gv6NZoOVqqHQoE12XFwJXmQ/4WdQq1WPxLnYaiGesdwbYkf ZNpUPDRfDPh03AZQXqeRrcCu+9qLg20KLKY8YVTfHUI9T4KFsMeA2NIIK5ux7vKZFMh9 jQ5TarxfrwfObfuE7aOQ2rnBzqZxdOmPGIslmnpZEIyQGdPU7YoZ/W6FxS2Pvd1i1QvK /Ewg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vKHUswvI; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a187si672914pge.269.2019.06.30.08.03.06; Sun, 30 Jun 2019 08:03:48 -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=@gmail.com header.s=20161025 header.b=vKHUswvI; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbfF3PCw (ORCPT + 99 others); Sun, 30 Jun 2019 11:02:52 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:33000 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfF3PCw (ORCPT ); Sun, 30 Jun 2019 11:02:52 -0400 Received: by mail-qt1-f193.google.com with SMTP id h24so8869876qto.0; Sun, 30 Jun 2019 08:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QyVCRwDG/FzMILKy+0D6jsU2j8VALwyqKuHip6bg8Vc=; b=vKHUswvI6acNk5JHHOslBw5H1xZCtlqz7wxsVgnwV8/xPkF38zAHVioXhSkIxmqf5l 3/zdZZkZhuWugtkYlNiUG3Au/C9JDLDtJ8jdod8Btp9V1fzI7hCmZH+JZ7XmHaKkUSNf gEzzQ9uzkp8bxXdWb7ZwVbK961QW0T7bLjX8flaFCBsxzfVFmIHTuN3AiMLpVHlp/1uP VGOhEEwHEjC26dn4y+JpfYkpmPQcpcoC24oe8Qeaf0ldO6+fqT3Y0PIARHlm2DJjLdZl iR81+tF5oAknkkjxVGcrUMij4KsH+fosAGbQDSnhP+Q+5QVkz7VrtzG0pEO0A+VP/Nzv QKKg== 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=QyVCRwDG/FzMILKy+0D6jsU2j8VALwyqKuHip6bg8Vc=; b=D0A/QFQY2XwVqIP4Kamck4OS7s6+YjlX90xXCqInkXyFzTs7GeuUxZnrB3m8p4Tx2H IjbXsVzp0haumu8xW+TV8onZQJqr8f2UCqc5zM/tY28nQ9QB6f/O7C40MFdUG6lFt2Eh jC0mGI82/sGC483YTkPkMXrckI2C6LmdrP/gQLO0fvU9/+JG8M68P9/jlNngByFTI3jG r91AM2yLgsXJbhHwA/bda1AHVng5dBwMoiUHd4ud1hDot2UHyr6sgJk7xclH3NnOV4iy 8nauMiuY8n7BUu96HXmd6ER6SfiRO3C0ASnhiQojzU7B5W+SE1M4GRTrXtGs1/CsT4ET 2Jxg== X-Gm-Message-State: APjAAAVqoVXIS72YMYbI/SqfQ90/ftr+S/beKhLKQX2EGi/XxnO3PgLO 0LErIyjx3L9B7z4/2bbKHEc= X-Received: by 2002:ac8:3811:: with SMTP id q17mr15849886qtb.315.1561906970879; Sun, 30 Jun 2019 08:02:50 -0700 (PDT) Received: from localhost ([2601:184:4780:7861:5010:5849:d76d:b714]) by smtp.gmail.com with ESMTPSA id q36sm4115062qtc.12.2019.06.30.08.02.50 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 30 Jun 2019 08:02:50 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org, aarch64-laptops@lists.linaro.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, Rob Clark , "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Greg Kroah-Hartman , Andy Gross , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] genpd/gdsc: inherit display powerdomain from bootloader Date: Sun, 30 Jun 2019 08:01:40 -0700 Message-Id: <20190630150230.7878-3-robdclark@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190630150230.7878-1-robdclark@gmail.com> References: <20190630150230.7878-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Mark power domains that may be enabled by bootloader, and which should not be disabled until a driver takes them over. This keeps efifb alive until the real driver can be probed. In a distro kernel, the driver will most likely built as a module, and not probed until we get to userspace (after late_initcall) Signed-off-by: Rob Clark --- drivers/base/power/domain.c | 10 ++++++++++ drivers/clk/qcom/dispcc-sdm845.c | 2 +- drivers/clk/qcom/gdsc.c | 5 +++++ drivers/clk/qcom/gdsc.h | 1 + include/linux/pm_domain.h | 4 ++++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 33c30c1e6a30..513a8655fbd7 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -537,6 +537,16 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, not_suspended++; } + /* + * If the power domain is enabled by the bootloader (for example + * display enabled by bootloader), but no devices attached yet + * (perhaps because driver built as kernel module), then do not + * suspend. + */ + if ((genpd->flags & GENPD_FLAG_INHERIT_BL) && + list_empty(&genpd->dev_list)) + not_suspended++; + if (not_suspended > 1 || (not_suspended == 1 && !one_dev_on)) return -EBUSY; diff --git a/drivers/clk/qcom/dispcc-sdm845.c b/drivers/clk/qcom/dispcc-sdm845.c index 40d7e0ab4340..1d9365ac2315 100644 --- a/drivers/clk/qcom/dispcc-sdm845.c +++ b/drivers/clk/qcom/dispcc-sdm845.c @@ -575,7 +575,7 @@ static struct gdsc mdss_gdsc = { .name = "mdss_gdsc", }, .pwrsts = PWRSTS_OFF_ON, - .flags = HW_CTRL | POLL_CFG_GDSCR, + .flags = HW_CTRL | POLL_CFG_GDSCR | INHERIT_BL, }; static struct clk_regmap *disp_cc_sdm845_clocks[] = { diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index a250f59708d8..4639fbeb9a7f 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -331,6 +331,11 @@ static int gdsc_init(struct gdsc *sc) if ((sc->flags & VOTABLE) && on) gdsc_enable(&sc->pd); + if ((sc->flags & INHERIT_BL) && on) { + pr_debug("gdsc: %s is enabled from bootloader!\n", sc->pd.name); + sc->pd.flags |= GENPD_FLAG_INHERIT_BL; + } + /* If ALWAYS_ON GDSCs are not ON, turn them ON */ if (sc->flags & ALWAYS_ON) { if (!on) diff --git a/drivers/clk/qcom/gdsc.h b/drivers/clk/qcom/gdsc.h index 64cdc8cf0d4d..c6fe56247399 100644 --- a/drivers/clk/qcom/gdsc.h +++ b/drivers/clk/qcom/gdsc.h @@ -49,6 +49,7 @@ struct gdsc { #define AON_RESET BIT(4) #define POLL_CFG_GDSCR BIT(5) #define ALWAYS_ON BIT(6) +#define INHERIT_BL BIT(7) struct reset_controller_dev *rcdev; unsigned int *resets; unsigned int reset_count; diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 91d9bf497071..5e421afcf6f3 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -55,6 +55,9 @@ * * GENPD_FLAG_RPM_ALWAYS_ON: Instructs genpd to always keep the PM domain * powered on except for system suspend. + * + * GENPD_FLAG_INHERIT_BL: The bootloader has already enabled this power + * domain. */ #define GENPD_FLAG_PM_CLK (1U << 0) #define GENPD_FLAG_IRQ_SAFE (1U << 1) @@ -62,6 +65,7 @@ #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3) #define GENPD_FLAG_CPU_DOMAIN (1U << 4) #define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5) +#define GENPD_FLAG_INHERIT_BL (1U << 6) enum gpd_status { GPD_STATE_ACTIVE = 0, /* PM domain is active */ -- 2.20.1