From 2567f5ebfc562fedecb4ade4a41663e3c5846a53 Mon Sep 17 00:00:00 2001 From: luowei Date: Mon, 28 Mar 2011 21:13:07 +0800 Subject: [PATCH] change pin number of wm831x to irq --- drivers/mfd/wm831x-spi.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c index 20896e0ca4a1..1fe4de7d86e6 100755 --- a/drivers/mfd/wm831x-spi.c +++ b/drivers/mfd/wm831x-spi.c @@ -15,6 +15,8 @@ #include #include #include +#include + #include @@ -67,7 +69,8 @@ static int __devinit wm831x_spi_probe(struct spi_device *spi) { struct wm831x *wm831x; enum wm831x_parent type; - + int ret,gpio,irq; + /* Currently SPI support for ID tables is unmerged, we're faking it */ if (strcmp(spi->modalias, "wm8310") == 0) type = WM8310; @@ -93,13 +96,26 @@ static int __devinit wm831x_spi_probe(struct spi_device *spi) spi->bits_per_word = 16; spi->mode = SPI_MODE_0; + gpio = spi->irq; + ret = gpio_request(gpio, "wm831x"); + if (ret) { + printk( "failed to request rk gpio irq for wm831x \n"); + return ret; + } + gpio_pull_updown(gpio, GPIOPullUp); + if (ret) { + printk("failed to pull up gpio irq for wm831x \n"); + return ret; + } + irq = gpio_to_irq(gpio); + dev_set_drvdata(&spi->dev, wm831x); wm831x->dev = &spi->dev; wm831x->control_data = spi; wm831x->read_dev = wm831x_spi_read_device; wm831x->write_dev = wm831x_spi_write_device; - return wm831x_device_init(wm831x, type, spi->irq); + return wm831x_device_init(wm831x, type, irq); } static int __devexit wm831x_spi_remove(struct spi_device *spi) -- 2.34.1