linux/drivers/firmware/arm_scmi/sensors.c

// SPDX-License-Identifier: GPL-2.0
/*
 * System Control and Management Interface (SCMI) Sensor Protocol
 *
 * Copyright (C) 2018-2022 ARM Ltd.
 */

#define pr_fmt(fmt)

#include <linux/bitfield.h>
#include <linux/module.h>
#include <linux/scmi_protocol.h>

#include "protocols.h"
#include "notify.h"

/* Updated only after ALL the mandatory features for that version are merged */
#define SCMI_PROTOCOL_SUPPORTED_VERSION

#define SCMI_MAX_NUM_SENSOR_AXIS
#define SCMIv2_SENSOR_PROTOCOL

enum scmi_sensor_protocol_cmd {};

struct scmi_msg_resp_sensor_attributes {};

/* v3 attributes_low macros */
#define SUPPORTS_UPDATE_NOTIFY(x)
#define SENSOR_TSTAMP_EXP(x)
#define SUPPORTS_TIMESTAMP(x)
#define SUPPORTS_EXTEND_ATTRS(x)

/* v2 attributes_high macros */
#define SENSOR_UPDATE_BASE(x)
#define SENSOR_UPDATE_SCALE(x)

/* v3 attributes_high macros */
#define SENSOR_AXIS_NUMBER(x)
#define SUPPORTS_AXIS(x)

/* v3 resolution macros */
#define SENSOR_RES(x)
#define SENSOR_RES_EXP(x)

struct scmi_msg_resp_attrs {};

struct scmi_msg_sensor_description {};

struct scmi_msg_resp_sensor_description {};

/* Base scmi_sensor_descriptor size excluding extended attrs after name */
#define SCMI_MSG_RESP_SENS_DESCR_BASE_SZ

/* Sign extend to a full s32 */
#define S32_EXT(v)

struct scmi_msg_sensor_axis_description_get {};

struct scmi_msg_resp_sensor_axis_description {};

struct scmi_msg_resp_sensor_axis_names_description {};

/* Base scmi_axis_descriptor size excluding extended attrs after name */
#define SCMI_MSG_RESP_AXIS_DESCR_BASE_SZ

struct scmi_msg_sensor_list_update_intervals {};

struct scmi_msg_resp_sensor_list_update_intervals {};

struct scmi_msg_sensor_request_notify {};

struct scmi_msg_set_sensor_trip_point {};

struct scmi_msg_sensor_config_set {};

struct scmi_msg_sensor_reading_get {};

struct scmi_resp_sensor_reading_complete {};

struct scmi_sensor_reading_resp {};

struct scmi_resp_sensor_reading_complete_v3 {};

struct scmi_sensor_trip_notify_payld {};

struct scmi_sensor_update_notify_payld {};

struct sensors_info {};

static int scmi_sensor_attributes_get(const struct scmi_protocol_handle *ph,
				      struct sensors_info *si)
{}

static inline void scmi_parse_range_attrs(struct scmi_range_attrs *out,
					  const struct scmi_msg_resp_attrs *in)
{}

struct scmi_sens_ipriv {};

static void iter_intervals_prepare_message(void *message,
					   unsigned int desc_index,
					   const void *p)
{}

static int iter_intervals_update_state(struct scmi_iterator_state *st,
				       const void *response, void *p)
{}

static int
iter_intervals_process_response(const struct scmi_protocol_handle *ph,
				const void *response,
				struct scmi_iterator_state *st, void *p)
{}

static int scmi_sensor_update_intervals(const struct scmi_protocol_handle *ph,
					struct scmi_sensor_info *s)
{}

struct scmi_apriv {};

static void iter_axes_desc_prepare_message(void *message,
					   const unsigned int desc_index,
					   const void *priv)
{}

static int
iter_axes_desc_update_state(struct scmi_iterator_state *st,
			    const void *response, void *priv)
{}

static int
iter_axes_desc_process_response(const struct scmi_protocol_handle *ph,
				const void *response,
				struct scmi_iterator_state *st, void *priv)
{}

static int
iter_axes_extended_name_update_state(struct scmi_iterator_state *st,
				     const void *response, void *priv)
{}

static int
iter_axes_extended_name_process_response(const struct scmi_protocol_handle *ph,
					 const void *response,
					 struct scmi_iterator_state *st,
					 void *priv)
{}

static int
scmi_sensor_axis_extended_names_get(const struct scmi_protocol_handle *ph,
				    struct scmi_sensor_info *s)
{}

