Lines Matching refs:ipu
42 static struct ipu ipu_data;
44 #define to_ipu(id) container_of(id, struct ipu, idmac)
46 static u32 __idmac_read_icreg(struct ipu *ipu, unsigned long reg) in __idmac_read_icreg() argument
48 return __raw_readl(ipu->reg_ic + reg); in __idmac_read_icreg()
51 #define idmac_read_icreg(ipu, reg) __idmac_read_icreg(ipu, reg - IC_CONF) argument
53 static void __idmac_write_icreg(struct ipu *ipu, u32 value, unsigned long reg) in __idmac_write_icreg() argument
55 __raw_writel(value, ipu->reg_ic + reg); in __idmac_write_icreg()
58 #define idmac_write_icreg(ipu, v, reg) __idmac_write_icreg(ipu, v, reg - IC_CONF) argument
60 static u32 idmac_read_ipureg(struct ipu *ipu, unsigned long reg) in idmac_read_ipureg() argument
62 return __raw_readl(ipu->reg_ipu + reg); in idmac_read_ipureg()
65 static void idmac_write_ipureg(struct ipu *ipu, u32 value, unsigned long reg) in idmac_write_ipureg() argument
67 __raw_writel(value, ipu->reg_ipu + reg); in idmac_write_ipureg()
73 static void dump_idmac_reg(struct ipu *ipu) in dump_idmac_reg() argument
75 dev_dbg(ipu->dev, "IDMAC_CONF 0x%x, IC_CONF 0x%x, IDMAC_CHA_EN 0x%x, " in dump_idmac_reg()
77 idmac_read_icreg(ipu, IDMAC_CONF), in dump_idmac_reg()
78 idmac_read_icreg(ipu, IC_CONF), in dump_idmac_reg()
79 idmac_read_icreg(ipu, IDMAC_CHA_EN), in dump_idmac_reg()
80 idmac_read_icreg(ipu, IDMAC_CHA_PRI), in dump_idmac_reg()
81 idmac_read_icreg(ipu, IDMAC_CHA_BUSY)); in dump_idmac_reg()
82 dev_dbg(ipu->dev, "BUF0_RDY 0x%x, BUF1_RDY 0x%x, CUR_BUF 0x%x, " in dump_idmac_reg()
84 idmac_read_ipureg(ipu, IPU_CHA_BUF0_RDY), in dump_idmac_reg()
85 idmac_read_ipureg(ipu, IPU_CHA_BUF1_RDY), in dump_idmac_reg()
86 idmac_read_ipureg(ipu, IPU_CHA_CUR_BUF), in dump_idmac_reg()
87 idmac_read_ipureg(ipu, IPU_CHA_DB_MODE_SEL), in dump_idmac_reg()
88 idmac_read_ipureg(ipu, IPU_TASKS_STAT)); in dump_idmac_reg()
116 static void ipu_ic_enable_task(struct ipu *ipu, enum ipu_channel channel) in ipu_ic_enable_task() argument
130 ic_conf = idmac_read_icreg(ipu, IC_CONF) | mask; in ipu_ic_enable_task()
131 idmac_write_icreg(ipu, ic_conf, IC_CONF); in ipu_ic_enable_task()
135 static void ipu_ic_disable_task(struct ipu *ipu, enum ipu_channel channel) in ipu_ic_disable_task() argument
149 ic_conf = idmac_read_icreg(ipu, IC_CONF) & ~mask; in ipu_ic_disable_task()
150 idmac_write_icreg(ipu, ic_conf, IC_CONF); in ipu_ic_disable_task()
153 static uint32_t ipu_channel_status(struct ipu *ipu, enum ipu_channel channel) in ipu_channel_status() argument
156 uint32_t task_stat_reg = idmac_read_ipureg(ipu, IPU_TASKS_STAT); in ipu_channel_status()
511 static int ipu_ic_init_prpenc(struct ipu *ipu, in ipu_ic_init_prpenc() argument
539 dev_err(ipu->dev, "Colourspace conversion unsupported!\n"); in ipu_ic_init_prpenc()
543 idmac_write_icreg(ipu, reg, IC_PRP_ENC_RSC); in ipu_ic_init_prpenc()
545 ic_conf = idmac_read_icreg(ipu, IC_CONF); in ipu_ic_init_prpenc()
552 idmac_write_icreg(ipu, ic_conf, IC_CONF); in ipu_ic_init_prpenc()
563 static void ipu_channel_set_priority(struct ipu *ipu, enum ipu_channel channel, in ipu_channel_set_priority() argument
566 u32 reg = idmac_read_icreg(ipu, IDMAC_CHA_PRI); in ipu_channel_set_priority()
573 idmac_write_icreg(ipu, reg, IDMAC_CHA_PRI); in ipu_channel_set_priority()
575 dump_idmac_reg(ipu); in ipu_channel_set_priority()
607 struct ipu *ipu = to_ipu(idmac); in ipu_enable_channel() local
612 spin_lock_irqsave(&ipu->lock, flags); in ipu_enable_channel()
615 idmac_write_ipureg(ipu, 1UL << channel, IPU_CHA_CUR_BUF); in ipu_enable_channel()
623 ipu_channel_set_priority(ipu, channel, true); in ipu_enable_channel()
628 reg = idmac_read_icreg(ipu, IDMAC_CHA_EN); in ipu_enable_channel()
630 idmac_write_icreg(ipu, reg | (1UL << channel), IDMAC_CHA_EN); in ipu_enable_channel()
632 ipu_ic_enable_task(ipu, channel); in ipu_enable_channel()
634 spin_unlock_irqrestore(&ipu->lock, flags); in ipu_enable_channel()
662 struct ipu *ipu = to_ipu(idmac); in ipu_init_channel_buffer() local
671 dev_err(ipu->dev, in ipu_init_channel_buffer()
679 dev_err(ipu->dev, "Stride must be 8 pixel multiple\n"); in ipu_init_channel_buffer()
688 spin_lock_irqsave(&ipu->lock, flags); in ipu_init_channel_buffer()
692 reg = idmac_read_ipureg(ipu, IPU_CHA_DB_MODE_SEL); in ipu_init_channel_buffer()
699 idmac_write_ipureg(ipu, reg, IPU_CHA_DB_MODE_SEL); in ipu_init_channel_buffer()
703 spin_unlock_irqrestore(&ipu->lock, flags); in ipu_init_channel_buffer()
827 struct ipu *ipu = to_ipu(idmac); in idmac_tx_submit() local
893 dump_idmac_reg(ipu); in idmac_tx_submit()
957 struct ipu *ipu = to_ipu(idmac); in ipu_init_channel() local
960 dev_dbg(ipu->dev, "init channel = %d\n", channel); in ipu_init_channel()
966 spin_lock_irqsave(&ipu->lock, flags); in ipu_init_channel()
971 reg = idmac_read_icreg(ipu, IC_CONF); in ipu_init_channel()
972 idmac_write_icreg(ipu, reg & ~IC_CONF_CSI_MEM_WR_EN, IC_CONF); in ipu_init_channel()
976 reg = idmac_read_ipureg(ipu, IPU_FS_PROC_FLOW); in ipu_init_channel()
977 idmac_write_ipureg(ipu, reg & ~FS_ENC_IN_VALID, IPU_FS_PROC_FLOW); in ipu_init_channel()
978 ret = ipu_ic_init_prpenc(ipu, params, true); in ipu_init_channel()
987 ipu->channel_init_mask |= 1L << channel; in ipu_init_channel()
990 ipu_conf = idmac_read_ipureg(ipu, IPU_CONF) | in ipu_init_channel()
992 idmac_write_ipureg(ipu, ipu_conf, IPU_CONF); in ipu_init_channel()
994 spin_unlock_irqrestore(&ipu->lock, flags); in ipu_init_channel()
999 dump_idmac_reg(ipu); in ipu_init_channel()
1016 struct ipu *ipu = to_ipu(idmac); in ipu_uninit_channel() local
1018 spin_lock_irqsave(&ipu->lock, flags); in ipu_uninit_channel()
1020 if (!(ipu->channel_init_mask & chan_mask)) { in ipu_uninit_channel()
1021 dev_err(ipu->dev, "Channel already uninitialized %d\n", in ipu_uninit_channel()
1023 spin_unlock_irqrestore(&ipu->lock, flags); in ipu_uninit_channel()
1028 reg = idmac_read_ipureg(ipu, IPU_CHA_DB_MODE_SEL); in ipu_uninit_channel()
1029 idmac_write_ipureg(ipu, reg & ~chan_mask, IPU_CHA_DB_MODE_SEL); in ipu_uninit_channel()
1035 reg = idmac_read_icreg(ipu, IC_CONF); in ipu_uninit_channel()
1036 idmac_write_icreg(ipu, reg & ~(IC_CONF_RWS_EN | IC_CONF_PRPENC_EN), in ipu_uninit_channel()
1040 reg = idmac_read_icreg(ipu, IC_CONF); in ipu_uninit_channel()
1041 idmac_write_icreg(ipu, reg & ~(IC_CONF_PRPENC_EN | IC_CONF_PRPENC_CSC1), in ipu_uninit_channel()
1050 ipu->channel_init_mask &= ~(1L << channel); in ipu_uninit_channel()
1052 ipu_conf = idmac_read_ipureg(ipu, IPU_CONF) & in ipu_uninit_channel()
1054 idmac_write_ipureg(ipu, ipu_conf, IPU_CONF); in ipu_uninit_channel()
1056 spin_unlock_irqrestore(&ipu->lock, flags); in ipu_uninit_channel()
1075 struct ipu *ipu = to_ipu(idmac); in ipu_disable_channel() local
1084 while ((idmac_read_icreg(ipu, IDMAC_CHA_BUSY) & chan_mask) || in ipu_disable_channel()
1085 (ipu_channel_status(ipu, channel) == TASK_STAT_ACTIVE)) { in ipu_disable_channel()
1090 dev_dbg(ipu->dev, in ipu_disable_channel()
1094 idmac_read_ipureg(ipu, IPU_CHA_BUF0_RDY), in ipu_disable_channel()
1095 idmac_read_ipureg(ipu, IPU_CHA_BUF1_RDY), in ipu_disable_channel()
1096 idmac_read_icreg(ipu, IDMAC_CHA_BUSY), in ipu_disable_channel()
1097 idmac_read_ipureg(ipu, IPU_TASKS_STAT)); in ipu_disable_channel()
1101 dev_dbg(ipu->dev, "timeout = %d * 10ms\n", 40 - timeout); in ipu_disable_channel()
1111 spin_lock_irqsave(&ipu->lock, flags); in ipu_disable_channel()
1114 ipu_ic_disable_task(ipu, channel); in ipu_disable_channel()
1117 reg = idmac_read_icreg(ipu, IDMAC_CHA_EN); in ipu_disable_channel()
1118 idmac_write_icreg(ipu, reg & ~chan_mask, IDMAC_CHA_EN); in ipu_disable_channel()
1120 spin_unlock_irqrestore(&ipu->lock, flags); in ipu_disable_channel()
1308 struct ipu *ipu = (struct ipu *)arg; in ipu_gc_tasklet() local
1312 struct idmac_channel *ichan = ipu->channel + i; in ipu_gc_tasklet()
1385 struct ipu *ipu = to_ipu(idmac); in idmac_issue_pending() local
1389 spin_lock_irqsave(&ipu->lock, flags); in idmac_issue_pending()
1391 spin_unlock_irqrestore(&ipu->lock, flags); in idmac_issue_pending()
1406 struct ipu *ipu = to_ipu(idmac); in __idmac_control() local
1413 spin_lock_irqsave(&ipu->lock, flags); in __idmac_control()
1414 ipu_ic_disable_task(ipu, chan->chan_id); in __idmac_control()
1423 spin_unlock_irqrestore(&ipu->lock, flags); in __idmac_control()
1431 tasklet_disable(&ipu->tasklet); in __idmac_control()
1451 tasklet_enable(&ipu->tasklet); in __idmac_control()
1607 static int __init ipu_idmac_init(struct ipu *ipu) in ipu_idmac_init() argument
1609 struct idmac *idmac = &ipu->idmac; in ipu_idmac_init()
1617 dma->dev = ipu->dev; in ipu_idmac_init()
1629 struct idmac_channel *ichan = ipu->channel + i; in ipu_idmac_init()
1645 idmac_write_icreg(ipu, 0x00000070, IDMAC_CONF); in ipu_idmac_init()
1650 static void ipu_idmac_exit(struct ipu *ipu) in ipu_idmac_exit() argument
1653 struct idmac *idmac = &ipu->idmac; in ipu_idmac_exit()
1656 struct idmac_channel *ichan = ipu->channel + i; in ipu_idmac_exit()
1766 struct ipu *ipu = platform_get_drvdata(pdev); in ipu_remove() local
1768 ipu_idmac_exit(ipu); in ipu_remove()
1769 ipu_irq_detach_irq(ipu, pdev); in ipu_remove()
1770 clk_disable_unprepare(ipu->ipu_clk); in ipu_remove()
1771 clk_put(ipu->ipu_clk); in ipu_remove()
1772 iounmap(ipu->reg_ic); in ipu_remove()
1773 iounmap(ipu->reg_ipu); in ipu_remove()
1774 tasklet_kill(&ipu->tasklet); in ipu_remove()