|  | 
|  | 1 | +/* | 
|  | 2 | + * Copyright 2025 NXP | 
|  | 3 | + * | 
|  | 4 | + * SPDX-License-Identifier: Apache-2.0 | 
|  | 5 | + */ | 
|  | 6 | + | 
|  | 7 | +/** | 
|  | 8 | + * @file | 
|  | 9 | + * @brief SCMI NXP BBNSM domain protocol helpers | 
|  | 10 | + */ | 
|  | 11 | + | 
|  | 12 | +#ifndef _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_BBM_H_ | 
|  | 13 | +#define _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_BBM_H_ | 
|  | 14 | + | 
|  | 15 | +#include <zephyr/drivers/firmware/scmi/protocol.h> | 
|  | 16 | + | 
|  | 17 | +#define SCMI_PROTOCOL_NXP_BBM	129 | 
|  | 18 | + | 
|  | 19 | +/*! | 
|  | 20 | + * @name SCMI NXP BBM button notification flags | 
|  | 21 | + */ | 
|  | 22 | +/** @{ */ | 
|  | 23 | +/*! Enable button notifications */ | 
|  | 24 | +#define SCMI_BBM_NOTIFY_BUTTON_DETECT(x)  (((x) & 0x1U) << 0U) | 
|  | 25 | +/** @} */ | 
|  | 26 | + | 
|  | 27 | +/** | 
|  | 28 | + * @brief Bbm protocol command message IDs | 
|  | 29 | + */ | 
|  | 30 | +enum scmi_bbm_message { | 
|  | 31 | +	SCMI_PROTO_BBM_PROTOCOL_RTC_EVENT = 0x0, | 
|  | 32 | +	SCMI_PROTO_BBM_PROTOCOL_BUTTON_EVENT = 0x1, | 
|  | 33 | +	SCMI_PROTO_BBM_BBM_GPR_SET = 0x3, | 
|  | 34 | +	SCMI_PROTO_BBM_BBM_GPR_GET = 0x4, | 
|  | 35 | +	SCMI_PROTO_BBM_BBM_RTC_ATTRIBUTES = 0x5, | 
|  | 36 | +	SCMI_PROTO_BBM_BBM_RTC_TIME_SET = 0x6, | 
|  | 37 | +	SCMI_PROTO_BBM_BBM_RTC_TIME_GET = 0x7, | 
|  | 38 | +	SCMI_PROTO_BBM_BBM_RTC_ALARM_SET = 0x8, | 
|  | 39 | +	SCMI_PROTO_BBM_BBM_BUTTON_GET = 0x9, | 
|  | 40 | +	SCMI_PROTO_BBM_BBM_RTC_NOTIFY = 0xA, | 
|  | 41 | +	SCMI_PROTO_BBM_BBM_BUTTON_NOTIFY = 0xB, | 
|  | 42 | +	SCMI_PROTO_BBM_BBM_RTC_STATE = 0xC, | 
|  | 43 | +	SCMI_PROTO_BBM_NEGOTIATE_PROTOCOL_VERSION = 0x10, | 
|  | 44 | +}; | 
|  | 45 | + | 
|  | 46 | +/** | 
|  | 47 | + * @brief Set up BBM button notify message | 
|  | 48 | + * | 
|  | 49 | + * @param flags to enable or disable button notify for agent | 
|  | 50 | + * | 
|  | 51 | + * @retval 0 if successful | 
|  | 52 | + * @retval negative errno if failure | 
|  | 53 | + */ | 
|  | 54 | +int scmi_bbm_button_notify(uint32_t flags); | 
|  | 55 | + | 
|  | 56 | +/** | 
|  | 57 | + * @brief Read BBM button event message | 
|  | 58 | + * | 
|  | 59 | + * @param flags to get notification event from agent | 
|  | 60 | + * | 
|  | 61 | + * @retval 0 if successful | 
|  | 62 | + * @retval negative errno if failure | 
|  | 63 | + */ | 
|  | 64 | +int scmi_bbm_button_event(uint32_t *flags); | 
|  | 65 | + | 
|  | 66 | +/** | 
|  | 67 | + * @brief BBM event notification callback | 
|  | 68 | + * | 
|  | 69 | + * @param msg_id to determine and handle the corresponding event. | 
|  | 70 | + * | 
|  | 71 | + * @retval 0 if successful | 
|  | 72 | + * @retval negative errno if failure | 
|  | 73 | + */ | 
|  | 74 | +int scmi_bbm_event_protocol_cb(int32_t msg_id); | 
|  | 75 | +#endif /* _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_BBM_H_ */ | 
0 commit comments