Merge branch 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson

* 'for-torvalds' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson:
mach-ux500: configure board for the TPS61052 regulator v2
mach-ux500: provide ab8500 init vector
mach-ux500: board support for AB8500 GPIO driver
gpio: driver for 42 AB8500 GPIO pins

+873 -4
+1
arch/arm/mach-ux500/Kconfig
··· 23 config MACH_U8500 24 bool "U8500 Development platform" 25 depends on UX500_SOC_DB8500 26 help 27 Include support for the mop500 development platform. 28
··· 23 config MACH_U8500 24 bool "U8500 Development platform" 25 depends on UX500_SOC_DB8500 26 + select TPS6105X 27 help 28 Include support for the mop500 development platform. 29
+201
arch/arm/mach-ux500/board-mop500-regulators.c
··· 13 #include <linux/regulator/ab8500.h> 14 #include "board-mop500-regulators.h" 15 16 static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { 17 /* External displays, connector on board 2v5 power supply */ 18 REGULATOR_SUPPLY("vaux12v5", "mcde.0"), ··· 86 REGULATOR_SUPPLY("vsmps2", "mcde.0"), 87 }; 88 89 /* AB8500 regulators */ 90 struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { 91 /* supplies to the display/camera */ ··· 272 .max_uV = 2900000, 273 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 274 REGULATOR_CHANGE_STATUS, 275 }, 276 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 277 .consumer_supplies = ab8500_vaux1_consumers,
··· 13 #include <linux/regulator/ab8500.h> 14 #include "board-mop500-regulators.h" 15 16 + /* 17 + * TPS61052 regulator 18 + */ 19 + static struct regulator_consumer_supply tps61052_vaudio_consumers[] = { 20 + /* 21 + * Boost converter supply to raise voltage on audio speaker, this 22 + * is actually connected to three pins, VInVhfL (left amplifier) 23 + * VInVhfR (right amplifier) and VIntDClassInt - all three must 24 + * be connected to the same voltage. 25 + */ 26 + REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"), 27 + }; 28 + 29 + struct regulator_init_data tps61052_regulator = { 30 + .constraints = { 31 + .name = "vaudio-hf", 32 + .min_uV = 4500000, 33 + .max_uV = 4500000, 34 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 35 + }, 36 + .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers), 37 + .consumer_supplies = tps61052_vaudio_consumers, 38 + }; 39 + 40 static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { 41 /* External displays, connector on board 2v5 power supply */ 42 REGULATOR_SUPPLY("vaux12v5", "mcde.0"), ··· 62 REGULATOR_SUPPLY("vsmps2", "mcde.0"), 63 }; 64 65 + /* ab8500 regulator register initialization */ 66 + struct ab8500_regulator_reg_init 67 + ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS] = { 68 + /* 69 + * VanaRequestCtrl = HP/LP depending on VxRequest 70 + * VextSupply1RequestCtrl = HP/LP depending on VxRequest 71 + */ 72 + INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0x00), 73 + /* 74 + * VextSupply2RequestCtrl = HP/LP depending on VxRequest 75 + * VextSupply3RequestCtrl = HP/LP depending on VxRequest 76 + * Vaux1RequestCtrl = HP/LP depending on VxRequest 77 + * Vaux2RequestCtrl = HP/LP depending on VxRequest 78 + */ 79 + INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0x00), 80 + /* 81 + * Vaux3RequestCtrl = HP/LP depending on VxRequest 82 + * SwHPReq = Control through SWValid disabled 83 + */ 84 + INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x00), 85 + /* 86 + * VanaSysClkReq1HPValid = disabled 87 + * Vaux1SysClkReq1HPValid = disabled 88 + * Vaux2SysClkReq1HPValid = disabled 89 + * Vaux3SysClkReq1HPValid = disabled 90 + */ 91 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0x00), 92 + /* 93 + * VextSupply1SysClkReq1HPValid = disabled 94 + * VextSupply2SysClkReq1HPValid = disabled 95 + * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled 96 + */ 97 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x40), 98 + /* 99 + * VanaHwHPReq1Valid = disabled 100 + * Vaux1HwHPreq1Valid = disabled 101 + * Vaux2HwHPReq1Valid = disabled 102 + * Vaux3HwHPReqValid = disabled 103 + */ 104 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0x00), 105 + /* 106 + * VextSupply1HwHPReq1Valid = disabled 107 + * VextSupply2HwHPReq1Valid = disabled 108 + * VextSupply3HwHPReq1Valid = disabled 109 + */ 110 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x00), 111 + /* 112 + * VanaHwHPReq2Valid = disabled 113 + * Vaux1HwHPReq2Valid = disabled 114 + * Vaux2HwHPReq2Valid = disabled 115 + * Vaux3HwHPReq2Valid = disabled 116 + */ 117 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0x00), 118 + /* 119 + * VextSupply1HwHPReq2Valid = disabled 120 + * VextSupply2HwHPReq2Valid = disabled 121 + * VextSupply3HwHPReq2Valid = HWReq2 controlled 122 + */ 123 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x04), 124 + /* 125 + * VanaSwHPReqValid = disabled 126 + * Vaux1SwHPReqValid = disabled 127 + */ 128 + INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0x00), 129 + /* 130 + * Vaux2SwHPReqValid = disabled 131 + * Vaux3SwHPReqValid = disabled 132 + * VextSupply1SwHPReqValid = disabled 133 + * VextSupply2SwHPReqValid = disabled 134 + * VextSupply3SwHPReqValid = disabled 135 + */ 136 + INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x00), 137 + /* 138 + * SysClkReq2Valid1 = SysClkReq2 controlled 139 + * SysClkReq3Valid1 = disabled 140 + * SysClkReq4Valid1 = SysClkReq4 controlled 141 + * SysClkReq5Valid1 = disabled 142 + * SysClkReq6Valid1 = SysClkReq6 controlled 143 + * SysClkReq7Valid1 = disabled 144 + * SysClkReq8Valid1 = disabled 145 + */ 146 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0x2a), 147 + /* 148 + * SysClkReq2Valid2 = disabled 149 + * SysClkReq3Valid2 = disabled 150 + * SysClkReq4Valid2 = disabled 151 + * SysClkReq5Valid2 = disabled 152 + * SysClkReq6Valid2 = SysClkReq6 controlled 153 + * SysClkReq7Valid2 = disabled 154 + * SysClkReq8Valid2 = disabled 155 + */ 156 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0x20), 157 + /* 158 + * VTVoutEna = disabled 159 + * Vintcore12Ena = disabled 160 + * Vintcore12Sel = 1.25 V 161 + * Vintcore12LP = inactive (HP) 162 + * VTVoutLP = inactive (HP) 163 + */ 164 + INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0x10), 165 + /* 166 + * VaudioEna = disabled 167 + * VdmicEna = disabled 168 + * Vamic1Ena = disabled 169 + * Vamic2Ena = disabled 170 + */ 171 + INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x00), 172 + /* 173 + * Vamic1_dzout = high-Z when Vamic1 is disabled 174 + * Vamic2_dzout = high-Z when Vamic2 is disabled 175 + */ 176 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x00), 177 + /* 178 + * VPll = Hw controlled 179 + * VanaRegu = force off 180 + */ 181 + INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x02), 182 + /* 183 + * VrefDDREna = disabled 184 + * VrefDDRSleepMode = inactive (no pulldown) 185 + */ 186 + INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x00), 187 + /* 188 + * VextSupply1Regu = HW control 189 + * VextSupply2Regu = HW control 190 + * VextSupply3Regu = HW control 191 + * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 192 + * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 193 + */ 194 + INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0x2a), 195 + /* 196 + * Vaux1Regu = force HP 197 + * Vaux2Regu = force off 198 + */ 199 + INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x01), 200 + /* 201 + * Vaux3regu = force off 202 + */ 203 + INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x00), 204 + /* 205 + * Vsmps1 = 1.15V 206 + */ 207 + INIT_REGULATOR_REGISTER(AB8500_VSMPS1SEL1, 0x24), 208 + /* 209 + * Vaux1Sel = 2.5 V 210 + */ 211 + INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x08), 212 + /* 213 + * Vaux2Sel = 2.9 V 214 + */ 215 + INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0d), 216 + /* 217 + * Vaux3Sel = 2.91 V 218 + */ 219 + INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07), 220 + /* 221 + * VextSupply12LP = disabled (no LP) 222 + */ 223 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x00), 224 + /* 225 + * Vaux1Disch = short discharge time 226 + * Vaux2Disch = short discharge time 227 + * Vaux3Disch = short discharge time 228 + * Vintcore12Disch = short discharge time 229 + * VTVoutDisch = short discharge time 230 + * VaudioDisch = short discharge time 231 + */ 232 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0x00), 233 + /* 234 + * VanaDisch = short discharge time 235 + * VdmicPullDownEna = pulldown disabled when Vdmic is disabled 236 + * VdmicDisch = short discharge time 237 + */ 238 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x00), 239 + }; 240 + 241 /* AB8500 regulators */ 242 struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { 243 /* supplies to the display/camera */ ··· 72 .max_uV = 2900000, 73 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 74 REGULATOR_CHANGE_STATUS, 75 + .boot_on = 1, /* must be on for display */ 76 }, 77 .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 78 .consumer_supplies = ab8500_vaux1_consumers,
+1
arch/arm/mach-ux500/board-mop500-regulators.h
··· 17 extern struct ab8500_regulator_reg_init 18 ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; 19 extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; 20 21 #endif
··· 17 extern struct ab8500_regulator_reg_init 18 ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS]; 19 extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; 20 + extern struct regulator_init_data tps61052_regulator; 21 22 #endif
+48 -1
arch/arm/mach-ux500/board-mop500.c
··· 22 #include <linux/mfd/ab8500.h> 23 #include <linux/regulator/ab8500.h> 24 #include <linux/mfd/tc3589x.h> 25 #include <linux/leds-lp5521.h> 26 #include <linux/input.h> 27 #include <linux/gpio_keys.h> ··· 44 #include "board-mop500.h" 45 #include "board-mop500-regulators.h" 46 47 static struct ab8500_platform_data ab8500_platdata = { 48 .irq_base = MOP500_AB8500_IRQ_BASE, 49 .regulator = ab8500_regulators, 50 .num_regulator = ARRAY_SIZE(ab8500_regulators), 51 }; 52 53 static struct resource ab8500_resources[] = { ··· 91 }, 92 .num_resources = 1, 93 .resource = ab8500_resources, 94 }; 95 96 /* ··· 172 .clock_mode = LP5521_CLOCK_EXT, 173 }; 174 175 - static struct i2c_board_info mop500_i2c0_devices[] = { 176 { 177 I2C_BOARD_INFO("tc3589x", 0x42), 178 .irq = NOMADIK_GPIO_TO_IRQ(217), 179 .platform_data = &mop500_tc35892_data, 180 }, 181 }; 182 ··· 450 451 i2c_register_board_info(0, mop500_i2c0_devices, 452 ARRAY_SIZE(mop500_i2c0_devices)); 453 i2c_register_board_info(2, mop500_i2c2_devices, 454 ARRAY_SIZE(mop500_i2c2_devices)); 455 }
··· 22 #include <linux/mfd/ab8500.h> 23 #include <linux/regulator/ab8500.h> 24 #include <linux/mfd/tc3589x.h> 25 + #include <linux/mfd/tps6105x.h> 26 + #include <linux/mfd/ab8500/gpio.h> 27 #include <linux/leds-lp5521.h> 28 #include <linux/input.h> 29 #include <linux/gpio_keys.h> ··· 42 #include "board-mop500.h" 43 #include "board-mop500-regulators.h" 44 45 + static struct ab8500_gpio_platform_data ab8500_gpio_pdata = { 46 + .gpio_base = MOP500_AB8500_GPIO(0), 47 + .irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE, 48 + /* config_reg is the initial configuration of ab8500 pins. 49 + * The pins can be configured as GPIO or alt functions based 50 + * on value present in GpioSel1 to GpioSel6 and AlternatFunction 51 + * register. This is the array of 7 configuration settings. 52 + * One has to compile time decide these settings. Below is the 53 + * explaination of these setting 54 + * GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO 55 + * GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO 56 + * GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO 57 + * GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO 58 + * GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO 59 + * GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO 60 + * AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured 61 + * as GPIO then this register selectes the alternate fucntions 62 + */ 63 + .config_reg = {0x00, 0x1E, 0x80, 0x01, 64 + 0x7A, 0x00, 0x00}, 65 + }; 66 + 67 static struct ab8500_platform_data ab8500_platdata = { 68 .irq_base = MOP500_AB8500_IRQ_BASE, 69 + .regulator_reg_init = ab8500_regulator_reg_init, 70 + .num_regulator_reg_init = ARRAY_SIZE(ab8500_regulator_reg_init), 71 .regulator = ab8500_regulators, 72 .num_regulator = ARRAY_SIZE(ab8500_regulators), 73 + .gpio = &ab8500_gpio_pdata, 74 }; 75 76 static struct resource ab8500_resources[] = { ··· 64 }, 65 .num_resources = 1, 66 .resource = ab8500_resources, 67 + }; 68 + 69 + /* 70 + * TPS61052 71 + */ 72 + 73 + static struct tps6105x_platform_data mop500_tps61052_data = { 74 + .mode = TPS6105X_MODE_VOLTAGE, 75 + .regulator_data = &tps61052_regulator, 76 }; 77 78 /* ··· 136 .clock_mode = LP5521_CLOCK_EXT, 137 }; 138 139 + static struct i2c_board_info __initdata mop500_i2c0_devices[] = { 140 { 141 I2C_BOARD_INFO("tc3589x", 0x42), 142 .irq = NOMADIK_GPIO_TO_IRQ(217), 143 .platform_data = &mop500_tc35892_data, 144 + }, 145 + }; 146 + 147 + /* I2C0 devices only available prior to HREFv60 */ 148 + static struct i2c_board_info __initdata mop500_i2c0_old_devices[] = { 149 + { 150 + I2C_BOARD_INFO("tps61052", 0x33), 151 + .platform_data = &mop500_tps61052_data, 152 }, 153 }; 154 ··· 406 407 i2c_register_board_info(0, mop500_i2c0_devices, 408 ARRAY_SIZE(mop500_i2c0_devices)); 409 + if (!machine_is_hrefv60()) 410 + i2c_register_board_info(0, mop500_i2c0_old_devices, 411 + ARRAY_SIZE(mop500_i2c0_old_devices)); 412 i2c_register_board_info(2, mop500_i2c2_devices, 413 ARRAY_SIZE(mop500_i2c2_devices)); 414 }
+4
arch/arm/mach-ux500/board-mop500.h
··· 27 #define GPIO_BU21013_CS MOP500_EGPIO(13) 28 #define GPIO_SDMMC_EN MOP500_EGPIO(17) 29 #define GPIO_SDMMC_1V8_3V_SEL MOP500_EGPIO(18) 30 31 struct i2c_board_info; 32
··· 27 #define GPIO_BU21013_CS MOP500_EGPIO(13) 28 #define GPIO_SDMMC_EN MOP500_EGPIO(17) 29 #define GPIO_SDMMC_1V8_3V_SEL MOP500_EGPIO(18) 30 + #define MOP500_EGPIO_END MOP500_EGPIO(24) 31 + 32 + /* GPIOs on the AB8500 mixed-signals circuit */ 33 + #define MOP500_AB8500_GPIO(x) (MOP500_EGPIO_END + (x)) 34 35 struct i2c_board_info; 36
+13 -2
arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
··· 35 #define MOP500_STMPE1601_IRQBASE MOP500_EGPIO_IRQ_END 36 #define MOP500_STMPE1601_IRQ(x) (MOP500_STMPE1601_IRQBASE + (x)) 37 38 - #define MOP500_NR_IRQS MOP500_STMPE1601_IRQ(STMPE_NR_INTERNAL_IRQS) 39 40 - #define MOP500_IRQ_END MOP500_NR_IRQS 41 42 #if MOP500_IRQ_END > IRQ_BOARD_END 43 #undef IRQ_BOARD_END
··· 35 #define MOP500_STMPE1601_IRQBASE MOP500_EGPIO_IRQ_END 36 #define MOP500_STMPE1601_IRQ(x) (MOP500_STMPE1601_IRQBASE + (x)) 37 38 + #define MOP500_STMPE1601_IRQ_END \ 39 + MOP500_STMPE1601_IRQ(STMPE_NR_INTERNAL_IRQS) 40 41 + /* AB8500 virtual gpio IRQ */ 42 + #define AB8500_VIR_GPIO_NR_IRQS 16 43 + 44 + #define MOP500_AB8500_VIR_GPIO_IRQ_BASE \ 45 + MOP500_STMPE1601_IRQ_END 46 + #define MOP500_AB8500_VIR_GPIO_IRQ_END \ 47 + (MOP500_AB8500_VIR_GPIO_IRQ_BASE + AB8500_VIR_GPIO_NR_IRQS) 48 + 49 + #define MOP500_NR_IRQS MOP500_AB8500_VIR_GPIO_IRQ_END 50 + 51 + #define MOP500_IRQ_END MOP500_NR_IRQS 52 53 #if MOP500_IRQ_END > IRQ_BOARD_END 54 #undef IRQ_BOARD_END
+5
drivers/gpio/Kconfig
··· 414 This driver provides support for driving the pins in output 415 mode only. Input mode is not supported. 416 417 endif
··· 414 This driver provides support for driving the pins in output 415 mode only. Input mode is not supported. 416 417 + config AB8500_GPIO 418 + bool "ST-Ericsson AB8500 Mixed Signal Circuit gpio functions" 419 + depends on AB8500_CORE 420 + help 421 + Select this to enable the AB8500 IC GPIO driver 422 endif
+1
drivers/gpio/Makefile
··· 42 obj-$(CONFIG_GPIO_SX150X) += sx150x.o 43 obj-$(CONFIG_GPIO_VX855) += vx855_gpio.o 44 obj-$(CONFIG_GPIO_ML_IOH) += ml_ioh_gpio.o
··· 42 obj-$(CONFIG_GPIO_SX150X) += sx150x.o 43 obj-$(CONFIG_GPIO_VX855) += vx855_gpio.o 44 obj-$(CONFIG_GPIO_ML_IOH) += ml_ioh_gpio.o 45 + obj-$(CONFIG_AB8500_GPIO) += ab8500-gpio.o
+522
drivers/gpio/ab8500-gpio.c
···
··· 1 + /* 2 + * Copyright (C) ST-Ericsson SA 2011 3 + * 4 + * Author: BIBEK BASU <bibek.basu@stericsson.com> 5 + * License terms: GNU General Public License (GPL) version 2 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + */ 11 + #include <linux/kernel.h> 12 + #include <linux/types.h> 13 + #include <linux/slab.h> 14 + #include <linux/init.h> 15 + #include <linux/module.h> 16 + #include <linux/err.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/slab.h> 19 + #include <linux/gpio.h> 20 + #include <linux/irq.h> 21 + #include <linux/interrupt.h> 22 + #include <linux/mfd/ab8500.h> 23 + #include <linux/mfd/abx500.h> 24 + #include <linux/mfd/ab8500/gpio.h> 25 + 26 + /* 27 + * GPIO registers offset 28 + * Bank: 0x10 29 + */ 30 + #define AB8500_GPIO_SEL1_REG 0x00 31 + #define AB8500_GPIO_SEL2_REG 0x01 32 + #define AB8500_GPIO_SEL3_REG 0x02 33 + #define AB8500_GPIO_SEL4_REG 0x03 34 + #define AB8500_GPIO_SEL5_REG 0x04 35 + #define AB8500_GPIO_SEL6_REG 0x05 36 + 37 + #define AB8500_GPIO_DIR1_REG 0x10 38 + #define AB8500_GPIO_DIR2_REG 0x11 39 + #define AB8500_GPIO_DIR3_REG 0x12 40 + #define AB8500_GPIO_DIR4_REG 0x13 41 + #define AB8500_GPIO_DIR5_REG 0x14 42 + #define AB8500_GPIO_DIR6_REG 0x15 43 + 44 + #define AB8500_GPIO_OUT1_REG 0x20 45 + #define AB8500_GPIO_OUT2_REG 0x21 46 + #define AB8500_GPIO_OUT3_REG 0x22 47 + #define AB8500_GPIO_OUT4_REG 0x23 48 + #define AB8500_GPIO_OUT5_REG 0x24 49 + #define AB8500_GPIO_OUT6_REG 0x25 50 + 51 + #define AB8500_GPIO_PUD1_REG 0x30 52 + #define AB8500_GPIO_PUD2_REG 0x31 53 + #define AB8500_GPIO_PUD3_REG 0x32 54 + #define AB8500_GPIO_PUD4_REG 0x33 55 + #define AB8500_GPIO_PUD5_REG 0x34 56 + #define AB8500_GPIO_PUD6_REG 0x35 57 + 58 + #define AB8500_GPIO_IN1_REG 0x40 59 + #define AB8500_GPIO_IN2_REG 0x41 60 + #define AB8500_GPIO_IN3_REG 0x42 61 + #define AB8500_GPIO_IN4_REG 0x43 62 + #define AB8500_GPIO_IN5_REG 0x44 63 + #define AB8500_GPIO_IN6_REG 0x45 64 + #define AB8500_GPIO_ALTFUN_REG 0x45 65 + #define ALTFUN_REG_INDEX 6 66 + #define AB8500_NUM_GPIO 42 67 + #define AB8500_NUM_VIR_GPIO_IRQ 16 68 + 69 + enum ab8500_gpio_action { 70 + NONE, 71 + STARTUP, 72 + SHUTDOWN, 73 + MASK, 74 + UNMASK 75 + }; 76 + 77 + struct ab8500_gpio { 78 + struct gpio_chip chip; 79 + struct ab8500 *parent; 80 + struct device *dev; 81 + struct mutex lock; 82 + u32 irq_base; 83 + enum ab8500_gpio_action irq_action; 84 + u16 rising; 85 + u16 falling; 86 + }; 87 + /** 88 + * to_ab8500_gpio() - get the pointer to ab8500_gpio 89 + * @chip: Member of the structure ab8500_gpio 90 + */ 91 + static inline struct ab8500_gpio *to_ab8500_gpio(struct gpio_chip *chip) 92 + { 93 + return container_of(chip, struct ab8500_gpio, chip); 94 + } 95 + 96 + static int ab8500_gpio_set_bits(struct gpio_chip *chip, u8 reg, 97 + unsigned offset, int val) 98 + { 99 + struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); 100 + u8 pos = offset % 8; 101 + int ret; 102 + 103 + reg = reg + (offset / 8); 104 + ret = abx500_mask_and_set_register_interruptible(ab8500_gpio->dev, 105 + AB8500_MISC, reg, 1 << pos, val << pos); 106 + if (ret < 0) 107 + dev_err(ab8500_gpio->dev, "%s write failed\n", __func__); 108 + return ret; 109 + } 110 + /** 111 + * ab8500_gpio_get() - Get the particular GPIO value 112 + * @chip: Gpio device 113 + * @offset: GPIO number to read 114 + */ 115 + static int ab8500_gpio_get(struct gpio_chip *chip, unsigned offset) 116 + { 117 + struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); 118 + u8 mask = 1 << (offset % 8); 119 + u8 reg = AB8500_GPIO_OUT1_REG + (offset / 8); 120 + int ret; 121 + u8 data; 122 + ret = abx500_get_register_interruptible(ab8500_gpio->dev, AB8500_MISC, 123 + reg, &data); 124 + if (ret < 0) { 125 + dev_err(ab8500_gpio->dev, "%s read failed\n", __func__); 126 + return ret; 127 + } 128 + return (data & mask) >> (offset % 8); 129 + } 130 + 131 + static void ab8500_gpio_set(struct gpio_chip *chip, unsigned offset, int val) 132 + { 133 + struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); 134 + int ret; 135 + /* Write the data */ 136 + ret = ab8500_gpio_set_bits(chip, AB8500_GPIO_OUT1_REG, offset, 1); 137 + if (ret < 0) 138 + dev_err(ab8500_gpio->dev, "%s write failed\n", __func__); 139 + } 140 + 141 + static int ab8500_gpio_direction_output(struct gpio_chip *chip, unsigned offset, 142 + int val) 143 + { 144 + int ret; 145 + /* set direction as output */ 146 + ret = ab8500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 1); 147 + if (ret < 0) 148 + return ret; 149 + /* disable pull down */ 150 + ret = ab8500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, offset, 1); 151 + if (ret < 0) 152 + return ret; 153 + /* set the output as 1 or 0 */ 154 + return ab8500_gpio_set_bits(chip, AB8500_GPIO_OUT1_REG, offset, val); 155 + 156 + } 157 + 158 + static int ab8500_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 159 + { 160 + /* set the register as input */ 161 + return ab8500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 0); 162 + } 163 + 164 + static int ab8500_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 165 + { 166 + /* 167 + * Only some GPIOs are interrupt capable, and they are 168 + * organized in discontiguous clusters: 169 + * 170 + * GPIO6 to GPIO13 171 + * GPIO24 and GPIO25 172 + * GPIO36 to GPIO41 173 + */ 174 + static struct ab8500_gpio_irq_cluster { 175 + int start; 176 + int end; 177 + } clusters[] = { 178 + {.start = 6, .end = 13}, 179 + {.start = 24, .end = 25}, 180 + {.start = 36, .end = 41}, 181 + }; 182 + struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); 183 + int base = ab8500_gpio->irq_base; 184 + int i; 185 + 186 + for (i = 0; i < ARRAY_SIZE(clusters); i++) { 187 + struct ab8500_gpio_irq_cluster *cluster = &clusters[i]; 188 + 189 + if (offset >= cluster->start && offset <= cluster->end) 190 + return base + offset - cluster->start; 191 + 192 + /* Advance by the number of gpios in this cluster */ 193 + base += cluster->end - cluster->start + 1; 194 + } 195 + 196 + return -EINVAL; 197 + } 198 + 199 + static struct gpio_chip ab8500gpio_chip = { 200 + .label = "ab8500_gpio", 201 + .owner = THIS_MODULE, 202 + .direction_input = ab8500_gpio_direction_input, 203 + .get = ab8500_gpio_get, 204 + .direction_output = ab8500_gpio_direction_output, 205 + .set = ab8500_gpio_set, 206 + .to_irq = ab8500_gpio_to_irq, 207 + }; 208 + 209 + static unsigned int irq_to_rising(unsigned int irq) 210 + { 211 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 212 + int offset = irq - ab8500_gpio->irq_base; 213 + int new_irq = offset + AB8500_INT_GPIO6R 214 + + ab8500_gpio->parent->irq_base; 215 + return new_irq; 216 + } 217 + 218 + static unsigned int irq_to_falling(unsigned int irq) 219 + { 220 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 221 + int offset = irq - ab8500_gpio->irq_base; 222 + int new_irq = offset + AB8500_INT_GPIO6F 223 + + ab8500_gpio->parent->irq_base; 224 + return new_irq; 225 + 226 + } 227 + 228 + static unsigned int rising_to_irq(unsigned int irq, void *dev) 229 + { 230 + struct ab8500_gpio *ab8500_gpio = dev; 231 + int offset = irq - AB8500_INT_GPIO6R 232 + - ab8500_gpio->parent->irq_base ; 233 + int new_irq = offset + ab8500_gpio->irq_base; 234 + return new_irq; 235 + } 236 + 237 + static unsigned int falling_to_irq(unsigned int irq, void *dev) 238 + { 239 + struct ab8500_gpio *ab8500_gpio = dev; 240 + int offset = irq - AB8500_INT_GPIO6F 241 + - ab8500_gpio->parent->irq_base ; 242 + int new_irq = offset + ab8500_gpio->irq_base; 243 + return new_irq; 244 + 245 + } 246 + 247 + /* 248 + * IRQ handler 249 + */ 250 + 251 + static irqreturn_t handle_rising(int irq, void *dev) 252 + { 253 + 254 + handle_nested_irq(rising_to_irq(irq , dev)); 255 + return IRQ_HANDLED; 256 + } 257 + 258 + static irqreturn_t handle_falling(int irq, void *dev) 259 + { 260 + 261 + handle_nested_irq(falling_to_irq(irq, dev)); 262 + return IRQ_HANDLED; 263 + } 264 + 265 + static void ab8500_gpio_irq_lock(unsigned int irq) 266 + { 267 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 268 + mutex_lock(&ab8500_gpio->lock); 269 + } 270 + 271 + static void ab8500_gpio_irq_sync_unlock(unsigned int irq) 272 + { 273 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 274 + int offset = irq - ab8500_gpio->irq_base; 275 + bool rising = ab8500_gpio->rising & BIT(offset); 276 + bool falling = ab8500_gpio->falling & BIT(offset); 277 + int ret; 278 + 279 + switch (ab8500_gpio->irq_action) { 280 + case STARTUP: 281 + if (rising) 282 + ret = request_threaded_irq(irq_to_rising(irq), 283 + NULL, handle_rising, 284 + IRQF_TRIGGER_RISING, 285 + "ab8500-gpio-r", ab8500_gpio); 286 + if (falling) 287 + ret = request_threaded_irq(irq_to_falling(irq), 288 + NULL, handle_falling, 289 + IRQF_TRIGGER_FALLING, 290 + "ab8500-gpio-f", ab8500_gpio); 291 + break; 292 + case SHUTDOWN: 293 + if (rising) 294 + free_irq(irq_to_rising(irq), ab8500_gpio); 295 + if (falling) 296 + free_irq(irq_to_falling(irq), ab8500_gpio); 297 + break; 298 + case MASK: 299 + if (rising) 300 + disable_irq(irq_to_rising(irq)); 301 + if (falling) 302 + disable_irq(irq_to_falling(irq)); 303 + break; 304 + case UNMASK: 305 + if (rising) 306 + enable_irq(irq_to_rising(irq)); 307 + if (falling) 308 + enable_irq(irq_to_falling(irq)); 309 + break; 310 + case NONE: 311 + break; 312 + } 313 + ab8500_gpio->irq_action = NONE; 314 + ab8500_gpio->rising &= ~(BIT(offset)); 315 + ab8500_gpio->falling &= ~(BIT(offset)); 316 + mutex_unlock(&ab8500_gpio->lock); 317 + } 318 + 319 + 320 + static void ab8500_gpio_irq_mask(unsigned int irq) 321 + { 322 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 323 + ab8500_gpio->irq_action = MASK; 324 + } 325 + 326 + static void ab8500_gpio_irq_unmask(unsigned int irq) 327 + { 328 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 329 + ab8500_gpio->irq_action = UNMASK; 330 + } 331 + 332 + static int ab8500_gpio_irq_set_type(unsigned int irq, unsigned int type) 333 + { 334 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 335 + int offset = irq - ab8500_gpio->irq_base; 336 + 337 + if (type == IRQ_TYPE_EDGE_BOTH) { 338 + ab8500_gpio->rising = BIT(offset); 339 + ab8500_gpio->falling = BIT(offset); 340 + } else if (type == IRQ_TYPE_EDGE_RISING) { 341 + ab8500_gpio->rising = BIT(offset); 342 + } else { 343 + ab8500_gpio->falling = BIT(offset); 344 + } 345 + return 0; 346 + } 347 + 348 + unsigned int ab8500_gpio_irq_startup(unsigned int irq) 349 + { 350 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 351 + ab8500_gpio->irq_action = STARTUP; 352 + return 0; 353 + } 354 + 355 + void ab8500_gpio_irq_shutdown(unsigned int irq) 356 + { 357 + struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); 358 + ab8500_gpio->irq_action = SHUTDOWN; 359 + } 360 + 361 + static struct irq_chip ab8500_gpio_irq_chip = { 362 + .name = "ab8500-gpio", 363 + .startup = ab8500_gpio_irq_startup, 364 + .shutdown = ab8500_gpio_irq_shutdown, 365 + .bus_lock = ab8500_gpio_irq_lock, 366 + .bus_sync_unlock = ab8500_gpio_irq_sync_unlock, 367 + .mask = ab8500_gpio_irq_mask, 368 + .unmask = ab8500_gpio_irq_unmask, 369 + .set_type = ab8500_gpio_irq_set_type, 370 + }; 371 + 372 + static int ab8500_gpio_irq_init(struct ab8500_gpio *ab8500_gpio) 373 + { 374 + u32 base = ab8500_gpio->irq_base; 375 + int irq; 376 + 377 + for (irq = base; irq < base + AB8500_NUM_VIR_GPIO_IRQ ; irq++) { 378 + set_irq_chip_data(irq, ab8500_gpio); 379 + set_irq_chip_and_handler(irq, &ab8500_gpio_irq_chip, 380 + handle_simple_irq); 381 + set_irq_nested_thread(irq, 1); 382 + #ifdef CONFIG_ARM 383 + set_irq_flags(irq, IRQF_VALID); 384 + #else 385 + set_irq_noprobe(irq); 386 + #endif 387 + } 388 + 389 + return 0; 390 + } 391 + 392 + static void ab8500_gpio_irq_remove(struct ab8500_gpio *ab8500_gpio) 393 + { 394 + int base = ab8500_gpio->irq_base; 395 + int irq; 396 + 397 + for (irq = base; irq < base + AB8500_NUM_VIR_GPIO_IRQ; irq++) { 398 + #ifdef CONFIG_ARM 399 + set_irq_flags(irq, 0); 400 + #endif 401 + set_irq_chip_and_handler(irq, NULL, NULL); 402 + set_irq_chip_data(irq, NULL); 403 + } 404 + } 405 + 406 + static int __devinit ab8500_gpio_probe(struct platform_device *pdev) 407 + { 408 + struct ab8500_platform_data *ab8500_pdata = 409 + dev_get_platdata(pdev->dev.parent); 410 + struct ab8500_gpio_platform_data *pdata; 411 + struct ab8500_gpio *ab8500_gpio; 412 + int ret; 413 + int i; 414 + 415 + pdata = ab8500_pdata->gpio; 416 + if (!pdata) { 417 + dev_err(&pdev->dev, "gpio platform data missing\n"); 418 + return -ENODEV; 419 + } 420 + 421 + ab8500_gpio = kzalloc(sizeof(struct ab8500_gpio), GFP_KERNEL); 422 + if (ab8500_gpio == NULL) { 423 + dev_err(&pdev->dev, "failed to allocate memory\n"); 424 + return -ENOMEM; 425 + } 426 + ab8500_gpio->dev = &pdev->dev; 427 + ab8500_gpio->parent = dev_get_drvdata(pdev->dev.parent); 428 + ab8500_gpio->chip = ab8500gpio_chip; 429 + ab8500_gpio->chip.ngpio = AB8500_NUM_GPIO; 430 + ab8500_gpio->chip.dev = &pdev->dev; 431 + ab8500_gpio->chip.base = pdata->gpio_base; 432 + ab8500_gpio->irq_base = pdata->irq_base; 433 + /* initialize the lock */ 434 + mutex_init(&ab8500_gpio->lock); 435 + /* 436 + * AB8500 core will handle and clear the IRQ 437 + * configre GPIO based on config-reg value. 438 + * These values are for selecting the PINs as 439 + * GPIO or alternate function 440 + */ 441 + for (i = AB8500_GPIO_SEL1_REG; i <= AB8500_GPIO_SEL6_REG; i++) { 442 + ret = abx500_set_register_interruptible(ab8500_gpio->dev, 443 + AB8500_MISC, i, 444 + pdata->config_reg[i]); 445 + if (ret < 0) 446 + goto out_free; 447 + } 448 + ret = abx500_set_register_interruptible(ab8500_gpio->dev, AB8500_MISC, 449 + AB8500_GPIO_ALTFUN_REG, 450 + pdata->config_reg[ALTFUN_REG_INDEX]); 451 + if (ret < 0) 452 + goto out_free; 453 + 454 + ret = ab8500_gpio_irq_init(ab8500_gpio); 455 + if (ret) 456 + goto out_free; 457 + ret = gpiochip_add(&ab8500_gpio->chip); 458 + if (ret) { 459 + dev_err(&pdev->dev, "unable to add gpiochip: %d\n", 460 + ret); 461 + goto out_rem_irq; 462 + } 463 + platform_set_drvdata(pdev, ab8500_gpio); 464 + return 0; 465 + 466 + out_rem_irq: 467 + ab8500_gpio_irq_remove(ab8500_gpio); 468 + out_free: 469 + mutex_destroy(&ab8500_gpio->lock); 470 + kfree(ab8500_gpio); 471 + return ret; 472 + } 473 + 474 + /* 475 + * ab8500_gpio_remove() - remove Ab8500-gpio driver 476 + * @pdev : Platform device registered 477 + */ 478 + static int __devexit ab8500_gpio_remove(struct platform_device *pdev) 479 + { 480 + struct ab8500_gpio *ab8500_gpio = platform_get_drvdata(pdev); 481 + int ret; 482 + 483 + ret = gpiochip_remove(&ab8500_gpio->chip); 484 + if (ret < 0) { 485 + dev_err(ab8500_gpio->dev, "unable to remove gpiochip:\ 486 + %d\n", ret); 487 + return ret; 488 + } 489 + 490 + platform_set_drvdata(pdev, NULL); 491 + mutex_destroy(&ab8500_gpio->lock); 492 + kfree(ab8500_gpio); 493 + 494 + return 0; 495 + } 496 + 497 + static struct platform_driver ab8500_gpio_driver = { 498 + .driver = { 499 + .name = "ab8500-gpio", 500 + .owner = THIS_MODULE, 501 + }, 502 + .probe = ab8500_gpio_probe, 503 + .remove = __devexit_p(ab8500_gpio_remove), 504 + }; 505 + 506 + static int __init ab8500_gpio_init(void) 507 + { 508 + return platform_driver_register(&ab8500_gpio_driver); 509 + } 510 + arch_initcall(ab8500_gpio_init); 511 + 512 + static void __exit ab8500_gpio_exit(void) 513 + { 514 + platform_driver_unregister(&ab8500_gpio_driver); 515 + } 516 + module_exit(ab8500_gpio_exit); 517 + 518 + MODULE_AUTHOR("BIBEK BASU <bibek.basu@stericsson.com>"); 519 + MODULE_DESCRIPTION("Driver allows to use AB8500 unused pins\ 520 + to be used as GPIO"); 521 + MODULE_ALIAS("AB8500 GPIO driver"); 522 + MODULE_LICENSE("GPL v2");
+14
drivers/mfd/ab8500-core.c
··· 362 } 363 } 364 365 static struct resource ab8500_gpadc_resources[] = { 366 { 367 .name = "HW_CONV_END", ··· 603 }, 604 { 605 .name = "ab8500-regulator", 606 }, 607 { 608 .name = "ab8500-gpadc",
··· 362 } 363 } 364 365 + static struct resource ab8500_gpio_resources[] = { 366 + { 367 + .name = "GPIO_INT6", 368 + .start = AB8500_INT_GPIO6R, 369 + .end = AB8500_INT_GPIO41F, 370 + .flags = IORESOURCE_IRQ, 371 + } 372 + }; 373 + 374 static struct resource ab8500_gpadc_resources[] = { 375 { 376 .name = "HW_CONV_END", ··· 594 }, 595 { 596 .name = "ab8500-regulator", 597 + }, 598 + { 599 + .name = "ab8500-gpio", 600 + .num_resources = ARRAY_SIZE(ab8500_gpio_resources), 601 + .resources = ab8500_gpio_resources, 602 }, 603 { 604 .name = "ab8500-gpadc",
+1 -1
drivers/mfd/ab8500-i2c.c
··· 97 { 98 platform_driver_unregister(&ab8500_i2c_driver); 99 } 100 - subsys_initcall(ab8500_i2c_init); 101 module_exit(ab8500_i2c_exit); 102 103 MODULE_AUTHOR("Mattias WALLIN <mattias.wallin@stericsson.com");
··· 97 { 98 platform_driver_unregister(&ab8500_i2c_driver); 99 } 100 + arch_initcall(ab8500_i2c_init); 101 module_exit(ab8500_i2c_exit); 102 103 MODULE_AUTHOR("Mattias WALLIN <mattias.wallin@stericsson.com");
+41
include/linux/mfd/ab8500.h
··· 74 #define AB8500_INT_ACC_DETECT_21DB_F 37 75 #define AB8500_INT_ACC_DETECT_21DB_R 38 76 #define AB8500_INT_GP_SW_ADC_CONV_END 39 77 #define AB8500_INT_ADP_SOURCE_ERROR 72 78 #define AB8500_INT_ADP_SINK_ERROR 73 79 #define AB8500_INT_ADP_PROBE_PLUG 74 ··· 180 181 struct regulator_reg_init; 182 struct regulator_init_data; 183 184 /** 185 * struct ab8500_platform_data - AB8500 platform data ··· 198 struct ab8500_regulator_reg_init *regulator_reg_init; 199 int num_regulator; 200 struct regulator_init_data *regulator; 201 }; 202 203 extern int __devinit ab8500_init(struct ab8500 *ab8500);
··· 74 #define AB8500_INT_ACC_DETECT_21DB_F 37 75 #define AB8500_INT_ACC_DETECT_21DB_R 38 76 #define AB8500_INT_GP_SW_ADC_CONV_END 39 77 + #define AB8500_INT_ACC_DETECT_1DB_F 33 78 + #define AB8500_INT_ACC_DETECT_1DB_R 34 79 + #define AB8500_INT_ACC_DETECT_22DB_F 35 80 + #define AB8500_INT_ACC_DETECT_22DB_R 36 81 + #define AB8500_INT_ACC_DETECT_21DB_F 37 82 + #define AB8500_INT_ACC_DETECT_21DB_R 38 83 + #define AB8500_INT_GP_SW_ADC_CONV_END 39 84 + #define AB8500_INT_GPIO6R 40 85 + #define AB8500_INT_GPIO7R 41 86 + #define AB8500_INT_GPIO8R 42 87 + #define AB8500_INT_GPIO9R 43 88 + #define AB8500_INT_GPIO10R 44 89 + #define AB8500_INT_GPIO11R 45 90 + #define AB8500_INT_GPIO12R 46 91 + #define AB8500_INT_GPIO13R 47 92 + #define AB8500_INT_GPIO24R 48 93 + #define AB8500_INT_GPIO25R 49 94 + #define AB8500_INT_GPIO36R 50 95 + #define AB8500_INT_GPIO37R 51 96 + #define AB8500_INT_GPIO38R 52 97 + #define AB8500_INT_GPIO39R 53 98 + #define AB8500_INT_GPIO40R 54 99 + #define AB8500_INT_GPIO41R 55 100 + #define AB8500_INT_GPIO6F 56 101 + #define AB8500_INT_GPIO7F 57 102 + #define AB8500_INT_GPIO8F 58 103 + #define AB8500_INT_GPIO9F 59 104 + #define AB8500_INT_GPIO10F 60 105 + #define AB8500_INT_GPIO11F 61 106 + #define AB8500_INT_GPIO12F 62 107 + #define AB8500_INT_GPIO13F 63 108 + #define AB8500_INT_GPIO24F 64 109 + #define AB8500_INT_GPIO25F 65 110 + #define AB8500_INT_GPIO36F 66 111 + #define AB8500_INT_GPIO37F 67 112 + #define AB8500_INT_GPIO38F 68 113 + #define AB8500_INT_GPIO39F 69 114 + #define AB8500_INT_GPIO40F 70 115 + #define AB8500_INT_GPIO41F 71 116 #define AB8500_INT_ADP_SOURCE_ERROR 72 117 #define AB8500_INT_ADP_SINK_ERROR 73 118 #define AB8500_INT_ADP_PROBE_PLUG 74 ··· 141 142 struct regulator_reg_init; 143 struct regulator_init_data; 144 + struct ab8500_gpio_platform_data; 145 146 /** 147 * struct ab8500_platform_data - AB8500 platform data ··· 158 struct ab8500_regulator_reg_init *regulator_reg_init; 159 int num_regulator; 160 struct regulator_init_data *regulator; 161 + struct ab8500_gpio_platform_data *gpio; 162 }; 163 164 extern int __devinit ab8500_init(struct ab8500 *ab8500);
+21
include/linux/mfd/ab8500/gpio.h
···
··· 1 + /* 2 + * Copyright ST-Ericsson 2010. 3 + * 4 + * Author: Bibek Basu <bibek.basu@stericsson.com> 5 + * Licensed under GPLv2. 6 + */ 7 + 8 + #ifndef _AB8500_GPIO_H 9 + #define _AB8500_GPIO_H 10 + 11 + /* 12 + * Platform data to register a block: only the initial gpio/irq number. 13 + */ 14 + 15 + struct ab8500_gpio_platform_data { 16 + int gpio_base; 17 + u32 irq_base; 18 + u8 config_reg[7]; 19 + }; 20 + 21 + #endif /* _AB8500_GPIO_H */