From 90763d244023ceda14d73e12c2f949ec642a1708 Mon Sep 17 00:00:00 2001 From: luowei Date: Thu, 17 Mar 2011 10:25:18 +0800 Subject: [PATCH] add pmu config for rk29_phonesdk_defconfig --- arch/arm/configs/rk29_phonesdk_defconfig | 10 ++++++- arch/arm/mach-rk29/board-rk29-phonesdk.c | 27 ++++++++++++++++-- arch/arm/mach-rk29/include/mach/board.h | 36 ++++++++++++++++++++++++ drivers/regulator/wm831x-ldo.c | 4 +-- include/asm-generic/gpio.h | 5 +++- 5 files changed, 75 insertions(+), 7 deletions(-) diff --git a/arch/arm/configs/rk29_phonesdk_defconfig b/arch/arm/configs/rk29_phonesdk_defconfig index 60abf165f3a4..309a1c84544f 100644 --- a/arch/arm/configs/rk29_phonesdk_defconfig +++ b/arch/arm/configs/rk29_phonesdk_defconfig @@ -835,6 +835,7 @@ CONFIG_INPUT_LPSENSOR_ISL29028=y # CONFIG_INPUT_UINPUT is not set # CONFIG_INPUT_GPIO is not set # CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set +CONFIG_INPUT_WM831X_ON=y CONFIG_G_SENSOR_DEVICE=y # CONFIG_GS_MMA7660 is not set CONFIG_GS_MMA8452=y @@ -943,6 +944,7 @@ CONFIG_GPIOLIB=y # CONFIG_GPIO_PCA953X is not set # CONFIG_GPIO_PCF857X is not set # CONFIG_GPIO_WM8994 is not set +CONFIG_GPIO_WM831X=y # # PCI GPIO expanders: @@ -966,6 +968,8 @@ CONFIG_SPI_FPGA_GPIO_IRQ_NUM=16 CONFIG_POWER_SUPPLY=y # CONFIG_POWER_SUPPLY_DEBUG is not set # CONFIG_PDA_POWER is not set +CONFIG_WM831X_BACKUP=y +CONFIG_WM831X_POWER=y # CONFIG_BATTERY_DS2760 is not set # CONFIG_BATTERY_DS2782 is not set # CONFIG_BATTERY_BQ27x00 is not set @@ -1003,7 +1007,8 @@ CONFIG_MFD_CORE=y # CONFIG_PMIC_DA903X is not set CONFIG_MFD_WM8994=y # CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set +CONFIG_MFD_WM831X=y +CONFIG_MFD_WM831X_I2C=y # CONFIG_MFD_WM8350_I2C is not set # CONFIG_MFD_PCF50633 is not set # CONFIG_AB3100_CORE is not set @@ -1015,6 +1020,7 @@ CONFIG_REGULATOR=y # CONFIG_REGULATOR_BQ24022 is not set # CONFIG_REGULATOR_MAX1586 is not set # CONFIG_REGULATOR_WM8994 is not set +CONFIG_REGULATOR_WM831X=y # CONFIG_REGULATOR_LP3971 is not set # CONFIG_REGULATOR_TPS65023 is not set # CONFIG_REGULATOR_TPS6507X is not set @@ -1192,6 +1198,7 @@ CONFIG_BACKLIGHT_LCD_SUPPORT=y # CONFIG_LCD_CLASS_DEVICE is not set CONFIG_BACKLIGHT_CLASS_DEVICE=y # CONFIG_BACKLIGHT_GENERIC is not set +CONFIG_BACKLIGHT_WM831X=y CONFIG_BACKLIGHT_RK29_BL=y # @@ -1581,6 +1588,7 @@ CONFIG_RTC_HYM8563=y # CONFIG_RTC_DRV_M48T59 is not set # CONFIG_RTC_DRV_BQ4802 is not set # CONFIG_RTC_DRV_V3020 is not set +CONFIG_RTC_DRV_WM831X=y # # on-CPU RTC drivers diff --git a/arch/arm/mach-rk29/board-rk29-phonesdk.c b/arch/arm/mach-rk29/board-rk29-phonesdk.c index 2ade42c506a5..d8a69cdf4699 100755 --- a/arch/arm/mach-rk29/board-rk29-phonesdk.c +++ b/arch/arm/mach-rk29/board-rk29-phonesdk.c @@ -417,7 +417,7 @@ static struct mma8452_platform_data mma8452_info = { #endif #if defined(CONFIG_GPIO_WM831X) -struct rk2818_gpio_expander_info wm831x_gpio_settinginfo[] = { +struct rk29_gpio_expander_info wm831x_gpio_settinginfo[] = { { .gpio_num =WM831X_P01,// tp3 .pin_type = GPIO_OUT, @@ -1001,9 +1001,9 @@ static int wm831x_checkrange(int start,int num,int val) static int wm831x_init_pin_type(struct wm831x *wm831x) { -#if 0 +#if 1 struct wm831x_pdata *pdata = wm831x->dev->platform_data; - struct rk2818_gpio_expander_info *wm831x_gpio_settinginfo; + struct rk29_gpio_expander_info *wm831x_gpio_settinginfo; uint16_t offset = 0; uint16_t wm831x_settingpin_num = 0; uint16_t ret = 0; @@ -1403,6 +1403,15 @@ static struct i2c_board_info __initdata board_i2c1_devices[] = { #ifdef CONFIG_I2C2_RK29 static struct i2c_board_info __initdata board_i2c2_devices[] = { +#if defined (CONFIG_MFD_WM831X_I2C) +{ + .type = "wm8310", + .addr = 0x34, + .flags = 0, + .irq = RK29_PIN4_PD0, + .platform_data = &wm831x_platdata, +}, +#endif #if defined (CONFIG_HANNSTAR_P1003) { .type = "p1003_touch", @@ -2678,6 +2687,18 @@ static struct spi_board_info board_spi_devices[] = { .platform_data = &xpt2046_info, }, #endif + +#if defined(CONFIG_MFD_WM831X_SPI) + { + .modalias = "wm8310", + .chip_select = 1, + .max_speed_hz = 12*1000*1000, + .bus_num = 1, + .irq = RK29_PIN4_PD0, + .platform_data = &wm831x_platdata, + }, +#endif + }; diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h index 01c0eee2df88..eb9de55e73b8 100755 --- a/arch/arm/mach-rk29/include/mach/board.h +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -19,6 +19,10 @@ #include #include +/* platform device data structures */ +struct platform_device; +struct i2c_client; + /*spi*/ struct spi_cs_gpio { const char *name; @@ -197,6 +201,38 @@ struct akm8975_platform_data { int gpio_DRDY; }; +struct rk29_gpio_expander_info { + unsigned int gpio_num;// ³õʼ»¯µÄpin ½Åºê¶¨Òå È磺rk29_PIN_PI0 + unsigned int pin_type;//³õʼ»¯µÄpin ΪÊäÈëpin»¹ÊÇÊä³öpin È磺GPIO_IN + unsigned int pin_value;//Èç¹ûΪ output pin ÉèÖõçƽ£¬È磺GPIO_HIGH +}; + +struct tca6424_platform_data { + /* the first extern gpio number in all of gpio groups */ + unsigned int gpio_base; + unsigned int gpio_pin_num; + /* the first gpio irq number in all of irq source */ + + unsigned int gpio_irq_start; + unsigned int irq_pin_num; //ÖжϵĸöÊý + unsigned int tca6424_irq_pin; //À©Õ¹IOµÄÖжϹÒÔÚÄĸögpio + unsigned int expand_port_group; + unsigned int expand_port_pinnum; + unsigned int rk_irq_mode; + unsigned int rk_irq_gpio_pull_up_down; + + /* initial polarity inversion setting */ + uint16_t invert; + struct rk29_gpio_expander_info *settinginfo; + int settinginfolen; + void *context; /* param to setup/teardown */ + + int (*setup)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context); + int (*teardown)(struct i2c_client *client,unsigned gpio, unsigned ngpio,void *context); + char **names; + void (*reseti2cpin)(void); +}; + void __init rk29_setup_early_printk(void); void __init rk29_map_common_io(void); void __init rk29_clock_init(void); diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index e44d9b4f9153..6ebc65742553 100755 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c @@ -835,8 +835,8 @@ static __devexit int wm831x_alive_ldo_shutdown(struct platform_device *pdev) /*Z //struct wm831x_ldo *ldo = platform_get_drvdata(pdev); struct regulator* ldo; - if (reboot_cmd_get()) - return 0; + //if (reboot_cmd_get()) + // return 0; printk("%s\n", __FUNCTION__); ldo = regulator_get(NULL, "ldo1"); diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index f68ea6e02b7e..49eb6ee841a2 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -89,7 +89,10 @@ struct gpio_chip { unsigned offset, int value); void (*set)(struct gpio_chip *chip, unsigned offset, int value); - + + int (*set_debounce)(struct gpio_chip *chip, + unsigned offset, unsigned debounce); + int (*pull_updown)(struct gpio_chip *chip, unsigned offset, unsigned value); -- 2.34.1