Lines Matching defs:cec

16 #include <media/cec.h>
17 #include <media/cec-notifier.h>
19 #include "dw-hdmi-cec.h"
71 static void dw_hdmi_write(struct dw_hdmi_cec *cec, u8 val, int offset)
73 cec->ops->write(cec->hdmi, val, offset);
76 static u8 dw_hdmi_read(struct dw_hdmi_cec *cec, int offset)
78 return cec->ops->read(cec->hdmi, offset);
83 struct dw_hdmi_cec *cec = cec_get_drvdata(adap);
86 cec->addresses = 0;
88 cec->addresses |= BIT(logical_addr) | BIT(15);
90 dw_hdmi_write(cec, cec->addresses & 255, HDMI_CEC_ADDR_L);
91 dw_hdmi_write(cec, cec->addresses >> 8, HDMI_CEC_ADDR_H);
99 struct dw_hdmi_cec *cec = cec_get_drvdata(adap);
116 dw_hdmi_write(cec, msg->msg[i], HDMI_CEC_TX_DATA0 + i);
118 dw_hdmi_write(cec, msg->len, HDMI_CEC_TX_CNT);
119 dw_hdmi_write(cec, ctrl | CEC_CTRL_START, HDMI_CEC_CTRL);
127 struct dw_hdmi_cec *cec = cec_get_drvdata(adap);
128 unsigned int stat = dw_hdmi_read(cec, HDMI_IH_CEC_STAT0);
134 dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0);
137 cec->tx_status = CEC_TX_STATUS_ERROR;
138 cec->tx_done = true;
141 cec->tx_status = CEC_TX_STATUS_OK;
142 cec->tx_done = true;
145 cec->tx_status = CEC_TX_STATUS_NACK;
146 cec->tx_done = true;
149 cec->tx_status = CEC_TX_STATUS_ARB_LOST;
150 cec->tx_done = true;
157 len = dw_hdmi_read(cec, HDMI_CEC_RX_CNT);
158 if (len > sizeof(cec->rx_msg.msg))
159 len = sizeof(cec->rx_msg.msg);
162 cec->rx_msg.msg[i] =
163 dw_hdmi_read(cec, HDMI_CEC_RX_DATA0 + i);
165 dw_hdmi_write(cec, 0, HDMI_CEC_LOCK);
167 cec->rx_msg.len = len;
169 cec->rx_done = true;
180 struct dw_hdmi_cec *cec = cec_get_drvdata(adap);
182 if (cec->tx_done) {
183 cec->tx_done = false;
184 cec_transmit_attempt_done(adap, cec->tx_status);
186 if (cec->rx_done) {
187 cec->rx_done = false;
189 cec_received_msg(adap, &cec->rx_msg);
196 struct dw_hdmi_cec *cec = cec_get_drvdata(adap);
199 dw_hdmi_write(cec, ~0, HDMI_CEC_MASK);
200 dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0);
201 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY);
203 cec->ops->disable(cec->hdmi);
207 dw_hdmi_write(cec, 0, HDMI_CEC_CTRL);
208 dw_hdmi_write(cec, ~0, HDMI_IH_CEC_STAT0);
209 dw_hdmi_write(cec, 0, HDMI_CEC_LOCK);
211 dw_hdmi_cec_log_addr(cec->adap, CEC_LOG_ADDR_INVALID);
213 cec->ops->enable(cec->hdmi);
217 dw_hdmi_write(cec, irqs, HDMI_CEC_POLARITY);
218 dw_hdmi_write(cec, ~irqs, HDMI_CEC_MASK);
219 dw_hdmi_write(cec, ~irqs, HDMI_IH_MUTE_CEC_STAT0);
232 struct dw_hdmi_cec *cec = data;
234 cec_delete_adapter(cec->adap);
240 struct dw_hdmi_cec *cec;
251 cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL);
252 if (!cec)
255 cec->irq = data->irq;
256 cec->ops = data->ops;
257 cec->hdmi = data->hdmi;
259 platform_set_drvdata(pdev, cec);
261 dw_hdmi_write(cec, 0, HDMI_CEC_TX_CNT);
262 dw_hdmi_write(cec, ~0, HDMI_CEC_MASK);
263 dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0);
264 dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY);
266 cec->adap = cec_allocate_adapter(&dw_hdmi_cec_ops, cec, "dw_hdmi",
270 if (IS_ERR(cec->adap))
271 return PTR_ERR(cec->adap);
274 cec->adap->owner = THIS_MODULE;
276 ret = devm_add_action_or_reset(&pdev->dev, dw_hdmi_cec_del, cec);
280 ret = devm_request_threaded_irq(&pdev->dev, cec->irq,
283 "dw-hdmi-cec", cec->adap);
287 cec->notify = cec_notifier_cec_adap_register(pdev->dev.parent,
288 NULL, cec->adap);
289 if (!cec->notify)
292 ret = cec_register_adapter(cec->adap, pdev->dev.parent);
294 cec_notifier_cec_adap_unregister(cec->notify, cec->adap);
302 devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec);
309 struct dw_hdmi_cec *cec = platform_get_drvdata(pdev);
311 cec_notifier_cec_adap_unregister(cec->notify, cec->adap);
312 cec_unregister_adapter(cec->adap);
317 struct dw_hdmi_cec *cec = dev_get_drvdata(dev);
320 dw_hdmi_write(cec, cec->addresses & 255, HDMI_CEC_ADDR_L);
321 dw_hdmi_write(cec, cec->addresses >> 8, HDMI_CEC_ADDR_H);
324 dw_hdmi_write(cec, cec->regs_polarity, HDMI_CEC_POLARITY);
325 dw_hdmi_write(cec, cec->regs_mask, HDMI_CEC_MASK);
326 dw_hdmi_write(cec, cec->regs_mute_stat0, HDMI_IH_MUTE_CEC_STAT0);
333 struct dw_hdmi_cec *cec = dev_get_drvdata(dev);
336 cec->regs_polarity = dw_hdmi_read(cec, HDMI_CEC_POLARITY);
337 cec->regs_mask = dw_hdmi_read(cec, HDMI_CEC_MASK);
338 cec->regs_mute_stat0 = dw_hdmi_read(cec, HDMI_IH_MUTE_CEC_STAT0);
351 .name = "dw-hdmi-cec",
360 MODULE_ALIAS(PLATFORM_MODULE_PREFIX "dw-hdmi-cec");