From: Amit Kucheria <amit.kucheria@verdurent.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [RFC][PATCH 5/5] thermal: int340x: Use new device interface
Date: Wed, 20 May 2020 10:19:52 +0530 [thread overview]
Message-ID: <CAHLCerOvQYbgQDFkA9-pfx-VTZB7KckXeJeFH3sodTgohpMq0g@mail.gmail.com> (raw)
In-Reply-To: <20200504181616.175477-6-srinivas.pandruvada@linux.intel.com>
On Mon, May 4, 2020 at 11:47 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> Use the new framework to send notifications for:
> - Setting temperature threshold for notification to avoid polling
> - Send THERMAL_TRIP_REACHED event on reaching threshold
> - Send THERMAL_TRIP_UPDATE when firmware change the the existing trip
> temperature
I am a little confused here. I would've expected the thermal core to
send the THERMAL_TRIP_* notifications, not platform drivers. Why
shouldn't this be done in thermal core?
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> .../intel/int340x_thermal/int3403_thermal.c | 3 ++
> .../int340x_thermal/int340x_thermal_zone.c | 29 +++++++++++++++++++
> .../int340x_thermal/int340x_thermal_zone.h | 7 +++++
> .../processor_thermal_device.c | 1 +
> 4 files changed, 40 insertions(+)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> index f86cbb125e2f..77c014a113a4 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> @@ -63,15 +63,18 @@ static void int3403_notify(acpi_handle handle,
>
> switch (event) {
> case INT3403_PERF_CHANGED_EVENT:
> + int340x_thermal_send_user_event(obj->int340x_zone, THERMAL_PERF_CHANGED, 0);
> break;
> case INT3403_THERMAL_EVENT:
> int340x_thermal_zone_device_update(obj->int340x_zone,
> THERMAL_TRIP_VIOLATED);
> + int340x_thermal_send_user_event(obj->int340x_zone, THERMAL_TRIP_REACHED, 0);
> break;
> case INT3403_PERF_TRIP_POINT_CHANGED:
> int340x_thermal_read_trips(obj->int340x_zone);
> int340x_thermal_zone_device_update(obj->int340x_zone,
> THERMAL_TRIP_CHANGED);
> + int340x_thermal_send_user_event(obj->int340x_zone, THERMAL_TRIP_UPDATE, 0);
> break;
> default:
> dev_err(&priv->pdev->dev, "Unsupported event [0x%x]\n", event);
> diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
> index 432213272f1e..9568a2db7afd 100644
> --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
> +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
> @@ -146,12 +146,41 @@ static int int340x_thermal_get_trip_hyst(struct thermal_zone_device *zone,
> return 0;
> }
>
> +static int int340x_thermal_get_thres_low(struct thermal_zone_device *zone, int *temp)
> +{
> + struct int34x_thermal_zone *d = zone->devdata;
> +
> + *temp = d->aux_trips[0];
> +
> + return 0;
> +}
> +
> +static int int340x_thermal_set_thres_low(struct thermal_zone_device *zone, int temp)
> +{
> + struct int34x_thermal_zone *d = zone->devdata;
> + acpi_status status;
> +
> + if (d->override_ops && d->override_ops->set_trip_temp)
> + return d->override_ops->set_trip_temp(zone, 0, temp);
> +
> + status = acpi_execute_simple_method(d->adev->handle, "PAT0",
> + millicelsius_to_deci_kelvin(temp));
> + if (ACPI_FAILURE(status))
> + return -EIO;
> +
> + d->aux_trips[0] = temp;
> +
> + return 0;
> +}
> +
> static struct thermal_zone_device_ops int340x_thermal_zone_ops = {
> .get_temp = int340x_thermal_get_zone_temp,
> .get_trip_temp = int340x_thermal_get_trip_temp,
> .get_trip_type = int340x_thermal_get_trip_type,
> .set_trip_temp = int340x_thermal_set_trip_temp,
> .get_trip_hyst = int340x_thermal_get_trip_hyst,
> + .set_temp_thres_low = int340x_thermal_set_thres_low,
> + .get_temp_thres_low = int340x_thermal_get_thres_low,
> };
>
> static int int340x_thermal_get_trip_config(acpi_handle handle, char *name,
> diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h
> index 3b4971df1b33..142027e4955f 100644
> --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h
> +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h
> @@ -58,4 +58,11 @@ static inline void int340x_thermal_zone_device_update(
> thermal_zone_device_update(tzone->zone, event);
> }
>
> +static inline void int340x_thermal_send_user_event(
> + struct int34x_thermal_zone *tzone,
> + enum thermal_device_events event,
> + u64 data)
> +{
> + thermal_dev_send_event(tzone->zone->id, event, data);
> +}
> #endif
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> index 297db1d2d960..e25f01948d33 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> @@ -340,6 +340,7 @@ static void proc_thermal_notify(acpi_handle handle, u32 event, void *data)
> proc_thermal_read_ppcc(proc_priv);
> int340x_thermal_zone_device_update(proc_priv->int340x_zone,
> THERMAL_DEVICE_POWER_CAPABILITY_CHANGED);
> + int340x_thermal_send_user_event(proc_priv->int340x_zone, THERMAL_PERF_CHANGED, 0);
> break;
> default:
> dev_dbg(proc_priv->dev, "Unsupported event [0x%x]\n", event);
> --
> 2.25.4
>
prev parent reply other threads:[~2020-05-20 4:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 18:16 [RFC][PATCH 0/5] thermal: Add new mechanism to get thermal notification Srinivas Pandruvada
2020-05-04 18:16 ` [RFC][PATCH 1/5] thermal: Add support for /dev/thermal_notify Srinivas Pandruvada
2020-05-20 4:45 ` Amit Kucheria
2020-05-04 18:16 ` [RFC][PATCH 2/5] thermal: Add notification for zone creation and deletion Srinivas Pandruvada
2020-05-04 18:16 ` [RFC][PATCH 3/5] thermal: Add support for setting notification thresholds Srinivas Pandruvada
2020-05-18 16:37 ` Daniel Lezcano
2020-05-18 23:40 ` Srinivas Pandruvada
2020-05-20 4:28 ` Amit Kucheria
2020-05-20 18:16 ` Srinivas Pandruvada
2020-05-21 5:11 ` Amit Kucheria
2020-05-21 19:11 ` Srinivas Pandruvada
2020-05-04 18:16 ` [RFC][PATCH 4/5] thermal: Add support for setting polling interval Srinivas Pandruvada
2020-05-18 16:51 ` Daniel Lezcano
2020-05-18 23:46 ` Srinivas Pandruvada
2020-05-19 10:25 ` Daniel Lezcano
2020-05-21 22:26 ` Srinivas Pandruvada
2020-05-20 4:38 ` Amit Kucheria
2020-05-04 18:16 ` [RFC][PATCH 5/5] thermal: int340x: Use new device interface Srinivas Pandruvada
2020-05-20 4:49 ` Amit Kucheria [this message]
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=CAHLCerOvQYbgQDFkA9-pfx-VTZB7KckXeJeFH3sodTgohpMq0g@mail.gmail.com \
--to=amit.kucheria@verdurent.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.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;
as well as URLs for NNTP newsgroup(s).