return ret;
}
-static int scmi_base_set_notify_enabled(const struct scmi_handle *handle,
+static int scmi_base_set_notify_enabled(const void *handle,
u8 evt_id, u32 src_id, bool enable)
{
int ret;
return ret;
}
-static void *scmi_base_fill_custom_report(const struct scmi_handle *handle,
+static void *scmi_base_fill_custom_report(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)
*/
if (pi->proto->events) {
ret = scmi_register_protocol_events(handle, pi->proto->id,
+ &pi->ph,
pi->proto->events);
if (ret)
dev_warn(handle->dev,
#define REVT_NOTIFY_SET_STATUS(revt, eid, sid, state) \
({ \
typeof(revt) r = revt; \
- r->proto->ops->set_notify_enabled(r->proto->ni->handle, \
+ r->proto->ops->set_notify_enabled(r->proto->ph, \
(eid), (sid), (state)); \
})
#define REVT_FILL_REPORT(revt, ...) \
({ \
typeof(revt) r = revt; \
- r->proto->ops->fill_custom_report(r->proto->ni->handle, \
+ r->proto->ops->fill_custom_report(r->proto->ph, \
__VA_ARGS__); \
})
* events' descriptors, whose fixed-size is determined at
* compile time.
* @registered_mtx: A mutex to protect @registered_events_handlers
+ * @ph: SCMI protocol handle reference
* @registered_events_handlers: An hashtable containing all events' handlers
* descriptors registered for this protocol
*
struct scmi_registered_event **registered_events;
/* mutex to protect registered_events_handlers */
struct mutex registered_mtx;
+ const struct scmi_protocol_handle *ph;
DECLARE_HASHTABLE(registered_events_handlers, SCMI_REGISTERED_HASH_SZ);
};
* @handle: The handle identifying the platform instance against which the
* protocol's events are registered
* @proto_id: Protocol ID
+ * @ph: SCMI protocol handle.
* @ee: A structure describing the events supported by this protocol.
*
* Used by SCMI Protocols initialization code to register with the notification
* Return: 0 on Success
*/
int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id,
+ const struct scmi_protocol_handle *ph,
const struct scmi_protocol_events *ee)
{
int i;
struct scmi_notify_instance *ni;
const struct scmi_event *evt;
- if (!ee || !ee->ops || !ee->evts ||
+ if (!ee || !ee->ops || !ee->evts || !ph ||
(!ee->num_sources && !ee->ops->get_num_sources))
return -EINVAL;
if (ee->num_sources) {
num_sources = ee->num_sources;
} else {
- int nsrc = ee->ops->get_num_sources(handle);
+ int nsrc = ee->ops->get_num_sources(ph);
if (nsrc <= 0)
return -EINVAL;
if (IS_ERR(pd))
return PTR_ERR(pd);
+ pd->ph = ph;
for (i = 0; i < ee->num_events; i++, evt++) {
struct scmi_registered_event *r_evt;
* process context.
*/
struct scmi_event_ops {
- int (*get_num_sources)(const struct scmi_handle *handle);
- int (*set_notify_enabled)(const struct scmi_handle *handle,
+ int (*get_num_sources)(const void *handle);
+ int (*set_notify_enabled)(const void *handle,
u8 evt_id, u32 src_id, bool enabled);
- void *(*fill_custom_report)(const struct scmi_handle *handle,
+ void *(*fill_custom_report)(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id);
struct scmi_protocol_handle;
int scmi_register_protocol_events(const struct scmi_handle *handle, u8 proto_id,
+ const struct scmi_protocol_handle *ph,
const struct scmi_protocol_events *ee);
void scmi_deregister_protocol_events(const struct scmi_handle *handle,
u8 proto_id);
.power_scale_mw_get = scmi_power_scale_mw_get,
};
-static int scmi_perf_set_notify_enabled(const struct scmi_handle *handle,
+static int scmi_perf_set_notify_enabled(const void *handle,
u8 evt_id, u32 src_id, bool enable)
{
int ret, cmd_id;
return ret;
}
-static void *scmi_perf_fill_custom_report(const struct scmi_handle *handle,
+static void *scmi_perf_fill_custom_report(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)
return rep;
}
-static int scmi_perf_get_num_sources(const struct scmi_handle *handle)
+static int scmi_perf_get_num_sources(const void *handle)
{
- struct scmi_perf_info *pi = handle->perf_priv;
+ struct scmi_perf_info *pi =
+ ((const struct scmi_handle *)(handle))->perf_priv;
if (!pi)
return -EINVAL;
return ret;
}
-static int scmi_power_set_notify_enabled(const struct scmi_handle *handle,
+static int scmi_power_set_notify_enabled(const void *handle,
u8 evt_id, u32 src_id, bool enable)
{
int ret;
return ret;
}
-static void *scmi_power_fill_custom_report(const struct scmi_handle *handle,
+static void *scmi_power_fill_custom_report(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)
return r;
}
-static int scmi_power_get_num_sources(const struct scmi_handle *handle)
+static int scmi_power_get_num_sources(const void *handle)
{
- struct scmi_power_info *pinfo = handle->power_priv;
+ struct scmi_power_info *pinfo =
+ ((const struct scmi_handle *)(handle))->power_priv;
if (!pinfo)
return -EINVAL;
return ret;
}
-static int scmi_reset_set_notify_enabled(const struct scmi_handle *handle,
+static int scmi_reset_set_notify_enabled(const void *handle,
u8 evt_id, u32 src_id, bool enable)
{
int ret;
return ret;
}
-static void *scmi_reset_fill_custom_report(const struct scmi_handle *handle,
+static void *scmi_reset_fill_custom_report(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)
return r;
}
-static int scmi_reset_get_num_sources(const struct scmi_handle *handle)
+static int scmi_reset_get_num_sources(const void *handle)
{
- struct scmi_reset_info *pinfo = handle->reset_priv;
+ struct scmi_reset_info *pinfo =
+ ((const struct scmi_handle *)(handle))->reset_priv;
if (!pinfo)
return -EINVAL;
.config_set = scmi_sensor_config_set,
};
-static int scmi_sensor_set_notify_enabled(const struct scmi_handle *handle,
+static int scmi_sensor_set_notify_enabled(const void *handle,
u8 evt_id, u32 src_id, bool enable)
{
int ret;
return ret;
}
-static void *scmi_sensor_fill_custom_report(const struct scmi_handle *handle,
+static void *scmi_sensor_fill_custom_report(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)
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;
+ struct sensors_info *sinfo =
+ ((const struct scmi_handle *)(handle))->sensor_priv;
/* payld_sz is variable for this event */
r->sensor_id = le32_to_cpu(p->sensor_id);
return rep;
}
-static int scmi_sensor_get_num_sources(const struct scmi_handle *handle)
+static int scmi_sensor_get_num_sources(const void *handle)
{
- struct sensors_info *si = handle->sensor_priv;
+ struct sensors_info *si =
+ ((const struct scmi_handle *)(handle))->sensor_priv;
return si->num_sensors;
}
return ret;
}
-static int scmi_system_set_notify_enabled(const struct scmi_handle *handle,
+static int scmi_system_set_notify_enabled(const void *handle,
u8 evt_id, u32 src_id, bool enable)
{
int ret;
return ret;
}
-static void *scmi_system_fill_custom_report(const struct scmi_handle *handle,
+static void *scmi_system_fill_custom_report(const void *handle,
u8 evt_id, ktime_t timestamp,
const void *payld, size_t payld_sz,
void *report, u32 *src_id)