Lines Matching refs:mfc_dev
1109 static int s5p_mfc_configure_2port_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_configure_2port_memory() argument
1111 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_configure_2port_memory()
1121 mfc_dev->mem_dev[BANK_L_CTX] = s5p_mfc_alloc_memdev(dev, "left", in s5p_mfc_configure_2port_memory()
1123 if (!mfc_dev->mem_dev[BANK_L_CTX]) in s5p_mfc_configure_2port_memory()
1125 mfc_dev->mem_dev[BANK_R_CTX] = s5p_mfc_alloc_memdev(dev, "right", in s5p_mfc_configure_2port_memory()
1127 if (!mfc_dev->mem_dev[BANK_R_CTX]) { in s5p_mfc_configure_2port_memory()
1128 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_configure_2port_memory()
1133 ret = s5p_mfc_alloc_firmware(mfc_dev); in s5p_mfc_configure_2port_memory()
1135 device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_configure_2port_memory()
1136 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_configure_2port_memory()
1140 mfc_dev->dma_base[BANK_L_CTX] = mfc_dev->fw_buf.dma; in s5p_mfc_configure_2port_memory()
1142 bank2_virt = dma_alloc_coherent(mfc_dev->mem_dev[BANK_R_CTX], in s5p_mfc_configure_2port_memory()
1146 s5p_mfc_release_firmware(mfc_dev); in s5p_mfc_configure_2port_memory()
1147 device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_configure_2port_memory()
1148 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_configure_2port_memory()
1156 mfc_dev->dma_base[BANK_R_CTX] = bank2_dma_addr - align_size; in s5p_mfc_configure_2port_memory()
1158 dma_free_coherent(mfc_dev->mem_dev[BANK_R_CTX], align_size, bank2_virt, in s5p_mfc_configure_2port_memory()
1161 vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK_L_CTX], in s5p_mfc_configure_2port_memory()
1163 vb2_dma_contig_set_max_seg_size(mfc_dev->mem_dev[BANK_R_CTX], in s5p_mfc_configure_2port_memory()
1169 static void s5p_mfc_unconfigure_2port_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_unconfigure_2port_memory() argument
1171 device_unregister(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_unconfigure_2port_memory()
1172 device_unregister(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_unconfigure_2port_memory()
1173 vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK_L_CTX]); in s5p_mfc_unconfigure_2port_memory()
1174 vb2_dma_contig_clear_max_seg_size(mfc_dev->mem_dev[BANK_R_CTX]); in s5p_mfc_unconfigure_2port_memory()
1177 static int s5p_mfc_configure_common_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_configure_common_memory() argument
1179 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_configure_common_memory()
1191 mfc_dev->mem_bitmap = kzalloc(bitmap_size, GFP_KERNEL); in s5p_mfc_configure_common_memory()
1192 if (!mfc_dev->mem_bitmap) in s5p_mfc_configure_common_memory()
1195 mfc_dev->mem_virt = dma_alloc_coherent(dev, mem_size, in s5p_mfc_configure_common_memory()
1196 &mfc_dev->mem_base, GFP_KERNEL); in s5p_mfc_configure_common_memory()
1197 if (!mfc_dev->mem_virt) { in s5p_mfc_configure_common_memory()
1198 kfree(mfc_dev->mem_bitmap); in s5p_mfc_configure_common_memory()
1203 mfc_dev->mem_size = mem_size; in s5p_mfc_configure_common_memory()
1204 mfc_dev->dma_base[BANK_L_CTX] = mfc_dev->mem_base; in s5p_mfc_configure_common_memory()
1205 mfc_dev->dma_base[BANK_R_CTX] = mfc_dev->mem_base; in s5p_mfc_configure_common_memory()
1211 if (mfc_dev->mem_base == (dma_addr_t)0) { in s5p_mfc_configure_common_memory()
1214 bitmap_set(mfc_dev->mem_bitmap, 0, offset >> PAGE_SHIFT); in s5p_mfc_configure_common_memory()
1215 mfc_dev->dma_base[BANK_L_CTX] += offset; in s5p_mfc_configure_common_memory()
1216 mfc_dev->dma_base[BANK_R_CTX] += offset; in s5p_mfc_configure_common_memory()
1220 s5p_mfc_alloc_firmware(mfc_dev); in s5p_mfc_configure_common_memory()
1222 mfc_dev->mem_dev[BANK_L_CTX] = mfc_dev->mem_dev[BANK_R_CTX] = dev; in s5p_mfc_configure_common_memory()
1231 static void s5p_mfc_unconfigure_common_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_unconfigure_common_memory() argument
1233 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_unconfigure_common_memory()
1235 dma_free_coherent(dev, mfc_dev->mem_size, mfc_dev->mem_virt, in s5p_mfc_unconfigure_common_memory()
1236 mfc_dev->mem_base); in s5p_mfc_unconfigure_common_memory()
1237 kfree(mfc_dev->mem_bitmap); in s5p_mfc_unconfigure_common_memory()
1241 static int s5p_mfc_configure_dma_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_configure_dma_memory() argument
1243 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_configure_dma_memory()
1245 if (exynos_is_iommu_available(dev) || !IS_TWOPORT(mfc_dev)) in s5p_mfc_configure_dma_memory()
1246 return s5p_mfc_configure_common_memory(mfc_dev); in s5p_mfc_configure_dma_memory()
1248 return s5p_mfc_configure_2port_memory(mfc_dev); in s5p_mfc_configure_dma_memory()
1251 static void s5p_mfc_unconfigure_dma_memory(struct s5p_mfc_dev *mfc_dev) in s5p_mfc_unconfigure_dma_memory() argument
1253 struct device *dev = &mfc_dev->plat_dev->dev; in s5p_mfc_unconfigure_dma_memory()
1255 s5p_mfc_release_firmware(mfc_dev); in s5p_mfc_unconfigure_dma_memory()
1256 if (exynos_is_iommu_available(dev) || !IS_TWOPORT(mfc_dev)) in s5p_mfc_unconfigure_dma_memory()
1257 s5p_mfc_unconfigure_common_memory(mfc_dev); in s5p_mfc_unconfigure_dma_memory()
1259 s5p_mfc_unconfigure_2port_memory(mfc_dev); in s5p_mfc_unconfigure_dma_memory()