From: Cristian Marussi <cristian.marussi@arm.com>
To: Peter Hilber <peter.hilber@opensynergy.com>
Cc: mikhail.golubev@opensynergy.com, Igor.Skalkin@opensynergy.com,
jbhayana@google.com, Jonathan.Cameron@Huawei.com,
linux-kernel@vger.kernel.org, lukasz.luba@arm.com,
james.quinlan@broadcom.com, sudeep.holla@arm.com,
egranata@google.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 6/6] firmware: arm_scmi: add SCMIv3.0 Sensor notifications
Date: Tue, 10 Nov 2020 17:09:22 +0000 [thread overview]
Message-ID: <20201110170922.GE42652@e120937-lin> (raw)
In-Reply-To: <8f8e171e-03eb-f818-48e5-f542d1ab9061@opensynergy.com>
On Tue, Nov 10, 2020 at 05:01:57PM +0100, Peter Hilber wrote:
> On 26.10.20 21:10, Cristian Marussi wrote:
> > Add support for new SCMIv3.0 SENSOR_UPDATE notification.
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> > drivers/firmware/arm_scmi/sensors.c | 124 ++++++++++++++++++++++++----
> > include/linux/scmi_protocol.h | 9 ++
> > 2 files changed, 116 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
> > index 372a3592e99b..51921e279c9f 100644
> > --- a/drivers/firmware/arm_scmi/sensors.c
> > +++ b/drivers/firmware/arm_scmi/sensors.c
> > @@ -24,6 +24,7 @@ enum scmi_sensor_protocol_cmd {
> > SENSOR_LIST_UPDATE_INTERVALS = 0x8,
> > SENSOR_CONFIG_GET = 0x9,
> > SENSOR_CONFIG_SET = 0xA,
> > + SENSOR_CONTINUOUS_UPDATE_NOTIFY = 0xB,
> > };
> >
> > struct scmi_msg_resp_sensor_attributes {
> > @@ -133,10 +134,10 @@ struct scmi_msg_resp_sensor_list_update_intervals {
> > __le32 intervals[];
> > };
> >
> > -struct scmi_msg_sensor_trip_point_notify {
> > +struct scmi_msg_sensor_request_notify {
> > __le32 id;
> > __le32 event_control;
> > -#define SENSOR_TP_NOTIFY_ALL BIT(0)
> > +#define SENSOR_NOTIFY_ALL BIT(0)
> > };
> >
> > struct scmi_msg_set_sensor_trip_point {
> > @@ -198,6 +199,17 @@ struct scmi_sensor_trip_notify_payld {
> > __le32 trip_point_desc;
> > };
> >
> > +struct scmi_msg_sensor_continuous_update_notify {
> > + __le32 id;
> > + __le32 event_control;
> > +};
>
> This struct appears unused and redundant to struct
> scmi_msg_sensor_request_notify.
>
Seems so, I'll remove.
> [...]
>
> > @@ -850,20 +892,58 @@ static void *scmi_sensor_fill_custom_report(const struct scmi_handle *handle,
> > const void *payld, size_t payld_sz,
> > void *report, u32 *src_id)
> > {
> > + void *rep = NULL;
> > const struct scmi_sensor_trip_notify_payld *p = payld;
> > struct scmi_sensor_trip_point_report *r = report;
>
> Above two variables should be moved into the first case block.
>
Yes, not sure why they ended up there.
Regards
Cristian
> Best regards,
>
> Peter
>
> >
> > - if (evt_id != SCMI_EVENT_SENSOR_TRIP_POINT_EVENT ||
> > - sizeof(*p) != payld_sz)
> > - return NULL;
> > + switch (evt_id) {
> > + case SCMI_EVENT_SENSOR_TRIP_POINT_EVENT:
> > + {
> > + if (sizeof(*p) != payld_sz)
> > + break;
> >
> > - r->timestamp = timestamp;
> > - r->agent_id = le32_to_cpu(p->agent_id);
> > - r->sensor_id = le32_to_cpu(p->sensor_id);
> > - r->trip_point_desc = le32_to_cpu(p->trip_point_desc);
> > - *src_id = r->sensor_id;
> > + r->timestamp = timestamp;
> > + r->agent_id = le32_to_cpu(p->agent_id);
> > + r->sensor_id = le32_to_cpu(p->sensor_id);
> > + r->trip_point_desc = le32_to_cpu(p->trip_point_desc);
> > + *src_id = r->sensor_id;
> > + rep = r;
> > + break;
> > + }
> > + case SCMI_EVENT_SENSOR_UPDATE:
> > + {
> > + int i;
> > + struct scmi_sensor_info *s;
> > + const struct scmi_sensor_update_notify_payld *p = payld;
> > + struct scmi_sensor_update_report *r = report;
> > + struct sensors_info *sinfo = handle->sensor_priv;
> > +
> > + /* payld_sz is variable for this event */
> > + r->sensor_id = le32_to_cpu(p->sensor_id);
> > + if (r->sensor_id >= sinfo->num_sensors)
> > + break;
> > + r->timestamp = timestamp;
> > + r->agent_id = le32_to_cpu(p->agent_id);
> > + s = &sinfo->sensors[r->sensor_id];
> > + /*
> > + * The generated report r (@struct scmi_sensor_update_report)
> > + * was pre-allocated to contain up to SCMI_MAX_NUM_SENSOR_AXIS
> > + * readings: here it is filled with the effective @num_axis
> > + * readings defined for this sensor or 1 for scalar sensors.
> > + */
> > + r->readings_count = s->num_axis ?: 1;
> > + for (i = 0; i < r->readings_count; i++)
> > + scmi_parse_sensor_readings(&r->readings[i],
> > + &p->readings[i]);
> > + *src_id = r->sensor_id;
> > + rep = r;
> > + break;
> > + }
> > + default:
> > + break;
> > + }
> >
> > - return r;
> > + return rep;
> > }
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-11-10 17:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 20:10 [PATCH v2 0/6] SCMIv3.0 Sensor Extensions Cristian Marussi
2020-10-26 20:10 ` [PATCH v2 1/6] firmware: arm_scmi: rework scmi_sensors_protocol_init Cristian Marussi
2020-10-26 20:10 ` [PATCH v2 2/6] firmware: arm_scmi: add SCMIv3.0 Sensors descriptors extensions Cristian Marussi
2020-11-10 16:00 ` Mailing Lists
2020-11-10 17:21 ` Cristian Marussi
2020-11-10 17:50 ` Peter Hilber
2020-11-10 19:19 ` Cristian Marussi
2020-10-26 20:10 ` [PATCH v2 3/6] hwmon: scmi: update hwmon internal scale data type Cristian Marussi
2020-10-26 20:10 ` [PATCH v2 4/6] firmware: arm_scmi: add SCMIv3.0 Sensors timestamped reads Cristian Marussi
2020-11-10 16:01 ` Peter Hilber
2020-11-10 17:04 ` Cristian Marussi
2020-11-10 17:14 ` Peter Hilber
2020-10-26 20:10 ` [PATCH v2 5/6] firmware: arm_scmi: add SCMIv3.0 Sensor configuration support Cristian Marussi
2020-10-26 20:10 ` [PATCH v2 6/6] firmware: arm_scmi: add SCMIv3.0 Sensor notifications Cristian Marussi
2020-11-10 16:01 ` Peter Hilber
2020-11-10 17:09 ` Cristian Marussi [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=20201110170922.GE42652@e120937-lin \
--to=cristian.marussi@arm.com \
--cc=Igor.Skalkin@opensynergy.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=egranata@google.com \
--cc=james.quinlan@broadcom.com \
--cc=jbhayana@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=mikhail.golubev@opensynergy.com \
--cc=peter.hilber@opensynergy.com \
--cc=sudeep.holla@arm.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