Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1415240 > unrolled thread

[PATCH 0/3] firmware: scpi: add device power domain support

Started bySudeep Holla <sudeep.holla@arm.com>
First post2016-06-06 18:00 +0200
Last post2016-06-07 15:10 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] firmware: scpi: add device power domain support Sudeep Holla <sudeep.holla@arm.com> - 2016-06-06 18:00 +0200
    [PATCH 1/3] firmware: arm_scpi: add support for device power state management Sudeep Holla <sudeep.holla@arm.com> - 2016-06-06 18:00 +0200
      Re: [PATCH 1/3] firmware: arm_scpi: add support for device power  state management "Jon Medhurst (Tixy)" <tixy@linaro.org> - 2016-06-07 15:00 +0200
        Re: [PATCH 1/3] firmware: arm_scpi: add support for device power  state management Sudeep Holla <sudeep.holla@arm.com> - 2016-06-07 15:10 +0200

#1415240 — [PATCH 0/3] firmware: scpi: add device power domain support

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-06-06 18:00 +0200
Subject[PATCH 0/3] firmware: scpi: add device power domain support
Message-ID<rH56x-6VJ-11@gated-at.bofh.it>
This series add support for SCPI based device device power state
management using genpd.

Regards,
Sudeep

Sudeep Holla (3):
  firmware: arm_scpi: add support for device power state management
  Documentation: add DT bindings for ARM SCPI power domains
  firmware: scpi: add device power domain support using genpd

 Documentation/devicetree/bindings/arm/arm,scpi.txt |  34 +++++
 drivers/firmware/Kconfig                           |   8 ++
 drivers/firmware/Makefile                          |   1 +
 drivers/firmware/arm_scpi.c                        |  29 ++++
 drivers/firmware/scpi_pd.c                         | 152 +++++++++++++++++++++
 include/linux/scpi_protocol.h                      |   2 +
 6 files changed, 226 insertions(+)
 create mode 100644 drivers/firmware/scpi_pd.c

-- 
2.7.4

[toc] | [next] | [standalone]


#1415246 — [PATCH 1/3] firmware: arm_scpi: add support for device power state management

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-06-06 18:00 +0200
Subject[PATCH 1/3] firmware: arm_scpi: add support for device power state management
Message-ID<rH56y-6VJ-31@gated-at.bofh.it>
In reply to#1415240
SCPI protocol supports device power state management. This deals with
power states of various peripheral devices in the system other than the
core compute subsystem.

This patch adds support for the power state management of those
peripheral devices.

Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scpi.c   | 29 +++++++++++++++++++++++++++++
 include/linux/scpi_protocol.h |  2 ++
 2 files changed, 31 insertions(+)

diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index 51c6db0774cc..ca6afd2217a8 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -231,6 +231,11 @@ struct sensor_value {
 	__le32 hi_val;
 } __packed;

+struct dev_pstate_set {
+	u16 dev_id;
+	u8 pstate;
+} __packed;
+
 static struct scpi_drvinfo *scpi_info;

 static int scpi_linux_errmap[SCPI_ERR_MAX] = {
@@ -537,6 +542,28 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val)
 	return ret;
 }

