17
17
#include <fsl_cache.h>
18
18
#endif
19
19
20
- #ifdef CONFIG_MCUX_ELCDIF_PXP
21
- #include <zephyr/drivers/dma.h>
22
- #include <zephyr/drivers/dma/dma_mcux_pxp.h>
23
- #endif
24
-
25
20
#include <zephyr/logging/log.h>
26
21
#include <zephyr/irq.h>
27
22
@@ -39,7 +34,6 @@ struct mcux_elcdif_config {
39
34
elcdif_rgb_mode_config_t rgb_mode ;
40
35
const struct pinctrl_dev_config * pincfg ;
41
36
const struct gpio_dt_spec backlight_gpio ;
42
- const struct device * pxp ;
43
37
};
44
38
45
39
struct mcux_elcdif_data {
@@ -54,22 +48,8 @@ struct mcux_elcdif_data {
54
48
struct k_sem sem ;
55
49
/* Tracks index of next active driver framebuffer */
56
50
uint8_t next_idx ;
57
- #ifdef CONFIG_MCUX_ELCDIF_PXP
58
- /* Given to when PXP completes operation */
59
- struct k_sem pxp_done ;
60
- #endif
61
51
};
62
52
63
- #ifdef CONFIG_MCUX_ELCDIF_PXP
64
- static void mcux_elcdif_pxp_callback (const struct device * dma_dev , void * user_data ,
65
- uint32_t channel , int ret )
66
- {
67
- struct mcux_elcdif_data * data = user_data ;
68
-
69
- k_sem_give (& data -> pxp_done );
70
- }
71
- #endif /* CONFIG_MCUX_ELCDIF_PXP */
72
-
73
53
static int mcux_elcdif_write (const struct device * dev , const uint16_t x , const uint16_t y ,
74
54
const struct display_buffer_descriptor * desc , const void * buf )
75
55
{
@@ -92,15 +72,6 @@ static int mcux_elcdif_write(const struct device *dev, const uint16_t x, const u
92
72
LOG_DBG ("Setting FB from %p->%p" , (void * )dev_data -> active_fb , (void * )buf );
93
73
dev_data -> active_fb = buf ;
94
74
full_fb = true;
95
- } else if ((x == 0 ) && (y == 0 ) && (desc -> width == config -> rgb_mode .panelHeight ) &&
96
- (desc -> height == config -> rgb_mode .panelWidth ) && (desc -> pitch == desc -> width ) &&
97
- IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP )) {
98
- /* With the PXP, we can rotate this display buffer to align
99
- * with output dimensions
100
- */
101
- LOG_DBG ("Setting FB from %p->%p" , (void * )dev_data -> active_fb , (void * )buf );
102
- dev_data -> active_fb = buf ;
103
- full_fb = true;
104
75
} else {
105
76
/* We must use partial framebuffer copy */
106
77
if (CONFIG_MCUX_ELCDIF_FB_NUM == 0 ) {
@@ -137,77 +108,6 @@ static int mcux_elcdif_write(const struct device *dev, const uint16_t x, const u
137
108
DCACHE_CleanByRange ((uint32_t )dev_data -> active_fb , dev_data -> fb_bytes );
138
109
#endif
139
110
140
- #ifdef CONFIG_MCUX_ELCDIF_PXP
141
- if (full_fb ) {
142
- /* Configure PXP using DMA API, and rotate/flip frame */
143
- struct dma_config pxp_dma = {0 };
144
- struct dma_block_config pxp_block = {0 };
145
-
146
- /* Source buffer is input to display_write, we will
147
- * place modified output into a driver framebuffer.
148
- */
149
- dev_data -> active_fb = dev_data -> fb [dev_data -> next_idx ];
150
- pxp_block .source_address = (uint32_t )buf ;
151
- pxp_block .dest_address = (uint32_t )dev_data -> active_fb ;
152
- pxp_block .block_size = desc -> buf_size ;
153
-
154
- /* DMA slot sets pixel format and rotation angle */
155
- if (dev_data -> pixel_format == PIXEL_FORMAT_BGR_565 ) {
156
- pxp_dma .dma_slot = DMA_MCUX_PXP_FMT (DMA_MCUX_PXP_FMT_RGB565 );
157
- } else if (dev_data -> pixel_format == PIXEL_FORMAT_RGB_888 ) {
158
- pxp_dma .dma_slot = DMA_MCUX_PXP_FMT (DMA_MCUX_PXP_FMT_RGB888 );
159
- } else if (dev_data -> pixel_format == PIXEL_FORMAT_ARGB_8888 ) {
160
- pxp_dma .dma_slot = DMA_MCUX_PXP_FMT (DMA_MCUX_PXP_FMT_ARGB8888 );
161
- } else {
162
- /* Cannot rotate */
163
- return - ENOTSUP ;
164
- }
165
- if (IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP_ROTATE_90 )) {
166
- pxp_dma .dma_slot |= DMA_MCUX_PXP_CMD (DMA_MCUX_PXP_CMD_ROTATE_90 );
167
- } else if (IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP_ROTATE_180 )) {
168
- pxp_dma .dma_slot |= DMA_MCUX_PXP_CMD (DMA_MCUX_PXP_CMD_ROTATE_180 );
169
- } else if (IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP_ROTATE_270 )) {
170
- pxp_dma .dma_slot |= DMA_MCUX_PXP_CMD (DMA_MCUX_PXP_CMD_ROTATE_270 );
171
- } else {
172
- pxp_dma .dma_slot |= DMA_MCUX_PXP_CMD (DMA_MCUX_PXP_CMD_ROTATE_0 );
173
- }
174
-
175
- /* DMA linked_channel sets the flip direction */
176
- if (IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP_FLIP_HORIZONTAL )) {
177
- pxp_dma .linked_channel |= DMA_MCUX_PXP_FLIP (DMA_MCUX_PXP_FLIP_HORIZONTAL );
178
- } else if (IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP_FLIP_VERTICAL )) {
179
- pxp_dma .linked_channel |= DMA_MCUX_PXP_FLIP (DMA_MCUX_PXP_FLIP_VERTICAL );
180
- } else if (IS_ENABLED (CONFIG_MCUX_ELCDIF_PXP_FLIP_BOTH )) {
181
- pxp_dma .linked_channel |= DMA_MCUX_PXP_FLIP (DMA_MCUX_PXP_FLIP_BOTH );
182
- } else {
183
- pxp_dma .linked_channel |= DMA_MCUX_PXP_FLIP (DMA_MCUX_PXP_FLIP_DISABLE );
184
- }
185
-
186
- pxp_dma .channel_direction = MEMORY_TO_MEMORY ;
187
- pxp_dma .source_data_size = desc -> width * dev_data -> pixel_bytes ;
188
- pxp_dma .dest_data_size = config -> rgb_mode .panelWidth * dev_data -> pixel_bytes ;
189
- /* Burst lengths are heights of source/dest buffer in pixels */
190
- pxp_dma .source_burst_length = desc -> height ;
191
- pxp_dma .dest_burst_length = config -> rgb_mode .panelHeight ;
192
- pxp_dma .head_block = & pxp_block ;
193
- pxp_dma .dma_callback = mcux_elcdif_pxp_callback ;
194
- pxp_dma .user_data = dev_data ;
195
-
196
- ret = dma_config (config -> pxp , 0 , & pxp_dma );
197
- if (ret < 0 ) {
198
- return ret ;
199
- }
200
- ret = dma_start (config -> pxp , 0 );
201
- if (ret < 0 ) {
202
- return ret ;
203
- }
204
- k_sem_take (& dev_data -> pxp_done , K_FOREVER );
205
- } else {
206
- LOG_WRN ("PXP rotation/flip will not work correctly unless a full sized "
207
- "framebuffer is provided" );
208
- }
209
- #endif /* CONFIG_MCUX_ELCDIF_PXP */
210
-
211
111
/* Queue next framebuffer */
212
112
ELCDIF_SetNextBufferAddr (config -> base , (uint32_t )dev_data -> active_fb );
213
113
@@ -348,13 +248,6 @@ static int mcux_elcdif_init(const struct device *dev)
348
248
#endif /* DT_ANY_INST_HAS_PROP_STATUS_OKAY(backlight_gpios) */
349
249
350
250
k_sem_init (& dev_data -> sem , 0 , 1 );
351
- #ifdef CONFIG_MCUX_ELCDIF_PXP
352
- k_sem_init (& dev_data -> pxp_done , 0 , 1 );
353
- if (!device_is_ready (config -> pxp )) {
354
- LOG_ERR ("PXP device is not ready" );
355
- return - ENODEV ;
356
- }
357
- #endif
358
251
359
252
config -> irq_config_func (dev );
360
253
@@ -413,8 +306,7 @@ static DEVICE_API(display, mcux_elcdif_api) = {
413
306
}, \
414
307
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id), \
415
308
.backlight_gpio = GPIO_DT_SPEC_INST_GET_OR(id, backlight_gpios, {0}), \
416
- IF_ENABLED(CONFIG_MCUX_ELCDIF_PXP, \
417
- (.pxp = DEVICE_DT_GET(DT_INST_PHANDLE(id, nxp_pxp)),))}; \
309
+ }; \
418
310
static struct mcux_elcdif_data mcux_elcdif_data_##id = { \
419
311
.next_idx = 0, \
420
312
.pixel_format = DT_INST_PROP(id, pixel_format), \
0 commit comments