If you want use cases, how about mine? I didn't write the code originally for
fun, I wrote it for a real product.
We have a flash chip with a hardware write protected boot block controlled by
a gpio. If we want to flash this block, we need a way to change the gpio.
patching the mtd driver to do this automatically would require maintaining an
out-of-tree patch, I like to avoid those. We'd also rather mtd didn't
automatically un-write-protect the boot block; kinda defeats the purpose.
The device may have a daughtercard installed in it. There is a gpio used as a
presence detect. We want to be able, from userspace (any maybe kernel too),
to print out "card installed" or "no card installed". There is also certain
stuff that should run if the card is present when the machine boots.
We have some PCA9557 I2C gpio expanders that encode a device version number.
We want to print this number out in userspace (e.g. show it in the web
interface, various other application specific interfaces, etc.). Maybe the
kernel will need to know too, we'll see what happens when there is a version
two. The daughter card also has a PCA9557 expander, but of course it might
not be connected, the pca9557 driver can probe the bus for this.
Suppose I want line 5 from the mpuio gpios? I'd make it so this was:
/sys/class/gpio/mpuio:5
How would you get the sysfs location, with an automatic shell script running
on a lightweight embedded system (no perl!)?
Why not have an irq file for that?
--