Lines Matching refs:cec
60 static void mtk_cec_clear_bits(struct mtk_cec *cec, unsigned int offset, in mtk_cec_clear_bits() argument
63 void __iomem *reg = cec->regs + offset; in mtk_cec_clear_bits()
71 static void mtk_cec_set_bits(struct mtk_cec *cec, unsigned int offset, in mtk_cec_set_bits() argument
74 void __iomem *reg = cec->regs + offset; in mtk_cec_set_bits()
82 static void mtk_cec_mask(struct mtk_cec *cec, unsigned int offset, in mtk_cec_mask() argument
85 u32 tmp = readl(cec->regs + offset) & ~mask; in mtk_cec_mask()
88 writel(tmp, cec->regs + offset); in mtk_cec_mask()
95 struct mtk_cec *cec = dev_get_drvdata(dev); in mtk_cec_set_hpd_event() local
98 spin_lock_irqsave(&cec->lock, flags); in mtk_cec_set_hpd_event()
99 cec->hdmi_dev = hdmi_dev; in mtk_cec_set_hpd_event()
100 cec->hpd_event = hpd_event; in mtk_cec_set_hpd_event()
101 spin_unlock_irqrestore(&cec->lock, flags); in mtk_cec_set_hpd_event()
106 struct mtk_cec *cec = dev_get_drvdata(dev); in mtk_cec_hpd_high() local
109 status = readl(cec->regs + RX_EVENT); in mtk_cec_hpd_high()
114 static void mtk_cec_htplg_irq_init(struct mtk_cec *cec) in mtk_cec_htplg_irq_init() argument
116 mtk_cec_mask(cec, CEC_CKGEN, 0 | CEC_32K_PDN, PDN | CEC_32K_PDN); in mtk_cec_htplg_irq_init()
117 mtk_cec_set_bits(cec, RX_GEN_WD, HDMI_PORD_INT_32K_CLR | in mtk_cec_htplg_irq_init()
119 mtk_cec_mask(cec, RX_GEN_WD, 0, HDMI_PORD_INT_32K_CLR | RX_INT_32K_CLR | in mtk_cec_htplg_irq_init()
124 static void mtk_cec_htplg_irq_enable(struct mtk_cec *cec) in mtk_cec_htplg_irq_enable() argument
126 mtk_cec_set_bits(cec, RX_EVENT, HDMI_PORD_INT_EN | HDMI_HTPLG_INT_EN); in mtk_cec_htplg_irq_enable()
129 static void mtk_cec_htplg_irq_disable(struct mtk_cec *cec) in mtk_cec_htplg_irq_disable() argument
131 mtk_cec_clear_bits(cec, RX_EVENT, HDMI_PORD_INT_EN | HDMI_HTPLG_INT_EN); in mtk_cec_htplg_irq_disable()
134 static void mtk_cec_clear_htplg_irq(struct mtk_cec *cec) in mtk_cec_clear_htplg_irq() argument
136 mtk_cec_set_bits(cec, TR_CONFIG, CLEAR_CEC_IRQ); in mtk_cec_clear_htplg_irq()
137 mtk_cec_set_bits(cec, NORMAL_INT_CTRL, HDMI_HTPLG_INT_CLR | in mtk_cec_clear_htplg_irq()
139 mtk_cec_set_bits(cec, RX_GEN_WD, HDMI_PORD_INT_32K_CLR | in mtk_cec_clear_htplg_irq()
142 mtk_cec_clear_bits(cec, NORMAL_INT_CTRL, HDMI_HTPLG_INT_CLR | in mtk_cec_clear_htplg_irq()
144 mtk_cec_clear_bits(cec, TR_CONFIG, CLEAR_CEC_IRQ); in mtk_cec_clear_htplg_irq()
145 mtk_cec_clear_bits(cec, RX_GEN_WD, HDMI_PORD_INT_32K_CLR | in mtk_cec_clear_htplg_irq()
149 static void mtk_cec_hpd_event(struct mtk_cec *cec, bool hpd) in mtk_cec_hpd_event() argument
155 spin_lock_irqsave(&cec->lock, flags); in mtk_cec_hpd_event()
156 hpd_event = cec->hpd_event; in mtk_cec_hpd_event()
157 hdmi_dev = cec->hdmi_dev; in mtk_cec_hpd_event()
158 spin_unlock_irqrestore(&cec->lock, flags); in mtk_cec_hpd_event()
167 struct mtk_cec *cec = dev_get_drvdata(dev); in mtk_cec_htplg_isr_thread() local
170 mtk_cec_clear_htplg_irq(cec); in mtk_cec_htplg_isr_thread()
173 if (cec->hpd != hpd) { in mtk_cec_htplg_isr_thread()
175 cec->hpd, hpd); in mtk_cec_htplg_isr_thread()
176 cec->hpd = hpd; in mtk_cec_htplg_isr_thread()
177 mtk_cec_hpd_event(cec, hpd); in mtk_cec_htplg_isr_thread()
185 struct mtk_cec *cec; in mtk_cec_probe() local
189 cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); in mtk_cec_probe()
190 if (!cec) in mtk_cec_probe()
193 platform_set_drvdata(pdev, cec); in mtk_cec_probe()
194 spin_lock_init(&cec->lock); in mtk_cec_probe()
197 cec->regs = devm_ioremap_resource(dev, res); in mtk_cec_probe()
198 if (IS_ERR(cec->regs)) { in mtk_cec_probe()
199 ret = PTR_ERR(cec->regs); in mtk_cec_probe()
204 cec->clk = devm_clk_get(dev, NULL); in mtk_cec_probe()
205 if (IS_ERR(cec->clk)) { in mtk_cec_probe()
206 ret = PTR_ERR(cec->clk); in mtk_cec_probe()
211 cec->irq = platform_get_irq(pdev, 0); in mtk_cec_probe()
212 if (cec->irq < 0) in mtk_cec_probe()
213 return cec->irq; in mtk_cec_probe()
215 ret = devm_request_threaded_irq(dev, cec->irq, NULL, in mtk_cec_probe()
224 ret = clk_prepare_enable(cec->clk); in mtk_cec_probe()
230 mtk_cec_htplg_irq_init(cec); in mtk_cec_probe()
231 mtk_cec_htplg_irq_enable(cec); in mtk_cec_probe()
238 struct mtk_cec *cec = platform_get_drvdata(pdev); in mtk_cec_remove() local
240 mtk_cec_htplg_irq_disable(cec); in mtk_cec_remove()
241 clk_disable_unprepare(cec->clk); in mtk_cec_remove()