+static int scpi_device_get_power_state(u16 dev_id)
+{
+	int ret;
+	u8 pstate;
+
+	ret = scpi_send_message(SCPI_CMD_GET_DEVICE_PWR_STATE, &dev_id,
+				sizeof(dev_id), &pstate, sizeof(pstate));
+	return ret ? ret : pstate;
+}
+
+static int scpi_device_set_power_state(u16 dev_id, u8 pstate)
+{
+	int stat;
+	struct dev_pstate_set dev_set = {
+		.dev_id = cpu_to_le16(dev_id),
+		.pstate = pstate,
+	};
+
+	return scpi_send_message(SCPI_CMD_SET_DEVICE_PWR_STATE, &dev_set,
+				 sizeof(dev_set), &stat, sizeof(stat));
+}
+
 static struct scpi_ops scpi_ops = {
 	.get_version = scpi_get_version,
 	.clk_get_range = scpi_clk_get_range,
@@ -548,6 +575,8 @@ static struct scpi_ops scpi_ops = {
 	.sensor_get_capability = scpi_sensor_get_capability,
 	.sensor_get_info = scpi_sensor_get_info,
 	.sensor_get_value = scpi_sensor_get_value,
+	.device_get_power_state = scpi_device_get_power_state,
+	.device_set_power_state = scpi_device_set_power_state,
 };

 struct scpi_ops *get_scpi_ops(void)
diff --git a/include/linux/scpi_protocol.h b/include/linux/scpi_protocol.h
index 35de50a65665..dc5f989be226 100644
--- a/include/linux/scpi_protocol.h
+++ b/include/linux/scpi_protocol.h
@@ -70,6 +70,8 @@ struct scpi_ops {
 	int (*sensor_get_capability)(u16 *sensors);
 	int (*sensor_get_info)(u16 sensor_id, struct scpi_sensor_info *);
 	int (*sensor_get_value)(u16, u64 *);
+	int (*device_get_power_state)(u16);
+	int (*device_set_power_state)(u16, u8);
 };

 #if IS_REACHABLE(CONFIG_ARM_SCPI_PROTOCOL)
--
2.7.4

[toc] | [prev] | [next] | [standalone]


#1416143 — Re: [PATCH 1/3] firmware: arm_scpi: add support for device power state management

From"Jon Medhurst (Tixy)" <tixy@linaro.org>
Date2016-06-07 15:00 +0200
SubjectRe: [PATCH 1/3] firmware: arm_scpi: add support for device power state management
Message-ID<rHoLT-2Pn-7@gated-at.bofh.it>
In reply to#1415246
On Mon, 2016-06-06 at 16:53 +0100, Sudeep Holla wrote:
> SCPI protocol supports device power state management. This deals with
> power states of various peripheral devices in the system other than the
> core compute subsystem.
> 
> This patch adds support for the power state management of those
> peripheral devices.
> 
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scpi.c   | 29 +++++++++++++++++++++++++++++
>  include/linux/scpi_protocol.h |  2 ++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
> index 51c6db0774cc..ca6afd2217a8 100644
> --- a/drivers/firmware/arm_scpi.c
> +++ b/drivers/firmware/arm_scpi.c
> @@ -231,6 +231,11 @@ struct sensor_value {
>  	__le32 hi_val;
>  } __packed;
> 
> +struct dev_pstate_set {
> +	u16 dev_id;
> +	u8 pstate;
> +} __packed;
> +
>  static struct scpi_drvinfo *scpi_info;
> 
>  static int scpi_linux_errmap[SCPI_ERR_MAX] = {
> @@ -537,6 +542,28 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val)
>  	return ret;
>  }
> 
> +static int scpi_device_get_power_state(u16 dev_id)
> +{
> +	int ret;
> +	u8 pstate;
> +
> +	ret = scpi_send_message(SCPI_CMD_GET_DEVICE_PWR_STATE, &dev_id,
> +				sizeof(dev_id), &pstate, sizeof(pstate));

Don't you need to run translate dev_id to little-endian before sending
it? You remembered to do that next function...

> +	return ret ? ret : pstate;
> +}
> +
> +static int scpi_device_set_power_state(u16 dev_id, u8 pstate)
> +{
> +	int stat;
> +	struct dev_pstate_set dev_set = {
> +		.dev_id = cpu_to_le16(dev_id),
> +		.pstate = pstate,
> +	};
> +
> +	return scpi_send_message(SCPI_CMD_SET_DEVICE_PWR_STATE, &dev_set,
> +				 sizeof(dev_set), &stat, sizeof(stat));
> +}
> +

[...]

-- 
Tixy

[toc] | [prev] | [next] | [standalone]


#1416147 — Re: [PATCH 1/3] firmware: arm_scpi: add support for device power state management

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-06-07 15:10 +0200
SubjectRe: [PATCH 1/3] firmware: arm_scpi: add support for device power state management
Message-ID<rHoVA-37S-35@gated-at.bofh.it>
In reply to#1416143

On 07/06/16 13:58, Jon Medhurst (Tixy) wrote:
> On Mon, 2016-06-06 at 16:53 +0100, Sudeep Holla wrote:
>> SCPI protocol supports device power state management. This deals with
>> power states of various peripheral devices in the system other than the
>> core compute subsystem.
>>
>> This patch adds support for the power state management of those
>> peripheral devices.
>>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>   drivers/firmware/arm_scpi.c   | 29 +++++++++++++++++++++++++++++
>>   include/linux/scpi_protocol.h |  2 ++
>>   2 files changed, 31 insertions(+)
>>
>> diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
>> index 51c6db0774cc..ca6afd2217a8 100644
>> --- a/drivers/firmware/arm_scpi.c
>> +++ b/drivers/firmware/arm_scpi.c
>> @@ -231,6 +231,11 @@ struct sensor_value {
>>   	__le32 hi_val;
>>   } __packed;
>>
>> +struct dev_pstate_set {
>> +	u16 dev_id;
>> +	u8 pstate;
>> +} __packed;
>> +
>>   static struct scpi_drvinfo *scpi_info;
>>
>>   static int scpi_linux_errmap[SCPI_ERR_MAX] = {
>> @@ -537,6 +542,28 @@ static int scpi_sensor_get_value(u16 sensor, u64 *val)
>>   	return ret;
>>   }
>>
>> +static int scpi_device_get_power_state(u16 dev_id)
>> +{
>> +	int ret;
>> +	u8 pstate;
>> +
>> +	ret = scpi_send_message(SCPI_CMD_GET_DEVICE_PWR_STATE, &dev_id,
>> +				sizeof(dev_id), &pstate, sizeof(pstate));
>
> Don't you need to run translate dev_id to little-endian before sending
> it? You remembered to do that next function...
>

Good catch, that's the reason I added the get_power_state call in
scpi_genpd code to cover testing but still I failed.

Thanks for catching this.

-- 
Regards,
Sudeep

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web