@@ -113,52 +113,14 @@ static void mtk_drm_finish_page_flip(struct mtk_crtc *mtk_crtc)
113
113
}
114
114
}
115
115
116
- #if IS_REACHABLE (CONFIG_MTK_CMDQ )
117
- static int mtk_drm_cmdq_pkt_create (struct cmdq_client * client , struct cmdq_pkt * pkt ,
118
- size_t size )
119
- {
120
- struct device * dev ;
121
- dma_addr_t dma_addr ;
122
-
123
- pkt -> va_base = kzalloc (size , GFP_KERNEL );
124
- if (!pkt -> va_base )
125
- return - ENOMEM ;
126
-
127
- pkt -> buf_size = size ;
128
- pkt -> cl = (void * )client ;
129
-
130
- dev = client -> chan -> mbox -> dev ;
131
- dma_addr = dma_map_single (dev , pkt -> va_base , pkt -> buf_size ,
132
- DMA_TO_DEVICE );
133
- if (dma_mapping_error (dev , dma_addr )) {
134
- dev_err (dev , "dma map failed, size=%u\n" , (u32 )(u64 )size );
135
- kfree (pkt -> va_base );
136
- return - ENOMEM ;
137
- }
138
-
139
- pkt -> pa_base = dma_addr ;
140
-
141
- return 0 ;
142
- }
143
-
144
- static void mtk_drm_cmdq_pkt_destroy (struct cmdq_pkt * pkt )
145
- {
146
- struct cmdq_client * client = (struct cmdq_client * )pkt -> cl ;
147
-
148
- dma_unmap_single (client -> chan -> mbox -> dev , pkt -> pa_base , pkt -> buf_size ,
149
- DMA_TO_DEVICE );
150
- kfree (pkt -> va_base );
151
- }
152
- #endif
153
-
154
116
static void mtk_crtc_destroy (struct drm_crtc * crtc )
155
117
{
156
118
struct mtk_crtc * mtk_crtc = to_mtk_crtc (crtc );
157
119
int i ;
158
120
159
121
mtk_mutex_put (mtk_crtc -> mutex );
160
122
#if IS_REACHABLE (CONFIG_MTK_CMDQ )
161
- mtk_drm_cmdq_pkt_destroy ( & mtk_crtc -> cmdq_handle );
123
+ cmdq_pkt_destroy ( & mtk_crtc -> cmdq_client , & mtk_crtc -> cmdq_handle );
162
124
163
125
if (mtk_crtc -> cmdq_client .chan ) {
164
126
mbox_free_channel (mtk_crtc -> cmdq_client .chan );
@@ -1094,9 +1056,9 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path,
1094
1056
mbox_free_channel (mtk_crtc -> cmdq_client .chan );
1095
1057
mtk_crtc -> cmdq_client .chan = NULL ;
1096
1058
} else {
1097
- ret = mtk_drm_cmdq_pkt_create (& mtk_crtc -> cmdq_client ,
1098
- & mtk_crtc -> cmdq_handle ,
1099
- PAGE_SIZE );
1059
+ ret = cmdq_pkt_create (& mtk_crtc -> cmdq_client ,
1060
+ & mtk_crtc -> cmdq_handle ,
1061
+ PAGE_SIZE );
1100
1062
if (ret ) {
1101
1063
dev_dbg (dev , "mtk_crtc %d failed to create cmdq packet\n" ,
1102
1064
drm_crtc_index (& mtk_crtc -> base ));
0 commit comments