Lines Matching defs:ipu
24 #include <mach/ipu.h>
37 * struct ipu *ipu = to_ipu(to_idmac(ichan->dma_chan.device));
40 static struct ipu ipu_data;
42 #define to_ipu(id) container_of(id, struct ipu, idmac)
44 static u32 __idmac_read_icreg(struct ipu *ipu, unsigned long reg)
46 return __raw_readl(ipu->reg_ic + reg);
49 #define idmac_read_icreg(ipu, reg) __idmac_read_icreg(ipu, reg - IC_CONF)
51 static void __idmac_write_icreg(struct ipu *ipu, u32 value, unsigned long reg)
53 __raw_writel(value, ipu->reg_ic + reg);
56 #define idmac_write_icreg(ipu, v, reg) __idmac_write_icreg(ipu, v, reg - IC_CONF)
58 static u32 idmac_read_ipureg(struct ipu *ipu, unsigned long reg)
60 return __raw_readl(ipu->reg_ipu + reg);
63 static void idmac_write_ipureg(struct ipu *ipu, u32 value, unsigned long reg)
65 __raw_writel(value, ipu->reg_ipu + reg);
71 static void dump_idmac_reg(struct ipu *ipu)
73 dev_dbg(ipu->dev, "IDMAC_CONF 0x%x, IC_CONF 0x%x, IDMAC_CHA_EN 0x%x, "
75 idmac_read_icreg(ipu, IDMAC_CONF),
76 idmac_read_icreg(ipu, IC_CONF),
77 idmac_read_icreg(ipu, IDMAC_CHA_EN),
78 idmac_read_icreg(ipu, IDMAC_CHA_PRI),
79 idmac_read_icreg(ipu, IDMAC_CHA_BUSY));
80 dev_dbg(ipu->dev, "BUF0_RDY 0x%x, BUF1_RDY 0x%x, CUR_BUF 0x%x, "
82 idmac_read_ipureg(ipu, IPU_CHA_BUF0_RDY),
83 idmac_read_ipureg(ipu, IPU_CHA_BUF1_RDY),
84 idmac_read_ipureg(ipu, IPU_CHA_CUR_BUF),
85 idmac_read_ipureg(ipu, IPU_CHA_DB_MODE_SEL),
86 idmac_read_ipureg(ipu, IPU_TASKS_STAT));
114 static void ipu_ic_enable_task(struct ipu *ipu, enum ipu_channel channel)
128 ic_conf = idmac_read_icreg(ipu, IC_CONF) | mask;
129 idmac_write_icreg(ipu, ic_conf, IC_CONF);
133 static void ipu_ic_disable_task(struct ipu *ipu, enum ipu_channel channel)
147 ic_conf = idmac_read_icreg(ipu, IC_CONF) & ~mask;
148 idmac_write_icreg(ipu, ic_conf, IC_CONF);
151 static uint32_t ipu_channel_status(struct ipu *ipu, enum ipu_channel channel)
154 uint32_t task_stat_reg = idmac_read_ipureg(ipu, IPU_TASKS_STAT);
416 "mx3 ipu: unimplemented pixel format %d\n", pixel_fmt);
515 static int ipu_ic_init_prpenc(struct ipu *ipu,
543 dev_err(ipu->dev, "Colourspace conversion unsupported!\n");
547 idmac_write_icreg(ipu, reg, IC_PRP_ENC_RSC);
549 ic_conf = idmac_read_icreg(ipu, IC_CONF);
556 idmac_write_icreg(ipu, ic_conf, IC_CONF);
567 static void ipu_channel_set_priority(struct ipu *ipu, enum ipu_channel channel,
570 u32 reg = idmac_read_icreg(ipu, IDMAC_CHA_PRI);
577 idmac_write_icreg(ipu, reg, IDMAC_CHA_PRI);
579 dump_idmac_reg(ipu);
611 struct ipu *ipu = to_ipu(idmac);
616 spin_lock_irqsave(&ipu->lock, flags);
619 idmac_write_ipureg(ipu, 1UL << channel, IPU_CHA_CUR_BUF);
627 ipu_channel_set_priority(ipu, channel, true);
632 reg = idmac_read_icreg(ipu, IDMAC_CHA_EN);
634 idmac_write_icreg(ipu, reg | (1UL << channel), IDMAC_CHA_EN);
636 ipu_ic_enable_task(ipu, channel);
638 spin_unlock_irqrestore(&ipu->lock, flags);
666 struct ipu *ipu = to_ipu(idmac);
675 dev_err(ipu->dev,
683 dev_err(ipu->dev, "Stride must be 8 pixel multiple\n");
709 spin_lock_irqsave(&ipu->lock, flags);
713 reg = idmac_read_ipureg(ipu, IPU_CHA_DB_MODE_SEL);
720 idmac_write_ipureg(ipu, reg, IPU_CHA_DB_MODE_SEL);
724 spin_unlock_irqrestore(&ipu->lock, flags);
848 struct ipu *ipu = to_ipu(idmac);
899 /* ipu->lock can be taken under ichan->lock, but not v.v. */
921 dump_idmac_reg(ipu);
985 struct ipu *ipu = to_ipu(idmac);
988 dev_dbg(ipu->dev, "init channel = %d\n", channel);
994 spin_lock_irqsave(&ipu->lock, flags);
999 reg = idmac_read_icreg(ipu, IC_CONF);
1000 idmac_write_icreg(ipu, reg & ~IC_CONF_CSI_MEM_WR_EN, IC_CONF);
1004 reg = idmac_read_ipureg(ipu, IPU_FS_PROC_FLOW);
1005 idmac_write_ipureg(ipu, reg & ~FS_ENC_IN_VALID, IPU_FS_PROC_FLOW);
1006 ret = ipu_ic_init_prpenc(ipu, params, true);
1015 ipu->channel_init_mask |= 1L << channel;
1018 ipu_conf = idmac_read_ipureg(ipu, IPU_CONF) |
1020 idmac_write_ipureg(ipu, ipu_conf, IPU_CONF);
1022 spin_unlock_irqrestore(&ipu->lock, flags);
1027 dump_idmac_reg(ipu);
1044 struct ipu *ipu = to_ipu(idmac);
1046 spin_lock_irqsave(&ipu->lock, flags);
1048 if (!(ipu->channel_init_mask & chan_mask)) {
1049 dev_err(ipu->dev, "Channel already uninitialized %d\n",
1051 spin_unlock_irqrestore(&ipu->lock, flags);
1056 reg = idmac_read_ipureg(ipu, IPU_CHA_DB_MODE_SEL);
1057 idmac_write_ipureg(ipu, reg & ~chan_mask, IPU_CHA_DB_MODE_SEL);
1063 reg = idmac_read_icreg(ipu, IC_CONF);
1064 idmac_write_icreg(ipu, reg & ~(IC_CONF_RWS_EN | IC_CONF_PRPENC_EN),
1068 reg = idmac_read_icreg(ipu, IC_CONF);
1069 idmac_write_icreg(ipu, reg & ~(IC_CONF_PRPENC_EN | IC_CONF_PRPENC_CSC1),
1078 ipu->channel_init_mask &= ~(1L << channel);
1080 ipu_conf = idmac_read_ipureg(ipu, IPU_CONF) &
1082 idmac_write_ipureg(ipu, ipu_conf, IPU_CONF);
1084 spin_unlock_irqrestore(&ipu->lock, flags);
1103 struct ipu *ipu = to_ipu(idmac);
1112 while ((idmac_read_icreg(ipu, IDMAC_CHA_BUSY) & chan_mask) ||
1113 (ipu_channel_status(ipu, channel) == TASK_STAT_ACTIVE)) {
1118 dev_dbg(ipu->dev,
1122 idmac_read_ipureg(ipu, IPU_CHA_BUF0_RDY),
1123 idmac_read_ipureg(ipu, IPU_CHA_BUF1_RDY),
1124 idmac_read_icreg(ipu, IDMAC_CHA_BUSY),
1125 idmac_read_ipureg(ipu, IPU_TASKS_STAT));
1129 dev_dbg(ipu->dev, "timeout = %d * 10ms\n", 40 - timeout);
1139 spin_lock_irqsave(&ipu->lock, flags);
1142 ipu_ic_disable_task(ipu, channel);
1145 reg = idmac_read_icreg(ipu, IDMAC_CHA_EN);
1146 idmac_write_icreg(ipu, reg & ~chan_mask, IDMAC_CHA_EN);
1163 reg = idmac_read_ipureg(ipu, IPU_CHA_BUF0_RDY);
1164 idmac_write_ipureg(ipu, 0, IPU_CHA_BUF0_RDY);
1165 idmac_write_ipureg(ipu, reg & ~(1UL << channel), IPU_CHA_BUF0_RDY);
1167 reg = idmac_read_ipureg(ipu, IPU_CHA_BUF1_RDY);
1168 idmac_write_ipureg(ipu, 0, IPU_CHA_BUF1_RDY);
1169 idmac_write_ipureg(ipu, reg & ~(1UL << channel), IPU_CHA_BUF1_RDY);
1171 spin_unlock_irqrestore(&ipu->lock, flags);
1383 struct ipu *ipu = (struct ipu *)arg;
1387 struct idmac_channel *ichan = ipu->channel + i;
1459 struct ipu *ipu = to_ipu(idmac);
1463 spin_lock_irqsave(&ipu->lock, flags);
1465 spin_unlock_irqrestore(&ipu->lock, flags);
1662 static int __init ipu_idmac_init(struct ipu *ipu)
1664 struct idmac *idmac = &ipu->idmac;
1672 dma->dev = ipu->dev;
1684 struct idmac_channel *ichan = ipu->channel + i;
1701 idmac_write_icreg(ipu, 0x00000070, IDMAC_CONF);
1706 static void __exit ipu_idmac_exit(struct ipu *ipu)
1709 struct idmac *idmac = &ipu->idmac;
1712 struct idmac_channel *ichan = ipu->channel + i;
1827 struct ipu *ipu = platform_get_drvdata(pdev);
1829 ipu_idmac_exit(ipu);
1830 ipu_irq_detach_irq(ipu, pdev);
1831 clk_disable(ipu->ipu_clk);
1832 clk_put(ipu->ipu_clk);
1833 iounmap(ipu->reg_ic);
1834 iounmap(ipu->reg_ipu);
1835 tasklet_kill(&ipu->tasklet);
1847 .name = "ipu-core",
1862 MODULE_ALIAS("platform:ipu-core");