From patchwork Mon Oct 28 10:25:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13853261 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 328251C3F27 for ; Mon, 28 Oct 2024 10:26:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111176; cv=none; b=NaeQpnGR9p3T2x1Zv0Xkb0XsZaEGthTlExuwmyV92VEeINcP5JIwHEPT9x4JYREkvvg1C0yL0+LLkVWoViI3cR14qRnac2nkXpljkjWzKhuB7bPcHaYbGyXocaNsJUj4MWSfI792qk90hebwOhjMTD4x7aPIK51InXwbahE0Ie8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111176; c=relaxed/simple; bh=R93VMLohkk+JmS520PXpYqfQBg15NGWIzpjAwA+J2Kw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iEBsixPFeMSuUXT9DhfiUl1gL7Xs5ECtJCtQv1Sr2/izfEB8LwFETPYpU8+4r53RUBwrfD5Vzz3Vqkq7vhKcCCkYPmh0JtJgy9lIo7iNr0hKUxKlwIQ5a7w1DihEZCxrRIF6r4Fnb5aM9CWqih4iOAmDlEtaSSbKR8hpOOHP9co= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=IGywNBIA; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="IGywNBIA" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-539e690479cso3921169e87.3 for ; Mon, 28 Oct 2024 03:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730111171; x=1730715971; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vYexXqsopB/TorltyWtW3DQvmZVEoLO13n0GfiFkuag=; b=IGywNBIA22VBL1i1W4pgL4EBT5pFbE3OKpYb7O0MjmO6yvZZPFse+6EhVzj5Z7+6O0 THaLMOs975lgEsZQrXLrP5EsoD21F/U9FCmn3wzhQV4/AJQHoYjTIpRSOaX0w07XTGMM VWBaRGrog2mfeYuqlcrYSvD3PwK2/s7RvNjjk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730111171; x=1730715971; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vYexXqsopB/TorltyWtW3DQvmZVEoLO13n0GfiFkuag=; b=oOF6hCPHusPg0KdhBKv9IDgUqSdcm5dW/VvA0QnDUR/UI3EKV27SGyMPYwk//QMcIs w2RvFW3txwj80XHPVfDAnnxrncxzBetzgO+h8gevZ4gsR7Ebkqo1hTrnJaEfHNH2x9i7 RDThdZZD9sln8V1Yij4ovpb105s5JHWr8xSFlUz47EN8B116x9KLhZ6j7A1qYmIU3drf b7CgCyLSnktIZ2vbErU7xwWAEbpThEaVBN5mmeJmOdTEjndB/nYwfAoehwNmRlwe2Zxn 5zUB/11d855OsPH3RXCCa2nxU8rH2JKhKoIvV9qlPXNRNumFuOZSOs0uDwv1i/SmXuDE QMeA== X-Forwarded-Encrypted: i=1; AJvYcCUcISTYk0UUdVtwdoVj7ol06JUiXbFumsHbPPnWWdDyrFQ3UrJ5UJX/hG566UX0Z9a/Sa4=@lists.linux.dev X-Gm-Message-State: AOJu0YyhIVJrcejlJHOlJZV2OoAaDiJH1V4cUJznK/i8O4obEFtyaA7k P7kwb2SekwwhVyCWEpxhfNXtCoKsoc6Uf831Z43oQHPFWk8Tjf0GA3YdX7na++U= X-Google-Smtp-Source: AGHT+IFPiWSMUJsvLDsFUQKEPXeJtOq9dyzWbF9cm4SlPeUZQ8cIi4gauJvX3gywzP7yEJIBk1InHA== X-Received: by 2002:ac2:4c46:0:b0:535:82eb:21d1 with SMTP id 2adb3069b0e04-53b34a3516cmr2517575e87.57.1730111171159; Mon, 28 Oct 2024 03:26:11 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.121]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297b04sm363613966b.134.2024.10.28.03.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 03:26:10 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Conor Dooley , Fabio Estevam , Krzysztof Kozlowski , Lucas Stach , Pengutronix Kernel Team , Rob Herring , Sascha Hauer , Shawn Guo , devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 01/10] dt-bindings: soc: imx-blk-ctrl: add 'fsl,power-domains-boot-on' property Date: Mon, 28 Oct 2024 11:25:24 +0100 Message-ID: <20241028102559.1451383-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> References: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This property lists the state of the power domains, indicating whether they have been left on or off by the bootloader/firmware. This information becomes relevant, for example, in the case of supporting the simple framebuffer. Signed-off-by: Dario Binacchi --- .../bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml index eeec9965b091..00aa0b8d8ea9 100644 --- a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml +++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mn-disp-blk-ctrl.yaml @@ -56,6 +56,15 @@ properties: - const: csi-aclk - const: csi-pclk + fsl,power-domains-boot-on: + description: | + Provide the on/off (1/0) status of the power domains. It allows + specifying whether one or more power domains have already been + initialized and left powered on by the bootloader. + $ref: /schemas/types.yaml#/definitions/uint32-array + minItems: 5 + maxItems: 5 + required: - compatible - reg From patchwork Mon Oct 28 10:25:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13853262 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83E061D2F6F for ; Mon, 28 Oct 2024 10:26:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111176; cv=none; b=bvnqqOjqQvF7n023p12mXhnyZlhnant+N1PxVPBe510ooYFs1TGBM7LzBjM02E/GAqgjk2tQYwADo4MVLLWdTxVNX6u3EN361btSUKrENYWPp1pJ9KUE2Egn1R3kYeXDi0IJHVETh8mSDiRRRAGLlisDDzhmSlJJsLw3F+W/Ib8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111176; c=relaxed/simple; bh=jOASmNrBy0k5ebd7B11buXOeSSx1yKz2tcuTybTDs10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G9imn61bTKafvr3OKaD0lKl3mGxSjepWFgfE9TFsVCJpY4B4kgnT94/f2KAFKHC/VKroJRYtLXOOhEcRNw2KerVao3TO2BMET8p1da3Bkbp3OXng7Qz0e+4+Ms5VWl9ItShERVmowsTj4v1XeI5SI8Ot6TIcV70/MiwOO+5ss7s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=lRFpyRhs; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="lRFpyRhs" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5c94c4ad9d8so5185545a12.2 for ; Mon, 28 Oct 2024 03:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730111173; x=1730715973; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ErPoXh63XrcFWpHe9zG8v9aPuGfFzlqWX+d+j6TRc4A=; b=lRFpyRhsxlC+ww3RusF5gdmgIi1fHSoGgvkx2Ju4kv9oI1+h0xfff0amfcJBXtI/Ry 8BkIgMNGgKEz7emPEE09WddGfogQUtfN59MKkBH1Ufc/PDiNdCkqwK3qX+BBqVcNlahK q5F2Ac4vnKxoP0+zYdN4ZZaulnZI+W9Ifr/Pk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730111173; x=1730715973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ErPoXh63XrcFWpHe9zG8v9aPuGfFzlqWX+d+j6TRc4A=; b=MDZ9QVrbt05X8AQGJ/BK4g8Yo1haaYa0sWnLzpGQUllgaEpssRSkDydBkNEl/SH1bf 9ACVY5rQWypC1FWcBDJuUhRS6WHGVIizvTZt9+zY7bI9PAX0w/TOjs8MIl9zsDGlv9Xx EoJFNV9Oi0zEr18hdkLO8FCNkZnaOAl3QO8mepAFIEh/iFL67ymYzBqbUyBzRXfL2FT/ 0SV6h/IBqbUpDXq/6UabPfRpNmQ8FuN97o5Kb+EvKjIYW2d8dNpMeNqT87wg75Vqu9Ju JJM1Wul/7C6ywezhdmphT9jMkO67bdI+8EFaQnateoP044/kLkvIWbHiq5aGKYgeoiqR wobQ== X-Forwarded-Encrypted: i=1; AJvYcCUlqWL4kyj2xdtl+h15yz1mqjAw+nwRvOm7hGa5xNWdQeyYZXG0WEIJ08bavHk/Ntql2Ic=@lists.linux.dev X-Gm-Message-State: AOJu0YzRPdcLWQr1efyqWGAci8m/FNLRZSz/M6aL/YcK1qTMz7ULl7qM fBD4S+hmO1En2dxmp3mvD0NWOLBsplOLJbE2Z45bW9ENTDecIl/7EZ2+l1Jjd0o= X-Google-Smtp-Source: AGHT+IGCR28JnEaozP81Xbh2KLif47qmv9KNL7NMIxup/Qx2H3ia0ChVJ6kRCnNRLDGwqzzr1QgmvA== X-Received: by 2002:a17:907:9712:b0:a9a:2afc:e4d7 with SMTP id a640c23a62f3a-a9de619d18bmr803160866b.44.1730111172695; Mon, 28 Oct 2024 03:26:12 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.121]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297b04sm363613966b.134.2024.10.28.03.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 03:26:12 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Michael Trimarchi , Fabio Estevam , Marek Vasut , Peng Fan , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Ulf Hansson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [RFC PATCH 02/10] pmdomain: imx8m-blk-ctrl: don't turn on a power domain already on Date: Mon, 28 Oct 2024 11:25:25 +0100 Message-ID: <20241028102559.1451383-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> References: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The patch, by informing pm_genpd_init() with the "is_off" parameter that the power domain is already on, prevents the power_on() callback from being called, thus avoiding the unnecessary repetition of the hardware power-on procedure. This feature is crucial when supporting the simple framebuffer, as the power domains have already been initialized by the bootloader. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/pmdomain/imx/imx8m-blk-ctrl.c | 51 ++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/pmdomain/imx/imx8m-blk-ctrl.c b/drivers/pmdomain/imx/imx8m-blk-ctrl.c index ca942d7929c2..8dc1508571dd 100644 --- a/drivers/pmdomain/imx/imx8m-blk-ctrl.c +++ b/drivers/pmdomain/imx/imx8m-blk-ctrl.c @@ -166,6 +166,24 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd) static struct lock_class_key blk_ctrl_genpd_lock_class; +static bool imx8m_blk_ctrl_is_off(struct device *dev, struct generic_pm_domain *genpd) +{ + struct device_node *node = dev->of_node; + struct imx8m_blk_ctrl_domain *domain = to_imx8m_blk_ctrl_domain(genpd); + const struct imx8m_blk_ctrl_domain_data *data = domain->data; + u32 boot_on; + int index; + + index = of_property_match_string(node, "power-domain-names", + data->gpc_name); + if (index < 0 || of_property_read_u32_index(node, + "fsl,power-domains-boot-on", + index, &boot_on)) + return true; + + return !boot_on; +} + static int imx8m_blk_ctrl_probe(struct platform_device *pdev) { const struct imx8m_blk_ctrl_data *bc_data; @@ -173,6 +191,8 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) struct imx8m_blk_ctrl *bc; void __iomem *base; int i, ret; + bool init_off; + bool *pm_runtime_cleanup; struct regmap_config regmap_config = { .reg_bits = 32, @@ -221,6 +241,11 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) "failed to attach power domain \"bus\"\n"); } + pm_runtime_cleanup = devm_kcalloc(dev, bc_data->num_domains, + sizeof(*pm_runtime_cleanup), GFP_KERNEL); + if (!pm_runtime_cleanup) + return -ENOMEM; + for (i = 0; i < bc_data->num_domains; i++) { const struct imx8m_blk_ctrl_domain_data *data = &bc_data->domains[i]; struct imx8m_blk_ctrl_domain *domain = &bc->domains[i]; @@ -274,7 +299,8 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) domain->genpd.power_off = imx8m_blk_ctrl_power_off; domain->bc = bc; - ret = pm_genpd_init(&domain->genpd, NULL, true); + init_off = imx8m_blk_ctrl_is_off(dev, &domain->genpd); + ret = pm_genpd_init(&domain->genpd, NULL, init_off); if (ret) { dev_err_probe(dev, ret, "failed to init power domain \"%s\"\n", @@ -283,6 +309,24 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) goto cleanup_pds; } + if (!init_off) { + ret = pm_runtime_get_sync(bc->bus_power_dev); + if (ret < 0) { + pm_runtime_put_noidle(bc->bus_power_dev); + dev_err_probe(dev, ret, "failed to power up bus domain\n"); + goto cleanup_pds; + } + + ret = pm_runtime_get_sync(domain->power_dev); + if (ret < 0) { + pm_runtime_put(bc->bus_power_dev); + dev_err_probe(dev, ret, "failed to power up peripheral domain\n"); + goto cleanup_pds; + } + + pm_runtime_cleanup[i] = true; + } + /* * We use runtime PM to trigger power on/off of the upstream GPC * domain, as a strict hierarchical parent/child power domain @@ -324,6 +368,11 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) of_genpd_del_provider(dev->of_node); cleanup_pds: for (i--; i >= 0; i--) { + if (pm_runtime_cleanup[i]) { + pm_runtime_put(bc->domains[i].power_dev); + pm_runtime_put(bc->bus_power_dev); + } + pm_genpd_remove(&bc->domains[i].genpd); dev_pm_domain_detach(bc->domains[i].power_dev, true); } From patchwork Mon Oct 28 10:25:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13853263 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3A4E1D5171 for ; Mon, 28 Oct 2024 10:26:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111177; cv=none; b=kmAz2CswkGe33Fc7Wj92SZlqeAxajJ7R7YonzgLQVOoMq/CkT16WcgixuWMDDw2IwxRTgRmVTcxkudkOLwt0PpZnpqtS6ywd97xhUAsj/c6vihXJ94AuW9N/69SgEgO7hO3dwJUS34vkMj51uLxQDF/bPhCtNVnnZkpf6Lv8PKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111177; c=relaxed/simple; bh=3RJbrpbC6Nxmr4CObGvh2EeJe3fwMHBQ3Iide/lIGUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BcRrJHaySXi7h0lihJrh0NXc2bfqf28zsMKrYLZsF42CPmk5dJ5FxzOOkWO8dw9+6HMBdd6wMTucw9oEoAu0u6Enr6U9LjY9hbZqRb1q/PFD4Q7816GWkneM8i+z7oKTEkupZ9oC8MbWfiV2WBiheGQxVP2o1hcEef8Lx8QdQdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=Pg4VU/Sq; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="Pg4VU/Sq" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a9a3dc089d8so614057566b.3 for ; Mon, 28 Oct 2024 03:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730111174; x=1730715974; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3kjaoDHO/Cxmm9XfSkRfXuiq2XlHBj2nIJAqnJTFngw=; b=Pg4VU/Sq4JRFliH6vLhaWFcDlWWhpEbTbnbFK2d/SrKuosHhTiu7NCAU7V0qNN1cm/ iaSIBlgzH2B5GNZgkZgemTPom9I2nDHlteR2/PqDBJrMZUJZTp+HKnRhTwfd7eZ53UfE KSvEIBR4p90r/sPdUTFEefwYRuetjwFYl2D/U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730111174; x=1730715974; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3kjaoDHO/Cxmm9XfSkRfXuiq2XlHBj2nIJAqnJTFngw=; b=hBNqrSehxGyO9e9hOFmJhiuDhDNU/hrTBzCou7tBRlyx29occspZkrEyLj9LERh1Ok ZhYvV1arSWl09b9/ed4PHrgyNsjqJHCwb2Yh3sJtJv1XxYO+8WKCULGzpyFu28umJNGW unK4oq8AAzXomdR3Gb3V8z1AWXWi2l3hoNuKYyLWifgRltciCoTUnxQRHFpea4853SBP MMVUqVnGbZlTZATkFjjBrTgoMBqXnHlTqdnUCSAtXtTdt3W135kesQ6t102U0Vp4iZj9 FRefRo1WSIewfsFIdpw/Vg7yxCMU+J94+JRPKuwwtq+SGBdbr1XNJnyb3w/CqXCFOGSq p2iA== X-Forwarded-Encrypted: i=1; AJvYcCUW3OBHyod/65kMeHSnILalhBoKSxhFpr6wUtZ3zlg5EkQf1T+SUOR0hI2fW6hD/Eek7DQ=@lists.linux.dev X-Gm-Message-State: AOJu0YyffF7/K2e+Low3KswSJakptKwvIBhEgN/H7AHv24uoLjAPs9qK dMfv8eX7VEdlSmQAPzMk9GZtN7ftqdOc6oEjowcZl1SqH0ERlwv+mIZKhaSr9h8= X-Google-Smtp-Source: AGHT+IEYNCvHyI4Ub76KdqemIzRCqERBXA/yyqTx2llDK0lvcsPc5x2y/hbBEKlGhDYQLy/s0WjfIA== X-Received: by 2002:a17:907:9721:b0:a99:89bd:d84a with SMTP id a640c23a62f3a-a9de5ee107dmr668398566b.25.1730111174240; Mon, 28 Oct 2024 03:26:14 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.121]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297b04sm363613966b.134.2024.10.28.03.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 03:26:13 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Andrey Smirnov , Conor Dooley , Fabio Estevam , Krzysztof Kozlowski , Pengutronix Kernel Team , Rob Herring , Sascha Hauer , Shawn Guo , devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 03/10] dt-bindings: power: gpcv2: add 'fsl,boot-on' property Date: Mon, 28 Oct 2024 11:25:26 +0100 Message-ID: <20241028102559.1451383-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> References: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The property states that the power-domain has been initialized and left on by the bootloader/firmware. This information becomes relevant, for example, in the case of supporting the simple framebuffer. Signed-off-by: Dario Binacchi --- Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml b/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml index dfdb8dfb6b65..718196f516ad 100644 --- a/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml +++ b/Documentation/devicetree/bindings/power/fsl,imx-gpcv2.yaml @@ -94,6 +94,12 @@ properties: minItems: 1 maxItems: 4 + fsl,boot-on: + description: | + The power-domain has been initialized and left on by the + bootloader/firmware. + type: boolean + required: - '#power-domain-cells' - reg From patchwork Mon Oct 28 10:25:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13853264 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D63B1D6194 for ; Mon, 28 Oct 2024 10:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111182; cv=none; b=jJHoLZ7XU+oHOv0G9I54WW6g9vRAljs7SzZ/ec9o+tupszd+NkNVAuvRS5d7NuPLKguVAMCtquztUgIwWFQSC+btwu/mCMeL/Byz3PDuAlOI7/Xcj9cfVxYuyHQfWbjNQAx5sRkVuqpA+lkvITTsjmihZeEQo8AvyTR3nj1HOS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111182; c=relaxed/simple; bh=js8gtoeOZlGeLq8295+lq+IHMiMRiPiXT/e6W18eRR8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qqIU6cRE1cFj/6CfnGLmC/G1oEfQZmK8QDJZiUpHk52G+L7RCrw5cevEaUZRoSl7mseqgG270bSkMx9w+5E8bmnpuzSXT7NdTIrPpSLjzRr8a2mmXMKbgwxXO6/SXSwl6COy5eBo+9abv3NWKlF2nGOtzjKC/2NqxY+87EfitIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=nhXk9vEx; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="nhXk9vEx" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5c96b2a10e1so6471920a12.2 for ; Mon, 28 Oct 2024 03:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730111176; x=1730715976; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3tF2Wj+vRMtC983z9w7XL42BV51oFEPPNHEhybEVd+Q=; b=nhXk9vExE5Bd4kqp8KgLjQ4kTd8FKv5YvF4DXMHVw8Q0gUZvXIMRef4HhLXYdHBVV7 Ymk3W0X/Pj+707myzw6Yn+VWgdYgATGzDYLAbMCUdNjiijl2sgIlcFq2d6bHwMwNQEGw 3Z3lNMMp/D/PElSp8MY1w2YM6DaMxCOI6DSEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730111176; x=1730715976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3tF2Wj+vRMtC983z9w7XL42BV51oFEPPNHEhybEVd+Q=; b=PUFrB3MjXRLwPWmVULLDFvV86JD8CO9HZFOMzEFr35eCzSrFIut/nAF9Csr3EaTUdJ BeTN4IcyI39x4fDTkxGQr8FeAZCqLBoWjcGsSR0HCdkmABj40gbbm4WV1MVIQraDh+HV QFfwMFgtnlVNH55LfKzYpgvAUU+HC2DIsjP4d0WKjnw0lCn0vcR0O07kE70KBrEbk4FW dBl72TVZ/itPIjeIajqMRqo0wOQ6xXiMU1Youqen6xOXiv4gB76vTNVBbIHw0JLAe0Ya qiKMeYCmWHgK5FYe3Bj8q4ZCIAibPncjsy+sKSqyzm9jemkC9kNntMqH180jhl5fn2Tg 2rCw== X-Forwarded-Encrypted: i=1; AJvYcCUxKPeJtMn3UJOFOK5z5CPR/iumbua5OhEiLeWAad4HavSH0PRslkFGV9D+CB6wQBbMabU=@lists.linux.dev X-Gm-Message-State: AOJu0YwJuRJ7BMJO5H2DLuTsbPVKvCgpokZwmmplphzROiITE1gDRN+q FdxRfeSzp+hjrw6B7hSo4tB1RTu5P2OLRX4Bg/JH2uzGXqkKFgWag+QVcYNT8GM= X-Google-Smtp-Source: AGHT+IFdXb6XtLDCZdRMrvkyA0aKsne7r7Yx41P1F2c1jET9YdgAPGWx1KeM7QlZRwkreW9voNIysQ== X-Received: by 2002:a17:907:1c22:b0:a99:f1aa:a71f with SMTP id a640c23a62f3a-a9de5c90d49mr793546866b.11.1730111175841; Mon, 28 Oct 2024 03:26:15 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.121]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297b04sm363613966b.134.2024.10.28.03.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 03:26:15 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Michael Trimarchi , Fabio Estevam , Krzysztof Kozlowski , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Shengjiu Wang , Ulf Hansson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [RFC PATCH 04/10] pmdomain: imx: gpcv2: don't turn on a power domain already on Date: Mon, 28 Oct 2024 11:25:27 +0100 Message-ID: <20241028102559.1451383-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> References: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The patch, by informing pm_genpd_init() with the "is_off" parameter that the power domain is already on, prevents the power_on() callback from being called, thus avoiding the unnecessary repetition of the hardware power-on procedure. This feature is crucial when supporting the simple framebuffer, as the power domains have already been initialized by the bootloader. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/pmdomain/imx/gpcv2.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c index 963d61c5af6d..bf9fe4af03c5 100644 --- a/drivers/pmdomain/imx/gpcv2.c +++ b/drivers/pmdomain/imx/gpcv2.c @@ -1324,6 +1324,7 @@ static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = { static int imx_pgc_domain_probe(struct platform_device *pdev) { struct imx_pgc_domain *domain = pdev->dev.platform_data; + bool init_off; int ret; domain->dev = &pdev->dev; @@ -1354,12 +1355,33 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) regmap_update_bits(domain->regmap, domain->regs->map, domain->bits.map, domain->bits.map); - ret = pm_genpd_init(&domain->genpd, NULL, true); + init_off = !of_property_read_bool(domain->dev->of_node, + "fsl,boot-on"); + ret = pm_genpd_init(&domain->genpd, NULL, init_off); if (ret) { dev_err(domain->dev, "Failed to init power domain\n"); goto out_domain_unmap; } + if (!init_off) { + ret = pm_runtime_get_sync(domain->dev); + if (ret < 0) { + pm_runtime_put_noidle(domain->dev); + dev_err_probe(domain->dev, ret, "failed to power up bus domain\n"); + goto out_genpd_remove; + } + + if (domain->keep_clocks) { + ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); + if (ret) { + dev_err_probe(domain->dev, ret, + "failed to enable clocks for domain: %s\n", + domain->genpd.name); + goto out_pm_put; + } + } + } + if (IS_ENABLED(CONFIG_LOCKDEP) && of_property_read_bool(domain->dev->of_node, "power-domains")) lockdep_set_subclass(&domain->genpd.mlock, 1); @@ -1368,11 +1390,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) &domain->genpd); if (ret) { dev_err(domain->dev, "Failed to add genpd provider\n"); - goto out_genpd_remove; + goto out_clk_unprepare; } return 0; +out_clk_unprepare: + if (!init_off && domain->keep_clocks) + clk_bulk_disable_unprepare(domain->num_clks, domain->clks); +out_pm_put: + if (!init_off) + pm_runtime_put(domain->dev); out_genpd_remove: pm_genpd_remove(&domain->genpd); out_domain_unmap: From patchwork Mon Oct 28 10:25:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13853265 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 798C31D47A6 for ; Mon, 28 Oct 2024 10:26:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111189; cv=none; b=k6NbvY+VHpdA3BlXKWCodEPwibqDTEAF1LyMzM95Y7Nd1AHIR1v+dEClYO6pkwCDfflug+t8ou1o3sBzKYzcTM5EHtqOiT8BE1odlLG6byBhvbNep3MhT4+18VpKzoQVG1EWT/uJN39cQWMILv4FysadHSKAYa6tYm7CGtAlsxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730111189; c=relaxed/simple; bh=SGAmR4rTXOAGzH5qe9m5L7xwcpV493faJv+dbyO/XxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lYTAWrADl2sYMKxVCIOG34BRaSKh4U+nFe+3WXR7Xy2DY+MQ8bQQ2bDkaNdq0UxgI06QMGhAEBSE7mftpLWbZp2WAwGx25jxF/DYQSyrMt5gEQygbcRMeF2s7UaYxKGBFtcVsrUJyuZYXAnJ3aZ+m5BNJKuWYlkXvikUY2TgImA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com; spf=pass smtp.mailfrom=amarulasolutions.com; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b=Qcei7ty6; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amarulasolutions.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="Qcei7ty6" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5cb6b2b7127so4792818a12.1 for ; Mon, 28 Oct 2024 03:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730111186; x=1730715986; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aIDm7KBT1s0AbOc3yV3TQ9ohvs8sUqIvua5HhBI5V8A=; b=Qcei7ty6vkXVn/YfZ5w2dutRiaqnouGtFzOyk7rFO+MV81mocL2qe8L4T/srxAuRam tjW19vFx7OknJ98kkHG/liWkj65yaM50J2xzIBzhoVopCLMpHinGi8H4ioAgiO3NX3kv 3SZTeICp6wuo7I742KcMrFlF5NcfO0fneMFRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730111186; x=1730715986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aIDm7KBT1s0AbOc3yV3TQ9ohvs8sUqIvua5HhBI5V8A=; b=b7XR33szOhiE6u+VpdCrWEZvQBsZO8hSKixUy6nVrmQ0nN0l2waa+W4MZxFhplYF+2 wzECWRXjFRCkYeO+u0SPB4VOIm48pgC4SbB/tuv+Wd3jD4djlUkHcKm9Ngv1jtv+Y+Up YPtpn98Qlyalv68bH3BIk1AcUkpWT4jNWSuLDvPlGO8KRUdceJ+mlODsdc4MhIkkgs8y 6BwRBHoSPAGCKn2PmohA9pI7lHysFaH8L4f/jS0p6tv0i3MYQKK6Rd6WeaVO+bDnNVZl HdJ1tcGsoNSZ1XKOhN9wPioiTd7GXffuO7t34MwZKwGURBf0TVqCcii9+crygIsbyNse PMNg== X-Forwarded-Encrypted: i=1; AJvYcCW7U0m95YjBwC90B0mLwsluJlULH6uGfVnvN6qOSbs6hhc0MMq7HVqv4xOCeta7IKU5JtU=@lists.linux.dev X-Gm-Message-State: AOJu0YwUza/6IRHZ3uAhXT5aG9wwoXOHc49e1lQ9XrHyW8KHUFwdtW1x NcEA2jhVzODmdluSAajyWQa1/HBt5H4hbk/m0OvBWQl8cVIOjBEb7U2YryubmS0= X-Google-Smtp-Source: AGHT+IEA5nCg2j7DVomJoAqNLW+z2Nbv9V6XM3cl17RychbK0FRUPkeqVCDGC4TH9y5e5TfNamZx8g== X-Received: by 2002:a17:906:da8a:b0:a99:425c:c653 with SMTP id a640c23a62f3a-a9de5ce24f6mr866426966b.22.1730111185881; Mon, 28 Oct 2024 03:26:25 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.121]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297b04sm363613966b.134.2024.10.28.03.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 03:26:25 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , David Airlie , Fabio Estevam , Maarten Lankhorst , Marek Vasut , Maxime Ripard , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Simona Vetter , Stefan Agner , Thomas Zimmermann , dri-devel@lists.freedesktop.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 10/10] drm/mxsfb: stop controller and drain FIFOs if already initialized Date: Mon, 28 Oct 2024 11:25:33 +0100 Message-ID: <20241028102559.1451383-11-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> References: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 You can't re-program the controller if it is still running. This may lead to shifted pictures, so stop the controller and drain its FIFOs in case it's already properly setup. This patch is crucial when supporting the simple framebuffer, as the controller has already been initialized by the bootloader. Signed-off-by: Dario Binacchi --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 +++ drivers/gpu/drm/mxsfb/mxsfb_drv.h | 1 + drivers/gpu/drm/mxsfb/mxsfb_kms.c | 14 +++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index cb5ce4e81fc7..38c94cdc8f6c 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -221,6 +222,8 @@ static int mxsfb_load(struct drm_device *drm, if (!mxsfb) return -ENOMEM; + mxsfb->enabled = + of_property_read_bool(drm->dev->of_node, "fsl,boot-on"); mxsfb->drm = drm; drm->dev_private = mxsfb; mxsfb->devdata = devdata; diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h index d160d921b25f..0f9ae4ce450c 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h @@ -47,6 +47,7 @@ struct mxsfb_drm_private { struct drm_bridge *bridge; bool crc_active; + bool enabled; }; static inline struct mxsfb_drm_private * diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c index 7ed2516b6de0..d064a2bb65df 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c @@ -202,9 +202,11 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb) writel(reg, mxsfb->base + LCDC_CTRL1); writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET); + + mxsfb->enabled = true; } -static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) +static void _mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) { u32 reg; @@ -221,6 +223,13 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) reg &= ~VDCTRL4_SYNC_SIGNALS_ON; writel(reg, mxsfb->base + LCDC_VDCTRL4); + mxsfb->enabled = false; +} + +static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) +{ + _mxsfb_disable_controller(mxsfb); + clk_disable_unprepare(mxsfb->clk); if (mxsfb->clk_disp_axi) clk_disable_unprepare(mxsfb->clk_disp_axi); @@ -354,6 +363,9 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, u32 bus_format = 0; dma_addr_t dma_addr; + if (mxsfb->enabled) + _mxsfb_disable_controller(mxsfb); + pm_runtime_get_sync(drm->dev); mxsfb_enable_axi_clk(mxsfb);