Lines Matching refs:hist

33 static void hist_reset_mem(struct ispstat *hist)  in hist_reset_mem()  argument
35 struct isp_device *isp = hist->isp; in hist_reset_mem()
36 struct omap3isp_hist_config *conf = hist->priv; in hist_reset_mem()
59 hist->wait_acc_frames = conf->num_acc_frames; in hist_reset_mem()
65 static void hist_setup_regs(struct ispstat *hist, void *priv) in hist_setup_regs() argument
67 struct isp_device *isp = hist->isp; in hist_setup_regs()
75 if (!hist->update || hist->state == ISPSTAT_DISABLED || in hist_setup_regs()
76 hist->state == ISPSTAT_DISABLING) in hist_setup_regs()
124 hist_reset_mem(hist); in hist_setup_regs()
137 hist->update = 0; in hist_setup_regs()
138 hist->config_counter += hist->inc_config; in hist_setup_regs()
139 hist->inc_config = 0; in hist_setup_regs()
140 hist->buf_size = conf->buf_size; in hist_setup_regs()
143 static void hist_enable(struct ispstat *hist, int enable) in hist_enable() argument
146 isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, in hist_enable()
148 omap3isp_subclk_enable(hist->isp, OMAP3_ISP_SUBCLK_HIST); in hist_enable()
150 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, in hist_enable()
152 omap3isp_subclk_disable(hist->isp, OMAP3_ISP_SUBCLK_HIST); in hist_enable()
156 static int hist_busy(struct ispstat *hist) in hist_busy() argument
158 return isp_reg_readl(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR) in hist_busy()
164 struct ispstat *hist = data; in hist_dma_cb() local
168 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_dma_cb()
171 omap3isp_stat_dma_isr(hist); in hist_dma_cb()
172 if (hist->state != ISPSTAT_DISABLED) in hist_dma_cb()
173 omap3isp_hist_dma_done(hist->isp); in hist_dma_cb()
176 static int hist_buf_dma(struct ispstat *hist) in hist_buf_dma() argument
178 dma_addr_t dma_addr = hist->active_buf->dma_addr; in hist_buf_dma()
185 dev_dbg(hist->isp->dev, "hist: invalid DMA buffer address\n"); in hist_buf_dma()
189 isp_reg_writel(hist->isp, 0, OMAP3_ISP_IOMEM_HIST, ISPHIST_ADDR); in hist_buf_dma()
190 isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_buf_dma()
192 omap3isp_flush(hist->isp); in hist_buf_dma()
195 cfg.src_addr = hist->isp->mmio_hist_base_phys + ISPHIST_DATA; in hist_buf_dma()
197 cfg.src_maxburst = hist->buf_size / 4; in hist_buf_dma()
199 ret = dmaengine_slave_config(hist->dma_ch, &cfg); in hist_buf_dma()
201 dev_dbg(hist->isp->dev, in hist_buf_dma()
206 tx = dmaengine_prep_slave_single(hist->dma_ch, dma_addr, in hist_buf_dma()
207 hist->buf_size, DMA_DEV_TO_MEM, in hist_buf_dma()
210 dev_dbg(hist->isp->dev, in hist_buf_dma()
216 tx->callback_param = hist; in hist_buf_dma()
219 dev_dbg(hist->isp->dev, "hist: DMA submission failed\n"); in hist_buf_dma()
223 dma_async_issue_pending(hist->dma_ch); in hist_buf_dma()
228 hist_reset_mem(hist); in hist_buf_dma()
232 static int hist_buf_pio(struct ispstat *hist) in hist_buf_pio() argument
234 struct isp_device *isp = hist->isp; in hist_buf_pio()
235 u32 *buf = hist->active_buf->virt_addr; in hist_buf_pio()
240 hist_reset_mem(hist); in hist_buf_pio()
258 for (i = hist->buf_size / 16; i > 0; i--) { in hist_buf_pio()
264 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_buf_pio()
273 static int hist_buf_process(struct ispstat *hist) in hist_buf_process() argument
275 struct omap3isp_hist_config *user_cfg = hist->priv; in hist_buf_process()
278 if (atomic_read(&hist->buf_err) || hist->state != ISPSTAT_ENABLED) { in hist_buf_process()
279 hist_reset_mem(hist); in hist_buf_process()
283 if (--(hist->wait_acc_frames)) in hist_buf_process()
286 if (hist->dma_ch) in hist_buf_process()
287 ret = hist_buf_dma(hist); in hist_buf_process()
289 ret = hist_buf_pio(hist); in hist_buf_process()
291 hist->wait_acc_frames = user_cfg->num_acc_frames; in hist_buf_process()
307 static int hist_validate_params(struct ispstat *hist, void *new_conf) in hist_validate_params() argument
363 static int hist_comp_params(struct ispstat *hist, in hist_comp_params() argument
366 struct omap3isp_hist_config *cur_cfg = hist->priv; in hist_comp_params()
407 static void hist_set_params(struct ispstat *hist, void *new_conf) in hist_set_params() argument
410 struct omap3isp_hist_config *cur_cfg = hist->priv; in hist_set_params()
412 if (!hist->configured || hist_comp_params(hist, user_cfg)) { in hist_set_params()
416 hist->inc_config++; in hist_set_params()
417 hist->update = 1; in hist_set_params()
479 struct ispstat *hist = &isp->isp_hist; in omap3isp_hist_init() local
487 hist->isp = isp; in omap3isp_hist_init()
501 hist->dma_ch = dma_request_chan_by_mask(&mask); in omap3isp_hist_init()
502 if (IS_ERR(hist->dma_ch)) { in omap3isp_hist_init()
503 ret = PTR_ERR(hist->dma_ch); in omap3isp_hist_init()
507 hist->dma_ch = NULL; in omap3isp_hist_init()
512 dma_chan_name(hist->dma_ch)); in omap3isp_hist_init()
516 hist->ops = &hist_ops; in omap3isp_hist_init()
517 hist->priv = hist_cfg; in omap3isp_hist_init()
518 hist->event_type = V4L2_EVENT_OMAP3ISP_HIST; in omap3isp_hist_init()
520 ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops); in omap3isp_hist_init()
522 if (hist->dma_ch) in omap3isp_hist_init()
523 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()