On Thu, Oct 20, 2016 at 11:17:13AM +0200, Hans de Goede wrote:
> Yes that is the idea. Although it is not really fake as theoretically
> the CEC pin could be used as a general gpio. Basically the idea is that
> if the hardware only offers get and set functionality on the pin and
> nothing really CEC specific, that we then should really have one generic
> driver to deal with any such hardware, and not an allwinner specific
> driver.
> 
> The natural abstraction for such a driver to talk to the actual hardware
> (be it allwinner or other hw) would be to use the gpio interface.

There's really no point of having such an abstraction in the first
place. Theorically, you could use your audio output or PWM as a GPIO,
yet no one exposes it as a GPIO to then use a generic pwm-gpio driver
to actually implement a PWM.

> > How in that case implement interrupts for such fake gpio?
> 
> GPIOs can be interrupts too, e.g. the cec driver would do:
> 
> struct gpio_desc *cec_gpio = gpiod_get(dev, ...);
> 
> int irq = gpiod_to_irq(cec_gpio);
> 
> devm_request_threaded_irq(dev, irq, NULL, cec_gpio_irq_handler, 
> IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
>                           "cec_irq", cec_data);
> 
> To register an irq on rising and falling edges on the gpio
> pin. If you want to use this you can even make the availability
> of irq functionality on the gpio mandatory in your cec-gpio driver
> and then when someone needs things to work without irq functionality
> they can extend it.
> 
> The cool thing about this approach is that it will give instant CEC
> capability to any (new) board where an edge irq capable GPIO is
> available, just hook up the HMDI connector CEC pin to an edge IRQ
> capable gpio and even non CEC capable HDMI encoders can do CEC :)

The bad thing about this approach is that it doesn't work for us,
since we don't have any interrupts on the CEC pins.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: PGP signature

Reply via email to