aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Longerbeam <slongerbeam@gmail.com>2014-06-25 21:05:30 -0400
committerPhilipp Zabel <p.zabel@pengutronix.de>2014-08-18 08:17:47 -0400
commitba07975f0fe5bf95107d71d0df0405c16f5c3266 (patch)
tree8346726e7bce8ffb879d66d258e24b3896018c11
parent2eb671c485c06133ff0b568d5ec3c09fda0f4359 (diff)
gpu: ipu-v3: Add functions to set CSI/IC source muxes
Adds two new functions, ipu_set_csi_src_mux() and ipu_set_ic_src_mux(), that select the inputs to the CSI and IC respectively. Both muxes are programmed in the IPU_CONF register. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r--drivers/gpu/ipu-v3/ipu-common.c51
-rw-r--r--include/video/imx-ipu-v3.h6
2 files changed, 57 insertions, 0 deletions
diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 5978e7aab8ed..cae543115856 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -382,6 +382,57 @@ static int ipu_memory_reset(struct ipu_soc *ipu)
382 return 0; 382 return 0;
383} 383}
384 384
385/*
386 * Set the source mux for the given CSI. Selects either parallel or
387 * MIPI CSI2 sources.
388 */
389void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2)
390{
391 unsigned long flags;
392 u32 val, mask;
393
394 mask = (csi_id == 1) ? IPU_CONF_CSI1_DATA_SOURCE :
395 IPU_CONF_CSI0_DATA_SOURCE;
396
397 spin_lock_irqsave(&ipu->lock, flags);
398
399 val = ipu_cm_read(ipu, IPU_CONF);
400 if (mipi_csi2)
401 val |= mask;
402 else
403 val &= ~mask;
404 ipu_cm_write(ipu, val, IPU_CONF);
405
406 spin_unlock_irqrestore(&ipu->lock, flags);
407}
408EXPORT_SYMBOL_GPL(ipu_set_csi_src_mux);
409
410/*
411 * Set the source mux for the IC. Selects either CSI[01] or the VDI.
412 */
413void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi)
414{
415 unsigned long flags;
416 u32 val;
417
418 spin_lock_irqsave(&ipu->lock, flags);
419
420 val = ipu_cm_read(ipu, IPU_CONF);
421 if (vdi) {
422 val |= IPU_CONF_IC_INPUT;
423 } else {
424 val &= ~IPU_CONF_IC_INPUT;
425 if (csi_id == 1)
426 val |= IPU_CONF_CSI_SEL;
427 else
428 val &= ~IPU_CONF_CSI_SEL;
429 }
430 ipu_cm_write(ipu, val, IPU_CONF);
431
432 spin_unlock_irqrestore(&ipu->lock, flags);
433}
434EXPORT_SYMBOL_GPL(ipu_set_ic_src_mux);
435
385struct ipu_devtype { 436struct ipu_devtype {
386 const char *name; 437 const char *name;
387 unsigned long cm_ofs; 438 unsigned long cm_ofs;
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index ef64b66b18df..f80fe13b0d4d 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -93,6 +93,12 @@ int ipu_idmac_channel_irq(struct ipu_soc *ipu, struct ipuv3_channel *channel,
93#define IPU_IRQ_VSYNC_PRE_1 (448 + 15) 93#define IPU_IRQ_VSYNC_PRE_1 (448 + 15)
94 94
95/* 95/*
96 * IPU Common functions
97 */
98void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2);
99void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi);
100
101/*
96 * IPU Image DMA Controller (idmac) functions 102 * IPU Image DMA Controller (idmac) functions
97 */ 103 */
98struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel); 104struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel);