i2c: mux/i801: Switch to use descriptor passing
This switches the i801 GPIO mux to use GPIO descriptors for
handling the GPIO lines. The previous hack which was reaching
inside the GPIO chips etc cannot live on. We pass descriptors
along with the GPIO mux device at creation instead.
The GPIO mux was only used by way of platform data with a
platform device from one place in the kernel: the i801 i2c bus
driver. Let's just associate the GPIO descriptor table with
the actual device like everyone else and dynamically create
a descriptor table passed along with the GPIO i2c mux.
This enables simplification of the GPIO i2c mux driver to
use only the descriptor API and the OF probe path gets
simplified in the process.
The i801 driver was registering the GPIO i2c mux with
PLATFORM_DEVID_AUTO which would make it hard to predict the
device name and assign the descriptor table properly, but
this seems to be a mistake to begin with: all of the
GPIO mux devices are hardcoded to look up GPIO lines from
the "gpio_ich" GPIO chip. If there are more than one mux,
there is certainly more than one gpio chip as well, and
then we have more serious problems. Switch to
PLATFORM_DEVID_NONE instead. There can be only one.
Cc: Mika Westerberg <email@example.com>
Cc: Andy Shevchenko <firstname.lastname@example.org>
Cc: Peter Rosin <email@example.com>
Cc: Jean Delvare <firstname.lastname@example.org>
Signed-off-by: Serge Semin <email@example.com>
Signed-off-by: Linus Walleij <firstname.lastname@example.org>
- Fold in fixes from Serge and add his Signed-off-by.
- Reorder variable declarations to inverse christmas tree.
- Stash away GPIO lookup table reference and make sure to
remove it on deletion and on error path.
- Insert some nasty FIXME comments about poking around
in gpiolib internals.
- Found some unused vars when compiling for DT, mea culpa.
3 files changed