From: Anjelique Melendez <quic_amelende@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: <robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<amitk@kernel.org>, <thara.gopinath@gmail.com>,
<andersson@kernel.org>, <quic_collinsd@quicinc.com>,
<rafael@kernel.org>, <daniel.lezcano@linaro.org>,
<rui.zhang@intel.com>, <lukasz.luba@arm.com>,
<linux-arm-msm@vger.kernel.org>, <linux-pm@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/5] thermal: qcom-spmi-temp-alarm: add support for GEN2 rev 2 PMIC peripherals
Date: Tue, 30 Jul 2024 15:44:06 -0700 [thread overview]
Message-ID: <35402164-dce0-b972-bf98-c025fe5620f0@quicinc.com> (raw)
In-Reply-To: <pzu2ijzkofzxpehpc4yphj5567ijdrxngqrepaq54njdagjenh@3vxmezjoepqg>
>>
>> +/* Configure TEMP_DAC registers based on DT thermal_zone trips */
>> +static int qpnp_tm_gen2_rev2_update_trip_temps(struct qpnp_tm_chip *chip)
>> +{
>> + struct thermal_trip trip = {0};
>> + int ret, ntrips, i;
>> +
>> + ntrips = thermal_zone_get_num_trips(chip->tz_dev);
>> + /* Keep hardware defaults if no DT trips are defined. */
>> + if (ntrips <= 0)
>> + return 0;
>> +
>> + for (i = 0; i < ntrips; i++) {
>> + ret = thermal_zone_get_trip(chip->tz_dev, i, &trip);
>> + if (ret < 0)
>> + return ret;
>> +
>> + ret = qpnp_tm_gen2_rev2_set_temp_thresh(chip, i, trip.temperature);
>> + if (ret < 0)
>> + return ret;
>> + }
>> +
>> + /* Verify that trips are strictly increasing. */
>
> There is no such requirement in the DT bindings. Please don't invent
> artificial restrictions, especially if they are undocumented.
>
This is not an entirely new restirction. Currently the temp alarm driver
has hardcoded temperature thresholds options which are "strictly increasing"
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/thermal/qcom/qcom-spmi-temp-alarm.c?h=v6.11-rc1#n44).
The threshold values are initially configured based on the stage 2 critical trip
temperature.
For newer PMICs, we have individual temperature registers for stage 1, 2, and 3,
so we instead configure each threshold temperature as defined in DT. In general
since stage 1 = warning, stage 2 = system should shut down, stage 3 = emergency shutdown,
we would expect for temperature thresholds to increase for each stage
(https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/thermal?h=v5.4.281&id=f1599f9e4cd6f1dd0cad202853fb830854f4e944).
I agree that we are missing some documentation but since the trips are defined in the
thermal_zone node what is the best way to mention this requirement? Will adding a
few sentences to qcom,spmi-temp-alarm.yaml description be enough? Do we need
to make changes to thermal_zone.yaml so that dt_binding_check catches this requirement?
>> + for (i = 1; i < STAGE_COUNT; i++) {
>> + if (chip->temp_dac_map[i] <= chip->temp_dac_map[i - 1]) {
>> + dev_err(chip->dev, "Threshold %d=%ld <= threshold %d=%ld\n",
>> + i, chip->temp_dac_map[i], i - 1,
>> + chip->temp_dac_map[i - 1]);
>> + return -EINVAL;
>> + }
>> + }
>> +
>> + return 0;
Thanks,
Anjelique
next prev parent reply other threads:[~2024-07-30 22:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-29 23:12 [PATCH 0/5] thermal: qcom-spmi-temp-alarm: add support for new TEMP_ALARM subtypes Anjelique Melendez
2024-07-29 23:12 ` [PATCH 1/5] dt-bindings: qcom,spmi-temp-alarm: Add compatible for GEN2 rev2 temp alarm Anjelique Melendez
2024-07-30 6:19 ` Krzysztof Kozlowski
2024-07-30 6:21 ` Krzysztof Kozlowski
2024-07-29 23:12 ` [PATCH 2/5] dt-bindings: qcom,spmi-temp-alarm: Add compatible for lite " Anjelique Melendez
2024-07-30 6:20 ` Krzysztof Kozlowski
2024-07-29 23:12 ` [PATCH 3/5] thermal: qcom-spmi-temp-alarm: enable stage 2 shutdown when required Anjelique Melendez
2024-07-29 23:12 ` [PATCH 4/5] thermal: qcom-spmi-temp-alarm: add support for GEN2 rev 2 PMIC peripherals Anjelique Melendez
2024-07-29 23:36 ` Dmitry Baryshkov
2024-07-30 22:44 ` Anjelique Melendez [this message]
2024-07-30 23:37 ` Dmitry Baryshkov
2024-07-29 23:12 ` [PATCH 5/5] thermal: qcom-spmi-temp-alarm: add support for LITE " Anjelique Melendez
2024-07-29 23:39 ` Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=35402164-dce0-b972-bf98-c025fe5620f0@quicinc.com \
--to=quic_amelende@quicinc.com \
--cc=amitk@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=quic_collinsd@quicinc.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=thara.gopinath@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox