Skip to content

Commit 7e7503f

Browse files
SW_MA PMIC sequence for 9230
Signed-off-by: Juha Kortesalmi <[email protected]>
1 parent dbfe4a1 commit 7e7503f

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

nrfs/include/internal/requests/nrfs_pmic_reqs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ enum {
2424
NRFS_PMIC_PWM_GHOST_AVOID = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x08),
2525
NRFS_PMIC_TEST_IF = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x09),
2626
NRFS_PMIC_INFO = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x0A),
27+
NRFS_PMIC_MA_IO_ON = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x0B),
28+
NRFS_PMIC_MA_IO_OFF = NRFS_REQUEST_ID_DEF(NRFS_SERVICE_ID_PMIC, 0x0C)
2729
};
2830

2931
#ifdef __cplusplus

nrfs/include/internal/services/nrfs_pmic.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,18 @@ typedef struct __NRFS_PACKED {
115115
nrfs_ctx_t ctx; /**< Context of the message. */
116116
} nrfs_pmic_pwm_ghost_avoid_req_t;
117117

118+
/** @brief PMIC MA I/O Power ON request structure. */
119+
typedef struct __NRFS_PACKED {
120+
nrfs_hdr_t hdr; /**< Header of the message. */
121+
nrfs_ctx_t ctx; /**< Context of the message. */
122+
} nrfs_pmic_ma_io_on_req_t;
123+
124+
/** @brief PMIC MA I/O Power OFF request structure. */
125+
typedef struct __NRFS_PACKED {
126+
nrfs_hdr_t hdr; /**< Header of the message. */
127+
nrfs_ctx_t ctx; /**< Context of the message. */
128+
} nrfs_pmic_ma_io_off_req_t;
129+
118130
/** @brief PMIC TEST IF request structure. */
119131
typedef struct __NRFS_PACKED {
120132
nrfs_hdr_t hdr; /**< Header of the message. */

nrfs/include/services/nrfs_pmic.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,46 @@ nrfs_err_t nrfs_pmic_pwm_ghost_avoid_set(void * p_context);
223223
*/
224224
nrfs_err_t nrfs_pmic_pwm_ghost_avoid_set_no_rsp(void);
225225

226+
/**
227+
* @brief Function for requesting MA (Modem and Application) I/O power on
228+
*
229+
* @param[in] p_context Pointer to the context to be associated with request.
230+
*
231+
* @retval NRFS_SUCCESS Request sent successfully.
232+
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
233+
* @retval NRFS_ERR_IPC Backend returned error during request sending.
234+
*/
235+
nrfs_err_t nrfs_pmic_ma_io_on(void * p_context);
236+
237+
/**
238+
* @brief Function for requesting MA (Modem and Application) I/O power on with no response
239+
*
240+
* @retval NRFS_SUCCESS Request sent successfully.
241+
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
242+
* @retval NRFS_ERR_IPC Backend returned error during request sending.
243+
*/
244+
nrfs_err_t nrfs_pmic_ma_io_on_no_rsp(void);
245+
246+
/**
247+
* @brief Function for requesting MA (Modem and Application) I/O power off
248+
*
249+
* @param[in] p_context Pointer to the context to be associated with request.
250+
*
251+
* @retval NRFS_SUCCESS Request sent successfully.
252+
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
253+
* @retval NRFS_ERR_IPC Backend returned error during request sending.
254+
*/
255+
nrfs_err_t nrfs_pmic_ma_io_off(void * p_context);
256+
257+
/**
258+
* @brief Function for requesting MA (Modem and Application) I/O power off with no response
259+
*
260+
* @retval NRFS_SUCCESS Request sent successfully.
261+
* @retval NRFS_ERR_INVALID_STATE Service is uninitialized.
262+
* @retval NRFS_ERR_IPC Backend returned error during request sending.
263+
*/
264+
nrfs_err_t nrfs_pmic_ma_io_off_no_rsp(void);
265+
226266
/**
227267
* @brief Function for checking PMIC existence
228268
*

nrfs/src/services/nrfs_pmic.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,62 @@ nrfs_err_t nrfs_pmic_pwm_ghost_avoid_set_no_rsp(void)
260260
return nrfs_backend_send(&req, sizeof(req));
261261
}
262262

263+
nrfs_err_t nrfs_pmic_ma_io_on(void * p_context)
264+
{
265+
if (!m_cb.is_initialized) {
266+
return NRFS_ERR_INVALID_STATE;
267+
}
268+
269+
nrfs_pmic_ma_io_on_req_t req;
270+
271+
NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_ON);
272+
req.ctx.ctx = (uint32_t)p_context;
273+
274+
return nrfs_backend_send(&req, sizeof(req));
275+
}
276+
277+
nrfs_err_t nrfs_pmic_ma_io_on_no_rsp(void)
278+
{
279+
if (!m_cb.is_initialized) {
280+
return NRFS_ERR_INVALID_STATE;
281+
}
282+
283+
nrfs_pmic_ma_io_on_req_t req;
284+
285+
NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_ON);
286+
NRFS_HDR_NO_RSP_SET(&req.hdr);
287+
288+
return nrfs_backend_send(&req, sizeof(req));
289+
}
290+
291+
nrfs_err_t nrfs_pmic_ma_io_off(void * p_context)
292+
{
293+
if (!m_cb.is_initialized) {
294+
return NRFS_ERR_INVALID_STATE;
295+
}
296+
297+
nrfs_pmic_ma_io_off_req_t req;
298+
299+
NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_OFF);
300+
req.ctx.ctx = (uint32_t)p_context;
301+
302+
return nrfs_backend_send(&req, sizeof(req));
303+
}
304+
305+
nrfs_err_t nrfs_pmic_ma_io_off_no_rsp(void)
306+
{
307+
if (!m_cb.is_initialized) {
308+
return NRFS_ERR_INVALID_STATE;
309+
}
310+
311+
nrfs_pmic_ma_io_off_req_t req;
312+
313+
NRFS_SERVICE_HDR_FILL(&req, NRFS_PMIC_MA_IO_OFF);
314+
NRFS_HDR_NO_RSP_SET(&req.hdr);
315+
316+
return nrfs_backend_send(&req, sizeof(req));
317+
}
318+
263319
nrfs_err_t nrfs_pmic_test_if_read(uint16_t addr, void *p_context)
264320
{
265321
if (!m_cb.is_initialized) {
@@ -332,6 +388,8 @@ void nrfs_pmic_service_notify(void *p_notification, size_t size)
332388
case NRFS_PMIC_BLE_RADIO_OFF:
333389
case NRFS_PMIC_PWM_DEFAULT:
334390
case NRFS_PMIC_PWM_GHOST_AVOID:
391+
case NRFS_PMIC_MA_IO_ON:
392+
case NRFS_PMIC_MA_IO_OFF:
335393
evt.type = NRFS_PMIC_EVT_APPLIED;
336394
m_cb.handler(&evt, (void *)p_data->ctx.ctx);
337395
break;

0 commit comments

Comments
 (0)