Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remove} calls

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Brownell
Date: Tuesday, October 21, 2008 - 9:22 pm

On Tuesday 21 October 2008, Benjamin Herrenschmidt wrote:

Like what I suggested:  "chip-aware OF glue drivers".  The relevant
bus code being the "of_platform_bus_type" infrastructure.

Example:  instead of Anton's patch #6 modifying the existing pca953x
driver, an of_pca953x driver that knows how to poke around in the OF
device attributes to (a) create the pca953x_platform_data, (b) call
i2c_register_board_info() to make that available later, and then
finally (c) vanish, since it's not needed any longer.

Better that than either the $SUBJECT patch, or modifying gpiolib to
grow OF-specific hooks ... hooks that can at best solve *one* of the
problems:  which GPIO numbers to use with this chip.  The platform
data does solve other problems(*) like:  (i) how to initialize the
polarity inversion register, (ii) arranging to set up other devices
only after their GPIOs are ready, (iii) initializing things that
device drivers won't always know about, or which may need to be
set up before such drivers are available.

- Dave

(*) A trivial example of (ii) would be LEDs driven by those GPIOs.

    A less trivial example:  see arch/arm/mach-davinci/board-evm.c
    in current GIT.  There are three pcf8574 I2C expanders used for
    various things ... LEDs, audio PLL, device power supplies, reset
    lines for external devices, more.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/7] i2c: add info->archdata field, Anton Vorontsov, (Thu Oct 16, 10:12 am)
[PATCH 3/7] of: fill the archdata for I2C devices, Anton Vorontsov, (Thu Oct 16, 10:12 am)
[PATCH 6/7] gpio/pca953x: convert to dev_gpiochip_add and ..., Anton Vorontsov, (Thu Oct 16, 10:13 am)
Re: [PATCH 2/7] i2c: add info->archdata field, Jean Delvare, (Fri Oct 17, 2:21 am)
Re: [PATCH 2/7] i2c: add info->archdata field, Benjamin Herrenschmidt, (Tue Oct 21, 5:27 pm)
Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remov ..., Benjamin Herrenschmidt, (Tue Oct 21, 5:29 pm)
Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remov ..., Benjamin Herrenschmidt, (Tue Oct 21, 7:27 pm)
Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remov ..., Benjamin Herrenschmidt, (Tue Oct 21, 7:28 pm)
Re: [PATCH 3/7] of: fill the archdata for I2C devices, Grant Likely, (Tue Oct 21, 9:14 pm)
Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remov ..., David Brownell, (Tue Oct 21, 9:22 pm)
Re: [PATCH 2/7] i2c: add info->archdata field, Jean Delvare, (Tue Oct 21, 11:50 pm)
Re: [PATCH 2/7] i2c: add info->archdata field, Benjamin Herrenschmidt, (Wed Oct 22, 12:37 am)
Re: [PATCH 2/7] i2c: add info->archdata field, Anton Vorontsov, (Wed Oct 22, 3:08 am)
Re: [PATCH 2/7] i2c: add info->archdata field, Jean Delvare, (Wed Oct 22, 4:07 am)
Re: [PATCH 2/7] i2c: add info->archdata field, Anton Vorontsov, (Wed Oct 22, 5:50 am)
Re: [PATCH 4/7] gpiolib: implement dev_gpiochip_{add,remov ..., Benjamin Herrenschmidt, (Wed Oct 22, 9:45 pm)
[PATCH 0/6 RFC] OF-glue devices for I2C/SPI (was: Re: [P ..., Anton Vorontsov, (Tue Oct 28, 10:45 am)
[PATCH 1/6] of/base: Add new helper of_should_create_pdev(), Anton Vorontsov, (Tue Oct 28, 10:46 am)
[PATCH 2/6] of/of_i2c: implement of_{,un}register_i2c_device, Anton Vorontsov, (Tue Oct 28, 10:46 am)
[PATCH 6/6] gpio: OpenFirmware bindings for the pca953x, Anton Vorontsov, (Tue Oct 28, 10:46 am)