Lines Matching refs:cec

67 static void dw_hdmi_write(struct dw_hdmi_cec *cec, u8 val, int offset)  in dw_hdmi_write()  argument
69 cec->ops->write(cec->hdmi, val, offset); in dw_hdmi_write()
72 static u8 dw_hdmi_read(struct dw_hdmi_cec *cec, int offset) in dw_hdmi_read() argument
74 return cec->ops->read(cec->hdmi, offset); in dw_hdmi_read()
79 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_log_addr() local
82 cec->addresses = 0; in dw_hdmi_cec_log_addr()
84 cec->addresses |= BIT(logical_addr) | BIT(15); in dw_hdmi_cec_log_addr()
86 dw_hdmi_write(cec, cec->addresses & 255, HDMI_CEC_ADDR_L); in dw_hdmi_cec_log_addr()
87 dw_hdmi_write(cec, cec->addresses >> 8, HDMI_CEC_ADDR_H); in dw_hdmi_cec_log_addr()
95 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_transmit() local
112 dw_hdmi_write(cec, msg->msg[i], HDMI_CEC_TX_DATA0 + i); in dw_hdmi_cec_transmit()
114 dw_hdmi_write(cec, msg->len, HDMI_CEC_TX_CNT); in dw_hdmi_cec_transmit()
115 dw_hdmi_write(cec, ctrl | CEC_CTRL_START, HDMI_CEC_CTRL); in dw_hdmi_cec_transmit()
123 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_hardirq() local
124 unsigned int stat = dw_hdmi_read(cec, HDMI_IH_CEC_STAT0); in dw_hdmi_cec_hardirq()
130 dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0); in dw_hdmi_cec_hardirq()
133 cec->tx_status = CEC_TX_STATUS_ERROR; in dw_hdmi_cec_hardirq()
134 cec->tx_done = true; in dw_hdmi_cec_hardirq()
137 cec->tx_status = CEC_TX_STATUS_OK; in dw_hdmi_cec_hardirq()
138 cec->tx_done = true; in dw_hdmi_cec_hardirq()
141 cec->tx_status = CEC_TX_STATUS_NACK; in dw_hdmi_cec_hardirq()
142 cec->tx_done = true; in dw_hdmi_cec_hardirq()
149 len = dw_hdmi_read(cec, HDMI_CEC_RX_CNT); in dw_hdmi_cec_hardirq()
150 if (len > sizeof(cec->rx_msg.msg)) in dw_hdmi_cec_hardirq()
151 len = sizeof(cec->rx_msg.msg); in dw_hdmi_cec_hardirq()
154 cec->rx_msg.msg[i] = in dw_hdmi_cec_hardirq()
155 dw_hdmi_read(cec, HDMI_CEC_RX_DATA0 + i); in dw_hdmi_cec_hardirq()
157 dw_hdmi_write(cec, 0, HDMI_CEC_LOCK); in dw_hdmi_cec_hardirq()
159 cec->rx_msg.len = len; in dw_hdmi_cec_hardirq()
161 cec->rx_done = true; in dw_hdmi_cec_hardirq()
172 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_thread() local
174 if (cec->tx_done) { in dw_hdmi_cec_thread()
175 cec->tx_done = false; in dw_hdmi_cec_thread()
176 cec_transmit_attempt_done(adap, cec->tx_status); in dw_hdmi_cec_thread()
178 if (cec->rx_done) { in dw_hdmi_cec_thread()
179 cec->rx_done = false; in dw_hdmi_cec_thread()
181 cec_received_msg(adap, &cec->rx_msg); in dw_hdmi_cec_thread()
188 struct dw_hdmi_cec *cec = cec_get_drvdata(adap); in dw_hdmi_cec_enable() local
191 dw_hdmi_write(cec, ~0, HDMI_CEC_MASK); in dw_hdmi_cec_enable()
192 dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_enable()
193 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); in dw_hdmi_cec_enable()
195 cec->ops->disable(cec->hdmi); in dw_hdmi_cec_enable()
199 dw_hdmi_write(cec, 0, HDMI_CEC_CTRL); in dw_hdmi_cec_enable()
200 dw_hdmi_write(cec, ~0, HDMI_IH_CEC_STAT0); in dw_hdmi_cec_enable()
201 dw_hdmi_write(cec, 0, HDMI_CEC_LOCK); in dw_hdmi_cec_enable()
203 dw_hdmi_cec_log_addr(cec->adap, CEC_LOG_ADDR_INVALID); in dw_hdmi_cec_enable()
205 cec->ops->enable(cec->hdmi); in dw_hdmi_cec_enable()
209 dw_hdmi_write(cec, irqs, HDMI_CEC_POLARITY); in dw_hdmi_cec_enable()
210 dw_hdmi_write(cec, ~irqs, HDMI_CEC_MASK); in dw_hdmi_cec_enable()
211 dw_hdmi_write(cec, ~irqs, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_enable()
224 struct dw_hdmi_cec *cec = data; in dw_hdmi_cec_del() local
226 cec_delete_adapter(cec->adap); in dw_hdmi_cec_del()
232 struct dw_hdmi_cec *cec; in dw_hdmi_cec_probe() local
243 cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); in dw_hdmi_cec_probe()
244 if (!cec) in dw_hdmi_cec_probe()
247 cec->irq = data->irq; in dw_hdmi_cec_probe()
248 cec->ops = data->ops; in dw_hdmi_cec_probe()
249 cec->hdmi = data->hdmi; in dw_hdmi_cec_probe()
251 platform_set_drvdata(pdev, cec); in dw_hdmi_cec_probe()
253 dw_hdmi_write(cec, 0, HDMI_CEC_TX_CNT); in dw_hdmi_cec_probe()
254 dw_hdmi_write(cec, ~0, HDMI_CEC_MASK); in dw_hdmi_cec_probe()
255 dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0); in dw_hdmi_cec_probe()
256 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); in dw_hdmi_cec_probe()
258 cec->adap = cec_allocate_adapter(&dw_hdmi_cec_ops, cec, "dw_hdmi", in dw_hdmi_cec_probe()
262 if (IS_ERR(cec->adap)) in dw_hdmi_cec_probe()
263 return PTR_ERR(cec->adap); in dw_hdmi_cec_probe()
266 cec->adap->owner = THIS_MODULE; in dw_hdmi_cec_probe()
268 ret = devm_add_action_or_reset(&pdev->dev, dw_hdmi_cec_del, cec); in dw_hdmi_cec_probe()
272 ret = devm_request_threaded_irq(&pdev->dev, cec->irq, in dw_hdmi_cec_probe()
275 "dw-hdmi-cec", cec->adap); in dw_hdmi_cec_probe()
279 cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent, in dw_hdmi_cec_probe()
280 NULL, cec->adap); in dw_hdmi_cec_probe()
281 if (!cec->notify) in dw_hdmi_cec_probe()
284 ret = cec_register_adapter(cec->adap, pdev->dev.parent); in dw_hdmi_cec_probe()
286 cec_notifier_cec_adap_unregister(cec->notify, cec->adap); in dw_hdmi_cec_probe()
294 devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec); in dw_hdmi_cec_probe()
301 struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); in dw_hdmi_cec_remove() local
303 cec_notifier_cec_adap_unregister(cec->notify, cec->adap); in dw_hdmi_cec_remove()
304 cec_unregister_adapter(cec->adap); in dw_hdmi_cec_remove()