Lines Matching full:pre

118 	struct ipu_pre *pre;  in ipu_pre_lookup_by_phandle()  local
121 list_for_each_entry(pre, &ipu_pre_list, list) { in ipu_pre_lookup_by_phandle()
122 if (pre_node == pre->dev->of_node) { in ipu_pre_lookup_by_phandle()
124 device_link_add(dev, pre->dev, in ipu_pre_lookup_by_phandle()
127 return pre; in ipu_pre_lookup_by_phandle()
137 int ipu_pre_get(struct ipu_pre *pre) in ipu_pre_get() argument
141 if (pre->in_use) in ipu_pre_get()
145 writel(0, pre->regs + IPU_PRE_CTRL); in ipu_pre_get()
152 writel(val, pre->regs + IPU_PRE_CTRL); in ipu_pre_get()
154 pre->in_use = true; in ipu_pre_get()
158 void ipu_pre_put(struct ipu_pre *pre) in ipu_pre_put() argument
160 writel(IPU_PRE_CTRL_SFTRST, pre->regs + IPU_PRE_CTRL); in ipu_pre_put()
162 pre->in_use = false; in ipu_pre_put()
165 void ipu_pre_configure(struct ipu_pre *pre, unsigned int width, in ipu_pre_configure() argument
175 pre->safe_window_end = height - 2; in ipu_pre_configure()
177 pre->safe_window_end = DIV_ROUND_UP(height, 4) - 1; in ipu_pre_configure()
179 writel(bufaddr, pre->regs + IPU_PRE_CUR_BUF); in ipu_pre_configure()
180 writel(bufaddr, pre->regs + IPU_PRE_NEXT_BUF); in ipu_pre_configure()
181 pre->last_bufaddr = bufaddr; in ipu_pre_configure()
188 writel(val, pre->regs + IPU_PRE_PREFETCH_ENG_CTRL); in ipu_pre_configure()
192 writel(val, pre->regs + IPU_PRE_PREFETCH_ENG_INPUT_SIZE); in ipu_pre_configure()
195 writel(val, pre->regs + IPU_PRE_PREFETCH_ENG_PITCH); in ipu_pre_configure()
200 writel(val, pre->regs + IPU_PRE_STORE_ENG_CTRL); in ipu_pre_configure()
204 writel(val, pre->regs + IPU_PRE_STORE_ENG_SIZE); in ipu_pre_configure()
207 writel(val, pre->regs + IPU_PRE_STORE_ENG_PITCH); in ipu_pre_configure()
209 writel(pre->buffer_paddr, pre->regs + IPU_PRE_STORE_ENG_ADDR); in ipu_pre_configure()
211 val = readl(pre->regs + IPU_PRE_TPR_CTRL); in ipu_pre_configure()
221 writel(val, pre->regs + IPU_PRE_TPR_CTRL); in ipu_pre_configure()
223 val = readl(pre->regs + IPU_PRE_CTRL); in ipu_pre_configure()
230 writel(val, pre->regs + IPU_PRE_CTRL); in ipu_pre_configure()
233 void ipu_pre_update(struct ipu_pre *pre, unsigned int bufaddr) in ipu_pre_update() argument
239 if (bufaddr == pre->last_bufaddr) in ipu_pre_update()
242 writel(bufaddr, pre->regs + IPU_PRE_NEXT_BUF); in ipu_pre_update()
243 pre->last_bufaddr = bufaddr; in ipu_pre_update()
247 dev_warn(pre->dev, "timeout waiting for PRE safe window\n"); in ipu_pre_update()
251 val = readl(pre->regs + IPU_PRE_STORE_ENG_STATUS); in ipu_pre_update()
255 } while (current_yblock == 0 || current_yblock >= pre->safe_window_end); in ipu_pre_update()
257 writel(IPU_PRE_CTRL_SDW_UPDATE, pre->regs + IPU_PRE_CTRL_SET); in ipu_pre_update()
260 bool ipu_pre_update_pending(struct ipu_pre *pre) in ipu_pre_update_pending() argument
262 return !!(readl_relaxed(pre->regs + IPU_PRE_CTRL) & in ipu_pre_update_pending()
266 u32 ipu_pre_get_baddr(struct ipu_pre *pre) in ipu_pre_get_baddr() argument
268 return (u32)pre->buffer_paddr; in ipu_pre_get_baddr()
274 struct ipu_pre *pre; in ipu_pre_probe() local
276 pre = devm_kzalloc(dev, sizeof(*pre), GFP_KERNEL); in ipu_pre_probe()
277 if (!pre) in ipu_pre_probe()
280 pre->regs = devm_platform_ioremap_resource(pdev, 0); in ipu_pre_probe()
281 if (IS_ERR(pre->regs)) in ipu_pre_probe()
282 return PTR_ERR(pre->regs); in ipu_pre_probe()
284 pre->clk_axi = devm_clk_get(dev, "axi"); in ipu_pre_probe()
285 if (IS_ERR(pre->clk_axi)) in ipu_pre_probe()
286 return PTR_ERR(pre->clk_axi); in ipu_pre_probe()
288 pre->iram = of_gen_pool_get(dev->of_node, "fsl,iram", 0); in ipu_pre_probe()
289 if (!pre->iram) in ipu_pre_probe()
297 pre->buffer_virt = gen_pool_dma_alloc(pre->iram, IPU_PRE_MAX_WIDTH * in ipu_pre_probe()
299 &pre->buffer_paddr); in ipu_pre_probe()
300 if (!pre->buffer_virt) in ipu_pre_probe()
303 clk_prepare_enable(pre->clk_axi); in ipu_pre_probe()
305 pre->dev = dev; in ipu_pre_probe()
306 platform_set_drvdata(pdev, pre); in ipu_pre_probe()
308 list_add(&pre->list, &ipu_pre_list); in ipu_pre_probe()
317 struct ipu_pre *pre = platform_get_drvdata(pdev); in ipu_pre_remove() local
320 list_del(&pre->list); in ipu_pre_remove()
324 clk_disable_unprepare(pre->clk_axi); in ipu_pre_remove()
326 if (pre->buffer_virt) in ipu_pre_remove()
327 gen_pool_free(pre->iram, (unsigned long)pre->buffer_virt, in ipu_pre_remove()
333 { .compatible = "fsl,imx6qp-pre", },
341 .name = "imx-ipu-pre",