media: platform: rockchip: cif: fix rk356x iommu issue

when open video0/1/2/3 first, then close it;
if reopen video0, the output data is green;
if not enable iommu, it's ok; fix it;

Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: Ib977c34f005548bbc21cc93ca39c10d871235ad9
This commit is contained in:
Wang Panzhenzhuan
2021-05-17 15:42:02 +08:00
committed by Tao Huang
parent a427c86942
commit e3390a9335

View File

@@ -764,17 +764,17 @@ err:
static void rkcif_iommu_cleanup(struct rkcif_hw *cif_hw)
{
struct iommu_domain *domain;
if (cif_hw->domain)
cif_hw->domain->ops->detach_dev(cif_hw->domain, cif_hw->dev);
}
dev_err(cif_hw->dev, "%s enter\n", __func__);
static void rkcif_iommu_enable(struct rkcif_hw *cif_hw)
{
if (!cif_hw->domain)
cif_hw->domain = iommu_get_domain_for_dev(cif_hw->dev);
domain = iommu_get_domain_for_dev(cif_hw->dev);
if (domain) {
#ifdef CONFIG_IOMMU_API
domain->ops->detach_dev(domain, cif_hw->dev);
domain->ops->attach_dev(domain, cif_hw->dev);
#endif
}
if (cif_hw->domain)
cif_hw->domain->ops->attach_dev(cif_hw->domain, cif_hw->dev);
}
static inline bool is_iommu_enable(struct device *dev)
@@ -809,6 +809,9 @@ void rkcif_hw_soft_reset(struct rkcif_hw *cif_hw, bool is_rst_iommu)
for (i = 0; i < ARRAY_SIZE(cif_hw->cif_rst); i++)
if (cif_hw->cif_rst[i])
reset_control_deassert(cif_hw->cif_rst[i]);
if (cif_hw->iommu_en && is_rst_iommu)
rkcif_iommu_enable(cif_hw);
}
static int rkcif_plat_hw_probe(struct platform_device *pdev)