Skip to content

Commit

Permalink
SW_MA PMIC sequence for 9230
Browse files Browse the repository at this point in the history
Signed-off-by: Juha Kortesalmi <[email protected]>
  • Loading branch information
JuhaKortesalmi committed Oct 22, 2024
1 parent 42e86be commit a93de20
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nrfs/include/internal/requests/nrfs_pmic_reqs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ enum {
NRFS_PMIC_PWM_GHOST_AVOID = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x08),
NRFS_PMIC_TEST_IF = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x09),
NRFS_PMIC_INFO = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x0A),
NRFS_PMIC_MA_IO_ON = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x0B),
NRFS_PMIC_MA_IO_OFF = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x0C)
};

#ifdef __cplusplus
Expand Down
12 changes: 12 additions & 0 deletions nrfs/include/internal/services/nrfs_pmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ typedef struct __NRFS_PACKED {
nrfs_ctx_t ctx; /**< Context of the message. */
} nrfs_pmic_pwm_ghost_avoid_req_t;

/** @brief PMIC MA I/O Power ON request structure. */
typedef struct __NRFS_PACKED {
nrfs_hdr_t hdr; /**< Header of the message. */
nrfs_ctx_t ctx; /**< Context of the message. */
} nrfs_pmic_ma_io_on_req_t;

/** @brief PMIC MA I/O Power OFF request structure. */
typedef struct __NRFS_PACKED {
nrfs_hdr_t hdr; /**< Header of the message. */
nrfs_ctx_t ctx; /**< Context of the message. */
} nrfs_pmic_ma_io_off_req_t;

/** @brief PMIC TEST IF request structure. */
typedef struct __NRFS_PACKED {
nrfs_hdr_t hdr; /**< Header of the message. */
Expand Down
40 changes: 40 additions & 0 deletions nrfs/include/services/nrfs_pmic.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,46 @@ nrfs_err_t nrfs_pmic_pwm_ghost_avoid_set(void * p_context);
*/
nrfs_err_t nrfs_pmic_pwm_ghost_avoid_set_no_rsp(void);

/**
* @brief Function for requesting MA (Modem and Application) I/O power on
*
* @param[in] p_context Pointer to the context to be associated with request.
*
* @retval NRFS_SUCCESS Request sent successfully.
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
* @retval NRFS_ERR_IPC Backend returned error during request sending.
*/
nrfs_err_t nrfs_pmic_ma_io_on(void * p_context);

/**
* @brief Function for requesting MA (Modem and Application) I/O power on with no response
*
* @retval NRFS_SUCCESS Request sent successfully.
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
* @retval NRFS_ERR_IPC Backend returned error during request sending.
*/
nrfs_err_t nrfs_pmic_ma_io_on_no_rsp(void);

/**
* @brief Function for requesting MA (Modem and Application) I/O power off
*
* @param[in] p_context Pointer to the context to be associated with request.
*
* @retval NRFS_SUCCESS Request sent successfully.
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
* @retval NRFS_ERR_IPC Backend returned error during request sending.
*/
nrfs_err_t nrfs_pmic_ma_io_off(void * p_context);

/**
* @brief Function for requesting MA (Modem and Application) I/O power off with no response
*
* @retval NRFS_SUCCESS Request sent successfully.
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
* @retval NRFS_ERR_IPC Backend returned error during request sending.
*/
nrfs_err_t nrfs_pmic_ma_io_off_no_rsp(void);

/**
* @brief Function for checking PMIC existence
*
Expand Down
58 changes: 58 additions & 0 deletions nrfs/src/services/nrfs_pmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,62 @@ nrfs_err_t nrfs_pmic_pwm_ghost_avoid_set_no_rsp(void)
return nrfs_backend_send(&req, sizeof(req));
}

nrfs_err_t nrfs_pmic_ma_io_on(void * p_context)
{
if (!m_cb.is_initialized) {
return NRFS_ERR_INVALID_STATE;
}

nrfs_pmic_ma_io_on_req_t req;

NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_ON);
req.ctx.ctx = (uint32_t)p_context;

return nrfs_backend_send(&req, sizeof(req));
}

nrfs_err_t nrfs_pmic_ma_io_on_no_rsp(void)
{
if (!m_cb.is_initialized) {
return NRFS_ERR_INVALID_STATE;
}

nrfs_pmic_ma_io_on_req_t req;

NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_ON);
NRFS_HDR_NO_RSP_SET(&req.hdr);

return nrfs_backend_send(&req, sizeof(req));
}

nrfs_err_t nrfs_pmic_ma_io_off(void * p_context)
{
if (!m_cb.is_initialized) {
return NRFS_ERR_INVALID_STATE;
}

nrfs_pmic_ma_io_off_req_t req;

NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_OFF);
req.ctx.ctx = (uint32_t)p_context;

return nrfs_backend_send(&req, sizeof(req));
}

nrfs_err_t nrfs_pmic_ma_io_off_no_rsp(void)
{
if (!m_cb.is_initialized) {
return NRFS_ERR_INVALID_STATE;
}

nrfs_pmic_ma_io_off_req_t req;

NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_OFF);
NRFS_HDR_NO_RSP_SET(&req.hdr);

return nrfs_backend_send(&req, sizeof(req));
}

nrfs_err_t nrfs_pmic_test_if_read(uint16_t addr, void *p_context)
{
if (!m_cb.is_initialized) {
Expand Down Expand Up @@ -332,6 +388,8 @@ void nrfs_pmic_service_notify(void *p_notification, size_t size)
case NRFS_PMIC_BLE_RADIO_OFF:
case NRFS_PMIC_PWM_DEFAULT:
case NRFS_PMIC_PWM_GHOST_AVOID:
case NRFS_PMIC_MA_IO_ON:
case NRFS_PMIC_MA_IO_OFF:
evt.type = NRFS_PMIC_EVT_APPLIED;
m_cb.handler(&evt, (void *)p_data->ctx.ctx);
break;
Expand Down

0 comments on commit a93de20

Please sign in to comment.