static int scmi_sensor_axis_description(const struct scmi_protocol_handle *ph,
					struct scmi_sensor_info *s,
					u32 version)
{}

static void iter_sens_descr_prepare_message(void *message,
					    unsigned int desc_index,
					    const void *priv)
{}

static int iter_sens_descr_update_state(struct scmi_iterator_state *st,
					const void *response, void *priv)
{}

static int
iter_sens_descr_process_response(const struct scmi_protocol_handle *ph,
				 const void *response,
				 struct scmi_iterator_state *st, void *priv)

{}

static int scmi_sensor_description_get(const struct scmi_protocol_handle *ph,
				       struct sensors_info *si)
{}

static inline int
scmi_sensor_request_notify(const struct scmi_protocol_handle *ph, u32 sensor_id,
			   u8 message_id, bool enable)
{}

static int scmi_sensor_trip_point_notify(const struct scmi_protocol_handle *ph,
					 u32 sensor_id, bool enable)
{}

static int
scmi_sensor_continuous_update_notify(const struct scmi_protocol_handle *ph,
				     u32 sensor_id, bool enable)
{}

static int
scmi_sensor_trip_point_config(const struct scmi_protocol_handle *ph,
			      u32 sensor_id, u8 trip_id, u64 trip_value)
{}

static int scmi_sensor_config_get(const struct scmi_protocol_handle *ph,
				  u32 sensor_id, u32 *sensor_config)
{}

static int scmi_sensor_config_set(const struct scmi_protocol_handle *ph,
				  u32 sensor_id, u32 sensor_config)
{}

/**
 * scmi_sensor_reading_get  - Read scalar sensor value
 * @ph: Protocol handle
 * @sensor_id: Sensor ID
 * @value: The 64bit value sensor reading
 *
 * This function returns a single 64 bit reading value representing the sensor
 * value; if the platform SCMI Protocol implementation and the sensor support
 * multiple axis and timestamped-reads, this just returns the first axis while
 * dropping the timestamp value.
 * Use instead the @scmi_sensor_reading_get_timestamped to retrieve the array of
 * timestamped multi-axis values.
 *
 * Return: 0 on Success
 */
static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph,
				   u32 sensor_id, u64 *value)
{}

static inline void
scmi_parse_sensor_readings(struct scmi_sensor_reading *out,
			   const struct scmi_sensor_reading_resp *in)
{}

/**
 * scmi_sensor_reading_get_timestamped  - Read multiple-axis timestamped values
 * @ph: Protocol handle
 * @sensor_id: Sensor ID
 * @count: The length of the provided @readings array
 * @readings: An array of elements each representing a timestamped per-axis
 *	      reading of type @struct scmi_sensor_reading.
 *	      Returned readings are ordered as the @axis descriptors array
 *	      included in @struct scmi_sensor_info and the max number of
 *	      returned elements is min(@count, @num_axis); ideally the provided
 *	      array should be of length @count equal to @num_axis.
 *
 * Return: 0 on Success
 */
static int
scmi_sensor_reading_get_timestamped(const struct scmi_protocol_handle *ph,
				    u32 sensor_id, u8 count,
				    struct scmi_sensor_reading *readings)
{}

static const struct scmi_sensor_info *
scmi_sensor_info_get(const struct scmi_protocol_handle *ph, u32 sensor_id)
{}

static int scmi_sensor_count_get(const struct scmi_protocol_handle *ph)
{}

static const struct scmi_sensor_proto_ops sensor_proto_ops =;

static bool scmi_sensor_notify_supported(const struct scmi_protocol_handle *ph,
					 u8 evt_id, u32 src_id)
{}

static int scmi_sensor_set_notify_enabled(const struct scmi_protocol_handle *ph,
					  u8 evt_id, u32 src_id, bool enable)
{}

static void *
scmi_sensor_fill_custom_report(const struct scmi_protocol_handle *ph,
			       u8 evt_id, ktime_t timestamp,
			       const void *payld, size_t payld_sz,
			       void *report, u32 *src_id)
{}

static int scmi_sensor_get_num_sources(const struct scmi_protocol_handle *ph)
{}

static const struct scmi_event sensor_events[] =;

static const struct scmi_event_ops sensor_event_ops =;

static const struct scmi_protocol_events sensor_protocol_events =;

static int scmi_sensors_protocol_init(const struct scmi_protocol_handle *ph)
{}

static const struct scmi_protocol scmi_sensors =;

DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(sensors, scmi_sensors)