1\ingroup GroupModules Modules
2\defgroup GroupSCMISensorRequester SCMI Sensor Protocol Requester
3
4# SCMI Sensor Requester architecture
5
6Copyright (c) 2022, Arm Limited. All rights reserved.
7
8
9## Overview
10
11The SCMI Sensor Requester is used to send sensor protocol SCMI commands
12to a completer. It also receives the sensor protocol SCMI commands' responses.
13
14The SCMI Sensor Requester implements the driver interface provided by the HAL
15sensor. So it is treated as if it was a sensor driver. Hence an entity that
16requires to get a sensor value doesn't need to know if the sensor is local or
17if is required to access the sensor via the SCMI. This is achievable using the
18Sensor HAL.
19
20The SCMI Sensor Requester implements the get_value interface provided by the
21HAL. It acts as an asynchronous sensor driver. This is because SCMI Sensor
22Requester issues a "Sensor Reading Get" command to the entity responsible of
23the actual sensor with no blocking call. When the required entity responds back
24the SCMI Sensor Requester handles the response and send the value back to the
25Sensor HAL.
26
27## Architecture
28
29The following sequence diagram demonstrates the communication between the
30involved modules starting from a client requesting sensor data until it gets
31the response.
32
33                            Sequence diagram
34    +--------+     +------------+     +-----------------+         +------+
35    | Client |     | Sensor HAL |     | SCMI Sensor Req |         | SCMI |
36    +--------+     +------------+     +-----------------+         +------+
37         | get_data()     |                     |                     |
38         |--------------->| get_value()         |                     |
39         |                |-------------------->| scmi_send_message() |
40         |                |                     |-------------------->|
41                                       ..
42                                       ..
43                                       ..
44                                             scmi_sensor_req_message_handler()
45         |                | reading_complete()  |<--------------------|
46         | put_event()    |<--------------------|                     |
47         |<---------------|                     |                     |
48
49
50## Configuration
51
52The following diagram shows an example configuration for the SCMI sensor
53requester in a primary SCP which needs to get a sensor value accessed by
54another SCP.
55
56                              Configuration example
57    +----------------------------------------------------------------------+
58    |  Primary SCP                                                         |
59    |----------------------------------------------------------------------|
60    |                                                                      |
61    | +-------------+ +-------------+ +---------------+   +-------------+  |
62    | |Client module| |Sensor HAL   | |SCMI Sensor Req|   | SCMI        |  |
63    | |-------------| |-------------| |--------   ----|   |-------------+  |
64    | | +---------+ | | +---------+ | | +-----------+ |   | +---------+ |  |
65    | | |element_A|-+-+>|element_B|-+-+>|element_C  |-+-+-+>|element_D| |  |
66    | | +---------+ | | +---------+ | | +-----------+ | | | +---------+ |  |
67    | +-------------+ +-------------+ +---------------+ | +-------------+  |
68    |                                                   |                  |
69    +---------------------------------------------------+------------------+
70                                                        |
71                       +----------------------+         |
72                       |Secondary SCP         |         |
73                       |----------------------|         |
74                       | +------------------+ |         |
75                       | |Sensor HAL        | |         |
76                       | |------------------| |         |
77                       | | +--------------+ | |         |
78                       | | |element_X     |<+-+---------+
79                       | | +--------------+ | | sensor_req_c is configured to
80                       +----------------------+ use sensor_hal_x in the
81                                                completer by setting its ID.
82
83## Limitations
84
85Currently only the Sensor Reading Get command is implemented.
86