Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Steve Longerbeam and committed by
Philipp Zabel
ba07975f 2eb671c4

+57
+51
drivers/gpu/ipu-v3/ipu-common.c
··· 382 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 + */ 389 + void 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 + } 408 + EXPORT_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 + */ 413 + void 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 + } 434 + EXPORT_SYMBOL_GPL(ipu_set_ic_src_mux); 435 + 385 436 struct ipu_devtype { 386 437 const char *name; 387 438 unsigned long cm_ofs;
+6
include/video/imx-ipu-v3.h
··· 93 93 #define IPU_IRQ_VSYNC_PRE_1 (448 + 15) 94 94 95 95 /* 96 + * IPU Common functions 97 + */ 98 + void ipu_set_csi_src_mux(struct ipu_soc *ipu, int csi_id, bool mipi_csi2); 99 + void ipu_set_ic_src_mux(struct ipu_soc *ipu, int csi_id, bool vdi); 100 + 101 + /* 96 102 * IPU Image DMA Controller (idmac) functions 97 103 */ 98 104 struct ipuv3_channel *ipu_idmac_get(struct ipu_soc *ipu, unsigned channel);