Lines Matching refs:hist

30 static void hist_reset_mem(struct ispstat *hist)  in hist_reset_mem()  argument
32 struct isp_device *isp = hist->isp; in hist_reset_mem()
33 struct omap3isp_hist_config *conf = hist->priv; in hist_reset_mem()
56 hist->wait_acc_frames = conf->num_acc_frames; in hist_reset_mem()
62 static void hist_setup_regs(struct ispstat *hist, void *priv) in hist_setup_regs() argument
64 struct isp_device *isp = hist->isp; in hist_setup_regs()
72 if (!hist->update || hist->state == ISPSTAT_DISABLED || in hist_setup_regs()
73 hist->state == ISPSTAT_DISABLING) in hist_setup_regs()
121 hist_reset_mem(hist); in hist_setup_regs()
134 hist->update = 0; in hist_setup_regs()
135 hist->config_counter += hist->inc_config; in hist_setup_regs()
136 hist->inc_config = 0; in hist_setup_regs()
137 hist->buf_size = conf->buf_size; in hist_setup_regs()
140 static void hist_enable(struct ispstat *hist, int enable) in hist_enable() argument
143 isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, in hist_enable()
145 omap3isp_subclk_enable(hist->isp, OMAP3_ISP_SUBCLK_HIST); in hist_enable()
147 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, in hist_enable()
149 omap3isp_subclk_disable(hist->isp, OMAP3_ISP_SUBCLK_HIST); in hist_enable()
153 static int hist_busy(struct ispstat *hist) in hist_busy() argument
155 return isp_reg_readl(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR) in hist_busy()
161 struct ispstat *hist = data; in hist_dma_cb() local
165 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_dma_cb()
168 omap3isp_stat_dma_isr(hist); in hist_dma_cb()
169 if (hist->state != ISPSTAT_DISABLED) in hist_dma_cb()
170 omap3isp_hist_dma_done(hist->isp); in hist_dma_cb()
173 static int hist_buf_dma(struct ispstat *hist) in hist_buf_dma() argument
175 dma_addr_t dma_addr = hist->active_buf->dma_addr; in hist_buf_dma()
182 dev_dbg(hist->isp->dev, "hist: invalid DMA buffer address\n"); in hist_buf_dma()
186 isp_reg_writel(hist->isp, 0, OMAP3_ISP_IOMEM_HIST, ISPHIST_ADDR); in hist_buf_dma()
187 isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_buf_dma()
189 omap3isp_flush(hist->isp); in hist_buf_dma()
192 cfg.src_addr = hist->isp->mmio_hist_base_phys + ISPHIST_DATA; in hist_buf_dma()
194 cfg.src_maxburst = hist->buf_size / 4; in hist_buf_dma()
196 ret = dmaengine_slave_config(hist->dma_ch, &cfg); in hist_buf_dma()
198 dev_dbg(hist->isp->dev, in hist_buf_dma()
203 tx = dmaengine_prep_slave_single(hist->dma_ch, dma_addr, in hist_buf_dma()
204 hist->buf_size, DMA_DEV_TO_MEM, in hist_buf_dma()
207 dev_dbg(hist->isp->dev, in hist_buf_dma()
213 tx->callback_param = hist; in hist_buf_dma()
216 dev_dbg(hist->isp->dev, "hist: DMA submission failed\n"); in hist_buf_dma()
220 dma_async_issue_pending(hist->dma_ch); in hist_buf_dma()
225 hist_reset_mem(hist); in hist_buf_dma()
229 static int hist_buf_pio(struct ispstat *hist) in hist_buf_pio() argument
231 struct isp_device *isp = hist->isp; in hist_buf_pio()
232 u32 *buf = hist->active_buf->virt_addr; in hist_buf_pio()
237 hist_reset_mem(hist); in hist_buf_pio()
255 for (i = hist->buf_size / 16; i > 0; i--) { in hist_buf_pio()
261 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_buf_pio()
270 static int hist_buf_process(struct ispstat *hist) in hist_buf_process() argument
272 struct omap3isp_hist_config *user_cfg = hist->priv; in hist_buf_process()
275 if (atomic_read(&hist->buf_err) || hist->state != ISPSTAT_ENABLED) { in hist_buf_process()
276 hist_reset_mem(hist); in hist_buf_process()
280 if (--(hist->wait_acc_frames)) in hist_buf_process()
283 if (hist->dma_ch) in hist_buf_process()
284 ret = hist_buf_dma(hist); in hist_buf_process()
286 ret = hist_buf_pio(hist); in hist_buf_process()
288 hist->wait_acc_frames = user_cfg->num_acc_frames; in hist_buf_process()
304 static int hist_validate_params(struct ispstat *hist, void *new_conf) in hist_validate_params() argument
360 static int hist_comp_params(struct ispstat *hist, in hist_comp_params() argument
363 struct omap3isp_hist_config *cur_cfg = hist->priv; in hist_comp_params()
404 static void hist_set_params(struct ispstat *hist, void *new_conf) in hist_set_params() argument
407 struct omap3isp_hist_config *cur_cfg = hist->priv; in hist_set_params()
409 if (!hist->configured || hist_comp_params(hist, user_cfg)) { in hist_set_params()
413 hist->inc_config++; in hist_set_params()
414 hist->update = 1; in hist_set_params()
476 struct ispstat *hist = &isp->isp_hist; in omap3isp_hist_init() local
484 hist->isp = isp; in omap3isp_hist_init()
498 hist->dma_ch = dma_request_chan_by_mask(&mask); in omap3isp_hist_init()
499 if (IS_ERR(hist->dma_ch)) { in omap3isp_hist_init()
500 ret = PTR_ERR(hist->dma_ch); in omap3isp_hist_init()
504 hist->dma_ch = NULL; in omap3isp_hist_init()
509 dma_chan_name(hist->dma_ch)); in omap3isp_hist_init()
513 hist->ops = &hist_ops; in omap3isp_hist_init()
514 hist->priv = hist_cfg; in omap3isp_hist_init()
515 hist->event_type = V4L2_EVENT_OMAP3ISP_HIST; in omap3isp_hist_init()
517 ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops); in omap3isp_hist_init()
521 if (!IS_ERR_OR_NULL(hist->dma_ch)) in omap3isp_hist_init()
522 dma_release_channel(hist->dma_ch); in omap3isp_hist_init()
534 struct ispstat *hist = &isp->isp_hist; in omap3isp_hist_cleanup() local
536 if (hist->dma_ch) in omap3isp_hist_cleanup()
537 dma_release_channel(hist->dma_ch); in omap3isp_hist_cleanup()
539 omap3isp_stat_cleanup(hist); in omap3isp_hist_cleanup()