From: Javi Merino <javi.merino@arm.com>
To: linux-pm@vger.kernel.org
Cc: dmitry.torokhov@gmail.com, cywang@chromium.org,
linux-kernel@vger.kernel.org, punit.agrawal@arm.com,
djkurtz@chromium.org, edubezval@gmail.com,
Javi Merino <javi.merino@arm.com>,
Zhang Rui <rui.zhang@intel.com>
Subject: [PATCH v4 1/5] thermal: Add a function to get the minimum power
Date: Wed, 26 Aug 2015 14:26:40 +0100 [thread overview]
Message-ID: <1440595604-27197-2-git-send-email-javi.merino@arm.com> (raw)
In-Reply-To: <1440595604-27197-1-git-send-email-javi.merino@arm.com>
The thermal core already has a function to get the maximum power of a
cooling device: power_actor_get_max_power(). Add a function to get the
minimum power of a cooling device.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
---
drivers/thermal/thermal_core.c | 28 ++++++++++++++++++++++++++++
include/linux/thermal.h | 6 ++++++
2 files changed, 34 insertions(+)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 4ca211be4c0f..760204f0b63c 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -997,6 +997,34 @@ int power_actor_get_max_power(struct thermal_cooling_device *cdev,
}
/**
+ * power_actor_get_min_power() - get the mainimum power that a cdev can consume
+ * @cdev: pointer to &thermal_cooling_device
+ * @tz: a valid thermal zone device pointer
+ * @min_power: pointer in which to store the minimum power
+ *
+ * Calculate the minimum power consumption in milliwatts that the
+ * cooling device can currently consume and store it in @min_power.
+ *
+ * Return: 0 on success, -EINVAL if @cdev doesn't support the
+ * power_actor API or -E* on other error.
+ */
+int power_actor_get_min_power(struct thermal_cooling_device *cdev,
+ struct thermal_zone_device *tz, u32 *min_power)
+{
+ unsigned long max_state;
+ int ret;
+
+ if (!cdev_is_power_actor(cdev))
+ return -EINVAL;
+
+ ret = cdev->ops->get_max_state(cdev, &max_state);
+ if (ret)
+ return ret;
+
+ return cdev->ops->state2power(cdev, tz, max_state, min_power);
+}
+
+/**
* power_actor_set_power() - limit the maximum power that a cooling device can consume
* @cdev: pointer to &thermal_cooling_device
* @instance: thermal instance to update
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 037e9df2f610..f99d934d373a 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -384,6 +384,8 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
int power_actor_get_max_power(struct thermal_cooling_device *,
struct thermal_zone_device *tz, u32 *max_power);
+int power_actor_get_min_power(struct thermal_cooling_device *,
+ struct thermal_zone_device *tz, u32 *min_power);
int power_actor_set_power(struct thermal_cooling_device *,
struct thermal_instance *, u32);
struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
@@ -419,6 +421,10 @@ static inline bool cdev_is_power_actor(struct thermal_cooling_device *cdev)
static inline int power_actor_get_max_power(struct thermal_cooling_device *cdev,
struct thermal_zone_device *tz, u32 *max_power)
{ return 0; }
+static inline int power_actor_get_min_power(struct thermal_cooling_device *cdev,
+ struct thermal_zone_device *tz,
+ u32 *min_power)
+{ return -ENODEV; }
static inline int power_actor_set_power(struct thermal_cooling_device *cdev,
struct thermal_instance *tz, u32 power)
{ return 0; }
--
1.9.1
next prev parent reply other threads:[~2015-08-26 13:27 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 16:39 [PATCH] thermal: remove power allocator from list of default governors Dmitry Torokhov
2015-08-05 8:37 ` Javi Merino
2015-08-05 16:18 ` Srinivas Pandruvada
2015-08-05 16:35 ` Dmitry Torokhov
2015-08-05 18:49 ` Eduardo Valentin
2015-08-06 8:30 ` Javi Merino
2015-08-10 16:04 ` [PATCH 0/3] Let the power allocator thermal governor run on any thermal zone Javi Merino
2015-08-10 16:04 ` [PATCH 1/3] thermal: power_allocator: relax the requirement of a sustainable_power in tzp Javi Merino
2015-08-10 16:04 ` [PATCH 2/3] thermal: power_allocator: relax the requirement of two passive trip points Javi Merino
2015-08-10 16:04 ` [PATCH 3/3] thermal: power_allocator: exit early if there are no cooling devices Javi Merino
2015-08-11 10:21 ` [PATCH v2 0/4] Let the power allocator thermal governor run on any thermal zone Javi Merino
2015-08-11 10:21 ` [PATCH v2 1/4] thermal: power_allocator: relax the requirement of a sustainable_power in tzp Javi Merino
2015-08-11 13:42 ` Punit Agrawal
2015-08-11 17:37 ` Javi Merino
2015-08-12 11:05 ` Daniel Kurtz
2015-08-11 10:21 ` [PATCH v2 2/4] thermal: power_allocator: relax the requirement of two passive trip points Javi Merino
2015-08-12 11:13 ` Daniel Kurtz
2015-08-12 16:46 ` Javi Merino
2015-08-11 10:21 ` [PATCH v2 3/4] thermal: power_allocator: don't require tzp to be present for the thermal zone Javi Merino
2015-08-11 10:21 ` [PATCH v2 4/4] thermal: power_allocator: exit early if there are no cooling devices Javi Merino
2015-08-17 17:36 ` [PATCH v3 0/4] Let the power allocator thermal governor run on any thermal zone Javi Merino
2015-08-17 17:36 ` [PATCH v3 1/4] thermal: power_allocator: relax the requirement of a sustainable_power in tzp Javi Merino
2015-08-20 22:16 ` Eduardo Valentin
2015-08-24 18:37 ` Javi Merino
2015-08-17 17:36 ` [PATCH v3 2/4] thermal: power_allocator: relax the requirement of two passive trip points Javi Merino
2015-08-17 17:36 ` [PATCH v3 3/4] thermal: power_allocator: don't require tzp to be present for the thermal zone Javi Merino
2015-08-17 17:36 ` [PATCH v3 4/4] thermal: power_allocator: exit early if there are no cooling devices Javi Merino
2015-08-26 13:26 ` [PATCH v4 0/5] Let the power allocator thermal governor run on any thermal zone Javi Merino
2015-08-26 13:26 ` Javi Merino [this message]
2015-08-26 13:26 ` [PATCH v4 2/5] thermal: power_allocator: relax the requirement of a sustainable_power in tzp Javi Merino
2015-08-26 13:26 ` [PATCH v4 3/5] thermal: power_allocator: relax the requirement of two passive trip points Javi Merino
2015-08-26 13:26 ` [PATCH v4 4/5] thermal: power_allocator: don't require tzp to be present for the thermal zone Javi Merino
2015-08-28 2:18 ` Daniel Kurtz
2015-08-28 16:28 ` Javi Merino
2015-08-31 13:14 ` Daniel Kurtz
2015-08-26 13:26 ` [PATCH v4 5/5] thermal: power_allocator: exit early if there are no cooling devices Javi Merino
2015-09-02 15:11 ` [PATCH v4 0/5] Let the power allocator thermal governor run on any thermal zone Javi Merino
2015-09-07 13:19 ` [PATCH v5 " Javi Merino
2015-09-07 13:19 ` [PATCH v5 1/5] thermal: Add a function to get the minimum power Javi Merino
2015-09-07 13:19 ` [PATCH v5 2/5] thermal: power_allocator: relax the requirement of a sustainable_power in tzp Javi Merino
2015-09-07 13:19 ` [PATCH v5 3/5] thermal: power_allocator: relax the requirement of two passive trip points Javi Merino
2015-09-07 13:19 ` [PATCH v5 4/5] thermal: power_allocator: don't require tzp to be present for the thermal zone Javi Merino
2015-09-07 13:19 ` [PATCH v5 5/5] thermal: power_allocator: exit early if there are no cooling devices Javi Merino
2015-09-08 1:46 ` [PATCH v5 0/5] Let the power allocator thermal governor run on any thermal zone Daniel Kurtz
2015-09-14 13:23 ` [PATCH v6 " Javi Merino
2015-09-14 13:23 ` [PATCH v6 1/5] thermal: Add a function to get the minimum power Javi Merino
2015-09-14 13:23 ` [PATCH v6 2/5] thermal: power_allocator: relax the requirement of a sustainable_power in tzp Javi Merino
2015-09-14 13:23 ` [PATCH v6 3/5] thermal: power_allocator: relax the requirement of two passive trip points Javi Merino
2015-09-14 13:23 ` [PATCH v6 4/5] thermal: power_allocator: don't require tzp to be present for the thermal zone Javi Merino
2015-09-14 13:23 ` [PATCH v6 5/5] thermal: power_allocator: exit early if there are no cooling devices Javi Merino
2015-09-14 3:04 ` [PATCH v4 0/5] Let the power allocator thermal governor run on any thermal zone Eduardo Valentin
2015-09-14 13:32 ` Javi Merino
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=1440595604-27197-2-git-send-email-javi.merino@arm.com \
--to=javi.merino@arm.com \
--cc=cywang@chromium.org \
--cc=djkurtz@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=edubezval@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=punit.agrawal@arm.com \
--cc=rui.zhang@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®