dcmi              203 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_start_capture(struct stm32_dcmi *dcmi, struct dcmi_buf *buf);
dcmi              205 drivers/media/platform/stm32/stm32-dcmi.c static void dcmi_buffer_done(struct stm32_dcmi *dcmi,
dcmi              219 drivers/media/platform/stm32/stm32-dcmi.c 	vbuf->sequence = dcmi->sequence++;
dcmi              225 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "buffer[%d] done seq=%d, bytesused=%zu\n",
dcmi              228 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->buffers_count++;
dcmi              229 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->active = NULL;
dcmi              232 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_restart_capture(struct stm32_dcmi *dcmi)
dcmi              236 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              238 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->state != RUNNING) {
dcmi              239 drivers/media/platform/stm32/stm32-dcmi.c 		spin_unlock_irq(&dcmi->irqlock);
dcmi              244 drivers/media/platform/stm32/stm32-dcmi.c 	if (list_empty(&dcmi->buffers)) {
dcmi              245 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "Capture restart is deferred to next buffer queueing\n");
dcmi              246 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->state = WAIT_FOR_BUFFER;
dcmi              247 drivers/media/platform/stm32/stm32-dcmi.c 		spin_unlock_irq(&dcmi->irqlock);
dcmi              250 drivers/media/platform/stm32/stm32-dcmi.c 	buf = list_entry(dcmi->buffers.next, struct dcmi_buf, list);
dcmi              251 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->active = buf;
dcmi              253 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              255 drivers/media/platform/stm32/stm32-dcmi.c 	return dcmi_start_capture(dcmi, buf);
dcmi              260 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = (struct stm32_dcmi *)param;
dcmi              263 drivers/media/platform/stm32/stm32-dcmi.c 	struct dcmi_buf *buf = dcmi->active;
dcmi              265 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              268 drivers/media/platform/stm32/stm32-dcmi.c 	status = dmaengine_tx_status(dcmi->dma_chan, dcmi->dma_cookie, &state);
dcmi              272 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "%s: Received DMA_IN_PROGRESS\n", __func__);
dcmi              275 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Received DMA_PAUSED\n", __func__);
dcmi              278 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Received DMA_ERROR\n", __func__);
dcmi              281 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi_buffer_done(dcmi, buf, 0, -EIO);
dcmi              284 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "%s: Received DMA_COMPLETE\n", __func__);
dcmi              287 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi_buffer_done(dcmi, buf, buf->size, 0);
dcmi              289 drivers/media/platform/stm32/stm32-dcmi.c 		spin_unlock_irq(&dcmi->irqlock);
dcmi              292 drivers/media/platform/stm32/stm32-dcmi.c 		if (dcmi_restart_capture(dcmi))
dcmi              293 drivers/media/platform/stm32/stm32-dcmi.c 			dev_err(dcmi->dev, "%s: Cannot restart capture on DMA complete\n",
dcmi              297 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Received unknown status\n", __func__);
dcmi              301 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              304 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_start_dma(struct stm32_dcmi *dcmi,
dcmi              313 drivers/media/platform/stm32/stm32-dcmi.c 	config.src_addr = (dma_addr_t)dcmi->res->start + DCMI_DR;
dcmi              319 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dmaengine_slave_config(dcmi->dma_chan, &config);
dcmi              321 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: DMA channel config failed (%d)\n",
dcmi              331 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_lock(&dcmi->dma_lock);
dcmi              334 drivers/media/platform/stm32/stm32-dcmi.c 	desc = dmaengine_prep_slave_single(dcmi->dma_chan, buf->paddr,
dcmi              339 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: DMA dmaengine_prep_slave_single failed for buffer phy=%pad size=%zu\n",
dcmi              341 drivers/media/platform/stm32/stm32-dcmi.c 		mutex_unlock(&dcmi->dma_lock);
dcmi              347 drivers/media/platform/stm32/stm32-dcmi.c 	desc->callback_param = dcmi;
dcmi              350 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->dma_cookie = dmaengine_submit(desc);
dcmi              351 drivers/media/platform/stm32/stm32-dcmi.c 	if (dma_submit_error(dcmi->dma_cookie)) {
dcmi              352 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: DMA submission failed\n", __func__);
dcmi              353 drivers/media/platform/stm32/stm32-dcmi.c 		mutex_unlock(&dcmi->dma_lock);
dcmi              357 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_unlock(&dcmi->dma_lock);
dcmi              359 drivers/media/platform/stm32/stm32-dcmi.c 	dma_async_issue_pending(dcmi->dma_chan);
dcmi              364 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_start_capture(struct stm32_dcmi *dcmi, struct dcmi_buf *buf)
dcmi              371 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_start_dma(dcmi, buf);
dcmi              373 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->errors_count++;
dcmi              378 drivers/media/platform/stm32/stm32-dcmi.c 	reg_set(dcmi->regs, DCMI_CR, CR_CAPTURE);
dcmi              383 drivers/media/platform/stm32/stm32-dcmi.c static void dcmi_set_crop(struct stm32_dcmi *dcmi)
dcmi              388 drivers/media/platform/stm32/stm32-dcmi.c 	size = ((dcmi->crop.height - 1) << 16) |
dcmi              389 drivers/media/platform/stm32/stm32-dcmi.c 		((dcmi->crop.width << 1) - 1);
dcmi              390 drivers/media/platform/stm32/stm32-dcmi.c 	reg_write(dcmi->regs, DCMI_CWSIZE, size);
dcmi              393 drivers/media/platform/stm32/stm32-dcmi.c 	start = ((dcmi->crop.top) << 16) |
dcmi              394 drivers/media/platform/stm32/stm32-dcmi.c 		 ((dcmi->crop.left << 1));
dcmi              395 drivers/media/platform/stm32/stm32-dcmi.c 	reg_write(dcmi->regs, DCMI_CWSTRT, start);
dcmi              397 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Cropping to %ux%u@%u:%u\n",
dcmi              398 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->crop.width, dcmi->crop.height,
dcmi              399 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->crop.left, dcmi->crop.top);
dcmi              402 drivers/media/platform/stm32/stm32-dcmi.c 	reg_set(dcmi->regs, DCMI_CR, CR_CROP);
dcmi              405 drivers/media/platform/stm32/stm32-dcmi.c static void dcmi_process_jpeg(struct stm32_dcmi *dcmi)
dcmi              409 drivers/media/platform/stm32/stm32-dcmi.c 	struct dcmi_buf *buf = dcmi->active;
dcmi              425 drivers/media/platform/stm32/stm32-dcmi.c 	dmaengine_synchronize(dcmi->dma_chan);
dcmi              428 drivers/media/platform/stm32/stm32-dcmi.c 	status = dmaengine_tx_status(dcmi->dma_chan, dcmi->dma_cookie, &state);
dcmi              431 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi_buffer_done(dcmi, buf, buf->size - state.residue, 0);
dcmi              433 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->errors_count++;
dcmi              434 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Cannot get JPEG size from DMA\n",
dcmi              437 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi_buffer_done(dcmi, buf, 0, -EIO);
dcmi              441 drivers/media/platform/stm32/stm32-dcmi.c 	dmaengine_terminate_all(dcmi->dma_chan);
dcmi              444 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi_restart_capture(dcmi))
dcmi              445 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Cannot restart capture on JPEG received\n",
dcmi              451 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = arg;
dcmi              453 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              455 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->misr & IT_OVR) {
dcmi              456 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->overrun_count++;
dcmi              457 drivers/media/platform/stm32/stm32-dcmi.c 		if (dcmi->overrun_count > OVERRUN_ERROR_THRESHOLD)
dcmi              458 drivers/media/platform/stm32/stm32-dcmi.c 			dcmi->errors_count++;
dcmi              460 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->misr & IT_ERR)
dcmi              461 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->errors_count++;
dcmi              463 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG &&
dcmi              464 drivers/media/platform/stm32/stm32-dcmi.c 	    dcmi->misr & IT_FRAME) {
dcmi              466 drivers/media/platform/stm32/stm32-dcmi.c 		spin_unlock_irq(&dcmi->irqlock);
dcmi              467 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi_process_jpeg(dcmi);
dcmi              471 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              477 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = arg;
dcmi              480 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irqsave(&dcmi->irqlock, flags);
dcmi              482 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->misr = reg_read(dcmi->regs, DCMI_MIS);
dcmi              485 drivers/media/platform/stm32/stm32-dcmi.c 	reg_set(dcmi->regs, DCMI_ICR, IT_FRAME | IT_OVR | IT_ERR);
dcmi              487 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irqrestore(&dcmi->irqlock, flags);
dcmi              498 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq);
dcmi              501 drivers/media/platform/stm32/stm32-dcmi.c 	size = dcmi->fmt.fmt.pix.sizeimage;
dcmi              510 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Setup queue, count=%d, size=%d\n",
dcmi              528 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi =  vb2_get_drv_priv(vb->vb2_queue);
dcmi              533 drivers/media/platform/stm32/stm32-dcmi.c 	size = dcmi->fmt.fmt.pix.sizeimage;
dcmi              536 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s data will not fit into plane (%lu < %lu)\n",
dcmi              552 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "buffer[%d] phy=%pad size=%zu\n",
dcmi              561 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi =  vb2_get_drv_priv(vb->vb2_queue);
dcmi              565 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              568 drivers/media/platform/stm32/stm32-dcmi.c 	list_add_tail(&buf->list, &dcmi->buffers);
dcmi              570 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->state == WAIT_FOR_BUFFER) {
dcmi              571 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->state = RUNNING;
dcmi              572 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->active = buf;
dcmi              574 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "Starting capture on buffer[%d] queued\n",
dcmi              577 drivers/media/platform/stm32/stm32-dcmi.c 		spin_unlock_irq(&dcmi->irqlock);
dcmi              578 drivers/media/platform/stm32/stm32-dcmi.c 		if (dcmi_start_capture(dcmi, buf))
dcmi              579 drivers/media/platform/stm32/stm32-dcmi.c 			dev_err(dcmi->dev, "%s: Cannot restart capture on overflow or error\n",
dcmi              584 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              587 drivers/media/platform/stm32/stm32-dcmi.c static struct media_entity *dcmi_find_source(struct stm32_dcmi *dcmi)
dcmi              589 drivers/media/platform/stm32/stm32-dcmi.c 	struct media_entity *entity = &dcmi->vdev->entity;
dcmi              608 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_pipeline_s_fmt(struct stm32_dcmi *dcmi,
dcmi              612 drivers/media/platform/stm32/stm32-dcmi.c 	struct media_entity *entity = &dcmi->entity.source->entity;
dcmi              646 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "\"%s\":%d pad format set to 0x%x %ux%u\n",
dcmi              653 drivers/media/platform/stm32/stm32-dcmi.c 			dev_err(dcmi->dev, "%s: Failed to set format 0x%x %ux%u on \"%s\":%d pad (%d)\n",
dcmi              663 drivers/media/platform/stm32/stm32-dcmi.c 			dev_dbg(dcmi->dev, "\"%s\":%d pad format has been changed to 0x%x %ux%u\n",
dcmi              680 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_pipeline_s_stream(struct stm32_dcmi *dcmi, int state)
dcmi              682 drivers/media/platform/stm32/stm32-dcmi.c 	struct media_entity *entity = &dcmi->vdev->entity;
dcmi              702 drivers/media/platform/stm32/stm32-dcmi.c 			dev_err(dcmi->dev, "%s: \"%s\" failed to %s streaming (%d)\n",
dcmi              708 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "\"%s\" is %s\n",
dcmi              715 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_pipeline_start(struct stm32_dcmi *dcmi)
dcmi              717 drivers/media/platform/stm32/stm32-dcmi.c 	return dcmi_pipeline_s_stream(dcmi, 1);
dcmi              720 drivers/media/platform/stm32/stm32-dcmi.c static void dcmi_pipeline_stop(struct stm32_dcmi *dcmi)
dcmi              722 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi_pipeline_s_stream(dcmi, 0);
dcmi              727 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq);
dcmi              732 drivers/media/platform/stm32/stm32-dcmi.c 	ret = pm_runtime_get_sync(dcmi->dev);
dcmi              734 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Failed to start streaming, cannot get sync (%d)\n",
dcmi              739 drivers/media/platform/stm32/stm32-dcmi.c 	ret = media_pipeline_start(&dcmi->vdev->entity, &dcmi->pipeline);
dcmi              741 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Failed to start streaming, media pipeline start error (%d)\n",
dcmi              746 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_pipeline_start(dcmi);
dcmi              750 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              753 drivers/media/platform/stm32/stm32-dcmi.c 	switch (dcmi->bus.bus_width) {
dcmi              769 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->bus.flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
dcmi              773 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->bus.flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
dcmi              777 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->bus.flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
dcmi              780 drivers/media/platform/stm32/stm32-dcmi.c 	reg_write(dcmi->regs, DCMI_CR, val);
dcmi              783 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->do_crop)
dcmi              784 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi_set_crop(dcmi);
dcmi              787 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG)
dcmi              788 drivers/media/platform/stm32/stm32-dcmi.c 		reg_set(dcmi->regs, DCMI_CR, CR_CM);/* Snapshot mode */
dcmi              791 drivers/media/platform/stm32/stm32-dcmi.c 	reg_set(dcmi->regs, DCMI_CR, CR_ENABLE);
dcmi              793 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sequence = 0;
dcmi              794 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->errors_count = 0;
dcmi              795 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->overrun_count = 0;
dcmi              796 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->buffers_count = 0;
dcmi              802 drivers/media/platform/stm32/stm32-dcmi.c 	if (list_empty(&dcmi->buffers)) {
dcmi              803 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "Start streaming is deferred to next buffer queueing\n");
dcmi              804 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->state = WAIT_FOR_BUFFER;
dcmi              805 drivers/media/platform/stm32/stm32-dcmi.c 		spin_unlock_irq(&dcmi->irqlock);
dcmi              809 drivers/media/platform/stm32/stm32-dcmi.c 	buf = list_entry(dcmi->buffers.next, struct dcmi_buf, list);
dcmi              810 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->active = buf;
dcmi              812 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->state = RUNNING;
dcmi              814 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Start streaming, starting capture\n");
dcmi              816 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              817 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_start_capture(dcmi, buf);
dcmi              819 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "%s: Start streaming failed, cannot start capture\n",
dcmi              825 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->sd_format->fourcc == V4L2_PIX_FMT_JPEG)
dcmi              826 drivers/media/platform/stm32/stm32-dcmi.c 		reg_set(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR);
dcmi              828 drivers/media/platform/stm32/stm32-dcmi.c 		reg_set(dcmi->regs, DCMI_IER, IT_OVR | IT_ERR);
dcmi              833 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi_pipeline_stop(dcmi);
dcmi              836 drivers/media/platform/stm32/stm32-dcmi.c 	media_pipeline_stop(&dcmi->vdev->entity);
dcmi              839 drivers/media/platform/stm32/stm32-dcmi.c 	pm_runtime_put(dcmi->dev);
dcmi              842 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              847 drivers/media/platform/stm32/stm32-dcmi.c 	list_for_each_entry_safe(buf, node, &dcmi->buffers, list) {
dcmi              851 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->active = NULL;
dcmi              852 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              859 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq);
dcmi              862 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi_pipeline_stop(dcmi);
dcmi              864 drivers/media/platform/stm32/stm32-dcmi.c 	media_pipeline_stop(&dcmi->vdev->entity);
dcmi              866 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_irq(&dcmi->irqlock);
dcmi              869 drivers/media/platform/stm32/stm32-dcmi.c 	reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR);
dcmi              872 drivers/media/platform/stm32/stm32-dcmi.c 	reg_clear(dcmi->regs, DCMI_CR, CR_ENABLE);
dcmi              875 drivers/media/platform/stm32/stm32-dcmi.c 	list_for_each_entry_safe(buf, node, &dcmi->buffers, list) {
dcmi              880 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->active = NULL;
dcmi              881 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->state = STOPPED;
dcmi              883 drivers/media/platform/stm32/stm32-dcmi.c 	spin_unlock_irq(&dcmi->irqlock);
dcmi              886 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_lock(&dcmi->dma_lock);
dcmi              887 drivers/media/platform/stm32/stm32-dcmi.c 	dmaengine_terminate_all(dcmi->dma_chan);
dcmi              888 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_unlock(&dcmi->dma_lock);
dcmi              890 drivers/media/platform/stm32/stm32-dcmi.c 	pm_runtime_put(dcmi->dev);
dcmi              892 drivers/media/platform/stm32/stm32-dcmi.c 	if (dcmi->errors_count)
dcmi              893 drivers/media/platform/stm32/stm32-dcmi.c 		dev_warn(dcmi->dev, "Some errors found while streaming: errors=%d (overrun=%d), buffers=%d\n",
dcmi              894 drivers/media/platform/stm32/stm32-dcmi.c 			 dcmi->errors_count, dcmi->overrun_count,
dcmi              895 drivers/media/platform/stm32/stm32-dcmi.c 			 dcmi->buffers_count);
dcmi              896 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Stop streaming, errors=%d (overrun=%d), buffers=%d\n",
dcmi              897 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->errors_count, dcmi->overrun_count,
dcmi              898 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->buffers_count);
dcmi              915 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi              917 drivers/media/platform/stm32/stm32-dcmi.c 	*fmt = dcmi->fmt;
dcmi              922 drivers/media/platform/stm32/stm32-dcmi.c static const struct dcmi_format *find_format_by_fourcc(struct stm32_dcmi *dcmi,
dcmi              925 drivers/media/platform/stm32/stm32-dcmi.c 	unsigned int num_formats = dcmi->num_of_sd_formats;
dcmi              930 drivers/media/platform/stm32/stm32-dcmi.c 		fmt = dcmi->sd_formats[i];
dcmi              938 drivers/media/platform/stm32/stm32-dcmi.c static void __find_outer_frame_size(struct stm32_dcmi *dcmi,
dcmi              946 drivers/media/platform/stm32/stm32-dcmi.c 	for (i = 0; i < dcmi->num_of_sd_framesizes; i++) {
dcmi              947 drivers/media/platform/stm32/stm32-dcmi.c 		struct dcmi_framesize *fsize = &dcmi->sd_framesizes[i];
dcmi              958 drivers/media/platform/stm32/stm32-dcmi.c 		match = &dcmi->sd_framesizes[0];
dcmi              963 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_try_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f,
dcmi              977 drivers/media/platform/stm32/stm32-dcmi.c 	sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat);
dcmi              979 drivers/media/platform/stm32/stm32-dcmi.c 		if (!dcmi->num_of_sd_formats)
dcmi              982 drivers/media/platform/stm32/stm32-dcmi.c 		sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats - 1];
dcmi              991 drivers/media/platform/stm32/stm32-dcmi.c 	do_crop = dcmi->do_crop && (pix->pixelformat != V4L2_PIX_FMT_JPEG);
dcmi              993 drivers/media/platform/stm32/stm32-dcmi.c 	if (do_crop && dcmi->num_of_sd_framesizes) {
dcmi              999 drivers/media/platform/stm32/stm32-dcmi.c 		__find_outer_frame_size(dcmi, pix, &outer_sd_fsize);
dcmi             1005 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_subdev_call(dcmi->entity.source, pad, set_fmt,
dcmi             1018 drivers/media/platform/stm32/stm32-dcmi.c 		struct v4l2_rect c = dcmi->crop;
dcmi             1032 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->crop = c;
dcmi             1035 drivers/media/platform/stm32/stm32-dcmi.c 		pix->width = dcmi->crop.width;
dcmi             1036 drivers/media/platform/stm32/stm32-dcmi.c 		pix->height = dcmi->crop.height;
dcmi             1051 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_set_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f)
dcmi             1068 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_try_fmt(dcmi, f, &sd_format, &sd_framesize);
dcmi             1074 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->do_crop = false;
dcmi             1082 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_pipeline_s_fmt(dcmi, NULL, &format);
dcmi             1086 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Sensor format set to 0x%x %ux%u\n",
dcmi             1088 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Buffer format set to %4.4s %ux%u\n",
dcmi             1092 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->fmt = *f;
dcmi             1093 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sd_format = sd_format;
dcmi             1094 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sd_framesize = sd_framesize;
dcmi             1102 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1104 drivers/media/platform/stm32/stm32-dcmi.c 	if (vb2_is_streaming(&dcmi->queue))
dcmi             1107 drivers/media/platform/stm32/stm32-dcmi.c 	return dcmi_set_fmt(dcmi, f);
dcmi             1113 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1115 drivers/media/platform/stm32/stm32-dcmi.c 	return dcmi_try_fmt(dcmi, f, NULL, NULL);
dcmi             1121 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1123 drivers/media/platform/stm32/stm32-dcmi.c 	if (f->index >= dcmi->num_of_sd_formats)
dcmi             1126 drivers/media/platform/stm32/stm32-dcmi.c 	f->pixelformat = dcmi->sd_formats[f->index]->fourcc;
dcmi             1130 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_get_sensor_format(struct stm32_dcmi *dcmi,
dcmi             1138 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_subdev_call(dcmi->entity.source, pad, get_fmt, NULL, &fmt);
dcmi             1147 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_set_sensor_format(struct stm32_dcmi *dcmi,
dcmi             1157 drivers/media/platform/stm32/stm32-dcmi.c 	sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat);
dcmi             1159 drivers/media/platform/stm32/stm32-dcmi.c 		if (!dcmi->num_of_sd_formats)
dcmi             1162 drivers/media/platform/stm32/stm32-dcmi.c 		sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats - 1];
dcmi             1167 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_subdev_call(dcmi->entity.source, pad, set_fmt,
dcmi             1175 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_get_sensor_bounds(struct stm32_dcmi *dcmi,
dcmi             1190 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_subdev_call(dcmi->entity.source, pad, get_selection,
dcmi             1205 drivers/media/platform/stm32/stm32-dcmi.c 	for (i = 0; i < dcmi->num_of_sd_framesizes; i++) {
dcmi             1206 drivers/media/platform/stm32/stm32-dcmi.c 		struct dcmi_framesize *fsize = &dcmi->sd_framesizes[i];
dcmi             1227 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_get_sensor_format(dcmi, &pix);
dcmi             1242 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1250 drivers/media/platform/stm32/stm32-dcmi.c 		s->r = dcmi->sd_bounds;
dcmi             1253 drivers/media/platform/stm32/stm32-dcmi.c 		if (dcmi->do_crop) {
dcmi             1254 drivers/media/platform/stm32/stm32-dcmi.c 			s->r = dcmi->crop;
dcmi             1258 drivers/media/platform/stm32/stm32-dcmi.c 			s->r.width = dcmi->fmt.fmt.pix.width;
dcmi             1259 drivers/media/platform/stm32/stm32-dcmi.c 			s->r.height = dcmi->fmt.fmt.pix.height;
dcmi             1272 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1282 drivers/media/platform/stm32/stm32-dcmi.c 	pix.pixelformat = dcmi->fmt.fmt.pix.pixelformat;
dcmi             1283 drivers/media/platform/stm32/stm32-dcmi.c 	pix.width = dcmi->sd_bounds.width;
dcmi             1284 drivers/media/platform/stm32/stm32-dcmi.c 	pix.height = dcmi->sd_bounds.height;
dcmi             1285 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi_set_sensor_format(dcmi, &pix);
dcmi             1300 drivers/media/platform/stm32/stm32-dcmi.c 	if (!(r.top == dcmi->sd_bounds.top &&
dcmi             1301 drivers/media/platform/stm32/stm32-dcmi.c 	      r.left == dcmi->sd_bounds.left &&
dcmi             1302 drivers/media/platform/stm32/stm32-dcmi.c 	      r.width == dcmi->sd_bounds.width &&
dcmi             1303 drivers/media/platform/stm32/stm32-dcmi.c 	      r.height == dcmi->sd_bounds.height)) {
dcmi             1305 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->do_crop = true;
dcmi             1306 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->crop = r;
dcmi             1307 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "s_selection: crop %ux%u@(%u,%u) from %ux%u\n",
dcmi             1312 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->do_crop = false;
dcmi             1313 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "s_selection: crop is disabled\n");
dcmi             1357 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1365 drivers/media/platform/stm32/stm32-dcmi.c 	sd_fmt = find_format_by_fourcc(dcmi, fsize->pixel_format);
dcmi             1371 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_subdev_call(dcmi->entity.source, pad, enum_frame_size,
dcmi             1386 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1388 drivers/media/platform/stm32/stm32-dcmi.c 	return v4l2_g_parm_cap(video_devdata(file), dcmi->entity.source, p);
dcmi             1394 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1396 drivers/media/platform/stm32/stm32-dcmi.c 	return v4l2_s_parm_cap(video_devdata(file), dcmi->entity.source, p);
dcmi             1402 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1412 drivers/media/platform/stm32/stm32-dcmi.c 	sd_fmt = find_format_by_fourcc(dcmi, fival->pixel_format);
dcmi             1418 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_subdev_call(dcmi->entity.source, pad,
dcmi             1437 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1438 drivers/media/platform/stm32/stm32-dcmi.c 	struct v4l2_subdev *sd = dcmi->entity.source;
dcmi             1441 drivers/media/platform/stm32/stm32-dcmi.c 	if (mutex_lock_interruptible(&dcmi->lock))
dcmi             1455 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_set_fmt(dcmi, &dcmi->fmt);
dcmi             1462 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_unlock(&dcmi->lock);
dcmi             1468 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = video_drvdata(file);
dcmi             1469 drivers/media/platform/stm32/stm32-dcmi.c 	struct v4l2_subdev *sd = dcmi->entity.source;
dcmi             1473 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_lock(&dcmi->lock);
dcmi             1482 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_unlock(&dcmi->lock);
dcmi             1535 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_set_default_fmt(struct stm32_dcmi *dcmi)
dcmi             1543 drivers/media/platform/stm32/stm32-dcmi.c 			.pixelformat	= dcmi->sd_formats[0]->fourcc,
dcmi             1548 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_try_fmt(dcmi, &f, NULL, NULL);
dcmi             1551 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sd_format = dcmi->sd_formats[0];
dcmi             1552 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->fmt = f;
dcmi             1582 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_formats_init(struct stm32_dcmi *dcmi)
dcmi             1586 drivers/media/platform/stm32/stm32-dcmi.c 	struct v4l2_subdev *subdev = dcmi->entity.source;
dcmi             1602 drivers/media/platform/stm32/stm32-dcmi.c 					dev_dbg(dcmi->dev, "Skipping fourcc/code: %4.4s/0x%x\n",
dcmi             1610 drivers/media/platform/stm32/stm32-dcmi.c 				dev_dbg(dcmi->dev, "Supported fourcc/code: %4.4s/0x%x\n",
dcmi             1621 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->num_of_sd_formats = num_fmts;
dcmi             1622 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sd_formats = devm_kcalloc(dcmi->dev,
dcmi             1625 drivers/media/platform/stm32/stm32-dcmi.c 	if (!dcmi->sd_formats) {
dcmi             1626 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Could not allocate memory\n");
dcmi             1630 drivers/media/platform/stm32/stm32-dcmi.c 	memcpy(dcmi->sd_formats, sd_fmts,
dcmi             1632 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sd_format = dcmi->sd_formats[0];
dcmi             1637 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_framesizes_init(struct stm32_dcmi *dcmi)
dcmi             1640 drivers/media/platform/stm32/stm32-dcmi.c 	struct v4l2_subdev *subdev = dcmi->entity.source;
dcmi             1643 drivers/media/platform/stm32/stm32-dcmi.c 		.code = dcmi->sd_format->mbus_code,
dcmi             1657 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->num_of_sd_framesizes = num_fsize;
dcmi             1658 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->sd_framesizes = devm_kcalloc(dcmi->dev, num_fsize,
dcmi             1661 drivers/media/platform/stm32/stm32-dcmi.c 	if (!dcmi->sd_framesizes) {
dcmi             1662 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Could not allocate memory\n");
dcmi             1667 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Sensor supports %u frame sizes:\n", num_fsize);
dcmi             1668 drivers/media/platform/stm32/stm32-dcmi.c 	for (i = 0; i < dcmi->num_of_sd_framesizes; i++) {
dcmi             1674 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->sd_framesizes[fse.index].width = fse.max_width;
dcmi             1675 drivers/media/platform/stm32/stm32-dcmi.c 		dcmi->sd_framesizes[fse.index].height = fse.max_height;
dcmi             1676 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "%ux%u\n", fse.max_width, fse.max_height);
dcmi             1684 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = notifier_to_dcmi(notifier);
dcmi             1692 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->entity.source =
dcmi             1693 drivers/media/platform/stm32/stm32-dcmi.c 		media_entity_to_v4l2_subdev(dcmi_find_source(dcmi));
dcmi             1694 drivers/media/platform/stm32/stm32-dcmi.c 	if (!dcmi->entity.source) {
dcmi             1695 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Source subdevice not found\n");
dcmi             1699 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->ctrl_handler = dcmi->entity.source->ctrl_handler;
dcmi             1701 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_formats_init(dcmi);
dcmi             1703 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "No supported mediabus format found\n");
dcmi             1707 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_framesizes_init(dcmi);
dcmi             1709 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Could not initialize framesizes\n");
dcmi             1713 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_get_sensor_bounds(dcmi, &dcmi->sd_bounds);
dcmi             1715 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Could not get sensor bounds\n");
dcmi             1719 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_set_default_fmt(dcmi);
dcmi             1721 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Could not set default format\n");
dcmi             1732 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = notifier_to_dcmi(notifier);
dcmi             1734 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Removing %s\n", video_device_node_name(dcmi->vdev));
dcmi             1737 drivers/media/platform/stm32/stm32-dcmi.c 	video_unregister_device(dcmi->vdev);
dcmi             1744 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = notifier_to_dcmi(notifier);
dcmi             1748 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Subdev \"%s\" bound\n", subdev->name);
dcmi             1759 drivers/media/platform/stm32/stm32-dcmi.c 				    &dcmi->vdev->entity, 0,
dcmi             1763 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Failed to create media pad link with subdev \"%s\"\n",
dcmi             1766 drivers/media/platform/stm32/stm32-dcmi.c 		dev_dbg(dcmi->dev, "DCMI is now linked to \"%s\"\n",
dcmi             1778 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_graph_parse(struct stm32_dcmi *dcmi, struct device_node *node)
dcmi             1793 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->entity.remote_node = remote;
dcmi             1794 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
dcmi             1795 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->entity.asd.match.fwnode = of_fwnode_handle(remote);
dcmi             1799 drivers/media/platform/stm32/stm32-dcmi.c static int dcmi_graph_init(struct stm32_dcmi *dcmi)
dcmi             1804 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_graph_parse(dcmi, dcmi->dev->of_node);
dcmi             1806 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Failed to parse graph\n");
dcmi             1810 drivers/media/platform/stm32/stm32-dcmi.c 	v4l2_async_notifier_init(&dcmi->notifier);
dcmi             1812 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_async_notifier_add_subdev(&dcmi->notifier,
dcmi             1813 drivers/media/platform/stm32/stm32-dcmi.c 					     &dcmi->entity.asd);
dcmi             1815 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Failed to add subdev notifier\n");
dcmi             1816 drivers/media/platform/stm32/stm32-dcmi.c 		of_node_put(dcmi->entity.remote_node);
dcmi             1820 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->notifier.ops = &dcmi_graph_notify_ops;
dcmi             1822 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_async_notifier_register(&dcmi->v4l2_dev, &dcmi->notifier);
dcmi             1824 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Failed to register notifier\n");
dcmi             1825 drivers/media/platform/stm32/stm32-dcmi.c 		v4l2_async_notifier_cleanup(&dcmi->notifier);
dcmi             1837 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi;
dcmi             1850 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi = devm_kzalloc(&pdev->dev, sizeof(struct stm32_dcmi), GFP_KERNEL);
dcmi             1851 drivers/media/platform/stm32/stm32-dcmi.c 	if (!dcmi)
dcmi             1854 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
dcmi             1855 drivers/media/platform/stm32/stm32-dcmi.c 	if (IS_ERR(dcmi->rstc)) {
dcmi             1857 drivers/media/platform/stm32/stm32-dcmi.c 		return PTR_ERR(dcmi->rstc);
dcmi             1878 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->bus.flags = ep.bus.parallel.flags;
dcmi             1879 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->bus.bus_width = ep.bus.parallel.bus_width;
dcmi             1880 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->bus.data_shift = ep.bus.parallel.data_shift;
dcmi             1886 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dcmi             1887 drivers/media/platform/stm32/stm32-dcmi.c 	if (!dcmi->res) {
dcmi             1892 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->regs = devm_ioremap_resource(&pdev->dev, dcmi->res);
dcmi             1893 drivers/media/platform/stm32/stm32-dcmi.c 	if (IS_ERR(dcmi->regs)) {
dcmi             1895 drivers/media/platform/stm32/stm32-dcmi.c 		return PTR_ERR(dcmi->regs);
dcmi             1900 drivers/media/platform/stm32/stm32-dcmi.c 					dev_name(&pdev->dev), dcmi);
dcmi             1919 drivers/media/platform/stm32/stm32-dcmi.c 	spin_lock_init(&dcmi->irqlock);
dcmi             1920 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_init(&dcmi->lock);
dcmi             1921 drivers/media/platform/stm32/stm32-dcmi.c 	mutex_init(&dcmi->dma_lock);
dcmi             1922 drivers/media/platform/stm32/stm32-dcmi.c 	init_completion(&dcmi->complete);
dcmi             1923 drivers/media/platform/stm32/stm32-dcmi.c 	INIT_LIST_HEAD(&dcmi->buffers);
dcmi             1925 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->dev = &pdev->dev;
dcmi             1926 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->mclk = mclk;
dcmi             1927 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->state = STOPPED;
dcmi             1928 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->dma_chan = chan;
dcmi             1930 drivers/media/platform/stm32/stm32-dcmi.c 	q = &dcmi->queue;
dcmi             1932 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->v4l2_dev.mdev = &dcmi->mdev;
dcmi             1935 drivers/media/platform/stm32/stm32-dcmi.c 	strscpy(dcmi->mdev.model, DRV_NAME, sizeof(dcmi->mdev.model));
dcmi             1936 drivers/media/platform/stm32/stm32-dcmi.c 	snprintf(dcmi->mdev.bus_info, sizeof(dcmi->mdev.bus_info),
dcmi             1938 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->mdev.dev = &pdev->dev;
dcmi             1939 drivers/media/platform/stm32/stm32-dcmi.c 	media_device_init(&dcmi->mdev);
dcmi             1942 drivers/media/platform/stm32/stm32-dcmi.c 	ret = v4l2_device_register(&pdev->dev, &dcmi->v4l2_dev);
dcmi             1946 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev = video_device_alloc();
dcmi             1947 drivers/media/platform/stm32/stm32-dcmi.c 	if (!dcmi->vdev) {
dcmi             1953 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->fops = &dcmi_fops;
dcmi             1954 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->v4l2_dev = &dcmi->v4l2_dev;
dcmi             1955 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->queue = &dcmi->queue;
dcmi             1956 drivers/media/platform/stm32/stm32-dcmi.c 	strscpy(dcmi->vdev->name, KBUILD_MODNAME, sizeof(dcmi->vdev->name));
dcmi             1957 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->release = video_device_release;
dcmi             1958 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->ioctl_ops = &dcmi_ioctl_ops;
dcmi             1959 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->lock = &dcmi->lock;
dcmi             1960 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
dcmi             1962 drivers/media/platform/stm32/stm32-dcmi.c 	video_set_drvdata(dcmi->vdev, dcmi);
dcmi             1965 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vid_cap_pad.flags = MEDIA_PAD_FL_SINK;
dcmi             1966 drivers/media/platform/stm32/stm32-dcmi.c 	ret = media_entity_pads_init(&dcmi->vdev->entity,
dcmi             1967 drivers/media/platform/stm32/stm32-dcmi.c 				     1, &dcmi->vid_cap_pad);
dcmi             1969 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Failed to init media entity pad\n");
dcmi             1972 drivers/media/platform/stm32/stm32-dcmi.c 	dcmi->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
dcmi             1974 drivers/media/platform/stm32/stm32-dcmi.c 	ret = video_register_device(dcmi->vdev, VFL_TYPE_GRABBER, -1);
dcmi             1976 drivers/media/platform/stm32/stm32-dcmi.c 		dev_err(dcmi->dev, "Failed to register video device\n");
dcmi             1980 drivers/media/platform/stm32/stm32-dcmi.c 	dev_dbg(dcmi->dev, "Device registered as %s\n",
dcmi             1981 drivers/media/platform/stm32/stm32-dcmi.c 		video_device_node_name(dcmi->vdev));
dcmi             1986 drivers/media/platform/stm32/stm32-dcmi.c 	q->lock = &dcmi->lock;
dcmi             1987 drivers/media/platform/stm32/stm32-dcmi.c 	q->drv_priv = dcmi;
dcmi             2001 drivers/media/platform/stm32/stm32-dcmi.c 	ret = dcmi_graph_init(dcmi);
dcmi             2006 drivers/media/platform/stm32/stm32-dcmi.c 	ret = reset_control_assert(dcmi->rstc);
dcmi             2014 drivers/media/platform/stm32/stm32-dcmi.c 	ret = reset_control_deassert(dcmi->rstc);
dcmi             2022 drivers/media/platform/stm32/stm32-dcmi.c 	platform_set_drvdata(pdev, dcmi);
dcmi             2029 drivers/media/platform/stm32/stm32-dcmi.c 	v4l2_async_notifier_cleanup(&dcmi->notifier);
dcmi             2031 drivers/media/platform/stm32/stm32-dcmi.c 	media_entity_cleanup(&dcmi->vdev->entity);
dcmi             2033 drivers/media/platform/stm32/stm32-dcmi.c 	video_device_release(dcmi->vdev);
dcmi             2035 drivers/media/platform/stm32/stm32-dcmi.c 	v4l2_device_unregister(&dcmi->v4l2_dev);
dcmi             2037 drivers/media/platform/stm32/stm32-dcmi.c 	media_device_cleanup(&dcmi->mdev);
dcmi             2038 drivers/media/platform/stm32/stm32-dcmi.c 	dma_release_channel(dcmi->dma_chan);
dcmi             2045 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = platform_get_drvdata(pdev);
dcmi             2049 drivers/media/platform/stm32/stm32-dcmi.c 	v4l2_async_notifier_unregister(&dcmi->notifier);
dcmi             2050 drivers/media/platform/stm32/stm32-dcmi.c 	v4l2_async_notifier_cleanup(&dcmi->notifier);
dcmi             2051 drivers/media/platform/stm32/stm32-dcmi.c 	media_entity_cleanup(&dcmi->vdev->entity);
dcmi             2052 drivers/media/platform/stm32/stm32-dcmi.c 	v4l2_device_unregister(&dcmi->v4l2_dev);
dcmi             2053 drivers/media/platform/stm32/stm32-dcmi.c 	media_device_cleanup(&dcmi->mdev);
dcmi             2055 drivers/media/platform/stm32/stm32-dcmi.c 	dma_release_channel(dcmi->dma_chan);
dcmi             2062 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = dev_get_drvdata(dev);
dcmi             2064 drivers/media/platform/stm32/stm32-dcmi.c 	clk_disable_unprepare(dcmi->mclk);
dcmi             2071 drivers/media/platform/stm32/stm32-dcmi.c 	struct stm32_dcmi *dcmi = dev_get_drvdata(dev);
dcmi             2074 drivers/media/platform/stm32/stm32-dcmi.c 	ret = clk_prepare_enable(dcmi->mclk);