From: Tony Lindgren <tony@atomide.com>
To: David Brownell <david-b@pacbell.net>
Cc: linux-omap@vger.kernel.org
Subject: Re: [patch 2.6.28-rc6-omap 1/2] H3 stops using <mach/gpioexpander.h>
Date: Tue, 25 Nov 2008 15:37:11 -0800 [thread overview]
Message-ID: <20081125233711.GD11997@atomide.com> (raw)
In-Reply-To: <200811241028.15876.david-b@pacbell.net>
* David Brownell <david-b@pacbell.net> [081124 10:29]:
> From: David Brownell <dbrownell@users.sourceforge.net>
>
> Update board-h3.c to use standard GPIO calls to set up the
> IRDA transceiver, not legacy OMAP-only gpioexpander code.
>
> Also, move the #include <.../ov9640.h>; the header is gone,
> there's currently no driver for that camera sensor.
>
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
> COMPILE TESTED ONLY ... but obviously, nobody's built this
> board in a while, or the ov9640 header would have been seen.
Great, pushing to l-o tree. It's OK for us to decimate any code
that's not being maintained. Especially if it's not in mainline
tree ;)
Tony
> arch/arm/mach-omap1/board-h3.c | 112 ++++++++++++++++++++++++---------------
> 1 file changed, 69 insertions(+), 43 deletions(-)
>
> --- a/arch/arm/mach-omap1/board-h3.c
> +++ b/arch/arm/mach-omap1/board-h3.c
> @@ -26,8 +26,11 @@
> #include <linux/mtd/nand.h>
> #include <linux/mtd/partitions.h>
> #include <linux/input.h>
> -#include <linux/i2c/tps65010.h>
> #include <linux/clk.h>
> +
> +#include <linux/i2c/tps65010.h>
> +#include <linux/i2c/pcf857x.h>
> +
> #include <linux/spi/spi.h>
> #include <linux/spi/tsc210x.h>
>
> @@ -45,7 +48,6 @@
>
> #include <mach/gpio.h>
> #include <mach/gpio-switch.h>
> -#include <mach/gpioexpander.h>
> #include <mach/irqs.h>
> #include <mach/mux.h>
> #include <mach/tc.h>
> @@ -58,8 +60,6 @@
> #include <mach/mcbsp.h>
> #include <mach/omap-alsa.h>
>
> -#include <../drivers/media/video/ov9640.h>
> -
> #define H3_TS_GPIO 48
>
> static int h3_keymap[] = {
> @@ -284,29 +284,15 @@ static struct platform_device h3_kp_devi
>
> /* Select between the IrDA and aGPS module
> */
> -static int h3_select_irda(struct device *dev, int state)
> -{
> - unsigned char expa;
> - int err = 0;
>
> - if ((err = read_gpio_expa(&expa, 0x26))) {
> - printk(KERN_ERR "Error reading from I/O EXPANDER \n");
> - return err;
> - }
> +static int gpio_irda_enable;
> +static int gpio_irda_x;
> +static int gpio_irda_fir;
>
> - /* 'P6' enable/disable IRDA_TX and IRDA_RX */
> - if (state & IR_SEL) { /* IrDA */
> - if ((err = write_gpio_expa(expa | 0x40, 0x26))) {
> - printk(KERN_ERR "Error writing to I/O EXPANDER \n");
> - return err;
> - }
> - } else {
> - if ((err = write_gpio_expa(expa & ~0x40, 0x26))) {
> - printk(KERN_ERR "Error writing to I/O EXPANDER \n");
> - return err;
> - }
> - }
> - return err;
> +static int h3_select_irda(struct device *dev, int state)
> +{
> + gpio_set_value_cansleep(gpio_irda_enable, state & IR_SEL);
> + return 0;
> }
>
> static void set_trans_mode(struct work_struct *work)
> @@ -314,24 +300,9 @@ static void set_trans_mode(struct work_s
> struct omap_irda_config *irda_config =
> container_of(work, struct omap_irda_config, gpio_expa.work);
> int mode = irda_config->mode;
> - unsigned char expa;
> - int err = 0;
> -
> - if ((err = read_gpio_expa(&expa, 0x27)) != 0) {
> - printk(KERN_ERR "Error reading from I/O expander\n");
> - }
>
> - expa &= ~0x03;
> -
> - if (mode & IR_SIRMODE) {
> - expa |= 0x01;
> - } else { /* MIR/FIR */
> - expa |= 0x03;
> - }
> -
> - if ((err = write_gpio_expa(expa, 0x27)) != 0) {
> - printk(KERN_ERR "Error writing to I/O expander\n");
> - }
> + gpio_set_value_cansleep(gpio_irda_x, 1);
> + gpio_set_value_cansleep(gpio_irda_fir, !(mode & IR_SIRMODE));
> }
>
> static int h3_transceiver_mode(struct device *dev, int mode)
> @@ -441,7 +412,6 @@ static struct platform_device *devices[]
> &nand_device,
> &smc91x_device,
> &intlat_device,
> - &h3_irda_device,
> &h3_kp_device,
> &h3_lcd_device,
> &h3_mcbsp1_device,
> @@ -483,6 +453,9 @@ static int nand_dev_ready(struct omap_na
> }
>
> #if defined(CONFIG_VIDEO_OV9640) || defined(CONFIG_VIDEO_OV9640_MODULE)
> +
> +#include <../drivers/media/video/ov9640.h>
> +
> /*
> * Common OV9640 register initialization for all image sizes, pixel formats,
> * and frame rates
> @@ -576,8 +549,61 @@ static struct ov9640_platform_data h3_ov
> };
> #endif
>
> +static int h3_pcf_setup(struct i2c_client *client, int gpio,
> + unsigned ngpio, void *context)
> +{
> + int status;
> +
> + /* REVISIT someone with schematics should look up the rest
> + * of these signals, and configure them appropriately ...
> + * camera and audio seem to be involved, too.
> + */
> +
> + /* P0 - ? */
> + gpio_irda_x = gpio + 0;
> + status = gpio_request(gpio_irda_x, "irda_x");
> + if (status < 0)
> + goto done;
> + status = gpio_direction_output(gpio_irda_x, 0);
> + if (status < 0)
> + goto done;
> +
> + /* P1 - set if MIR/FIR */
> + gpio_irda_fir = gpio + 1;
> + status = gpio_request(gpio_irda_fir, "irda_fir");
> + if (status < 0)
> + goto done;
> + status = gpio_direction_output(gpio_irda_fir, 0);
> + if (status < 0)
> + goto done;
> +
> + /* 'P6' enable/disable IRDA_TX and IRDA_RX ... default, off */
> + gpio_irda_enable = gpio + 6;
> + status = gpio_request(gpio_irda_enable, "irda_enable");
> + if (status < 0)
> + goto done;
> + status = gpio_direction_output(gpio_irda_enable, 0);
> + if (status < 0)
> + goto done;
> +
> + /* register the IRDA device now that it can be operated */
> + status = platform_device_register(&h3_irda_device);
> +
> +done:
> + return status;
> +}
> +
> +static struct pcf857x_platform_data h3_pcf_data = {
> + /* assign these GPIO numbers right after the MPUIO lines */
> + .gpio_base = OMAP_MAX_GPIO_LINES + 16,
> + .setup = h3_pcf_setup,
> +};
> +
> static struct i2c_board_info __initdata h3_i2c_board_info[] = {
> {
> + I2C_BOARD_INFO("pcf8574", 0x27),
> + .platform_data = &h3_pcf_data,
> + }, {
> I2C_BOARD_INFO("tps65013", 0x48),
> /* .irq = OMAP_GPIO_IRQ(??), */
> },
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-11-25 23:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 18:28 [patch 2.6.28-rc6-omap 1/2] H3 stops using <mach/gpioexpander.h> David Brownell
2008-11-25 23:37 ` Tony Lindgren [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081125233711.GD11997@atomide.com \
--to=tony@atomide.com \
--cc=david-b@pacbell.net \
--cc=linux-omap@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox