Lines Matching refs:mfc_dev
1116 static int s5p_mfc_configure_2port_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_configure_2port_memory() argument
1118 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_configure_2port_memory()
1128 mfc_dev->mem_dev[BANK_L_CTX] = s5p_mfc_alloc_memdev(dev, "left", in s5p_mfc_configure_2port_memory()
1130 if (!mfc_dev->mem_dev[BANK_L_CTX]) in s5p_mfc_configure_2port_memory()
1132 mfc_dev->mem_dev[BANK_R_CTX] = s5p_mfc_alloc_memdev(dev, "right", in s5p_mfc_configure_2port_memory()
1134 if (!mfc_dev->mem_dev[BANK_R_CTX]) { in s5p_mfc_configure_2port_memory()
1135 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_configure_2port_memory()
1140 ret = s5p_mfc_alloc_firmware(mfc_dev); in s5p_mfc_configure_2port_memory()
1142 device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_configure_2port_memory()
1143 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_configure_2port_memory()
1147 mfc_dev->dma_base[BANK_L_CTX] = mfc_dev->fw_buf.dma; in s5p_mfc_configure_2port_memory()
1149 bank2_virt = dma_alloc_coherent(mfc_dev->mem_dev[BANK_R_CTX], in s5p_mfc_configure_2port_memory()
1153 s5p_mfc_release_firmware(mfc_dev); in s5p_mfc_configure_2port_memory()
1154 device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_configure_2port_memory()
1155 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_configure_2port_memory()
1163 mfc_dev->dma_base[BANK_R_CTX] = bank2_dma_addr - align_size; in s5p_mfc_configure_2port_memory()
1165 dma_free_coherent(mfc_dev->mem_dev[BANK_R_CTX], align_size, bank2_virt, in s5p_mfc_configure_2port_memory()
1168 vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK_L_CTX], in s5p_mfc_configure_2port_memory()
1170 vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK_R_CTX], in s5p_mfc_configure_2port_memory()
1176 static void s5p_mfc_unconfigure_2port_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_unconfigure_2port_memory() argument
1178 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_unconfigure_2port_memory()
1179 device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_unconfigure_2port_memory()
1180 vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_unconfigure_2port_memory()
1181 vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_unconfigure_2port_memory()
1184 static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_configure_common_memory() argument
1186 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_configure_common_memory()
1195 mfc_dev->mem_bitmap = bitmap_zalloc(mem_size >> PAGE_SHIFT, GFP_KERNEL); in s5p_mfc_configure_common_memory()
1196 if (!mfc_dev->mem_bitmap) in s5p_mfc_configure_common_memory()
1199 mfc_dev->mem_virt = dma_alloc_coherent(dev, mem_size, in s5p_mfc_configure_common_memory()
1200 &mfc_dev->mem_base, GFP_KERNEL); in s5p_mfc_configure_common_memory()
1201 if (!mfc_dev->mem_virt) { in s5p_mfc_configure_common_memory()
1202 bitmap_free(mfc_dev->mem_bitmap); in s5p_mfc_configure_common_memory()
1207 mfc_dev->mem_size = mem_size; in s5p_mfc_configure_common_memory()
1208 mfc_dev->dma_base[BANK_L_CTX] = mfc_dev->mem_base; in s5p_mfc_configure_common_memory()
1209 mfc_dev->dma_base[BANK_R_CTX] = mfc_dev->mem_base; in s5p_mfc_configure_common_memory()
1215 if (mfc_dev->mem_base == (dma_addr_t)0) { in s5p_mfc_configure_common_memory()
1218 bitmap_set(mfc_dev->mem_bitmap, 0, offset >> PAGE_SHIFT); in s5p_mfc_configure_common_memory()
1219 mfc_dev->dma_base[BANK_L_CTX] += offset; in s5p_mfc_configure_common_memory()
1220 mfc_dev->dma_base[BANK_R_CTX] += offset; in s5p_mfc_configure_common_memory()
1224 s5p_mfc_alloc_firmware(mfc_dev); in s5p_mfc_configure_common_memory()
1226 mfc_dev->mem_dev[BANK_L_CTX] = mfc_dev->mem_dev[BANK_R_CTX] = dev; in s5p_mfc_configure_common_memory()
1235 static void s5p_mfc_unconfigure_common_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_unconfigure_common_memory() argument
1237 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_unconfigure_common_memory()
1239 dma_free_coherent(dev, mfc_dev->mem_size, mfc_dev->mem_virt, in s5p_mfc_unconfigure_common_memory()
1240 mfc_dev->mem_base); in s5p_mfc_unconfigure_common_memory()
1241 bitmap_free(mfc_dev->mem_bitmap); in s5p_mfc_unconfigure_common_memory()
1245 static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_configure_dma_memory() argument
1247 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_configure_dma_memory()
1249 if (exynos_is_iommu_available(dev) || !IS_TWOPORT(mfc_dev)) in s5p_mfc_configure_dma_memory()
1250 return s5p_mfc_configure_common_memory(mfc_dev); in s5p_mfc_configure_dma_memory()
1252 return s5p_mfc_configure_2port_memory(mfc_dev); in s5p_mfc_configure_dma_memory()
1255 static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_unconfigure_dma_memory() argument
1257 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_unconfigure_dma_memory()
1259 s5p_mfc_release_firmware(mfc_dev); in s5p_mfc_unconfigure_dma_memory()
1260 if (exynos_is_iommu_available(dev) || !IS_TWOPORT(mfc_dev)) in s5p_mfc_unconfigure_dma_memory()
1261 s5p_mfc_unconfigure_common_memory(mfc_dev); in s5p_mfc_unconfigure_dma_memory()
1263 s5p_mfc_unconfigure_2port_memory(mfc_dev); in s5p_mfc_unconfigure_dma_memory()