Message ID | 20240123-thermal-sun8i-registration-v3-1-3e5771b1bbdd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-36190-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp666204dyi; Tue, 23 Jan 2024 15:34:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGu9nDDdy7jI+QsgCzhS3xCQBQxd86iT7ZC7GSNQQOl1JA4UwvP+4yYLrq8r/jf6vGCz+Oc X-Received: by 2002:a17:902:dac7:b0:1d5:be4d:1afb with SMTP id q7-20020a170902dac700b001d5be4d1afbmr420160plx.14.1706052873280; Tue, 23 Jan 2024 15:34:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706052873; cv=pass; d=google.com; s=arc-20160816; b=WSHKTZnOAftujYcBi3bDeV6oq/W9EaNI6vyAo4V27upLuhfb99kxb/cVG+ahTYE2Hw mNKZEHxD9tGn+4W2MEhgKokG+a/vbFU6L/BqewYsMYQcEJannP2uO84xxkh7wq+qmisv GGf0ZemXPKfH2g4BnMfEyiEl1AEAwyJfCNcKPXWG0iLnahhfQ0xOEEZMktODc7eMlhUb UU1q/d4h7rXG8uqQrO5d5j5Ii8RSs0SP8m+Rn9Q0XR2vUJ7pR/SPB72Uo/1Y+GAo5bcR qts5a/wv8Dxk2cNUYH+Lj33yk3VCpT677owWfoRnUFvJYTEZPvIihDzSo52npeuOCW7n Lv9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=34An0v/gj+GCLX99NcoM5hLAwxPA/hpNBVa7HPHFc3U=; fh=oOosinzDEh7N/KlGq9vEP1Y7VTEbfpzblPMPvSPTEpg=; b=dAJiN6xJew1mk+65C5HGk8pGjFiw9fdl4HbADWeXPDcRzAyiNKZMRWFm+nu7F/zwKP wmrL8Uv3DwctmTh3s2cShru7AQZh3I+kvCy9+yptYciItdi5ZGnQy1u/LEQz4tdOW3R7 z4xvhlNMkxMUrTk2UEVG7KfWd8ioXChTmNOSH6wsFp4kULrGvNgeyXCdEExHf3RNVBBk iWQZqgGF5PmI0ZPz0BIOehu9ZXdarVm6Q0mbfcPuJ5ThWQ0E+ObczOSKsbsRwHVlQ3KX oegVNcGPKjQZeTWVH2OKr9EeO/gcYGWPGj1UxKZ/JBzfz6JefhRryXQ+lQ+PXpn3rT9b gc/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3MhngyQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-36190-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36190-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id g2-20020a170902740200b001d71e0ee3c6si8600026pll.599.2024.01.23.15.34.32 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 15:34:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36190-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3MhngyQ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-36190-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36190-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 87A55B277B2 for <ouuuleilei@gmail.com>; Tue, 23 Jan 2024 23:33:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0D0654FB4; Tue, 23 Jan 2024 23:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I3MhngyQ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 346DD3B78E; Tue, 23 Jan 2024 23:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706052795; cv=none; b=mo4Q6+9boZTqK8uNA6pEihvpNHeBmGZYvyZDLFn9NwjF65IPSw2/xQoY1AdKeAGN/rCXVBcStpCoQrUHAhvBxMYu/g6IXcIXyh0GVGwRhNPU1RuLryzdVM51gRfS3ohnGHZ0tPuWCs/nu0WlJotR+AuCjs7VXO83NIQnxWOGiTk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706052795; c=relaxed/simple; bh=QGNoOHkwOGudSjTTpE/RdtDWUSLVrM6Fux/IWb+zhHM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=W/6pR3L3gH2+fmiDAs/elkcIeafA4l4ojTwgqZYQJhr4WCMLTba6XAzuVOqf7QlGpLOF896CFemOBOBHAOIWgiLxZqfcvmPI4LQovlI9rxrocKLeVMOV2+CDo2kLXn4ZoCqdNLhp/5D/ZPrqIuVLWGi+Fo2m0lCZPtcjma4Y+Uw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I3MhngyQ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18AFAC433C7; Tue, 23 Jan 2024 23:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706052794; bh=QGNoOHkwOGudSjTTpE/RdtDWUSLVrM6Fux/IWb+zhHM=; h=From:Date:Subject:To:Cc:From; b=I3MhngyQQwiO+HC4n3VfkmRV26qY3hc8196Rl80VsXzQSixMKZRNcljsOQuC859Pt GtxxpSbvMhY0kWmqSRyhXBMqAPNRQGmlXtB9gs7SmTdba7VGsjUdeeAeMxVMu0/4Gl M69jk/jX/A0zXUXLdj6otuJq+2wXlwYZ2uY33QXB+djCAVLW0vmSqNzTAeu2wCYd3Q 0rCxV5EHOCbgXGmxXbmY6jqiTZrxPVxWX+72yDJA0FxDVvVtpoxOU/0B4MtYkv2CYt dN39Ryh+HKhdgVGrAa4dpXktn7cQwArrt8kjeCK3pKHqC9YNQMftRWrhYwedS2aI5k 3a8jZgdrGxdjQ== From: Mark Brown <broonie@kernel.org> Date: Tue, 23 Jan 2024 23:33:07 +0000 Subject: [PATCH v3] thermal/drivers/sun8i: Don't fail probe due to zone registration failure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240123-thermal-sun8i-registration-v3-1-3e5771b1bbdd@kernel.org> X-B4-Tracking: v=1; b=H4sIALJMsGUC/43NwQ6CMAwG4FchOzuzbgroyfcwHsYosIjDdLhoC O9u4WK8GE/N3/z9OomI5DGKYzYJwuSjHwIHs8mE62xoUfqas9BKG1VAKccO6WZ7GR+h9JKw9XE kO/KZrBtjweTO2cYKBu6EjX+u+PnCuePqQK/1V4Jl+xebQIJ0h30FlSqU2anTFSlgvx2oFYub9 Mc6gP5pabZUUXATeOTllzXP8xuVCXwkEQEAAA== To: Vasily Khoruzhick <anarsoul@gmail.com>, Yangtao Li <tiny.windzz@gmail.com>, "Rafael J. Wysocki" <rafael@kernel.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org> Cc: Hugh Dickins <hughd@google.com>, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org> X-Mailer: b4 0.13-dev-0438c X-Developer-Signature: v=1; a=openpgp-sha256; l=3046; i=broonie@kernel.org; h=from:subject:message-id; bh=QGNoOHkwOGudSjTTpE/RdtDWUSLVrM6Fux/IWb+zhHM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlsEy2pfbbtfAa2AvPeU5FJK+lig+Fng09Sfcm5 fgY1u17UcGJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZbBMtgAKCRAk1otyXVSH 0GL2B/9T8OMF5ewkEdFH2AXiJaGPuFFxbdo8n+2gHijdVsbwin12SeH0pZR5zYV9jEb1kQjkm2t GM7TFXxYNHmje9ZuQqtUF45nzMMShij0BdAxyiU1PfpM5gNycOam1hPpkVCmRA+53swpLJCl8aP U48gmUmQ4BdbS+ZxiqvtcJTrOhItl02NwSu49BcWYhQDswW5vKKG3ZdJ/P2YbgDO/DpLbBW3W+R KfG16WMDw6xjYADDD/xoTW3SiHmPppok0DFzb2KurnnH4BKJYKDLMXDK61SZfuduz8Mx80Rv2xR qCfHX2hD13u2e2GQRWiRpB1oAgxZgSNwVEm5KnnzgpAvMqtf X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788926097697286281 X-GMAIL-MSGID: 1788926097697286281 |
Series |
[v3] thermal/drivers/sun8i: Don't fail probe due to zone registration failure
|
|
Commit Message
Mark Brown
Jan. 23, 2024, 11:33 p.m. UTC
Currently the sun8i thermal driver will fail to probe if any of the thermal zones it is registering fails to register with the thermal core. Since we currently do not define any trip points for the GPU thermal zones on at least A64 or H5 this means that we have no thermal support on these platforms: [ 1.698703] thermal_sys: Failed to find 'trips' node [ 1.698707] thermal_sys: Failed to find trip points for thermal-sensor id=1 even though the main CPU thermal zone on both SoCs is fully configured. This does not seem ideal, while we may not be able to use all the zones it seems better to have those zones which are usable be operational. Instead just carry on registering zones if we get any non-deferral error, allowing use of those zones which are usable. This means that we also need to update the interrupt handler to not attempt to notify the core for events on zones which we have not registered, I didn't see an ability to mask individual interrupts and I would expect that interrupts would still be indicated in the ISR even if they were masked. Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> --- Changes in v3: - Rebase onto v6.8-rc1. - Link to v2: https://lore.kernel.org/r/20230912-thermal-sun8i-registration-v2-1-077230107768@kernel.org Changes in v2: - Rebase onto v6.6-rc1. - Link to v1: https://lore.kernel.org/r/20230718-thermal-sun8i-registration-v1-1-c95b1b070340@kernel.org --- drivers/thermal/sun8i_thermal.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d change-id: 20230718-thermal-sun8i-registration-df3a136ccafa Best regards,
Comments
Hi Daniel, Rafael, is there any issue with this patch? Can you apply it? Best regards, Jernej Dne sreda, 24. januar 2024 ob 00:33:07 CET je Mark Brown napisal(a): > Currently the sun8i thermal driver will fail to probe if any of the > thermal zones it is registering fails to register with the thermal core. > Since we currently do not define any trip points for the GPU thermal > zones on at least A64 or H5 this means that we have no thermal support > on these platforms: > > [ 1.698703] thermal_sys: Failed to find 'trips' node > [ 1.698707] thermal_sys: Failed to find trip points for thermal-sensor id=1 > > even though the main CPU thermal zone on both SoCs is fully configured. > This does not seem ideal, while we may not be able to use all the zones > it seems better to have those zones which are usable be operational. > Instead just carry on registering zones if we get any non-deferral > error, allowing use of those zones which are usable. > > This means that we also need to update the interrupt handler to not > attempt to notify the core for events on zones which we have not > registered, I didn't see an ability to mask individual interrupts and > I would expect that interrupts would still be indicated in the ISR even > if they were masked. > > Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> > Signed-off-by: Mark Brown <broonie@kernel.org> > --- > Changes in v3: > - Rebase onto v6.8-rc1. > - Link to v2: https://lore.kernel.org/r/20230912-thermal-sun8i-registration-v2-1-077230107768@kernel.org > > Changes in v2: > - Rebase onto v6.6-rc1. > - Link to v1: https://lore.kernel.org/r/20230718-thermal-sun8i-registration-v1-1-c95b1b070340@kernel.org > --- > drivers/thermal/sun8i_thermal.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c > index 6a8e386dbc8d..c2a8ae7f8f2f 100644 > --- a/drivers/thermal/sun8i_thermal.c > +++ b/drivers/thermal/sun8i_thermal.c > @@ -188,6 +188,9 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data) > int i; > > for_each_set_bit(i, &irq_bitmap, tmdev->chip->sensor_num) { > + /* We allow some zones to not register. */ > + if (IS_ERR(tmdev->sensor[i].tzd)) > + continue; > thermal_zone_device_update(tmdev->sensor[i].tzd, > THERMAL_EVENT_UNSPECIFIED); > } > @@ -465,8 +468,17 @@ static int sun8i_ths_register(struct ths_device *tmdev) > i, > &tmdev->sensor[i], > &ths_ops); > - if (IS_ERR(tmdev->sensor[i].tzd)) > - return PTR_ERR(tmdev->sensor[i].tzd); > + > + /* > + * If an individual zone fails to register for reasons > + * other than probe deferral (eg, a bad DT) then carry > + * on, other zones might register successfully. > + */ > + if (IS_ERR(tmdev->sensor[i].tzd)) { > + if (PTR_ERR(tmdev->sensor[i].tzd) == -EPROBE_DEFER) > + return PTR_ERR(tmdev->sensor[i].tzd); > + continue; > + } > > devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd); > } > > --- > base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d > change-id: 20230718-thermal-sun8i-registration-df3a136ccafa > > Best regards, >
On 24/01/2024 00:33, Mark Brown wrote: > Currently the sun8i thermal driver will fail to probe if any of the > thermal zones it is registering fails to register with the thermal core. > Since we currently do not define any trip points for the GPU thermal > zones on at least A64 or H5 this means that we have no thermal support > on these platforms: > > [ 1.698703] thermal_sys: Failed to find 'trips' node > [ 1.698707] thermal_sys: Failed to find trip points for thermal-sensor id=1 > > even though the main CPU thermal zone on both SoCs is fully configured. > This does not seem ideal, while we may not be able to use all the zones > it seems better to have those zones which are usable be operational. > Instead just carry on registering zones if we get any non-deferral > error, allowing use of those zones which are usable. > > This means that we also need to update the interrupt handler to not > attempt to notify the core for events on zones which we have not > registered, I didn't see an ability to mask individual interrupts and > I would expect that interrupts would still be indicated in the ISR even > if they were masked. > > Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> > Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> > Signed-off-by: Mark Brown <broonie@kernel.org> > --- Applied, thanks
diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index 6a8e386dbc8d..c2a8ae7f8f2f 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -188,6 +188,9 @@ static irqreturn_t sun8i_irq_thread(int irq, void *data) int i; for_each_set_bit(i, &irq_bitmap, tmdev->chip->sensor_num) { + /* We allow some zones to not register. */ + if (IS_ERR(tmdev->sensor[i].tzd)) + continue; thermal_zone_device_update(tmdev->sensor[i].tzd, THERMAL_EVENT_UNSPECIFIED); } @@ -465,8 +468,17 @@ static int sun8i_ths_register(struct ths_device *tmdev) i, &tmdev->sensor[i], &ths_ops); - if (IS_ERR(tmdev->sensor[i].tzd)) - return PTR_ERR(tmdev->sensor[i].tzd); + + /* + * If an individual zone fails to register for reasons + * other than probe deferral (eg, a bad DT) then carry + * on, other zones might register successfully. + */ + if (IS_ERR(tmdev->sensor[i].tzd)) { + if (PTR_ERR(tmdev->sensor[i].tzd) == -EPROBE_DEFER) + return PTR_ERR(tmdev->sensor[i].tzd); + continue; + } devm_thermal_add_hwmon_sysfs(tmdev->dev, tmdev->sensor[i].tzd); }