rga                79 drivers/media/platform/rockchip/rga/rga-buf.c 	struct rockchip_rga *rga = ctx->rga;
rga                82 drivers/media/platform/rockchip/rga/rga-buf.c 	ret = pm_runtime_get_sync(rga->dev);
rga                94 drivers/media/platform/rockchip/rga/rga-buf.c 	struct rockchip_rga *rga = ctx->rga;
rga                97 drivers/media/platform/rockchip/rga/rga-buf.c 	pm_runtime_put(rga->dev);
rga               116 drivers/media/platform/rockchip/rga/rga-buf.c 	struct rockchip_rga *rga = ctx->rga;
rga               124 drivers/media/platform/rockchip/rga/rga-buf.c 		pages = rga->src_mmu_pages;
rga               126 drivers/media/platform/rockchip/rga/rga-buf.c 		pages = rga->dst_mmu_pages;
rga               146 drivers/media/platform/rockchip/rga/rga-buf.c 	dma_sync_single_for_device(rga->dev, virt_to_phys(pages),
rga               124 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rockchip_rga *rga = ctx->rga;
rga               125 drivers/media/platform/rockchip/rga/rga-hw.c 	u32 *dest = rga->cmdbuf_virt;
rga               137 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rockchip_rga *rga = ctx->rga;
rga               138 drivers/media/platform/rockchip/rga/rga-hw.c 	u32 *dest = rga->cmdbuf_virt;
rga               150 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rockchip_rga *rga = ctx->rga;
rga               151 drivers/media/platform/rockchip/rga/rga-hw.c 	u32 *dest = rga->cmdbuf_virt;
rga               163 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rockchip_rga *rga = ctx->rga;
rga               164 drivers/media/platform/rockchip/rga/rga-hw.c 	u32 *dest = rga->cmdbuf_virt;
rga               258 drivers/media/platform/rockchip/rga/rga-hw.c 		if (rga->version.major == 0 || rga->version.minor == 0) {
rga               354 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rockchip_rga *rga = ctx->rga;
rga               355 drivers/media/platform/rockchip/rga/rga-hw.c 	u32 *dest = rga->cmdbuf_virt;
rga               377 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rockchip_rga *rga = ctx->rga;
rga               379 drivers/media/platform/rockchip/rga/rga-hw.c 	memset(rga->cmdbuf_virt, 0, RGA_CMDBUF_SIZE * 4);
rga               381 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_cmd_set_src_addr(ctx, rga->src_mmu_pages);
rga               386 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_cmd_set_src1_addr(ctx, rga->dst_mmu_pages);
rga               388 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_cmd_set_dst_addr(ctx, rga->dst_mmu_pages);
rga               393 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_write(rga, RGA_CMD_BASE, rga->cmdbuf_phy);
rga               396 drivers/media/platform/rockchip/rga/rga-hw.c 	dma_sync_single_for_device(rga->dev, rga->cmdbuf_phy,
rga               400 drivers/media/platform/rockchip/rga/rga-hw.c void rga_hw_start(struct rockchip_rga *rga)
rga               402 drivers/media/platform/rockchip/rga/rga-hw.c 	struct rga_ctx *ctx = rga->curr;
rga               406 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_write(rga, RGA_SYS_CTRL, 0x00);
rga               408 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_write(rga, RGA_SYS_CTRL, 0x22);
rga               410 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_write(rga, RGA_INT, 0x600);
rga               412 drivers/media/platform/rockchip/rga/rga-hw.c 	rga_write(rga, RGA_CMD_CTRL, 0x1);
rga                37 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = ctx->rga;
rga                41 drivers/media/platform/rockchip/rga/rga.c 	spin_lock_irqsave(&rga->ctrl_lock, flags);
rga                43 drivers/media/platform/rockchip/rga/rga.c 	rga->curr = ctx;
rga                51 drivers/media/platform/rockchip/rga/rga.c 	rga_hw_start(rga);
rga                53 drivers/media/platform/rockchip/rga/rga.c 	spin_unlock_irqrestore(&rga->ctrl_lock, flags);
rga                58 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = prv;
rga                61 drivers/media/platform/rockchip/rga/rga.c 	intr = rga_read(rga, RGA_INT) & 0xf;
rga                63 drivers/media/platform/rockchip/rga/rga.c 	rga_mod(rga, RGA_INT, intr << 4, 0xf << 4);
rga                67 drivers/media/platform/rockchip/rga/rga.c 		struct rga_ctx *ctx = rga->curr;
rga                71 drivers/media/platform/rockchip/rga/rga.c 		rga->curr = NULL;
rga                86 drivers/media/platform/rockchip/rga/rga.c 		v4l2_m2m_job_finish(rga->m2m_dev, ctx->fh.m2m_ctx);
rga               109 drivers/media/platform/rockchip/rga/rga.c 	src_vq->lock = &ctx->rga->mutex;
rga               110 drivers/media/platform/rockchip/rga/rga.c 	src_vq->dev = ctx->rga->v4l2_dev.dev;
rga               123 drivers/media/platform/rockchip/rga/rga.c 	dst_vq->lock = &ctx->rga->mutex;
rga               124 drivers/media/platform/rockchip/rga/rga.c 	dst_vq->dev = ctx->rga->v4l2_dev.dev;
rga               135 drivers/media/platform/rockchip/rga/rga.c 	spin_lock_irqsave(&ctx->rga->ctrl_lock, flags);
rga               150 drivers/media/platform/rockchip/rga/rga.c 	spin_unlock_irqrestore(&ctx->rga->ctrl_lock, flags);
rga               160 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = ctx->rga;
rga               179 drivers/media/platform/rockchip/rga/rga.c 		v4l2_err(&rga->v4l2_dev, "%s failed\n", __func__);
rga               372 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = video_drvdata(file);
rga               379 drivers/media/platform/rockchip/rga/rga.c 	ctx->rga = rga;
rga               384 drivers/media/platform/rockchip/rga/rga.c 	if (mutex_lock_interruptible(&rga->mutex)) {
rga               388 drivers/media/platform/rockchip/rga/rga.c 	ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(rga->m2m_dev, ctx, &queue_init);
rga               391 drivers/media/platform/rockchip/rga/rga.c 		mutex_unlock(&rga->mutex);
rga               405 drivers/media/platform/rockchip/rga/rga.c 	mutex_unlock(&rga->mutex);
rga               414 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = ctx->rga;
rga               416 drivers/media/platform/rockchip/rga/rga.c 	mutex_lock(&rga->mutex);
rga               425 drivers/media/platform/rockchip/rga/rga.c 	mutex_unlock(&rga->mutex);
rga               522 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = ctx->rga;
rga               536 drivers/media/platform/rockchip/rga/rga.c 		v4l2_err(&rga->v4l2_dev, "queue (%d) bust\n", f->type);
rga               613 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = ctx->rga;
rga               647 drivers/media/platform/rockchip/rga/rga.c 		v4l2_dbg(debug, 1, &rga->v4l2_dev,
rga               655 drivers/media/platform/rockchip/rga/rga.c 		v4l2_dbg(debug, 1, &rga->v4l2_dev, "unsupported crop value.\n");
rga               705 drivers/media/platform/rockchip/rga/rga.c static int rga_enable_clocks(struct rockchip_rga *rga)
rga               709 drivers/media/platform/rockchip/rga/rga.c 	ret = clk_prepare_enable(rga->sclk);
rga               711 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "Cannot enable rga sclk: %d\n", ret);
rga               715 drivers/media/platform/rockchip/rga/rga.c 	ret = clk_prepare_enable(rga->aclk);
rga               717 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "Cannot enable rga aclk: %d\n", ret);
rga               721 drivers/media/platform/rockchip/rga/rga.c 	ret = clk_prepare_enable(rga->hclk);
rga               723 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "Cannot enable rga hclk: %d\n", ret);
rga               730 drivers/media/platform/rockchip/rga/rga.c 	clk_disable_unprepare(rga->sclk);
rga               732 drivers/media/platform/rockchip/rga/rga.c 	clk_disable_unprepare(rga->aclk);
rga               737 drivers/media/platform/rockchip/rga/rga.c static void rga_disable_clocks(struct rockchip_rga *rga)
rga               739 drivers/media/platform/rockchip/rga/rga.c 	clk_disable_unprepare(rga->sclk);
rga               740 drivers/media/platform/rockchip/rga/rga.c 	clk_disable_unprepare(rga->hclk);
rga               741 drivers/media/platform/rockchip/rga/rga.c 	clk_disable_unprepare(rga->aclk);
rga               744 drivers/media/platform/rockchip/rga/rga.c static int rga_parse_dt(struct rockchip_rga *rga)
rga               748 drivers/media/platform/rockchip/rga/rga.c 	core_rst = devm_reset_control_get(rga->dev, "core");
rga               750 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to get core reset controller\n");
rga               754 drivers/media/platform/rockchip/rga/rga.c 	axi_rst = devm_reset_control_get(rga->dev, "axi");
rga               756 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to get axi reset controller\n");
rga               760 drivers/media/platform/rockchip/rga/rga.c 	ahb_rst = devm_reset_control_get(rga->dev, "ahb");
rga               762 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to get ahb reset controller\n");
rga               778 drivers/media/platform/rockchip/rga/rga.c 	rga->sclk = devm_clk_get(rga->dev, "sclk");
rga               779 drivers/media/platform/rockchip/rga/rga.c 	if (IS_ERR(rga->sclk)) {
rga               780 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to get sclk clock\n");
rga               781 drivers/media/platform/rockchip/rga/rga.c 		return PTR_ERR(rga->sclk);
rga               784 drivers/media/platform/rockchip/rga/rga.c 	rga->aclk = devm_clk_get(rga->dev, "aclk");
rga               785 drivers/media/platform/rockchip/rga/rga.c 	if (IS_ERR(rga->aclk)) {
rga               786 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to get aclk clock\n");
rga               787 drivers/media/platform/rockchip/rga/rga.c 		return PTR_ERR(rga->aclk);
rga               790 drivers/media/platform/rockchip/rga/rga.c 	rga->hclk = devm_clk_get(rga->dev, "hclk");
rga               791 drivers/media/platform/rockchip/rga/rga.c 	if (IS_ERR(rga->hclk)) {
rga               792 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to get hclk clock\n");
rga               793 drivers/media/platform/rockchip/rga/rga.c 		return PTR_ERR(rga->hclk);
rga               801 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga;
rga               810 drivers/media/platform/rockchip/rga/rga.c 	rga = devm_kzalloc(&pdev->dev, sizeof(*rga), GFP_KERNEL);
rga               811 drivers/media/platform/rockchip/rga/rga.c 	if (!rga)
rga               814 drivers/media/platform/rockchip/rga/rga.c 	rga->dev = &pdev->dev;
rga               815 drivers/media/platform/rockchip/rga/rga.c 	spin_lock_init(&rga->ctrl_lock);
rga               816 drivers/media/platform/rockchip/rga/rga.c 	mutex_init(&rga->mutex);
rga               818 drivers/media/platform/rockchip/rga/rga.c 	ret = rga_parse_dt(rga);
rga               822 drivers/media/platform/rockchip/rga/rga.c 	pm_runtime_enable(rga->dev);
rga               826 drivers/media/platform/rockchip/rga/rga.c 	rga->regs = devm_ioremap_resource(rga->dev, res);
rga               827 drivers/media/platform/rockchip/rga/rga.c 	if (IS_ERR(rga->regs)) {
rga               828 drivers/media/platform/rockchip/rga/rga.c 		ret = PTR_ERR(rga->regs);
rga               838 drivers/media/platform/rockchip/rga/rga.c 	ret = devm_request_irq(rga->dev, irq, rga_isr, 0,
rga               839 drivers/media/platform/rockchip/rga/rga.c 			       dev_name(rga->dev), rga);
rga               841 drivers/media/platform/rockchip/rga/rga.c 		dev_err(rga->dev, "failed to request irq\n");
rga               845 drivers/media/platform/rockchip/rga/rga.c 	ret = v4l2_device_register(&pdev->dev, &rga->v4l2_dev);
rga               850 drivers/media/platform/rockchip/rga/rga.c 		v4l2_err(&rga->v4l2_dev, "Failed to allocate video device\n");
rga               855 drivers/media/platform/rockchip/rga/rga.c 	vfd->lock = &rga->mutex;
rga               856 drivers/media/platform/rockchip/rga/rga.c 	vfd->v4l2_dev = &rga->v4l2_dev;
rga               858 drivers/media/platform/rockchip/rga/rga.c 	video_set_drvdata(vfd, rga);
rga               859 drivers/media/platform/rockchip/rga/rga.c 	rga->vfd = vfd;
rga               861 drivers/media/platform/rockchip/rga/rga.c 	platform_set_drvdata(pdev, rga);
rga               862 drivers/media/platform/rockchip/rga/rga.c 	rga->m2m_dev = v4l2_m2m_init(&rga_m2m_ops);
rga               863 drivers/media/platform/rockchip/rga/rga.c 	if (IS_ERR(rga->m2m_dev)) {
rga               864 drivers/media/platform/rockchip/rga/rga.c 		v4l2_err(&rga->v4l2_dev, "Failed to init mem2mem device\n");
rga               865 drivers/media/platform/rockchip/rga/rga.c 		ret = PTR_ERR(rga->m2m_dev);
rga               869 drivers/media/platform/rockchip/rga/rga.c 	pm_runtime_get_sync(rga->dev);
rga               871 drivers/media/platform/rockchip/rga/rga.c 	rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF;
rga               872 drivers/media/platform/rockchip/rga/rga.c 	rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F;
rga               874 drivers/media/platform/rockchip/rga/rga.c 	v4l2_info(&rga->v4l2_dev, "HW Version: 0x%02x.%02x\n",
rga               875 drivers/media/platform/rockchip/rga/rga.c 		  rga->version.major, rga->version.minor);
rga               877 drivers/media/platform/rockchip/rga/rga.c 	pm_runtime_put(rga->dev);
rga               880 drivers/media/platform/rockchip/rga/rga.c 	rga->cmdbuf_virt = dma_alloc_attrs(rga->dev, RGA_CMDBUF_SIZE,
rga               881 drivers/media/platform/rockchip/rga/rga.c 					   &rga->cmdbuf_phy, GFP_KERNEL,
rga               884 drivers/media/platform/rockchip/rga/rga.c 	rga->src_mmu_pages =
rga               886 drivers/media/platform/rockchip/rga/rga.c 	rga->dst_mmu_pages =
rga               894 drivers/media/platform/rockchip/rga/rga.c 		v4l2_err(&rga->v4l2_dev, "Failed to register video device\n");
rga               898 drivers/media/platform/rockchip/rga/rga.c 	v4l2_info(&rga->v4l2_dev, "Registered %s as /dev/%s\n",
rga               906 drivers/media/platform/rockchip/rga/rga.c 	video_unregister_device(rga->vfd);
rga               908 drivers/media/platform/rockchip/rga/rga.c 	v4l2_device_unregister(&rga->v4l2_dev);
rga               910 drivers/media/platform/rockchip/rga/rga.c 	pm_runtime_disable(rga->dev);
rga               917 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = platform_get_drvdata(pdev);
rga               919 drivers/media/platform/rockchip/rga/rga.c 	dma_free_attrs(rga->dev, RGA_CMDBUF_SIZE, rga->cmdbuf_virt,
rga               920 drivers/media/platform/rockchip/rga/rga.c 		       rga->cmdbuf_phy, DMA_ATTR_WRITE_COMBINE);
rga               922 drivers/media/platform/rockchip/rga/rga.c 	free_pages((unsigned long)rga->src_mmu_pages, 3);
rga               923 drivers/media/platform/rockchip/rga/rga.c 	free_pages((unsigned long)rga->dst_mmu_pages, 3);
rga               925 drivers/media/platform/rockchip/rga/rga.c 	v4l2_info(&rga->v4l2_dev, "Removing\n");
rga               927 drivers/media/platform/rockchip/rga/rga.c 	v4l2_m2m_release(rga->m2m_dev);
rga               928 drivers/media/platform/rockchip/rga/rga.c 	video_unregister_device(rga->vfd);
rga               929 drivers/media/platform/rockchip/rga/rga.c 	v4l2_device_unregister(&rga->v4l2_dev);
rga               931 drivers/media/platform/rockchip/rga/rga.c 	pm_runtime_disable(rga->dev);
rga               938 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = dev_get_drvdata(dev);
rga               940 drivers/media/platform/rockchip/rga/rga.c 	rga_disable_clocks(rga);
rga               947 drivers/media/platform/rockchip/rga/rga.c 	struct rockchip_rga *rga = dev_get_drvdata(dev);
rga               949 drivers/media/platform/rockchip/rga/rga.c 	return rga_enable_clocks(rga);
rga                50 drivers/media/platform/rockchip/rga/rga.h 	struct rockchip_rga *rga;
rga                95 drivers/media/platform/rockchip/rga/rga.h static inline void rga_write(struct rockchip_rga *rga, u32 reg, u32 value)
rga                97 drivers/media/platform/rockchip/rga/rga.h 	writel(value, rga->regs + reg);
rga               100 drivers/media/platform/rockchip/rga/rga.h static inline u32 rga_read(struct rockchip_rga *rga, u32 reg)
rga               102 drivers/media/platform/rockchip/rga/rga.h 	return readl(rga->regs + reg);
rga               105 drivers/media/platform/rockchip/rga/rga.h static inline void rga_mod(struct rockchip_rga *rga, u32 reg, u32 val, u32 mask)
rga               107 drivers/media/platform/rockchip/rga/rga.h 	u32 temp = rga_read(rga, reg) & ~(mask);
rga               110 drivers/media/platform/rockchip/rga/rga.h 	rga_write(rga, reg, temp);
rga               113 drivers/media/platform/rockchip/rga/rga.h void rga_hw_start(struct rockchip_rga *rga);