Lines Matching refs:cec

71 static void dw_hdmi_write(struct dw_hdmi_cec *cec, u8 val, int offset)  in dw_hdmi_write()  argument
73 cec->ops->write(cec->hdmi, val, offset); in dw_hdmi_write()
76 static u8 dw_hdmi_read(struct dw_hdmi_cec *cec, int offset) in dw_hdmi_read() argument
78 return cec->ops->read(cec->hdmi, offset); in dw_hdmi_read()
83 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_log_addr() local
86 cec->addresses = 0; in dw_hdmi_cec_log_addr()
88 cec->addresses |= BIT(logical_addr) | BIT(15); in dw_hdmi_cec_log_addr()
90 dw_hdmi_write(cec, cec->addresses & 255, HDMI_CEC_ADDR_L); in dw_hdmi_cec_log_addr()
91 dw_hdmi_write(cec, cec->addresses >> 8, HDMI_CEC_ADDR_H); in dw_hdmi_cec_log_addr()
99 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_transmit() local
116 dw_hdmi_write(cec, msg->msg[i], HDMI_CEC_TX_DATA0 + i); in dw_hdmi_cec_transmit()
118 dw_hdmi_write(cec, msg->len, HDMI_CEC_TX_CNT); in dw_hdmi_cec_transmit()
119 dw_hdmi_write(cec, ctrl | CEC_CTRL_START, HDMI_CEC_CTRL); in dw_hdmi_cec_transmit()
127 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_hardirq() local
128 unsigned int stat = dw_hdmi_read(cec, HDMI_IH_CEC_STAT0); in dw_hdmi_cec_hardirq()
134 dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0); in dw_hdmi_cec_hardirq()
137 cec->tx_status = CEC_TX_STATUS_ERROR; in dw_hdmi_cec_hardirq()
138 cec->tx_done = true; in dw_hdmi_cec_hardirq()
141 cec->tx_status = CEC_TX_STATUS_OK; in dw_hdmi_cec_hardirq()
142 cec->tx_done = true; in dw_hdmi_cec_hardirq()
145 cec->tx_status = CEC_TX_STATUS_NACK; in dw_hdmi_cec_hardirq()
146 cec->tx_done = true; in dw_hdmi_cec_hardirq()
153 len = dw_hdmi_read(cec, HDMI_CEC_RX_CNT); in dw_hdmi_cec_hardirq()
154 if (len > sizeof(cec->rx_msg.msg)) in dw_hdmi_cec_hardirq()
155 len = sizeof(cec->rx_msg.msg); in dw_hdmi_cec_hardirq()
158 cec->rx_msg.msg[i] = in dw_hdmi_cec_hardirq()
159 dw_hdmi_read(cec, HDMI_CEC_RX_DATA0 + i); in dw_hdmi_cec_hardirq()
161 dw_hdmi_write(cec, 0, HDMI_CEC_LOCK); in dw_hdmi_cec_hardirq()
163 cec->rx_msg.len = len; in dw_hdmi_cec_hardirq()
165 cec->rx_done = true; in dw_hdmi_cec_hardirq()
176 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_thread() local
178 if (cec->tx_done) { in dw_hdmi_cec_thread()
179 cec->tx_done = false; in dw_hdmi_cec_thread()
180 cec_transmit_attempt_done(adap, cec->tx_status); in dw_hdmi_cec_thread()
182 if (cec->rx_done) { in dw_hdmi_cec_thread()
183 cec->rx_done = false; in dw_hdmi_cec_thread()
185 cec_received_msg(adap, &cec->rx_msg); in dw_hdmi_cec_thread()
192 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_enable() local
195 dw_hdmi_write(cec, ~0, HDMI_CEC_MASK); in dw_hdmi_cec_enable()
196 dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_enable()
197 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); in dw_hdmi_cec_enable()
199 cec->ops->disable(cec->hdmi); in dw_hdmi_cec_enable()
203 dw_hdmi_write(cec, 0, HDMI_CEC_CTRL); in dw_hdmi_cec_enable()
204 dw_hdmi_write(cec, ~0, HDMI_IH_CEC_STAT0); in dw_hdmi_cec_enable()
205 dw_hdmi_write(cec, 0, HDMI_CEC_LOCK); in dw_hdmi_cec_enable()
207 dw_hdmi_cec_log_addr(cec->adap, CEC_LOG_ADDR_INVALID); in dw_hdmi_cec_enable()
209 cec->ops->enable(cec->hdmi); in dw_hdmi_cec_enable()
213 dw_hdmi_write(cec, irqs, HDMI_CEC_POLARITY); in dw_hdmi_cec_enable()
214 dw_hdmi_write(cec, ~irqs, HDMI_CEC_MASK); in dw_hdmi_cec_enable()
215 dw_hdmi_write(cec, ~irqs, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_enable()
228 struct dw_hdmi_cec *cec = data; in dw_hdmi_cec_del() local
230 cec_delete_adapter(cec->adap); in dw_hdmi_cec_del()
236 struct dw_hdmi_cec *cec; in dw_hdmi_cec_probe() local
247 cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); in dw_hdmi_cec_probe()
248 if (!cec) in dw_hdmi_cec_probe()
251 cec->irq = data->irq; in dw_hdmi_cec_probe()
252 cec->ops = data->ops; in dw_hdmi_cec_probe()
253 cec->hdmi = data->hdmi; in dw_hdmi_cec_probe()
255 platform_set_drvdata(pdev, cec); in dw_hdmi_cec_probe()
257 dw_hdmi_write(cec, 0, HDMI_CEC_TX_CNT); in dw_hdmi_cec_probe()
258 dw_hdmi_write(cec, ~0, HDMI_CEC_MASK); in dw_hdmi_cec_probe()
259 dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_probe()
260 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); in dw_hdmi_cec_probe()
262 cec->adap = cec_allocate_adapter(&dw_hdmi_cec_ops, cec, "dw_hdmi", in dw_hdmi_cec_probe()
266 if (IS_ERR(cec->adap)) in dw_hdmi_cec_probe()
267 return PTR_ERR(cec->adap); in dw_hdmi_cec_probe()
270 cec->adap->owner = THIS_MODULE; in dw_hdmi_cec_probe()
272 ret = devm_add_action_or_reset(&pdev->dev, dw_hdmi_cec_del, cec); in dw_hdmi_cec_probe()
276 ret = devm_request_threaded_irq(&pdev->dev, cec->irq, in dw_hdmi_cec_probe()
279 "dw-hdmi-cec", cec->adap); in dw_hdmi_cec_probe()
283 cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent, in dw_hdmi_cec_probe()
284 NULL, cec->adap); in dw_hdmi_cec_probe()
285 if (!cec->notify) in dw_hdmi_cec_probe()
288 ret = cec_register_adapter(cec->adap, pdev->dev.parent); in dw_hdmi_cec_probe()
290 cec_notifier_cec_adap_unregister(cec->notify, cec->adap); in dw_hdmi_cec_probe()
298 devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec); in dw_hdmi_cec_probe()
305 struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); in dw_hdmi_cec_remove() local
307 cec_notifier_cec_adap_unregister(cec->notify, cec->adap); in dw_hdmi_cec_remove()
308 cec_unregister_adapter(cec->adap); in dw_hdmi_cec_remove()
313 struct dw_hdmi_cec *cec = dev_get_drvdata(dev); in dw_hdmi_cec_resume() local
316 dw_hdmi_write(cec, cec->addresses & 255, HDMI_CEC_ADDR_L); in dw_hdmi_cec_resume()
317 dw_hdmi_write(cec, cec->addresses >> 8, HDMI_CEC_ADDR_H); in dw_hdmi_cec_resume()
320 dw_hdmi_write(cec, cec->regs_polarity, HDMI_CEC_POLARITY); in dw_hdmi_cec_resume()
321 dw_hdmi_write(cec, cec->regs_mask, HDMI_CEC_MASK); in dw_hdmi_cec_resume()
322 dw_hdmi_write(cec, cec->regs_mute_stat0, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_resume()
329 struct dw_hdmi_cec *cec = dev_get_drvdata(dev); in dw_hdmi_cec_suspend() local
332 cec->regs_polarity = dw_hdmi_read(cec, HDMI_CEC_POLARITY); in dw_hdmi_cec_suspend()
333 cec->regs_mask = dw_hdmi_read(cec, HDMI_CEC_MASK); in dw_hdmi_cec_suspend()
334 cec->regs_mute_stat0 = dw_hdmi_read(cec, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_suspend()