From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>, rafael@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
rui.zhang@intel.com, Amit Kucheria <amitk@kernel.org>,
Sumeet Pawnikar <sumeet.r.pawnikar@intel.com>,
Shang XiaoJing <shangxiaojing@huawei.com>
Subject: Re: [PATCH 2/3] thermal/drivers/intel: Use generic trip points for processor_thermal_device_pci
Date: Wed, 18 Jan 2023 11:09:51 -0800 [thread overview]
Message-ID: <e7ab0321e8c655836960295987f69c18d940ae52.camel@linux.intel.com> (raw)
In-Reply-To: <20230118181622.33335-2-daniel.lezcano@linaro.org>
On Wed, 2023-01-18 at 19:16 +0100, Daniel Lezcano wrote:
> The thermal framework gives the possibility to register the trip
> points with the thermal zone. When that is done, no get_trip_* ops
> are
> needed and they can be removed.
>
> Convert ops content logic into generic trip points and register them
> with the
> thermal zone.
>
In this scheme is the assumption is that trip point temperature never
changes? If firmware updated the trip temperature, what needs to be
done?
Thanks,
Srinivas
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> .../processor_thermal_device_pci.c | 53 ++++++++---------
> --
> 1 file changed, 22 insertions(+), 31 deletions(-)
>
> diff --git
> a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.
> c
> b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.
> c
> index bf1b1cdfade4..c7d50862bf56 100644
> ---
> a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.
> c
> +++
> b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.
> c
> @@ -144,34 +144,6 @@ static int sys_get_curr_temp(struct
> thermal_zone_device *tzd, int *temp)
> return 0;
> }
>
> -static int sys_get_trip_temp(struct thermal_zone_device *tzd,
> - int trip, int *temp)
> -{
> - struct proc_thermal_pci *pci_info = tzd->devdata;
> - u32 _temp;
> -
> - proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_THRES_0,
> &_temp);
> - if (!_temp) {
> - *temp = THERMAL_TEMP_INVALID;
> - } else {
> - int tjmax;
> -
> - proc_thermal_mmio_read(pci_info,
> PROC_THERMAL_MMIO_TJMAX, &tjmax);
> - _temp = tjmax - _temp;
> - *temp = (unsigned long)_temp * 1000;
> - }
> -
> - return 0;
> -}
> -
> -static int sys_get_trip_type(struct thermal_zone_device *tzd, int
> trip,
> - enum thermal_trip_type *type)
> -{
> - *type = THERMAL_TRIP_PASSIVE;
> -
> - return 0;
> -}
> -
> static int sys_set_trip_temp(struct thermal_zone_device *tzd, int
> trip, int temp)
> {
> struct proc_thermal_pci *pci_info = tzd->devdata;
> @@ -200,10 +172,26 @@ static int sys_set_trip_temp(struct
> thermal_zone_device *tzd, int trip, int temp
> return 0;
> }
>
> +static int get_trip_temp(struct proc_thermal_pci *pci_info)
> +{
> + int temp, tjmax;
> +
> + proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_THRES_0,
> &temp);
> + if (!temp)
> + return THERMAL_TEMP_INVALID;
> +
> + proc_thermal_mmio_read(pci_info, PROC_THERMAL_MMIO_TJMAX,
> &tjmax);
> + temp = (tjmax - temp) * 1000;
> +
> + return temp;
> +}
> +
> +static struct thermal_trip psv_trip = {
> + .type = THERMAL_TRIP_PASSIVE,
> +};
> +
> static struct thermal_zone_device_ops tzone_ops = {
> .get_temp = sys_get_curr_temp,
> - .get_trip_temp = sys_get_trip_temp,
> - .get_trip_type = sys_get_trip_type,
> .set_trip_temp = sys_set_trip_temp,
> };
>
> @@ -251,7 +239,10 @@ static int proc_thermal_pci_probe(struct pci_dev
> *pdev, const struct pci_device_
> if (ret)
> goto err_ret_thermal;
>
> - pci_info->tzone = thermal_zone_device_register("TCPU_PCI", 1,
> 1, pci_info,
> + psv_trip.temperature = get_trip_temp(pci_info);
> +
> + pci_info->tzone =
> thermal_zone_device_register_with_trips("TCPU_PCI", &psv_trip,
> + 1, 1,
> pci_info,
> &tzone_ops,
> &tzone_params
> , 0, 0);
> if (IS_ERR(pci_info->tzone)) {
next prev parent reply other threads:[~2023-01-18 19:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-18 18:16 [PATCH 1/3] thermal/drivers/intel: Use generic trip points for quark_dts Daniel Lezcano
2023-01-18 18:16 ` [PATCH 2/3] thermal/drivers/intel: Use generic trip points for processor_thermal_device_pci Daniel Lezcano
2023-01-18 19:09 ` srinivas pandruvada [this message]
2023-01-23 18:02 ` Daniel Lezcano
2023-01-23 19:31 ` srinivas pandruvada
2023-01-26 15:18 ` Rafael J. Wysocki
2023-01-18 18:16 ` [PATCH 3/3] thermal/drivers/intel: Use generic trip points for intel_soc_dts_iosf Daniel Lezcano
2023-01-19 20:04 ` Rafael J. Wysocki
2023-01-23 18:09 ` Daniel Lezcano
2023-01-23 20:19 ` Rafael J. Wysocki
2023-01-24 10:28 ` Daniel Lezcano
2023-01-24 14:09 ` Rafael J. Wysocki
2023-01-26 16:47 ` Rafael J. Wysocki
2023-01-31 17:03 ` Daniel Lezcano
2023-01-31 19:17 ` Rafael J. Wysocki
2023-02-02 14:36 ` Daniel Lezcano
2023-02-02 14:43 ` Rafael J. Wysocki
2023-02-02 15:54 ` Daniel Lezcano
2023-01-26 14:15 ` [PATCH 1/3] thermal/drivers/intel: Use generic trip points for quark_dts Rafael J. Wysocki
2023-01-31 16:41 ` Daniel Lezcano
2023-01-31 19:11 ` Rafael J. Wysocki
2023-01-31 23:55 ` Daniel Lezcano
2023-02-01 10:42 ` Daniel Lezcano
2023-02-01 18:47 ` Rafael J. Wysocki
2023-02-01 19:27 ` Daniel Lezcano
2023-02-02 10:32 ` Rafael J. Wysocki
2023-02-02 13:31 ` Daniel Lezcano
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=e7ab0321e8c655836960295987f69c18d940ae52.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=shangxiaojing@huawei.com \
--cc=sumeet.r.pawnikar@intel.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
all inboxes | Powered by JetHome®