Skip to content

Commit 45bea0e

Browse files
Hoang Nguyennhutnguyenkc
authored andcommitted
hal: renesas: rza: Add support MIPI-DSI for RZ/A3M
Add support MIPI-DSI for RZ/A3M Signed-off-by: Hoang Nguyen <[email protected]> Signed-off-by: Nhut Nguyen <[email protected]>
1 parent d2bb84b commit 45bea0e

File tree

8 files changed

+2134
-0
lines changed

8 files changed

+2134
-0
lines changed

drivers/rz/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,7 @@ zephyr_library_sources_ifdef(CONFIG_USE_RZ_FSP_QSPI_SPIBSC
114114

115115
zephyr_library_sources_ifdef(CONFIG_USE_RZ_FSP_QSPI_XSPI
116116
fsp/src/${SOC_SERIES_PREFIX}/r_xspi_qspi/r_xspi_qspi.c)
117+
118+
zephyr_library_sources_ifdef(CONFIG_USE_RZ_FSP_MIPI_DSI
119+
fsp/src/${SOC_SERIES_PREFIX}/r_mipi_dsi_b/r_mipi_dsi_b.c
120+
fsp/src/${SOC_SERIES_PREFIX}/r_mipi_phy_b/r_mipi_phy_b.c)

drivers/rz/fsp/inc/api/r_mipi_dsi_api.h

Lines changed: 546 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef R_MIPI_DSI_B_H
8+
#define R_MIPI_DSI_B_H
9+
10+
/***********************************************************************************************************************
11+
* Includes
12+
**********************************************************************************************************************/
13+
14+
#include "bsp_api.h"
15+
#include "r_mipi_dsi_api.h"
16+
17+
/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
18+
FSP_HEADER
19+
20+
/*******************************************************************************************************************//**
21+
* @addtogroup MIPI_DSI_B
22+
* @{
23+
**********************************************************************************************************************/
24+
25+
/***********************************************************************************************************************
26+
* Macro definitions
27+
**********************************************************************************************************************/
28+
29+
/***********************************************************************************************************************
30+
* Typedef definitions
31+
**********************************************************************************************************************/
32+
typedef enum e_mipi_dsi_clock_state
33+
{
34+
MIPI_DSI_CLOCK_STATE_IDLE, ///< MIPI DSI Clock is off
35+
MIPI_DSI_CLOCK_STATE_STARTING, ///< MIPI DSI Clock starting
36+
MIPI_DSI_CLOCK_STATE_STARTED, ///< MIPI DSI Clock is started
37+
MIPI_DSI_CLOCK_STATE_STOPPING, ///< MIPI DSI Clock is stopping
38+
} mipi_dsi_clock_state_t;
39+
40+
/** MIPI DSI interrupt configuration */
41+
typedef struct st_mipi_dsi_b_irq_cfg
42+
{
43+
uint8_t ipl; ///< Interrupt priority
44+
IRQn_Type irq; ///< Interrupt vector number
45+
} mipi_dsi_b_irq_cfg_t;
46+
47+
/** Extended configuration structure for MIPI DSI. */
48+
typedef struct st_mipi_dsi_b_extended_cfg
49+
{
50+
/* Interrupt configuration */
51+
mipi_dsi_b_irq_cfg_t dsi_seq0; ///< Sequence 0 interrupt
52+
mipi_dsi_b_irq_cfg_t dsi_seq1; ///< Sequence 1 interrupt
53+
mipi_dsi_b_irq_cfg_t dsi_ferr; ///< DSI Fatal Error interrupt
54+
mipi_dsi_b_irq_cfg_t dsi_ppi; ///< D-PHY PPI interrupt
55+
mipi_dsi_b_irq_cfg_t dsi_rcv; ///< Receive interrupt
56+
mipi_dsi_b_irq_cfg_t dsi_vin1; ///< Video Input Operation interrupt
57+
58+
uint32_t dsi_rxie; ///< Receive interrupt enable configuration
59+
uint32_t dsi_ferrie; ///< Fatal error interrupt enable configuration
60+
uint32_t dsi_plie; ///< Physical lane interrupt enable configuration
61+
uint32_t dsi_vmie; ///< Video mode interrupt enable configuration
62+
uint32_t dsi_sqch0ie; ///< Sequence Channel 0 interrupt enable configuration
63+
uint32_t dsi_sqch1ie; ///< Sequence Channel 1 interrupt enable configuration
64+
} mipi_dsi_b_extended_cfg_t;
65+
66+
/** MIPI DSI instance control block. */
67+
typedef struct st_mipi_dsi_b_instance_ctrl
68+
{
69+
uint32_t open; ///< Interface is open
70+
bool data_ulps_active; ///< Data lane ULPS status
71+
bool clock_ulps_active; ///< Data lane ULPS status
72+
bool video_started; ///< If video started or not
73+
mipi_dsi_clock_state_t clock_state; ///< Clock state
74+
mipi_dsi_lane_t ulps_status; ///< Ultra-low Power State active status
75+
mipi_dsi_cfg_t const * p_cfg; ///< Pointer to configuration structure used to open the interface
76+
void (* p_callback)(mipi_dsi_callback_args_t *); ///< Pointer to callback that is called when an adc_event_t occurs.
77+
void const * p_context; ///< Pointer to context to be passed into callback function
78+
mipi_dsi_callback_args_t * p_callback_memory; ///< Pointer to non-secure memory that can be used to pass arguments to a callback in non-secure memory.
79+
} mipi_dsi_b_instance_ctrl_t;
80+
81+
/**********************************************************************************************************************
82+
* Exported global variables
83+
**********************************************************************************************************************/
84+
85+
/** @cond INC_HEADER_DEFS_SEC */
86+
/** Filled in Interface API structure for this Instance. */
87+
extern const mipi_dsi_api_t g_mipi_dsi;
88+
89+
/** @endcond */
90+
91+
/***********************************************************************************************************************
92+
* Exported global functions (to be accessed by other files)
93+
**********************************************************************************************************************/
94+
95+
/***********************************************************************************************************************
96+
* Public APIs
97+
**********************************************************************************************************************/
98+
fsp_err_t R_MIPI_DSI_B_Open(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_cfg_t const * const p_cfg);
99+
fsp_err_t R_MIPI_DSI_B_Close(mipi_dsi_ctrl_t * const p_api_ctrl);
100+
fsp_err_t R_MIPI_DSI_B_Start(mipi_dsi_ctrl_t * const p_api_ctrl);
101+
fsp_err_t R_MIPI_DSI_B_UlpsEnter(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_lane_t lane);
102+
fsp_err_t R_MIPI_DSI_B_UlpsExit(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_lane_t lane);
103+
fsp_err_t R_MIPI_DSI_B_Stop(mipi_dsi_ctrl_t * const p_api_ctrl);
104+
fsp_err_t R_MIPI_DSI_B_Command(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_cmd_t * p_cmd);
105+
fsp_err_t R_MIPI_DSI_B_StatusGet(mipi_dsi_ctrl_t * const p_api_ctrl, mipi_dsi_status_t * p_status);
106+
107+
/*******************************************************************************************************************//**
108+
* @} (end defgroup MIPI_DSI_B)
109+
**********************************************************************************************************************/
110+
111+
/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
112+
FSP_FOOTER
113+
114+
#endif // R_MIPI_DSI_B_H
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef R_MIPI_PHY_H
8+
#define R_MIPI_PHY_H
9+
10+
/***********************************************************************************************************************
11+
* Includes
12+
**********************************************************************************************************************/
13+
14+
#include "r_mipi_phy_b.h"
15+
16+
/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
17+
FSP_HEADER
18+
19+
/***********************************************************************************************************************
20+
* Macro definitions
21+
**********************************************************************************************************************/
22+
23+
/***********************************************************************************************************************
24+
* Typedef definitions
25+
**********************************************************************************************************************/
26+
27+
/**********************************************************************************************************************
28+
* Exported global variables
29+
**********************************************************************************************************************/
30+
31+
/***********************************************************************************************************************
32+
* Exported global functions (to be accessed by other files)
33+
**********************************************************************************************************************/
34+
35+
/***********************************************************************************************************************
36+
* Instance Functions (Note: This is not a public API and should not be called directly)
37+
**********************************************************************************************************************/
38+
39+
/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
40+
FSP_FOOTER
41+
42+
#endif // R_MIPI_PHY_H
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/*
2+
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
#ifndef R_MIPI_PHY_B_H
8+
#define R_MIPI_PHY_B_H
9+
10+
/***********************************************************************************************************************
11+
* Includes
12+
**********************************************************************************************************************/
13+
14+
#include "bsp_api.h"
15+
16+
/* Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
17+
FSP_HEADER
18+
19+
/***********************************************************************************************************************
20+
* Macro definitions
21+
**********************************************************************************************************************/
22+
#ifndef __PACKED_STRUCT
23+
#define __PACKED_STRUCT struct __attribute__((packed, aligned(1)))
24+
#endif
25+
26+
/***********************************************************************************************************************
27+
* Typedef definitions
28+
**********************************************************************************************************************/
29+
30+
/** MIPI PHY D-PHY power mode transition timing */
31+
typedef struct st_mipi_phy_b_timing
32+
{
33+
uint32_t t_init; ///< Minimum duration of the TINIT state (Units: PCLKA cycles)
34+
uint8_t t_clk_prep; ///< Duration of the clock lane LP-00 state (immediately before entry to the HS-0 state)
35+
uint8_t t_hs_prep; ///< Duration of the data lane LP-00 state (immediately before entry to the HS-0 state)
36+
uint8_t t_clk_zero; ///< TCLKZERO setting.
37+
uint8_t t_clk_pre; ///< TCLKPRE setting.
38+
uint8_t t_clk_post; ///< TCLKPOST setting.
39+
uint8_t t_clk_trail; ///< TCLKTRAIL setting.
40+
uint8_t t_hs_zero; ///< THSZERO setting.
41+
uint8_t t_hs_trail; ///< THSTRAIL setting.
42+
uint8_t t_hs_exit; ///< THSEXIT setting.
43+
uint8_t t_lp_exit; ///< Low-power transition time to High-Speed mode
44+
} mipi_phy_b_timing_t;
45+
46+
/** MIPI_PHY configuration structure. */
47+
typedef struct st_mipi_phy_b_cfg
48+
{
49+
mipi_phy_b_timing_t const * p_timing; ///< Pointer to D-PHY HS/LP transition timing values
50+
} mipi_phy_b_cfg_t;
51+
52+
/** MIPI_PHY instance control block. */
53+
typedef struct st_mipi_phy_b_ctrl
54+
{
55+
uint32_t open;
56+
mipi_phy_b_cfg_t const * p_cfg;
57+
} mipi_phy_b_ctrl_t;
58+
59+
/** Private Interface definition for MIPI PHY peripheral */
60+
typedef struct st_mipi_phy_b_api
61+
{
62+
/** Open MIPI PHY device.
63+
* @param[in,out] p_ctrl Pointer to MIPI PHY interface control block.
64+
* @param[in] p_cfg Pointer to MIPI PHY configuration structure.
65+
*/
66+
fsp_err_t (* open)(mipi_phy_b_ctrl_t * const p_ctrl, mipi_phy_b_cfg_t const * const p_cfg);
67+
68+
/** Close MIPI PHY device.
69+
* @param[in] p_ctrl Pointer to MIPI PHY interface control block.
70+
*/
71+
fsp_err_t (* close)(mipi_phy_b_ctrl_t * const p_ctrl);
72+
} mipi_phy_b_api_t;
73+
74+
/** This structure encompasses everything that is needed to use an instance of this interface. */
75+
typedef struct st_mipi_phy_b_instance
76+
{
77+
mipi_phy_b_ctrl_t * p_ctrl; ///< Pointer to the control structure for this instance
78+
mipi_phy_b_cfg_t const * p_cfg; ///< Pointer to the configuration structure for this instance
79+
mipi_phy_b_api_t const * p_api; ///< Pointer to the API structure for this instance
80+
} mipi_phy_instance_t;
81+
82+
/**********************************************************************************************************************
83+
* Exported global variables
84+
**********************************************************************************************************************/
85+
86+
/** @cond INC_HEADER_DEFS_SEC */
87+
/** Filled in Interface API structure for this Instance. */
88+
extern const mipi_phy_b_api_t g_mipi_phy;
89+
90+
/** @endcond */
91+
92+
/***********************************************************************************************************************
93+
* Exported global functions (to be accessed by other files)
94+
**********************************************************************************************************************/
95+
96+
/***********************************************************************************************************************
97+
* Instance Functions (Note: This is not a public API and should not be called directly)
98+
**********************************************************************************************************************/
99+
fsp_err_t r_mipi_phy_b_open(mipi_phy_b_ctrl_t * const p_api_ctrl, mipi_phy_b_cfg_t const * const p_cfg);
100+
fsp_err_t r_mipi_phy_b_close(mipi_phy_b_ctrl_t * const p_api_ctrl);
101+
102+
/* Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
103+
FSP_FOOTER
104+
105+
#endif // R_MIPI_PHY_B_H

0 commit comments

Comments
 (0)