Lines Matching refs:hist
34 static void hist_reset_mem(struct ispstat *hist) in hist_reset_mem() argument
36 struct isp_device *isp = hist->isp; in hist_reset_mem()
37 struct omap3isp_hist_config *conf = hist->priv; in hist_reset_mem()
60 hist->wait_acc_frames = conf->num_acc_frames; in hist_reset_mem()
66 static void hist_setup_regs(struct ispstat *hist, void *priv) in hist_setup_regs() argument
68 struct isp_device *isp = hist->isp; in hist_setup_regs()
76 if (!hist->update || hist->state == ISPSTAT_DISABLED || in hist_setup_regs()
77 hist->state == ISPSTAT_DISABLING) in hist_setup_regs()
125 hist_reset_mem(hist); in hist_setup_regs()
138 hist->update = 0; in hist_setup_regs()
139 hist->config_counter += hist->inc_config; in hist_setup_regs()
140 hist->inc_config = 0; in hist_setup_regs()
141 hist->buf_size = conf->buf_size; in hist_setup_regs()
144 static void hist_enable(struct ispstat *hist, int enable) in hist_enable() argument
147 isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, in hist_enable()
149 omap3isp_subclk_enable(hist->isp, OMAP3_ISP_SUBCLK_HIST); in hist_enable()
151 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, in hist_enable()
153 omap3isp_subclk_disable(hist->isp, OMAP3_ISP_SUBCLK_HIST); in hist_enable()
157 static int hist_busy(struct ispstat *hist) in hist_busy() argument
159 return isp_reg_readl(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR) in hist_busy()
165 struct ispstat *hist = data; in hist_dma_cb() local
169 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_dma_cb()
172 omap3isp_stat_dma_isr(hist); in hist_dma_cb()
173 if (hist->state != ISPSTAT_DISABLED) in hist_dma_cb()
174 omap3isp_hist_dma_done(hist->isp); in hist_dma_cb()
177 static int hist_buf_dma(struct ispstat *hist) in hist_buf_dma() argument
179 dma_addr_t dma_addr = hist->active_buf->dma_addr; in hist_buf_dma()
186 dev_dbg(hist->isp->dev, "hist: invalid DMA buffer address\n"); in hist_buf_dma()
190 isp_reg_writel(hist->isp, 0, OMAP3_ISP_IOMEM_HIST, ISPHIST_ADDR); in hist_buf_dma()
191 isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_buf_dma()
193 omap3isp_flush(hist->isp); in hist_buf_dma()
196 cfg.src_addr = hist->isp->mmio_hist_base_phys + ISPHIST_DATA; in hist_buf_dma()
198 cfg.src_maxburst = hist->buf_size / 4; in hist_buf_dma()
200 ret = dmaengine_slave_config(hist->dma_ch, &cfg); in hist_buf_dma()
202 dev_dbg(hist->isp->dev, in hist_buf_dma()
207 tx = dmaengine_prep_slave_single(hist->dma_ch, dma_addr, in hist_buf_dma()
208 hist->buf_size, DMA_DEV_TO_MEM, in hist_buf_dma()
211 dev_dbg(hist->isp->dev, in hist_buf_dma()
217 tx->callback_param = hist; in hist_buf_dma()
220 dev_dbg(hist->isp->dev, "hist: DMA submission failed\n"); in hist_buf_dma()
224 dma_async_issue_pending(hist->dma_ch); in hist_buf_dma()
229 hist_reset_mem(hist); in hist_buf_dma()
233 static int hist_buf_pio(struct ispstat *hist) in hist_buf_pio() argument
235 struct isp_device *isp = hist->isp; in hist_buf_pio()
236 u32 *buf = hist->active_buf->virt_addr; in hist_buf_pio()
241 hist_reset_mem(hist); in hist_buf_pio()
259 for (i = hist->buf_size / 16; i > 0; i--) { in hist_buf_pio()
265 isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_CNT, in hist_buf_pio()
274 static int hist_buf_process(struct ispstat *hist) in hist_buf_process() argument
276 struct omap3isp_hist_config *user_cfg = hist->priv; in hist_buf_process()
279 if (atomic_read(&hist->buf_err) || hist->state != ISPSTAT_ENABLED) { in hist_buf_process()
280 hist_reset_mem(hist); in hist_buf_process()
284 if (--(hist->wait_acc_frames)) in hist_buf_process()
287 if (hist->dma_ch) in hist_buf_process()
288 ret = hist_buf_dma(hist); in hist_buf_process()
290 ret = hist_buf_pio(hist); in hist_buf_process()
292 hist->wait_acc_frames = user_cfg->num_acc_frames; in hist_buf_process()
308 static int hist_validate_params(struct ispstat *hist, void *new_conf) in hist_validate_params() argument
364 static int hist_comp_params(struct ispstat *hist, in hist_comp_params() argument
367 struct omap3isp_hist_config *cur_cfg = hist->priv; in hist_comp_params()
408 static void hist_set_params(struct ispstat *hist, void *new_conf) in hist_set_params() argument
411 struct omap3isp_hist_config *cur_cfg = hist->priv; in hist_set_params()
413 if (!hist->configured || hist_comp_params(hist, user_cfg)) { in hist_set_params()
417 hist->inc_config++; in hist_set_params()
418 hist->update = 1; in hist_set_params()
478 struct ispstat *hist = &isp->isp_hist; in omap3isp_hist_init() local
486 hist->isp = isp; in omap3isp_hist_init()
502 hist->dma_ch = dma_request_slave_channel_compat(mask, in omap3isp_hist_init()
504 if (!hist->dma_ch) in omap3isp_hist_init()
509 dma_chan_name(hist->dma_ch)); in omap3isp_hist_init()
512 hist->ops = &hist_ops; in omap3isp_hist_init()
513 hist->priv = hist_cfg; in omap3isp_hist_init()
514 hist->event_type = V4L2_EVENT_OMAP3ISP_HIST; in omap3isp_hist_init()
516 ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops); in omap3isp_hist_init()
518 if (hist->dma_ch) in omap3isp_hist_init()
519 dma_release_channel(hist->dma_ch); in omap3isp_hist_init()
530 struct ispstat *hist = &isp->isp_hist; in omap3isp_hist_cleanup() local
532 if (hist->dma_ch) in omap3isp_hist_cleanup()
533 dma_release_channel(hist->dma_ch); in omap3isp_hist_cleanup()
535 omap3isp_stat_cleanup(hist); in omap3isp_hist_cleanup()