Lines Matching refs:cec

36 	struct cec_gpio *cec = cec_get_drvdata(adap);  in cec_gpio_read()  local
38 if (cec->cec_is_low) in cec_gpio_read()
40 return gpiod_get_value(cec->cec_gpio); in cec_gpio_read()
45 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_high() local
47 if (!cec->cec_is_low) in cec_gpio_high()
49 cec->cec_is_low = false; in cec_gpio_high()
50 gpiod_set_value(cec->cec_gpio, 1); in cec_gpio_high()
55 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_low() local
57 if (cec->cec_is_low) in cec_gpio_low()
59 cec->cec_is_low = true; in cec_gpio_low()
60 gpiod_set_value(cec->cec_gpio, 0); in cec_gpio_low()
65 struct cec_gpio *cec = priv; in cec_hpd_gpio_irq_handler_thread() local
67 cec_queue_pin_hpd_event(cec->adap, cec->hpd_is_high, cec->hpd_ts); in cec_hpd_gpio_irq_handler_thread()
73 struct cec_gpio *cec = priv; in cec_5v_gpio_irq_handler() local
74 int val = gpiod_get_value(cec->v5_gpio); in cec_5v_gpio_irq_handler()
77 if (val < 0 || is_high == cec->v5_is_high) in cec_5v_gpio_irq_handler()
79 cec->v5_ts = ktime_get(); in cec_5v_gpio_irq_handler()
80 cec->v5_is_high = is_high; in cec_5v_gpio_irq_handler()
86 struct cec_gpio *cec = priv; in cec_5v_gpio_irq_handler_thread() local
88 cec_queue_pin_5v_event(cec->adap, cec->v5_is_high, cec->v5_ts); in cec_5v_gpio_irq_handler_thread()
94 struct cec_gpio *cec = priv; in cec_hpd_gpio_irq_handler() local
95 int val = gpiod_get_value(cec->hpd_gpio); in cec_hpd_gpio_irq_handler()
98 if (val < 0 || is_high == cec->hpd_is_high) in cec_hpd_gpio_irq_handler()
100 cec->hpd_ts = ktime_get(); in cec_hpd_gpio_irq_handler()
101 cec->hpd_is_high = is_high; in cec_hpd_gpio_irq_handler()
107 struct cec_gpio *cec = priv; in cec_gpio_irq_handler() local
108 int val = gpiod_get_value(cec->cec_gpio); in cec_gpio_irq_handler()
111 cec_pin_changed(cec->adap, val > 0); in cec_gpio_irq_handler()
117 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_enable_irq() local
119 enable_irq(cec->cec_irq); in cec_gpio_enable_irq()
125 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_disable_irq() local
127 disable_irq(cec->cec_irq); in cec_gpio_disable_irq()
132 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_status() local
134 seq_printf(file, "mode: %s\n", cec->cec_is_low ? "low-drive" : "read"); in cec_gpio_status()
135 seq_printf(file, "using irq: %d\n", cec->cec_irq); in cec_gpio_status()
136 if (cec->hpd_gpio) in cec_gpio_status()
138 cec->hpd_is_high ? "high" : "low"); in cec_gpio_status()
139 if (cec->v5_gpio) in cec_gpio_status()
141 cec->v5_is_high ? "high" : "low"); in cec_gpio_status()
146 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_read_hpd() local
148 if (!cec->hpd_gpio) in cec_gpio_read_hpd()
150 return gpiod_get_value(cec->hpd_gpio); in cec_gpio_read_hpd()
155 struct cec_gpio *cec = cec_get_drvdata(adap); in cec_gpio_read_5v() local
157 if (!cec->v5_gpio) in cec_gpio_read_5v()
159 return gpiod_get_value(cec->v5_gpio); in cec_gpio_read_5v()
183 struct cec_gpio *cec; in cec_gpio_probe() local
193 cec = devm_kzalloc(dev, sizeof(*cec), GFP_KERNEL); in cec_gpio_probe()
194 if (!cec) in cec_gpio_probe()
197 cec->dev = dev; in cec_gpio_probe()
199 cec->cec_gpio = devm_gpiod_get(dev, "cec", GPIOD_OUT_HIGH_OPEN_DRAIN); in cec_gpio_probe()
200 if (IS_ERR(cec->cec_gpio)) in cec_gpio_probe()
201 return PTR_ERR(cec->cec_gpio); in cec_gpio_probe()
202 cec->cec_irq = gpiod_to_irq(cec->cec_gpio); in cec_gpio_probe()
204 cec->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN); in cec_gpio_probe()
205 if (IS_ERR(cec->hpd_gpio)) in cec_gpio_probe()
206 return PTR_ERR(cec->hpd_gpio); in cec_gpio_probe()
208 cec->v5_gpio = devm_gpiod_get_optional(dev, "v5", GPIOD_IN); in cec_gpio_probe()
209 if (IS_ERR(cec->v5_gpio)) in cec_gpio_probe()
210 return PTR_ERR(cec->v5_gpio); in cec_gpio_probe()
212 cec->adap = cec_pin_allocate_adapter(&cec_gpio_pin_ops, in cec_gpio_probe()
213 cec, pdev->name, caps); in cec_gpio_probe()
214 if (IS_ERR(cec->adap)) in cec_gpio_probe()
215 return PTR_ERR(cec->adap); in cec_gpio_probe()
217 ret = devm_request_irq(dev, cec->cec_irq, cec_gpio_irq_handler, in cec_gpio_probe()
219 cec->adap->name, cec); in cec_gpio_probe()
223 cec_gpio_disable_irq(cec->adap); in cec_gpio_probe()
225 if (cec->hpd_gpio) { in cec_gpio_probe()
226 cec->hpd_irq = gpiod_to_irq(cec->hpd_gpio); in cec_gpio_probe()
227 ret = devm_request_threaded_irq(dev, cec->hpd_irq, in cec_gpio_probe()
232 "hpd-gpio", cec); in cec_gpio_probe()
237 if (cec->v5_gpio) { in cec_gpio_probe()
238 cec->v5_irq = gpiod_to_irq(cec->v5_gpio); in cec_gpio_probe()
239 ret = devm_request_threaded_irq(dev, cec->v5_irq, in cec_gpio_probe()
244 "v5-gpio", cec); in cec_gpio_probe()
250 cec->notifier = cec_notifier_cec_adap_register(hdmi_dev, NULL, in cec_gpio_probe()
251 cec->adap); in cec_gpio_probe()
252 if (!cec->notifier) { in cec_gpio_probe()
258 ret = cec_register_adapter(cec->adap, &pdev->dev); in cec_gpio_probe()
262 platform_set_drvdata(pdev, cec); in cec_gpio_probe()
266 cec_notifier_cec_adap_unregister(cec->notifier, cec->adap); in cec_gpio_probe()
268 cec_delete_adapter(cec->adap); in cec_gpio_probe()
274 struct cec_gpio *cec = platform_get_drvdata(pdev); in cec_gpio_remove() local
276 cec_notifier_cec_adap_unregister(cec->notifier, cec->adap); in cec_gpio_remove()
277 cec_unregister_adapter(cec->adap); in cec_gpio_remove()