diff --git a/[refs] b/[refs] index 085ec392bd95..6b584d67f70e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 86caa905f333ddfb609c55c60e2679d764652181 +refs/heads/master: 1a8f85d402a2bf3b86c08c696a0adf36656f770a diff --git a/trunk/CREDITS b/trunk/CREDITS index 2346b09ca8bb..d8fe12a9421f 100644 --- a/trunk/CREDITS +++ b/trunk/CREDITS @@ -1823,11 +1823,6 @@ S: Kattreinstr 38 S: D-64295 S: Germany -N: Avi Kivity -E: avi.kivity@gmail.com -D: Kernel-based Virtual Machine (KVM) -S: Ra'annana, Israel - N: Andi Kleen E: andi@firstfloor.org U: http://www.halobates.de diff --git a/trunk/Documentation/devicetree/bindings/net/mdio-gpio.txt b/trunk/Documentation/devicetree/bindings/net/mdio-gpio.txt index c79bab025369..bc9549529014 100644 --- a/trunk/Documentation/devicetree/bindings/net/mdio-gpio.txt +++ b/trunk/Documentation/devicetree/bindings/net/mdio-gpio.txt @@ -8,16 +8,9 @@ gpios property as described in section VIII.1 in the following order: MDC, MDIO. -Note: Each gpio-mdio bus should have an alias correctly numbered in "aliases" -node. - Example: -aliases { - mdio-gpio0 = <&mdio0>; -}; - -mdio0: mdio { +mdio { compatible = "virtual,mdio-gpio"; #address-cells = <1>; #size-cells = <0>; diff --git a/trunk/Documentation/devicetree/bindings/regulator/gpio-regulator.txt b/trunk/Documentation/devicetree/bindings/regulator/gpio-regulator.txt deleted file mode 100644 index 63c659800c03..000000000000 --- a/trunk/Documentation/devicetree/bindings/regulator/gpio-regulator.txt +++ /dev/null @@ -1,37 +0,0 @@ -GPIO controlled regulators - -Required properties: -- compatible : Must be "regulator-gpio". -- states : Selection of available voltages and GPIO configs. - if there are no states, then use a fixed regulator - -Optional properties: -- enable-gpio : GPIO to use to enable/disable the regulator. -- gpios : GPIO group used to control voltage. -- startup-delay-us : Startup time in microseconds. -- enable-active-high : Polarity of GPIO is active high (default is low). - -Any property defined as part of the core regulator binding defined in -regulator.txt can also be used. - -Example: - - mmciv: gpio-regulator { - compatible = "regulator-gpio"; - - regulator-name = "mmci-gpio-supply"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <2600000>; - regulator-boot-on; - - enable-gpio = <&gpio0 23 0x4>; - gpios = <&gpio0 24 0x4 - &gpio0 25 0x4>; - states = <1800000 0x3 - 2200000 0x2 - 2600000 0x1 - 2900000 0x0>; - - startup-delay-us = <100000>; - enable-active-high; - }; diff --git a/trunk/Documentation/devicetree/bindings/regulator/max8925-regulator.txt b/trunk/Documentation/devicetree/bindings/regulator/max8925-regulator.txt deleted file mode 100644 index 0057695aae8f..000000000000 --- a/trunk/Documentation/devicetree/bindings/regulator/max8925-regulator.txt +++ /dev/null @@ -1,40 +0,0 @@ -Max8925 Voltage regulators - -Required nodes: --nodes: - - SDV1 for SDV SDV1 - - SDV2 for SDV SDV2 - - SDV3 for SDV SDV3 - - LDO1 for LDO LDO1 - - LDO2 for LDO LDO2 - - LDO3 for LDO LDO3 - - LDO4 for LDO LDO4 - - LDO5 for LDO LDO5 - - LDO6 for LDO LDO6 - - LDO7 for LDO LDO7 - - LDO8 for LDO LDO8 - - LDO9 for LDO LDO9 - - LDO10 for LDO LDO10 - - LDO11 for LDO LDO11 - - LDO12 for LDO LDO12 - - LDO13 for LDO LDO13 - - LDO14 for LDO LDO14 - - LDO15 for LDO LDO15 - - LDO16 for LDO LDO16 - - LDO17 for LDO LDO17 - - LDO18 for LDO LDO18 - - LDO19 for LDO LDO19 - - LDO20 for LDO LDO20 - -Optional properties: -- Any optional property defined in bindings/regulator/regulator.txt - -Example: - - SDV1 { - regulator-min-microvolt = <637500>; - regulator-max-microvolt = <1425000>; - regulator-boot-on; - regulator-always-on; - }; - diff --git a/trunk/Documentation/devicetree/bindings/regulator/max8997-regulator.txt b/trunk/Documentation/devicetree/bindings/regulator/max8997-regulator.txt deleted file mode 100644 index 9fd69a18b0ba..000000000000 --- a/trunk/Documentation/devicetree/bindings/regulator/max8997-regulator.txt +++ /dev/null @@ -1,146 +0,0 @@ -* Maxim MAX8997 Voltage and Current Regulator - -The Maxim MAX8997 is a multi-function device which includes volatage and -current regulators, rtc, charger controller and other sub-blocks. It is -interfaced to the host controller using a i2c interface. Each sub-block is -addressed by the host system using different i2c slave address. This document -describes the bindings for 'pmic' sub-block of max8997. - -Required properties: -- compatible: Should be "maxim,max8997-pmic". -- reg: Specifies the i2c slave address of the pmic block. It should be 0x66. - -- max8997,pmic-buck1-dvs-voltage: A set of 8 voltage values in micro-volt (uV) - units for buck1 when changing voltage using gpio dvs. Refer to [1] below - for additional information. - -- max8997,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV) - units for buck2 when changing voltage using gpio dvs. Refer to [1] below - for additional information. - -- max8997,pmic-buck5-dvs-voltage: A set of 8 voltage values in micro-volt (uV) - units for buck5 when changing voltage using gpio dvs. Refer to [1] below - for additional information. - -[1] If none of the 'max8997,pmic-buck[1/2/5]-uses-gpio-dvs' optional - property is specified, the 'max8997,pmic-buck[1/2/5]-dvs-voltage' - property should specify atleast one voltage level (which would be a - safe operating voltage). - - If either of the 'max8997,pmic-buck[1/2/5]-uses-gpio-dvs' optional - property is specified, then all the eigth voltage values for the - 'max8997,pmic-buck[1/2/5]-dvs-voltage' should be specified. - -Optional properties: -- interrupt-parent: Specifies the phandle of the interrupt controller to which - the interrupts from max8997 are delivered to. -- interrupts: Interrupt specifiers for two interrupt sources. - - First interrupt specifier is for 'irq1' interrupt. - - Second interrupt specifier is for 'alert' interrupt. -- max8997,pmic-buck1-uses-gpio-dvs: 'buck1' can be controlled by gpio dvs. -- max8997,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs. -- max8997,pmic-buck5-uses-gpio-dvs: 'buck5' can be controlled by gpio dvs. - -Additional properties required if either of the optional properties are used: -- max8997,pmic-ignore-gpiodvs-side-effect: When GPIO-DVS mode is used for - multiple bucks, changing the voltage value of one of the bucks may affect - that of another buck, which is the side effect of the change (set_voltage). - Use this property to ignore such side effects and change the voltage. - -- max8997,pmic-buck125-default-dvs-idx: Default voltage setting selected from - the possible 8 options selectable by the dvs gpios. The value of this - property should be between 0 and 7. If not specified or if out of range, the - default value of this property is set to 0. - -- max8997,pmic-buck125-dvs-gpios: GPIO specifiers for three host gpio's used - for dvs. The format of the gpio specifier depends in the gpio controller. - -Regulators: The regulators of max8997 that have to be instantiated should be -included in a sub-node named 'regulators'. Regulator nodes included in this -sub-node should be of the format as listed below. - - regulator_name { - standard regulator bindings here - }; - -The following are the names of the regulators that the max8997 pmic block -supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number -as per the datasheet of max8997. - - - LDOn - - valid values for n are 1 to 18 and 21 - - Example: LDO0, LD01, LDO2, LDO21 - - BUCKn - - valid values for n are 1 to 7. - - Example: BUCK1, BUCK2, BUCK3, BUCK7 - - - ENVICHG: Battery Charging Current Monitor Output. This is a fixed - voltage type regulator - - - ESAFEOUT1: (ldo19) - - ESAFEOUT2: (ld020) - - - CHARGER_CV: main battery charger voltage control - - CHARGER: main battery charger current control - - CHARGER_TOPOFF: end of charge current threshold level - -The bindings inside the regulator nodes use the standard regulator bindings -which are documented elsewhere. - -Example: - - max8997_pmic@66 { - compatible = "maxim,max8997-pmic"; - interrupt-parent = <&wakeup_eint>; - reg = <0x66>; - interrupts = <4 0>, <3 0>; - - max8997,pmic-buck1-uses-gpio-dvs; - max8997,pmic-buck2-uses-gpio-dvs; - max8997,pmic-buck5-uses-gpio-dvs; - - max8997,pmic-ignore-gpiodvs-side-effect; - max8997,pmic-buck125-default-dvs-idx = <0>; - - max8997,pmic-buck125-dvs-gpios = <&gpx0 0 1 0 0>, /* SET1 */ - <&gpx0 1 1 0 0>, /* SET2 */ - <&gpx0 2 1 0 0>; /* SET3 */ - - max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>, - <1250000>, <1200000>, - <1150000>, <1100000>, - <1000000>, <950000>; - - max8997,pmic-buck2-dvs-voltage = <1100000>, <1100000>, - <1100000>, <1100000>, - <1000000>, <1000000>, - <1000000>, <1000000>; - - max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>, - <1200000>, <1200000>, - <1200000>, <1200000>, - <1200000>, <1200000>; - - regulators { - ldo1_reg: LDO1 { - regulator-name = "VDD_ABB_3.3V"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - }; - - ldo2_reg: LDO2 { - regulator-name = "VDD_ALIVE_1.1V"; - regulator-min-microvolt = <1100000>; - regulator-max-microvolt = <1100000>; - regulator-always-on; - }; - - buck1_reg: BUCK1 { - regulator-name = "VDD_ARM_1.2V"; - regulator-min-microvolt = <950000>; - regulator-max-microvolt = <1350000>; - regulator-always-on; - regulator-boot-on; - }; - }; - }; diff --git a/trunk/Documentation/devicetree/bindings/regulator/vexpress.txt b/trunk/Documentation/devicetree/bindings/regulator/vexpress.txt deleted file mode 100644 index d775f72487aa..000000000000 --- a/trunk/Documentation/devicetree/bindings/regulator/vexpress.txt +++ /dev/null @@ -1,32 +0,0 @@ -Versatile Express voltage regulators ------------------------------------- - -Requires node properties: -- "compatible" value: "arm,vexpress-volt" -- "arm,vexpress-sysreg,func" when controlled via vexpress-sysreg - (see Documentation/devicetree/bindings/arm/vexpress-sysreg.txt - for more details) - -Required regulator properties: -- "regulator-name" -- "regulator-always-on" - -Optional regulator properties: -- "regulator-min-microvolt" -- "regulator-max-microvolt" - -See Documentation/devicetree/bindings/regulator/regulator.txt -for more details about the regulator properties. - -When no "regulator-[min|max]-microvolt" properties are defined, -the device is treated as fixed (or rather "read-only") regulator. - -Example: - volt@0 { - compatible = "arm,vexpress-volt"; - arm,vexpress-sysreg,func = <2 0>; - regulator-name = "Cores"; - regulator-min-microvolt = <800000>; - regulator-max-microvolt = <1050000>; - regulator-always-on; - }; diff --git a/trunk/Documentation/networking/vxlan.txt b/trunk/Documentation/networking/vxlan.txt index 6d993510f091..5b34b762d7d5 100644 --- a/trunk/Documentation/networking/vxlan.txt +++ b/trunk/Documentation/networking/vxlan.txt @@ -32,7 +32,7 @@ no entry is in the forwarding table. # ip link delete vxlan0 3. Show vxlan info - # ip -d link show vxlan0 + # ip -d show vxlan0 It is possible to create, destroy and display the vxlan forwarding table using the new bridge command. @@ -41,7 +41,7 @@ forwarding table using the new bridge command. # bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0 2. Delete forwarding table entry - # bridge fdb delete 00:17:42:8a:b4:05 dev vxlan0 + # bridge fdb delete 00:17:42:8a:b4:05 3. Show forwarding table # bridge fdb show dev vxlan0 diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 9386a63ea8f6..bb0b27db673f 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -526,17 +526,17 @@ F: drivers/video/geode/ F: arch/x86/include/asm/geode.h AMD IOMMU (AMD-VI) -M: Joerg Roedel +M: Joerg Roedel L: iommu@lists.linux-foundation.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git -S: Maintained +S: Supported F: drivers/iommu/amd_iommu*.[ch] F: include/linux/amd-iommu.h AMD MICROCODE UPDATE SUPPORT -M: Andreas Herrmann +M: Andreas Herrmann L: amd64-microcode@amd64.org -S: Maintained +S: Supported F: arch/x86/kernel/microcode_amd.c AMS (Apple Motion Sensor) DRIVER @@ -841,14 +841,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kristoffer/linux-hpc.git F: arch/arm/mach-sa1100/jornada720.c F: arch/arm/mach-sa1100/include/mach/jornada720.h -ARM/IGEP MACHINE SUPPORT -M: Enric Balletbo i Serra -M: Javier Martinez Canillas -L: linux-omap@vger.kernel.org -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-omap2/board-igep0020.c - ARM/INCOME PXA270 SUPPORT M: Marek Vasut L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) @@ -2716,10 +2708,10 @@ F: include/linux/edac.h EDAC-AMD64 M: Doug Thompson -M: Borislav Petkov +M: Borislav Petkov L: linux-edac@vger.kernel.org W: bluesmoke.sourceforge.net -S: Maintained +S: Supported F: drivers/edac/amd64_edac* EDAC-E752X @@ -3761,7 +3753,7 @@ S: Maintained F: drivers/platform/x86/ideapad-laptop.c IDE/ATAPI DRIVERS -M: Borislav Petkov +M: Borislav Petkov L: linux-ide@vger.kernel.org S: Maintained F: Documentation/cdrom/ide-cd @@ -4288,8 +4280,8 @@ F: include/linux/lockd/ F: include/linux/sunrpc/ KERNEL VIRTUAL MACHINE (KVM) +M: Avi Kivity M: Marcelo Tosatti -M: Gleb Natapov L: kvm@vger.kernel.org W: http://kvm.qumranet.com S: Supported @@ -5421,7 +5413,7 @@ S: Maintained F: sound/drivers/opl4/ OPROFILE -M: Robert Richter +M: Robert Richter L: oprofile-list@lists.sf.net S: Maintained F: arch/*/include/asm/oprofile*.h @@ -8206,7 +8198,7 @@ F: drivers/platform/x86 X86 MCE INFRASTRUCTURE M: Tony Luck -M: Borislav Petkov +M: Borislav Petkov L: linux-edac@vger.kernel.org S: Maintained F: arch/x86/kernel/cpu/mcheck/* diff --git a/trunk/Makefile b/trunk/Makefile index 3d2fc460b22f..9f6ca124e890 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 7 SUBLEVEL = 0 -EXTRAVERSION = -rc7 +EXTRAVERSION = -rc6 NAME = Terrified Chipmunk # *DOCUMENTATION* diff --git a/trunk/arch/alpha/kernel/osf_sys.c b/trunk/arch/alpha/kernel/osf_sys.c index 14db93e4c8a8..1e6956a90608 100644 --- a/trunk/arch/alpha/kernel/osf_sys.c +++ b/trunk/arch/alpha/kernel/osf_sys.c @@ -445,7 +445,7 @@ struct procfs_args { * unhappy with OSF UFS. [CHECKME] */ static int -osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags) +osf_ufs_mount(char *dirname, struct ufs_args __user *args, int flags) { int retval; struct cdfs_args tmp; @@ -465,7 +465,7 @@ osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags) } static int -osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags) +osf_cdfs_mount(char *dirname, struct cdfs_args __user *args, int flags) { int retval; struct cdfs_args tmp; @@ -485,7 +485,7 @@ osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags) } static int -osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int flags) +osf_procfs_mount(char *dirname, struct procfs_args __user *args, int flags) { struct procfs_args tmp; diff --git a/trunk/arch/arm/mach-davinci/dm644x.c b/trunk/arch/arm/mach-davinci/dm644x.c index 14e9947bad6e..cd0c8b1e1ecf 100644 --- a/trunk/arch/arm/mach-davinci/dm644x.c +++ b/trunk/arch/arm/mach-davinci/dm644x.c @@ -713,7 +713,8 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type, break; case VPBE_ENC_CUSTOM_TIMINGS: if (pclock <= 27000000) { - v |= DM644X_VPSS_DACCLKEN; + v |= DM644X_VPSS_MUXSEL_PLL2_MODE | + DM644X_VPSS_DACCLKEN; writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); } else { /* diff --git a/trunk/arch/arm/mach-exynos/dma.c b/trunk/arch/arm/mach-exynos/dma.c index 87e07d6fc615..21d568b3b149 100644 --- a/trunk/arch/arm/mach-exynos/dma.c +++ b/trunk/arch/arm/mach-exynos/dma.c @@ -275,9 +275,6 @@ static int __init exynos_dma_init(void) exynos_pdma1_pdata.nr_valid_peri = ARRAY_SIZE(exynos4210_pdma1_peri); exynos_pdma1_pdata.peri_id = exynos4210_pdma1_peri; - - if (samsung_rev() == EXYNOS4210_REV_0) - exynos_mdma1_device.res.start = EXYNOS4_PA_S_MDMA1; } else if (soc_is_exynos4212() || soc_is_exynos4412()) { exynos_pdma0_pdata.nr_valid_peri = ARRAY_SIZE(exynos4212_pdma0_peri); diff --git a/trunk/arch/arm/mach-exynos/include/mach/map.h b/trunk/arch/arm/mach-exynos/include/mach/map.h index ed4da4544cd2..8480849affb9 100644 --- a/trunk/arch/arm/mach-exynos/include/mach/map.h +++ b/trunk/arch/arm/mach-exynos/include/mach/map.h @@ -90,7 +90,6 @@ #define EXYNOS4_PA_MDMA0 0x10810000 #define EXYNOS4_PA_MDMA1 0x12850000 -#define EXYNOS4_PA_S_MDMA1 0x12840000 #define EXYNOS4_PA_PDMA0 0x12680000 #define EXYNOS4_PA_PDMA1 0x12690000 #define EXYNOS5_PA_MDMA0 0x10800000 diff --git a/trunk/arch/arm/mach-omap2/board-igep0020.c b/trunk/arch/arm/mach-omap2/board-igep0020.c index 378590694447..48d5e41dfbfa 100644 --- a/trunk/arch/arm/mach-omap2/board-igep0020.c +++ b/trunk/arch/arm/mach-omap2/board-igep0020.c @@ -580,11 +580,6 @@ static void __init igep_wlan_bt_init(void) } else return; - /* Make sure that the GPIO pins are muxed correctly */ - omap_mux_init_gpio(igep_wlan_bt_gpios[0].gpio, OMAP_PIN_OUTPUT); - omap_mux_init_gpio(igep_wlan_bt_gpios[1].gpio, OMAP_PIN_OUTPUT); - omap_mux_init_gpio(igep_wlan_bt_gpios[2].gpio, OMAP_PIN_OUTPUT); - err = gpio_request_array(igep_wlan_bt_gpios, ARRAY_SIZE(igep_wlan_bt_gpios)); if (err) { diff --git a/trunk/arch/arm/mach-omap2/common-board-devices.c b/trunk/arch/arm/mach-omap2/common-board-devices.c index 84551f205e46..48daac2581b4 100644 --- a/trunk/arch/arm/mach-omap2/common-board-devices.c +++ b/trunk/arch/arm/mach-omap2/common-board-devices.c @@ -64,36 +64,30 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, struct spi_board_info *spi_bi = &ads7846_spi_board_info; int err; - /* - * If a board defines get_pendown_state() function, request the pendown - * GPIO and set the GPIO debounce time. - * If a board does not define the get_pendown_state() function, then - * the ads7846 driver will setup the pendown GPIO itself. - */ - if (board_pdata && board_pdata->get_pendown_state) { - err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); - if (err) { - pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); - return; - } - - if (gpio_debounce) - gpio_set_debounce(gpio_pendown, gpio_debounce); - - gpio_export(gpio_pendown, 0); + err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); + if (err) { + pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); + return; } + if (gpio_debounce) + gpio_set_debounce(gpio_pendown, gpio_debounce); + spi_bi->bus_num = bus_num; spi_bi->irq = gpio_to_irq(gpio_pendown); - ads7846_config.gpio_pendown = gpio_pendown; - if (board_pdata) { board_pdata->gpio_pendown = gpio_pendown; - board_pdata->gpio_pendown_debounce = gpio_debounce; spi_bi->platform_data = board_pdata; + if (board_pdata->get_pendown_state) + gpio_export(gpio_pendown, 0); + } else { + ads7846_config.gpio_pendown = gpio_pendown; } + if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state)) + gpio_free(gpio_pendown); + spi_register_board_info(&ads7846_spi_board_info, 1); } #else diff --git a/trunk/arch/arm/mach-omap2/twl-common.c b/trunk/arch/arm/mach-omap2/twl-common.c index a256135d8e48..44c42057b61c 100644 --- a/trunk/arch/arm/mach-omap2/twl-common.c +++ b/trunk/arch/arm/mach-omap2/twl-common.c @@ -73,7 +73,6 @@ void __init omap4_pmic_init(const char *pmic_type, { /* PMIC part*/ omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); - omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT); omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data); /* Register additional devices on i2c1 bus if needed */ diff --git a/trunk/arch/arm/plat-omap/i2c.c b/trunk/arch/arm/plat-omap/i2c.c index 6013831a043e..a5683a84c6ee 100644 --- a/trunk/arch/arm/plat-omap/i2c.c +++ b/trunk/arch/arm/plat-omap/i2c.c @@ -26,14 +26,12 @@ #include #include #include -#include #include #include #include #include #include -#include #include #define OMAP_I2C_SIZE 0x3f @@ -129,16 +127,6 @@ static inline int omap1_i2c_add_bus(int bus_id) #ifdef CONFIG_ARCH_OMAP2PLUS -/* - * XXX This function is a temporary compatibility wrapper - only - * needed until the I2C driver can be converted to call - * omap_pm_set_max_dev_wakeup_lat() and handle a return code. - */ -static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t) -{ - omap_pm_set_max_mpu_wakeup_lat(dev, t); -} - static inline int omap2_i2c_add_bus(int bus_id) { int l; @@ -170,15 +158,6 @@ static inline int omap2_i2c_add_bus(int bus_id) dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr; pdata->flags = dev_attr->flags; - /* - * When waiting for completion of a i2c transfer, we need to - * set a wake up latency constraint for the MPU. This is to - * ensure quick enough wakeup from idle, when transfer - * completes. - * Only omap3 has support for constraints - */ - if (cpu_is_omap34xx()) - pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(struct omap_i2c_bus_platform_data), NULL, 0, 0); diff --git a/trunk/arch/m68k/include/asm/signal.h b/trunk/arch/m68k/include/asm/signal.h index 2df26b57c26a..67e489d8d1bd 100644 --- a/trunk/arch/m68k/include/asm/signal.h +++ b/trunk/arch/m68k/include/asm/signal.h @@ -41,7 +41,7 @@ struct k_sigaction { static inline void sigaddset(sigset_t *set, int _sig) { asm ("bfset %0{%1,#1}" - : "+o" (*set) + : "+od" (*set) : "id" ((_sig - 1) ^ 31) : "cc"); } @@ -49,7 +49,7 @@ static inline void sigaddset(sigset_t *set, int _sig) static inline void sigdelset(sigset_t *set, int _sig) { asm ("bfclr %0{%1,#1}" - : "+o" (*set) + : "+od" (*set) : "id" ((_sig - 1) ^ 31) : "cc"); } @@ -65,7 +65,7 @@ static inline int __gen_sigismember(sigset_t *set, int _sig) int ret; asm ("bfextu %1{%2,#1},%0" : "=d" (ret) - : "o" (*set), "id" ((_sig-1) ^ 31) + : "od" (*set), "id" ((_sig-1) ^ 31) : "cc"); return ret; } diff --git a/trunk/arch/mips/kernel/setup.c b/trunk/arch/mips/kernel/setup.c index 290dc6a1d7a3..a53f8ec37aac 100644 --- a/trunk/arch/mips/kernel/setup.c +++ b/trunk/arch/mips/kernel/setup.c @@ -79,7 +79,7 @@ static struct resource data_resource = { .name = "Kernel data", }; void __init add_memory_region(phys_t start, phys_t size, long type) { int x = boot_mem_map.nr_map; - int i; + struct boot_mem_map_entry *prev = boot_mem_map.map + x - 1; /* Sanity check */ if (start + size < start) { @@ -88,29 +88,15 @@ void __init add_memory_region(phys_t start, phys_t size, long type) } /* - * Try to merge with existing entry, if any. + * Try to merge with previous entry if any. This is far less than + * perfect but is sufficient for most real world cases. */ - for (i = 0; i < boot_mem_map.nr_map; i++) { - struct boot_mem_map_entry *entry = boot_mem_map.map + i; - unsigned long top; - - if (entry->type != type) - continue; - - if (start + size < entry->addr) - continue; /* no overlap */ - - if (entry->addr + entry->size < start) - continue; /* no overlap */ - - top = max(entry->addr + entry->size, start + size); - entry->addr = min(entry->addr, start); - entry->size = top - entry->addr; - + if (x && prev->addr + prev->size == start && prev->type == type) { + prev->size += size; return; } - if (boot_mem_map.nr_map == BOOT_MEM_MAP_MAX) { + if (x == BOOT_MEM_MAP_MAX) { pr_err("Ooops! Too many entries in the memory map!\n"); return; } diff --git a/trunk/arch/mips/lib/mips-atomic.c b/trunk/arch/mips/lib/mips-atomic.c index cd160be3ce4d..e091430dbeb1 100644 --- a/trunk/arch/mips/lib/mips-atomic.c +++ b/trunk/arch/mips/lib/mips-atomic.c @@ -56,7 +56,7 @@ __asm__( " .set pop \n" " .endm \n"); -notrace void arch_local_irq_disable(void) +void arch_local_irq_disable(void) { preempt_disable(); __asm__ __volatile__( @@ -93,7 +93,7 @@ __asm__( " .set pop \n" " .endm \n"); -notrace unsigned long arch_local_irq_save(void) +unsigned long arch_local_irq_save(void) { unsigned long flags; preempt_disable(); @@ -135,7 +135,7 @@ __asm__( " .set pop \n" " .endm \n"); -notrace void arch_local_irq_restore(unsigned long flags) +void arch_local_irq_restore(unsigned long flags) { unsigned long __tmp1; @@ -159,7 +159,7 @@ notrace void arch_local_irq_restore(unsigned long flags) EXPORT_SYMBOL(arch_local_irq_restore); -notrace void __arch_local_irq_restore(unsigned long flags) +void __arch_local_irq_restore(unsigned long flags) { unsigned long __tmp1; diff --git a/trunk/arch/parisc/kernel/signal32.c b/trunk/arch/parisc/kernel/signal32.c index 5dede04f2f3e..fd49aeda9eb8 100644 --- a/trunk/arch/parisc/kernel/signal32.c +++ b/trunk/arch/parisc/kernel/signal32.c @@ -65,8 +65,7 @@ put_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz) { compat_sigset_t s; - if (sz != sizeof *set) - return -EINVAL; + if (sz != sizeof *set) panic("put_sigset32()"); sigset_64to32(&s, set); return copy_to_user(up, &s, sizeof s); @@ -78,8 +77,7 @@ get_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz) compat_sigset_t s; int r; - if (sz != sizeof *set) - return -EINVAL; + if (sz != sizeof *set) panic("put_sigset32()"); if ((r = copy_from_user(&s, up, sz)) == 0) { sigset_32to64(set, &s); diff --git a/trunk/arch/parisc/kernel/sys_parisc.c b/trunk/arch/parisc/kernel/sys_parisc.c index f76c10863c62..7426e40699bd 100644 --- a/trunk/arch/parisc/kernel/sys_parisc.c +++ b/trunk/arch/parisc/kernel/sys_parisc.c @@ -73,8 +73,6 @@ static unsigned long get_shared_area(struct address_space *mapping, struct vm_area_struct *vma; int offset = mapping ? get_offset(mapping) : 0; - offset = (offset + (pgoff << PAGE_SHIFT)) & 0x3FF000; - addr = DCACHE_ALIGN(addr - offset) + offset; for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { diff --git a/trunk/arch/powerpc/boot/dts/mpc5200b.dtsi b/trunk/arch/powerpc/boot/dts/mpc5200b.dtsi index 39ed65a44c5f..7ab286ab5300 100644 --- a/trunk/arch/powerpc/boot/dts/mpc5200b.dtsi +++ b/trunk/arch/powerpc/boot/dts/mpc5200b.dtsi @@ -231,12 +231,6 @@ interrupts = <2 7 0>; }; - sclpc@3c00 { - compatible = "fsl,mpc5200-lpbfifo"; - reg = <0x3c00 0x60>; - interrupts = <2 23 0>; - }; - i2c@3d00 { #address-cells = <1>; #size-cells = <0>; diff --git a/trunk/arch/powerpc/boot/dts/o2d.dtsi b/trunk/arch/powerpc/boot/dts/o2d.dtsi index 24f668039295..3444eb8f0ade 100644 --- a/trunk/arch/powerpc/boot/dts/o2d.dtsi +++ b/trunk/arch/powerpc/boot/dts/o2d.dtsi @@ -86,6 +86,12 @@ reg = <0>; }; }; + + sclpc@3c00 { + compatible = "fsl,mpc5200-lpbfifo"; + reg = <0x3c00 0x60>; + interrupts = <3 23 0>; + }; }; localbus { diff --git a/trunk/arch/powerpc/boot/dts/pcm030.dts b/trunk/arch/powerpc/boot/dts/pcm030.dts index 96512c058033..9e354997eb7e 100644 --- a/trunk/arch/powerpc/boot/dts/pcm030.dts +++ b/trunk/arch/powerpc/boot/dts/pcm030.dts @@ -59,7 +59,7 @@ #gpio-cells = <2>; }; - audioplatform: psc@2000 { /* PSC1 in ac97 mode */ + psc@2000 { /* PSC1 in ac97 mode */ compatible = "mpc5200b-psc-ac97","fsl,mpc5200b-psc-ac97"; cell-index = <0>; }; @@ -134,9 +134,4 @@ localbus { status = "disabled"; }; - - sound { - compatible = "phytec,pcm030-audio-fabric"; - asoc-platform = <&audioplatform>; - }; }; diff --git a/trunk/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/trunk/arch/powerpc/platforms/52xx/mpc52xx_pic.c index b89ef65392dc..8520b58a5e9a 100644 --- a/trunk/arch/powerpc/platforms/52xx/mpc52xx_pic.c +++ b/trunk/arch/powerpc/platforms/52xx/mpc52xx_pic.c @@ -372,11 +372,10 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq, case MPC52xx_IRQ_L1_MAIN: irqchip = &mpc52xx_main_irqchip; break; case MPC52xx_IRQ_L1_PERP: irqchip = &mpc52xx_periph_irqchip; break; case MPC52xx_IRQ_L1_SDMA: irqchip = &mpc52xx_sdma_irqchip; break; - case MPC52xx_IRQ_L1_CRIT: - pr_warn("%s: Critical IRQ #%d is unsupported! Nopping it.\n", - __func__, l2irq); - irq_set_chip(virq, &no_irq_chip); - return 0; + default: + pr_err("%s: invalid irq: virq=%i, l1=%i, l2=%i\n", + __func__, virq, l1irq, l2irq); + return -EINVAL; } irq_set_chip_and_handler(virq, irqchip, handle_level_irq); diff --git a/trunk/arch/powerpc/platforms/pseries/eeh_pe.c b/trunk/arch/powerpc/platforms/pseries/eeh_pe.c index d16c8ded1084..797cd181dc3f 100644 --- a/trunk/arch/powerpc/platforms/pseries/eeh_pe.c +++ b/trunk/arch/powerpc/platforms/pseries/eeh_pe.c @@ -449,7 +449,7 @@ int eeh_rmv_from_parent_pe(struct eeh_dev *edev, int purge_pe) if (list_empty(&pe->edevs)) { cnt = 0; list_for_each_entry(child, &pe->child_list, child) { - if (!(child->type & EEH_PE_INVALID)) { + if (!(pe->type & EEH_PE_INVALID)) { cnt++; break; } diff --git a/trunk/arch/powerpc/platforms/pseries/msi.c b/trunk/arch/powerpc/platforms/pseries/msi.c index e5b084723131..d19f4977c834 100644 --- a/trunk/arch/powerpc/platforms/pseries/msi.c +++ b/trunk/arch/powerpc/platforms/pseries/msi.c @@ -220,8 +220,7 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total) /* Get the top level device in the PE */ edev = of_node_to_eeh_dev(dn); - if (edev->pe) - edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); + edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list); dn = eeh_dev_to_of_node(edev); if (!dn) return NULL; diff --git a/trunk/arch/sparc/include/asm/prom.h b/trunk/arch/sparc/include/asm/prom.h index 67c62578d170..f93003123bce 100644 --- a/trunk/arch/sparc/include/asm/prom.h +++ b/trunk/arch/sparc/include/asm/prom.h @@ -63,13 +63,10 @@ extern char *of_console_options; extern void irq_trans_init(struct device_node *dp); extern char *build_path_component(struct device_node *dp); -/* SPARC has local implementations */ +/* SPARC has a local implementation */ extern int of_address_to_resource(struct device_node *dev, int index, struct resource *r); #define of_address_to_resource of_address_to_resource -void __iomem *of_iomap(struct device_node *node, int index); -#define of_iomap of_iomap - #endif /* __KERNEL__ */ #endif /* _SPARC_PROM_H */ diff --git a/trunk/arch/sparc/kernel/signal_64.c b/trunk/arch/sparc/kernel/signal_64.c index 689e1ba62809..867de2f8189c 100644 --- a/trunk/arch/sparc/kernel/signal_64.c +++ b/trunk/arch/sparc/kernel/signal_64.c @@ -295,7 +295,9 @@ void do_rt_sigreturn(struct pt_regs *regs) err |= restore_fpu_state(regs, fpu_save); err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); - if (err || do_sigaltstack(&sf->stack, NULL, (unsigned long)sf) == -EFAULT) + err |= do_sigaltstack(&sf->stack, NULL, (unsigned long)sf); + + if (err) goto segv; err |= __get_user(rwin_save, &sf->rwin_save); diff --git a/trunk/arch/x86/boot/compressed/eboot.c b/trunk/arch/x86/boot/compressed/eboot.c index e87b0cac14b5..c760e073963e 100644 --- a/trunk/arch/x86/boot/compressed/eboot.c +++ b/trunk/arch/x86/boot/compressed/eboot.c @@ -12,8 +12,6 @@ #include #include -#undef memcpy /* Use memcpy from misc.c */ - #include "eboot.h" static efi_system_table_t *sys_table; diff --git a/trunk/arch/x86/boot/header.S b/trunk/arch/x86/boot/header.S index 8c132a625b94..2a017441b8b2 100644 --- a/trunk/arch/x86/boot/header.S +++ b/trunk/arch/x86/boot/header.S @@ -476,3 +476,6 @@ die: setup_corrupt: .byte 7 .string "No setup signature found...\n" + + .data +dummy: .long 0 diff --git a/trunk/arch/x86/include/asm/ptrace.h b/trunk/arch/x86/include/asm/ptrace.h index 19f16ebaf4fa..dcfde52979c3 100644 --- a/trunk/arch/x86/include/asm/ptrace.h +++ b/trunk/arch/x86/include/asm/ptrace.h @@ -205,14 +205,21 @@ static inline bool user_64bit_mode(struct pt_regs *regs) } #endif -#ifdef CONFIG_X86_32 -extern unsigned long kernel_stack_pointer(struct pt_regs *regs); -#else +/* + * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode + * when it traps. The previous stack will be directly underneath the saved + * registers, and 'sp/ss' won't even have been saved. Thus the '®s->sp'. + * + * This is valid only for kernel mode traps. + */ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) { +#ifdef CONFIG_X86_32 + return (unsigned long)(®s->sp); +#else return regs->sp; -} #endif +} #define GET_IP(regs) ((regs)->ip) #define GET_FP(regs) ((regs)->bp) diff --git a/trunk/arch/x86/kernel/cpu/amd.c b/trunk/arch/x86/kernel/cpu/amd.c index 1b7d1656a042..f7e98a2c0d12 100644 --- a/trunk/arch/x86/kernel/cpu/amd.c +++ b/trunk/arch/x86/kernel/cpu/amd.c @@ -631,20 +631,6 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) } } - /* - * The way access filter has a performance penalty on some workloads. - * Disable it on the affected CPUs. - */ - if ((c->x86 == 0x15) && - (c->x86_model >= 0x02) && (c->x86_model < 0x20)) { - u64 val; - - if (!rdmsrl_safe(0xc0011021, &val) && !(val & 0x1E)) { - val |= 0x1E; - wrmsrl_safe(0xc0011021, val); - } - } - cpu_detect_cache_sizes(c); /* Multi core CPU? */ diff --git a/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c b/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c index 1ac581f38dfa..698b6ec12e0f 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/mce_amd.c @@ -6,7 +6,7 @@ * * Written by Jacob Shin - AMD, Inc. * - * Maintained by: Borislav Petkov + * Support: borislav.petkov@amd.com * * April 2006 * - added support for AMD Family 0x10 processors diff --git a/trunk/arch/x86/kernel/cpu/mcheck/mce_intel.c b/trunk/arch/x86/kernel/cpu/mcheck/mce_intel.c index 4f9a3cbfc4a3..5f88abf07e9c 100644 --- a/trunk/arch/x86/kernel/cpu/mcheck/mce_intel.c +++ b/trunk/arch/x86/kernel/cpu/mcheck/mce_intel.c @@ -285,39 +285,34 @@ void cmci_clear(void) raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); } -static long cmci_rediscover_work_func(void *arg) -{ - int banks; - - /* Recheck banks in case CPUs don't all have the same */ - if (cmci_supported(&banks)) - cmci_discover(banks); - - return 0; -} - /* * After a CPU went down cycle through all the others and rediscover * Must run in process context. */ void cmci_rediscover(int dying) { - int cpu, banks; + int banks; + int cpu; + cpumask_var_t old; if (!cmci_supported(&banks)) return; + if (!alloc_cpumask_var(&old, GFP_KERNEL)) + return; + cpumask_copy(old, ¤t->cpus_allowed); for_each_online_cpu(cpu) { if (cpu == dying) continue; - - if (cpu == smp_processor_id()) { - cmci_rediscover_work_func(NULL); + if (set_cpus_allowed_ptr(current, cpumask_of(cpu))) continue; - } - - work_on_cpu(cpu, cmci_rediscover_work_func, NULL); + /* Recheck banks in case CPUs don't all have the same */ + if (cmci_supported(&banks)) + cmci_discover(banks); } + + set_cpus_allowed_ptr(current, old); + free_cpumask_var(old); } /* diff --git a/trunk/arch/x86/kernel/entry_64.S b/trunk/arch/x86/kernel/entry_64.S index 1328fe49a3f1..b51b2c7ee51f 100644 --- a/trunk/arch/x86/kernel/entry_64.S +++ b/trunk/arch/x86/kernel/entry_64.S @@ -995,8 +995,8 @@ END(interrupt) */ .p2align CONFIG_X86_L1_CACHE_SHIFT common_interrupt: - XCPT_FRAME ASM_CLAC + XCPT_FRAME addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range */ interrupt do_IRQ /* 0(%rsp): old_rsp-ARGOFFSET */ @@ -1135,8 +1135,8 @@ END(common_interrupt) */ .macro apicinterrupt num sym do_sym ENTRY(\sym) - INTR_FRAME ASM_CLAC + INTR_FRAME pushq_cfi $~(\num) .Lcommon_\sym: interrupt \do_sym @@ -1190,8 +1190,8 @@ apicinterrupt IRQ_WORK_VECTOR \ */ .macro zeroentry sym do_sym ENTRY(\sym) - INTR_FRAME ASM_CLAC + INTR_FRAME PARAVIRT_ADJUST_EXCEPTION_FRAME pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ subq $ORIG_RAX-R15, %rsp @@ -1208,8 +1208,8 @@ END(\sym) .macro paranoidzeroentry sym do_sym ENTRY(\sym) - INTR_FRAME ASM_CLAC + INTR_FRAME PARAVIRT_ADJUST_EXCEPTION_FRAME pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ subq $ORIG_RAX-R15, %rsp @@ -1227,8 +1227,8 @@ END(\sym) #define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8) .macro paranoidzeroentry_ist sym do_sym ist ENTRY(\sym) - INTR_FRAME ASM_CLAC + INTR_FRAME PARAVIRT_ADJUST_EXCEPTION_FRAME pushq_cfi $-1 /* ORIG_RAX: no syscall to restart */ subq $ORIG_RAX-R15, %rsp @@ -1247,8 +1247,8 @@ END(\sym) .macro errorentry sym do_sym ENTRY(\sym) - XCPT_FRAME ASM_CLAC + XCPT_FRAME PARAVIRT_ADJUST_EXCEPTION_FRAME subq $ORIG_RAX-R15, %rsp CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 @@ -1266,8 +1266,8 @@ END(\sym) /* error code is on the stack already */ .macro paranoiderrorentry sym do_sym ENTRY(\sym) - XCPT_FRAME ASM_CLAC + XCPT_FRAME PARAVIRT_ADJUST_EXCEPTION_FRAME subq $ORIG_RAX-R15, %rsp CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 diff --git a/trunk/arch/x86/kernel/microcode_amd.c b/trunk/arch/x86/kernel/microcode_amd.c index efdec7cd8e01..7720ff5a9ee2 100644 --- a/trunk/arch/x86/kernel/microcode_amd.c +++ b/trunk/arch/x86/kernel/microcode_amd.c @@ -8,8 +8,8 @@ * Tigran Aivazian * * Maintainers: - * Andreas Herrmann - * Borislav Petkov + * Andreas Herrmann + * Borislav Petkov * * This driver allows to upgrade microcode on F10h AMD * CPUs and later. @@ -190,7 +190,6 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size, #define F1XH_MPB_MAX_SIZE 2048 #define F14H_MPB_MAX_SIZE 1824 #define F15H_MPB_MAX_SIZE 4096 -#define F16H_MPB_MAX_SIZE 3458 switch (c->x86) { case 0x14: @@ -199,9 +198,6 @@ static unsigned int verify_patch_size(int cpu, u32 patch_size, case 0x15: max_size = F15H_MPB_MAX_SIZE; break; - case 0x16: - max_size = F16H_MPB_MAX_SIZE; - break; default: max_size = F1XH_MPB_MAX_SIZE; break; diff --git a/trunk/arch/x86/kernel/ptrace.c b/trunk/arch/x86/kernel/ptrace.c index 5e0596b0632e..b00b33a18390 100644 --- a/trunk/arch/x86/kernel/ptrace.c +++ b/trunk/arch/x86/kernel/ptrace.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -167,35 +166,6 @@ static inline bool invalid_selector(u16 value) #define FLAG_MASK FLAG_MASK_32 -/* - * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode - * when it traps. The previous stack will be directly underneath the saved - * registers, and 'sp/ss' won't even have been saved. Thus the '®s->sp'. - * - * Now, if the stack is empty, '®s->sp' is out of range. In this - * case we try to take the previous stack. To always return a non-null - * stack pointer we fall back to regs as stack if no previous stack - * exists. - * - * This is valid only for kernel mode traps. - */ -unsigned long kernel_stack_pointer(struct pt_regs *regs) -{ - unsigned long context = (unsigned long)regs & ~(THREAD_SIZE - 1); - unsigned long sp = (unsigned long)®s->sp; - struct thread_info *tinfo; - - if (context == (sp & ~(THREAD_SIZE - 1))) - return sp; - - tinfo = (struct thread_info *)context; - if (tinfo->previous_esp) - return tinfo->previous_esp; - - return (unsigned long)regs; -} -EXPORT_SYMBOL_GPL(kernel_stack_pointer); - static unsigned long *pt_regs_access(struct pt_regs *regs, unsigned long regno) { BUILD_BUG_ON(offsetof(struct pt_regs, bx) != 0); diff --git a/trunk/arch/x86/mm/tlb.c b/trunk/arch/x86/mm/tlb.c index 60f926cd8b0e..0777f042e400 100644 --- a/trunk/arch/x86/mm/tlb.c +++ b/trunk/arch/x86/mm/tlb.c @@ -197,7 +197,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, } if (end == TLB_FLUSH_ALL || tlb_flushall_shift == -1 - || vmflag & VM_HUGETLB) { + || vmflag == VM_HUGETLB) { local_flush_tlb(); goto flush_all; } diff --git a/trunk/arch/x86/pci/ce4100.c b/trunk/arch/x86/pci/ce4100.c index b914e20b5a00..41bd2a2d2c50 100644 --- a/trunk/arch/x86/pci/ce4100.c +++ b/trunk/arch/x86/pci/ce4100.c @@ -115,16 +115,6 @@ static void sata_revid_read(struct sim_dev_reg *reg, u32 *value) reg_read(reg, value); } -static void reg_noirq_read(struct sim_dev_reg *reg, u32 *value) -{ - unsigned long flags; - - raw_spin_lock_irqsave(&pci_config_lock, flags); - /* force interrupt pin value to 0 */ - *value = reg->sim_reg.value & 0xfff00ff; - raw_spin_unlock_irqrestore(&pci_config_lock, flags); -} - static struct sim_dev_reg bus1_fixups[] = { DEFINE_REG(2, 0, 0x10, (16*MB), reg_init, reg_read, reg_write) DEFINE_REG(2, 0, 0x14, (256), reg_init, reg_read, reg_write) @@ -154,7 +144,6 @@ static struct sim_dev_reg bus1_fixups[] = { DEFINE_REG(11, 5, 0x10, (64*KB), reg_init, reg_read, reg_write) DEFINE_REG(11, 6, 0x10, (256), reg_init, reg_read, reg_write) DEFINE_REG(11, 7, 0x10, (64*KB), reg_init, reg_read, reg_write) - DEFINE_REG(11, 7, 0x3c, 256, reg_init, reg_noirq_read, reg_write) DEFINE_REG(12, 0, 0x10, (128*KB), reg_init, reg_read, reg_write) DEFINE_REG(12, 0, 0x14, (256), reg_init, reg_read, reg_write) DEFINE_REG(12, 1, 0x10, (1024), reg_init, reg_read, reg_write) @@ -172,10 +161,8 @@ static struct sim_dev_reg bus1_fixups[] = { DEFINE_REG(16, 0, 0x10, (64*KB), reg_init, reg_read, reg_write) DEFINE_REG(16, 0, 0x14, (64*MB), reg_init, reg_read, reg_write) DEFINE_REG(16, 0, 0x18, (64*MB), reg_init, reg_read, reg_write) - DEFINE_REG(16, 0, 0x3c, 256, reg_init, reg_noirq_read, reg_write) DEFINE_REG(17, 0, 0x10, (128*KB), reg_init, reg_read, reg_write) DEFINE_REG(18, 0, 0x10, (1*KB), reg_init, reg_read, reg_write) - DEFINE_REG(18, 0, 0x3c, 256, reg_init, reg_noirq_read, reg_write) }; static void __init init_sim_regs(void) diff --git a/trunk/arch/x86/platform/ce4100/ce4100.c b/trunk/arch/x86/platform/ce4100/ce4100.c index 92525cb8e54c..4c61b52191eb 100644 --- a/trunk/arch/x86/platform/ce4100/ce4100.c +++ b/trunk/arch/x86/platform/ce4100/ce4100.c @@ -21,25 +21,12 @@ #include #include #include -#include static int ce4100_i8042_detect(void) { return 0; } -/* - * The CE4100 platform has an internal 8051 Microcontroller which is - * responsible for signaling to the external Power Management Unit the - * intention to reset, reboot or power off the system. This 8051 device has - * its command register mapped at I/O port 0xcf9 and the value 0x4 is used - * to power off the system. - */ -static void ce4100_power_off(void) -{ - outb(0x4, 0xcf9); -} - #ifdef CONFIG_SERIAL_8250 static unsigned int mem_serial_in(struct uart_port *p, int offset) @@ -152,19 +139,8 @@ void __init x86_ce4100_early_setup(void) x86_init.mpparse.find_smp_config = x86_init_noop; x86_init.pci.init = ce4100_pci_init; - /* - * By default, the reboot method is ACPI which is supported by the - * CE4100 bootloader CEFDK using FADT.ResetReg Address and ResetValue - * the bootloader will however issue a system power off instead of - * reboot. By using BOOT_KBD we ensure proper system reboot as - * expected. - */ - reboot_type = BOOT_KBD; - #ifdef CONFIG_X86_IO_APIC x86_init.pci.init_irq = sdv_pci_init; x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc_nocheck; #endif - - pm_power_off = ce4100_power_off; } diff --git a/trunk/block/blk-exec.c b/trunk/block/blk-exec.c index f71eac35c1b9..8b6dc5bd4dd0 100644 --- a/trunk/block/blk-exec.c +++ b/trunk/block/blk-exec.c @@ -52,17 +52,11 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, rq_end_io_fn *done) { int where = at_head ? ELEVATOR_INSERT_FRONT : ELEVATOR_INSERT_BACK; - bool is_pm_resume; WARN_ON(irqs_disabled()); rq->rq_disk = bd_disk; rq->end_io = done; - /* - * need to check this before __blk_run_queue(), because rq can - * be freed before that returns. - */ - is_pm_resume = rq->cmd_type == REQ_TYPE_PM_RESUME; spin_lock_irq(q->queue_lock); @@ -77,7 +71,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk, __elv_add_request(q, rq, where); __blk_run_queue(q); /* the queue is stopped so it won't be run */ - if (is_pm_resume) + if (rq->cmd_type == REQ_TYPE_PM_RESUME) q->request_fn(q); spin_unlock_irq(q->queue_lock); } diff --git a/trunk/drivers/ata/ahci_platform.c b/trunk/drivers/ata/ahci_platform.c index b7078afddb74..b1ae48054dc5 100644 --- a/trunk/drivers/ata/ahci_platform.c +++ b/trunk/drivers/ata/ahci_platform.c @@ -238,7 +238,7 @@ static int __devexit ahci_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int ahci_suspend(struct device *dev) { struct ahci_platform_data *pdata = dev_get_platdata(dev); diff --git a/trunk/drivers/ata/libata-acpi.c b/trunk/drivers/ata/libata-acpi.c index 5b0ba3f20edc..fd9ecf74e631 100644 --- a/trunk/drivers/ata/libata-acpi.c +++ b/trunk/drivers/ata/libata-acpi.c @@ -1105,15 +1105,10 @@ static int ata_acpi_bind_device(struct ata_port *ap, struct scsi_device *sdev, struct acpi_device *acpi_dev; struct acpi_device_power_state *states; - if (ap->flags & ATA_FLAG_ACPI_SATA) { - if (!sata_pmp_attached(ap)) - ata_dev = &ap->link.device[sdev->id]; - else - ata_dev = &ap->pmp_link[sdev->channel].device[sdev->id]; - } - else { + if (ap->flags & ATA_FLAG_ACPI_SATA) + ata_dev = &ap->link.device[sdev->channel]; + else ata_dev = &ap->link.device[sdev->id]; - } *handle = ata_dev_acpi_handle(ata_dev); diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index f46fbd3bd3fb..3cc7096cfda7 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -2942,10 +2942,6 @@ const struct ata_timing *ata_timing_find_mode(u8 xfer_mode) if (xfer_mode == t->mode) return t; - - WARN_ONCE(true, "%s: unable to find timing for xfer_mode 0x%x\n", - __func__, xfer_mode); - return NULL; } diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index a6df6a351d6e..e3bda074fa12 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -1052,8 +1052,6 @@ static void ata_scsi_sdev_config(struct scsi_device *sdev) { sdev->use_10_for_rw = 1; sdev->use_10_for_ms = 1; - sdev->no_report_opcodes = 1; - sdev->no_write_same = 1; /* Schedule policy is determined by ->qc_defer() callback and * it needs to see every deferred qc. Set dev_blocked to 1 to diff --git a/trunk/drivers/ata/pata_arasan_cf.c b/trunk/drivers/ata/pata_arasan_cf.c index 371fd2c698b7..26201ebef3ca 100644 --- a/trunk/drivers/ata/pata_arasan_cf.c +++ b/trunk/drivers/ata/pata_arasan_cf.c @@ -317,12 +317,6 @@ static int cf_init(struct arasan_cf_dev *acdev) return ret; } - ret = clk_set_rate(acdev->clk, 166000000); - if (ret) { - dev_warn(acdev->host->dev, "clock set rate failed"); - return ret; - } - spin_lock_irqsave(&acdev->host->lock, flags); /* configure CF interface clock */ writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk : @@ -914,7 +908,7 @@ static int __devexit arasan_cf_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int arasan_cf_suspend(struct device *dev) { struct ata_host *host = dev_get_drvdata(dev); diff --git a/trunk/drivers/ata/sata_highbank.c b/trunk/drivers/ata/sata_highbank.c index 400bf1c3e982..0d7c4c2cd26f 100644 --- a/trunk/drivers/ata/sata_highbank.c +++ b/trunk/drivers/ata/sata_highbank.c @@ -260,7 +260,7 @@ static const struct of_device_id ahci_of_match[] = { }; MODULE_DEVICE_TABLE(of, ahci_of_match); -static int __devinit ahci_highbank_probe(struct platform_device *pdev) +static int __init ahci_highbank_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ahci_host_priv *hpriv; @@ -378,7 +378,7 @@ static int __devexit ahci_highbank_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static int ahci_highbank_suspend(struct device *dev) { struct ata_host *host = dev_get_drvdata(dev); diff --git a/trunk/drivers/ata/sata_svw.c b/trunk/drivers/ata/sata_svw.c index 08608de87e4e..44a4256533e1 100644 --- a/trunk/drivers/ata/sata_svw.c +++ b/trunk/drivers/ata/sata_svw.c @@ -142,39 +142,6 @@ static int k2_sata_scr_write(struct ata_link *link, return 0; } -static int k2_sata_softreset(struct ata_link *link, - unsigned int *class, unsigned long deadline) -{ - u8 dmactl; - void __iomem *mmio = link->ap->ioaddr.bmdma_addr; - - dmactl = readb(mmio + ATA_DMA_CMD); - - /* Clear the start bit */ - if (dmactl & ATA_DMA_START) { - dmactl &= ~ATA_DMA_START; - writeb(dmactl, mmio + ATA_DMA_CMD); - } - - return ata_sff_softreset(link, class, deadline); -} - -static int k2_sata_hardreset(struct ata_link *link, - unsigned int *class, unsigned long deadline) -{ - u8 dmactl; - void __iomem *mmio = link->ap->ioaddr.bmdma_addr; - - dmactl = readb(mmio + ATA_DMA_CMD); - - /* Clear the start bit */ - if (dmactl & ATA_DMA_START) { - dmactl &= ~ATA_DMA_START; - writeb(dmactl, mmio + ATA_DMA_CMD); - } - - return sata_sff_hardreset(link, class, deadline); -} static void k2_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf) { @@ -379,8 +346,6 @@ static struct scsi_host_template k2_sata_sht = { static struct ata_port_operations k2_sata_ops = { .inherits = &ata_bmdma_port_ops, - .softreset = k2_sata_softreset, - .hardreset = k2_sata_hardreset, .sff_tf_load = k2_sata_tf_load, .sff_tf_read = k2_sata_tf_read, .sff_check_status = k2_stat_check_status, diff --git a/trunk/drivers/base/power/qos.c b/trunk/drivers/base/power/qos.c index fbbd4ed2edf2..74a67e0019a2 100644 --- a/trunk/drivers/base/power/qos.c +++ b/trunk/drivers/base/power/qos.c @@ -451,7 +451,7 @@ int dev_pm_qos_add_ancestor_request(struct device *dev, if (ancestor) error = dev_pm_qos_add_request(ancestor, req, value); - if (error < 0) + if (error) req->dev = NULL; return error; diff --git a/trunk/drivers/block/aoe/aoecmd.c b/trunk/drivers/block/aoe/aoecmd.c index 9fe4f1865558..3804a0af3ef1 100644 --- a/trunk/drivers/block/aoe/aoecmd.c +++ b/trunk/drivers/block/aoe/aoecmd.c @@ -935,7 +935,7 @@ aoe_end_request(struct aoedev *d, struct request *rq, int fastfail) /* cf. http://lkml.org/lkml/2006/10/31/28 */ if (!fastfail) - __blk_run_queue(q); + q->request_fn(q); } static void diff --git a/trunk/drivers/block/floppy.c b/trunk/drivers/block/floppy.c index 2ddd64a9ffde..1c49d7173966 100644 --- a/trunk/drivers/block/floppy.c +++ b/trunk/drivers/block/floppy.c @@ -4330,7 +4330,6 @@ static int __init do_floppy_init(void) out_unreg_blkdev: unregister_blkdev(FLOPPY_MAJOR, "fd"); out_put_disk: - destroy_workqueue(floppy_wq); for (drive = 0; drive < N_DRIVE; drive++) { if (!disks[drive]) break; @@ -4341,6 +4340,7 @@ static int __init do_floppy_init(void) } put_disk(disks[drive]); } + destroy_workqueue(floppy_wq); return err; } @@ -4555,8 +4555,6 @@ static void __exit floppy_module_exit(void) unregister_blkdev(FLOPPY_MAJOR, "fd"); platform_driver_unregister(&floppy_driver); - destroy_workqueue(floppy_wq); - for (drive = 0; drive < N_DRIVE; drive++) { del_timer_sync(&motor_off_timer[drive]); @@ -4580,6 +4578,7 @@ static void __exit floppy_module_exit(void) cancel_delayed_work_sync(&fd_timeout); cancel_delayed_work_sync(&fd_timer); + destroy_workqueue(floppy_wq); if (atomic_read(&usage_count)) floppy_release_irq_and_dma(); diff --git a/trunk/drivers/block/mtip32xx/mtip32xx.c b/trunk/drivers/block/mtip32xx/mtip32xx.c index 9694dd99bbbc..adc6f36564cf 100644 --- a/trunk/drivers/block/mtip32xx/mtip32xx.c +++ b/trunk/drivers/block/mtip32xx/mtip32xx.c @@ -559,7 +559,7 @@ static void mtip_timeout_function(unsigned long int data) struct mtip_cmd *command; int tag, cmdto_cnt = 0; unsigned int bit, group; - unsigned int num_command_slots; + unsigned int num_command_slots = port->dd->slot_groups * 32; unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; if (unlikely(!port)) @@ -572,7 +572,6 @@ static void mtip_timeout_function(unsigned long int data) } /* clear the tag accumulator */ memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); - num_command_slots = port->dd->slot_groups * 32; for (tag = 0; tag < num_command_slots; tag++) { /* @@ -2219,8 +2218,8 @@ static int exec_drive_taskfile(struct driver_data *dd, fis.device); /* check for erase mode support during secure erase.*/ - if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) && outbuf && - (outbuf[0] & MTIP_SEC_ERASE_MODE)) { + if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) + && (outbuf[0] & MTIP_SEC_ERASE_MODE)) { erasemode = 1; } @@ -2440,7 +2439,7 @@ static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd, * return value * None */ -static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector, +static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, int nsect, int nents, int tag, void *callback, void *data, int dir) { @@ -2448,7 +2447,6 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector, struct mtip_port *port = dd->port; struct mtip_cmd *command = &port->commands[tag]; int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; - u64 start = sector; /* Map the scatter list for DMA access */ nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); @@ -2467,12 +2465,8 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector, fis->opts = 1 << 7; fis->command = (dir == READ ? ATA_CMD_FPDMA_READ : ATA_CMD_FPDMA_WRITE); - fis->lba_low = start & 0xFF; - fis->lba_mid = (start >> 8) & 0xFF; - fis->lba_hi = (start >> 16) & 0xFF; - fis->lba_low_ex = (start >> 24) & 0xFF; - fis->lba_mid_ex = (start >> 32) & 0xFF; - fis->lba_hi_ex = (start >> 40) & 0xFF; + *((unsigned int *) &fis->lba_low) = (start & 0xFFFFFF); + *((unsigned int *) &fis->lba_low_ex) = ((start >> 24) & 0xFFFFFF); fis->device = 1 << 6; fis->features = nsect & 0xFF; fis->features_ex = (nsect >> 8) & 0xFF; diff --git a/trunk/drivers/block/mtip32xx/mtip32xx.h b/trunk/drivers/block/mtip32xx/mtip32xx.h index b1742640556a..5f4a917bd8bb 100644 --- a/trunk/drivers/block/mtip32xx/mtip32xx.h +++ b/trunk/drivers/block/mtip32xx/mtip32xx.h @@ -34,7 +34,7 @@ #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 /* check for erase mode support during secure erase */ -#define MTIP_SEC_ERASE_MODE 0x2 +#define MTIP_SEC_ERASE_MODE 0x3 /* # of times to retry timed out/failed IOs */ #define MTIP_MAX_RETRIES 2 @@ -155,14 +155,14 @@ enum { MTIP_DDF_REBUILD_FAILED_BIT = 8, }; -struct smart_attr { +__packed struct smart_attr{ u8 attr_id; u16 flags; u8 cur; u8 worst; u32 data; u8 res[3]; -} __packed; +}; /* Register Frame Information Structure (FIS), host to device. */ struct host_to_dev_fis { diff --git a/trunk/drivers/edac/amd64_edac.h b/trunk/drivers/edac/amd64_edac.h index 8c4139647efc..8d4804732bac 100644 --- a/trunk/drivers/edac/amd64_edac.h +++ b/trunk/drivers/edac/amd64_edac.h @@ -33,7 +33,7 @@ * detection. The mods to Rev F required more family * information detection. * - * Changes/Fixes by Borislav Petkov : + * Changes/Fixes by Borislav Petkov : * - misc fixes and code cleanups * * This module is based on the following documents diff --git a/trunk/drivers/edac/edac_stub.c b/trunk/drivers/edac/edac_stub.c index 351945fa2ecd..6c86f6e54558 100644 --- a/trunk/drivers/edac/edac_stub.c +++ b/trunk/drivers/edac/edac_stub.c @@ -5,7 +5,7 @@ * * 2007 (c) MontaVista Software, Inc. * 2010 (c) Advanced Micro Devices Inc. - * Borislav Petkov + * Borislav Petkov * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any diff --git a/trunk/drivers/edac/mce_amd_inj.c b/trunk/drivers/edac/mce_amd_inj.c index 2ae78f20cc28..66b5151c1080 100644 --- a/trunk/drivers/edac/mce_amd_inj.c +++ b/trunk/drivers/edac/mce_amd_inj.c @@ -6,7 +6,7 @@ * This file may be distributed under the terms of the GNU General Public * License version 2. * - * Copyright (c) 2010: Borislav Petkov + * Copyright (c) 2010: Borislav Petkov * Advanced Micro Devices Inc. */ @@ -168,6 +168,6 @@ module_init(edac_init_mce_inject); module_exit(edac_exit_mce_inject); MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Borislav Petkov "); +MODULE_AUTHOR("Borislav Petkov "); MODULE_AUTHOR("AMD Inc."); MODULE_DESCRIPTION("MCE injection facility for testing MCE decoding"); diff --git a/trunk/drivers/firewire/sbp2.c b/trunk/drivers/firewire/sbp2.c index bb1b392f5cda..1162d6b3bf85 100644 --- a/trunk/drivers/firewire/sbp2.c +++ b/trunk/drivers/firewire/sbp2.c @@ -1546,8 +1546,6 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev) struct sbp2_logical_unit *lu = sdev->hostdata; sdev->use_10_for_rw = 1; - sdev->no_report_opcodes = 1; - sdev->no_write_same = 1; if (sbp2_param_exclusive_login) sdev->manage_start_stop = 1; diff --git a/trunk/drivers/gpio/Kconfig b/trunk/drivers/gpio/Kconfig index 47150f5ded04..f11d8e3b4041 100644 --- a/trunk/drivers/gpio/Kconfig +++ b/trunk/drivers/gpio/Kconfig @@ -466,7 +466,7 @@ config GPIO_ADP5588_IRQ config GPIO_ADNP tristate "Avionic Design N-bit GPIO expander" - depends on I2C && OF_GPIO + depends on I2C && OF help This option enables support for N GPIOs found on Avionic Design I2C GPIO expanders. The register space will be extended by powers diff --git a/trunk/drivers/gpio/gpio-mcp23s08.c b/trunk/drivers/gpio/gpio-mcp23s08.c index ce1c84760076..0f425189de11 100644 --- a/trunk/drivers/gpio/gpio-mcp23s08.c +++ b/trunk/drivers/gpio/gpio-mcp23s08.c @@ -77,7 +77,7 @@ struct mcp23s08_driver_data { /*----------------------------------------------------------------------*/ -#if IS_ENABLED(CONFIG_I2C) +#ifdef CONFIG_I2C static int mcp23008_read(struct mcp23s08 *mcp, unsigned reg) { @@ -399,7 +399,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, break; #endif /* CONFIG_SPI_MASTER */ -#if IS_ENABLED(CONFIG_I2C) +#ifdef CONFIG_I2C case MCP_TYPE_008: mcp->ops = &mcp23008_ops; mcp->chip.ngpio = 8; @@ -473,7 +473,7 @@ static int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev, /*----------------------------------------------------------------------*/ -#if IS_ENABLED(CONFIG_I2C) +#ifdef CONFIG_I2C static int __devinit mcp230xx_probe(struct i2c_client *client, const struct i2c_device_id *id) diff --git a/trunk/drivers/gpio/gpio-mvebu.c b/trunk/drivers/gpio/gpio-mvebu.c index be65c0451ad5..cf7afb9eb61a 100644 --- a/trunk/drivers/gpio/gpio-mvebu.c +++ b/trunk/drivers/gpio/gpio-mvebu.c @@ -92,11 +92,6 @@ static inline void __iomem *mvebu_gpioreg_out(struct mvebu_gpio_chip *mvchip) return mvchip->membase + GPIO_OUT_OFF; } -static inline void __iomem *mvebu_gpioreg_blink(struct mvebu_gpio_chip *mvchip) -{ - return mvchip->membase + GPIO_BLINK_EN_OFF; -} - static inline void __iomem *mvebu_gpioreg_io_conf(struct mvebu_gpio_chip *mvchip) { return mvchip->membase + GPIO_IO_CONF_OFF; @@ -211,23 +206,6 @@ static int mvebu_gpio_get(struct gpio_chip *chip, unsigned pin) return (u >> pin) & 1; } -static void mvebu_gpio_blink(struct gpio_chip *chip, unsigned pin, int value) -{ - struct mvebu_gpio_chip *mvchip = - container_of(chip, struct mvebu_gpio_chip, chip); - unsigned long flags; - u32 u; - - spin_lock_irqsave(&mvchip->lock, flags); - u = readl_relaxed(mvebu_gpioreg_blink(mvchip)); - if (value) - u |= 1 << pin; - else - u &= ~(1 << pin); - writel_relaxed(u, mvebu_gpioreg_blink(mvchip)); - spin_unlock_irqrestore(&mvchip->lock, flags); -} - static int mvebu_gpio_direction_input(struct gpio_chip *chip, unsigned pin) { struct mvebu_gpio_chip *mvchip = @@ -266,7 +244,6 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, if (ret) return ret; - mvebu_gpio_blink(chip, pin, 0); mvebu_gpio_set(chip, pin, value); spin_lock_irqsave(&mvchip->lock, flags); diff --git a/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 15b182c84ce8..05a909a17cee 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/trunk/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c @@ -49,7 +49,13 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc) if (chan->vblank.crtc != crtc) continue; - if (nv_device(priv)->chipset >= 0xc0) { + if (nv_device(priv)->chipset == 0x50) { + nv_wr32(priv, 0x001704, chan->vblank.channel); + nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma); + bar->flush(bar); + nv_wr32(priv, 0x001570, chan->vblank.offset); + nv_wr32(priv, 0x001574, chan->vblank.value); + } else { nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel); bar->flush(bar); nv_wr32(priv, 0x06000c, @@ -57,17 +63,6 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc) nv_wr32(priv, 0x060010, lower_32_bits(chan->vblank.offset)); nv_wr32(priv, 0x060014, chan->vblank.value); - } else { - nv_wr32(priv, 0x001704, chan->vblank.channel); - nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma); - bar->flush(bar); - if (nv_device(priv)->chipset == 0x50) { - nv_wr32(priv, 0x001570, chan->vblank.offset); - nv_wr32(priv, 0x001574, chan->vblank.value); - } else { - nv_wr32(priv, 0x060010, chan->vblank.offset); - nv_wr32(priv, 0x060014, chan->vblank.value); - } } list_del(&chan->vblank.head); diff --git a/trunk/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c b/trunk/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c index 7bbb1e1b7a8d..e45035efb8ca 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c +++ b/trunk/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv40.c @@ -669,27 +669,21 @@ nv40_grctx_fill(struct nouveau_device *device, struct nouveau_gpuobj *mem) }); } -int +void nv40_grctx_init(struct nouveau_device *device, u32 *size) { - u32 *ctxprog = kmalloc(256 * 4, GFP_KERNEL), i; + u32 ctxprog[256], i; struct nouveau_grctx ctx = { .device = device, .mode = NOUVEAU_GRCTX_PROG, .data = ctxprog, - .ctxprog_max = 256, + .ctxprog_max = ARRAY_SIZE(ctxprog) }; - if (!ctxprog) - return -ENOMEM; - nv40_grctx_generate(&ctx); nv_wr32(device, 0x400324, 0); for (i = 0; i < ctx.ctxprog_len; i++) nv_wr32(device, 0x400328, ctxprog[i]); *size = ctx.ctxvals_pos * 4; - - kfree(ctxprog); - return 0; } diff --git a/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c b/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c index cc6574eeb80e..425001204a89 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c +++ b/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.c @@ -346,9 +346,7 @@ nv40_graph_init(struct nouveau_object *object) return ret; /* generate and upload context program */ - ret = nv40_grctx_init(nv_device(priv), &priv->size); - if (ret) - return ret; + nv40_grctx_init(nv_device(priv), &priv->size); /* No context present currently */ nv_wr32(priv, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); diff --git a/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h b/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h index 7da35a4e7970..d2ac975afc2e 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h +++ b/trunk/drivers/gpu/drm/nouveau/core/engine/graph/nv40.h @@ -15,7 +15,7 @@ nv44_graph_class(void *priv) return !(0x0baf & (1 << (device->chipset & 0x0f))); } -int nv40_grctx_init(struct nouveau_device *, u32 *size); +void nv40_grctx_init(struct nouveau_device *, u32 *size); void nv40_grctx_fill(struct nouveau_device *, struct nouveau_gpuobj *); #endif diff --git a/trunk/drivers/gpu/drm/nouveau/core/include/core/object.h b/trunk/drivers/gpu/drm/nouveau/core/include/core/object.h index 486f1a9217fd..818feabbf4a0 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/include/core/object.h +++ b/trunk/drivers/gpu/drm/nouveau/core/include/core/object.h @@ -175,18 +175,14 @@ nv_mo32(void *obj, u32 addr, u32 mask, u32 data) return temp; } -static inline int -nv_memcmp(void *obj, u32 addr, const char *str, u32 len) +static inline bool +nv_strncmp(void *obj, u32 addr, u32 len, const char *str) { - unsigned char c1, c2; - while (len--) { - c1 = nv_ro08(obj, addr++); - c2 = *(str++); - if (c1 != c2) - return c1 - c2; + if (nv_ro08(obj, addr++) != *(str++)) + return false; } - return 0; + return true; } #endif diff --git a/trunk/drivers/gpu/drm/nouveau/core/include/subdev/clock.h b/trunk/drivers/gpu/drm/nouveau/core/include/subdev/clock.h index 41b7a6a76f19..39e73b91d360 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/include/subdev/clock.h +++ b/trunk/drivers/gpu/drm/nouveau/core/include/subdev/clock.h @@ -54,7 +54,6 @@ int nv04_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *, int clk, struct nouveau_pll_vals *); int nv04_clock_pll_prog(struct nouveau_clock *, u32 reg1, struct nouveau_pll_vals *); -int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *, - int clk, struct nouveau_pll_vals *); + #endif diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c index c51197157749..7d750382a833 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/bios/dcb.c @@ -64,7 +64,7 @@ dcb_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) } } else if (*ver >= 0x15) { - if (!nv_memcmp(bios, dcb - 7, "DEV_REC", 7)) { + if (!nv_strncmp(bios, dcb - 7, 7, "DEV_REC")) { u16 i2c = nv_ro16(bios, dcb + 2); *hdr = 4; *cnt = (i2c - dcb) / 10; diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c index 9068c98b96f6..cc8d7d162d7c 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nva3.c @@ -66,24 +66,6 @@ nva3_clock_pll_set(struct nouveau_clock *clk, u32 type, u32 freq) return ret; } -int -nva3_clock_pll_calc(struct nouveau_clock *clock, struct nvbios_pll *info, - int clk, struct nouveau_pll_vals *pv) -{ - int ret, N, M, P; - - ret = nva3_pll_calc(clock, info, clk, &N, NULL, &M, &P); - - if (ret > 0) { - pv->refclk = info->refclk; - pv->N1 = N; - pv->M1 = M; - pv->log2P = P; - } - return ret; -} - - static int nva3_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, struct nouveau_oclass *oclass, void *data, u32 size, @@ -98,7 +80,6 @@ nva3_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; priv->base.pll_set = nva3_clock_pll_set; - priv->base.pll_calc = nva3_clock_pll_calc; return 0; } diff --git a/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c b/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c index f6962c9b6c36..5ccce0b17bf3 100644 --- a/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c +++ b/trunk/drivers/gpu/drm/nouveau/core/subdev/clock/nvc0.c @@ -79,7 +79,6 @@ nvc0_clock_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return ret; priv->base.pll_set = nvc0_clock_pll_set; - priv->base.pll_calc = nva3_clock_pll_calc; return 0; } diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_abi16.c b/trunk/drivers/gpu/drm/nouveau/nouveau_abi16.c index cbf1fc60a386..cc79c796afee 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_abi16.c @@ -241,10 +241,6 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) if (unlikely(!abi16)) return -ENOMEM; - - if (!drm->channel) - return nouveau_abi16_put(abi16, -ENODEV); - client = nv_client(abi16->client); if (init->fb_ctxdma_handle == ~0 || init->tt_ctxdma_handle == ~0) diff --git a/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c b/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c index 8503b2ea570a..0910125cbbc3 100644 --- a/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/trunk/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -129,8 +129,7 @@ nouveau_accel_init(struct nouveau_drm *drm) /* initialise synchronisation routines */ if (device->card_type < NV_10) ret = nv04_fence_create(drm); - else if (device->card_type < NV_50) ret = nv10_fence_create(drm); - else if (device->chipset < 0x84) ret = nv50_fence_create(drm); + else if (device->chipset < 0x84) ret = nv10_fence_create(drm); else if (device->card_type < NV_C0) ret = nv84_fence_create(drm); else ret = nvc0_fence_create(drm); if (ret) { diff --git a/trunk/drivers/gpu/drm/radeon/evergreen.c b/trunk/drivers/gpu/drm/radeon/evergreen.c index 219942c660d7..af31f829f4a8 100644 --- a/trunk/drivers/gpu/drm/radeon/evergreen.c +++ b/trunk/drivers/gpu/drm/radeon/evergreen.c @@ -1330,8 +1330,6 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav break; udelay(1); } - } else { - save->crtc_enabled[i] = false; } } diff --git a/trunk/drivers/gpu/drm/radeon/radeon_agp.c b/trunk/drivers/gpu/drm/radeon/radeon_agp.c index 42433344cb1b..10ea17a6b2a6 100644 --- a/trunk/drivers/gpu/drm/radeon/radeon_agp.c +++ b/trunk/drivers/gpu/drm/radeon/radeon_agp.c @@ -69,12 +69,9 @@ static struct radeon_agpmode_quirk radeon_agpmode_quirk_list[] = { /* Intel 82830 830 Chipset Host Bridge / Mobility M6 LY Needs AGPMode 2 (fdo #17360)*/ { PCI_VENDOR_ID_INTEL, 0x3575, PCI_VENDOR_ID_ATI, 0x4c59, PCI_VENDOR_ID_DELL, 0x00e3, 2}, - /* Intel 82852/82855 host bridge / Mobility FireGL 9000 RV250 Needs AGPMode 1 (lp #296617) */ + /* Intel 82852/82855 host bridge / Mobility FireGL 9000 R250 Needs AGPMode 1 (lp #296617) */ { PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4c66, PCI_VENDOR_ID_DELL, 0x0149, 1}, - /* Intel 82855PM host bridge / Mobility FireGL 9000 RV250 Needs AGPMode 1 for suspend/resume */ - { PCI_VENDOR_ID_INTEL, 0x3340, PCI_VENDOR_ID_ATI, 0x4c66, - PCI_VENDOR_ID_IBM, 0x0531, 1}, /* Intel 82852/82855 host bridge / Mobility 9600 M10 RV350 Needs AGPMode 1 (deb #467460) */ { PCI_VENDOR_ID_INTEL, 0x3580, PCI_VENDOR_ID_ATI, 0x4e50, 0x1025, 0x0061, 1}, diff --git a/trunk/drivers/i2c/busses/i2c-at91.c b/trunk/drivers/i2c/busses/i2c-at91.c index c02bf208084f..aa59a254be2c 100644 --- a/trunk/drivers/i2c/busses/i2c-at91.c +++ b/trunk/drivers/i2c/busses/i2c-at91.c @@ -39,7 +39,6 @@ #define AT91_TWI_STOP 0x0002 /* Send a Stop Condition */ #define AT91_TWI_MSEN 0x0004 /* Master Transfer Enable */ #define AT91_TWI_SVDIS 0x0020 /* Slave Transfer Disable */ -#define AT91_TWI_QUICK 0x0040 /* SMBus quick command */ #define AT91_TWI_SWRST 0x0080 /* Software Reset */ #define AT91_TWI_MMR 0x0004 /* Master Mode Register */ @@ -213,11 +212,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) INIT_COMPLETION(dev->cmd_complete); dev->transfer_status = 0; - - if (!dev->buf_len) { - at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_QUICK); - at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); - } else if (dev->msg->flags & I2C_M_RD) { + if (dev->msg->flags & I2C_M_RD) { unsigned start_flags = AT91_TWI_START; if (at91_twi_read(dev, AT91_TWI_SR) & AT91_TWI_RXRDY) { diff --git a/trunk/drivers/i2c/busses/i2c-mxs.c b/trunk/drivers/i2c/busses/i2c-mxs.c index 0670da79ee5e..286ca1917820 100644 --- a/trunk/drivers/i2c/busses/i2c-mxs.c +++ b/trunk/drivers/i2c/busses/i2c-mxs.c @@ -287,14 +287,12 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap, select_init_dma_fail: dma_unmap_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE); select_init_pio_fail: - dmaengine_terminate_all(i2c->dmach); return -EINVAL; /* Write failpath. */ write_init_dma_fail: dma_unmap_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE); write_init_pio_fail: - dmaengine_terminate_all(i2c->dmach); return -EINVAL; } diff --git a/trunk/drivers/i2c/busses/i2c-omap.c b/trunk/drivers/i2c/busses/i2c-omap.c index 3525c9e62cb0..db31eaed6ea5 100644 --- a/trunk/drivers/i2c/busses/i2c-omap.c +++ b/trunk/drivers/i2c/busses/i2c-omap.c @@ -43,6 +43,7 @@ #include #include #include +#include /* I2C controller revisions */ #define OMAP_I2C_OMAP1_REV_2 0x20 @@ -186,9 +187,8 @@ struct omap_i2c_dev { int reg_shift; /* bit shift for I2C register addresses */ struct completion cmd_complete; struct resource *ioarea; - u32 latency; /* maximum mpu wkup latency */ - void (*set_mpu_wkup_lat)(struct device *dev, - long latency); + u32 latency; /* maximum MPU wkup latency */ + struct pm_qos_request pm_qos_request; u32 speed; /* Speed of bus in kHz */ u32 dtrev; /* extra revision from DT */ u32 flags; @@ -494,9 +494,7 @@ static void omap_i2c_resize_fifo(struct omap_i2c_dev *dev, u8 size, bool is_rx) dev->b_hw = 1; /* Enable hardware fixes */ /* calculate wakeup latency constraint for MPU */ - if (dev->set_mpu_wkup_lat != NULL) - dev->latency = (1000000 * dev->threshold) / - (1000 * dev->speed / 8); + dev->latency = (1000000 * dev->threshold) / (1000 * dev->speed / 8); } /* @@ -524,9 +522,6 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, dev->buf = msg->buf; dev->buf_len = msg->len; - /* make sure writes to dev->buf_len are ordered */ - barrier(); - omap_i2c_write_reg(dev, OMAP_I2C_CNT_REG, dev->buf_len); /* Clear the FIFO Buffers */ @@ -584,6 +579,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, */ timeout = wait_for_completion_timeout(&dev->cmd_complete, OMAP_I2C_TIMEOUT); + dev->buf_len = 0; if (timeout == 0) { dev_err(dev->dev, "controller timed out\n"); omap_i2c_init(dev); @@ -633,8 +629,16 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) if (r < 0) goto out; - if (dev->set_mpu_wkup_lat != NULL) - dev->set_mpu_wkup_lat(dev->dev, dev->latency); + /* + * When waiting for completion of a i2c transfer, we need to + * set a wake up latency constraint for the MPU. This is to + * ensure quick enough wakeup from idle, when transfer + * completes. + */ + if (dev->latency) + pm_qos_add_request(&dev->pm_qos_request, + PM_QOS_CPU_DMA_LATENCY, + dev->latency); for (i = 0; i < num; i++) { r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1))); @@ -642,8 +646,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) break; } - if (dev->set_mpu_wkup_lat != NULL) - dev->set_mpu_wkup_lat(dev->dev, -1); + if (dev->latency) + pm_qos_remove_request(&dev->pm_qos_request); if (r == 0) r = num; @@ -1100,7 +1104,6 @@ omap_i2c_probe(struct platform_device *pdev) } else if (pdata != NULL) { dev->speed = pdata->clkrate; dev->flags = pdata->flags; - dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat; dev->dtrev = pdata->rev; } @@ -1156,9 +1159,8 @@ omap_i2c_probe(struct platform_device *pdev) dev->b_hw = 1; /* Enable hardware fixes */ /* calculate wakeup latency constraint for MPU */ - if (dev->set_mpu_wkup_lat != NULL) - dev->latency = (1000000 * dev->fifo_size) / - (1000 * dev->speed / 8); + dev->latency = (1000000 * dev->fifo_size) / + (1000 * dev->speed / 8); } /* reset ASAP, clearing any IRQs */ diff --git a/trunk/drivers/i2c/busses/i2c-s3c2410.c b/trunk/drivers/i2c/busses/i2c-s3c2410.c index 9d902725bac9..3e0335f1fc60 100644 --- a/trunk/drivers/i2c/busses/i2c-s3c2410.c +++ b/trunk/drivers/i2c/busses/i2c-s3c2410.c @@ -806,7 +806,6 @@ static int s3c24xx_i2c_parse_dt_gpio(struct s3c24xx_i2c *i2c) dev_err(i2c->dev, "invalid gpio[%d]: %d\n", idx, gpio); goto free_gpio; } - i2c->gpios[idx] = gpio; ret = gpio_request(gpio, "i2c-bus"); if (ret) { diff --git a/trunk/drivers/input/input-mt.c b/trunk/drivers/input/input-mt.c index 1abbc170d8b7..c0ec7d42c3be 100644 --- a/trunk/drivers/input/input-mt.c +++ b/trunk/drivers/input/input-mt.c @@ -26,14 +26,10 @@ static void copy_abs(struct input_dev *dev, unsigned int dst, unsigned int src) * input_mt_init_slots() - initialize MT input slots * @dev: input device supporting MT events and finger tracking * @num_slots: number of slots used by the device - * @flags: mt tasks to handle in core * * This function allocates all necessary memory for MT slot handling * in the input device, prepares the ABS_MT_SLOT and * ABS_MT_TRACKING_ID events for use and sets up appropriate buffers. - * Depending on the flags set, it also performs pointer emulation and - * frame synchronization. - * * May be called repeatedly. Returns -EINVAL if attempting to * reinitialize with a different number of slots. */ diff --git a/trunk/drivers/input/mousedev.c b/trunk/drivers/input/mousedev.c index 4c842c320c2e..8f02e3d0e712 100644 --- a/trunk/drivers/input/mousedev.c +++ b/trunk/drivers/input/mousedev.c @@ -12,8 +12,8 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define MOUSEDEV_MINOR_BASE 32 -#define MOUSEDEV_MINORS 31 -#define MOUSEDEV_MIX 63 +#define MOUSEDEV_MINORS 32 +#define MOUSEDEV_MIX 31 #include #include diff --git a/trunk/drivers/input/touchscreen/ads7846.c b/trunk/drivers/input/touchscreen/ads7846.c index 78e5d9ab0ba7..f02028ec3db6 100644 --- a/trunk/drivers/input/touchscreen/ads7846.c +++ b/trunk/drivers/input/touchscreen/ads7846.c @@ -955,8 +955,7 @@ static int ads7846_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); -static int __devinit ads7846_setup_pendown(struct spi_device *spi, - struct ads7846 *ts) +static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads7846 *ts) { struct ads7846_platform_data *pdata = spi->dev.platform_data; int err; @@ -982,9 +981,6 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, ts->gpio_pendown = pdata->gpio_pendown; - if (pdata->gpio_pendown_debounce) - gpio_set_debounce(pdata->gpio_pendown, - pdata->gpio_pendown_debounce); } else { dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n"); return -EINVAL; diff --git a/trunk/drivers/iommu/intel-iommu.c b/trunk/drivers/iommu/intel-iommu.c index 0badfa48b32b..d4a4cd445cab 100644 --- a/trunk/drivers/iommu/intel-iommu.c +++ b/trunk/drivers/iommu/intel-iommu.c @@ -4108,7 +4108,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to) static int intel_iommu_add_device(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); - struct pci_dev *bridge, *dma_pdev = NULL; + struct pci_dev *bridge, *dma_pdev; struct iommu_group *group; int ret; @@ -4122,7 +4122,7 @@ static int intel_iommu_add_device(struct device *dev) dma_pdev = pci_get_domain_bus_and_slot( pci_domain_nr(pdev->bus), bridge->subordinate->number, 0); - if (!dma_pdev) + else dma_pdev = pci_dev_get(bridge); } else dma_pdev = pci_dev_get(pdev); diff --git a/trunk/drivers/iommu/tegra-smmu.c b/trunk/drivers/iommu/tegra-smmu.c index c0f7a4266263..a649f146d17b 100644 --- a/trunk/drivers/iommu/tegra-smmu.c +++ b/trunk/drivers/iommu/tegra-smmu.c @@ -1054,7 +1054,6 @@ static int smmu_debugfs_stats_show(struct seq_file *s, void *v) stats[i], val, offs); } seq_printf(s, "\n"); - dput(dent); return 0; } diff --git a/trunk/drivers/md/dm.c b/trunk/drivers/md/dm.c index 77e6eff41cae..02db9183ca01 100644 --- a/trunk/drivers/md/dm.c +++ b/trunk/drivers/md/dm.c @@ -740,14 +740,8 @@ static void rq_completed(struct mapped_device *md, int rw, int run_queue) if (!md_in_flight(md)) wake_up(&md->wait); - /* - * Run this off this callpath, as drivers could invoke end_io while - * inside their request_fn (and holding the queue lock). Calling - * back into ->request_fn() could deadlock attempting to grab the - * queue lock again. - */ if (run_queue) - blk_run_queue_async(md->queue); + blk_run_queue(md->queue); /* * dm_put() must be at the end of this function. See the comment above diff --git a/trunk/drivers/md/md.c b/trunk/drivers/md/md.c index 61200717687b..9ab768acfb62 100644 --- a/trunk/drivers/md/md.c +++ b/trunk/drivers/md/md.c @@ -1817,10 +1817,10 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev) memset(bbp, 0xff, PAGE_SIZE); for (i = 0 ; i < bb->count ; i++) { - u64 internal_bb = p[i]; + u64 internal_bb = *p++; u64 store_bb = ((BB_OFFSET(internal_bb) << 10) | BB_LEN(internal_bb)); - bbp[i] = cpu_to_le64(store_bb); + *bbp++ = cpu_to_le64(store_bb); } bb->changed = 0; if (read_seqretry(&bb->lock, seq)) @@ -5294,7 +5294,7 @@ void md_stop_writes(struct mddev *mddev) } EXPORT_SYMBOL_GPL(md_stop_writes); -static void __md_stop(struct mddev *mddev) +void md_stop(struct mddev *mddev) { mddev->ready = 0; mddev->pers->stop(mddev); @@ -5304,18 +5304,6 @@ static void __md_stop(struct mddev *mddev) mddev->pers = NULL; clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); } - -void md_stop(struct mddev *mddev) -{ - /* stop the array and free an attached data structures. - * This is called from dm-raid - */ - __md_stop(mddev); - bitmap_destroy(mddev); - if (mddev->bio_set) - bioset_free(mddev->bio_set); -} - EXPORT_SYMBOL_GPL(md_stop); static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) @@ -5376,7 +5364,7 @@ static int do_md_stop(struct mddev * mddev, int mode, set_disk_ro(disk, 0); __md_stop_writes(mddev); - __md_stop(mddev); + md_stop(mddev); mddev->queue->merge_bvec_fn = NULL; mddev->queue->backing_dev_info.congested_fn = NULL; @@ -7948,9 +7936,9 @@ int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, sector_t *first_bad, int *bad_sectors) { int hi; - int lo; + int lo = 0; u64 *p = bb->page; - int rv; + int rv = 0; sector_t target = s + sectors; unsigned seq; @@ -7965,8 +7953,7 @@ int md_is_badblock(struct badblocks *bb, sector_t s, int sectors, retry: seq = read_seqbegin(&bb->lock); - lo = 0; - rv = 0; + hi = bb->count; /* Binary search between lo and hi for 'target' diff --git a/trunk/drivers/md/raid10.c b/trunk/drivers/md/raid10.c index 0d5d0ff2c0f7..d1295aff4173 100644 --- a/trunk/drivers/md/raid10.c +++ b/trunk/drivers/md/raid10.c @@ -499,7 +499,7 @@ static void raid10_end_write_request(struct bio *bio, int error) */ one_write_done(r10_bio); if (dec_rdev) - rdev_dec_pending(rdev, conf->mddev); + rdev_dec_pending(conf->mirrors[dev].rdev, conf->mddev); } /* @@ -1334,21 +1334,18 @@ static void make_request(struct mddev *mddev, struct bio * bio) blocked_rdev = rrdev; break; } - if (rdev && (test_bit(Faulty, &rdev->flags) - || test_bit(Unmerged, &rdev->flags))) - rdev = NULL; if (rrdev && (test_bit(Faulty, &rrdev->flags) || test_bit(Unmerged, &rrdev->flags))) rrdev = NULL; r10_bio->devs[i].bio = NULL; r10_bio->devs[i].repl_bio = NULL; - - if (!rdev && !rrdev) { + if (!rdev || test_bit(Faulty, &rdev->flags) || + test_bit(Unmerged, &rdev->flags)) { set_bit(R10BIO_Degraded, &r10_bio->state); continue; } - if (rdev && test_bit(WriteErrorSeen, &rdev->flags)) { + if (test_bit(WriteErrorSeen, &rdev->flags)) { sector_t first_bad; sector_t dev_sector = r10_bio->devs[i].addr; int bad_sectors; @@ -1390,10 +1387,8 @@ static void make_request(struct mddev *mddev, struct bio * bio) max_sectors = good_sectors; } } - if (rdev) { - r10_bio->devs[i].bio = bio; - atomic_inc(&rdev->nr_pending); - } + r10_bio->devs[i].bio = bio; + atomic_inc(&rdev->nr_pending); if (rrdev) { r10_bio->devs[i].repl_bio = bio; atomic_inc(&rrdev->nr_pending); @@ -1449,71 +1444,69 @@ static void make_request(struct mddev *mddev, struct bio * bio) for (i = 0; i < conf->copies; i++) { struct bio *mbio; int d = r10_bio->devs[i].devnum; - if (r10_bio->devs[i].bio) { - struct md_rdev *rdev = conf->mirrors[d].rdev; - mbio = bio_clone_mddev(bio, GFP_NOIO, mddev); - md_trim_bio(mbio, r10_bio->sector - bio->bi_sector, - max_sectors); - r10_bio->devs[i].bio = mbio; - - mbio->bi_sector = (r10_bio->devs[i].addr+ - choose_data_offset(r10_bio, - rdev)); - mbio->bi_bdev = rdev->bdev; - mbio->bi_end_io = raid10_end_write_request; - mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; - mbio->bi_private = r10_bio; + if (!r10_bio->devs[i].bio) + continue; - atomic_inc(&r10_bio->remaining); + mbio = bio_clone_mddev(bio, GFP_NOIO, mddev); + md_trim_bio(mbio, r10_bio->sector - bio->bi_sector, + max_sectors); + r10_bio->devs[i].bio = mbio; - cb = blk_check_plugged(raid10_unplug, mddev, - sizeof(*plug)); - if (cb) - plug = container_of(cb, struct raid10_plug_cb, - cb); - else - plug = NULL; - spin_lock_irqsave(&conf->device_lock, flags); - if (plug) { - bio_list_add(&plug->pending, mbio); - plug->pending_cnt++; - } else { - bio_list_add(&conf->pending_bio_list, mbio); - conf->pending_count++; - } - spin_unlock_irqrestore(&conf->device_lock, flags); - if (!plug) - md_wakeup_thread(mddev->thread); - } + mbio->bi_sector = (r10_bio->devs[i].addr+ + choose_data_offset(r10_bio, + conf->mirrors[d].rdev)); + mbio->bi_bdev = conf->mirrors[d].rdev->bdev; + mbio->bi_end_io = raid10_end_write_request; + mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; + mbio->bi_private = r10_bio; - if (r10_bio->devs[i].repl_bio) { - struct md_rdev *rdev = conf->mirrors[d].replacement; - if (rdev == NULL) { - /* Replacement just got moved to main 'rdev' */ - smp_mb(); - rdev = conf->mirrors[d].rdev; - } - mbio = bio_clone_mddev(bio, GFP_NOIO, mddev); - md_trim_bio(mbio, r10_bio->sector - bio->bi_sector, - max_sectors); - r10_bio->devs[i].repl_bio = mbio; - - mbio->bi_sector = (r10_bio->devs[i].addr + - choose_data_offset( - r10_bio, rdev)); - mbio->bi_bdev = rdev->bdev; - mbio->bi_end_io = raid10_end_write_request; - mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; - mbio->bi_private = r10_bio; + atomic_inc(&r10_bio->remaining); - atomic_inc(&r10_bio->remaining); - spin_lock_irqsave(&conf->device_lock, flags); + cb = blk_check_plugged(raid10_unplug, mddev, sizeof(*plug)); + if (cb) + plug = container_of(cb, struct raid10_plug_cb, cb); + else + plug = NULL; + spin_lock_irqsave(&conf->device_lock, flags); + if (plug) { + bio_list_add(&plug->pending, mbio); + plug->pending_cnt++; + } else { bio_list_add(&conf->pending_bio_list, mbio); conf->pending_count++; - spin_unlock_irqrestore(&conf->device_lock, flags); - if (!mddev_check_plugged(mddev)) - md_wakeup_thread(mddev->thread); } + spin_unlock_irqrestore(&conf->device_lock, flags); + if (!plug) + md_wakeup_thread(mddev->thread); + + if (!r10_bio->devs[i].repl_bio) + continue; + + mbio = bio_clone_mddev(bio, GFP_NOIO, mddev); + md_trim_bio(mbio, r10_bio->sector - bio->bi_sector, + max_sectors); + r10_bio->devs[i].repl_bio = mbio; + + /* We are actively writing to the original device + * so it cannot disappear, so the replacement cannot + * become NULL here + */ + mbio->bi_sector = (r10_bio->devs[i].addr + + choose_data_offset( + r10_bio, + conf->mirrors[d].replacement)); + mbio->bi_bdev = conf->mirrors[d].replacement->bdev; + mbio->bi_end_io = raid10_end_write_request; + mbio->bi_rw = WRITE | do_sync | do_fua | do_discard; + mbio->bi_private = r10_bio; + + atomic_inc(&r10_bio->remaining); + spin_lock_irqsave(&conf->device_lock, flags); + bio_list_add(&conf->pending_bio_list, mbio); + conf->pending_count++; + spin_unlock_irqrestore(&conf->device_lock, flags); + if (!mddev_check_plugged(mddev)) + md_wakeup_thread(mddev->thread); } /* Don't remove the bias on 'remaining' (one_write_done) until diff --git a/trunk/drivers/md/raid5.c b/trunk/drivers/md/raid5.c index a4502686e7a8..c5439dce0295 100644 --- a/trunk/drivers/md/raid5.c +++ b/trunk/drivers/md/raid5.c @@ -2774,12 +2774,10 @@ static void handle_stripe_clean_event(struct r5conf *conf, dev = &sh->dev[i]; if (!test_bit(R5_LOCKED, &dev->flags) && (test_bit(R5_UPTODATE, &dev->flags) || - test_bit(R5_Discard, &dev->flags))) { + test_and_clear_bit(R5_Discard, &dev->flags))) { /* We can return any write requests */ struct bio *wbi, *wbi2; pr_debug("Return write for disc %d\n", i); - if (test_and_clear_bit(R5_Discard, &dev->flags)) - clear_bit(R5_UPTODATE, &dev->flags); wbi = dev->written; dev->written = NULL; while (wbi && wbi->bi_sector < @@ -2797,8 +2795,7 @@ static void handle_stripe_clean_event(struct r5conf *conf, !test_bit(STRIPE_DEGRADED, &sh->state), 0); } - } else if (test_bit(R5_Discard, &sh->dev[i].flags)) - clear_bit(R5_Discard, &sh->dev[i].flags); + } if (test_and_clear_bit(STRIPE_FULL_WRITE, &sh->state)) if (atomic_dec_and_test(&conf->pending_full_writes)) @@ -3493,6 +3490,40 @@ static void handle_stripe(struct stripe_head *sh) handle_failed_sync(conf, sh, &s); } + /* + * might be able to return some write requests if the parity blocks + * are safe, or on a failed drive + */ + pdev = &sh->dev[sh->pd_idx]; + s.p_failed = (s.failed >= 1 && s.failed_num[0] == sh->pd_idx) + || (s.failed >= 2 && s.failed_num[1] == sh->pd_idx); + qdev = &sh->dev[sh->qd_idx]; + s.q_failed = (s.failed >= 1 && s.failed_num[0] == sh->qd_idx) + || (s.failed >= 2 && s.failed_num[1] == sh->qd_idx) + || conf->level < 6; + + if (s.written && + (s.p_failed || ((test_bit(R5_Insync, &pdev->flags) + && !test_bit(R5_LOCKED, &pdev->flags) + && (test_bit(R5_UPTODATE, &pdev->flags) || + test_bit(R5_Discard, &pdev->flags))))) && + (s.q_failed || ((test_bit(R5_Insync, &qdev->flags) + && !test_bit(R5_LOCKED, &qdev->flags) + && (test_bit(R5_UPTODATE, &qdev->flags) || + test_bit(R5_Discard, &qdev->flags)))))) + handle_stripe_clean_event(conf, sh, disks, &s.return_bi); + + /* Now we might consider reading some blocks, either to check/generate + * parity, or to satisfy requests + * or to load a block that is being partially written. + */ + if (s.to_read || s.non_overwrite + || (conf->level == 6 && s.to_write && s.failed) + || (s.syncing && (s.uptodate + s.compute < disks)) + || s.replacing + || s.expanding) + handle_stripe_fill(sh, &s, disks); + /* Now we check to see if any write operations have recently * completed */ @@ -3530,40 +3561,6 @@ static void handle_stripe(struct stripe_head *sh) s.dec_preread_active = 1; } - /* - * might be able to return some write requests if the parity blocks - * are safe, or on a failed drive - */ - pdev = &sh->dev[sh->pd_idx]; - s.p_failed = (s.failed >= 1 && s.failed_num[0] == sh->pd_idx) - || (s.failed >= 2 && s.failed_num[1] == sh->pd_idx); - qdev = &sh->dev[sh->qd_idx]; - s.q_failed = (s.failed >= 1 && s.failed_num[0] == sh->qd_idx) - || (s.failed >= 2 && s.failed_num[1] == sh->qd_idx) - || conf->level < 6; - - if (s.written && - (s.p_failed || ((test_bit(R5_Insync, &pdev->flags) - && !test_bit(R5_LOCKED, &pdev->flags) - && (test_bit(R5_UPTODATE, &pdev->flags) || - test_bit(R5_Discard, &pdev->flags))))) && - (s.q_failed || ((test_bit(R5_Insync, &qdev->flags) - && !test_bit(R5_LOCKED, &qdev->flags) - && (test_bit(R5_UPTODATE, &qdev->flags) || - test_bit(R5_Discard, &qdev->flags)))))) - handle_stripe_clean_event(conf, sh, disks, &s.return_bi); - - /* Now we might consider reading some blocks, either to check/generate - * parity, or to satisfy requests - * or to load a block that is being partially written. - */ - if (s.to_read || s.non_overwrite - || (conf->level == 6 && s.to_write && s.failed) - || (s.syncing && (s.uptodate + s.compute < disks)) - || s.replacing - || s.expanding) - handle_stripe_fill(sh, &s, disks); - /* Now to consider new write requests and what else, if anything * should be read. We do not handle new writes when: * 1/ A 'write' operation (copy+xor) is already in flight. @@ -5532,10 +5529,6 @@ static int run(struct mddev *mddev) * discard data disk but write parity disk */ stripe = stripe * PAGE_SIZE; - /* Round up to power of 2, as discard handling - * currently assumes that */ - while ((stripe-1) & stripe) - stripe = (stripe | (stripe-1)) + 1; mddev->queue->limits.discard_alignment = stripe; mddev->queue->limits.discard_granularity = stripe; /* diff --git a/trunk/drivers/mfd/Kconfig b/trunk/drivers/mfd/Kconfig index 05acef8c7641..acab3ef8a310 100644 --- a/trunk/drivers/mfd/Kconfig +++ b/trunk/drivers/mfd/Kconfig @@ -201,6 +201,7 @@ config MFD_TPS6586X depends on I2C=y && GENERIC_HARDIRQS select MFD_CORE select REGMAP_I2C + depends on REGULATOR help If you say yes here you get support for the TPS6586X series of Power Management chips. diff --git a/trunk/drivers/mfd/max8997.c b/trunk/drivers/mfd/max8997.c index abd5c80c7cf5..f123517065ec 100644 --- a/trunk/drivers/mfd/max8997.c +++ b/trunk/drivers/mfd/max8997.c @@ -21,10 +21,8 @@ * This driver is based on max8998.c */ -#include #include #include -#include #include #include #include @@ -49,13 +47,6 @@ static struct mfd_cell max8997_devs[] = { { .name = "max8997-led", .id = 2 }, }; -#ifdef CONFIG_OF -static struct of_device_id __devinitdata max8997_pmic_dt_match[] = { - { .compatible = "maxim,max8997-pmic", .data = TYPE_MAX8997 }, - {}, -}; -#endif - int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) { struct max8997_dev *max8997 = i2c_get_clientdata(i2c); @@ -132,58 +123,6 @@ int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) } EXPORT_SYMBOL_GPL(max8997_update_reg); -#ifdef CONFIG_OF -/* - * Only the common platform data elements for max8997 are parsed here from the - * device tree. Other sub-modules of max8997 such as pmic, rtc and others have - * to parse their own platform data elements from device tree. - * - * The max8997 platform data structure is instantiated here and the drivers for - * the sub-modules need not instantiate another instance while parsing their - * platform data. - */ -static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( - struct device *dev) -{ - struct max8997_platform_data *pd; - - pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); - if (!pd) { - dev_err(dev, "could not allocate memory for pdata\n"); - return ERR_PTR(-ENOMEM); - } - - pd->ono = irq_of_parse_and_map(dev->of_node, 1); - - /* - * ToDo: the 'wakeup' member in the platform data is more of a linux - * specfic information. Hence, there is no binding for that yet and - * not parsed here. - */ - - return pd; -} -#else -static struct max8997_platform_data *max8997_i2c_parse_dt_pdata( - struct device *dev) -{ - return 0; -} -#endif - -static inline int max8997_i2c_get_driver_data(struct i2c_client *i2c, - const struct i2c_device_id *id) -{ -#ifdef CONFIG_OF - if (i2c->dev.of_node) { - const struct of_device_id *match; - match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node); - return (int)match->data; - } -#endif - return (int)id->driver_data; -} - static int max8997_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { @@ -198,21 +137,12 @@ static int max8997_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, max8997); max8997->dev = &i2c->dev; max8997->i2c = i2c; - max8997->type = max8997_i2c_get_driver_data(i2c, id); + max8997->type = id->driver_data; max8997->irq = i2c->irq; - if (max8997->dev->of_node) { - pdata = max8997_i2c_parse_dt_pdata(max8997->dev); - if (IS_ERR(pdata)) { - ret = PTR_ERR(pdata); - goto err; - } - } - if (!pdata) goto err; - max8997->pdata = pdata; max8997->ono = pdata->ono; mutex_init(&max8997->iolock); @@ -504,7 +434,6 @@ static struct i2c_driver max8997_i2c_driver = { .name = "max8997", .owner = THIS_MODULE, .pm = &max8997_pm, - .of_match_table = of_match_ptr(max8997_pmic_dt_match), }, .probe = max8997_i2c_probe, .remove = max8997_i2c_remove, diff --git a/trunk/drivers/mfd/tps6586x.c b/trunk/drivers/mfd/tps6586x.c index 9d67bd92edf8..467464368773 100644 --- a/trunk/drivers/mfd/tps6586x.c +++ b/trunk/drivers/mfd/tps6586x.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include @@ -96,9 +98,6 @@ static struct mfd_cell tps6586x_cell[] = { { .name = "tps6586x-gpio", }, - { - .name = "tps6586x-pmic", - }, { .name = "tps6586x-rtc", }, @@ -351,19 +350,80 @@ static int __devinit tps6586x_add_subdevs(struct tps6586x *tps6586x, } #ifdef CONFIG_OF +static struct of_regulator_match tps6586x_matches[] = { + { .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS }, + { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, + { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, + { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, + { .name = "ldo0", .driver_data = (void *)TPS6586X_ID_LDO_0 }, + { .name = "ldo1", .driver_data = (void *)TPS6586X_ID_LDO_1 }, + { .name = "ldo2", .driver_data = (void *)TPS6586X_ID_LDO_2 }, + { .name = "ldo3", .driver_data = (void *)TPS6586X_ID_LDO_3 }, + { .name = "ldo4", .driver_data = (void *)TPS6586X_ID_LDO_4 }, + { .name = "ldo5", .driver_data = (void *)TPS6586X_ID_LDO_5 }, + { .name = "ldo6", .driver_data = (void *)TPS6586X_ID_LDO_6 }, + { .name = "ldo7", .driver_data = (void *)TPS6586X_ID_LDO_7 }, + { .name = "ldo8", .driver_data = (void *)TPS6586X_ID_LDO_8 }, + { .name = "ldo9", .driver_data = (void *)TPS6586X_ID_LDO_9 }, + { .name = "ldo_rtc", .driver_data = (void *)TPS6586X_ID_LDO_RTC }, +}; + static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client) { + const unsigned int num = ARRAY_SIZE(tps6586x_matches); struct device_node *np = client->dev.of_node; struct tps6586x_platform_data *pdata; + struct tps6586x_subdev_info *devs; + struct device_node *regs; + const char *sys_rail_name = NULL; + unsigned int count; + unsigned int i, j; + int err; + + regs = of_find_node_by_name(np, "regulators"); + if (!regs) + return NULL; - pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - dev_err(&client->dev, "Memory allocation failed\n"); + err = of_regulator_match(&client->dev, regs, tps6586x_matches, num); + if (err < 0) { + of_node_put(regs); return NULL; } - pdata->num_subdevs = 0; - pdata->subdevs = NULL; + of_node_put(regs); + count = err; + + devs = devm_kzalloc(&client->dev, count * sizeof(*devs), GFP_KERNEL); + if (!devs) + return NULL; + + for (i = 0, j = 0; i < num && j < count; i++) { + struct regulator_init_data *reg_idata; + + if (!tps6586x_matches[i].init_data) + continue; + + reg_idata = tps6586x_matches[i].init_data; + devs[j].name = "tps6586x-regulator"; + devs[j].platform_data = tps6586x_matches[i].init_data; + devs[j].id = (int)tps6586x_matches[i].driver_data; + if (devs[j].id == TPS6586X_ID_SYS) + sys_rail_name = reg_idata->constraints.name; + + if ((devs[j].id == TPS6586X_ID_LDO_5) || + (devs[j].id == TPS6586X_ID_LDO_RTC)) + reg_idata->supply_regulator = sys_rail_name; + + devs[j].of_node = tps6586x_matches[i].of_node; + j++; + } + + pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return NULL; + + pdata->num_subdevs = count; + pdata->subdevs = devs; pdata->gpio_base = -1; pdata->irq_base = -1; pdata->pm_off = of_property_read_bool(np, "ti,system-power-controller"); diff --git a/trunk/drivers/mfd/wm5102-tables.c b/trunk/drivers/mfd/wm5102-tables.c index b829a5710ddc..01b9255ed631 100644 --- a/trunk/drivers/mfd/wm5102-tables.c +++ b/trunk/drivers/mfd/wm5102-tables.c @@ -775,7 +775,6 @@ static const struct reg_default wm5102_reg_default[] = { { 0x00000154, 0x0000 }, /* R340 - Rate Estimator 3 */ { 0x00000155, 0x0000 }, /* R341 - Rate Estimator 4 */ { 0x00000156, 0x0000 }, /* R342 - Rate Estimator 5 */ - { 0x00000161, 0x0000 }, /* R353 - Dynamic Frequency Scaling 1 */ { 0x00000171, 0x0000 }, /* R369 - FLL1 Control 1 */ { 0x00000172, 0x0008 }, /* R370 - FLL1 Control 2 */ { 0x00000173, 0x0018 }, /* R371 - FLL1 Control 3 */ @@ -1565,7 +1564,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg) case ARIZONA_RATE_ESTIMATOR_3: case ARIZONA_RATE_ESTIMATOR_4: case ARIZONA_RATE_ESTIMATOR_5: - case ARIZONA_DYNAMIC_FREQUENCY_SCALING_1: case ARIZONA_FLL1_CONTROL_1: case ARIZONA_FLL1_CONTROL_2: case ARIZONA_FLL1_CONTROL_3: @@ -1598,7 +1596,6 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg) case ARIZONA_FLL2_GPIO_CLOCK: case ARIZONA_MIC_CHARGE_PUMP_1: case ARIZONA_LDO1_CONTROL_1: - case ARIZONA_LDO1_CONTROL_2: case ARIZONA_LDO2_CONTROL_1: case ARIZONA_MIC_BIAS_CTRL_1: case ARIZONA_MIC_BIAS_CTRL_2: diff --git a/trunk/drivers/mtd/devices/slram.c b/trunk/drivers/mtd/devices/slram.c index 5a5cd2ace4a6..8f52fc858e48 100644 --- a/trunk/drivers/mtd/devices/slram.c +++ b/trunk/drivers/mtd/devices/slram.c @@ -240,7 +240,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) if (*(szlength) != '+') { devlength = simple_strtoul(szlength, &buffer, 0); - devlength = handle_unit(devlength, buffer); + devlength = handle_unit(devlength, buffer) - devstart; if (devlength < devstart) goto err_out; diff --git a/trunk/drivers/mtd/nand/nand_base.c b/trunk/drivers/mtd/nand/nand_base.c index 1a03b7f673ce..ec6841d8e956 100644 --- a/trunk/drivers/mtd/nand/nand_base.c +++ b/trunk/drivers/mtd/nand/nand_base.c @@ -2983,15 +2983,13 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip, /* * Field definitions are in the following datasheets: * Old style (4,5 byte ID): Samsung K9GAG08U0M (p.32) - * New Samsung (6 byte ID): Samsung K9GAG08U0F (p.44) + * New style (6 byte ID): Samsung K9GAG08U0F (p.44) * Hynix MLC (6 byte ID): Hynix H27UBG8T2B (p.22) * - * Check for ID length, non-zero 6th byte, cell type, and Hynix/Samsung - * ID to decide what to do. + * Check for ID length, cell type, and Hynix/Samsung ID to decide what + * to do. */ - if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG && - (chip->cellinfo & NAND_CI_CELLTYPE_MSK) && - id_data[5] != 0x00) { + if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG) { /* Calc pagesize */ mtd->writesize = 2048 << (extid & 0x03); extid >>= 2; diff --git a/trunk/drivers/mtd/ofpart.c b/trunk/drivers/mtd/ofpart.c index d9127e2ed808..64be8f0848b0 100644 --- a/trunk/drivers/mtd/ofpart.c +++ b/trunk/drivers/mtd/ofpart.c @@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master, nr_parts = plen / sizeof(part[0]); *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL); - if (!*pparts) + if (!pparts) return -ENOMEM; names = of_get_property(dp, "partition-names", &plen); diff --git a/trunk/drivers/mtd/onenand/onenand_base.c b/trunk/drivers/mtd/onenand/onenand_base.c index b3f41f200622..7153e0d27101 100644 --- a/trunk/drivers/mtd/onenand/onenand_base.c +++ b/trunk/drivers/mtd/onenand/onenand_base.c @@ -3694,7 +3694,7 @@ static int flexonenand_check_blocks_erased(struct mtd_info *mtd, int start, int * flexonenand_set_boundary - Writes the SLC boundary * @param mtd - mtd info structure */ -static int flexonenand_set_boundary(struct mtd_info *mtd, int die, +int flexonenand_set_boundary(struct mtd_info *mtd, int die, int boundary, int lock) { struct onenand_chip *this = mtd->priv; diff --git a/trunk/drivers/net/bonding/bond_main.c b/trunk/drivers/net/bonding/bond_main.c index 5f5b69f37d2e..b2530b002125 100644 --- a/trunk/drivers/net/bonding/bond_main.c +++ b/trunk/drivers/net/bonding/bond_main.c @@ -1379,8 +1379,6 @@ static void bond_compute_features(struct bonding *bond) struct net_device *bond_dev = bond->dev; netdev_features_t vlan_features = BOND_VLAN_FEATURES; unsigned short max_hard_header_len = ETH_HLEN; - unsigned int gso_max_size = GSO_MAX_SIZE; - u16 gso_max_segs = GSO_MAX_SEGS; int i; unsigned int flags, dst_release_flag = IFF_XMIT_DST_RELEASE; @@ -1396,16 +1394,11 @@ static void bond_compute_features(struct bonding *bond) dst_release_flag &= slave->dev->priv_flags; if (slave->dev->hard_header_len > max_hard_header_len) max_hard_header_len = slave->dev->hard_header_len; - - gso_max_size = min(gso_max_size, slave->dev->gso_max_size); - gso_max_segs = min(gso_max_segs, slave->dev->gso_max_segs); } done: bond_dev->vlan_features = vlan_features; bond_dev->hard_header_len = max_hard_header_len; - bond_dev->gso_max_segs = gso_max_segs; - netif_set_gso_max_size(bond_dev, gso_max_size); flags = bond_dev->priv_flags & ~IFF_XMIT_DST_RELEASE; bond_dev->priv_flags = flags | dst_release_flag; diff --git a/trunk/drivers/net/ethernet/8390/ne.c b/trunk/drivers/net/ethernet/8390/ne.c index 47618e505355..d04911d33b64 100644 --- a/trunk/drivers/net/ethernet/8390/ne.c +++ b/trunk/drivers/net/ethernet/8390/ne.c @@ -813,7 +813,6 @@ static int __init ne_drv_probe(struct platform_device *pdev) dev->irq = irq[this_dev]; dev->mem_end = bad[this_dev]; } - SET_NETDEV_DEV(dev, &pdev->dev); err = do_ne_probe(dev); if (err) { free_netdev(dev); diff --git a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 01611b33a93d..bd1fd3d87c24 100644 --- a/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -9545,13 +9545,10 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) */ static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp) { - if (!CHIP_IS_E1x(bp)) { - u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS); - if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) { - BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing"); - REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, - 1 << BP_FUNC(bp)); - } + u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS); + if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) { + BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing"); + REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp)); } } diff --git a/trunk/drivers/net/ethernet/realtek/8139cp.c b/trunk/drivers/net/ethernet/realtek/8139cp.c index b01f83a044c4..1c818254b7be 100644 --- a/trunk/drivers/net/ethernet/realtek/8139cp.c +++ b/trunk/drivers/net/ethernet/realtek/8139cp.c @@ -979,6 +979,17 @@ static void cp_init_hw (struct cp_private *cp) cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0))); cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4))); + cpw32_f(HiTxRingAddr, 0); + cpw32_f(HiTxRingAddr + 4, 0); + + ring_dma = cp->ring_dma; + cpw32_f(RxRingAddr, ring_dma & 0xffffffff); + cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16); + + ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE; + cpw32_f(TxRingAddr, ring_dma & 0xffffffff); + cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16); + cp_start_hw(cp); cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */ @@ -992,17 +1003,6 @@ static void cp_init_hw (struct cp_private *cp) cpw8(Config5, cpr8(Config5) & PMEStatus); - cpw32_f(HiTxRingAddr, 0); - cpw32_f(HiTxRingAddr + 4, 0); - - ring_dma = cp->ring_dma; - cpw32_f(RxRingAddr, ring_dma & 0xffffffff); - cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16); - - ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE; - cpw32_f(TxRingAddr, ring_dma & 0xffffffff); - cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16); - cpw16(MultiIntr, 0); cpw8_f(Cfg9346, Cfg9346_Lock); diff --git a/trunk/drivers/net/ethernet/sis/sis900.c b/trunk/drivers/net/ethernet/sis/sis900.c index edf5edb13140..fb9f6b38511f 100644 --- a/trunk/drivers/net/ethernet/sis/sis900.c +++ b/trunk/drivers/net/ethernet/sis/sis900.c @@ -2479,7 +2479,7 @@ static int sis900_resume(struct pci_dev *pci_dev) netif_start_queue(net_dev); /* Workaround for EDB */ - sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); + sis900_set_mode(ioaddr, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); /* Enable all known interrupts by setting the interrupt mask. */ sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); diff --git a/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index a788501e978e..77e6db9dcfed 100644 --- a/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/trunk/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -894,8 +894,6 @@ static irqreturn_t axienet_rx_irq(int irq, void *_ndev) return IRQ_HANDLED; } -static void axienet_dma_err_handler(unsigned long data); - /** * axienet_open - Driver open routine. * @ndev: Pointer to net_device structure diff --git a/trunk/drivers/net/ethernet/xscale/ixp4xx_eth.c b/trunk/drivers/net/ethernet/xscale/ixp4xx_eth.c index 477d6729b17f..98934bdf6acf 100644 --- a/trunk/drivers/net/ethernet/xscale/ixp4xx_eth.c +++ b/trunk/drivers/net/ethernet/xscale/ixp4xx_eth.c @@ -1102,12 +1102,10 @@ static int init_queues(struct port *port) { int i; - if (!ports_open) { - dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev, - POOL_ALLOC_SIZE, 32, 0); - if (!dma_pool) + if (!ports_open) + if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, + POOL_ALLOC_SIZE, 32, 0))) return -ENOMEM; - } if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, &port->desc_tab_phys))) diff --git a/trunk/drivers/net/irda/sir_dev.c b/trunk/drivers/net/irda/sir_dev.c index 43e9ab4f4d7e..5039f08f5a5b 100644 --- a/trunk/drivers/net/irda/sir_dev.c +++ b/trunk/drivers/net/irda/sir_dev.c @@ -222,7 +222,7 @@ static void sirdev_config_fsm(struct work_struct *work) break; case SIRDEV_STATE_DONGLE_SPEED: - if (dev->dongle_drv->set_speed) { + if (dev->dongle_drv->reset) { ret = dev->dongle_drv->set_speed(dev, fsm->param); if (ret < 0) { fsm->result = ret; diff --git a/trunk/drivers/net/phy/mdio-gpio.c b/trunk/drivers/net/phy/mdio-gpio.c index 2ed1140df3e9..899274f2f9b1 100644 --- a/trunk/drivers/net/phy/mdio-gpio.c +++ b/trunk/drivers/net/phy/mdio-gpio.c @@ -185,20 +185,17 @@ static int __devinit mdio_gpio_probe(struct platform_device *pdev) { struct mdio_gpio_platform_data *pdata; struct mii_bus *new_bus; - int ret, bus_id; + int ret; - if (pdev->dev.of_node) { + if (pdev->dev.of_node) pdata = mdio_gpio_of_get_data(pdev); - bus_id = of_alias_get_id(pdev->dev.of_node, "mdio-gpio"); - } else { + else pdata = pdev->dev.platform_data; - bus_id = pdev->id; - } if (!pdata) return -ENODEV; - new_bus = mdio_gpio_bus_init(&pdev->dev, pdata, bus_id); + new_bus = mdio_gpio_bus_init(&pdev->dev, pdata, pdev->id); if (!new_bus) return -ENODEV; diff --git a/trunk/drivers/net/team/team_mode_broadcast.c b/trunk/drivers/net/team/team_mode_broadcast.c index c5db428e73fa..9db0171e9366 100644 --- a/trunk/drivers/net/team/team_mode_broadcast.c +++ b/trunk/drivers/net/team/team_mode_broadcast.c @@ -29,8 +29,8 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb) if (last) { skb2 = skb_clone(skb, GFP_ATOMIC); if (skb2) { - ret = !team_dev_queue_xmit(team, last, - skb2); + ret = team_dev_queue_xmit(team, last, + skb2); if (!sum_ret) sum_ret = ret; } @@ -39,7 +39,7 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb) } } if (last) { - ret = !team_dev_queue_xmit(team, last, skb); + ret = team_dev_queue_xmit(team, last, skb); if (!sum_ret) sum_ret = ret; } diff --git a/trunk/drivers/net/wan/ixp4xx_hss.c b/trunk/drivers/net/wan/ixp4xx_hss.c index e9a3da588e95..3f575afd8cfc 100644 --- a/trunk/drivers/net/wan/ixp4xx_hss.c +++ b/trunk/drivers/net/wan/ixp4xx_hss.c @@ -969,12 +969,10 @@ static int init_hdlc_queues(struct port *port) { int i; - if (!ports_open) { - dma_pool = dma_pool_create(DRV_NAME, &port->netdev->dev, - POOL_ALLOC_SIZE, 32, 0); - if (!dma_pool) + if (!ports_open) + if (!(dma_pool = dma_pool_create(DRV_NAME, NULL, + POOL_ALLOC_SIZE, 32, 0))) return -ENOMEM; - } if (!(port->desc_tab = dma_pool_alloc(dma_pool, GFP_KERNEL, &port->desc_tab_phys))) diff --git a/trunk/drivers/net/wireless/ath/ath9k/hw.c b/trunk/drivers/net/wireless/ath/ath9k/hw.c index 1829b445d0b0..8e1559aba495 100644 --- a/trunk/drivers/net/wireless/ath/ath9k/hw.c +++ b/trunk/drivers/net/wireless/ath/ath9k/hw.c @@ -1456,7 +1456,7 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type) switch (type) { case ATH9K_RESET_POWER_ON: ret = ath9k_hw_set_reset_power_on(ah); - if (ret) + if (!ret) ah->reset_power_on = true; break; case ATH9K_RESET_WARM: diff --git a/trunk/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/trunk/drivers/net/wireless/iwlwifi/dvm/mac80211.c index 2d9eee93c743..fa4d1b8cd9f6 100644 --- a/trunk/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/trunk/drivers/net/wireless/iwlwifi/dvm/mac80211.c @@ -1354,20 +1354,6 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, vif_priv->ctx = ctx; ctx->vif = vif; - /* - * In SNIFFER device type, the firmware reports the FCS to - * the host, rather than snipping it off. Unfortunately, - * mac80211 doesn't (yet) provide a per-packet flag for - * this, so that we have to set the hardware flag based - * on the interfaces added. As the monitor interface can - * only be present by itself, and will be removed before - * other interfaces are added, this is safe. - */ - if (vif->type == NL80211_IFTYPE_MONITOR) - priv->hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS; - else - priv->hw->flags &= ~IEEE80211_HW_RX_INCLUDES_FCS; - err = iwl_setup_interface(priv, ctx); if (!err || reset) goto out; diff --git a/trunk/drivers/net/wireless/iwlwifi/pcie/tx.c b/trunk/drivers/net/wireless/iwlwifi/pcie/tx.c index 79a4ddc002d3..105e3af3c621 100644 --- a/trunk/drivers/net/wireless/iwlwifi/pcie/tx.c +++ b/trunk/drivers/net/wireless/iwlwifi/pcie/tx.c @@ -480,12 +480,20 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo, void iwl_trans_pcie_txq_disable(struct iwl_trans *trans, int txq_id) { struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); + u16 rd_ptr, wr_ptr; + int n_bd = trans_pcie->txq[txq_id].q.n_bd; if (!test_and_clear_bit(txq_id, trans_pcie->queue_used)) { WARN_ONCE(1, "queue %d not used", txq_id); return; } + rd_ptr = iwl_read_prph(trans, SCD_QUEUE_RDPTR(txq_id)) & (n_bd - 1); + wr_ptr = iwl_read_prph(trans, SCD_QUEUE_WRPTR(txq_id)); + + WARN_ONCE(rd_ptr != wr_ptr, "queue %d isn't empty: [%d,%d]", + txq_id, rd_ptr, wr_ptr); + iwl_txq_set_inactive(trans, txq_id); IWL_DEBUG_TX_QUEUES(trans, "Deactivate queue %d\n", txq_id); } diff --git a/trunk/drivers/net/wireless/mwifiex/cmdevt.c b/trunk/drivers/net/wireless/mwifiex/cmdevt.c index ae9010ed58de..8d465107f52b 100644 --- a/trunk/drivers/net/wireless/mwifiex/cmdevt.c +++ b/trunk/drivers/net/wireless/mwifiex/cmdevt.c @@ -890,6 +890,9 @@ mwifiex_cmd_timeout_func(unsigned long function_context) return; } cmd_node = adapter->curr_cmd; + if (cmd_node->wait_q_enabled) + adapter->cmd_wait_q.status = -ETIMEDOUT; + if (cmd_node) { adapter->dbg.timeout_cmd_id = adapter->dbg.last_cmd_id[adapter->dbg.last_cmd_index]; @@ -935,14 +938,6 @@ mwifiex_cmd_timeout_func(unsigned long function_context) dev_err(adapter->dev, "ps_mode=%d ps_state=%d\n", adapter->ps_mode, adapter->ps_state); - - if (cmd_node->wait_q_enabled) { - adapter->cmd_wait_q.status = -ETIMEDOUT; - wake_up_interruptible(&adapter->cmd_wait_q.wait); - mwifiex_cancel_pending_ioctl(adapter); - /* reset cmd_sent flag to unblock new commands */ - adapter->cmd_sent = false; - } } if (adapter->hw_status == MWIFIEX_HW_STATUS_INITIALIZING) mwifiex_init_fw_complete(adapter); diff --git a/trunk/drivers/net/wireless/mwifiex/sdio.c b/trunk/drivers/net/wireless/mwifiex/sdio.c index 82cf0fa2d9f6..fc8a9bfa1248 100644 --- a/trunk/drivers/net/wireless/mwifiex/sdio.c +++ b/trunk/drivers/net/wireless/mwifiex/sdio.c @@ -161,6 +161,7 @@ static int mwifiex_sdio_suspend(struct device *dev) struct sdio_mmc_card *card; struct mwifiex_adapter *adapter; mmc_pm_flag_t pm_flag = 0; + int hs_actived = 0; int i; int ret = 0; @@ -187,14 +188,12 @@ static int mwifiex_sdio_suspend(struct device *dev) adapter = card->adapter; /* Enable the Host Sleep */ - if (!mwifiex_enable_hs(adapter)) { - dev_err(adapter->dev, "cmd: failed to suspend\n"); - return -EFAULT; + hs_actived = mwifiex_enable_hs(adapter); + if (hs_actived) { + pr_debug("cmd: suspend with MMC_PM_KEEP_POWER\n"); + ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); } - dev_dbg(adapter->dev, "cmd: suspend with MMC_PM_KEEP_POWER\n"); - ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); - /* Indicate device suspended */ adapter->is_suspended = true; diff --git a/trunk/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/trunk/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index b7e6607e6b6d..9970c2b1b199 100644 --- a/trunk/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/trunk/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c @@ -297,7 +297,6 @@ static struct usb_device_id rtl8192c_usb_ids[] = { /*=== Customer ID ===*/ /****** 8188CU ********/ {RTL_USB_DEVICE(0x050d, 0x1102, rtl92cu_hal_cfg)}, /*Belkin - Edimax*/ - {RTL_USB_DEVICE(0x050d, 0x11f2, rtl92cu_hal_cfg)}, /*Belkin - ISY*/ {RTL_USB_DEVICE(0x06f8, 0xe033, rtl92cu_hal_cfg)}, /*Hercules - Edimax*/ {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ diff --git a/trunk/drivers/net/xen-netfront.c b/trunk/drivers/net/xen-netfront.c index fc24eb9b3948..caa011008cd0 100644 --- a/trunk/drivers/net/xen-netfront.c +++ b/trunk/drivers/net/xen-netfront.c @@ -452,85 +452,29 @@ static void xennet_make_frags(struct sk_buff *skb, struct net_device *dev, /* Grant backend access to each skb fragment page. */ for (i = 0; i < frags; i++) { skb_frag_t *frag = skb_shinfo(skb)->frags + i; - struct page *page = skb_frag_page(frag); - len = skb_frag_size(frag); - offset = frag->page_offset; - - /* Data must not cross a page boundary. */ - BUG_ON(len + offset > PAGE_SIZE<> PAGE_SHIFT; - offset &= ~PAGE_MASK; - - while (len > 0) { - unsigned long bytes; - - BUG_ON(offset >= PAGE_SIZE); - - bytes = PAGE_SIZE - offset; - if (bytes > len) - bytes = len; - - tx->flags |= XEN_NETTXF_more_data; - - id = get_id_from_freelist(&np->tx_skb_freelist, - np->tx_skbs); - np->tx_skbs[id].skb = skb_get(skb); - tx = RING_GET_REQUEST(&np->tx, prod++); - tx->id = id; - ref = gnttab_claim_grant_reference(&np->gref_tx_head); - BUG_ON((signed short)ref < 0); - - mfn = pfn_to_mfn(page_to_pfn(page)); - gnttab_grant_foreign_access_ref(ref, - np->xbdev->otherend_id, - mfn, GNTMAP_readonly); + tx->flags |= XEN_NETTXF_more_data; - tx->gref = np->grant_tx_ref[id] = ref; - tx->offset = offset; - tx->size = bytes; - tx->flags = 0; + id = get_id_from_freelist(&np->tx_skb_freelist, np->tx_skbs); + np->tx_skbs[id].skb = skb_get(skb); + tx = RING_GET_REQUEST(&np->tx, prod++); + tx->id = id; + ref = gnttab_claim_grant_reference(&np->gref_tx_head); + BUG_ON((signed short)ref < 0); - offset += bytes; - len -= bytes; + mfn = pfn_to_mfn(page_to_pfn(skb_frag_page(frag))); + gnttab_grant_foreign_access_ref(ref, np->xbdev->otherend_id, + mfn, GNTMAP_readonly); - /* Next frame */ - if (offset == PAGE_SIZE && len) { - BUG_ON(!PageCompound(page)); - page++; - offset = 0; - } - } + tx->gref = np->grant_tx_ref[id] = ref; + tx->offset = frag->page_offset; + tx->size = skb_frag_size(frag); + tx->flags = 0; } np->tx.req_prod_pvt = prod; } -/* - * Count how many ring slots are required to send the frags of this - * skb. Each frag might be a compound page. - */ -static int xennet_count_skb_frag_slots(struct sk_buff *skb) -{ - int i, frags = skb_shinfo(skb)->nr_frags; - int pages = 0; - - for (i = 0; i < frags; i++) { - skb_frag_t *frag = skb_shinfo(skb)->frags + i; - unsigned long size = skb_frag_size(frag); - unsigned long offset = frag->page_offset; - - /* Skip unused frames from start of page */ - offset &= ~PAGE_MASK; - - pages += PFN_UP(offset + size); - } - - return pages; -} - static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) { unsigned short id; @@ -543,23 +487,23 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) grant_ref_t ref; unsigned long mfn; int notify; - int slots; + int frags = skb_shinfo(skb)->nr_frags; unsigned int offset = offset_in_page(data); unsigned int len = skb_headlen(skb); unsigned long flags; - slots = DIV_ROUND_UP(offset + len, PAGE_SIZE) + - xennet_count_skb_frag_slots(skb); - if (unlikely(slots > MAX_SKB_FRAGS + 1)) { - net_alert_ratelimited( - "xennet: skb rides the rocket: %d slots\n", slots); + frags += DIV_ROUND_UP(offset + len, PAGE_SIZE); + if (unlikely(frags > MAX_SKB_FRAGS + 1)) { + printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n", + frags); + dump_stack(); goto drop; } spin_lock_irqsave(&np->tx_lock, flags); if (unlikely(!netif_carrier_ok(dev) || - (slots > 1 && !xennet_can_sg(dev)) || + (frags > 1 && !xennet_can_sg(dev)) || netif_needs_gso(skb, netif_skb_features(skb)))) { spin_unlock_irqrestore(&np->tx_lock, flags); goto drop; diff --git a/trunk/drivers/nfc/pn533.c b/trunk/drivers/nfc/pn533.c index 30ae18a03a9c..97c440a8cd61 100644 --- a/trunk/drivers/nfc/pn533.c +++ b/trunk/drivers/nfc/pn533.c @@ -698,14 +698,13 @@ static void pn533_wq_cmd(struct work_struct *work) cmd = list_first_entry(&dev->cmd_queue, struct pn533_cmd, queue); - list_del(&cmd->queue); - mutex_unlock(&dev->cmd_lock); __pn533_send_cmd_frame_async(dev, cmd->out_frame, cmd->in_frame, cmd->in_frame_len, cmd->cmd_complete, cmd->arg, cmd->flags); + list_del(&cmd->queue); kfree(cmd); } @@ -1679,14 +1678,11 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev, static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, u8 *params, int params_len) { + struct pn533_cmd_jump_dep *cmd; struct pn533_cmd_jump_dep_response *resp; struct nfc_target nfc_target; u8 target_gt_len; int rc; - struct pn533_cmd_jump_dep *cmd = (struct pn533_cmd_jump_dep *)arg; - u8 active = cmd->active; - - kfree(arg); if (params_len == -ENOENT) { nfc_dev_dbg(&dev->interface->dev, ""); @@ -1708,6 +1704,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, } resp = (struct pn533_cmd_jump_dep_response *) params; + cmd = (struct pn533_cmd_jump_dep *) arg; rc = resp->status & PN533_CMD_RET_MASK; if (rc != PN533_CMD_RET_SUCCESS) { nfc_dev_err(&dev->interface->dev, @@ -1737,7 +1734,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, if (rc == 0) rc = nfc_dep_link_is_up(dev->nfc_dev, dev->nfc_dev->targets[0].idx, - !active, NFC_RF_INITIATOR); + !cmd->active, NFC_RF_INITIATOR); return 0; } @@ -1822,8 +1819,12 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, rc = pn533_send_cmd_frame_async(dev, dev->out_frame, dev->in_frame, dev->in_maxlen, pn533_in_dep_link_up_complete, cmd, GFP_KERNEL); - if (rc < 0) - kfree(cmd); + if (rc) + goto out; + + +out: + kfree(cmd); return rc; } @@ -2077,12 +2078,8 @@ static int pn533_transceive(struct nfc_dev *nfc_dev, static int pn533_tm_send_complete(struct pn533 *dev, void *arg, u8 *params, int params_len) { - struct sk_buff *skb_out = arg; - nfc_dev_dbg(&dev->interface->dev, "%s", __func__); - dev_kfree_skb(skb_out); - if (params_len < 0) { nfc_dev_err(&dev->interface->dev, "Error %d when sending data", @@ -2120,7 +2117,7 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb) rc = pn533_send_cmd_frame_async(dev, out_frame, dev->in_frame, dev->in_maxlen, pn533_tm_send_complete, - skb, GFP_KERNEL); + NULL, GFP_KERNEL); if (rc) { nfc_dev_err(&dev->interface->dev, "Error %d when trying to send data", rc); diff --git a/trunk/drivers/pinctrl/Kconfig b/trunk/drivers/pinctrl/Kconfig index aeecf0f72cad..d96caefd914a 100644 --- a/trunk/drivers/pinctrl/Kconfig +++ b/trunk/drivers/pinctrl/Kconfig @@ -178,7 +178,7 @@ config PINCTRL_COH901 ports of 8 GPIO pins each. config PINCTRL_SAMSUNG - bool + bool "Samsung pinctrl driver" depends on OF && GPIOLIB select PINMUX select PINCONF diff --git a/trunk/drivers/regulator/88pm8607.c b/trunk/drivers/regulator/88pm8607.c index 2b557119adad..1c5ab0172ea2 100644 --- a/trunk/drivers/regulator/88pm8607.c +++ b/trunk/drivers/regulator/88pm8607.c @@ -394,7 +394,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, #define pm8607_regulator_dt_init(x, y, z) (-1) #endif -static int pm8607_regulator_probe(struct platform_device *pdev) +static int __devinit pm8607_regulator_probe(struct platform_device *pdev) { struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); struct pm8607_regulator_info *info = NULL; @@ -454,7 +454,7 @@ static int pm8607_regulator_probe(struct platform_device *pdev) return 0; } -static int pm8607_regulator_remove(struct platform_device *pdev) +static int __devexit pm8607_regulator_remove(struct platform_device *pdev) { struct pm8607_regulator_info *info = platform_get_drvdata(pdev); @@ -481,7 +481,7 @@ static struct platform_driver pm8607_regulator_driver = { .owner = THIS_MODULE, }, .probe = pm8607_regulator_probe, - .remove = pm8607_regulator_remove, + .remove = __devexit_p(pm8607_regulator_remove), .id_table = pm8607_regulator_driver_ids, }; diff --git a/trunk/drivers/regulator/Kconfig b/trunk/drivers/regulator/Kconfig index 551a22b07538..67d47b59a66d 100644 --- a/trunk/drivers/regulator/Kconfig +++ b/trunk/drivers/regulator/Kconfig @@ -109,16 +109,6 @@ config REGULATOR_DA9052 This driver supports the voltage regulators of DA9052-BC and DA9053-AA/Bx PMIC. -config REGULATOR_DA9055 - tristate "Dialog Semiconductor DA9055 regulators" - depends on MFD_DA9055 - help - Say y here to support the BUCKs and LDOs regulators found on - Dialog Semiconductor DA9055 PMIC. - - This driver can also be built as a module. If so, the module - will be called da9055-regulator. - config REGULATOR_FAN53555 tristate "Fairchild FAN53555 Regulator" depends on I2C @@ -214,16 +204,6 @@ config REGULATOR_MAX8952 via I2C bus. Maxim 8952 has one voltage output and supports 4 DVS modes ranging from 0.77V to 1.40V by 0.01V steps. -config REGULATOR_MAX8973 - tristate "Maxim MAX8973 voltage regulator " - depends on I2C - select REGMAP_I2C - help - The MAXIM MAX8973 high-efficiency. three phase, DC-DC step-down - switching regulator delievers up to 9A of output current. Each - phase operates at a 2MHz fixed frequency with a 120 deg shift - from the adjacent phase, allowing the use of small magnetic component. - config REGULATOR_MAX8997 tristate "Maxim 8997/8966 regulator" depends on MFD_MAX8997 @@ -355,17 +335,6 @@ config REGULATOR_PALMAS on the muxing. This is handled automatically in the driver by reading the mux info from OTP. -config REGULATOR_TPS51632 - tristate "TI TPS51632 Power Regulator" - depends on I2C - select REGMAP_I2C - help - This driver supports TPS51632 voltage regulator chip. - The TPS51632 is 3-2-1 Phase D-Cap+ Step Down Driverless Controller - with Serial VID control and DVFS. - The voltage output can be configure through I2C interface or PWM - interface. - config REGULATOR_TPS6105X tristate "TI TPS6105X Power regulators" depends on TPS6105X @@ -446,15 +415,6 @@ config REGULATOR_TPS65912 help This driver supports TPS65912 voltage regulator chip. -config REGULATOR_TPS80031 - tristate "TI TPS80031/TPS80032 power regualtor driver" - depends on MFD_TPS80031 - help - TPS80031/ TPS80032 Fully Integrated Power Management with Power - Path and Battery Charger. It has 5 configurable step-down - converters, 11 general purpose LDOs, VBUS generator and digital - output to control regulators. - config REGULATOR_TWL4030 bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC" depends on TWL4030_CORE @@ -462,13 +422,6 @@ config REGULATOR_TWL4030 This driver supports the voltage regulators provided by this family of companion chips. -config REGULATOR_VEXPRESS - tristate "Versatile Express regulators" - depends on VEXPRESS_CONFIG - help - This driver provides support for voltage regulators available - on the ARM Ltd's Versatile Express platform. - config REGULATOR_WM831X tristate "Wolfson Microelectronics WM831x PMIC regulators" depends on MFD_WM831X @@ -497,12 +450,5 @@ config REGULATOR_WM8994 This driver provides support for the voltage regulators on the WM8994 CODEC. -config REGULATOR_AS3711 - tristate "AS3711 PMIC" - depends on MFD_AS3711 - help - This driver provides support for the voltage regulators on the - AS3711 PMIC - endif diff --git a/trunk/drivers/regulator/Makefile b/trunk/drivers/regulator/Makefile index b802b0c7fb02..e431eed8a878 100644 --- a/trunk/drivers/regulator/Makefile +++ b/trunk/drivers/regulator/Makefile @@ -16,10 +16,8 @@ obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o -obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o -obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o @@ -36,7 +34,6 @@ obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o obj-$(CONFIG_REGULATOR_MAX8907) += max8907-regulator.o obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o -obj-$(CONFIG_REGULATOR_MAX8973) += max8973-regulator.o obj-$(CONFIG_REGULATOR_MAX8997) += max8997.o obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o obj-$(CONFIG_REGULATOR_MAX77686) += max77686.o @@ -44,7 +41,6 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o -obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o @@ -60,9 +56,7 @@ obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o -obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o -obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o diff --git a/trunk/drivers/regulator/aat2870-regulator.c b/trunk/drivers/regulator/aat2870-regulator.c index 8b5876356db9..167c93f21981 100644 --- a/trunk/drivers/regulator/aat2870-regulator.c +++ b/trunk/drivers/regulator/aat2870-regulator.c @@ -187,7 +187,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev) return 0; } -static int aat2870_regulator_remove(struct platform_device *pdev) +static int __devexit aat2870_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); @@ -201,7 +201,7 @@ static struct platform_driver aat2870_regulator_driver = { .owner = THIS_MODULE, }, .probe = aat2870_regulator_probe, - .remove = aat2870_regulator_remove, + .remove = __devexit_p(aat2870_regulator_remove), }; static int __init aat2870_regulator_init(void) diff --git a/trunk/drivers/regulator/ab3100.c b/trunk/drivers/regulator/ab3100.c index 111ec69a3e94..df4ad8927f0c 100644 --- a/trunk/drivers/regulator/ab3100.c +++ b/trunk/drivers/regulator/ab3100.c @@ -494,7 +494,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = { * for all the different regulators. */ -static int ab3100_regulators_probe(struct platform_device *pdev) +static int __devinit ab3100_regulators_probe(struct platform_device *pdev) { struct ab3100_platform_data *plfdata = pdev->dev.platform_data; struct regulator_config config = { }; @@ -571,7 +571,7 @@ static int ab3100_regulators_probe(struct platform_device *pdev) return 0; } -static int ab3100_regulators_remove(struct platform_device *pdev) +static int __devexit ab3100_regulators_remove(struct platform_device *pdev) { int i; @@ -589,7 +589,7 @@ static struct platform_driver ab3100_regulators_driver = { .owner = THIS_MODULE, }, .probe = ab3100_regulators_probe, - .remove = ab3100_regulators_remove, + .remove = __devexit_p(ab3100_regulators_remove), }; static __init int ab3100_regulators_init(void) diff --git a/trunk/drivers/regulator/ab8500.c b/trunk/drivers/regulator/ab8500.c index 09014f38a948..e3d1d063025a 100644 --- a/trunk/drivers/regulator/ab8500.c +++ b/trunk/drivers/regulator/ab8500.c @@ -641,7 +641,7 @@ static struct ab8500_reg_init ab8500_reg_init[] = { REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16), }; -static int +static __devinit int ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value) { int err; @@ -676,7 +676,7 @@ ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value) return 0; } -static int ab8500_regulator_register(struct platform_device *pdev, +static __devinit int ab8500_regulator_register(struct platform_device *pdev, struct regulator_init_data *init_data, int id, struct device_node *np) @@ -735,7 +735,7 @@ static struct of_regulator_match ab8500_regulator_matches[] = { { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, }, }; -static int +static __devinit int ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np) { int err, i; @@ -751,7 +751,7 @@ ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np) return 0; } -static int ab8500_regulator_probe(struct platform_device *pdev) +static __devinit int ab8500_regulator_probe(struct platform_device *pdev) { struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); struct ab8500_platform_data *pdata; @@ -817,7 +817,7 @@ static int ab8500_regulator_probe(struct platform_device *pdev) return 0; } -static int ab8500_regulator_remove(struct platform_device *pdev) +static __devexit int ab8500_regulator_remove(struct platform_device *pdev) { int i; @@ -836,7 +836,7 @@ static int ab8500_regulator_remove(struct platform_device *pdev) static struct platform_driver ab8500_regulator_driver = { .probe = ab8500_regulator_probe, - .remove = ab8500_regulator_remove, + .remove = __devexit_p(ab8500_regulator_remove), .driver = { .name = "ab8500-regulator", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/ad5398.c b/trunk/drivers/regulator/ad5398.c index 6b981b5faa70..f123f7e3b752 100644 --- a/trunk/drivers/regulator/ad5398.c +++ b/trunk/drivers/regulator/ad5398.c @@ -211,7 +211,7 @@ static const struct i2c_device_id ad5398_id[] = { }; MODULE_DEVICE_TABLE(i2c, ad5398_id); -static int ad5398_probe(struct i2c_client *client, +static int __devinit ad5398_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct regulator_init_data *init_data = client->dev.platform_data; @@ -256,7 +256,7 @@ static int ad5398_probe(struct i2c_client *client, return ret; } -static int ad5398_remove(struct i2c_client *client) +static int __devexit ad5398_remove(struct i2c_client *client) { struct ad5398_chip_info *chip = i2c_get_clientdata(client); @@ -266,7 +266,7 @@ static int ad5398_remove(struct i2c_client *client) static struct i2c_driver ad5398_driver = { .probe = ad5398_probe, - .remove = ad5398_remove, + .remove = __devexit_p(ad5398_remove), .driver = { .name = "ad5398", }, diff --git a/trunk/drivers/regulator/anatop-regulator.c b/trunk/drivers/regulator/anatop-regulator.c index 0199eeea63b1..1af97686f444 100644 --- a/trunk/drivers/regulator/anatop-regulator.c +++ b/trunk/drivers/regulator/anatop-regulator.c @@ -48,21 +48,36 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg, unsigned selector) { struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); + u32 val, mask; if (!anatop_reg->control_reg) return -ENOTSUPP; - return regulator_set_voltage_sel_regmap(reg, selector); + val = anatop_reg->min_bit_val + selector; + dev_dbg(®->dev, "%s: calculated val %d\n", __func__, val); + mask = ((1 << anatop_reg->vol_bit_width) - 1) << + anatop_reg->vol_bit_shift; + val <<= anatop_reg->vol_bit_shift; + regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg, + mask, val); + + return 0; } static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) { struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); + u32 val, mask; if (!anatop_reg->control_reg) return -ENOTSUPP; - return regulator_get_voltage_sel_regmap(reg); + regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val); + mask = ((1 << anatop_reg->vol_bit_width) - 1) << + anatop_reg->vol_bit_shift; + val = (val & mask) >> anatop_reg->vol_bit_shift; + + return val - anatop_reg->min_bit_val; } static struct regulator_ops anatop_rops = { @@ -72,7 +87,7 @@ static struct regulator_ops anatop_rops = { .map_voltage = regulator_map_voltage_linear, }; -static int anatop_regulator_probe(struct platform_device *pdev) +static int __devinit anatop_regulator_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; @@ -143,20 +158,15 @@ static int anatop_regulator_probe(struct platform_device *pdev) goto anatop_probe_end; } - rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) / 25000 + 1 - + sreg->min_bit_val; + rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) + / 25000 + 1; rdesc->min_uV = sreg->min_voltage; rdesc->uV_step = 25000; - rdesc->linear_min_sel = sreg->min_bit_val; - rdesc->vsel_reg = sreg->control_reg; - rdesc->vsel_mask = ((1 << sreg->vol_bit_width) - 1) << - sreg->vol_bit_shift; config.dev = &pdev->dev; config.init_data = initdata; config.driver_data = sreg; config.of_node = pdev->dev.of_node; - config.regmap = sreg->anatop; /* register regulator */ rdev = regulator_register(rdesc, &config); @@ -176,7 +186,7 @@ static int anatop_regulator_probe(struct platform_device *pdev) return ret; } -static int anatop_regulator_remove(struct platform_device *pdev) +static int __devexit anatop_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); struct anatop_regulator *sreg = rdev_get_drvdata(rdev); @@ -200,7 +210,7 @@ static struct platform_driver anatop_regulator_driver = { .of_match_table = of_anatop_regulator_match_tbl, }, .probe = anatop_regulator_probe, - .remove = anatop_regulator_remove, + .remove = __devexit_p(anatop_regulator_remove), }; static int __init anatop_regulator_init(void) diff --git a/trunk/drivers/regulator/arizona-ldo1.c b/trunk/drivers/regulator/arizona-ldo1.c index ed7beec53af8..d184aa35abcb 100644 --- a/trunk/drivers/regulator/arizona-ldo1.c +++ b/trunk/drivers/regulator/arizona-ldo1.c @@ -34,108 +34,6 @@ struct arizona_ldo1 { struct regulator_init_data init_data; }; -static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev, - unsigned int selector) -{ - if (selector >= rdev->desc->n_voltages) - return -EINVAL; - - if (selector == rdev->desc->n_voltages - 1) - return 1800000; - else - return rdev->desc->min_uV + (rdev->desc->uV_step * selector); -} - -static int arizona_ldo1_hc_map_voltage(struct regulator_dev *rdev, - int min_uV, int max_uV) -{ - int sel; - - sel = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step); - if (sel >= rdev->desc->n_voltages) - sel = rdev->desc->n_voltages - 1; - - return sel; -} - -static int arizona_ldo1_hc_set_voltage_sel(struct regulator_dev *rdev, - unsigned sel) -{ - struct arizona_ldo1 *ldo = rdev_get_drvdata(rdev); - struct regmap *regmap = ldo->arizona->regmap; - unsigned int val; - int ret; - - if (sel == rdev->desc->n_voltages - 1) - val = ARIZONA_LDO1_HI_PWR; - else - val = 0; - - ret = regmap_update_bits(regmap, ARIZONA_LDO1_CONTROL_2, - ARIZONA_LDO1_HI_PWR, val); - if (ret != 0) - return ret; - - ret = regmap_update_bits(regmap, ARIZONA_DYNAMIC_FREQUENCY_SCALING_1, - ARIZONA_SUBSYS_MAX_FREQ, val); - if (ret != 0) - return ret; - - if (val) - return 0; - - val = sel << ARIZONA_LDO1_VSEL_SHIFT; - - return regmap_update_bits(regmap, ARIZONA_LDO1_CONTROL_1, - ARIZONA_LDO1_VSEL_MASK, val); -} - -static int arizona_ldo1_hc_get_voltage_sel(struct regulator_dev *rdev) -{ - struct arizona_ldo1 *ldo = rdev_get_drvdata(rdev); - struct regmap *regmap = ldo->arizona->regmap; - unsigned int val; - int ret; - - ret = regmap_read(regmap, ARIZONA_LDO1_CONTROL_2, &val); - if (ret != 0) - return ret; - - if (val & ARIZONA_LDO1_HI_PWR) - return rdev->desc->n_voltages - 1; - - ret = regmap_read(regmap, ARIZONA_LDO1_CONTROL_1, &val); - if (ret != 0) - return ret; - - return (val & ARIZONA_LDO1_VSEL_MASK) >> ARIZONA_LDO1_VSEL_SHIFT; -} - -static struct regulator_ops arizona_ldo1_hc_ops = { - .list_voltage = arizona_ldo1_hc_list_voltage, - .map_voltage = arizona_ldo1_hc_map_voltage, - .get_voltage_sel = arizona_ldo1_hc_get_voltage_sel, - .set_voltage_sel = arizona_ldo1_hc_set_voltage_sel, - .get_bypass = regulator_get_bypass_regmap, - .set_bypass = regulator_set_bypass_regmap, -}; - -static const struct regulator_desc arizona_ldo1_hc = { - .name = "LDO1", - .supply_name = "LDOVDD", - .type = REGULATOR_VOLTAGE, - .ops = &arizona_ldo1_hc_ops, - - .bypass_reg = ARIZONA_LDO1_CONTROL_1, - .bypass_mask = ARIZONA_LDO1_BYPASS, - .min_uV = 900000, - .uV_step = 50000, - .n_voltages = 8, - .enable_time = 500, - - .owner = THIS_MODULE, -}; - static struct regulator_ops arizona_ldo1_ops = { .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, @@ -157,22 +55,11 @@ static const struct regulator_desc arizona_ldo1 = { .bypass_mask = ARIZONA_LDO1_BYPASS, .min_uV = 900000, .uV_step = 50000, - .n_voltages = 7, - .enable_time = 500, + .n_voltages = 6, .owner = THIS_MODULE, }; -static const struct regulator_init_data arizona_ldo1_dvfs = { - .constraints = { - .min_uV = 1200000, - .max_uV = 1800000, - .valid_ops_mask = REGULATOR_CHANGE_STATUS | - REGULATOR_CHANGE_VOLTAGE, - }, - .num_consumer_supplies = 1, -}; - static const struct regulator_init_data arizona_ldo1_default = { .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS, @@ -180,10 +67,9 @@ static const struct regulator_init_data arizona_ldo1_default = { .num_consumer_supplies = 1, }; -static int arizona_ldo1_probe(struct platform_device *pdev) +static __devinit int arizona_ldo1_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); - const struct regulator_desc *desc; struct regulator_config config = { }; struct arizona_ldo1 *ldo1; int ret; @@ -201,17 +87,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) * default init_data for it. This will be overridden with * platform data if provided. */ - switch (arizona->type) { - case WM5102: - desc = &arizona_ldo1_hc; - ldo1->init_data = arizona_ldo1_dvfs; - break; - default: - desc = &arizona_ldo1; - ldo1->init_data = arizona_ldo1_default; - break; - } - + ldo1->init_data = arizona_ldo1_default; ldo1->init_data.consumer_supplies = &ldo1->supply; ldo1->supply.supply = "DCVDD"; ldo1->supply.dev_name = dev_name(arizona->dev); @@ -226,7 +102,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) else config.init_data = &ldo1->init_data; - ldo1->regulator = regulator_register(desc, &config); + ldo1->regulator = regulator_register(&arizona_ldo1, &config); if (IS_ERR(ldo1->regulator)) { ret = PTR_ERR(ldo1->regulator); dev_err(arizona->dev, "Failed to register LDO1 supply: %d\n", @@ -239,7 +115,7 @@ static int arizona_ldo1_probe(struct platform_device *pdev) return 0; } -static int arizona_ldo1_remove(struct platform_device *pdev) +static __devexit int arizona_ldo1_remove(struct platform_device *pdev) { struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev); @@ -250,7 +126,7 @@ static int arizona_ldo1_remove(struct platform_device *pdev) static struct platform_driver arizona_ldo1_driver = { .probe = arizona_ldo1_probe, - .remove = arizona_ldo1_remove, + .remove = __devexit_p(arizona_ldo1_remove), .driver = { .name = "arizona-ldo1", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/arizona-micsupp.c b/trunk/drivers/regulator/arizona-micsupp.c index a6d040cbf8ac..d9b1f82cc5bd 100644 --- a/trunk/drivers/regulator/arizona-micsupp.c +++ b/trunk/drivers/regulator/arizona-micsupp.c @@ -101,8 +101,6 @@ static const struct regulator_desc arizona_micsupp = { .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, .bypass_mask = ARIZONA_CPMIC_BYPASS, - .enable_time = 3000, - .owner = THIS_MODULE, }; @@ -117,7 +115,7 @@ static const struct regulator_init_data arizona_micsupp_default = { .num_consumer_supplies = 1, }; -static int arizona_micsupp_probe(struct platform_device *pdev) +static __devinit int arizona_micsupp_probe(struct platform_device *pdev) { struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); struct regulator_config config = { }; @@ -168,7 +166,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev) return 0; } -static int arizona_micsupp_remove(struct platform_device *pdev) +static __devexit int arizona_micsupp_remove(struct platform_device *pdev) { struct arizona_micsupp *micsupp = platform_get_drvdata(pdev); @@ -179,7 +177,7 @@ static int arizona_micsupp_remove(struct platform_device *pdev) static struct platform_driver arizona_micsupp_driver = { .probe = arizona_micsupp_probe, - .remove = arizona_micsupp_remove, + .remove = __devexit_p(arizona_micsupp_remove), .driver = { .name = "arizona-micsupp", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/as3711-regulator.c b/trunk/drivers/regulator/as3711-regulator.c deleted file mode 100644 index 2f1341db38a0..000000000000 --- a/trunk/drivers/regulator/as3711-regulator.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * AS3711 PMIC regulator driver, using DCDC Step Down and LDO supplies - * - * Copyright (C) 2012 Renesas Electronics Corporation - * Author: Guennadi Liakhovetski, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the version 2 of the GNU General Public License as - * published by the Free Software Foundation - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -struct as3711_regulator_info { - struct regulator_desc desc; - unsigned int max_uV; -}; - -struct as3711_regulator { - struct as3711_regulator_info *reg_info; - struct regulator_dev *rdev; -}; - -static int as3711_list_voltage_sd(struct regulator_dev *rdev, - unsigned int selector) -{ - if (selector >= rdev->desc->n_voltages) - return -EINVAL; - - if (!selector) - return 0; - if (selector < 0x41) - return 600000 + selector * 12500; - if (selector < 0x71) - return 1400000 + (selector - 0x40) * 25000; - return 2600000 + (selector - 0x70) * 50000; -} - -static int as3711_list_voltage_aldo(struct regulator_dev *rdev, - unsigned int selector) -{ - if (selector >= rdev->desc->n_voltages) - return -EINVAL; - - if (selector < 0x10) - return 1200000 + selector * 50000; - return 1800000 + (selector - 0x10) * 100000; -} - -static int as3711_list_voltage_dldo(struct regulator_dev *rdev, - unsigned int selector) -{ - if (selector >= rdev->desc->n_voltages || - (selector > 0x10 && selector < 0x20)) - return -EINVAL; - - if (selector < 0x11) - return 900000 + selector * 50000; - return 1750000 + (selector - 0x20) * 50000; -} - -static int as3711_bound_check(struct regulator_dev *rdev, - int *min_uV, int *max_uV) -{ - struct as3711_regulator *reg = rdev_get_drvdata(rdev); - struct as3711_regulator_info *info = reg->reg_info; - - dev_dbg(&rdev->dev, "%s(), %d, %d, %d\n", __func__, - *min_uV, rdev->desc->min_uV, info->max_uV); - - if (*max_uV < *min_uV || - *min_uV > info->max_uV || rdev->desc->min_uV > *max_uV) - return -EINVAL; - - if (rdev->desc->n_voltages == 1) - return 0; - - if (*max_uV > info->max_uV) - *max_uV = info->max_uV; - - if (*min_uV < rdev->desc->min_uV) - *min_uV = rdev->desc->min_uV; - - return *min_uV; -} - -static int as3711_sel_check(int min, int max, int bottom, int step) -{ - int sel, voltage; - - /* Round up min, when dividing: keeps us within the range */ - sel = DIV_ROUND_UP(min - bottom, step); - voltage = sel * step + bottom; - pr_debug("%s(): select %d..%d in %d+N*%d: %d\n", __func__, - min, max, bottom, step, sel); - if (voltage > max) - return -EINVAL; - - return sel; -} - -static int as3711_map_voltage_sd(struct regulator_dev *rdev, - int min_uV, int max_uV) -{ - int ret; - - ret = as3711_bound_check(rdev, &min_uV, &max_uV); - if (ret <= 0) - return ret; - - if (min_uV <= 1400000) - return as3711_sel_check(min_uV, max_uV, 600000, 12500); - - if (min_uV <= 2600000) - return as3711_sel_check(min_uV, max_uV, 1400000, 25000) + 0x40; - - return as3711_sel_check(min_uV, max_uV, 2600000, 50000) + 0x70; -} - -/* - * The regulator API supports 4 modes of operataion: FAST, NORMAL, IDLE and - * STANDBY. We map them in the following way to AS3711 SD1-4 DCDC modes: - * FAST: sdX_fast=1 - * NORMAL: low_noise=1 - * IDLE: low_noise=0 - */ - -static int as3711_set_mode_sd(struct regulator_dev *rdev, unsigned int mode) -{ - unsigned int fast_bit = rdev->desc->enable_mask, - low_noise_bit = fast_bit << 4; - u8 val; - - switch (mode) { - case REGULATOR_MODE_FAST: - val = fast_bit | low_noise_bit; - break; - case REGULATOR_MODE_NORMAL: - val = low_noise_bit; - break; - case REGULATOR_MODE_IDLE: - val = 0; - break; - default: - return -EINVAL; - } - - return regmap_update_bits(rdev->regmap, AS3711_SD_CONTROL_1, - low_noise_bit | fast_bit, val); -} - -static unsigned int as3711_get_mode_sd(struct regulator_dev *rdev) -{ - unsigned int fast_bit = rdev->desc->enable_mask, - low_noise_bit = fast_bit << 4, mask = fast_bit | low_noise_bit; - unsigned int val; - int ret = regmap_read(rdev->regmap, AS3711_SD_CONTROL_1, &val); - - if (ret < 0) - return ret; - - if ((val & mask) == mask) - return REGULATOR_MODE_FAST; - - if ((val & mask) == low_noise_bit) - return REGULATOR_MODE_NORMAL; - - if (!(val & mask)) - return REGULATOR_MODE_IDLE; - - return -EINVAL; -} - -static int as3711_map_voltage_aldo(struct regulator_dev *rdev, - int min_uV, int max_uV) -{ - int ret; - - ret = as3711_bound_check(rdev, &min_uV, &max_uV); - if (ret <= 0) - return ret; - - if (min_uV <= 1800000) - return as3711_sel_check(min_uV, max_uV, 1200000, 50000); - - return as3711_sel_check(min_uV, max_uV, 1800000, 100000) + 0x10; -} - -static int as3711_map_voltage_dldo(struct regulator_dev *rdev, - int min_uV, int max_uV) -{ - int ret; - - ret = as3711_bound_check(rdev, &min_uV, &max_uV); - if (ret <= 0) - return ret; - - if (min_uV <= 1700000) - return as3711_sel_check(min_uV, max_uV, 900000, 50000); - - return as3711_sel_check(min_uV, max_uV, 1750000, 50000) + 0x20; -} - -static struct regulator_ops as3711_sd_ops = { - .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, - .list_voltage = as3711_list_voltage_sd, - .map_voltage = as3711_map_voltage_sd, - .get_mode = as3711_get_mode_sd, - .set_mode = as3711_set_mode_sd, -}; - -static struct regulator_ops as3711_aldo_ops = { - .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, - .list_voltage = as3711_list_voltage_aldo, - .map_voltage = as3711_map_voltage_aldo, -}; - -static struct regulator_ops as3711_dldo_ops = { - .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, - .list_voltage = as3711_list_voltage_dldo, - .map_voltage = as3711_map_voltage_dldo, -}; - -#define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx) \ - [AS3711_REGULATOR_ ## _id] = { \ - .desc = { \ - .name = "as3711-regulator-" # _id, \ - .id = AS3711_REGULATOR_ ## _id, \ - .n_voltages = (_vmask + 1), \ - .ops = &as3711_ ## _sfx ## _ops, \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ - .vsel_reg = AS3711_ ## _id ## _VOLTAGE, \ - .vsel_mask = _vmask << _vshift, \ - .enable_reg = AS3711_ ## _en_reg, \ - .enable_mask = BIT(_en_bit), \ - .min_uV = _min_uV, \ - }, \ - .max_uV = _max_uV, \ -} - -static struct as3711_regulator_info as3711_reg_info[] = { - AS3711_REG(SD_1, SD_CONTROL, 0, 0x7f, 0, 612500, 3350000, sd), - AS3711_REG(SD_2, SD_CONTROL, 1, 0x7f, 0, 612500, 3350000, sd), - AS3711_REG(SD_3, SD_CONTROL, 2, 0x7f, 0, 612500, 3350000, sd), - AS3711_REG(SD_4, SD_CONTROL, 3, 0x7f, 0, 612500, 3350000, sd), - AS3711_REG(LDO_1, LDO_1_VOLTAGE, 7, 0x1f, 0, 1200000, 3300000, aldo), - AS3711_REG(LDO_2, LDO_2_VOLTAGE, 7, 0x1f, 0, 1200000, 3300000, aldo), - AS3711_REG(LDO_3, LDO_3_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo), - AS3711_REG(LDO_4, LDO_4_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo), - AS3711_REG(LDO_5, LDO_5_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo), - AS3711_REG(LDO_6, LDO_6_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo), - AS3711_REG(LDO_7, LDO_7_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo), - AS3711_REG(LDO_8, LDO_8_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo), - /* StepUp output voltage depends on supplying regulator */ -}; - -#define AS3711_REGULATOR_NUM ARRAY_SIZE(as3711_reg_info) - -static int as3711_regulator_probe(struct platform_device *pdev) -{ - struct as3711_regulator_pdata *pdata = dev_get_platdata(&pdev->dev); - struct as3711 *as3711 = dev_get_drvdata(pdev->dev.parent); - struct regulator_init_data *reg_data; - struct regulator_config config = {.dev = &pdev->dev,}; - struct as3711_regulator *reg = NULL; - struct as3711_regulator *regs; - struct regulator_dev *rdev; - struct as3711_regulator_info *ri; - int ret; - int id; - - if (!pdata) - dev_dbg(&pdev->dev, "No platform data...\n"); - - regs = devm_kzalloc(&pdev->dev, AS3711_REGULATOR_NUM * - sizeof(struct as3711_regulator), GFP_KERNEL); - if (!regs) { - dev_err(&pdev->dev, "Memory allocation failed exiting..\n"); - return -ENOMEM; - } - - for (id = 0, ri = as3711_reg_info; id < AS3711_REGULATOR_NUM; ++id, ri++) { - reg_data = pdata ? pdata->init_data[id] : NULL; - - /* No need to register if there is no regulator data */ - if (!ri->desc.name) - continue; - - reg = ®s[id]; - reg->reg_info = ri; - - config.init_data = reg_data; - config.driver_data = reg; - config.regmap = as3711->regmap; - - rdev = regulator_register(&ri->desc, &config); - if (IS_ERR(rdev)) { - dev_err(&pdev->dev, "Failed to register regulator %s\n", - ri->desc.name); - ret = PTR_ERR(rdev); - goto eregreg; - } - reg->rdev = rdev; - } - platform_set_drvdata(pdev, regs); - return 0; - -eregreg: - while (--id >= 0) - regulator_unregister(regs[id].rdev); - - return ret; -} - -static int as3711_regulator_remove(struct platform_device *pdev) -{ - struct as3711_regulator *regs = platform_get_drvdata(pdev); - int id; - - for (id = 0; id < AS3711_REGULATOR_NUM; ++id) - regulator_unregister(regs[id].rdev); - return 0; -} - -static struct platform_driver as3711_regulator_driver = { - .driver = { - .name = "as3711-regulator", - .owner = THIS_MODULE, - }, - .probe = as3711_regulator_probe, - .remove = as3711_regulator_remove, -}; - -static int __init as3711_regulator_init(void) -{ - return platform_driver_register(&as3711_regulator_driver); -} -subsys_initcall(as3711_regulator_init); - -static void __exit as3711_regulator_exit(void) -{ - platform_driver_unregister(&as3711_regulator_driver); -} -module_exit(as3711_regulator_exit); - -MODULE_AUTHOR("Guennadi Liakhovetski "); -MODULE_DESCRIPTION("AS3711 regulator driver"); -MODULE_ALIAS("platform:as3711-regulator"); -MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/regulator/core.c b/trunk/drivers/regulator/core.c index cd1b201c91e2..e872c8be080e 100644 --- a/trunk/drivers/regulator/core.c +++ b/trunk/drivers/regulator/core.c @@ -199,11 +199,8 @@ static int regulator_check_consumers(struct regulator_dev *rdev, *min_uV = regulator->min_uV; } - if (*min_uV > *max_uV) { - dev_err(regulator->dev, "Restricting voltage, %u-%uuV\n", - regulator->min_uV, regulator->max_uV); + if (*min_uV > *max_uV) return -EINVAL; - } return 0; } @@ -883,9 +880,7 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, /* final: [min_uV..max_uV] valid iff constraints valid */ if (max_uV < min_uV) { - rdev_err(rdev, - "unsupportable voltage constraints %u-%uuV\n", - min_uV, max_uV); + rdev_err(rdev, "unsupportable voltage constraints\n"); return -EINVAL; } @@ -1871,28 +1866,6 @@ int regulator_is_enabled(struct regulator *regulator) } EXPORT_SYMBOL_GPL(regulator_is_enabled); -/** - * regulator_can_change_voltage - check if regulator can change voltage - * @regulator: regulator source - * - * Returns positive if the regulator driver backing the source/client - * can change its voltage, false otherwise. Usefull for detecting fixed - * or dummy regulators and disabling voltage change logic in the client - * driver. - */ -int regulator_can_change_voltage(struct regulator *regulator) -{ - struct regulator_dev *rdev = regulator->rdev; - - if (rdev->constraints && - rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE && - rdev->desc->n_voltages > 1) - return 1; - - return 0; -} -EXPORT_SYMBOL_GPL(regulator_can_change_voltage); - /** * regulator_count_voltages - count regulator_list_voltage() selectors * @regulator: regulator source @@ -1924,10 +1897,6 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev, { if (selector >= rdev->desc->n_voltages) return -EINVAL; - if (selector < rdev->desc->linear_min_sel) - return 0; - - selector -= rdev->desc->linear_min_sel; return rdev->desc->min_uV + (rdev->desc->uV_step * selector); } @@ -2016,11 +1985,6 @@ int regulator_is_supported_voltage(struct regulator *regulator, return ret; } - /* Any voltage within constrains range is fine? */ - if (rdev->desc->continuous_voltage_range) - return min_uV >= rdev->constraints->min_uV && - max_uV <= rdev->constraints->max_uV; - ret = regulator_count_voltages(regulator); if (ret < 0) return ret; @@ -2156,8 +2120,6 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, if (ret < 0) return ret; - ret += rdev->desc->linear_min_sel; - /* Map back into a voltage to verify we're still in bounds */ voltage = rdev->desc->ops->list_voltage(rdev, ret); if (voltage < min_uV || voltage > max_uV) diff --git a/trunk/drivers/regulator/da903x.c b/trunk/drivers/regulator/da903x.c index 2afa5730f324..36c5b92fe0af 100644 --- a/trunk/drivers/regulator/da903x.c +++ b/trunk/drivers/regulator/da903x.c @@ -460,7 +460,7 @@ static inline struct da903x_regulator_info *find_regulator_info(int id) return NULL; } -static int da903x_regulator_probe(struct platform_device *pdev) +static int __devinit da903x_regulator_probe(struct platform_device *pdev) { struct da903x_regulator_info *ri = NULL; struct regulator_dev *rdev; @@ -499,7 +499,7 @@ static int da903x_regulator_probe(struct platform_device *pdev) return 0; } -static int da903x_regulator_remove(struct platform_device *pdev) +static int __devexit da903x_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); @@ -513,7 +513,7 @@ static struct platform_driver da903x_regulator_driver = { .owner = THIS_MODULE, }, .probe = da903x_regulator_probe, - .remove = da903x_regulator_remove, + .remove = __devexit_p(da903x_regulator_remove), }; static int __init da903x_regulator_init(void) diff --git a/trunk/drivers/regulator/da9052-regulator.c b/trunk/drivers/regulator/da9052-regulator.c index d0963090442d..27355b1199e5 100644 --- a/trunk/drivers/regulator/da9052-regulator.c +++ b/trunk/drivers/regulator/da9052-regulator.c @@ -129,17 +129,17 @@ static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA, else if (offset == 0) row = 1; + if (min_uA > da9052_current_limits[row][DA9052_MAX_UA] || + max_uA < da9052_current_limits[row][DA9052_MIN_UA]) + return -EINVAL; + for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) { - if ((min_uA <= da9052_current_limits[row][i]) && - (da9052_current_limits[row][i] <= max_uA)) { + if (da9052_current_limits[row][i] <= max_uA) { reg_val = i; break; } } - if (i < 0) - return -EINVAL; - /* Determine the even or odd position of the buck current limit * register field */ @@ -365,7 +365,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id, return NULL; } -static int da9052_regulator_probe(struct platform_device *pdev) +static int __devinit da9052_regulator_probe(struct platform_device *pdev) { struct regulator_config config = { }; struct da9052_regulator *regulator; @@ -430,7 +430,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) return 0; } -static int da9052_regulator_remove(struct platform_device *pdev) +static int __devexit da9052_regulator_remove(struct platform_device *pdev) { struct da9052_regulator *regulator = platform_get_drvdata(pdev); @@ -440,7 +440,7 @@ static int da9052_regulator_remove(struct platform_device *pdev) static struct platform_driver da9052_regulator_driver = { .probe = da9052_regulator_probe, - .remove = da9052_regulator_remove, + .remove = __devexit_p(da9052_regulator_remove), .driver = { .name = "da9052-regulator", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/da9055-regulator.c b/trunk/drivers/regulator/da9055-regulator.c deleted file mode 100644 index a4b9cb8c4317..000000000000 --- a/trunk/drivers/regulator/da9055-regulator.c +++ /dev/null @@ -1,641 +0,0 @@ -/* -* Regulator driver for DA9055 PMIC -* -* Copyright(c) 2012 Dialog Semiconductor Ltd. -* -* Author: David Dajun Chen -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define DA9055_MIN_UA 0 -#define DA9055_MAX_UA 3 - -#define DA9055_LDO_MODE_SYNC 0 -#define DA9055_LDO_MODE_SLEEP 1 - -#define DA9055_BUCK_MODE_SLEEP 1 -#define DA9055_BUCK_MODE_SYNC 2 -#define DA9055_BUCK_MODE_AUTO 3 - -/* DA9055 REGULATOR IDs */ -#define DA9055_ID_BUCK1 0 -#define DA9055_ID_BUCK2 1 -#define DA9055_ID_LDO1 2 -#define DA9055_ID_LDO2 3 -#define DA9055_ID_LDO3 4 -#define DA9055_ID_LDO4 5 -#define DA9055_ID_LDO5 6 -#define DA9055_ID_LDO6 7 - -/* DA9055 BUCK current limit */ -static const int da9055_current_limits[] = { 500000, 600000, 700000, 800000 }; - -struct da9055_conf_reg { - int reg; - int sel_mask; - int en_mask; -}; - -struct da9055_volt_reg { - int reg_a; - int reg_b; - int sl_shift; - int v_mask; - int v_shift; -}; - -struct da9055_mode_reg { - int reg; - int mask; - int shift; -}; - -struct da9055_regulator_info { - struct regulator_desc reg_desc; - struct da9055_conf_reg conf; - struct da9055_volt_reg volt; - struct da9055_mode_reg mode; -}; - -struct da9055_regulator { - struct da9055 *da9055; - struct da9055_regulator_info *info; - struct regulator_dev *rdev; - enum gpio_select reg_rselect; -}; - -static unsigned int da9055_buck_get_mode(struct regulator_dev *rdev) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int ret, mode = 0; - - ret = da9055_reg_read(regulator->da9055, info->mode.reg); - if (ret < 0) - return ret; - - switch ((ret & info->mode.mask) >> info->mode.shift) { - case DA9055_BUCK_MODE_SYNC: - mode = REGULATOR_MODE_FAST; - break; - case DA9055_BUCK_MODE_AUTO: - mode = REGULATOR_MODE_NORMAL; - break; - case DA9055_BUCK_MODE_SLEEP: - mode = REGULATOR_MODE_STANDBY; - break; - } - - return mode; -} - -static int da9055_buck_set_mode(struct regulator_dev *rdev, - unsigned int mode) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int val = 0; - - switch (mode) { - case REGULATOR_MODE_FAST: - val = DA9055_BUCK_MODE_SYNC << info->mode.shift; - break; - case REGULATOR_MODE_NORMAL: - val = DA9055_BUCK_MODE_AUTO << info->mode.shift; - break; - case REGULATOR_MODE_STANDBY: - val = DA9055_BUCK_MODE_SLEEP << info->mode.shift; - break; - } - - return da9055_reg_update(regulator->da9055, info->mode.reg, - info->mode.mask, val); -} - -static unsigned int da9055_ldo_get_mode(struct regulator_dev *rdev) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int ret; - - ret = da9055_reg_read(regulator->da9055, info->volt.reg_b); - if (ret < 0) - return ret; - - if (ret >> info->volt.sl_shift) - return REGULATOR_MODE_STANDBY; - else - return REGULATOR_MODE_NORMAL; -} - -static int da9055_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - struct da9055_volt_reg volt = info->volt; - int val = 0; - - switch (mode) { - case REGULATOR_MODE_NORMAL: - case REGULATOR_MODE_FAST: - val = DA9055_LDO_MODE_SYNC; - break; - case REGULATOR_MODE_STANDBY: - val = DA9055_LDO_MODE_SLEEP; - break; - } - - return da9055_reg_update(regulator->da9055, volt.reg_b, - 1 << volt.sl_shift, - val << volt.sl_shift); -} - -static int da9055_buck_get_current_limit(struct regulator_dev *rdev) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int ret; - - ret = da9055_reg_read(regulator->da9055, DA9055_REG_BUCK_LIM); - if (ret < 0) - return ret; - - ret &= info->mode.mask; - return da9055_current_limits[ret >> info->mode.shift]; -} - -static int da9055_buck_set_current_limit(struct regulator_dev *rdev, int min_uA, - int max_uA) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int i; - - for (i = ARRAY_SIZE(da9055_current_limits) - 1; i >= 0; i--) { - if ((min_uA <= da9055_current_limits[i]) && - (da9055_current_limits[i] <= max_uA)) - return da9055_reg_update(regulator->da9055, - DA9055_REG_BUCK_LIM, - info->mode.mask, - i << info->mode.shift); - } - - return -EINVAL; -} - -static int da9055_regulator_get_voltage_sel(struct regulator_dev *rdev) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - struct da9055_volt_reg volt = info->volt; - int ret, sel; - - /* - * There are two voltage register set A & B for voltage ramping but - * either one of then can be active therefore we first determine - * the active register set. - */ - ret = da9055_reg_read(regulator->da9055, info->conf.reg); - if (ret < 0) - return ret; - - ret &= info->conf.sel_mask; - - /* Get the voltage for the active register set A/B */ - if (ret == DA9055_REGUALTOR_SET_A) - ret = da9055_reg_read(regulator->da9055, volt.reg_a); - else - ret = da9055_reg_read(regulator->da9055, volt.reg_b); - - if (ret < 0) - return ret; - - sel = (ret & volt.v_mask); - return sel; -} - -static int da9055_regulator_set_voltage_sel(struct regulator_dev *rdev, - unsigned int selector) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int ret; - - /* - * Regulator register set A/B is not selected through GPIO therefore - * we use default register set A for voltage ramping. - */ - if (regulator->reg_rselect == NO_GPIO) { - /* Select register set A */ - ret = da9055_reg_update(regulator->da9055, info->conf.reg, - info->conf.sel_mask, DA9055_SEL_REG_A); - if (ret < 0) - return ret; - - /* Set the voltage */ - return da9055_reg_update(regulator->da9055, info->volt.reg_a, - info->volt.v_mask, selector); - } - - /* - * Here regulator register set A/B is selected through GPIO. - * Therefore we first determine the selected register set A/B and - * then set the desired voltage for that register set A/B. - */ - ret = da9055_reg_read(regulator->da9055, info->conf.reg); - if (ret < 0) - return ret; - - ret &= info->conf.sel_mask; - - /* Set the voltage */ - if (ret == DA9055_REGUALTOR_SET_A) - return da9055_reg_update(regulator->da9055, info->volt.reg_a, - info->volt.v_mask, selector); - else - return da9055_reg_update(regulator->da9055, info->volt.reg_b, - info->volt.v_mask, selector); -} - -static int da9055_regulator_set_suspend_voltage(struct regulator_dev *rdev, - int uV) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - int ret; - - /* Select register set B for suspend voltage ramping. */ - if (regulator->reg_rselect == NO_GPIO) { - ret = da9055_reg_update(regulator->da9055, info->conf.reg, - info->conf.sel_mask, DA9055_SEL_REG_B); - if (ret < 0) - return ret; - } - - ret = regulator_map_voltage_linear(rdev, uV, uV); - if (ret < 0) - return ret; - - return da9055_reg_update(regulator->da9055, info->volt.reg_b, - info->volt.v_mask, ret); -} - -static int da9055_suspend_enable(struct regulator_dev *rdev) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - - /* Select register set B for voltage ramping. */ - if (regulator->reg_rselect == NO_GPIO) - return da9055_reg_update(regulator->da9055, info->conf.reg, - info->conf.sel_mask, DA9055_SEL_REG_B); - else - return 0; -} - -static int da9055_suspend_disable(struct regulator_dev *rdev) -{ - struct da9055_regulator *regulator = rdev_get_drvdata(rdev); - struct da9055_regulator_info *info = regulator->info; - - /* Diselect register set B. */ - if (regulator->reg_rselect == NO_GPIO) - return da9055_reg_update(regulator->da9055, info->conf.reg, - info->conf.sel_mask, DA9055_SEL_REG_A); - else - return 0; -} - -static struct regulator_ops da9055_buck_ops = { - .get_mode = da9055_buck_get_mode, - .set_mode = da9055_buck_set_mode, - - .get_current_limit = da9055_buck_get_current_limit, - .set_current_limit = da9055_buck_set_current_limit, - - .get_voltage_sel = da9055_regulator_get_voltage_sel, - .set_voltage_sel = da9055_regulator_set_voltage_sel, - .list_voltage = regulator_list_voltage_linear, - .map_voltage = regulator_map_voltage_linear, - .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, - - .set_suspend_voltage = da9055_regulator_set_suspend_voltage, - .set_suspend_enable = da9055_suspend_enable, - .set_suspend_disable = da9055_suspend_disable, - .set_suspend_mode = da9055_buck_set_mode, -}; - -static struct regulator_ops da9055_ldo_ops = { - .get_mode = da9055_ldo_get_mode, - .set_mode = da9055_ldo_set_mode, - - .get_voltage_sel = da9055_regulator_get_voltage_sel, - .set_voltage_sel = da9055_regulator_set_voltage_sel, - .list_voltage = regulator_list_voltage_linear, - .map_voltage = regulator_map_voltage_linear, - .is_enabled = regulator_is_enabled_regmap, - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, - - .set_suspend_voltage = da9055_regulator_set_suspend_voltage, - .set_suspend_enable = da9055_suspend_enable, - .set_suspend_disable = da9055_suspend_disable, - .set_suspend_mode = da9055_ldo_set_mode, - -}; - -#define DA9055_LDO(_id, step, min, max, vbits, voffset) \ -{\ - .reg_desc = {\ - .name = #_id,\ - .ops = &da9055_ldo_ops,\ - .type = REGULATOR_VOLTAGE,\ - .id = DA9055_ID_##_id,\ - .n_voltages = (max - min) / step + 1 + (voffset), \ - .enable_reg = DA9055_REG_BCORE_CONT + DA9055_ID_##_id, \ - .enable_mask = 1, \ - .min_uV = (min) * 1000,\ - .uV_step = (step) * 1000,\ - .linear_min_sel = (voffset),\ - .owner = THIS_MODULE,\ - },\ - .conf = {\ - .reg = DA9055_REG_BCORE_CONT + DA9055_ID_##_id, \ - .sel_mask = (1 << 4),\ - .en_mask = 1,\ - },\ - .volt = {\ - .reg_a = DA9055_REG_VBCORE_A + DA9055_ID_##_id, \ - .reg_b = DA9055_REG_VBCORE_B + DA9055_ID_##_id, \ - .sl_shift = 7,\ - .v_mask = (1 << (vbits)) - 1,\ - .v_shift = (vbits),\ - },\ -} - -#define DA9055_BUCK(_id, step, min, max, vbits, voffset, mbits, sbits) \ -{\ - .reg_desc = {\ - .name = #_id,\ - .ops = &da9055_buck_ops,\ - .type = REGULATOR_VOLTAGE,\ - .id = DA9055_ID_##_id,\ - .n_voltages = (max - min) / step + 1 + (voffset), \ - .enable_reg = DA9055_REG_BCORE_CONT + DA9055_ID_##_id, \ - .enable_mask = 1,\ - .min_uV = (min) * 1000,\ - .uV_step = (step) * 1000,\ - .linear_min_sel = (voffset),\ - .owner = THIS_MODULE,\ - },\ - .conf = {\ - .reg = DA9055_REG_BCORE_CONT + DA9055_ID_##_id, \ - .sel_mask = (1 << 4),\ - .en_mask = 1,\ - },\ - .volt = {\ - .reg_a = DA9055_REG_VBCORE_A + DA9055_ID_##_id, \ - .reg_b = DA9055_REG_VBCORE_B + DA9055_ID_##_id, \ - .sl_shift = 7,\ - .v_mask = (1 << (vbits)) - 1,\ - .v_shift = (vbits),\ - },\ - .mode = {\ - .reg = DA9055_REG_BCORE_MODE,\ - .mask = (mbits),\ - .shift = (sbits),\ - },\ -} - -static struct da9055_regulator_info da9055_regulator_info[] = { - DA9055_BUCK(BUCK1, 25, 725, 2075, 6, 9, 0xc, 2), - DA9055_BUCK(BUCK2, 25, 925, 2500, 6, 0, 3, 0), - DA9055_LDO(LDO1, 50, 900, 3300, 6, 2), - DA9055_LDO(LDO2, 50, 900, 3300, 6, 3), - DA9055_LDO(LDO3, 50, 900, 3300, 6, 2), - DA9055_LDO(LDO4, 50, 900, 3300, 6, 2), - DA9055_LDO(LDO5, 50, 900, 2750, 6, 2), - DA9055_LDO(LDO6, 20, 900, 3300, 7, 0), -}; - -/* - * Configures regulator to be controlled either through GPIO 1 or 2. - * GPIO can control regulator state and/or select the regulator register - * set A/B for voltage ramping. - */ -static __devinit int da9055_gpio_init(struct da9055_regulator *regulator, - struct regulator_config *config, - struct da9055_pdata *pdata, int id) -{ - struct da9055_regulator_info *info = regulator->info; - int ret = 0; - - if (pdata->gpio_ren && pdata->gpio_ren[id]) { - char name[18]; - int gpio_mux = pdata->gpio_ren[id]; - - config->ena_gpio = pdata->ena_gpio[id]; - config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH; - config->ena_gpio_invert = 1; - - /* - * GPI pin is muxed with regulator to control the - * regulator state. - */ - sprintf(name, "DA9055 GPI %d", gpio_mux); - ret = devm_gpio_request_one(config->dev, gpio_mux, GPIOF_DIR_IN, - name); - if (ret < 0) - goto err; - - /* - * Let the regulator know that its state is controlled - * through GPI. - */ - ret = da9055_reg_update(regulator->da9055, info->conf.reg, - DA9055_E_GPI_MASK, - pdata->reg_ren[id] - << DA9055_E_GPI_SHIFT); - if (ret < 0) - goto err; - } - - if (pdata->gpio_rsel && pdata->gpio_rsel[id]) { - char name[18]; - int gpio_mux = pdata->gpio_rsel[id]; - - regulator->reg_rselect = pdata->reg_rsel[id]; - - /* - * GPI pin is muxed with regulator to select the - * regulator register set A/B for voltage ramping. - */ - sprintf(name, "DA9055 GPI %d", gpio_mux); - ret = devm_gpio_request_one(config->dev, gpio_mux, GPIOF_DIR_IN, - name); - if (ret < 0) - goto err; - - /* - * Let the regulator know that its register set A/B - * will be selected through GPI for voltage ramping. - */ - ret = da9055_reg_update(regulator->da9055, info->conf.reg, - DA9055_V_GPI_MASK, - pdata->reg_rsel[id] - << DA9055_V_GPI_SHIFT); - } - -err: - return ret; -} - -static irqreturn_t da9055_ldo5_6_oc_irq(int irq, void *data) -{ - struct da9055_regulator *regulator = data; - - regulator_notifier_call_chain(regulator->rdev, - REGULATOR_EVENT_OVER_CURRENT, NULL); - - return IRQ_HANDLED; -} - -static inline struct da9055_regulator_info *find_regulator_info(int id) -{ - struct da9055_regulator_info *info; - int i; - - for (i = 0; i < ARRAY_SIZE(da9055_regulator_info); i++) { - info = &da9055_regulator_info[i]; - if (info->reg_desc.id == id) - return info; - } - - return NULL; -} - -static int __devinit da9055_regulator_probe(struct platform_device *pdev) -{ - struct regulator_config config = { }; - struct da9055_regulator *regulator; - struct da9055 *da9055 = dev_get_drvdata(pdev->dev.parent); - struct da9055_pdata *pdata = da9055->dev->platform_data; - int ret, irq; - - if (pdata == NULL || pdata->regulators[pdev->id] == NULL) - return -ENODEV; - - regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9055_regulator), - GFP_KERNEL); - if (!regulator) - return -ENOMEM; - - regulator->info = find_regulator_info(pdev->id); - if (regulator->info == NULL) { - dev_err(&pdev->dev, "invalid regulator ID specified\n"); - return -EINVAL; - } - - regulator->da9055 = da9055; - config.dev = &pdev->dev; - config.driver_data = regulator; - config.regmap = da9055->regmap; - - if (pdata && pdata->regulators) - config.init_data = pdata->regulators[pdev->id]; - - ret = da9055_gpio_init(regulator, &config, pdata, pdev->id); - if (ret < 0) - return ret; - - regulator->rdev = regulator_register(®ulator->info->reg_desc, - &config); - if (IS_ERR(regulator->rdev)) { - dev_err(&pdev->dev, "Failed to register regulator %s\n", - regulator->info->reg_desc.name); - ret = PTR_ERR(regulator->rdev); - return ret; - } - - /* Only LDO 5 and 6 has got the over current interrupt */ - if (pdev->id == DA9055_ID_LDO5 || pdev->id == DA9055_ID_LDO6) { - irq = platform_get_irq_byname(pdev, "REGULATOR"); - irq = regmap_irq_get_virq(da9055->irq_data, irq); - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - da9055_ldo5_6_oc_irq, - IRQF_TRIGGER_HIGH | - IRQF_ONESHOT | - IRQF_PROBE_SHARED, - pdev->name, regulator); - if (ret != 0) { - if (ret != -EBUSY) { - dev_err(&pdev->dev, - "Failed to request Regulator IRQ %d: %d\n", - irq, ret); - goto err_regulator; - } - } - } - - platform_set_drvdata(pdev, regulator); - - return 0; - -err_regulator: - regulator_unregister(regulator->rdev); - return ret; -} - -static int __devexit da9055_regulator_remove(struct platform_device *pdev) -{ - struct da9055_regulator *regulator = platform_get_drvdata(pdev); - - regulator_unregister(regulator->rdev); - - return 0; -} - -static struct platform_driver da9055_regulator_driver = { - .probe = da9055_regulator_probe, - .remove = __devexit_p(da9055_regulator_remove), - .driver = { - .name = "da9055-regulator", - .owner = THIS_MODULE, - }, -}; - -static int __init da9055_regulator_init(void) -{ - return platform_driver_register(&da9055_regulator_driver); -} -subsys_initcall(da9055_regulator_init); - -static void __exit da9055_regulator_exit(void) -{ - platform_driver_unregister(&da9055_regulator_driver); -} -module_exit(da9055_regulator_exit); - -MODULE_AUTHOR("David Dajun Chen "); -MODULE_DESCRIPTION("Power Regulator driver for Dialog DA9055 PMIC"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:da9055-regulator"); diff --git a/trunk/drivers/regulator/db8500-prcmu.c b/trunk/drivers/regulator/db8500-prcmu.c index 219d162b651e..359f8d18fc3f 100644 --- a/trunk/drivers/regulator/db8500-prcmu.c +++ b/trunk/drivers/regulator/db8500-prcmu.c @@ -412,7 +412,7 @@ dbx500_regulator_info[DB8500_NUM_REGULATORS] = { }, }; -static int db8500_regulator_register(struct platform_device *pdev, +static __devinit int db8500_regulator_register(struct platform_device *pdev, struct regulator_init_data *init_data, int id, struct device_node *np) @@ -474,7 +474,7 @@ static struct of_regulator_match db8500_regulator_matches[] = { { .name = "db8500_esram34_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, }, }; -static int +static __devinit int db8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np) { @@ -491,7 +491,7 @@ db8500_regulator_of_probe(struct platform_device *pdev, return 0; } -static int db8500_regulator_probe(struct platform_device *pdev) +static int __devinit db8500_regulator_probe(struct platform_device *pdev) { struct regulator_init_data *db8500_init_data = dev_get_platdata(&pdev->dev); diff --git a/trunk/drivers/regulator/dbx500-prcmu.c b/trunk/drivers/regulator/dbx500-prcmu.c index 261f3d2299bc..f2e5ecdc5864 100644 --- a/trunk/drivers/regulator/dbx500-prcmu.c +++ b/trunk/drivers/regulator/dbx500-prcmu.c @@ -173,7 +173,7 @@ int __attribute__((weak)) dbx500_regulator_testcase( return 0; } -int +int __devinit ux500_regulator_debug_init(struct platform_device *pdev, struct dbx500_regulator_info *regulator_info, int num_regulators) @@ -230,7 +230,7 @@ ux500_regulator_debug_init(struct platform_device *pdev, return -ENOMEM; } -int ux500_regulator_debug_exit(void) +int __devexit ux500_regulator_debug_exit(void) { debugfs_remove_recursive(rdebug.dir); kfree(rdebug.state_after_suspend); diff --git a/trunk/drivers/regulator/dummy.c b/trunk/drivers/regulator/dummy.c index df9f42524abb..03a1d7c11ef2 100644 --- a/trunk/drivers/regulator/dummy.c +++ b/trunk/drivers/regulator/dummy.c @@ -37,7 +37,7 @@ static struct regulator_desc dummy_desc = { .ops = &dummy_ops, }; -static int dummy_regulator_probe(struct platform_device *pdev) +static int __devinit dummy_regulator_probe(struct platform_device *pdev) { struct regulator_config config = { }; int ret; diff --git a/trunk/drivers/regulator/fan53555.c b/trunk/drivers/regulator/fan53555.c index 9165b0c40ed3..339f4d732e97 100644 --- a/trunk/drivers/regulator/fan53555.c +++ b/trunk/drivers/regulator/fan53555.c @@ -230,7 +230,7 @@ static struct regmap_config fan53555_regmap_config = { .val_bits = 8, }; -static int fan53555_regulator_probe(struct i2c_client *client, +static int __devinit fan53555_regulator_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct fan53555_device_info *di; @@ -293,7 +293,7 @@ static int fan53555_regulator_probe(struct i2c_client *client, } -static int fan53555_regulator_remove(struct i2c_client *client) +static int __devexit fan53555_regulator_remove(struct i2c_client *client) { struct fan53555_device_info *di = i2c_get_clientdata(client); @@ -311,7 +311,7 @@ static struct i2c_driver fan53555_regulator_driver = { .name = "fan53555-regulator", }, .probe = fan53555_regulator_probe, - .remove = fan53555_regulator_remove, + .remove = __devexit_p(fan53555_regulator_remove), .id_table = fan53555_id, }; diff --git a/trunk/drivers/regulator/fixed.c b/trunk/drivers/regulator/fixed.c index 48d5b7608b00..185468c4d38f 100644 --- a/trunk/drivers/regulator/fixed.c +++ b/trunk/drivers/regulator/fixed.c @@ -134,7 +134,7 @@ static struct regulator_ops fixed_voltage_ops = { .list_voltage = fixed_voltage_list_voltage, }; -static int reg_fixed_voltage_probe(struct platform_device *pdev) +static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) { struct fixed_voltage_config *config; struct fixed_voltage_data *drvdata; @@ -234,7 +234,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) return ret; } -static int reg_fixed_voltage_remove(struct platform_device *pdev) +static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) { struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); @@ -255,7 +255,7 @@ MODULE_DEVICE_TABLE(of, fixed_of_match); static struct platform_driver regulator_fixed_voltage_driver = { .probe = reg_fixed_voltage_probe, - .remove = reg_fixed_voltage_remove, + .remove = __devexit_p(reg_fixed_voltage_remove), .driver = { .name = "reg-fixed-voltage", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/gpio-regulator.c b/trunk/drivers/regulator/gpio-regulator.c index 2cfd9d3079e8..8b5944f2d7d1 100644 --- a/trunk/drivers/regulator/gpio-regulator.c +++ b/trunk/drivers/regulator/gpio-regulator.c @@ -28,12 +28,9 @@ #include #include #include -#include #include #include #include -#include -#include struct gpio_regulator_data { struct regulator_desc desc; @@ -132,108 +129,18 @@ static struct regulator_ops gpio_regulator_voltage_ops = { .list_voltage = gpio_regulator_list_voltage, }; -struct gpio_regulator_config * -of_get_gpio_regulator_config(struct device *dev, struct device_node *np) -{ - struct gpio_regulator_config *config; - struct property *prop; - const char *regtype; - int proplen, gpio, i; - - config = devm_kzalloc(dev, - sizeof(struct gpio_regulator_config), - GFP_KERNEL); - if (!config) - return ERR_PTR(-ENOMEM); - - config->init_data = of_get_regulator_init_data(dev, np); - if (!config->init_data) - return ERR_PTR(-EINVAL); - - config->supply_name = config->init_data->constraints.name; - - if (of_property_read_bool(np, "enable-active-high")) - config->enable_high = true; - - if (of_property_read_bool(np, "enable-at-boot")) - config->enabled_at_boot = true; - - of_property_read_u32(np, "startup-delay-us", &config->startup_delay); - - config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0); - - /* Fetch GPIOs. */ - for (i = 0; ; i++) - if (of_get_named_gpio(np, "gpios", i) < 0) - break; - config->nr_gpios = i; - - config->gpios = devm_kzalloc(dev, - sizeof(struct gpio) * config->nr_gpios, - GFP_KERNEL); - if (!config->gpios) - return ERR_PTR(-ENOMEM); - - for (i = 0; config->nr_gpios; i++) { - gpio = of_get_named_gpio(np, "gpios", i); - if (gpio < 0) - break; - config->gpios[i].gpio = gpio; - } - - /* Fetch states. */ - prop = of_find_property(np, "states", NULL); - if (!prop) { - dev_err(dev, "No 'states' property found\n"); - return ERR_PTR(-EINVAL); - } - - proplen = prop->length / sizeof(int); - - config->states = devm_kzalloc(dev, - sizeof(struct gpio_regulator_state) - * (proplen / 2), - GFP_KERNEL); - if (!config->states) - return ERR_PTR(-ENOMEM); - - for (i = 0; i < proplen / 2; i++) { - config->states[i].value = - be32_to_cpup((int *)prop->value + (i * 2)); - config->states[i].gpios = - be32_to_cpup((int *)prop->value + (i * 2 + 1)); - } - config->nr_states = i; - - of_property_read_string(np, "regulator-type", ®type); - - if (!strncmp("voltage", regtype, 7)) - config->type = REGULATOR_VOLTAGE; - else if (!strncmp("current", regtype, 7)) - config->type = REGULATOR_CURRENT; - - return config; -} - static struct regulator_ops gpio_regulator_current_ops = { .get_current_limit = gpio_regulator_get_value, .set_current_limit = gpio_regulator_set_current_limit, }; -static int gpio_regulator_probe(struct platform_device *pdev) +static int __devinit gpio_regulator_probe(struct platform_device *pdev) { struct gpio_regulator_config *config = pdev->dev.platform_data; - struct device_node *np = pdev->dev.of_node; struct gpio_regulator_data *drvdata; struct regulator_config cfg = { }; int ptr, ret, state; - if (np) { - config = of_get_gpio_regulator_config(&pdev->dev, np); - if (IS_ERR(config)) - return PTR_ERR(config); - } - drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data), GFP_KERNEL); if (drvdata == NULL) { @@ -308,7 +215,6 @@ static int gpio_regulator_probe(struct platform_device *pdev) cfg.dev = &pdev->dev; cfg.init_data = config->init_data; cfg.driver_data = drvdata; - cfg.of_node = np; if (config->enable_gpio >= 0) cfg.ena_gpio = config->enable_gpio; @@ -348,7 +254,7 @@ static int gpio_regulator_probe(struct platform_device *pdev) return ret; } -static int gpio_regulator_remove(struct platform_device *pdev) +static int __devexit gpio_regulator_remove(struct platform_device *pdev) { struct gpio_regulator_data *drvdata = platform_get_drvdata(pdev); @@ -364,20 +270,12 @@ static int gpio_regulator_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_OF) -static const struct of_device_id regulator_gpio_of_match[] __devinitconst = { - { .compatible = "regulator-gpio", }, - {}, -}; -#endif - static struct platform_driver gpio_regulator_driver = { .probe = gpio_regulator_probe, - .remove = gpio_regulator_remove, + .remove = __devexit_p(gpio_regulator_remove), .driver = { .name = "gpio-regulator", .owner = THIS_MODULE, - .of_match_table = of_match_ptr(regulator_gpio_of_match), }, }; diff --git a/trunk/drivers/regulator/isl6271a-regulator.c b/trunk/drivers/regulator/isl6271a-regulator.c index d1e5bee2a26b..d8ecf49a5777 100644 --- a/trunk/drivers/regulator/isl6271a-regulator.c +++ b/trunk/drivers/regulator/isl6271a-regulator.c @@ -106,7 +106,7 @@ static const struct regulator_desc isl_rd[] = { }, }; -static int isl6271a_probe(struct i2c_client *i2c, +static int __devinit isl6271a_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct regulator_config config = { }; @@ -151,7 +151,7 @@ static int isl6271a_probe(struct i2c_client *i2c, return err; } -static int isl6271a_remove(struct i2c_client *i2c) +static int __devexit isl6271a_remove(struct i2c_client *i2c) { struct isl_pmic *pmic = i2c_get_clientdata(i2c); int i; @@ -174,7 +174,7 @@ static struct i2c_driver isl6271a_i2c_driver = { .owner = THIS_MODULE, }, .probe = isl6271a_probe, - .remove = isl6271a_remove, + .remove = __devexit_p(isl6271a_remove), .id_table = isl6271a_id, }; diff --git a/trunk/drivers/regulator/lp3971.c b/trunk/drivers/regulator/lp3971.c index 5f68ff11a298..7c6e3b8ff484 100644 --- a/trunk/drivers/regulator/lp3971.c +++ b/trunk/drivers/regulator/lp3971.c @@ -386,7 +386,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val) return ret; } -static int setup_regulators(struct lp3971 *lp3971, +static int __devinit setup_regulators(struct lp3971 *lp3971, struct lp3971_platform_data *pdata) { int i, err; @@ -429,7 +429,7 @@ static int setup_regulators(struct lp3971 *lp3971, return err; } -static int lp3971_i2c_probe(struct i2c_client *i2c, +static int __devinit lp3971_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct lp3971 *lp3971; @@ -472,7 +472,7 @@ static int lp3971_i2c_probe(struct i2c_client *i2c, return ret; } -static int lp3971_i2c_remove(struct i2c_client *i2c) +static int __devexit lp3971_i2c_remove(struct i2c_client *i2c) { struct lp3971 *lp3971 = i2c_get_clientdata(i2c); int i; @@ -498,7 +498,7 @@ static struct i2c_driver lp3971_i2c_driver = { .owner = THIS_MODULE, }, .probe = lp3971_i2c_probe, - .remove = lp3971_i2c_remove, + .remove = __devexit_p(lp3971_i2c_remove), .id_table = lp3971_i2c_id, }; diff --git a/trunk/drivers/regulator/lp3972.c b/trunk/drivers/regulator/lp3972.c index 69c42c318b87..3cdc755d9b22 100644 --- a/trunk/drivers/regulator/lp3972.c +++ b/trunk/drivers/regulator/lp3972.c @@ -481,7 +481,7 @@ static const struct regulator_desc regulators[] = { }, }; -static int setup_regulators(struct lp3972 *lp3972, +static int __devinit setup_regulators(struct lp3972 *lp3972, struct lp3972_platform_data *pdata) { int i, err; @@ -523,7 +523,7 @@ static int setup_regulators(struct lp3972 *lp3972, return err; } -static int lp3972_i2c_probe(struct i2c_client *i2c, +static int __devinit lp3972_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct lp3972 *lp3972; @@ -569,7 +569,7 @@ static int lp3972_i2c_probe(struct i2c_client *i2c, return ret; } -static int lp3972_i2c_remove(struct i2c_client *i2c) +static int __devexit lp3972_i2c_remove(struct i2c_client *i2c) { struct lp3972 *lp3972 = i2c_get_clientdata(i2c); int i; @@ -594,7 +594,7 @@ static struct i2c_driver lp3972_i2c_driver = { .owner = THIS_MODULE, }, .probe = lp3972_i2c_probe, - .remove = lp3972_i2c_remove, + .remove = __devexit_p(lp3972_i2c_remove), .id_table = lp3972_i2c_id, }; diff --git a/trunk/drivers/regulator/lp872x.c b/trunk/drivers/regulator/lp872x.c index 9289ead715ca..708f4b6a17dc 100644 --- a/trunk/drivers/regulator/lp872x.c +++ b/trunk/drivers/regulator/lp872x.c @@ -893,7 +893,7 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id) return ret; } -static int lp872x_remove(struct i2c_client *cl) +static int __devexit lp872x_remove(struct i2c_client *cl) { struct lp872x *lp = i2c_get_clientdata(cl); @@ -914,7 +914,7 @@ static struct i2c_driver lp872x_driver = { .owner = THIS_MODULE, }, .probe = lp872x_probe, - .remove = lp872x_remove, + .remove = __devexit_p(lp872x_remove), .id_table = lp872x_ids, }; diff --git a/trunk/drivers/regulator/lp8788-buck.c b/trunk/drivers/regulator/lp8788-buck.c index aef3f2b0c5ea..ba3e0aa402de 100644 --- a/trunk/drivers/regulator/lp8788-buck.c +++ b/trunk/drivers/regulator/lp8788-buck.c @@ -429,6 +429,18 @@ static struct regulator_desc lp8788_buck_desc[] = { }, }; +static int _gpio_request(struct lp8788_buck *buck, int gpio, char *name) +{ + struct device *dev = buck->lp->dev; + + if (!gpio_is_valid(gpio)) { + dev_err(dev, "invalid gpio: %d\n", gpio); + return -EINVAL; + } + + return devm_gpio_request_one(dev, gpio, DVS_LOW, name); +} + static int lp8788_dvs_gpio_request(struct lp8788_buck *buck, enum lp8788_buck_id id) { @@ -440,8 +452,7 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck, switch (id) { case BUCK1: gpio = pdata->buck1_dvs->gpio; - ret = devm_gpio_request_one(buck->lp->dev, gpio, DVS_LOW, - b1_name); + ret = _gpio_request(buck, gpio, b1_name); if (ret) return ret; @@ -450,8 +461,7 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck, case BUCK2: for (i = 0 ; i < LP8788_NUM_BUCK2_DVS ; i++) { gpio = pdata->buck2_dvs->gpio[i]; - ret = devm_gpio_request_one(buck->lp->dev, gpio, - DVS_LOW, b2_name[i]); + ret = _gpio_request(buck, gpio, b2_name[i]); if (ret) return ret; } @@ -494,7 +504,7 @@ static int lp8788_init_dvs(struct lp8788_buck *buck, enum lp8788_buck_id id) default_dvs_mode[id]); } -static int lp8788_buck_probe(struct platform_device *pdev) +static __devinit int lp8788_buck_probe(struct platform_device *pdev) { struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); int id = pdev->id; @@ -532,7 +542,7 @@ static int lp8788_buck_probe(struct platform_device *pdev) return 0; } -static int lp8788_buck_remove(struct platform_device *pdev) +static int __devexit lp8788_buck_remove(struct platform_device *pdev) { struct lp8788_buck *buck = platform_get_drvdata(pdev); @@ -544,7 +554,7 @@ static int lp8788_buck_remove(struct platform_device *pdev) static struct platform_driver lp8788_buck_driver = { .probe = lp8788_buck_probe, - .remove = lp8788_buck_remove, + .remove = __devexit_p(lp8788_buck_remove), .driver = { .name = LP8788_DEV_BUCK, .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/lp8788-ldo.c b/trunk/drivers/regulator/lp8788-ldo.c index 3792741708ce..6796eeb47dc6 100644 --- a/trunk/drivers/regulator/lp8788-ldo.c +++ b/trunk/drivers/regulator/lp8788-ldo.c @@ -126,7 +126,7 @@ struct lp8788_ldo { }; /* DLDO 1, 2, 3, 9 voltage table */ -static const int lp8788_dldo1239_vtbl[] = { +const int lp8788_dldo1239_vtbl[] = { 1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000, 2600000, 2700000, 2800000, 2900000, 3000000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, @@ -662,6 +662,14 @@ static int lp8788_config_ldo_enable_mode(struct lp8788_ldo *ldo, [EN_DLDO7] = LP8788_EN_SEL_DLDO7_M, [EN_DLDO911] = LP8788_EN_SEL_DLDO911_M, }; + u8 val[] = { + [EN_ALDO1] = 0 << 5, + [EN_ALDO234] = 0 << 4, + [EN_ALDO5] = 0 << 3, + [EN_ALDO7] = 0 << 2, + [EN_DLDO7] = 0 << 1, + [EN_DLDO911] = 0 << 0, + }; switch (id) { case DLDO7: @@ -700,10 +708,11 @@ static int lp8788_config_ldo_enable_mode(struct lp8788_ldo *ldo, return ret; set_default_ldo_enable_mode: - return lp8788_update_bits(lp, LP8788_EN_SEL, en_mask[enable_id], 0); + return lp8788_update_bits(lp, LP8788_EN_SEL, en_mask[enable_id], + val[enable_id]); } -static int lp8788_dldo_probe(struct platform_device *pdev) +static __devinit int lp8788_dldo_probe(struct platform_device *pdev) { struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); int id = pdev->id; @@ -740,7 +749,7 @@ static int lp8788_dldo_probe(struct platform_device *pdev) return 0; } -static int lp8788_dldo_remove(struct platform_device *pdev) +static int __devexit lp8788_dldo_remove(struct platform_device *pdev) { struct lp8788_ldo *ldo = platform_get_drvdata(pdev); @@ -752,14 +761,14 @@ static int lp8788_dldo_remove(struct platform_device *pdev) static struct platform_driver lp8788_dldo_driver = { .probe = lp8788_dldo_probe, - .remove = lp8788_dldo_remove, + .remove = __devexit_p(lp8788_dldo_remove), .driver = { .name = LP8788_DEV_DLDO, .owner = THIS_MODULE, }, }; -static int lp8788_aldo_probe(struct platform_device *pdev) +static __devinit int lp8788_aldo_probe(struct platform_device *pdev) { struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); int id = pdev->id; @@ -796,7 +805,7 @@ static int lp8788_aldo_probe(struct platform_device *pdev) return 0; } -static int lp8788_aldo_remove(struct platform_device *pdev) +static int __devexit lp8788_aldo_remove(struct platform_device *pdev) { struct lp8788_ldo *ldo = platform_get_drvdata(pdev); @@ -808,7 +817,7 @@ static int lp8788_aldo_remove(struct platform_device *pdev) static struct platform_driver lp8788_aldo_driver = { .probe = lp8788_aldo_probe, - .remove = lp8788_aldo_remove, + .remove = __devexit_p(lp8788_aldo_remove), .driver = { .name = LP8788_DEV_ALDO, .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/max1586.c b/trunk/drivers/regulator/max1586.c index 8c5a54f541b5..f67af3c1b963 100644 --- a/trunk/drivers/regulator/max1586.c +++ b/trunk/drivers/regulator/max1586.c @@ -44,9 +44,6 @@ struct max1586_data { unsigned int min_uV; unsigned int max_uV; - unsigned int v3_curr_sel; - unsigned int v6_curr_sel; - struct regulator_dev *rdev[0]; }; @@ -66,60 +63,31 @@ static int v6_voltages_uv[] = { 1, 1800000, 2500000, 3000000 }; * R24 and R25=100kOhm as described in the data sheet. * The gain is approximately: 1 + R24/R25 + R24/185.5kOhm */ -static int max1586_v3_get_voltage_sel(struct regulator_dev *rdev) -{ - struct max1586_data *max1586 = rdev_get_drvdata(rdev); - - return max1586->v3_curr_sel; -} - static int max1586_v3_set_voltage_sel(struct regulator_dev *rdev, unsigned selector) { struct max1586_data *max1586 = rdev_get_drvdata(rdev); struct i2c_client *client = max1586->client; - int ret; u8 v3_prog; dev_dbg(&client->dev, "changing voltage v3 to %dmv\n", regulator_list_voltage_linear(rdev, selector) / 1000); v3_prog = I2C_V3_SELECT | (u8) selector; - ret = i2c_smbus_write_byte(client, v3_prog); - if (ret) - return ret; - - max1586->v3_curr_sel = selector; - - return 0; -} - -static int max1586_v6_get_voltage_sel(struct regulator_dev *rdev) -{ - struct max1586_data *max1586 = rdev_get_drvdata(rdev); - - return max1586->v6_curr_sel; + return i2c_smbus_write_byte(client, v3_prog); } static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector) { - struct max1586_data *max1586 = rdev_get_drvdata(rdev); - struct i2c_client *client = max1586->client; + struct i2c_client *client = rdev_get_drvdata(rdev); u8 v6_prog; - int ret; dev_dbg(&client->dev, "changing voltage v6 to %dmv\n", rdev->desc->volt_table[selector] / 1000); v6_prog = I2C_V6_SELECT | (u8) selector; - ret = i2c_smbus_write_byte(client, v6_prog); - if (ret) - return ret; - - max1586->v6_curr_sel = selector; - - return 0; + return i2c_smbus_write_byte(client, v6_prog); } /* @@ -127,14 +95,12 @@ static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev, * the set up value. */ static struct regulator_ops max1586_v3_ops = { - .get_voltage_sel = max1586_v3_get_voltage_sel, .set_voltage_sel = max1586_v3_set_voltage_sel, .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, }; static struct regulator_ops max1586_v6_ops = { - .get_voltage_sel = max1586_v6_get_voltage_sel, .set_voltage_sel = max1586_v6_set_voltage_sel, .list_voltage = regulator_list_voltage_table, }; @@ -159,7 +125,7 @@ static struct regulator_desc max1586_reg[] = { }, }; -static int max1586_pmic_probe(struct i2c_client *client, +static int __devinit max1586_pmic_probe(struct i2c_client *client, const struct i2c_device_id *i2c_id) { struct regulator_dev **rdev; @@ -182,10 +148,6 @@ static int max1586_pmic_probe(struct i2c_client *client, max1586->min_uV = MAX1586_V3_MIN_UV / 1000 * pdata->v3_gain / 1000; max1586->max_uV = MAX1586_V3_MAX_UV / 1000 * pdata->v3_gain / 1000; - /* Set curr_sel to default voltage on power-up */ - max1586->v3_curr_sel = 24; /* 1.3V */ - max1586->v6_curr_sel = 0; - rdev = max1586->rdev; for (i = 0; i < pdata->num_subdevs && i <= MAX1586_V6; i++) { id = pdata->subdevs[i].id; @@ -226,7 +188,7 @@ static int max1586_pmic_probe(struct i2c_client *client, return ret; } -static int max1586_pmic_remove(struct i2c_client *client) +static int __devexit max1586_pmic_remove(struct i2c_client *client) { struct max1586_data *max1586 = i2c_get_clientdata(client); int i; @@ -245,7 +207,7 @@ MODULE_DEVICE_TABLE(i2c, max1586_id); static struct i2c_driver max1586_pmic_driver = { .probe = max1586_pmic_probe, - .remove = max1586_pmic_remove, + .remove = __devexit_p(max1586_pmic_remove), .driver = { .name = "max1586", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/max77686.c b/trunk/drivers/regulator/max77686.c index b85040caaea3..2a67d08658ad 100644 --- a/trunk/drivers/regulator/max77686.c +++ b/trunk/drivers/regulator/max77686.c @@ -67,94 +67,8 @@ enum max77686_ramp_rate { struct max77686_data { struct regulator_dev *rdev[MAX77686_REGULATORS]; - unsigned int opmode[MAX77686_REGULATORS]; }; -/* Some BUCKS supports Normal[ON/OFF] mode during suspend */ -static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev) -{ - unsigned int val; - struct max77686_data *max77686 = rdev_get_drvdata(rdev); - - if (rdev->desc->id == MAX77686_BUCK1) - val = 0x1; - else - val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT; - - max77686->opmode[rdev->desc->id] = val; - return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, - val); -} - -/* Some LDOs supports [LPM/Normal]ON mode during suspend state */ -static int max77686_set_suspend_mode(struct regulator_dev *rdev, - unsigned int mode) -{ - struct max77686_data *max77686 = rdev_get_drvdata(rdev); - unsigned int val; - - /* BUCK[5-9] doesn't support this feature */ - if (rdev->desc->id >= MAX77686_BUCK5) - return 0; - - switch (mode) { - case REGULATOR_MODE_IDLE: /* ON in LP Mode */ - val = 0x2 << MAX77686_OPMODE_SHIFT; - break; - case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */ - val = 0x3 << MAX77686_OPMODE_SHIFT; - break; - default: - pr_warn("%s: regulator_suspend_mode : 0x%x not supported\n", - rdev->desc->name, mode); - return -EINVAL; - } - - max77686->opmode[rdev->desc->id] = val; - return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, - val); -} - -/* Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state */ -static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev, - unsigned int mode) -{ - unsigned int val; - struct max77686_data *max77686 = rdev_get_drvdata(rdev); - - switch (mode) { - case REGULATOR_MODE_STANDBY: /* switch off */ - val = 0x1 << MAX77686_OPMODE_SHIFT; - break; - case REGULATOR_MODE_IDLE: /* ON in LP Mode */ - val = 0x2 << MAX77686_OPMODE_SHIFT; - break; - case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */ - val = 0x3 << MAX77686_OPMODE_SHIFT; - break; - default: - pr_warn("%s: regulator_suspend_mode : 0x%x not supported\n", - rdev->desc->name, mode); - return -EINVAL; - } - - max77686->opmode[rdev->desc->id] = val; - return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, - val); -} - -static int max77686_enable(struct regulator_dev *rdev) -{ - struct max77686_data *max77686 = rdev_get_drvdata(rdev); - - return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, - rdev->desc->enable_mask, - max77686->opmode[rdev->desc->id]); -} - static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) { unsigned int ramp_value = RAMP_RATE_NO_CTRL; @@ -184,49 +98,23 @@ static struct regulator_ops max77686_ops = { .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, .is_enabled = regulator_is_enabled_regmap, - .enable = max77686_enable, - .disable = regulator_disable_regmap, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, - .set_voltage_time_sel = regulator_set_voltage_time_sel, - .set_suspend_mode = max77686_set_suspend_mode, -}; - -static struct regulator_ops max77686_ldo_ops = { - .list_voltage = regulator_list_voltage_linear, - .map_voltage = regulator_map_voltage_linear, - .is_enabled = regulator_is_enabled_regmap, - .enable = max77686_enable, + .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, - .set_suspend_mode = max77686_ldo_set_suspend_mode, -}; - -static struct regulator_ops max77686_buck1_ops = { - .list_voltage = regulator_list_voltage_linear, - .map_voltage = regulator_map_voltage_linear, - .is_enabled = regulator_is_enabled_regmap, - .enable = max77686_enable, - .disable = regulator_disable_regmap, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, - .set_voltage_time_sel = regulator_set_voltage_time_sel, - .set_suspend_disable = max77686_buck_set_suspend_disable, }; static struct regulator_ops max77686_buck_dvs_ops = { .list_voltage = regulator_list_voltage_linear, .map_voltage = regulator_map_voltage_linear, .is_enabled = regulator_is_enabled_regmap, - .enable = max77686_enable, + .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_ramp_delay = max77686_set_ramp_delay, - .set_suspend_disable = max77686_buck_set_suspend_disable, }; #define regulator_desc_ldo(num) { \ @@ -245,39 +133,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { .enable_mask = MAX77686_OPMODE_MASK \ << MAX77686_OPMODE_SHIFT, \ } -#define regulator_desc_lpm_ldo(num) { \ - .name = "LDO"#num, \ - .id = MAX77686_LDO##num, \ - .ops = &max77686_ldo_ops, \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ - .min_uV = MAX77686_LDO_MINUV, \ - .uV_step = MAX77686_LDO_UVSTEP, \ - .ramp_delay = MAX77686_RAMP_DELAY, \ - .n_voltages = MAX77686_VSEL_MASK + 1, \ - .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ - .vsel_mask = MAX77686_VSEL_MASK, \ - .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ - .enable_mask = MAX77686_OPMODE_MASK \ - << MAX77686_OPMODE_SHIFT, \ -} #define regulator_desc_ldo_low(num) { \ - .name = "LDO"#num, \ - .id = MAX77686_LDO##num, \ - .ops = &max77686_ldo_ops, \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ - .min_uV = MAX77686_LDO_LOW_MINUV, \ - .uV_step = MAX77686_LDO_LOW_UVSTEP, \ - .ramp_delay = MAX77686_RAMP_DELAY, \ - .n_voltages = MAX77686_VSEL_MASK + 1, \ - .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ - .vsel_mask = MAX77686_VSEL_MASK, \ - .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \ - .enable_mask = MAX77686_OPMODE_MASK \ - << MAX77686_OPMODE_SHIFT, \ -} -#define regulator_desc_ldo1_low(num) { \ .name = "LDO"#num, \ .id = MAX77686_LDO##num, \ .ops = &max77686_ops, \ @@ -311,7 +167,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { #define regulator_desc_buck1(num) { \ .name = "BUCK"#num, \ .id = MAX77686_BUCK##num, \ - .ops = &max77686_buck1_ops, \ + .ops = &max77686_ops, \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ .min_uV = MAX77686_BUCK_MINUV, \ @@ -341,7 +197,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { } static struct regulator_desc regulators[] = { - regulator_desc_ldo1_low(1), + regulator_desc_ldo_low(1), regulator_desc_ldo_low(2), regulator_desc_ldo(3), regulator_desc_ldo(4), @@ -350,13 +206,13 @@ static struct regulator_desc regulators[] = { regulator_desc_ldo_low(7), regulator_desc_ldo_low(8), regulator_desc_ldo(9), - regulator_desc_lpm_ldo(10), - regulator_desc_lpm_ldo(11), - regulator_desc_lpm_ldo(12), + regulator_desc_ldo(10), + regulator_desc_ldo(11), + regulator_desc_ldo(12), regulator_desc_ldo(13), - regulator_desc_lpm_ldo(14), + regulator_desc_ldo(14), regulator_desc_ldo_low(15), - regulator_desc_lpm_ldo(16), + regulator_desc_ldo(16), regulator_desc_ldo(17), regulator_desc_ldo(18), regulator_desc_ldo(19), @@ -424,7 +280,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, } #endif /* CONFIG_OF */ -static int max77686_pmic_probe(struct platform_device *pdev) +static __devinit int max77686_pmic_probe(struct platform_device *pdev) { struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev); @@ -458,14 +314,12 @@ static int max77686_pmic_probe(struct platform_device *pdev) config.dev = &pdev->dev; config.regmap = iodev->regmap; - config.driver_data = max77686; platform_set_drvdata(pdev, max77686); for (i = 0; i < MAX77686_REGULATORS; i++) { config.init_data = pdata->regulators[i].initdata; config.of_node = pdata->regulators[i].of_node; - max77686->opmode[i] = regulators[i].enable_mask; max77686->rdev[i] = regulator_register(®ulators[i], &config); if (IS_ERR(max77686->rdev[i])) { ret = PTR_ERR(max77686->rdev[i]); @@ -483,7 +337,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) return ret; } -static int max77686_pmic_remove(struct platform_device *pdev) +static int __devexit max77686_pmic_remove(struct platform_device *pdev) { struct max77686_data *max77686 = platform_get_drvdata(pdev); int i; @@ -506,7 +360,7 @@ static struct platform_driver max77686_pmic_driver = { .owner = THIS_MODULE, }, .probe = max77686_pmic_probe, - .remove = max77686_pmic_remove, + .remove = __devexit_p(max77686_pmic_remove), .id_table = max77686_pmic_id, }; diff --git a/trunk/drivers/regulator/max8649.c b/trunk/drivers/regulator/max8649.c index 3ca14380f22d..9d540cd02dab 100644 --- a/trunk/drivers/regulator/max8649.c +++ b/trunk/drivers/regulator/max8649.c @@ -176,7 +176,7 @@ static struct regmap_config max8649_regmap_config = { .val_bits = 8, }; -static int max8649_regulator_probe(struct i2c_client *client, +static int __devinit max8649_regulator_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct max8649_platform_data *pdata = client->dev.platform_data; @@ -271,7 +271,7 @@ static int max8649_regulator_probe(struct i2c_client *client, return 0; } -static int max8649_regulator_remove(struct i2c_client *client) +static int __devexit max8649_regulator_remove(struct i2c_client *client) { struct max8649_regulator_info *info = i2c_get_clientdata(client); @@ -291,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, max8649_id); static struct i2c_driver max8649_driver = { .probe = max8649_regulator_probe, - .remove = max8649_regulator_remove, + .remove = __devexit_p(max8649_regulator_remove), .driver = { .name = "max8649", }, diff --git a/trunk/drivers/regulator/max8660.c b/trunk/drivers/regulator/max8660.c index 4d7c635c36c2..8d531742f593 100644 --- a/trunk/drivers/regulator/max8660.c +++ b/trunk/drivers/regulator/max8660.c @@ -305,7 +305,7 @@ static const struct regulator_desc max8660_reg[] = { }, }; -static int max8660_probe(struct i2c_client *client, +static int __devinit max8660_probe(struct i2c_client *client, const struct i2c_device_id *i2c_id) { struct regulator_dev **rdev; @@ -420,7 +420,7 @@ static int max8660_probe(struct i2c_client *client, return ret; } -static int max8660_remove(struct i2c_client *client) +static int __devexit max8660_remove(struct i2c_client *client) { struct max8660 *max8660 = i2c_get_clientdata(client); int i; @@ -440,7 +440,7 @@ MODULE_DEVICE_TABLE(i2c, max8660_id); static struct i2c_driver max8660_driver = { .probe = max8660_probe, - .remove = max8660_remove, + .remove = __devexit_p(max8660_remove), .driver = { .name = "max8660", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/max8907-regulator.c b/trunk/drivers/regulator/max8907-regulator.c index d1a77512d83e..af7607515ab9 100644 --- a/trunk/drivers/regulator/max8907-regulator.c +++ b/trunk/drivers/regulator/max8907-regulator.c @@ -275,7 +275,7 @@ static inline struct device_node *match_of_node(int index) } #endif -static int max8907_regulator_probe(struct platform_device *pdev) +static __devinit int max8907_regulator_probe(struct platform_device *pdev) { struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent); struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev); @@ -368,7 +368,7 @@ static int max8907_regulator_probe(struct platform_device *pdev) return ret; } -static int max8907_regulator_remove(struct platform_device *pdev) +static __devexit int max8907_regulator_remove(struct platform_device *pdev) { struct max8907_regulator *pmic = platform_get_drvdata(pdev); int i; @@ -385,7 +385,7 @@ static struct platform_driver max8907_regulator_driver = { .owner = THIS_MODULE, }, .probe = max8907_regulator_probe, - .remove = max8907_regulator_remove, + .remove = __devexit_p(max8907_regulator_remove), }; static int __init max8907_regulator_init(void) diff --git a/trunk/drivers/regulator/max8925-regulator.c b/trunk/drivers/regulator/max8925-regulator.c index 446a85445553..9bb0be37495f 100644 --- a/trunk/drivers/regulator/max8925-regulator.c +++ b/trunk/drivers/regulator/max8925-regulator.c @@ -17,8 +17,6 @@ #include #include #include -#include -#include #define SD1_DVM_VMIN 850000 #define SD1_DVM_VMAX 1000000 @@ -189,34 +187,6 @@ static struct regulator_ops max8925_regulator_ldo_ops = { .enable_reg = MAX8925_LDOCTL##_id, \ } -#ifdef CONFIG_OF -static struct of_regulator_match max8925_regulator_matches[] = { - { .name = "SDV1",}, - { .name = "SDV2",}, - { .name = "SDV3",}, - { .name = "LDO1",}, - { .name = "LDO2",}, - { .name = "LDO3",}, - { .name = "LDO4",}, - { .name = "LDO5",}, - { .name = "LDO6",}, - { .name = "LDO7",}, - { .name = "LDO8",}, - { .name = "LDO9",}, - { .name = "LDO10",}, - { .name = "LDO11",}, - { .name = "LDO12",}, - { .name = "LDO13",}, - { .name = "LDO14",}, - { .name = "LDO15",}, - { .name = "LDO16",}, - { .name = "LDO17",}, - { .name = "LDO18",}, - { .name = "LDO19",}, - { .name = "LDO20",}, -}; -#endif - static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_SDV(1, 637.5, 1425, 12.5), MAX8925_SDV(2, 650, 2225, 25), @@ -244,37 +214,7 @@ static struct max8925_regulator_info max8925_regulator_info[] = { MAX8925_LDO(20, 750, 3900, 50), }; -#ifdef CONFIG_OF -static int max8925_regulator_dt_init(struct platform_device *pdev, - struct max8925_regulator_info *info, - struct regulator_config *config, - int ridx) -{ - struct device_node *nproot, *np; - int rcount; - nproot = pdev->dev.parent->of_node; - if (!nproot) - return -ENODEV; - np = of_find_node_by_name(nproot, "regulators"); - if (!np) { - dev_err(&pdev->dev, "failed to find regulators node\n"); - return -ENODEV; - } - - rcount = of_regulator_match(&pdev->dev, np, - &max8925_regulator_matches[ridx], 1); - if (rcount < 0) - return -ENODEV; - config->init_data = max8925_regulator_matches[ridx].init_data; - config->of_node = max8925_regulator_matches[ridx].of_node; - - return 0; -} -#else -#define max8925_regulator_dt_init(w, x, y, z) (-1) -#endif - -static int max8925_regulator_probe(struct platform_device *pdev) +static int __devinit max8925_regulator_probe(struct platform_device *pdev) { struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); struct regulator_init_data *pdata = pdev->dev.platform_data; @@ -282,7 +222,7 @@ static int max8925_regulator_probe(struct platform_device *pdev) struct max8925_regulator_info *ri; struct resource *res; struct regulator_dev *rdev; - int i, regulator_idx; + int i; res = platform_get_resource(pdev, IORESOURCE_REG, 0); if (!res) { @@ -291,12 +231,9 @@ static int max8925_regulator_probe(struct platform_device *pdev) } for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) { ri = &max8925_regulator_info[i]; - if (ri->vol_reg == res->start) { - regulator_idx = i; + if (ri->vol_reg == res->start) break; - } } - if (i == ARRAY_SIZE(max8925_regulator_info)) { dev_err(&pdev->dev, "Failed to find regulator %llu\n", (unsigned long long)res->start); @@ -306,12 +243,9 @@ static int max8925_regulator_probe(struct platform_device *pdev) ri->chip = chip; config.dev = &pdev->dev; + config.init_data = pdata; config.driver_data = ri; - if (max8925_regulator_dt_init(pdev, ri, &config, regulator_idx)) - if (pdata) - config.init_data = pdata; - rdev = regulator_register(&ri->desc, &config); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "failed to register regulator %s\n", @@ -323,7 +257,7 @@ static int max8925_regulator_probe(struct platform_device *pdev) return 0; } -static int max8925_regulator_remove(struct platform_device *pdev) +static int __devexit max8925_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); @@ -339,7 +273,7 @@ static struct platform_driver max8925_regulator_driver = { .owner = THIS_MODULE, }, .probe = max8925_regulator_probe, - .remove = max8925_regulator_remove, + .remove = __devexit_p(max8925_regulator_remove), }; static int __init max8925_regulator_init(void) diff --git a/trunk/drivers/regulator/max8952.c b/trunk/drivers/regulator/max8952.c index fc7935a19e3a..355ca7bad9d5 100644 --- a/trunk/drivers/regulator/max8952.c +++ b/trunk/drivers/regulator/max8952.c @@ -126,7 +126,7 @@ static const struct regulator_desc regulator = { .owner = THIS_MODULE, }; -static int max8952_pmic_probe(struct i2c_client *client, +static int __devinit max8952_pmic_probe(struct i2c_client *client, const struct i2c_device_id *i2c_id) { struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); @@ -247,7 +247,7 @@ static int max8952_pmic_probe(struct i2c_client *client, return 0; } -static int max8952_pmic_remove(struct i2c_client *client) +static int __devexit max8952_pmic_remove(struct i2c_client *client) { struct max8952_data *max8952 = i2c_get_clientdata(client); struct max8952_platform_data *pdata = max8952->pdata; @@ -268,7 +268,7 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids); static struct i2c_driver max8952_pmic_driver = { .probe = max8952_pmic_probe, - .remove = max8952_pmic_remove, + .remove = __devexit_p(max8952_pmic_remove), .driver = { .name = "max8952", }, diff --git a/trunk/drivers/regulator/max8973-regulator.c b/trunk/drivers/regulator/max8973-regulator.c deleted file mode 100644 index 3ee26387b121..000000000000 --- a/trunk/drivers/regulator/max8973-regulator.c +++ /dev/null @@ -1,505 +0,0 @@ -/* - * max8973-regulator.c -- Maxim max8973 - * - * Regulator driver for MAXIM 8973 DC-DC step-down switching regulator. - * - * Copyright (c) 2012, NVIDIA Corporation. - * - * Author: Laxman Dewangan - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, - * whether express or implied; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Register definitions */ -#define MAX8973_VOUT 0x0 -#define MAX8973_VOUT_DVS 0x1 -#define MAX8973_CONTROL1 0x2 -#define MAX8973_CONTROL2 0x3 -#define MAX8973_CHIPID1 0x4 -#define MAX8973_CHIPID2 0x5 - -#define MAX8973_MAX_VOUT_REG 2 - -/* MAX8973_VOUT */ -#define MAX8973_VOUT_ENABLE BIT(7) -#define MAX8973_VOUT_MASK 0x7F - -/* MAX8973_VOUT_DVS */ -#define MAX8973_DVS_VOUT_MASK 0x7F - -/* MAX8973_CONTROL1 */ -#define MAX8973_SNS_ENABLE BIT(7) -#define MAX8973_FPWM_EN_M BIT(6) -#define MAX8973_NFSR_ENABLE BIT(5) -#define MAX8973_AD_ENABLE BIT(4) -#define MAX8973_BIAS_ENABLE BIT(3) -#define MAX8973_FREQSHIFT_9PER BIT(2) - -#define MAX8973_RAMP_12mV_PER_US 0x0 -#define MAX8973_RAMP_25mV_PER_US 0x1 -#define MAX8973_RAMP_50mV_PER_US 0x2 -#define MAX8973_RAMP_200mV_PER_US 0x3 - -/* MAX8973_CONTROL2 */ -#define MAX8973_WDTMR_ENABLE BIT(6) -#define MAX8973_DISCH_ENBABLE BIT(5) -#define MAX8973_FT_ENABLE BIT(4) - -#define MAX8973_CKKADV_TRIP_DISABLE 0xC -#define MAX8973_CKKADV_TRIP_75mV_PER_US 0x0 -#define MAX8973_CKKADV_TRIP_150mV_PER_US 0x4 -#define MAX8973_CKKADV_TRIP_75mV_PER_US_HIST_DIS 0x8 -#define MAX8973_CONTROL_CLKADV_TRIP_MASK 0x00030000 - -#define MAX8973_INDUCTOR_MIN_30_PER 0x0 -#define MAX8973_INDUCTOR_NOMINAL 0x1 -#define MAX8973_INDUCTOR_PLUS_30_PER 0x2 -#define MAX8973_INDUCTOR_PLUS_60_PER 0x3 -#define MAX8973_CONTROL_INDUCTOR_VALUE_MASK 0x00300000 - -#define MAX8973_MIN_VOLATGE 606250 -#define MAX8973_MAX_VOLATGE 1400000 -#define MAX8973_VOLATGE_STEP 6250 -#define MAX8973_BUCK_N_VOLTAGE 0x80 - -/* Maxim 8973 chip information */ -struct max8973_chip { - struct device *dev; - struct regulator_desc desc; - struct regulator_dev *rdev; - struct regmap *regmap; - bool enable_external_control; - int dvs_gpio; - int lru_index[MAX8973_MAX_VOUT_REG]; - int curr_vout_val[MAX8973_MAX_VOUT_REG]; - int curr_vout_reg; - int curr_gpio_val; - bool valid_dvs_gpio; -}; - -/* - * find_voltage_set_register: Find new voltage configuration register (VOUT). - * The finding of the new VOUT register will be based on the LRU mechanism. - * Each VOUT register will have different voltage configured . This - * Function will look if any of the VOUT register have requested voltage set - * or not. - * - If it is already there then it will make that register as most - * recently used and return as found so that caller need not to set - * the VOUT register but need to set the proper gpios to select this - * VOUT register. - * - If requested voltage is not found then it will use the least - * recently mechanism to get new VOUT register for new configuration - * and will return not_found so that caller need to set new VOUT - * register and then gpios (both). - */ -static bool find_voltage_set_register(struct max8973_chip *tps, - int req_vsel, int *vout_reg, int *gpio_val) -{ - int i; - bool found = false; - int new_vout_reg = tps->lru_index[MAX8973_MAX_VOUT_REG - 1]; - int found_index = MAX8973_MAX_VOUT_REG - 1; - - for (i = 0; i < MAX8973_MAX_VOUT_REG; ++i) { - if (tps->curr_vout_val[tps->lru_index[i]] == req_vsel) { - new_vout_reg = tps->lru_index[i]; - found_index = i; - found = true; - goto update_lru_index; - } - } - -update_lru_index: - for (i = found_index; i > 0; i--) - tps->lru_index[i] = tps->lru_index[i - 1]; - - tps->lru_index[0] = new_vout_reg; - *gpio_val = new_vout_reg; - *vout_reg = MAX8973_VOUT + new_vout_reg; - return found; -} - -static int max8973_dcdc_get_voltage_sel(struct regulator_dev *rdev) -{ - struct max8973_chip *max = rdev_get_drvdata(rdev); - unsigned int data; - int ret; - - ret = regmap_read(max->regmap, max->curr_vout_reg, &data); - if (ret < 0) { - dev_err(max->dev, "register %d read failed, err = %d\n", - max->curr_vout_reg, ret); - return ret; - } - return data & MAX8973_VOUT_MASK; -} - -static int max8973_dcdc_set_voltage_sel(struct regulator_dev *rdev, - unsigned vsel) -{ - struct max8973_chip *max = rdev_get_drvdata(rdev); - int ret; - bool found = false; - int vout_reg = max->curr_vout_reg; - int gpio_val = max->curr_gpio_val; - - /* - * If gpios are available to select the VOUT register then least - * recently used register for new configuration. - */ - if (max->valid_dvs_gpio) - found = find_voltage_set_register(max, vsel, - &vout_reg, &gpio_val); - - if (!found) { - ret = regmap_update_bits(max->regmap, vout_reg, - MAX8973_VOUT_MASK, vsel); - if (ret < 0) { - dev_err(max->dev, "register %d update failed, err %d\n", - vout_reg, ret); - return ret; - } - max->curr_vout_reg = vout_reg; - max->curr_vout_val[gpio_val] = vsel; - } - - /* Select proper VOUT register vio gpios */ - if (max->valid_dvs_gpio) { - gpio_set_value_cansleep(max->dvs_gpio, gpio_val & 0x1); - max->curr_gpio_val = gpio_val; - } - return 0; -} - -static int max8973_dcdc_set_mode(struct regulator_dev *rdev, unsigned int mode) -{ - struct max8973_chip *max = rdev_get_drvdata(rdev); - int ret; - int pwm; - - /* Enable force PWM mode in FAST mode only. */ - switch (mode) { - case REGULATOR_MODE_FAST: - pwm = MAX8973_FPWM_EN_M; - break; - - case REGULATOR_MODE_NORMAL: - pwm = 0; - break; - - default: - return -EINVAL; - } - - ret = regmap_update_bits(max->regmap, MAX8973_CONTROL1, - MAX8973_FPWM_EN_M, pwm); - if (ret < 0) - dev_err(max->dev, "register %d update failed, err %d\n", - MAX8973_CONTROL1, ret); - return ret; -} - -static unsigned int max8973_dcdc_get_mode(struct regulator_dev *rdev) -{ - struct max8973_chip *max = rdev_get_drvdata(rdev); - unsigned int data; - int ret; - - ret = regmap_read(max->regmap, MAX8973_CONTROL1, &data); - if (ret < 0) { - dev_err(max->dev, "register %d read failed, err %d\n", - MAX8973_CONTROL1, ret); - return ret; - } - return (data & MAX8973_FPWM_EN_M) ? - REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL; -} - -static struct regulator_ops max8973_dcdc_ops = { - .get_voltage_sel = max8973_dcdc_get_voltage_sel, - .set_voltage_sel = max8973_dcdc_set_voltage_sel, - .list_voltage = regulator_list_voltage_linear, - .set_mode = max8973_dcdc_set_mode, - .get_mode = max8973_dcdc_get_mode, -}; - -static int __devinit max8973_init_dcdc(struct max8973_chip *max, - struct max8973_regulator_platform_data *pdata) -{ - int ret; - uint8_t control1 = 0; - uint8_t control2 = 0; - - if (pdata->control_flags & MAX8973_CONTROL_REMOTE_SENSE_ENABLE) - control1 |= MAX8973_SNS_ENABLE; - - if (!(pdata->control_flags & MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE)) - control1 |= MAX8973_NFSR_ENABLE; - - if (pdata->control_flags & MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE) - control1 |= MAX8973_AD_ENABLE; - - if (pdata->control_flags & MAX8973_CONTROL_BIAS_ENABLE) - control1 |= MAX8973_BIAS_ENABLE; - - if (pdata->control_flags & MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE) - control1 |= MAX8973_FREQSHIFT_9PER; - - /* Set ramp delay */ - if (pdata->reg_init_data && - pdata->reg_init_data->constraints.ramp_delay) { - if (pdata->reg_init_data->constraints.ramp_delay < 25000) - control1 = MAX8973_RAMP_12mV_PER_US; - else if (pdata->reg_init_data->constraints.ramp_delay < 50000) - control1 = MAX8973_RAMP_25mV_PER_US; - else if (pdata->reg_init_data->constraints.ramp_delay < 200000) - control1 = MAX8973_RAMP_50mV_PER_US; - else - control1 = MAX8973_RAMP_200mV_PER_US; - } else { - control1 = MAX8973_RAMP_12mV_PER_US; - max->desc.ramp_delay = 12500; - } - - if (!(pdata->control_flags & MAX8973_CONTROL_PULL_DOWN_ENABLE)) - control2 |= MAX8973_DISCH_ENBABLE; - - /* Clock advance trip configuration */ - switch (pdata->control_flags & MAX8973_CONTROL_CLKADV_TRIP_MASK) { - case MAX8973_CONTROL_CLKADV_TRIP_DISABLED: - control2 |= MAX8973_CKKADV_TRIP_DISABLE; - break; - - case MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US: - control2 |= MAX8973_CKKADV_TRIP_75mV_PER_US; - break; - - case MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US: - control2 |= MAX8973_CKKADV_TRIP_150mV_PER_US; - break; - - case MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS: - control2 |= MAX8973_CKKADV_TRIP_75mV_PER_US_HIST_DIS; - break; - } - - /* Configure inductor value */ - switch (pdata->control_flags & MAX8973_CONTROL_INDUCTOR_VALUE_MASK) { - case MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL: - control2 |= MAX8973_INDUCTOR_NOMINAL; - break; - - case MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER: - control2 |= MAX8973_INDUCTOR_MIN_30_PER; - break; - - case MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER: - control2 |= MAX8973_INDUCTOR_PLUS_30_PER; - break; - - case MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER: - control2 |= MAX8973_INDUCTOR_PLUS_60_PER; - break; - } - - ret = regmap_write(max->regmap, MAX8973_CONTROL1, control1); - if (ret < 0) { - dev_err(max->dev, "register %d write failed, err = %d", - MAX8973_CONTROL1, ret); - return ret; - } - - ret = regmap_write(max->regmap, MAX8973_CONTROL2, control2); - if (ret < 0) { - dev_err(max->dev, "register %d write failed, err = %d", - MAX8973_CONTROL2, ret); - return ret; - } - - /* If external control is enabled then disable EN bit */ - if (max->enable_external_control) { - ret = regmap_update_bits(max->regmap, MAX8973_VOUT, - MAX8973_VOUT_ENABLE, 0); - if (ret < 0) - dev_err(max->dev, "register %d update failed, err = %d", - MAX8973_VOUT, ret); - } - return ret; -} - -static const struct regmap_config max8973_regmap_config = { - .reg_bits = 8, - .val_bits = 8, - .max_register = MAX8973_CHIPID2, - .cache_type = REGCACHE_RBTREE, -}; - -static int __devinit max8973_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct max8973_regulator_platform_data *pdata; - struct regulator_config config = { }; - struct regulator_dev *rdev; - struct max8973_chip *max; - int ret; - - pdata = client->dev.platform_data; - if (!pdata) { - dev_err(&client->dev, "No Platform data"); - return -EIO; - } - - max = devm_kzalloc(&client->dev, sizeof(*max), GFP_KERNEL); - if (!max) { - dev_err(&client->dev, "Memory allocation for max failed\n"); - return -ENOMEM; - } - - max->regmap = devm_regmap_init_i2c(client, &max8973_regmap_config); - if (IS_ERR(max->regmap)) { - ret = PTR_ERR(max->regmap); - dev_err(&client->dev, "regmap init failed, err %d\n", ret); - return ret; - } - - i2c_set_clientdata(client, max); - max->dev = &client->dev; - max->desc.name = id->name; - max->desc.id = 0; - max->desc.ops = &max8973_dcdc_ops; - max->desc.type = REGULATOR_VOLTAGE; - max->desc.owner = THIS_MODULE; - max->desc.min_uV = MAX8973_MIN_VOLATGE; - max->desc.uV_step = MAX8973_VOLATGE_STEP; - max->desc.n_voltages = MAX8973_BUCK_N_VOLTAGE; - - if (!pdata->enable_ext_control) { - max->desc.enable_reg = MAX8973_VOUT; - max->desc.enable_mask = MAX8973_VOUT_ENABLE; - max8973_dcdc_ops.enable = regulator_enable_regmap; - max8973_dcdc_ops.disable = regulator_disable_regmap; - max8973_dcdc_ops.is_enabled = regulator_is_enabled_regmap; - } - - max->enable_external_control = pdata->enable_ext_control; - max->dvs_gpio = pdata->dvs_gpio; - max->curr_gpio_val = pdata->dvs_def_state; - max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state; - max->lru_index[0] = max->curr_vout_reg; - max->valid_dvs_gpio = false; - - if (gpio_is_valid(max->dvs_gpio)) { - int gpio_flags; - int i; - - gpio_flags = (pdata->dvs_def_state) ? - GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; - ret = devm_gpio_request_one(&client->dev, max->dvs_gpio, - gpio_flags, "max8973-dvs"); - if (ret) { - dev_err(&client->dev, - "gpio_request for gpio %d failed, err = %d\n", - max->dvs_gpio, ret); - return ret; - } - max->valid_dvs_gpio = true; - - /* - * Initialize the lru index with vout_reg id - * The index 0 will be most recently used and - * set with the max->curr_vout_reg */ - for (i = 0; i < MAX8973_MAX_VOUT_REG; ++i) - max->lru_index[i] = i; - max->lru_index[0] = max->curr_vout_reg; - max->lru_index[max->curr_vout_reg] = 0; - } - - ret = max8973_init_dcdc(max, pdata); - if (ret < 0) { - dev_err(max->dev, "Max8973 Init failed, err = %d\n", ret); - return ret; - } - - config.dev = &client->dev; - config.init_data = pdata->reg_init_data; - config.driver_data = max; - config.of_node = client->dev.of_node; - config.regmap = max->regmap; - - /* Register the regulators */ - rdev = regulator_register(&max->desc, &config); - if (IS_ERR(rdev)) { - ret = PTR_ERR(rdev); - dev_err(max->dev, "regulator register failed, err %d\n", ret); - return ret; - } - - max->rdev = rdev; - return 0; -} - -static int __devexit max8973_remove(struct i2c_client *client) -{ - struct max8973_chip *max = i2c_get_clientdata(client); - - regulator_unregister(max->rdev); - return 0; -} - -static const struct i2c_device_id max8973_id[] = { - {.name = "max8973",}, - {}, -}; - -MODULE_DEVICE_TABLE(i2c, max8973_id); - -static struct i2c_driver max8973_i2c_driver = { - .driver = { - .name = "max8973", - .owner = THIS_MODULE, - }, - .probe = max8973_probe, - .remove = __devexit_p(max8973_remove), - .id_table = max8973_id, -}; - -static int __init max8973_init(void) -{ - return i2c_add_driver(&max8973_i2c_driver); -} -subsys_initcall(max8973_init); - -static void __exit max8973_cleanup(void) -{ - i2c_del_driver(&max8973_i2c_driver); -} -module_exit(max8973_cleanup); - -MODULE_AUTHOR("Laxman Dewangan "); -MODULE_DESCRIPTION("MAX8973 voltage regulator driver"); -MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/regulator/max8997.c b/trunk/drivers/regulator/max8997.c index df0eafb0dc7e..e39a0c7260dc 100644 --- a/trunk/drivers/regulator/max8997.c +++ b/trunk/drivers/regulator/max8997.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -32,7 +31,6 @@ #include #include #include -#include struct max8997_data { struct device *dev; @@ -935,163 +933,22 @@ static struct regulator_desc regulators[] = { max8997_charger_fixedstate_ops), }; -#ifdef CONFIG_OF -static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev, - struct max8997_platform_data *pdata, - struct device_node *pmic_np) -{ - int i, gpio; - - for (i = 0; i < 3; i++) { - gpio = of_get_named_gpio(pmic_np, - "max8997,pmic-buck125-dvs-gpios", i); - if (!gpio_is_valid(gpio)) { - dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio); - return -EINVAL; - } - pdata->buck125_gpios[i] = gpio; - } - return 0; -} - -static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, - struct max8997_platform_data *pdata) -{ - struct device_node *pmic_np, *regulators_np, *reg_np; - struct max8997_regulator_data *rdata; - unsigned int i, dvs_voltage_nr = 1, ret; - - pmic_np = iodev->dev->of_node; - if (!pmic_np) { - dev_err(iodev->dev, "could not find pmic sub-node\n"); - return -ENODEV; - } - - regulators_np = of_find_node_by_name(pmic_np, "regulators"); - if (!regulators_np) { - dev_err(iodev->dev, "could not find regulators sub-node\n"); - return -EINVAL; - } - - /* count the number of regulators to be supported in pmic */ - pdata->num_regulators = 0; - for_each_child_of_node(regulators_np, reg_np) - pdata->num_regulators++; - - rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) * - pdata->num_regulators, GFP_KERNEL); - if (!rdata) { - dev_err(iodev->dev, "could not allocate memory for " - "regulator data\n"); - return -ENOMEM; - } - - pdata->regulators = rdata; - for_each_child_of_node(regulators_np, reg_np) { - for (i = 0; i < ARRAY_SIZE(regulators); i++) - if (!of_node_cmp(reg_np->name, regulators[i].name)) - break; - - if (i == ARRAY_SIZE(regulators)) { - dev_warn(iodev->dev, "don't know how to configure " - "regulator %s\n", reg_np->name); - continue; - } - - rdata->id = i; - rdata->initdata = of_get_regulator_init_data( - iodev->dev, reg_np); - rdata->reg_node = reg_np; - rdata++; - } - - if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL)) - pdata->buck1_gpiodvs = true; - - if (of_get_property(pmic_np, "max8997,pmic-buck2-uses-gpio-dvs", NULL)) - pdata->buck2_gpiodvs = true; - - if (of_get_property(pmic_np, "max8997,pmic-buck5-uses-gpio-dvs", NULL)) - pdata->buck5_gpiodvs = true; - - if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || - pdata->buck5_gpiodvs) { - ret = max8997_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np); - if (ret) - return -EINVAL; - - if (of_property_read_u32(pmic_np, - "max8997,pmic-buck125-default-dvs-idx", - &pdata->buck125_default_idx)) { - pdata->buck125_default_idx = 0; - } else { - if (pdata->buck125_default_idx >= 8) { - pdata->buck125_default_idx = 0; - dev_info(iodev->dev, "invalid value for " - "default dvs index, using 0 instead\n"); - } - } - - if (of_get_property(pmic_np, - "max8997,pmic-ignore-gpiodvs-side-effect", NULL)) - pdata->ignore_gpiodvs_side_effect = true; - - dvs_voltage_nr = 8; - } - - if (of_property_read_u32_array(pmic_np, - "max8997,pmic-buck1-dvs-voltage", - pdata->buck1_voltage, dvs_voltage_nr)) { - dev_err(iodev->dev, "buck1 voltages not specified\n"); - return -EINVAL; - } - - if (of_property_read_u32_array(pmic_np, - "max8997,pmic-buck2-dvs-voltage", - pdata->buck2_voltage, dvs_voltage_nr)) { - dev_err(iodev->dev, "buck2 voltages not specified\n"); - return -EINVAL; - } - - if (of_property_read_u32_array(pmic_np, - "max8997,pmic-buck5-dvs-voltage", - pdata->buck5_voltage, dvs_voltage_nr)) { - dev_err(iodev->dev, "buck5 voltages not specified\n"); - return -EINVAL; - } - - return 0; -} -#else -static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev, - struct max8997_platform_data *pdata) -{ - return 0; -} -#endif /* CONFIG_OF */ - -static int max8997_pmic_probe(struct platform_device *pdev) +static __devinit int max8997_pmic_probe(struct platform_device *pdev) { struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); - struct max8997_platform_data *pdata = iodev->pdata; + struct max8997_platform_data *pdata = dev_get_platdata(iodev->dev); struct regulator_config config = { }; struct regulator_dev **rdev; struct max8997_data *max8997; struct i2c_client *i2c; - int i, ret, size, nr_dvs; + int i, ret, size; u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; - if (IS_ERR_OR_NULL(pdata)) { + if (!pdata) { dev_err(pdev->dev.parent, "No platform init data supplied.\n"); return -ENODEV; } - if (iodev->dev->of_node) { - ret = max8997_pmic_dt_parse_pdata(iodev, pdata); - if (ret) - return ret; - } - max8997 = devm_kzalloc(&pdev->dev, sizeof(struct max8997_data), GFP_KERNEL); if (!max8997) @@ -1116,10 +973,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3); max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect; - nr_dvs = (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || - pdata->buck5_gpiodvs) ? 8 : 1; - - for (i = 0; i < nr_dvs; i++) { + for (i = 0; i < 8; i++) { max8997->buck1_vol[i] = ret = max8997_get_voltage_proper_val( &buck1245_voltage_map_desc, @@ -1165,19 +1019,6 @@ static int max8997_pmic_probe(struct platform_device *pdev) max_buck5, 0x3f); } - /* Initialize all the DVS related BUCK registers */ - for (i = 0; i < nr_dvs; i++) { - max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i, - max8997->buck1_vol[i], - 0x3f); - max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS1 + i, - max8997->buck2_vol[i], - 0x3f); - max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS1 + i, - max8997->buck5_vol[i], - 0x3f); - } - /* * If buck 1, 2, and 5 do not care DVS GPIO settings, ignore them. * If at least one of them cares, set gpios. @@ -1227,6 +1068,19 @@ static int max8997_pmic_probe(struct platform_device *pdev) max8997_update_reg(i2c, MAX8997_REG_BUCK5CTRL, (pdata->buck5_gpiodvs) ? (1 << 1) : (0 << 1), 1 << 1); + /* Initialize all the DVS related BUCK registers */ + for (i = 0; i < 8; i++) { + max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i, + max8997->buck1_vol[i], + 0x3f); + max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS1 + i, + max8997->buck2_vol[i], + 0x3f); + max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS1 + i, + max8997->buck5_vol[i], + 0x3f); + } + /* Misc Settings */ max8997->ramp_delay = 10; /* set 10mV/us, which is the default */ max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9); @@ -1247,7 +1101,6 @@ static int max8997_pmic_probe(struct platform_device *pdev) config.dev = max8997->dev; config.init_data = pdata->regulators[i].initdata; config.driver_data = max8997; - config.of_node = pdata->regulators[i].reg_node; rdev[i] = regulator_register(®ulators[id], &config); if (IS_ERR(rdev[i])) { @@ -1267,7 +1120,7 @@ static int max8997_pmic_probe(struct platform_device *pdev) return ret; } -static int max8997_pmic_remove(struct platform_device *pdev) +static int __devexit max8997_pmic_remove(struct platform_device *pdev) { struct max8997_data *max8997 = platform_get_drvdata(pdev); struct regulator_dev **rdev = max8997->rdev; @@ -1290,7 +1143,7 @@ static struct platform_driver max8997_pmic_driver = { .owner = THIS_MODULE, }, .probe = max8997_pmic_probe, - .remove = max8997_pmic_remove, + .remove = __devexit_p(max8997_pmic_remove), .id_table = max8997_pmic_id, }; diff --git a/trunk/drivers/regulator/max8998.c b/trunk/drivers/regulator/max8998.c index b821d08eb64a..5dfa920ff0c8 100644 --- a/trunk/drivers/regulator/max8998.c +++ b/trunk/drivers/regulator/max8998.c @@ -633,7 +633,7 @@ static struct regulator_desc regulators[] = { } }; -static int max8998_pmic_probe(struct platform_device *pdev) +static __devinit int max8998_pmic_probe(struct platform_device *pdev) { struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev); @@ -818,7 +818,7 @@ static int max8998_pmic_probe(struct platform_device *pdev) return ret; } -static int max8998_pmic_remove(struct platform_device *pdev) +static int __devexit max8998_pmic_remove(struct platform_device *pdev) { struct max8998_data *max8998 = platform_get_drvdata(pdev); struct regulator_dev **rdev = max8998->rdev; @@ -842,7 +842,7 @@ static struct platform_driver max8998_pmic_driver = { .owner = THIS_MODULE, }, .probe = max8998_pmic_probe, - .remove = max8998_pmic_remove, + .remove = __devexit_p(max8998_pmic_remove), .id_table = max8998_pmic_id, }; diff --git a/trunk/drivers/regulator/mc13783-regulator.c b/trunk/drivers/regulator/mc13783-regulator.c index c46c6705cd74..0801a6d0c122 100644 --- a/trunk/drivers/regulator/mc13783-regulator.c +++ b/trunk/drivers/regulator/mc13783-regulator.c @@ -392,7 +392,7 @@ static struct regulator_ops mc13783_gpo_regulator_ops = { .set_voltage = mc13xxx_fixed_regulator_set_voltage, }; -static int mc13783_regulator_probe(struct platform_device *pdev) +static int __devinit mc13783_regulator_probe(struct platform_device *pdev) { struct mc13xxx_regulator_priv *priv; struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); @@ -445,7 +445,7 @@ static int mc13783_regulator_probe(struct platform_device *pdev) return ret; } -static int mc13783_regulator_remove(struct platform_device *pdev) +static int __devexit mc13783_regulator_remove(struct platform_device *pdev) { struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); struct mc13xxx_regulator_platform_data *pdata = @@ -465,7 +465,7 @@ static struct platform_driver mc13783_regulator_driver = { .name = "mc13783-regulator", .owner = THIS_MODULE, }, - .remove = mc13783_regulator_remove, + .remove = __devexit_p(mc13783_regulator_remove), .probe = mc13783_regulator_probe, }; diff --git a/trunk/drivers/regulator/mc13892-regulator.c b/trunk/drivers/regulator/mc13892-regulator.c index 0d84b1f33199..1fa63812f7ac 100644 --- a/trunk/drivers/regulator/mc13892-regulator.c +++ b/trunk/drivers/regulator/mc13892-regulator.c @@ -486,7 +486,7 @@ static unsigned int mc13892_vcam_get_mode(struct regulator_dev *rdev) } -static int mc13892_regulator_probe(struct platform_device *pdev) +static int __devinit mc13892_regulator_probe(struct platform_device *pdev) { struct mc13xxx_regulator_priv *priv; struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent); @@ -588,7 +588,7 @@ static int mc13892_regulator_probe(struct platform_device *pdev) return ret; } -static int mc13892_regulator_remove(struct platform_device *pdev) +static int __devexit mc13892_regulator_remove(struct platform_device *pdev) { struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); int i; @@ -606,7 +606,7 @@ static struct platform_driver mc13892_regulator_driver = { .name = "mc13892-regulator", .owner = THIS_MODULE, }, - .remove = mc13892_regulator_remove, + .remove = __devexit_p(mc13892_regulator_remove), .probe = mc13892_regulator_probe, }; diff --git a/trunk/drivers/regulator/mc13xxx-regulator-core.c b/trunk/drivers/regulator/mc13xxx-regulator-core.c index 4ed89c654110..88cbb832d555 100644 --- a/trunk/drivers/regulator/mc13xxx-regulator-core.c +++ b/trunk/drivers/regulator/mc13xxx-regulator-core.c @@ -162,7 +162,7 @@ struct regulator_ops mc13xxx_fixed_regulator_ops = { EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_ops); #ifdef CONFIG_OF -int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) +int __devinit mc13xxx_get_num_regulators_dt(struct platform_device *pdev) { struct device_node *parent, *child; int num = 0; @@ -179,7 +179,7 @@ int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) } EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); -struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( +struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt( struct platform_device *pdev, struct mc13xxx_regulator *regulators, int num_regulators) { diff --git a/trunk/drivers/regulator/palmas-regulator.c b/trunk/drivers/regulator/palmas-regulator.c index e915629a25cf..07aee694ba92 100644 --- a/trunk/drivers/regulator/palmas-regulator.c +++ b/trunk/drivers/regulator/palmas-regulator.c @@ -309,22 +309,68 @@ static int palmas_list_voltage_smps(struct regulator_dev *dev, int id = rdev_get_id(dev); int mult = 1; + if (!selector) + return 0; + /* Read the multiplier set in VSEL register to return * the correct voltage. */ if (pmic->range[id]) mult = 2; - if (selector == 0) - return 0; - else if (selector < 6) - return 500000 * mult; - else - /* Voltage is linear mapping starting from selector 6, - * volt = (0.49V + ((selector - 5) * 0.01V)) * RANGE - * RANGE is either x1 or x2 - */ - return (490000 + ((selector - 5) * 10000)) * mult; + /* Voltage is (0.49V + (selector * 0.01V)) * RANGE + * as defined in data sheet. RANGE is either x1 or x2 + */ + return (490000 + (selector * 10000)) * mult; +} + +static int palmas_get_voltage_smps_sel(struct regulator_dev *dev) +{ + struct palmas_pmic *pmic = rdev_get_drvdata(dev); + int id = rdev_get_id(dev); + int selector; + unsigned int reg; + unsigned int addr; + + addr = palmas_regs_info[id].vsel_addr; + + palmas_smps_read(pmic->palmas, addr, ®); + + selector = reg & PALMAS_SMPS12_VOLTAGE_VSEL_MASK; + + /* Adjust selector to match list_voltage ranges */ + if ((selector > 0) && (selector < 6)) + selector = 6; + if (!selector) + selector = 5; + if (selector > 121) + selector = 121; + selector -= 5; + + return selector; +} + +static int palmas_set_voltage_smps_sel(struct regulator_dev *dev, + unsigned selector) +{ + struct palmas_pmic *pmic = rdev_get_drvdata(dev); + int id = rdev_get_id(dev); + unsigned int reg = 0; + unsigned int addr; + + addr = palmas_regs_info[id].vsel_addr; + + /* Make sure we don't change the value of RANGE */ + if (pmic->range[id]) + reg |= PALMAS_SMPS12_VOLTAGE_RANGE; + + /* Adjust the linux selector into range used in VSEL register */ + if (selector) + reg |= selector + 5; + + palmas_smps_write(pmic->palmas, addr, reg); + + return 0; } static int palmas_map_voltage_smps(struct regulator_dev *rdev, @@ -340,11 +386,11 @@ static int palmas_map_voltage_smps(struct regulator_dev *rdev, if (pmic->range[id]) { /* RANGE is x2 */ if (min_uV < 1000000) min_uV = 1000000; - ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 6; + ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 1; } else { /* RANGE is x1 */ if (min_uV < 500000) min_uV = 500000; - ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 6; + ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 1; } /* Map back into a voltage to verify we're still in bounds */ @@ -361,8 +407,8 @@ static struct regulator_ops palmas_ops_smps = { .disable = palmas_disable_smps, .set_mode = palmas_set_mode_smps, .get_mode = palmas_get_mode_smps, - .get_voltage_sel = regulator_get_voltage_sel_regmap, - .set_voltage_sel = regulator_set_voltage_sel_regmap, + .get_voltage_sel = palmas_get_voltage_smps_sel, + .set_voltage_sel = palmas_set_voltage_smps_sel, .list_voltage = palmas_list_voltage_smps, .map_voltage = palmas_map_voltage_smps, }; @@ -390,14 +436,44 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev) return !!(reg); } +static int palmas_list_voltage_ldo(struct regulator_dev *dev, + unsigned selector) +{ + if (!selector) + return 0; + + /* voltage is 0.85V + (selector * 0.05v) */ + return 850000 + (selector * 50000); +} + +static int palmas_map_voltage_ldo(struct regulator_dev *rdev, + int min_uV, int max_uV) +{ + int ret, voltage; + + if (min_uV == 0) + return 0; + + if (min_uV < 900000) + min_uV = 900000; + ret = DIV_ROUND_UP(min_uV - 900000, 50000) + 1; + + /* Map back into a voltage to verify we're still in bounds */ + voltage = palmas_list_voltage_ldo(rdev, ret); + if (voltage < min_uV || voltage > max_uV) + return -EINVAL; + + return ret; +} + static struct regulator_ops palmas_ops_ldo = { .is_enabled = palmas_is_enabled_ldo, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, - .list_voltage = regulator_list_voltage_linear, - .map_voltage = regulator_map_voltage_linear, + .list_voltage = palmas_list_voltage_ldo, + .map_voltage = palmas_map_voltage_ldo, }; /* @@ -519,7 +595,7 @@ static struct of_regulator_match palmas_matches[] = { { .name = "ldousb", }, }; -static void palmas_dt_to_pdata(struct device *dev, +static void __devinit palmas_dt_to_pdata(struct device *dev, struct device_node *node, struct palmas_pmic_platform_data *pdata) { @@ -587,7 +663,7 @@ static void palmas_dt_to_pdata(struct device *dev, } -static int palmas_probe(struct platform_device *pdev) +static __devinit int palmas_probe(struct platform_device *pdev) { struct palmas *palmas = dev_get_drvdata(pdev->dev.parent); struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data; @@ -657,14 +733,6 @@ static int palmas_probe(struct platform_device *pdev) continue; } - /* Initialise sleep/init values from platform data */ - if (pdata && pdata->reg_init[id]) { - reg_init = pdata->reg_init[id]; - ret = palmas_smps_init(palmas, id, reg_init); - if (ret) - goto err_unregister_regulator; - } - /* Register the regulators */ pmic->desc[id].name = palmas_regs_info[id].name; pmic->desc[id].id = id; @@ -685,11 +753,29 @@ static int palmas_probe(struct platform_device *pdev) pmic->desc[id].uV_step = 1250000; break; default: - /* - * Read and store the RANGE bit for later use - * This must be done before regulator is probed, - * otherwise we error in probe with unsupportable ranges. - */ + pmic->desc[id].ops = &palmas_ops_smps; + pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES; + } + + pmic->desc[id].type = REGULATOR_VOLTAGE; + pmic->desc[id].owner = THIS_MODULE; + + /* Initialise sleep/init values from platform data */ + if (pdata) { + reg_init = pdata->reg_init[id]; + if (reg_init) { + ret = palmas_smps_init(palmas, id, reg_init); + if (ret) + goto err_unregister_regulator; + } + } + + /* + * read and store the RANGE bit for later use + * This must be done before regulator is probed otherwise + * we error in probe with unsuportable ranges. + */ + if (id != PALMAS_REG_SMPS10) { addr = palmas_regs_info[id].vsel_addr; ret = palmas_smps_read(pmic->palmas, addr, ®); @@ -697,19 +783,8 @@ static int palmas_probe(struct platform_device *pdev) goto err_unregister_regulator; if (reg & PALMAS_SMPS12_VOLTAGE_RANGE) pmic->range[id] = 1; - - pmic->desc[id].ops = &palmas_ops_smps; - pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES; - pmic->desc[id].vsel_reg = - PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, - palmas_regs_info[id].vsel_addr); - pmic->desc[id].vsel_mask = - PALMAS_SMPS12_VOLTAGE_VSEL_MASK; } - pmic->desc[id].type = REGULATOR_VOLTAGE; - pmic->desc[id].owner = THIS_MODULE; - if (pdata) config.init_data = pdata->reg_data[id]; else @@ -746,9 +821,6 @@ static int palmas_probe(struct platform_device *pdev) pmic->desc[id].type = REGULATOR_VOLTAGE; pmic->desc[id].owner = THIS_MODULE; - pmic->desc[id].min_uV = 900000; - pmic->desc[id].uV_step = 50000; - pmic->desc[id].linear_min_sel = 1; pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, palmas_regs_info[id].vsel_addr); pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK; @@ -796,7 +868,7 @@ static int palmas_probe(struct platform_device *pdev) return ret; } -static int palmas_remove(struct platform_device *pdev) +static int __devexit palmas_remove(struct platform_device *pdev) { struct palmas_pmic *pmic = platform_get_drvdata(pdev); int id; @@ -818,7 +890,7 @@ static struct platform_driver palmas_driver = { .owner = THIS_MODULE, }, .probe = palmas_probe, - .remove = palmas_remove, + .remove = __devexit_p(palmas_remove), }; static int __init palmas_init(void) diff --git a/trunk/drivers/regulator/pcap-regulator.c b/trunk/drivers/regulator/pcap-regulator.c index 4899342f1fc1..68777acc099f 100644 --- a/trunk/drivers/regulator/pcap-regulator.c +++ b/trunk/drivers/regulator/pcap-regulator.c @@ -236,7 +236,7 @@ static const struct regulator_desc pcap_regulators[] = { VREG(VAUX4), VREG(VSIM), VREG(VSIM2), VREG(VVIB), VREG(SW1), VREG(SW2), }; -static int pcap_regulator_probe(struct platform_device *pdev) +static int __devinit pcap_regulator_probe(struct platform_device *pdev) { struct regulator_dev *rdev; void *pcap = dev_get_drvdata(pdev->dev.parent); @@ -255,7 +255,7 @@ static int pcap_regulator_probe(struct platform_device *pdev) return 0; } -static int pcap_regulator_remove(struct platform_device *pdev) +static int __devexit pcap_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); @@ -271,7 +271,7 @@ static struct platform_driver pcap_regulator_driver = { .owner = THIS_MODULE, }, .probe = pcap_regulator_probe, - .remove = pcap_regulator_remove, + .remove = __devexit_p(pcap_regulator_remove), }; static int __init pcap_regulator_init(void) diff --git a/trunk/drivers/regulator/pcf50633-regulator.c b/trunk/drivers/regulator/pcf50633-regulator.c index 534075e13d6d..092e5cb848a1 100644 --- a/trunk/drivers/regulator/pcf50633-regulator.c +++ b/trunk/drivers/regulator/pcf50633-regulator.c @@ -24,15 +24,12 @@ #include #include -#define PCF50633_REGULATOR(_name, _id, _min_uV, _uV_step, _min_sel, _n) \ +#define PCF50633_REGULATOR(_name, _id, _n) \ { \ .name = _name, \ .id = PCF50633_REGULATOR_##_id, \ .ops = &pcf50633_regulator_ops, \ .n_voltages = _n, \ - .min_uV = _min_uV, \ - .uV_step = _uV_step, \ - .linear_min_sel = _min_sel, \ .type = REGULATOR_VOLTAGE, \ .owner = THIS_MODULE, \ .vsel_reg = PCF50633_REG_##_id##OUT, \ @@ -41,42 +38,165 @@ .enable_mask = PCF50633_REGULATOR_ON, \ } +/* Bits from voltage value */ +static u8 auto_voltage_bits(unsigned int millivolts) +{ + if (millivolts < 1800) + return 0x2f; + if (millivolts > 3800) + return 0xff; + + millivolts -= 625; + + return millivolts / 25; +} + +static u8 down_voltage_bits(unsigned int millivolts) +{ + if (millivolts < 625) + return 0; + else if (millivolts > 3000) + return 0xff; + + millivolts -= 625; + + return millivolts / 25; +} + +static u8 ldo_voltage_bits(unsigned int millivolts) +{ + if (millivolts < 900) + return 0; + else if (millivolts > 3600) + return 0x1f; + + millivolts -= 900; + return millivolts / 100; +} + +/* Obtain voltage value from bits */ +static unsigned int auto_voltage_value(u8 bits) +{ + /* AUTOOUT: 00000000 to 00101110 are reserved. + * Return 0 for bits in reserved range, which means this selector code + * can't be used on this system */ + if (bits < 0x2f) + return 0; + + return 625 + (bits * 25); +} + + +static unsigned int down_voltage_value(u8 bits) +{ + return 625 + (bits * 25); +} + + +static unsigned int ldo_voltage_value(u8 bits) +{ + bits &= 0x1f; + + return 900 + (bits * 100); +} + +static int pcf50633_regulator_map_voltage(struct regulator_dev *rdev, + int min_uV, int max_uV) +{ + struct pcf50633 *pcf; + int regulator_id, millivolts; + u8 volt_bits; + + pcf = rdev_get_drvdata(rdev); + + regulator_id = rdev_get_id(rdev); + if (regulator_id >= PCF50633_NUM_REGULATORS) + return -EINVAL; + + millivolts = min_uV / 1000; + + switch (regulator_id) { + case PCF50633_REGULATOR_AUTO: + volt_bits = auto_voltage_bits(millivolts); + break; + case PCF50633_REGULATOR_DOWN1: + case PCF50633_REGULATOR_DOWN2: + volt_bits = down_voltage_bits(millivolts); + break; + case PCF50633_REGULATOR_LDO1: + case PCF50633_REGULATOR_LDO2: + case PCF50633_REGULATOR_LDO3: + case PCF50633_REGULATOR_LDO4: + case PCF50633_REGULATOR_LDO5: + case PCF50633_REGULATOR_LDO6: + case PCF50633_REGULATOR_HCLDO: + case PCF50633_REGULATOR_MEMLDO: + volt_bits = ldo_voltage_bits(millivolts); + break; + default: + return -EINVAL; + } + + return volt_bits; +} + +static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, + unsigned int index) +{ + int regulator_id = rdev_get_id(rdev); + + int millivolts; + + switch (regulator_id) { + case PCF50633_REGULATOR_AUTO: + millivolts = auto_voltage_value(index); + break; + case PCF50633_REGULATOR_DOWN1: + case PCF50633_REGULATOR_DOWN2: + millivolts = down_voltage_value(index); + break; + case PCF50633_REGULATOR_LDO1: + case PCF50633_REGULATOR_LDO2: + case PCF50633_REGULATOR_LDO3: + case PCF50633_REGULATOR_LDO4: + case PCF50633_REGULATOR_LDO5: + case PCF50633_REGULATOR_LDO6: + case PCF50633_REGULATOR_HCLDO: + case PCF50633_REGULATOR_MEMLDO: + millivolts = ldo_voltage_value(index); + break; + default: + return -EINVAL; + } + + return millivolts * 1000; +} + static struct regulator_ops pcf50633_regulator_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, - .list_voltage = regulator_list_voltage_linear, - .map_voltage = regulator_map_voltage_linear, + .list_voltage = pcf50633_regulator_list_voltage, + .map_voltage = pcf50633_regulator_map_voltage, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, }; static const struct regulator_desc regulators[] = { - [PCF50633_REGULATOR_AUTO] = - PCF50633_REGULATOR("auto", AUTO, 1800000, 25000, 0x2f, 128), - [PCF50633_REGULATOR_DOWN1] = - PCF50633_REGULATOR("down1", DOWN1, 625000, 25000, 0, 96), - [PCF50633_REGULATOR_DOWN2] = - PCF50633_REGULATOR("down2", DOWN2, 625000, 25000, 0, 96), - [PCF50633_REGULATOR_LDO1] = - PCF50633_REGULATOR("ldo1", LDO1, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_LDO2] = - PCF50633_REGULATOR("ldo2", LDO2, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_LDO3] = - PCF50633_REGULATOR("ldo3", LDO3, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_LDO4] = - PCF50633_REGULATOR("ldo4", LDO4, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_LDO5] = - PCF50633_REGULATOR("ldo5", LDO5, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_LDO6] = - PCF50633_REGULATOR("ldo6", LDO6, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_HCLDO] = - PCF50633_REGULATOR("hcldo", HCLDO, 900000, 100000, 0, 28), - [PCF50633_REGULATOR_MEMLDO] = - PCF50633_REGULATOR("memldo", MEMLDO, 900000, 100000, 0, 28), + [PCF50633_REGULATOR_AUTO] = PCF50633_REGULATOR("auto", AUTO, 128), + [PCF50633_REGULATOR_DOWN1] = PCF50633_REGULATOR("down1", DOWN1, 96), + [PCF50633_REGULATOR_DOWN2] = PCF50633_REGULATOR("down2", DOWN2, 96), + [PCF50633_REGULATOR_LDO1] = PCF50633_REGULATOR("ldo1", LDO1, 28), + [PCF50633_REGULATOR_LDO2] = PCF50633_REGULATOR("ldo2", LDO2, 28), + [PCF50633_REGULATOR_LDO3] = PCF50633_REGULATOR("ldo3", LDO3, 28), + [PCF50633_REGULATOR_LDO4] = PCF50633_REGULATOR("ldo4", LDO4, 28), + [PCF50633_REGULATOR_LDO5] = PCF50633_REGULATOR("ldo5", LDO5, 28), + [PCF50633_REGULATOR_LDO6] = PCF50633_REGULATOR("ldo6", LDO6, 28), + [PCF50633_REGULATOR_HCLDO] = PCF50633_REGULATOR("hcldo", HCLDO, 28), + [PCF50633_REGULATOR_MEMLDO] = PCF50633_REGULATOR("memldo", MEMLDO, 28), }; -static int pcf50633_regulator_probe(struct platform_device *pdev) +static int __devinit pcf50633_regulator_probe(struct platform_device *pdev) { struct regulator_dev *rdev; struct pcf50633 *pcf; @@ -102,7 +222,7 @@ static int pcf50633_regulator_probe(struct platform_device *pdev) return 0; } -static int pcf50633_regulator_remove(struct platform_device *pdev) +static int __devexit pcf50633_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); @@ -117,7 +237,7 @@ static struct platform_driver pcf50633_regulator_driver = { .name = "pcf50633-regltr", }, .probe = pcf50633_regulator_probe, - .remove = pcf50633_regulator_remove, + .remove = __devexit_p(pcf50633_regulator_remove), }; static int __init pcf50633_regulator_init(void) diff --git a/trunk/drivers/regulator/rc5t583-regulator.c b/trunk/drivers/regulator/rc5t583-regulator.c index 9e6f78694bf1..8bf4e8c9de9a 100644 --- a/trunk/drivers/regulator/rc5t583-regulator.c +++ b/trunk/drivers/regulator/rc5t583-regulator.c @@ -119,7 +119,7 @@ static struct rc5t583_regulator_info rc5t583_reg_info[RC5T583_REGULATOR_MAX] = { RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, 0x7F, 900, 3400, 25000, 133), }; -static int rc5t583_regulator_probe(struct platform_device *pdev) +static int __devinit rc5t583_regulator_probe(struct platform_device *pdev) { struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent); struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev); @@ -198,7 +198,7 @@ static int rc5t583_regulator_probe(struct platform_device *pdev) return ret; } -static int rc5t583_regulator_remove(struct platform_device *pdev) +static int __devexit rc5t583_regulator_remove(struct platform_device *pdev) { struct rc5t583_regulator *regs = platform_get_drvdata(pdev); int id; @@ -214,7 +214,7 @@ static struct platform_driver rc5t583_regulator_driver = { .owner = THIS_MODULE, }, .probe = rc5t583_regulator_probe, - .remove = rc5t583_regulator_remove, + .remove = __devexit_p(rc5t583_regulator_remove), }; static int __init rc5t583_regulator_init(void) diff --git a/trunk/drivers/regulator/s2mps11.c b/trunk/drivers/regulator/s2mps11.c index bd062a2ffbe2..926f9c8f2fac 100644 --- a/trunk/drivers/regulator/s2mps11.c +++ b/trunk/drivers/regulator/s2mps11.c @@ -231,7 +231,7 @@ static struct regulator_desc regulators[] = { regulator_desc_buck10, }; -static int s2mps11_pmic_probe(struct platform_device *pdev) +static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) { struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); @@ -269,16 +269,16 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) if (ramp_enable) { if (s2mps11->buck2_ramp) - ramp_reg |= get_ramp_delay(s2mps11->ramp_delay2) << 6; + ramp_reg |= get_ramp_delay(s2mps11->ramp_delay2) >> 6; if (s2mps11->buck3_ramp || s2mps11->buck4_ramp) - ramp_reg |= get_ramp_delay(s2mps11->ramp_delay34) << 4; + ramp_reg |= get_ramp_delay(s2mps11->ramp_delay34) >> 4; sec_reg_write(iodev, S2MPS11_REG_RAMP, ramp_reg | ramp_enable); } ramp_reg &= 0x00; - ramp_reg |= get_ramp_delay(s2mps11->ramp_delay5) << 6; - ramp_reg |= get_ramp_delay(s2mps11->ramp_delay16) << 4; - ramp_reg |= get_ramp_delay(s2mps11->ramp_delay7810) << 2; + ramp_reg |= get_ramp_delay(s2mps11->ramp_delay5) >> 6; + ramp_reg |= get_ramp_delay(s2mps11->ramp_delay16) >> 4; + ramp_reg |= get_ramp_delay(s2mps11->ramp_delay7810) >> 2; ramp_reg |= get_ramp_delay(s2mps11->ramp_delay9); sec_reg_write(iodev, S2MPS11_REG_RAMP_BUCK, ramp_reg); @@ -307,7 +307,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) return ret; } -static int s2mps11_pmic_remove(struct platform_device *pdev) +static int __devexit s2mps11_pmic_remove(struct platform_device *pdev) { struct s2mps11_info *s2mps11 = platform_get_drvdata(pdev); int i; @@ -330,7 +330,7 @@ static struct platform_driver s2mps11_pmic_driver = { .owner = THIS_MODULE, }, .probe = s2mps11_pmic_probe, - .remove = s2mps11_pmic_remove, + .remove = __devexit_p(s2mps11_pmic_remove), .id_table = s2mps11_pmic_id, }; diff --git a/trunk/drivers/regulator/s5m8767.c b/trunk/drivers/regulator/s5m8767.c index 2b822bec3c2d..abe64a32aedf 100644 --- a/trunk/drivers/regulator/s5m8767.c +++ b/trunk/drivers/regulator/s5m8767.c @@ -499,7 +499,7 @@ static struct regulator_desc regulators[] = { s5m8767_regulator_desc(BUCK9), }; -static int s5m8767_pmic_probe(struct platform_device *pdev) +static __devinit int s5m8767_pmic_probe(struct platform_device *pdev) { struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); @@ -773,7 +773,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) return ret; } -static int s5m8767_pmic_remove(struct platform_device *pdev) +static int __devexit s5m8767_pmic_remove(struct platform_device *pdev) { struct s5m8767_info *s5m8767 = platform_get_drvdata(pdev); struct regulator_dev **rdev = s5m8767->rdev; @@ -798,7 +798,7 @@ static struct platform_driver s5m8767_pmic_driver = { .owner = THIS_MODULE, }, .probe = s5m8767_pmic_probe, - .remove = s5m8767_pmic_remove, + .remove = __devexit_p(s5m8767_pmic_remove), .id_table = s5m8767_pmic_id, }; diff --git a/trunk/drivers/regulator/tps51632-regulator.c b/trunk/drivers/regulator/tps51632-regulator.c deleted file mode 100644 index 523b1e5e0b4c..000000000000 --- a/trunk/drivers/regulator/tps51632-regulator.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * tps51632-regulator.c -- TI TPS51632 - * - * Regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down Driverless - * Controller with serial VID control and DVFS. - * - * Copyright (c) 2012, NVIDIA Corporation. - * - * Author: Laxman Dewangan - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, - * whether express or implied; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Register definitions */ -#define TPS51632_VOLTAGE_SELECT_REG 0x0 -#define TPS51632_VOLTAGE_BASE_REG 0x1 -#define TPS51632_OFFSET_REG 0x2 -#define TPS51632_IMON_REG 0x3 -#define TPS51632_VMAX_REG 0x4 -#define TPS51632_DVFS_CONTROL_REG 0x5 -#define TPS51632_POWER_STATE_REG 0x6 -#define TPS51632_SLEW_REGS 0x7 -#define TPS51632_FAULT_REG 0x14 - -#define TPS51632_MAX_REG 0x15 - -#define TPS51632_VOUT_MASK 0x7F -#define TPS51632_VOUT_OFFSET_MASK 0x1F -#define TPS51632_VMAX_MASK 0x7F -#define TPS51632_VMAX_LOCK 0x80 - -/* TPS51632_DVFS_CONTROL_REG */ -#define TPS51632_DVFS_PWMEN 0x1 -#define TPS51632_DVFS_STEP_20 0x2 -#define TPS51632_DVFS_VMAX_PG 0x4 -#define TPS51632_DVFS_PWMRST 0x8 -#define TPS51632_DVFS_OCA_EN 0x10 -#define TPS51632_DVFS_FCCM 0x20 - -/* TPS51632_POWER_STATE_REG */ -#define TPS51632_POWER_STATE_MASK 0x03 -#define TPS51632_POWER_STATE_MULTI_PHASE_CCM 0x0 -#define TPS51632_POWER_STATE_SINGLE_PHASE_CCM 0x1 -#define TPS51632_POWER_STATE_SINGLE_PHASE_DCM 0x2 - -#define TPS51632_MIN_VOLATGE 500000 -#define TPS51632_MAX_VOLATGE 1520000 -#define TPS51632_VOLATGE_STEP_10mV 10000 -#define TPS51632_VOLATGE_STEP_20mV 20000 -#define TPS51632_MAX_VSEL 0x7F -#define TPS51632_MIN_VSEL 0x19 -#define TPS51632_DEFAULT_RAMP_DELAY 6000 -#define TPS51632_VOLT_VSEL(uV) \ - (DIV_ROUND_UP(uV - TPS51632_MIN_VOLATGE, \ - TPS51632_VOLATGE_STEP_10mV) + \ - TPS51632_MIN_VSEL) - -/* TPS51632 chip information */ -struct tps51632_chip { - struct device *dev; - struct regulator_desc desc; - struct regulator_dev *rdev; - struct regmap *regmap; - bool enable_pwm_dvfs; -}; - -static int tps51632_dcdc_get_voltage_sel(struct regulator_dev *rdev) -{ - struct tps51632_chip *tps = rdev_get_drvdata(rdev); - unsigned int data; - int ret; - unsigned int reg = TPS51632_VOLTAGE_SELECT_REG; - int vsel; - - if (tps->enable_pwm_dvfs) - reg = TPS51632_VOLTAGE_BASE_REG; - - ret = regmap_read(tps->regmap, reg, &data); - if (ret < 0) { - dev_err(tps->dev, "reg read failed, err %d\n", ret); - return ret; - } - - vsel = data & TPS51632_VOUT_MASK; - return vsel; -} - -static int tps51632_dcdc_set_voltage_sel(struct regulator_dev *rdev, - unsigned selector) -{ - struct tps51632_chip *tps = rdev_get_drvdata(rdev); - int ret; - unsigned int reg = TPS51632_VOLTAGE_SELECT_REG; - - if (tps->enable_pwm_dvfs) - reg = TPS51632_VOLTAGE_BASE_REG; - - if (selector > TPS51632_MAX_VSEL) - return -EINVAL; - - ret = regmap_write(tps->regmap, reg, selector); - if (ret < 0) - dev_err(tps->dev, "reg write failed, err %d\n", ret); - return ret; -} - -static int tps51632_dcdc_set_ramp_delay(struct regulator_dev *rdev, - int ramp_delay) -{ - struct tps51632_chip *tps = rdev_get_drvdata(rdev); - int bit = ramp_delay/6000; - int ret; - - if (bit) - bit--; - ret = regmap_write(tps->regmap, TPS51632_SLEW_REGS, BIT(bit)); - if (ret < 0) - dev_err(tps->dev, "SLEW reg write failed, err %d\n", ret); - return ret; -} - -static struct regulator_ops tps51632_dcdc_ops = { - .get_voltage_sel = tps51632_dcdc_get_voltage_sel, - .set_voltage_sel = tps51632_dcdc_set_voltage_sel, - .list_voltage = regulator_list_voltage_linear, - .set_voltage_time_sel = regulator_set_voltage_time_sel, - .set_ramp_delay = tps51632_dcdc_set_ramp_delay, -}; - -static int tps51632_init_dcdc(struct tps51632_chip *tps, - struct tps51632_regulator_platform_data *pdata) -{ - int ret; - uint8_t control = 0; - int vsel; - - if (!pdata->enable_pwm_dvfs) - goto skip_pwm_config; - - control |= TPS51632_DVFS_PWMEN; - tps->enable_pwm_dvfs = pdata->enable_pwm_dvfs; - vsel = TPS51632_VOLT_VSEL(pdata->base_voltage_uV); - ret = regmap_write(tps->regmap, TPS51632_VOLTAGE_BASE_REG, vsel); - if (ret < 0) { - dev_err(tps->dev, "BASE reg write failed, err %d\n", ret); - return ret; - } - - if (pdata->dvfs_step_20mV) - control |= TPS51632_DVFS_STEP_20; - - if (pdata->max_voltage_uV) { - unsigned int vmax; - /** - * TPS51632 hw behavior: VMAX register can be write only - * once as it get locked after first write. The lock get - * reset only when device is power-reset. - * Write register only when lock bit is not enabled. - */ - ret = regmap_read(tps->regmap, TPS51632_VMAX_REG, &vmax); - if (ret < 0) { - dev_err(tps->dev, "VMAX read failed, err %d\n", ret); - return ret; - } - if (!(vmax & TPS51632_VMAX_LOCK)) { - vsel = TPS51632_VOLT_VSEL(pdata->max_voltage_uV); - ret = regmap_write(tps->regmap, TPS51632_VMAX_REG, - vsel); - if (ret < 0) { - dev_err(tps->dev, - "VMAX write failed, err %d\n", ret); - return ret; - } - } - } - -skip_pwm_config: - ret = regmap_write(tps->regmap, TPS51632_DVFS_CONTROL_REG, control); - if (ret < 0) - dev_err(tps->dev, "DVFS reg write failed, err %d\n", ret); - return ret; -} - -static bool rd_wr_reg(struct device *dev, unsigned int reg) -{ - if ((reg >= 0x8) && (reg <= 0x10)) - return false; - return true; -} - -static const struct regmap_config tps51632_regmap_config = { - .reg_bits = 8, - .val_bits = 8, - .writeable_reg = rd_wr_reg, - .readable_reg = rd_wr_reg, - .max_register = TPS51632_MAX_REG - 1, - .cache_type = REGCACHE_RBTREE, -}; - -static int tps51632_probe(struct i2c_client *client, - const struct i2c_device_id *id) -{ - struct tps51632_regulator_platform_data *pdata; - struct regulator_dev *rdev; - struct tps51632_chip *tps; - int ret; - struct regulator_config config = { }; - - pdata = client->dev.platform_data; - if (!pdata) { - dev_err(&client->dev, "No Platform data\n"); - return -EINVAL; - } - - tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); - if (!tps) { - dev_err(&client->dev, "Memory allocation failed\n"); - return -ENOMEM; - } - - tps->dev = &client->dev; - tps->desc.name = id->name; - tps->desc.id = 0; - tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY; - tps->desc.min_uV = TPS51632_MIN_VOLATGE; - tps->desc.uV_step = TPS51632_VOLATGE_STEP_10mV; - tps->desc.linear_min_sel = TPS51632_MIN_VSEL; - tps->desc.n_voltages = TPS51632_MAX_VSEL + 1; - tps->desc.ops = &tps51632_dcdc_ops; - tps->desc.type = REGULATOR_VOLTAGE; - tps->desc.owner = THIS_MODULE; - - tps->regmap = devm_regmap_init_i2c(client, &tps51632_regmap_config); - if (IS_ERR(tps->regmap)) { - ret = PTR_ERR(tps->regmap); - dev_err(&client->dev, "regmap init failed, err %d\n", ret); - return ret; - } - i2c_set_clientdata(client, tps); - - ret = tps51632_init_dcdc(tps, pdata); - if (ret < 0) { - dev_err(tps->dev, "Init failed, err = %d\n", ret); - return ret; - } - - /* Register the regulators */ - config.dev = &client->dev; - config.init_data = pdata->reg_init_data; - config.driver_data = tps; - config.regmap = tps->regmap; - config.of_node = client->dev.of_node; - - rdev = regulator_register(&tps->desc, &config); - if (IS_ERR(rdev)) { - dev_err(tps->dev, "regulator register failed\n"); - return PTR_ERR(rdev); - } - - tps->rdev = rdev; - return 0; -} - -static int tps51632_remove(struct i2c_client *client) -{ - struct tps51632_chip *tps = i2c_get_clientdata(client); - - regulator_unregister(tps->rdev); - return 0; -} - -static const struct i2c_device_id tps51632_id[] = { - {.name = "tps51632",}, - {}, -}; - -MODULE_DEVICE_TABLE(i2c, tps51632_id); - -static struct i2c_driver tps51632_i2c_driver = { - .driver = { - .name = "tps51632", - .owner = THIS_MODULE, - }, - .probe = tps51632_probe, - .remove = tps51632_remove, - .id_table = tps51632_id, -}; - -static int __init tps51632_init(void) -{ - return i2c_add_driver(&tps51632_i2c_driver); -} -subsys_initcall(tps51632_init); - -static void __exit tps51632_cleanup(void) -{ - i2c_del_driver(&tps51632_i2c_driver); -} -module_exit(tps51632_cleanup); - -MODULE_AUTHOR("Laxman Dewangan "); -MODULE_DESCRIPTION("TPS51632 voltage regulator driver"); -MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/regulator/tps6105x-regulator.c b/trunk/drivers/regulator/tps6105x-regulator.c index ec9453ffb77f..1378409efaec 100644 --- a/trunk/drivers/regulator/tps6105x-regulator.c +++ b/trunk/drivers/regulator/tps6105x-regulator.c @@ -127,7 +127,7 @@ static const struct regulator_desc tps6105x_regulator_desc = { /* * Registers the chip as a voltage regulator */ -static int tps6105x_regulator_probe(struct platform_device *pdev) +static int __devinit tps6105x_regulator_probe(struct platform_device *pdev) { struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev); struct tps6105x_platform_data *pdata = tps6105x->pdata; @@ -159,7 +159,7 @@ static int tps6105x_regulator_probe(struct platform_device *pdev) return 0; } -static int tps6105x_regulator_remove(struct platform_device *pdev) +static int __devexit tps6105x_regulator_remove(struct platform_device *pdev) { struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev); regulator_unregister(tps6105x->regulator); @@ -172,7 +172,7 @@ static struct platform_driver tps6105x_regulator_driver = { .owner = THIS_MODULE, }, .probe = tps6105x_regulator_probe, - .remove = tps6105x_regulator_remove, + .remove = __devexit_p(tps6105x_regulator_remove), }; static __init int tps6105x_regulator_init(void) diff --git a/trunk/drivers/regulator/tps62360-regulator.c b/trunk/drivers/regulator/tps62360-regulator.c index acbd63fde415..68729a7c8709 100644 --- a/trunk/drivers/regulator/tps62360-regulator.c +++ b/trunk/drivers/regulator/tps62360-regulator.c @@ -243,7 +243,7 @@ static struct regulator_ops tps62360_dcdc_ops = { .get_mode = tps62360_get_mode, }; -static int tps62360_init_dcdc(struct tps62360_chip *tps, +static int __devinit tps62360_init_dcdc(struct tps62360_chip *tps, struct tps62360_regulator_platform_data *pdata) { int ret; @@ -339,7 +339,7 @@ static const struct of_device_id tps62360_of_match[] = { MODULE_DEVICE_TABLE(of, tps62360_of_match); #endif -static int tps62360_probe(struct i2c_client *client, +static int __devinit tps62360_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct regulator_config config = { }; @@ -490,7 +490,7 @@ static int tps62360_probe(struct i2c_client *client, * * Unregister TPS driver as an i2c client device driver */ -static int tps62360_remove(struct i2c_client *client) +static int __devexit tps62360_remove(struct i2c_client *client) { struct tps62360_chip *tps = i2c_get_clientdata(client); @@ -531,7 +531,7 @@ static struct i2c_driver tps62360_i2c_driver = { .of_match_table = of_match_ptr(tps62360_of_match), }, .probe = tps62360_probe, - .remove = tps62360_remove, + .remove = __devexit_p(tps62360_remove), .shutdown = tps62360_shutdown, .id_table = tps62360_id, }; diff --git a/trunk/drivers/regulator/tps65023-regulator.c b/trunk/drivers/regulator/tps65023-regulator.c index 9b9af6d889c8..6998d579d07b 100644 --- a/trunk/drivers/regulator/tps65023-regulator.c +++ b/trunk/drivers/regulator/tps65023-regulator.c @@ -219,7 +219,7 @@ static struct regmap_config tps65023_regmap_config = { .val_bits = 8, }; -static int tps_65023_probe(struct i2c_client *client, +static int __devinit tps_65023_probe(struct i2c_client *client, const struct i2c_device_id *id) { const struct tps_driver_data *drv_data = (void *)id->driver_data; @@ -319,7 +319,7 @@ static int tps_65023_probe(struct i2c_client *client, return error; } -static int tps_65023_remove(struct i2c_client *client) +static int __devexit tps_65023_remove(struct i2c_client *client) { struct tps_pmic *tps = i2c_get_clientdata(client); int i; @@ -446,7 +446,7 @@ static struct i2c_driver tps_65023_i2c_driver = { .owner = THIS_MODULE, }, .probe = tps_65023_probe, - .remove = tps_65023_remove, + .remove = __devexit_p(tps_65023_remove), .id_table = tps_65023_id, }; diff --git a/trunk/drivers/regulator/tps6507x-regulator.c b/trunk/drivers/regulator/tps6507x-regulator.c index 0233cfb56560..07d01ccdf308 100644 --- a/trunk/drivers/regulator/tps6507x-regulator.c +++ b/trunk/drivers/regulator/tps6507x-regulator.c @@ -356,7 +356,7 @@ static struct regulator_ops tps6507x_pmic_ops = { .list_voltage = regulator_list_voltage_table, }; -static int tps6507x_pmic_probe(struct platform_device *pdev) +static __devinit int tps6507x_pmic_probe(struct platform_device *pdev) { struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); struct tps_info *info = &tps6507x_pmic_regs[0]; @@ -439,7 +439,7 @@ static int tps6507x_pmic_probe(struct platform_device *pdev) return error; } -static int tps6507x_pmic_remove(struct platform_device *pdev) +static int __devexit tps6507x_pmic_remove(struct platform_device *pdev) { struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev); struct tps6507x_pmic *tps = tps6507x_dev->pmic; @@ -456,7 +456,7 @@ static struct platform_driver tps6507x_pmic_driver = { .owner = THIS_MODULE, }, .probe = tps6507x_pmic_probe, - .remove = tps6507x_pmic_remove, + .remove = __devexit_p(tps6507x_pmic_remove), }; static int __init tps6507x_pmic_init(void) diff --git a/trunk/drivers/regulator/tps65090-regulator.c b/trunk/drivers/regulator/tps65090-regulator.c index 3974a992220f..001ad554ac62 100644 --- a/trunk/drivers/regulator/tps65090-regulator.c +++ b/trunk/drivers/regulator/tps65090-regulator.c @@ -18,240 +18,119 @@ #include #include -#include #include #include #include #include #include #include +#include struct tps65090_regulator { - struct device *dev; - struct regulator_desc *desc; - struct regulator_dev *rdev; -}; - -static struct regulator_ops tps65090_ext_control_ops = { -}; + int id; + /* used by regulator core */ + struct regulator_desc desc; -static struct regulator_ops tps65090_reg_contol_ops = { - .enable = regulator_enable_regmap, - .disable = regulator_disable_regmap, - .is_enabled = regulator_is_enabled_regmap, + /* Device */ + struct device *dev; }; -static struct regulator_ops tps65090_ldo_ops = { +static struct regulator_ops tps65090_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = regulator_is_enabled_regmap, }; -#define tps65090_REG_DESC(_id, _sname, _en_reg, _ops) \ +#define tps65090_REG(_id) \ { \ - .name = "TPS65090_RAILS"#_id, \ - .supply_name = _sname, \ - .id = TPS65090_REGULATOR_##_id, \ - .ops = &_ops, \ - .enable_reg = _en_reg, \ - .enable_mask = BIT(0), \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ + .id = TPS65090_ID_##_id, \ + .desc = { \ + .name = tps65090_rails(_id), \ + .id = TPS65090_ID_##_id, \ + .ops = &tps65090_ops, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + .enable_reg = (TPS65090_ID_##_id) + 12, \ + .enable_mask = BIT(0), \ + }, \ } -static struct regulator_desc tps65090_regulator_desc[] = { - tps65090_REG_DESC(DCDC1, "vsys1", 0x0C, tps65090_reg_contol_ops), - tps65090_REG_DESC(DCDC2, "vsys2", 0x0D, tps65090_reg_contol_ops), - tps65090_REG_DESC(DCDC3, "vsys3", 0x0E, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET1, "infet1", 0x0F, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET2, "infet2", 0x10, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET3, "infet3", 0x11, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET4, "infet4", 0x12, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET5, "infet5", 0x13, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET6, "infet6", 0x14, tps65090_reg_contol_ops), - tps65090_REG_DESC(FET7, "infet7", 0x15, tps65090_reg_contol_ops), - tps65090_REG_DESC(LDO1, "vsys_l1", 0, tps65090_ldo_ops), - tps65090_REG_DESC(LDO2, "vsys_l2", 0, tps65090_ldo_ops), +static struct tps65090_regulator TPS65090_regulator[] = { + tps65090_REG(DCDC1), + tps65090_REG(DCDC2), + tps65090_REG(DCDC3), + tps65090_REG(FET1), + tps65090_REG(FET2), + tps65090_REG(FET3), + tps65090_REG(FET4), + tps65090_REG(FET5), + tps65090_REG(FET6), + tps65090_REG(FET7), }; -static inline bool is_dcdc(int id) -{ - switch (id) { - case TPS65090_REGULATOR_DCDC1: - case TPS65090_REGULATOR_DCDC2: - case TPS65090_REGULATOR_DCDC3: - return true; - default: - return false; - } -} - -static int tps65090_config_ext_control( - struct tps65090_regulator *ri, bool enable) -{ - int ret; - struct device *parent = ri->dev->parent; - unsigned int reg_en_reg = ri->desc->enable_reg; - - if (enable) - ret = tps65090_set_bits(parent, reg_en_reg, 1); - else - ret = tps65090_clr_bits(parent, reg_en_reg, 1); - if (ret < 0) - dev_err(ri->dev, "Error in updating reg 0x%x\n", reg_en_reg); - return ret; -} - -static int tps65090_regulator_disable_ext_control( - struct tps65090_regulator *ri, - struct tps65090_regulator_plat_data *tps_pdata) -{ - int ret = 0; - struct device *parent = ri->dev->parent; - unsigned int reg_en_reg = ri->desc->enable_reg; - - /* - * First enable output for internal control if require. - * And then disable external control. - */ - if (tps_pdata->reg_init_data->constraints.always_on || - tps_pdata->reg_init_data->constraints.boot_on) { - ret = tps65090_set_bits(parent, reg_en_reg, 0); - if (ret < 0) { - dev_err(ri->dev, "Error in set reg 0x%x\n", reg_en_reg); - return ret; - } - } - return tps65090_config_ext_control(ri, false); -} - -static void tps65090_configure_regulator_config( - struct tps65090_regulator_plat_data *tps_pdata, - struct regulator_config *config) +static inline struct tps65090_regulator *find_regulator_info(int id) { - if (gpio_is_valid(tps_pdata->gpio)) { - int gpio_flag = GPIOF_OUT_INIT_LOW; - - if (tps_pdata->reg_init_data->constraints.always_on || - tps_pdata->reg_init_data->constraints.boot_on) - gpio_flag = GPIOF_OUT_INIT_HIGH; + struct tps65090_regulator *ri; + int i; - config->ena_gpio = tps_pdata->gpio; - config->ena_gpio_flags = gpio_flag; + for (i = 0; i < ARRAY_SIZE(TPS65090_regulator); i++) { + ri = &TPS65090_regulator[i]; + if (ri->desc.id == id) + return ri; } + return NULL; } -static int tps65090_regulator_probe(struct platform_device *pdev) +static int __devinit tps65090_regulator_probe(struct platform_device *pdev) { struct tps65090 *tps65090_mfd = dev_get_drvdata(pdev->dev.parent); struct tps65090_regulator *ri = NULL; struct regulator_config config = { }; struct regulator_dev *rdev; - struct tps65090_regulator_plat_data *tps_pdata; - struct tps65090_regulator *pmic; - struct tps65090_platform_data *tps65090_pdata; - int num; - int ret; + struct tps65090_regulator_platform_data *tps_pdata; + int id = pdev->id; - dev_dbg(&pdev->dev, "Probing regulator\n"); + dev_dbg(&pdev->dev, "Probing regulator %d\n", id); - tps65090_pdata = dev_get_platdata(pdev->dev.parent); - if (!tps65090_pdata) { - dev_err(&pdev->dev, "Platform data missing\n"); + ri = find_regulator_info(id); + if (ri == NULL) { + dev_err(&pdev->dev, "invalid regulator ID specified\n"); return -EINVAL; } - - pmic = devm_kzalloc(&pdev->dev, TPS65090_REGULATOR_MAX * sizeof(*pmic), - GFP_KERNEL); - if (!pmic) { - dev_err(&pdev->dev, "mem alloc for pmic failed\n"); - return -ENOMEM; - } - - for (num = 0; num < TPS65090_REGULATOR_MAX; num++) { - tps_pdata = tps65090_pdata->reg_pdata[num]; - - ri = &pmic[num]; - ri->dev = &pdev->dev; - ri->desc = &tps65090_regulator_desc[num]; - - /* - * TPS5090 DCDC support the control from external digital input. - * Configure it as per platform data. - */ - if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data) { - if (tps_pdata->enable_ext_control) { - tps65090_configure_regulator_config( - tps_pdata, &config); - ri->desc->ops = &tps65090_ext_control_ops; - } else { - ret = tps65090_regulator_disable_ext_control( - ri, tps_pdata); - if (ret < 0) { - dev_err(&pdev->dev, - "failed disable ext control\n"); - goto scrub; - } - } - } - - config.dev = &pdev->dev; - config.driver_data = ri; - config.regmap = tps65090_mfd->rmap; - if (tps_pdata) - config.init_data = tps_pdata->reg_init_data; - else - config.init_data = NULL; - - rdev = regulator_register(ri->desc, &config); - if (IS_ERR(rdev)) { - dev_err(&pdev->dev, "failed to register regulator %s\n", - ri->desc->name); - ret = PTR_ERR(rdev); - goto scrub; - } - ri->rdev = rdev; - - /* Enable external control if it is require */ - if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data && - tps_pdata->enable_ext_control) { - ret = tps65090_config_ext_control(ri, true); - if (ret < 0) { - /* Increment num to get unregister rdev */ - num++; - goto scrub; - } - } + tps_pdata = pdev->dev.platform_data; + ri->dev = &pdev->dev; + + config.dev = &pdev->dev; + config.init_data = &tps_pdata->regulator; + config.driver_data = ri; + config.regmap = tps65090_mfd->rmap; + + rdev = regulator_register(&ri->desc, &config); + if (IS_ERR(rdev)) { + dev_err(&pdev->dev, "failed to register regulator %s\n", + ri->desc.name); + return PTR_ERR(rdev); } - platform_set_drvdata(pdev, pmic); + platform_set_drvdata(pdev, rdev); return 0; - -scrub: - while (--num >= 0) { - ri = &pmic[num]; - regulator_unregister(ri->rdev); - } - return ret; } -static int tps65090_regulator_remove(struct platform_device *pdev) +static int __devexit tps65090_regulator_remove(struct platform_device *pdev) { - struct tps65090_regulator *pmic = platform_get_drvdata(pdev); - struct tps65090_regulator *ri; - int num; + struct regulator_dev *rdev = platform_get_drvdata(pdev); - for (num = 0; num < TPS65090_REGULATOR_MAX; ++num) { - ri = &pmic[num]; - regulator_unregister(ri->rdev); - } + regulator_unregister(rdev); return 0; } static struct platform_driver tps65090_regulator_driver = { .driver = { - .name = "tps65090-pmic", + .name = "tps65090-regulator", .owner = THIS_MODULE, }, .probe = tps65090_regulator_probe, - .remove = tps65090_regulator_remove, + .remove = __devexit_p(tps65090_regulator_remove), }; static int __init tps65090_regulator_init(void) diff --git a/trunk/drivers/regulator/tps65217-regulator.c b/trunk/drivers/regulator/tps65217-regulator.c index 73dce7664126..ab00cab905b7 100644 --- a/trunk/drivers/regulator/tps65217-regulator.c +++ b/trunk/drivers/regulator/tps65217-regulator.c @@ -332,7 +332,7 @@ static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) } #endif -static int tps65217_regulator_probe(struct platform_device *pdev) +static int __devinit tps65217_regulator_probe(struct platform_device *pdev) { struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); struct tps65217_board *pdata = dev_get_platdata(tps->dev); @@ -397,7 +397,7 @@ static int tps65217_regulator_probe(struct platform_device *pdev) return ret; } -static int tps65217_regulator_remove(struct platform_device *pdev) +static int __devexit tps65217_regulator_remove(struct platform_device *pdev) { struct tps65217 *tps = platform_get_drvdata(pdev); unsigned int i; @@ -415,7 +415,7 @@ static struct platform_driver tps65217_regulator_driver = { .name = "tps65217-pmic", }, .probe = tps65217_regulator_probe, - .remove = tps65217_regulator_remove, + .remove = __devexit_p(tps65217_regulator_remove), }; static int __init tps65217_regulator_init(void) diff --git a/trunk/drivers/regulator/tps6524x-regulator.c b/trunk/drivers/regulator/tps6524x-regulator.c index 843ee0a9bb92..058d2f2675e9 100644 --- a/trunk/drivers/regulator/tps6524x-regulator.c +++ b/trunk/drivers/regulator/tps6524x-regulator.c @@ -592,7 +592,7 @@ static int pmic_remove(struct spi_device *spi) return 0; } -static int pmic_probe(struct spi_device *spi) +static int __devinit pmic_probe(struct spi_device *spi) { struct tps6524x *hw; struct device *dev = &spi->dev; @@ -649,7 +649,7 @@ static int pmic_probe(struct spi_device *spi) static struct spi_driver pmic_driver = { .probe = pmic_probe, - .remove = pmic_remove, + .remove = __devexit_p(pmic_remove), .driver = { .name = "tps6524x", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/tps6586x-regulator.c b/trunk/drivers/regulator/tps6586x-regulator.c index 9ce44109f2aa..ce1e7cb8d513 100644 --- a/trunk/drivers/regulator/tps6586x-regulator.c +++ b/trunk/drivers/regulator/tps6586x-regulator.c @@ -17,12 +17,10 @@ #include #include #include -#include #include #include #include #include -#include #include /* supply control and voltage setting */ @@ -257,10 +255,10 @@ static inline int tps6586x_regulator_preinit(struct device *parent, 1 << ri->enable_bit[1]); } -static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev, - int id, struct regulator_init_data *p) +static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev) { struct device *parent = pdev->dev.parent; + struct regulator_init_data *p = pdev->dev.platform_data; struct tps6586x_settings *setting = p->driver_data; uint8_t reg; @@ -271,7 +269,7 @@ static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev, return 0; /* only SM0 and SM1 can have the slew rate settings */ - switch (id) { + switch (pdev->id) { case TPS6586X_ID_SM_0: reg = TPS6586X_SM0SL; break; @@ -300,185 +298,58 @@ static inline struct tps6586x_regulator *find_regulator_info(int id) return NULL; } -#ifdef CONFIG_OF -static struct of_regulator_match tps6586x_matches[] = { - { .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS }, - { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, - { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, - { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, - { .name = "ldo0", .driver_data = (void *)TPS6586X_ID_LDO_0 }, - { .name = "ldo1", .driver_data = (void *)TPS6586X_ID_LDO_1 }, - { .name = "ldo2", .driver_data = (void *)TPS6586X_ID_LDO_2 }, - { .name = "ldo3", .driver_data = (void *)TPS6586X_ID_LDO_3 }, - { .name = "ldo4", .driver_data = (void *)TPS6586X_ID_LDO_4 }, - { .name = "ldo5", .driver_data = (void *)TPS6586X_ID_LDO_5 }, - { .name = "ldo6", .driver_data = (void *)TPS6586X_ID_LDO_6 }, - { .name = "ldo7", .driver_data = (void *)TPS6586X_ID_LDO_7 }, - { .name = "ldo8", .driver_data = (void *)TPS6586X_ID_LDO_8 }, - { .name = "ldo9", .driver_data = (void *)TPS6586X_ID_LDO_9 }, - { .name = "ldo_rtc", .driver_data = (void *)TPS6586X_ID_LDO_RTC }, -}; - -static struct tps6586x_platform_data *tps6586x_parse_regulator_dt( - struct platform_device *pdev, - struct of_regulator_match **tps6586x_reg_matches) -{ - const unsigned int num = ARRAY_SIZE(tps6586x_matches); - struct device_node *np = pdev->dev.parent->of_node; - struct device_node *regs; - const char *sys_rail = NULL; - unsigned int i; - struct tps6586x_platform_data *pdata; - int err; - - regs = of_find_node_by_name(np, "regulators"); - if (!regs) { - dev_err(&pdev->dev, "regulator node not found\n"); - return NULL; - } - - err = of_regulator_match(&pdev->dev, regs, tps6586x_matches, num); - if (err < 0) { - dev_err(&pdev->dev, "Regulator match failed, e %d\n", err); - of_node_put(regs); - return NULL; - } - - of_node_put(regs); - - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - dev_err(&pdev->dev, "Memory alloction failed\n"); - return NULL; - } - - for (i = 0; i < num; i++) { - int id; - if (!tps6586x_matches[i].init_data) - continue; - - pdata->reg_init_data[i] = tps6586x_matches[i].init_data; - id = (int)tps6586x_matches[i].driver_data; - if (id == TPS6586X_ID_SYS) - sys_rail = pdata->reg_init_data[i]->constraints.name; - - if ((id == TPS6586X_ID_LDO_5) || (id == TPS6586X_ID_LDO_RTC)) - pdata->reg_init_data[i]->supply_regulator = sys_rail; - } - *tps6586x_reg_matches = tps6586x_matches; - return pdata; -} -#else -static struct tps6586x_platform_data *tps6586x_parse_regulator_dt( - struct platform_device *pdev, - struct of_regulator_match **tps6586x_reg_matches) -{ - *tps6586x_reg_matches = NULL; - return NULL; -} -#endif - -static int tps6586x_regulator_probe(struct platform_device *pdev) +static int __devinit tps6586x_regulator_probe(struct platform_device *pdev) { struct tps6586x_regulator *ri = NULL; struct regulator_config config = { }; - struct regulator_dev **rdev; - struct regulator_init_data *reg_data; - struct tps6586x_platform_data *pdata; - struct of_regulator_match *tps6586x_reg_matches = NULL; - int id; + struct regulator_dev *rdev; + int id = pdev->id; int err; dev_dbg(&pdev->dev, "Probing regulator %d\n", id); - pdata = dev_get_platdata(pdev->dev.parent); - if ((!pdata) && (pdev->dev.parent->of_node)) - pdata = tps6586x_parse_regulator_dt(pdev, - &tps6586x_reg_matches); - - if (!pdata) { - dev_err(&pdev->dev, "Platform data not available, exiting\n"); - return -ENODEV; + ri = find_regulator_info(id); + if (ri == NULL) { + dev_err(&pdev->dev, "invalid regulator ID specified\n"); + return -EINVAL; } - rdev = devm_kzalloc(&pdev->dev, TPS6586X_ID_MAX_REGULATOR * - sizeof(*rdev), GFP_KERNEL); - if (!rdev) { - dev_err(&pdev->dev, "Mmemory alloc failed\n"); - return -ENOMEM; - } + err = tps6586x_regulator_preinit(pdev->dev.parent, ri); + if (err) + return err; - for (id = 0; id < TPS6586X_ID_MAX_REGULATOR; ++id) { - reg_data = pdata->reg_init_data[id]; - - ri = find_regulator_info(id); - if (!ri) { - dev_err(&pdev->dev, "invalid regulator ID specified\n"); - err = -EINVAL; - goto fail; - } - - err = tps6586x_regulator_preinit(pdev->dev.parent, ri); - if (err) { - dev_err(&pdev->dev, - "regulator %d preinit failed, e %d\n", id, err); - goto fail; - } - - config.dev = pdev->dev.parent; - config.init_data = reg_data; - config.driver_data = ri; - - if (tps6586x_reg_matches) - config.of_node = tps6586x_reg_matches[id].of_node; - - rdev[id] = regulator_register(&ri->desc, &config); - if (IS_ERR(rdev[id])) { - dev_err(&pdev->dev, "failed to register regulator %s\n", - ri->desc.name); - err = PTR_ERR(rdev[id]); - goto fail; - } - - if (reg_data) { - err = tps6586x_regulator_set_slew_rate(pdev, id, - reg_data); - if (err < 0) { - dev_err(&pdev->dev, - "Slew rate config failed, e %d\n", err); - regulator_unregister(rdev[id]); - goto fail; - } - } + config.dev = pdev->dev.parent; + config.of_node = pdev->dev.of_node; + config.init_data = pdev->dev.platform_data; + config.driver_data = ri; + + rdev = regulator_register(&ri->desc, &config); + if (IS_ERR(rdev)) { + dev_err(&pdev->dev, "failed to register regulator %s\n", + ri->desc.name); + return PTR_ERR(rdev); } platform_set_drvdata(pdev, rdev); - return 0; -fail: - while (--id >= 0) - regulator_unregister(rdev[id]); - return err; + return tps6586x_regulator_set_slew_rate(pdev); } -static int tps6586x_regulator_remove(struct platform_device *pdev) +static int __devexit tps6586x_regulator_remove(struct platform_device *pdev) { - struct regulator_dev **rdev = platform_get_drvdata(pdev); - int id = TPS6586X_ID_MAX_REGULATOR; - - while (--id >= 0) - regulator_unregister(rdev[id]); + struct regulator_dev *rdev = platform_get_drvdata(pdev); + regulator_unregister(rdev); return 0; } static struct platform_driver tps6586x_regulator_driver = { .driver = { - .name = "tps6586x-pmic", + .name = "tps6586x-regulator", .owner = THIS_MODULE, }, .probe = tps6586x_regulator_probe, - .remove = tps6586x_regulator_remove, + .remove = __devexit_p(tps6586x_regulator_remove), }; static int __init tps6586x_regulator_init(void) diff --git a/trunk/drivers/regulator/tps65910-regulator.c b/trunk/drivers/regulator/tps65910-regulator.c index 6b77bbf32ebc..793adda560c3 100644 --- a/trunk/drivers/regulator/tps65910-regulator.c +++ b/trunk/drivers/regulator/tps65910-regulator.c @@ -1026,7 +1026,7 @@ static inline struct tps65910_board *tps65910_parse_dt_reg_data( } #endif -static int tps65910_probe(struct platform_device *pdev) +static __devinit int tps65910_probe(struct platform_device *pdev) { struct tps65910 *tps65910 = dev_get_drvdata(pdev->dev.parent); struct regulator_config config = { }; @@ -1184,7 +1184,7 @@ static int tps65910_probe(struct platform_device *pdev) return err; } -static int tps65910_remove(struct platform_device *pdev) +static int __devexit tps65910_remove(struct platform_device *pdev) { struct tps65910_reg *pmic = platform_get_drvdata(pdev); int i; @@ -1231,7 +1231,7 @@ static struct platform_driver tps65910_driver = { .owner = THIS_MODULE, }, .probe = tps65910_probe, - .remove = tps65910_remove, + .remove = __devexit_p(tps65910_remove), .shutdown = tps65910_shutdown, }; diff --git a/trunk/drivers/regulator/tps65912-regulator.c b/trunk/drivers/regulator/tps65912-regulator.c index 17e994e47dc1..18b2a1dcb4b5 100644 --- a/trunk/drivers/regulator/tps65912-regulator.c +++ b/trunk/drivers/regulator/tps65912-regulator.c @@ -459,7 +459,7 @@ static struct regulator_ops tps65912_ops_ldo = { .list_voltage = tps65912_list_voltage, }; -static int tps65912_probe(struct platform_device *pdev) +static __devinit int tps65912_probe(struct platform_device *pdev) { struct tps65912 *tps65912 = dev_get_drvdata(pdev->dev.parent); struct regulator_config config = { }; @@ -525,7 +525,7 @@ static int tps65912_probe(struct platform_device *pdev) return err; } -static int tps65912_remove(struct platform_device *pdev) +static int __devexit tps65912_remove(struct platform_device *pdev) { struct tps65912_reg *tps65912_reg = platform_get_drvdata(pdev); int i; @@ -541,7 +541,7 @@ static struct platform_driver tps65912_driver = { .owner = THIS_MODULE, }, .probe = tps65912_probe, - .remove = tps65912_remove, + .remove = __devexit_p(tps65912_remove), }; static int __init tps65912_init(void) diff --git a/trunk/drivers/regulator/tps80031-regulator.c b/trunk/drivers/regulator/tps80031-regulator.c deleted file mode 100644 index 127d1754fcd3..000000000000 --- a/trunk/drivers/regulator/tps80031-regulator.c +++ /dev/null @@ -1,793 +0,0 @@ -/* - * tps80031-regulator.c -- TI TPS80031 regulator driver. - * - * Regulator driver for TITPS80031/TPS80032 Fully Integrated Power - * Management with Power Path and Battery Charger. - * - * Copyright (c) 2012, NVIDIA Corporation. - * - * Author: Laxman Dewangan - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation version 2. - * - * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind, - * whether express or implied; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Flags for DCDC Voltage reading */ -#define DCDC_OFFSET_EN BIT(0) -#define DCDC_EXTENDED_EN BIT(1) -#define TRACK_MODE_ENABLE BIT(2) - -#define SMPS_MULTOFFSET_VIO BIT(1) -#define SMPS_MULTOFFSET_SMPS1 BIT(3) -#define SMPS_MULTOFFSET_SMPS2 BIT(4) -#define SMPS_MULTOFFSET_SMPS3 BIT(6) -#define SMPS_MULTOFFSET_SMPS4 BIT(0) - -#define SMPS_CMD_MASK 0xC0 -#define SMPS_VSEL_MASK 0x3F -#define LDO_VSEL_MASK 0x1F -#define LDO_TRACK_VSEL_MASK 0x3F - -#define MISC2_LDOUSB_IN_VSYS BIT(4) -#define MISC2_LDOUSB_IN_PMID BIT(3) -#define MISC2_LDOUSB_IN_MASK 0x18 - -#define MISC2_LDO3_SEL_VIB_VAL BIT(0) -#define MISC2_LDO3_SEL_VIB_MASK 0x1 - -#define BOOST_HW_PWR_EN BIT(5) -#define BOOST_HW_PWR_EN_MASK BIT(5) - -#define OPA_MODE_EN BIT(6) -#define OPA_MODE_EN_MASK BIT(6) - -#define USB_VBUS_CTRL_SET 0x04 -#define USB_VBUS_CTRL_CLR 0x05 -#define VBUS_DISCHRG 0x20 - -struct tps80031_regulator_info { - /* Regulator register address.*/ - u8 trans_reg; - u8 state_reg; - u8 force_reg; - u8 volt_reg; - u8 volt_id; - - /*Power request bits */ - int preq_bit; - - /* used by regulator core */ - struct regulator_desc desc; - -}; - -struct tps80031_regulator { - struct device *dev; - struct regulator_dev *rdev; - struct tps80031_regulator_info *rinfo; - - u8 device_flags; - unsigned int config_flags; - unsigned int ext_ctrl_flag; -}; - -static inline struct device *to_tps80031_dev(struct regulator_dev *rdev) -{ - return rdev_get_dev(rdev)->parent->parent; -} - -static int tps80031_reg_is_enabled(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - u8 reg_val; - int ret; - - if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ) - return true; - - ret = tps80031_read(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg, - ®_val); - if (ret < 0) { - dev_err(&rdev->dev, "Reg 0x%02x read failed, err = %d\n", - ri->rinfo->state_reg, ret); - return ret; - } - return ((reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON); -} - -static int tps80031_reg_enable(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret; - - if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ) - return 0; - - ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg, - TPS80031_STATE_ON, TPS80031_STATE_MASK); - if (ret < 0) { - dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n", - ri->rinfo->state_reg, ret); - return ret; - } - return ret; -} - -static int tps80031_reg_disable(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret; - - if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ) - return 0; - - ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg, - TPS80031_STATE_OFF, TPS80031_STATE_MASK); - if (ret < 0) - dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n", - ri->rinfo->state_reg, ret); - return ret; -} - -/* DCDC voltages for the selector of 58 to 63 */ -static int tps80031_dcdc_voltages[4][5] = { - { 1350, 1500, 1800, 1900, 2100}, - { 1350, 1500, 1800, 1900, 2100}, - { 2084, 2315, 2778, 2932, 3241}, - { 4167, 2315, 2778, 2932, 3241}, -}; - -static int tps80031_dcdc_list_voltage(struct regulator_dev *rdev, unsigned sel) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - int volt_index = ri->device_flags & 0x3; - - if (sel == 0) - return 0; - else if (sel < 58) - return regulator_list_voltage_linear(rdev, sel - 1); - else - return tps80031_dcdc_voltages[volt_index][sel - 58] * 1000; -} - -static int tps80031_dcdc_set_voltage_sel(struct regulator_dev *rdev, - unsigned vsel) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret; - u8 reg_val; - - if (ri->rinfo->force_reg) { - ret = tps80031_read(parent, ri->rinfo->volt_id, - ri->rinfo->force_reg, ®_val); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - ri->rinfo->force_reg, ret); - return ret; - } - if (!(reg_val & SMPS_CMD_MASK)) { - ret = tps80031_update(parent, ri->rinfo->volt_id, - ri->rinfo->force_reg, vsel, SMPS_VSEL_MASK); - if (ret < 0) - dev_err(ri->dev, - "reg 0x%02x update failed, e = %d\n", - ri->rinfo->force_reg, ret); - return ret; - } - } - ret = tps80031_update(parent, ri->rinfo->volt_id, - ri->rinfo->volt_reg, vsel, SMPS_VSEL_MASK); - if (ret < 0) - dev_err(ri->dev, "reg 0x%02x update failed, e = %d\n", - ri->rinfo->volt_reg, ret); - return ret; -} - -static int tps80031_dcdc_get_voltage_sel(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - uint8_t vsel = 0; - int ret; - - if (ri->rinfo->force_reg) { - ret = tps80031_read(parent, ri->rinfo->volt_id, - ri->rinfo->force_reg, &vsel); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - ri->rinfo->force_reg, ret); - return ret; - } - - if (!(vsel & SMPS_CMD_MASK)) - return vsel & SMPS_VSEL_MASK; - } - ret = tps80031_read(parent, ri->rinfo->volt_id, - ri->rinfo->volt_reg, &vsel); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - ri->rinfo->volt_reg, ret); - return ret; - } - return vsel & SMPS_VSEL_MASK; -} - -static int tps80031_ldo_set_voltage_sel(struct regulator_dev *rdev, - unsigned sel) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret; - - /* Check for valid setting for TPS80031 or TPS80032-ES1.0 */ - if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) && - (ri->device_flags & TRACK_MODE_ENABLE)) { - unsigned nvsel = (sel) & 0x1F; - if (((tps80031_get_chip_info(parent) == TPS80031) || - ((tps80031_get_chip_info(parent) == TPS80032) && - (tps80031_get_pmu_version(parent) == 0x0))) && - ((nvsel == 0x0) || (nvsel >= 0x19 && nvsel <= 0x1F))) { - dev_err(ri->dev, - "Invalid sel %d in track mode LDO2\n", - nvsel); - return -EINVAL; - } - } - - ret = tps80031_write(parent, ri->rinfo->volt_id, - ri->rinfo->volt_reg, sel); - if (ret < 0) - dev_err(ri->dev, "Error in writing reg 0x%02x, e = %d\n", - ri->rinfo->volt_reg, ret); - return ret; -} - -static int tps80031_ldo_get_voltage_sel(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - uint8_t vsel; - int ret; - - ret = tps80031_read(parent, ri->rinfo->volt_id, - ri->rinfo->volt_reg, &vsel); - if (ret < 0) { - dev_err(ri->dev, "Error in writing the Voltage register\n"); - return ret; - } - return vsel & rdev->desc->vsel_mask; -} - -static int tps80031_ldo_list_voltage(struct regulator_dev *rdev, unsigned sel) -{ - if (sel == 0) - return 0; - else - return regulator_list_voltage_linear(rdev, sel - 1); -} - -static int tps80031_vbus_is_enabled(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret = -EIO; - uint8_t ctrl1 = 0; - uint8_t ctrl3 = 0; - - ret = tps80031_read(parent, TPS80031_SLAVE_ID2, - TPS80031_CHARGERUSB_CTRL1, &ctrl1); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - TPS80031_CHARGERUSB_CTRL1, ret); - return ret; - } - ret = tps80031_read(parent, TPS80031_SLAVE_ID2, - TPS80031_CHARGERUSB_CTRL3, &ctrl3); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - TPS80031_CHARGERUSB_CTRL1, ret); - return ret; - } - if ((ctrl1 & OPA_MODE_EN) && (ctrl3 & BOOST_HW_PWR_EN)) - return 1; - return ret; -} - -static int tps80031_vbus_enable(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret; - - ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2, - TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - TPS80031_CHARGERUSB_CTRL1, ret); - return ret; - } - - ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2, - TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n", - TPS80031_CHARGERUSB_CTRL3, ret); - return ret; - } - return ret; -} - -static int tps80031_vbus_disable(struct regulator_dev *rdev) -{ - struct tps80031_regulator *ri = rdev_get_drvdata(rdev); - struct device *parent = to_tps80031_dev(rdev); - int ret = 0; - - if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) { - ret = tps80031_write(parent, TPS80031_SLAVE_ID2, - USB_VBUS_CTRL_SET, VBUS_DISCHRG); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n", - USB_VBUS_CTRL_SET, ret); - return ret; - } - } - - ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2, - TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n", - TPS80031_CHARGERUSB_CTRL1, ret); - return ret; - } - - ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2, - TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n", - TPS80031_CHARGERUSB_CTRL3, ret); - return ret; - } - - mdelay(DIV_ROUND_UP(ri->rinfo->desc.enable_time, 1000)); - if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) { - ret = tps80031_write(parent, TPS80031_SLAVE_ID2, - USB_VBUS_CTRL_CLR, VBUS_DISCHRG); - if (ret < 0) { - dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n", - USB_VBUS_CTRL_CLR, ret); - return ret; - } - } - return ret; -} - -static struct regulator_ops tps80031_dcdc_ops = { - .list_voltage = tps80031_dcdc_list_voltage, - .set_voltage_sel = tps80031_dcdc_set_voltage_sel, - .get_voltage_sel = tps80031_dcdc_get_voltage_sel, - .enable = tps80031_reg_enable, - .disable = tps80031_reg_disable, - .is_enabled = tps80031_reg_is_enabled, -}; - -static struct regulator_ops tps80031_ldo_ops = { - .list_voltage = tps80031_ldo_list_voltage, - .set_voltage_sel = tps80031_ldo_set_voltage_sel, - .get_voltage_sel = tps80031_ldo_get_voltage_sel, - .enable = tps80031_reg_enable, - .disable = tps80031_reg_disable, - .is_enabled = tps80031_reg_is_enabled, -}; - -static struct regulator_ops tps80031_vbus_sw_ops = { - .enable = tps80031_vbus_enable, - .disable = tps80031_vbus_disable, - .is_enabled = tps80031_vbus_is_enabled, -}; - -static struct regulator_ops tps80031_vbus_hw_ops = { -}; - -static struct regulator_ops tps80031_ext_reg_ops = { - .enable = tps80031_reg_enable, - .disable = tps80031_reg_disable, - .is_enabled = tps80031_reg_is_enabled, -}; - -/* Non-exiting default definition for some register */ -#define TPS80031_SMPS3_CFG_FORCE 0 -#define TPS80031_SMPS4_CFG_FORCE 0 - -#define TPS80031_VBUS_CFG_TRANS 0 -#define TPS80031_VBUS_CFG_STATE 0 - -#define TPS80031_REG_SMPS(_id, _volt_id, _pbit) \ -{ \ - .trans_reg = TPS80031_##_id##_CFG_TRANS, \ - .state_reg = TPS80031_##_id##_CFG_STATE, \ - .force_reg = TPS80031_##_id##_CFG_FORCE, \ - .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \ - .volt_id = TPS80031_SLAVE_##_volt_id, \ - .preq_bit = _pbit, \ - .desc = { \ - .name = "tps80031_"#_id, \ - .id = TPS80031_REGULATOR_##_id, \ - .n_voltages = 63, \ - .ops = &tps80031_dcdc_ops, \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ - .enable_time = 500, \ - }, \ -} - -#define TPS80031_REG_LDO(_id, _preq_bit) \ -{ \ - .trans_reg = TPS80031_##_id##_CFG_TRANS, \ - .state_reg = TPS80031_##_id##_CFG_STATE, \ - .volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \ - .volt_id = TPS80031_SLAVE_ID1, \ - .preq_bit = _preq_bit, \ - .desc = { \ - .owner = THIS_MODULE, \ - .name = "tps80031_"#_id, \ - .id = TPS80031_REGULATOR_##_id, \ - .ops = &tps80031_ldo_ops, \ - .type = REGULATOR_VOLTAGE, \ - .min_uV = 1000000, \ - .uV_step = 100000, \ - .n_voltages = 25, \ - .vsel_mask = LDO_VSEL_MASK, \ - .enable_time = 500, \ - }, \ -} - -#define TPS80031_REG_FIXED(_id, max_mV, _ops, _delay, _pbit) \ -{ \ - .trans_reg = TPS80031_##_id##_CFG_TRANS, \ - .state_reg = TPS80031_##_id##_CFG_STATE, \ - .volt_id = TPS80031_SLAVE_ID1, \ - .preq_bit = _pbit, \ - .desc = { \ - .name = "tps80031_"#_id, \ - .id = TPS80031_REGULATOR_##_id, \ - .n_voltages = 2, \ - .ops = &_ops, \ - .type = REGULATOR_VOLTAGE, \ - .owner = THIS_MODULE, \ - .enable_time = _delay, \ - }, \ -} - -static struct tps80031_regulator_info tps80031_rinfo[TPS80031_REGULATOR_MAX] = { - TPS80031_REG_SMPS(VIO, ID0, 4), - TPS80031_REG_SMPS(SMPS1, ID0, 0), - TPS80031_REG_SMPS(SMPS2, ID0, 1), - TPS80031_REG_SMPS(SMPS3, ID1, 2), - TPS80031_REG_SMPS(SMPS4, ID1, 3), - TPS80031_REG_LDO(VANA, -1), - TPS80031_REG_LDO(LDO1, 8), - TPS80031_REG_LDO(LDO2, 9), - TPS80031_REG_LDO(LDO3, 10), - TPS80031_REG_LDO(LDO4, 11), - TPS80031_REG_LDO(LDO5, 12), - TPS80031_REG_LDO(LDO6, 13), - TPS80031_REG_LDO(LDO7, 14), - TPS80031_REG_LDO(LDOLN, 15), - TPS80031_REG_LDO(LDOUSB, 5), - TPS80031_REG_FIXED(VBUS, 5000, tps80031_vbus_hw_ops, 100000, -1), - TPS80031_REG_FIXED(REGEN1, 3300, tps80031_ext_reg_ops, 0, 16), - TPS80031_REG_FIXED(REGEN2, 3300, tps80031_ext_reg_ops, 0, 17), - TPS80031_REG_FIXED(SYSEN, 3300, tps80031_ext_reg_ops, 0, 18), -}; - -static int tps80031_power_req_config(struct device *parent, - struct tps80031_regulator *ri, - struct tps80031_regulator_platform_data *tps80031_pdata) -{ - int ret = 0; - - if (ri->rinfo->preq_bit < 0) - goto skip_pwr_req_config; - - ret = tps80031_ext_power_req_config(parent, ri->ext_ctrl_flag, - ri->rinfo->preq_bit, ri->rinfo->state_reg, - ri->rinfo->trans_reg); - if (ret < 0) { - dev_err(ri->dev, "ext powerreq config failed, err = %d\n", ret); - return ret; - } - -skip_pwr_req_config: - if (tps80031_pdata->ext_ctrl_flag & TPS80031_PWR_ON_ON_SLEEP) { - ret = tps80031_update(parent, TPS80031_SLAVE_ID1, - ri->rinfo->trans_reg, TPS80031_TRANS_SLEEP_ON, - TPS80031_TRANS_SLEEP_MASK); - if (ret < 0) { - dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n", - ri->rinfo->trans_reg, ret); - return ret; - } - } - return ret; -} - -static int tps80031_regulator_config(struct device *parent, - struct tps80031_regulator *ri, - struct tps80031_regulator_platform_data *tps80031_pdata) -{ - int ret = 0; - - switch (ri->rinfo->desc.id) { - case TPS80031_REGULATOR_LDOUSB: - if (ri->config_flags & (TPS80031_USBLDO_INPUT_VSYS | - TPS80031_USBLDO_INPUT_PMID)) { - unsigned val = 0; - if (ri->config_flags & TPS80031_USBLDO_INPUT_VSYS) - val = MISC2_LDOUSB_IN_VSYS; - else - val = MISC2_LDOUSB_IN_PMID; - - ret = tps80031_update(parent, TPS80031_SLAVE_ID1, - TPS80031_MISC2, val, - MISC2_LDOUSB_IN_MASK); - if (ret < 0) { - dev_err(ri->dev, - "LDOUSB config failed, e= %d\n", ret); - return ret; - } - } - break; - - case TPS80031_REGULATOR_LDO3: - if (ri->config_flags & TPS80031_LDO3_OUTPUT_VIB) { - ret = tps80031_update(parent, TPS80031_SLAVE_ID1, - TPS80031_MISC2, MISC2_LDO3_SEL_VIB_VAL, - MISC2_LDO3_SEL_VIB_MASK); - if (ret < 0) { - dev_err(ri->dev, - "LDO3 config failed, e = %d\n", ret); - return ret; - } - } - break; - - case TPS80031_REGULATOR_VBUS: - /* Provide SW control Ops if VBUS is SW control */ - if (!(ri->config_flags & TPS80031_VBUS_SW_ONLY)) - ri->rinfo->desc.ops = &tps80031_vbus_sw_ops; - break; - default: - break; - } - - /* Configure Active state to ON, SLEEP to OFF and OFF_state to OFF */ - ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->trans_reg, - TPS80031_TRANS_ACTIVE_ON | TPS80031_TRANS_SLEEP_OFF | - TPS80031_TRANS_OFF_OFF, TPS80031_TRANS_ACTIVE_MASK | - TPS80031_TRANS_SLEEP_MASK | TPS80031_TRANS_OFF_MASK); - if (ret < 0) { - dev_err(ri->dev, "trans reg update failed, e %d\n", ret); - return ret; - } - - return ret; -} - -static int check_smps_mode_mult(struct device *parent, - struct tps80031_regulator *ri) -{ - int mult_offset; - int ret; - u8 smps_offset; - u8 smps_mult; - - ret = tps80031_read(parent, TPS80031_SLAVE_ID1, - TPS80031_SMPS_OFFSET, &smps_offset); - if (ret < 0) { - dev_err(parent, "Error in reading smps offset register\n"); - return ret; - } - - ret = tps80031_read(parent, TPS80031_SLAVE_ID1, - TPS80031_SMPS_MULT, &smps_mult); - if (ret < 0) { - dev_err(parent, "Error in reading smps mult register\n"); - return ret; - } - - switch (ri->rinfo->desc.id) { - case TPS80031_REGULATOR_VIO: - mult_offset = SMPS_MULTOFFSET_VIO; - break; - case TPS80031_REGULATOR_SMPS1: - mult_offset = SMPS_MULTOFFSET_SMPS1; - break; - case TPS80031_REGULATOR_SMPS2: - mult_offset = SMPS_MULTOFFSET_SMPS2; - break; - case TPS80031_REGULATOR_SMPS3: - mult_offset = SMPS_MULTOFFSET_SMPS3; - break; - case TPS80031_REGULATOR_SMPS4: - mult_offset = SMPS_MULTOFFSET_SMPS4; - break; - case TPS80031_REGULATOR_LDO2: - ri->device_flags = smps_mult & BIT(5) ? TRACK_MODE_ENABLE : 0; - /* TRACK mode the ldo2 varies from 600mV to 1300mV */ - if (ri->device_flags & TRACK_MODE_ENABLE) { - ri->rinfo->desc.min_uV = 600000; - ri->rinfo->desc.uV_step = 12500; - ri->rinfo->desc.n_voltages = 57; - ri->rinfo->desc.vsel_mask = LDO_TRACK_VSEL_MASK; - } - return 0; - default: - return 0; - } - - ri->device_flags = (smps_offset & mult_offset) ? DCDC_OFFSET_EN : 0; - ri->device_flags |= (smps_mult & mult_offset) ? DCDC_EXTENDED_EN : 0; - switch (ri->device_flags) { - case 0: - ri->rinfo->desc.min_uV = 607700; - ri->rinfo->desc.uV_step = 12660; - break; - case DCDC_OFFSET_EN: - ri->rinfo->desc.min_uV = 700000; - ri->rinfo->desc.uV_step = 12500; - break; - case DCDC_EXTENDED_EN: - ri->rinfo->desc.min_uV = 1852000; - ri->rinfo->desc.uV_step = 38600; - break; - case DCDC_OFFSET_EN | DCDC_EXTENDED_EN: - ri->rinfo->desc.min_uV = 2161000; - ri->rinfo->desc.uV_step = 38600; - break; - } - return 0; -} - -static int tps80031_regulator_probe(struct platform_device *pdev) -{ - struct tps80031_platform_data *pdata; - struct tps80031_regulator_platform_data *tps_pdata; - struct tps80031_regulator_info *rinfo; - struct tps80031_regulator *ri; - struct tps80031_regulator *pmic; - struct regulator_dev *rdev; - struct regulator_config config = { }; - int ret; - int num; - - pdata = dev_get_platdata(pdev->dev.parent); - - if (!pdata) { - dev_err(&pdev->dev, "No platform data\n"); - return -EINVAL; - } - - pmic = devm_kzalloc(&pdev->dev, - TPS80031_REGULATOR_MAX * sizeof(*pmic), GFP_KERNEL); - if (!pmic) { - dev_err(&pdev->dev, "mem alloc for pmic failed\n"); - return -ENOMEM; - } - - for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) { - tps_pdata = pdata->regulator_pdata[num]; - rinfo = &tps80031_rinfo[num]; - ri = &pmic[num]; - ri->rinfo = rinfo; - ri->dev = &pdev->dev; - - check_smps_mode_mult(pdev->dev.parent, ri); - config.dev = &pdev->dev; - config.init_data = NULL; - config.driver_data = ri; - if (tps_pdata) { - config.init_data = tps_pdata->reg_init_data; - ri->config_flags = tps_pdata->config_flags; - ri->ext_ctrl_flag = tps_pdata->ext_ctrl_flag; - ret = tps80031_regulator_config(pdev->dev.parent, - ri, tps_pdata); - if (ret < 0) { - dev_err(&pdev->dev, - "regulator config failed, e %d\n", ret); - goto fail; - } - - ret = tps80031_power_req_config(pdev->dev.parent, - ri, tps_pdata); - if (ret < 0) { - dev_err(&pdev->dev, - "pwr_req config failed, err %d\n", ret); - goto fail; - } - } - rdev = regulator_register(&ri->rinfo->desc, &config); - if (IS_ERR_OR_NULL(rdev)) { - dev_err(&pdev->dev, - "register regulator failed %s\n", - ri->rinfo->desc.name); - ret = PTR_ERR(rdev); - goto fail; - } - ri->rdev = rdev; - } - - platform_set_drvdata(pdev, pmic); - return 0; -fail: - while (--num >= 0) { - ri = &pmic[num]; - regulator_unregister(ri->rdev); - } - return ret; -} - -static int tps80031_regulator_remove(struct platform_device *pdev) -{ - struct tps80031_regulator *pmic = platform_get_drvdata(pdev); - struct tps80031_regulator *ri = NULL; - int num; - - for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) { - ri = &pmic[num]; - regulator_unregister(ri->rdev); - } - return 0; -} - -static struct platform_driver tps80031_regulator_driver = { - .driver = { - .name = "tps80031-pmic", - .owner = THIS_MODULE, - }, - .probe = tps80031_regulator_probe, - .remove = tps80031_regulator_remove, -}; - -static int __init tps80031_regulator_init(void) -{ - return platform_driver_register(&tps80031_regulator_driver); -} -subsys_initcall(tps80031_regulator_init); - -static void __exit tps80031_regulator_exit(void) -{ - platform_driver_unregister(&tps80031_regulator_driver); -} -module_exit(tps80031_regulator_exit); - -MODULE_ALIAS("platform:tps80031-regulator"); -MODULE_DESCRIPTION("Regulator Driver for TI TPS80031 PMIC"); -MODULE_AUTHOR("Laxman Dewangan "); -MODULE_LICENSE("GPL v2"); diff --git a/trunk/drivers/regulator/twl-regulator.c b/trunk/drivers/regulator/twl-regulator.c index 493c8c6a241f..7eb986a40746 100644 --- a/trunk/drivers/regulator/twl-regulator.c +++ b/trunk/drivers/regulator/twl-regulator.c @@ -1116,7 +1116,7 @@ static const struct of_device_id twl_of_match[] __devinitconst = { }; MODULE_DEVICE_TABLE(of, twl_of_match); -static int twlreg_probe(struct platform_device *pdev) +static int __devinit twlreg_probe(struct platform_device *pdev) { int i, id; struct twlreg_info *info; @@ -1241,7 +1241,7 @@ static int twlreg_probe(struct platform_device *pdev) return 0; } -static int twlreg_remove(struct platform_device *pdev) +static int __devexit twlreg_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); struct twlreg_info *info = rdev->reg_data; @@ -1255,7 +1255,7 @@ MODULE_ALIAS("platform:twl_reg"); static struct platform_driver twlreg_driver = { .probe = twlreg_probe, - .remove = twlreg_remove, + .remove = __devexit_p(twlreg_remove), /* NOTE: short name, to work around driver model truncation of * "twl_regulator.12" (and friends) to "twl_regulator.1". */ diff --git a/trunk/drivers/regulator/vexpress.c b/trunk/drivers/regulator/vexpress.c deleted file mode 100644 index 4668c7f8133d..000000000000 --- a/trunk/drivers/regulator/vexpress.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Copyright (C) 2012 ARM Limited - */ - -#define DRVNAME "vexpress-regulator" -#define pr_fmt(fmt) DRVNAME ": " fmt - -#include -#include -#include -#include -#include -#include -#include -#include - -struct vexpress_regulator { - struct regulator_desc desc; - struct regulator_dev *regdev; - struct vexpress_config_func *func; -}; - -static int vexpress_regulator_get_voltage(struct regulator_dev *regdev) -{ - struct vexpress_regulator *reg = rdev_get_drvdata(regdev); - u32 uV; - int err = vexpress_config_read(reg->func, 0, &uV); - - return err ? err : uV; -} - -static int vexpress_regulator_set_voltage(struct regulator_dev *regdev, - int min_uV, int max_uV, unsigned *selector) -{ - struct vexpress_regulator *reg = rdev_get_drvdata(regdev); - - return vexpress_config_write(reg->func, 0, min_uV); -} - -static struct regulator_ops vexpress_regulator_ops_ro = { - .get_voltage = vexpress_regulator_get_voltage, -}; - -static struct regulator_ops vexpress_regulator_ops = { - .get_voltage = vexpress_regulator_get_voltage, - .set_voltage = vexpress_regulator_set_voltage, -}; - -static int vexpress_regulator_probe(struct platform_device *pdev) -{ - int err; - struct vexpress_regulator *reg; - struct regulator_init_data *init_data; - struct regulator_config config = { }; - - reg = devm_kzalloc(&pdev->dev, sizeof(*reg), GFP_KERNEL); - if (!reg) { - err = -ENOMEM; - goto error_kzalloc; - } - - reg->func = vexpress_config_func_get_by_dev(&pdev->dev); - if (!reg->func) { - err = -ENXIO; - goto error_get_func; - } - - reg->desc.name = dev_name(&pdev->dev); - reg->desc.type = REGULATOR_VOLTAGE; - reg->desc.owner = THIS_MODULE; - reg->desc.continuous_voltage_range = true; - - init_data = of_get_regulator_init_data(&pdev->dev, pdev->dev.of_node); - if (!init_data) { - err = -EINVAL; - goto error_get_regulator_init_data; - } - - init_data->constraints.apply_uV = 0; - if (init_data->constraints.min_uV && init_data->constraints.max_uV) - reg->desc.ops = &vexpress_regulator_ops; - else - reg->desc.ops = &vexpress_regulator_ops_ro; - - config.dev = &pdev->dev; - config.init_data = init_data; - config.driver_data = reg; - config.of_node = pdev->dev.of_node; - - reg->regdev = regulator_register(®->desc, &config); - if (IS_ERR(reg->regdev)) { - err = PTR_ERR(reg->regdev); - goto error_regulator_register; - } - - platform_set_drvdata(pdev, reg); - - return 0; - -error_regulator_register: -error_get_regulator_init_data: - vexpress_config_func_put(reg->func); -error_get_func: -error_kzalloc: - return err; -} - -static int vexpress_regulator_remove(struct platform_device *pdev) -{ - struct vexpress_regulator *reg = platform_get_drvdata(pdev); - - vexpress_config_func_put(reg->func); - regulator_unregister(reg->regdev); - - return 0; -} - -static struct of_device_id vexpress_regulator_of_match[] = { - { .compatible = "arm,vexpress-volt", }, - { } -}; - -static struct platform_driver vexpress_regulator_driver = { - .probe = vexpress_regulator_probe, - .remove = vexpress_regulator_remove, - .driver = { - .name = DRVNAME, - .owner = THIS_MODULE, - .of_match_table = vexpress_regulator_of_match, - }, -}; - -module_platform_driver(vexpress_regulator_driver); - -MODULE_AUTHOR("Pawel Moll "); -MODULE_DESCRIPTION("Versatile Express regulator"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:vexpress-regulator"); diff --git a/trunk/drivers/regulator/virtual.c b/trunk/drivers/regulator/virtual.c index 01c66e9712a4..c038e7422538 100644 --- a/trunk/drivers/regulator/virtual.c +++ b/trunk/drivers/regulator/virtual.c @@ -285,7 +285,7 @@ static const struct attribute_group regulator_virtual_attr_group = { .attrs = regulator_virtual_attributes, }; -static int regulator_virtual_probe(struct platform_device *pdev) +static int __devinit regulator_virtual_probe(struct platform_device *pdev) { char *reg_id = pdev->dev.platform_data; struct virtual_consumer_data *drvdata; @@ -321,7 +321,7 @@ static int regulator_virtual_probe(struct platform_device *pdev) return 0; } -static int regulator_virtual_remove(struct platform_device *pdev) +static int __devexit regulator_virtual_remove(struct platform_device *pdev) { struct virtual_consumer_data *drvdata = platform_get_drvdata(pdev); @@ -337,7 +337,7 @@ static int regulator_virtual_remove(struct platform_device *pdev) static struct platform_driver regulator_virtual_consumer_driver = { .probe = regulator_virtual_probe, - .remove = regulator_virtual_remove, + .remove = __devexit_p(regulator_virtual_remove), .driver = { .name = "reg-virt-consumer", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/wm831x-dcdc.c b/trunk/drivers/regulator/wm831x-dcdc.c index bce25658e12e..782c228a19bd 100644 --- a/trunk/drivers/regulator/wm831x-dcdc.c +++ b/trunk/drivers/regulator/wm831x-dcdc.c @@ -290,7 +290,7 @@ static int wm831x_buckv_set_voltage_sel(struct regulator_dev *rdev, if (vsel > dcdc->dvs_vsel) { ret = wm831x_set_bits(wm831x, dvs_reg, WM831X_DC1_DVS_VSEL_MASK, - vsel); + dcdc->dvs_vsel); if (ret == 0) dcdc->dvs_vsel = vsel; else @@ -387,7 +387,7 @@ static struct regulator_ops wm831x_buckv_ops = { * Set up DVS control. We just log errors since we can still run * (with reduced performance) if we fail. */ -static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, +static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, struct wm831x_buckv_pdata *pdata) { struct wm831x *wm831x = dcdc->wm831x; @@ -448,7 +448,7 @@ static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, } } -static int wm831x_buckv_probe(struct platform_device *pdev) +static __devinit int wm831x_buckv_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -562,7 +562,7 @@ static int wm831x_buckv_probe(struct platform_device *pdev) return ret; } -static int wm831x_buckv_remove(struct platform_device *pdev) +static __devexit int wm831x_buckv_remove(struct platform_device *pdev) { struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); struct wm831x *wm831x = dcdc->wm831x; @@ -582,7 +582,7 @@ static int wm831x_buckv_remove(struct platform_device *pdev) static struct platform_driver wm831x_buckv_driver = { .probe = wm831x_buckv_probe, - .remove = wm831x_buckv_remove, + .remove = __devexit_p(wm831x_buckv_remove), .driver = { .name = "wm831x-buckv", .owner = THIS_MODULE, @@ -623,7 +623,7 @@ static struct regulator_ops wm831x_buckp_ops = { .set_suspend_mode = wm831x_dcdc_set_suspend_mode, }; -static int wm831x_buckp_probe(struct platform_device *pdev) +static __devinit int wm831x_buckp_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -710,7 +710,7 @@ static int wm831x_buckp_probe(struct platform_device *pdev) return ret; } -static int wm831x_buckp_remove(struct platform_device *pdev) +static __devexit int wm831x_buckp_remove(struct platform_device *pdev) { struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); @@ -725,7 +725,7 @@ static int wm831x_buckp_remove(struct platform_device *pdev) static struct platform_driver wm831x_buckp_driver = { .probe = wm831x_buckp_probe, - .remove = wm831x_buckp_remove, + .remove = __devexit_p(wm831x_buckp_remove), .driver = { .name = "wm831x-buckp", .owner = THIS_MODULE, @@ -771,7 +771,7 @@ static struct regulator_ops wm831x_boostp_ops = { .disable = regulator_disable_regmap, }; -static int wm831x_boostp_probe(struct platform_device *pdev) +static __devinit int wm831x_boostp_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -845,7 +845,7 @@ static int wm831x_boostp_probe(struct platform_device *pdev) return ret; } -static int wm831x_boostp_remove(struct platform_device *pdev) +static __devexit int wm831x_boostp_remove(struct platform_device *pdev) { struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); @@ -860,7 +860,7 @@ static int wm831x_boostp_remove(struct platform_device *pdev) static struct platform_driver wm831x_boostp_driver = { .probe = wm831x_boostp_probe, - .remove = wm831x_boostp_remove, + .remove = __devexit_p(wm831x_boostp_remove), .driver = { .name = "wm831x-boostp", .owner = THIS_MODULE, @@ -883,7 +883,7 @@ static struct regulator_ops wm831x_epe_ops = { .get_status = wm831x_dcdc_get_status, }; -static int wm831x_epe_probe(struct platform_device *pdev) +static __devinit int wm831x_epe_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -936,7 +936,7 @@ static int wm831x_epe_probe(struct platform_device *pdev) return ret; } -static int wm831x_epe_remove(struct platform_device *pdev) +static __devexit int wm831x_epe_remove(struct platform_device *pdev) { struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); @@ -948,7 +948,7 @@ static int wm831x_epe_remove(struct platform_device *pdev) static struct platform_driver wm831x_epe_driver = { .probe = wm831x_epe_probe, - .remove = wm831x_epe_remove, + .remove = __devexit_p(wm831x_epe_remove), .driver = { .name = "wm831x-epe", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/wm831x-isink.c b/trunk/drivers/regulator/wm831x-isink.c index 68586ee3e1cb..2646a1902b33 100644 --- a/trunk/drivers/regulator/wm831x-isink.c +++ b/trunk/drivers/regulator/wm831x-isink.c @@ -148,7 +148,7 @@ static irqreturn_t wm831x_isink_irq(int irq, void *data) } -static int wm831x_isink_probe(struct platform_device *pdev) +static __devinit int wm831x_isink_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -221,7 +221,7 @@ static int wm831x_isink_probe(struct platform_device *pdev) return ret; } -static int wm831x_isink_remove(struct platform_device *pdev) +static __devexit int wm831x_isink_remove(struct platform_device *pdev) { struct wm831x_isink *isink = platform_get_drvdata(pdev); @@ -236,7 +236,7 @@ static int wm831x_isink_remove(struct platform_device *pdev) static struct platform_driver wm831x_isink_driver = { .probe = wm831x_isink_probe, - .remove = wm831x_isink_remove, + .remove = __devexit_p(wm831x_isink_remove), .driver = { .name = "wm831x-isink", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/wm831x-ldo.c b/trunk/drivers/regulator/wm831x-ldo.c index 1ec379a9a95c..c2dc03993dc7 100644 --- a/trunk/drivers/regulator/wm831x-ldo.c +++ b/trunk/drivers/regulator/wm831x-ldo.c @@ -247,7 +247,7 @@ static struct regulator_ops wm831x_gp_ldo_ops = { .disable = regulator_disable_regmap, }; -static int wm831x_gp_ldo_probe(struct platform_device *pdev) +static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -334,7 +334,7 @@ static int wm831x_gp_ldo_probe(struct platform_device *pdev) return ret; } -static int wm831x_gp_ldo_remove(struct platform_device *pdev) +static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev) { struct wm831x_ldo *ldo = platform_get_drvdata(pdev); @@ -349,7 +349,7 @@ static int wm831x_gp_ldo_remove(struct platform_device *pdev) static struct platform_driver wm831x_gp_ldo_driver = { .probe = wm831x_gp_ldo_probe, - .remove = wm831x_gp_ldo_remove, + .remove = __devexit_p(wm831x_gp_ldo_remove), .driver = { .name = "wm831x-ldo", .owner = THIS_MODULE, @@ -504,7 +504,7 @@ static struct regulator_ops wm831x_aldo_ops = { .disable = regulator_disable_regmap, }; -static int wm831x_aldo_probe(struct platform_device *pdev) +static __devinit int wm831x_aldo_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -590,7 +590,7 @@ static int wm831x_aldo_probe(struct platform_device *pdev) return ret; } -static int wm831x_aldo_remove(struct platform_device *pdev) +static __devexit int wm831x_aldo_remove(struct platform_device *pdev) { struct wm831x_ldo *ldo = platform_get_drvdata(pdev); @@ -603,7 +603,7 @@ static int wm831x_aldo_remove(struct platform_device *pdev) static struct platform_driver wm831x_aldo_driver = { .probe = wm831x_aldo_probe, - .remove = wm831x_aldo_remove, + .remove = __devexit_p(wm831x_aldo_remove), .driver = { .name = "wm831x-aldo", .owner = THIS_MODULE, @@ -660,7 +660,7 @@ static struct regulator_ops wm831x_alive_ldo_ops = { .disable = regulator_disable_regmap, }; -static int wm831x_alive_ldo_probe(struct platform_device *pdev) +static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev) { struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x_pdata *pdata = wm831x->dev->platform_data; @@ -737,7 +737,7 @@ static int wm831x_alive_ldo_probe(struct platform_device *pdev) return ret; } -static int wm831x_alive_ldo_remove(struct platform_device *pdev) +static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev) { struct wm831x_ldo *ldo = platform_get_drvdata(pdev); @@ -748,7 +748,7 @@ static int wm831x_alive_ldo_remove(struct platform_device *pdev) static struct platform_driver wm831x_alive_ldo_driver = { .probe = wm831x_alive_ldo_probe, - .remove = wm831x_alive_ldo_remove, + .remove = __devexit_p(wm831x_alive_ldo_remove), .driver = { .name = "wm831x-alive-ldo", .owner = THIS_MODULE, diff --git a/trunk/drivers/regulator/wm8400-regulator.c b/trunk/drivers/regulator/wm8400-regulator.c index c6a32ea80b9d..27c746ef0636 100644 --- a/trunk/drivers/regulator/wm8400-regulator.c +++ b/trunk/drivers/regulator/wm8400-regulator.c @@ -226,7 +226,7 @@ static struct regulator_desc regulators[] = { }, }; -static int wm8400_regulator_probe(struct platform_device *pdev) +static int __devinit wm8400_regulator_probe(struct platform_device *pdev) { struct wm8400 *wm8400 = container_of(pdev, struct wm8400, regulators[pdev->id]); struct regulator_config config = { }; @@ -246,7 +246,7 @@ static int wm8400_regulator_probe(struct platform_device *pdev) return 0; } -static int wm8400_regulator_remove(struct platform_device *pdev) +static int __devexit wm8400_regulator_remove(struct platform_device *pdev) { struct regulator_dev *rdev = platform_get_drvdata(pdev); @@ -261,7 +261,7 @@ static struct platform_driver wm8400_regulator_driver = { .name = "wm8400-regulator", }, .probe = wm8400_regulator_probe, - .remove = wm8400_regulator_remove, + .remove = __devexit_p(wm8400_regulator_remove), }; /** diff --git a/trunk/drivers/regulator/wm8994-regulator.c b/trunk/drivers/regulator/wm8994-regulator.c index 6ff872342648..86bb48db149e 100644 --- a/trunk/drivers/regulator/wm8994-regulator.c +++ b/trunk/drivers/regulator/wm8994-regulator.c @@ -99,7 +99,7 @@ static const struct regulator_desc wm8994_ldo_desc[] = { }, }; -static int wm8994_ldo_probe(struct platform_device *pdev) +static __devinit int wm8994_ldo_probe(struct platform_device *pdev) { struct wm8994 *wm8994 = dev_get_drvdata(pdev->dev.parent); struct wm8994_pdata *pdata = wm8994->dev->platform_data; @@ -142,7 +142,7 @@ static int wm8994_ldo_probe(struct platform_device *pdev) return ret; } -static int wm8994_ldo_remove(struct platform_device *pdev) +static __devexit int wm8994_ldo_remove(struct platform_device *pdev) { struct wm8994_ldo *ldo = platform_get_drvdata(pdev); @@ -155,7 +155,7 @@ static int wm8994_ldo_remove(struct platform_device *pdev) static struct platform_driver wm8994_ldo_driver = { .probe = wm8994_ldo_probe, - .remove = wm8994_ldo_remove, + .remove = __devexit_p(wm8994_ldo_remove), .driver = { .name = "wm8994-ldo", .owner = THIS_MODULE, diff --git a/trunk/drivers/scsi/isci/request.c b/trunk/drivers/scsi/isci/request.c index 9594ab62702b..c1bafc3f3fb1 100644 --- a/trunk/drivers/scsi/isci/request.c +++ b/trunk/drivers/scsi/isci/request.c @@ -1972,7 +1972,7 @@ sci_io_request_frame_handler(struct isci_request *ireq, frame_index, (void **)&frame_buffer); - sci_controller_copy_sata_response(&ireq->stp.rsp, + sci_controller_copy_sata_response(&ireq->stp.req, frame_header, frame_buffer); diff --git a/trunk/drivers/scsi/scsi.c b/trunk/drivers/scsi/scsi.c index 2c0d0ec8150b..2936b447cae9 100644 --- a/trunk/drivers/scsi/scsi.c +++ b/trunk/drivers/scsi/scsi.c @@ -55,7 +55,6 @@ #include #include #include -#include #include #include @@ -1062,50 +1061,6 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, } EXPORT_SYMBOL_GPL(scsi_get_vpd_page); -/** - * scsi_report_opcode - Find out if a given command opcode is supported - * @sdev: scsi device to query - * @buffer: scratch buffer (must be at least 20 bytes long) - * @len: length of buffer - * @opcode: opcode for command to look up - * - * Uses the REPORT SUPPORTED OPERATION CODES to look up the given - * opcode. Returns 0 if RSOC fails or if the command opcode is - * unsupported. Returns 1 if the device claims to support the command. - */ -int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, - unsigned int len, unsigned char opcode) -{ - unsigned char cmd[16]; - struct scsi_sense_hdr sshdr; - int result; - - if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3) - return 0; - - memset(cmd, 0, 16); - cmd[0] = MAINTENANCE_IN; - cmd[1] = MI_REPORT_SUPPORTED_OPERATION_CODES; - cmd[2] = 1; /* One command format */ - cmd[3] = opcode; - put_unaligned_be32(len, &cmd[6]); - memset(buffer, 0, len); - - result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, - &sshdr, 30 * HZ, 3, NULL); - - if (result && scsi_sense_valid(&sshdr) && - sshdr.sense_key == ILLEGAL_REQUEST && - (sshdr.asc == 0x20 || sshdr.asc == 0x24) && sshdr.ascq == 0x00) - return 0; - - if ((buffer[1] & 3) == 3) /* Command supported */ - return 1; - - return 0; -} -EXPORT_SYMBOL(scsi_report_opcode); - /** * scsi_device_get - get an additional reference to a scsi_device * @sdev: device to get a reference to diff --git a/trunk/drivers/scsi/scsi_lib.c b/trunk/drivers/scsi/scsi_lib.c index 9032e910bca3..da36a3a81a9e 100644 --- a/trunk/drivers/scsi/scsi_lib.c +++ b/trunk/drivers/scsi/scsi_lib.c @@ -900,23 +900,11 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) action = ACTION_FAIL; error = -EILSEQ; /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */ - } else if (sshdr.asc == 0x20 || sshdr.asc == 0x24) { - switch (cmd->cmnd[0]) { - case UNMAP: - description = "Discard failure"; - break; - case WRITE_SAME: - case WRITE_SAME_16: - if (cmd->cmnd[1] & 0x8) - description = "Discard failure"; - else - description = - "Write same failure"; - break; - default: - description = "Invalid command failure"; - break; - } + } else if ((sshdr.asc == 0x20 || sshdr.asc == 0x24) && + (cmd->cmnd[0] == UNMAP || + cmd->cmnd[0] == WRITE_SAME_16 || + cmd->cmnd[0] == WRITE_SAME)) { + description = "Discard failure"; action = ACTION_FAIL; error = -EREMOTEIO; } else diff --git a/trunk/drivers/scsi/sd.c b/trunk/drivers/scsi/sd.c index 352bc77b7c88..12f6fdfc1147 100644 --- a/trunk/drivers/scsi/sd.c +++ b/trunk/drivers/scsi/sd.c @@ -99,7 +99,6 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); #endif static void sd_config_discard(struct scsi_disk *, unsigned int); -static void sd_config_write_same(struct scsi_disk *); static int sd_revalidate_disk(struct gendisk *); static void sd_unlock_native_capacity(struct gendisk *disk); static int sd_probe(struct device *); @@ -396,45 +395,6 @@ sd_store_max_medium_access_timeouts(struct device *dev, return err ? err : count; } -static ssize_t -sd_show_write_same_blocks(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct scsi_disk *sdkp = to_scsi_disk(dev); - - return snprintf(buf, 20, "%u\n", sdkp->max_ws_blocks); -} - -static ssize_t -sd_store_write_same_blocks(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct scsi_disk *sdkp = to_scsi_disk(dev); - struct scsi_device *sdp = sdkp->device; - unsigned long max; - int err; - - if (!capable(CAP_SYS_ADMIN)) - return -EACCES; - - if (sdp->type != TYPE_DISK) - return -EINVAL; - - err = kstrtoul(buf, 10, &max); - - if (err) - return err; - - if (max == 0) - sdp->no_write_same = 1; - else if (max <= SD_MAX_WS16_BLOCKS) - sdkp->max_ws_blocks = max; - - sd_config_write_same(sdkp); - - return count; -} - static struct device_attribute sd_disk_attrs[] = { __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, sd_store_cache_type), @@ -450,8 +410,6 @@ static struct device_attribute sd_disk_attrs[] = { __ATTR(thin_provisioning, S_IRUGO, sd_show_thin_provisioning, NULL), __ATTR(provisioning_mode, S_IRUGO|S_IWUSR, sd_show_provisioning_mode, sd_store_provisioning_mode), - __ATTR(max_write_same_blocks, S_IRUGO|S_IWUSR, - sd_show_write_same_blocks, sd_store_write_same_blocks), __ATTR(max_medium_access_timeouts, S_IRUGO|S_IWUSR, sd_show_max_medium_access_timeouts, sd_store_max_medium_access_timeouts), @@ -603,23 +561,19 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) return; case SD_LBP_UNMAP: - max_blocks = min_not_zero(sdkp->max_unmap_blocks, - (u32)SD_MAX_WS16_BLOCKS); + max_blocks = min_not_zero(sdkp->max_unmap_blocks, 0xffffffff); break; case SD_LBP_WS16: - max_blocks = min_not_zero(sdkp->max_ws_blocks, - (u32)SD_MAX_WS16_BLOCKS); + max_blocks = min_not_zero(sdkp->max_ws_blocks, 0xffffffff); break; case SD_LBP_WS10: - max_blocks = min_not_zero(sdkp->max_ws_blocks, - (u32)SD_MAX_WS10_BLOCKS); + max_blocks = min_not_zero(sdkp->max_ws_blocks, (u32)0xffff); break; case SD_LBP_ZERO: - max_blocks = min_not_zero(sdkp->max_ws_blocks, - (u32)SD_MAX_WS10_BLOCKS); + max_blocks = min_not_zero(sdkp->max_ws_blocks, (u32)0xffff); q->limits.discard_zeroes_data = 1; break; } @@ -629,26 +583,29 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode) } /** - * sd_setup_discard_cmnd - unmap blocks on thinly provisioned device + * scsi_setup_discard_cmnd - unmap blocks on thinly provisioned device * @sdp: scsi device to operate one * @rq: Request to prepare * * Will issue either UNMAP or WRITE SAME(16) depending on preference * indicated by target device. **/ -static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) +static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) { struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); - sector_t sector = blk_rq_pos(rq); - unsigned int nr_sectors = blk_rq_sectors(rq); - unsigned int nr_bytes = blk_rq_bytes(rq); + struct bio *bio = rq->bio; + sector_t sector = bio->bi_sector; + unsigned int nr_sectors = bio_sectors(bio); unsigned int len; int ret; char *buf; struct page *page; - sector >>= ilog2(sdp->sector_size) - 9; - nr_sectors >>= ilog2(sdp->sector_size) - 9; + if (sdkp->device->sector_size == 4096) { + sector >>= 3; + nr_sectors >>= 3; + } + rq->timeout = SD_TIMEOUT; memset(rq->cmd, 0, rq->cmd_len); @@ -703,7 +660,6 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) blk_add_request_payload(rq, page, len); ret = scsi_setup_blk_pc_cmnd(sdp, rq); rq->buffer = page_address(page); - rq->__data_len = nr_bytes; out: if (ret != BLKPREP_OK) { @@ -713,83 +669,6 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) return ret; } -static void sd_config_write_same(struct scsi_disk *sdkp) -{ - struct request_queue *q = sdkp->disk->queue; - unsigned int logical_block_size = sdkp->device->sector_size; - unsigned int blocks = 0; - - if (sdkp->device->no_write_same) { - sdkp->max_ws_blocks = 0; - goto out; - } - - /* Some devices can not handle block counts above 0xffff despite - * supporting WRITE SAME(16). Consequently we default to 64k - * blocks per I/O unless the device explicitly advertises a - * bigger limit. - */ - if (sdkp->max_ws_blocks == 0) - sdkp->max_ws_blocks = SD_MAX_WS10_BLOCKS; - - if (sdkp->ws16 || sdkp->max_ws_blocks > SD_MAX_WS10_BLOCKS) - blocks = min_not_zero(sdkp->max_ws_blocks, - (u32)SD_MAX_WS16_BLOCKS); - else - blocks = min_not_zero(sdkp->max_ws_blocks, - (u32)SD_MAX_WS10_BLOCKS); - -out: - blk_queue_max_write_same_sectors(q, blocks * (logical_block_size >> 9)); -} - -/** - * sd_setup_write_same_cmnd - write the same data to multiple blocks - * @sdp: scsi device to operate one - * @rq: Request to prepare - * - * Will issue either WRITE SAME(10) or WRITE SAME(16) depending on - * preference indicated by target device. - **/ -static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) -{ - struct scsi_disk *sdkp = scsi_disk(rq->rq_disk); - struct bio *bio = rq->bio; - sector_t sector = blk_rq_pos(rq); - unsigned int nr_sectors = blk_rq_sectors(rq); - unsigned int nr_bytes = blk_rq_bytes(rq); - int ret; - - if (sdkp->device->no_write_same) - return BLKPREP_KILL; - - BUG_ON(bio_offset(bio) || bio_iovec(bio)->bv_len != sdp->sector_size); - - sector >>= ilog2(sdp->sector_size) - 9; - nr_sectors >>= ilog2(sdp->sector_size) - 9; - - rq->__data_len = sdp->sector_size; - rq->timeout = SD_WRITE_SAME_TIMEOUT; - memset(rq->cmd, 0, rq->cmd_len); - - if (sdkp->ws16 || sector > 0xffffffff || nr_sectors > 0xffff) { - rq->cmd_len = 16; - rq->cmd[0] = WRITE_SAME_16; - put_unaligned_be64(sector, &rq->cmd[2]); - put_unaligned_be32(nr_sectors, &rq->cmd[10]); - } else { - rq->cmd_len = 10; - rq->cmd[0] = WRITE_SAME; - put_unaligned_be32(sector, &rq->cmd[2]); - put_unaligned_be16(nr_sectors, &rq->cmd[7]); - } - - ret = scsi_setup_blk_pc_cmnd(sdp, rq); - rq->__data_len = nr_bytes; - - return ret; -} - static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq) { rq->timeout = SD_FLUSH_TIMEOUT; @@ -833,10 +712,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) * block PC requests to make life easier. */ if (rq->cmd_flags & REQ_DISCARD) { - ret = sd_setup_discard_cmnd(sdp, rq); - goto out; - } else if (rq->cmd_flags & REQ_WRITE_SAME) { - ret = sd_setup_write_same_cmnd(sdp, rq); + ret = scsi_setup_discard_cmnd(sdp, rq); goto out; } else if (rq->cmd_flags & REQ_FLUSH) { ret = scsi_setup_flush_cmnd(sdp, rq); @@ -1606,21 +1482,12 @@ static int sd_done(struct scsi_cmnd *SCpnt) unsigned int good_bytes = result ? 0 : scsi_bufflen(SCpnt); struct scsi_sense_hdr sshdr; struct scsi_disk *sdkp = scsi_disk(SCpnt->request->rq_disk); - struct request *req = SCpnt->request; int sense_valid = 0; int sense_deferred = 0; unsigned char op = SCpnt->cmnd[0]; - unsigned char unmap = SCpnt->cmnd[1] & 8; - if (req->cmd_flags & REQ_DISCARD || req->cmd_flags & REQ_WRITE_SAME) { - if (!result) { - good_bytes = blk_rq_bytes(req); - scsi_set_resid(SCpnt, 0); - } else { - good_bytes = 0; - scsi_set_resid(SCpnt, blk_rq_bytes(req)); - } - } + if ((SCpnt->request->cmd_flags & REQ_DISCARD) && !result) + scsi_set_resid(SCpnt, 0); if (result) { sense_valid = scsi_command_normalize_sense(SCpnt, &sshdr); @@ -1669,25 +1536,9 @@ static int sd_done(struct scsi_cmnd *SCpnt) if (sshdr.asc == 0x10) /* DIX: Host detected corruption */ good_bytes = sd_completed_bytes(SCpnt); /* INVALID COMMAND OPCODE or INVALID FIELD IN CDB */ - if (sshdr.asc == 0x20 || sshdr.asc == 0x24) { - switch (op) { - case UNMAP: - sd_config_discard(sdkp, SD_LBP_DISABLE); - break; - case WRITE_SAME_16: - case WRITE_SAME: - if (unmap) - sd_config_discard(sdkp, SD_LBP_DISABLE); - else { - sdkp->device->no_write_same = 1; - sd_config_write_same(sdkp); - - good_bytes = 0; - req->__data_len = blk_rq_bytes(req); - req->cmd_flags |= REQ_QUIET; - } - } - } + if ((sshdr.asc == 0x20 || sshdr.asc == 0x24) && + (op == UNMAP || op == WRITE_SAME_16 || op == WRITE_SAME)) + sd_config_discard(sdkp, SD_LBP_DISABLE); break; default: break; @@ -2523,7 +2374,9 @@ static void sd_read_block_limits(struct scsi_disk *sdkp) if (buffer[3] == 0x3c) { unsigned int lba_count, desc_count; - sdkp->max_ws_blocks = (u32)get_unaligned_be64(&buffer[36]); + sdkp->max_ws_blocks = + (u32) min_not_zero(get_unaligned_be64(&buffer[36]), + (u64)0xffffffff); if (!sdkp->lbpme) goto out; @@ -2616,13 +2469,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) kfree(buffer); } -static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer) -{ - if (scsi_report_opcode(sdkp->device, buffer, SD_BUF_SIZE, - WRITE_SAME_16)) - sdkp->ws16 = 1; -} - static int sd_try_extended_inquiry(struct scsi_device *sdp) { /* @@ -2682,7 +2528,6 @@ static int sd_revalidate_disk(struct gendisk *disk) sd_read_write_protect_flag(sdkp, buffer); sd_read_cache_type(sdkp, buffer); sd_read_app_tag_own(sdkp, buffer); - sd_read_write_same(sdkp, buffer); } sdkp->first_scan = 0; @@ -2700,7 +2545,6 @@ static int sd_revalidate_disk(struct gendisk *disk) blk_queue_flush(sdkp->disk->queue, flush); set_capacity(disk, sdkp->capacity); - sd_config_write_same(sdkp); kfree(buffer); out: diff --git a/trunk/drivers/scsi/sd.h b/trunk/drivers/scsi/sd.h index 74a1e4ca5401..47c52a6d733c 100644 --- a/trunk/drivers/scsi/sd.h +++ b/trunk/drivers/scsi/sd.h @@ -14,7 +14,6 @@ #define SD_TIMEOUT (30 * HZ) #define SD_MOD_TIMEOUT (75 * HZ) #define SD_FLUSH_TIMEOUT (60 * HZ) -#define SD_WRITE_SAME_TIMEOUT (120 * HZ) /* * Number of allowed retries @@ -39,11 +38,6 @@ enum { SD_MEMPOOL_SIZE = 2, /* CDB pool size */ }; -enum { - SD_MAX_WS10_BLOCKS = 0xffff, - SD_MAX_WS16_BLOCKS = 0x7fffff, -}; - enum { SD_LBP_FULL = 0, /* Full logical block provisioning */ SD_LBP_UNMAP, /* Use UNMAP command */ @@ -83,7 +77,6 @@ struct scsi_disk { unsigned lbpws : 1; unsigned lbpws10 : 1; unsigned lbpvpd : 1; - unsigned ws16 : 1; }; #define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev) diff --git a/trunk/drivers/usb/storage/scsiglue.c b/trunk/drivers/usb/storage/scsiglue.c index 92f35abee92d..a3d54366afcc 100644 --- a/trunk/drivers/usb/storage/scsiglue.c +++ b/trunk/drivers/usb/storage/scsiglue.c @@ -186,12 +186,6 @@ static int slave_configure(struct scsi_device *sdev) /* Some devices don't handle VPD pages correctly */ sdev->skip_vpd_pages = 1; - /* Do not attempt to use REPORT SUPPORTED OPERATION CODES */ - sdev->no_report_opcodes = 1; - - /* Do not attempt to use WRITE SAME */ - sdev->no_write_same = 1; - /* Some disks return the total number of blocks in response * to READ CAPACITY rather than the highest block number. * If this device makes that mistake, tell the sd driver. */ diff --git a/trunk/drivers/video/omap2/dss/dsi.c b/trunk/drivers/video/omap2/dss/dsi.c index bee92846cfab..d64ac3842884 100644 --- a/trunk/drivers/video/omap2/dss/dsi.c +++ b/trunk/drivers/video/omap2/dss/dsi.c @@ -365,20 +365,11 @@ struct platform_device *dsi_get_dsidev_from_id(int module) struct omap_dss_output *out; enum omap_dss_output_id id; - switch (module) { - case 0: - id = OMAP_DSS_OUTPUT_DSI1; - break; - case 1: - id = OMAP_DSS_OUTPUT_DSI2; - break; - default: - return NULL; - } + id = module == 0 ? OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2; out = omap_dss_get_output(id); - return out ? out->pdev : NULL; + return out->pdev; } static inline void dsi_write_reg(struct platform_device *dsidev, diff --git a/trunk/drivers/video/omap2/dss/dss.c b/trunk/drivers/video/omap2/dss/dss.c index 5f6eea801b06..2ab1c3e96553 100644 --- a/trunk/drivers/video/omap2/dss/dss.c +++ b/trunk/drivers/video/omap2/dss/dss.c @@ -697,15 +697,11 @@ static int dss_get_clocks(void) dss.dss_clk = clk; - if (dss.feat->clk_name) { - clk = clk_get(NULL, dss.feat->clk_name); - if (IS_ERR(clk)) { - DSSERR("Failed to get %s\n", dss.feat->clk_name); - r = PTR_ERR(clk); - goto err; - } - } else { - clk = NULL; + clk = clk_get(NULL, dss.feat->clk_name); + if (IS_ERR(clk)) { + DSSERR("Failed to get %s\n", dss.feat->clk_name); + r = PTR_ERR(clk); + goto err; } dss.dpll4_m4_ck = clk; @@ -809,10 +805,10 @@ static int __init dss_init_features(struct device *dev) if (cpu_is_omap24xx()) src = &omap24xx_dss_feats; - else if (cpu_is_omap3630()) - src = &omap3630_dss_feats; else if (cpu_is_omap34xx()) src = &omap34xx_dss_feats; + else if (cpu_is_omap3630()) + src = &omap3630_dss_feats; else if (cpu_is_omap44xx()) src = &omap44xx_dss_feats; else if (soc_is_omap54xx()) diff --git a/trunk/drivers/video/omap2/dss/hdmi.c b/trunk/drivers/video/omap2/dss/hdmi.c index 8c9b8b3b7f77..a48a7dd75b33 100644 --- a/trunk/drivers/video/omap2/dss/hdmi.c +++ b/trunk/drivers/video/omap2/dss/hdmi.c @@ -644,10 +644,8 @@ static void hdmi_dump_regs(struct seq_file *s) { mutex_lock(&hdmi.lock); - if (hdmi_runtime_get()) { - mutex_unlock(&hdmi.lock); + if (hdmi_runtime_get()) return; - } hdmi.ip_data.ops->dump_wrapper(&hdmi.ip_data, s); hdmi.ip_data.ops->dump_pll(&hdmi.ip_data, s); diff --git a/trunk/drivers/video/omap2/omapfb/omapfb-ioctl.c b/trunk/drivers/video/omap2/omapfb/omapfb-ioctl.c index d630b26a005c..606b89f12351 100644 --- a/trunk/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/trunk/drivers/video/omap2/omapfb/omapfb-ioctl.c @@ -787,7 +787,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) case OMAPFB_WAITFORVSYNC: DBG("ioctl WAITFORVSYNC\n"); - if (!display || !display->output || !display->output->manager) { + if (!display && !display->output && !display->output->manager) { r = -EINVAL; break; } diff --git a/trunk/drivers/xen/privcmd.c b/trunk/drivers/xen/privcmd.c index 71f5c459b088..8adb9cc267f9 100644 --- a/trunk/drivers/xen/privcmd.c +++ b/trunk/drivers/xen/privcmd.c @@ -361,13 +361,13 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) down_write(&mm->mmap_sem); vma = find_vma(mm, m.addr); + ret = -EINVAL; if (!vma || vma->vm_ops != &privcmd_vm_ops || (m.addr != vma->vm_start) || ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || !privcmd_enforce_singleshot_mapping(vma)) { up_write(&mm->mmap_sem); - ret = -EINVAL; goto out; } @@ -383,16 +383,12 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) up_write(&mm->mmap_sem); - if (version == 1) { - if (state.global_error) { - /* Write back errors in second pass. */ - state.user_mfn = (xen_pfn_t *)m.arr; - state.err = err_array; - ret = traverse_pages(m.num, sizeof(xen_pfn_t), - &pagelist, mmap_return_errors_v1, &state); - } else - ret = 0; - + if (state.global_error && (version == 1)) { + /* Write back errors in second pass. */ + state.user_mfn = (xen_pfn_t *)m.arr; + state.err = err_array; + ret = traverse_pages(m.num, sizeof(xen_pfn_t), + &pagelist, mmap_return_errors_v1, &state); } else if (version == 2) { ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); if (ret) diff --git a/trunk/fs/ext3/balloc.c b/trunk/fs/ext3/balloc.c index 22548f56197b..7320a66e958f 100644 --- a/trunk/fs/ext3/balloc.c +++ b/trunk/fs/ext3/balloc.c @@ -2101,9 +2101,8 @@ int ext3_trim_fs(struct super_block *sb, struct fstrim_range *range) end = start + (range->len >> sb->s_blocksize_bits) - 1; minlen = range->minlen >> sb->s_blocksize_bits; - if (minlen > EXT3_BLOCKS_PER_GROUP(sb) || - start >= max_blks || - range->len < sb->s_blocksize) + if (unlikely(minlen > EXT3_BLOCKS_PER_GROUP(sb)) || + unlikely(start >= max_blks)) return -EINVAL; if (end >= max_blks) end = max_blks - 1; diff --git a/trunk/fs/file.c b/trunk/fs/file.c index 7cb71b992603..708d997a7748 100644 --- a/trunk/fs/file.c +++ b/trunk/fs/file.c @@ -685,6 +685,7 @@ void do_close_on_exec(struct files_struct *files) struct fdtable *fdt; /* exec unshares first */ + BUG_ON(atomic_read(&files->count) != 1); spin_lock(&files->file_lock); for (i = 0; ; i++) { unsigned long set; diff --git a/trunk/fs/jffs2/file.c b/trunk/fs/jffs2/file.c index 1506673c087e..60ef3fb707ff 100644 --- a/trunk/fs/jffs2/file.c +++ b/trunk/fs/jffs2/file.c @@ -138,39 +138,33 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, struct page *pg; struct inode *inode = mapping->host; struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); - struct jffs2_raw_inode ri; - uint32_t alloc_len = 0; pgoff_t index = pos >> PAGE_CACHE_SHIFT; uint32_t pageofs = index << PAGE_CACHE_SHIFT; int ret = 0; - jffs2_dbg(1, "%s()\n", __func__); - - if (pageofs > inode->i_size) { - ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, - ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); - if (ret) - return ret; - } - - mutex_lock(&f->sem); pg = grab_cache_page_write_begin(mapping, index, flags); - if (!pg) { - if (alloc_len) - jffs2_complete_reservation(c); - mutex_unlock(&f->sem); + if (!pg) return -ENOMEM; - } *pagep = pg; - if (alloc_len) { + jffs2_dbg(1, "%s()\n", __func__); + + if (pageofs > inode->i_size) { /* Make new hole frag from old EOF to new page */ + struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); + struct jffs2_raw_inode ri; struct jffs2_full_dnode *fn; + uint32_t alloc_len; jffs2_dbg(1, "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", (unsigned int)inode->i_size, pageofs); + ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, + ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); + if (ret) + goto out_page; + + mutex_lock(&f->sem); memset(&ri, 0, sizeof(ri)); ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); @@ -197,6 +191,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, if (IS_ERR(fn)) { ret = PTR_ERR(fn); jffs2_complete_reservation(c); + mutex_unlock(&f->sem); goto out_page; } ret = jffs2_add_full_dnode_to_inode(c, f, fn); @@ -211,10 +206,12 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, jffs2_mark_node_obsolete(c, fn->raw); jffs2_free_full_dnode(fn); jffs2_complete_reservation(c); + mutex_unlock(&f->sem); goto out_page; } jffs2_complete_reservation(c); inode->i_size = pageofs; + mutex_unlock(&f->sem); } /* @@ -223,18 +220,18 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, * case of a short-copy. */ if (!PageUptodate(pg)) { + mutex_lock(&f->sem); ret = jffs2_do_readpage_nolock(inode, pg); + mutex_unlock(&f->sem); if (ret) goto out_page; } - mutex_unlock(&f->sem); jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); return ret; out_page: unlock_page(pg); page_cache_release(pg); - mutex_unlock(&f->sem); return ret; } diff --git a/trunk/fs/notify/fanotify/fanotify_user.c b/trunk/fs/notify/fanotify/fanotify_user.c index 6fcaeb8c902e..721d692fa8d4 100644 --- a/trunk/fs/notify/fanotify/fanotify_user.c +++ b/trunk/fs/notify/fanotify/fanotify_user.c @@ -258,8 +258,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, if (ret) goto out_close_fd; - if (fd != FAN_NOFD) - fd_install(fd, f); + fd_install(fd, f); return fanotify_event_metadata.event_len; out_close_fd: diff --git a/trunk/fs/reiserfs/inode.c b/trunk/fs/reiserfs/inode.c index d83736fbc26c..f27f01a98aa2 100644 --- a/trunk/fs/reiserfs/inode.c +++ b/trunk/fs/reiserfs/inode.c @@ -1782,9 +1782,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, BUG_ON(!th->t_trans_id); - reiserfs_write_unlock(inode->i_sb); + dquot_initialize(inode); err = dquot_alloc_inode(inode); - reiserfs_write_lock(inode->i_sb); if (err) goto out_end_trans; if (!dir->i_nlink) { @@ -1980,10 +1979,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, out_end_trans: journal_end(th, th->t_super, th->t_blocks_allocated); - reiserfs_write_unlock(inode->i_sb); /* Drop can be outside and it needs more credits so it's better to have it outside */ dquot_drop(inode); - reiserfs_write_lock(inode->i_sb); inode->i_flags |= S_NOQUOTA; make_bad_inode(inode); @@ -3106,9 +3103,10 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) /* must be turned off for recursive notify_change calls */ ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); + depth = reiserfs_write_lock_once(inode->i_sb); if (is_quota_modification(inode, attr)) dquot_initialize(inode); - depth = reiserfs_write_lock_once(inode->i_sb); + if (attr->ia_valid & ATTR_SIZE) { /* version 2 items will be caught by the s_maxbytes check ** done for us in vmtruncate @@ -3172,9 +3170,7 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) error = journal_begin(&th, inode->i_sb, jbegin_count); if (error) goto out; - reiserfs_write_unlock_once(inode->i_sb, depth); error = dquot_transfer(inode, attr); - depth = reiserfs_write_lock_once(inode->i_sb); if (error) { journal_end(&th, inode->i_sb, jbegin_count); goto out; diff --git a/trunk/fs/reiserfs/stree.c b/trunk/fs/reiserfs/stree.c index 2f40a4c70a4d..f8afa4b162b8 100644 --- a/trunk/fs/reiserfs/stree.c +++ b/trunk/fs/reiserfs/stree.c @@ -1968,9 +1968,7 @@ int reiserfs_paste_into_item(struct reiserfs_transaction_handle *th, struct tree key2type(&(key->on_disk_key))); #endif - reiserfs_write_unlock(inode->i_sb); retval = dquot_alloc_space_nodirty(inode, pasted_size); - reiserfs_write_lock(inode->i_sb); if (retval) { pathrelse(search_path); return retval; @@ -2063,11 +2061,9 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, "reiserquota insert_item(): allocating %u id=%u type=%c", quota_bytes, inode->i_uid, head2type(ih)); #endif - reiserfs_write_unlock(inode->i_sb); /* We can't dirty inode here. It would be immediately written but * appropriate stat item isn't inserted yet... */ retval = dquot_alloc_space_nodirty(inode, quota_bytes); - reiserfs_write_lock(inode->i_sb); if (retval) { pathrelse(path); return retval; diff --git a/trunk/fs/reiserfs/super.c b/trunk/fs/reiserfs/super.c index 418bdc3a57da..1078ae179993 100644 --- a/trunk/fs/reiserfs/super.c +++ b/trunk/fs/reiserfs/super.c @@ -298,9 +298,7 @@ static int finish_unfinished(struct super_block *s) retval = remove_save_link_only(s, &save_link_key, 0); continue; } - reiserfs_write_unlock(s); dquot_initialize(inode); - reiserfs_write_lock(s); if (truncate && S_ISDIR(inode->i_mode)) { /* We got a truncate request for a dir which is impossible. @@ -1337,7 +1335,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) kfree(qf_names[i]); #endif err = -EINVAL; - goto out_unlock; + goto out_err; } #ifdef CONFIG_QUOTA handle_quota_files(s, qf_names, &qfmt); @@ -1381,7 +1379,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) if (blocks) { err = reiserfs_resize(s, blocks); if (err != 0) - goto out_unlock; + goto out_err; } if (*mount_flags & MS_RDONLY) { @@ -1391,15 +1389,9 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) /* it is read-only already */ goto out_ok; - /* - * Drop write lock. Quota will retake it when needed and lock - * ordering requires calling dquot_suspend() without it. - */ - reiserfs_write_unlock(s); err = dquot_suspend(s, -1); if (err < 0) goto out_err; - reiserfs_write_lock(s); /* try to remount file system with read-only permissions */ if (sb_umount_state(rs) == REISERFS_VALID_FS @@ -1409,7 +1401,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) err = journal_begin(&th, s, 10); if (err) - goto out_unlock; + goto out_err; /* Mounting a rw partition read-only. */ reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); @@ -1424,7 +1416,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) if (reiserfs_is_journal_aborted(journal)) { err = journal->j_errno; - goto out_unlock; + goto out_err; } handle_data_mode(s, mount_options); @@ -1433,7 +1425,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) s->s_flags &= ~MS_RDONLY; /* now it is safe to call journal_begin */ err = journal_begin(&th, s, 10); if (err) - goto out_unlock; + goto out_err; /* Mount a partition which is read-only, read-write */ reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); @@ -1450,16 +1442,10 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) SB_JOURNAL(s)->j_must_wait = 1; err = journal_end(&th, s, 10); if (err) - goto out_unlock; + goto out_err; if (!(*mount_flags & MS_RDONLY)) { - /* - * Drop write lock. Quota will retake it when needed and lock - * ordering requires calling dquot_resume() without it. - */ - reiserfs_write_unlock(s); dquot_resume(s, -1); - reiserfs_write_lock(s); finish_unfinished(s); reiserfs_xattr_init(s, *mount_flags); } @@ -1469,10 +1455,9 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) reiserfs_write_unlock(s); return 0; -out_unlock: - reiserfs_write_unlock(s); out_err: kfree(new_opts); + reiserfs_write_unlock(s); return err; } @@ -2110,15 +2095,13 @@ static int reiserfs_write_dquot(struct dquot *dquot) REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb)); if (ret) goto out; - reiserfs_write_unlock(dquot->dq_sb); ret = dquot_commit(dquot); - reiserfs_write_lock(dquot->dq_sb); err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_TRANS_BLOCKS(dquot->dq_sb)); if (!ret && err) ret = err; -out: + out: reiserfs_write_unlock(dquot->dq_sb); return ret; } @@ -2134,15 +2117,13 @@ static int reiserfs_acquire_dquot(struct dquot *dquot) REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb)); if (ret) goto out; - reiserfs_write_unlock(dquot->dq_sb); ret = dquot_acquire(dquot); - reiserfs_write_lock(dquot->dq_sb); err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_INIT_BLOCKS(dquot->dq_sb)); if (!ret && err) ret = err; -out: + out: reiserfs_write_unlock(dquot->dq_sb); return ret; } @@ -2156,21 +2137,19 @@ static int reiserfs_release_dquot(struct dquot *dquot) ret = journal_begin(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb)); - reiserfs_write_unlock(dquot->dq_sb); if (ret) { /* Release dquot anyway to avoid endless cycle in dqput() */ dquot_release(dquot); goto out; } ret = dquot_release(dquot); - reiserfs_write_lock(dquot->dq_sb); err = journal_end(&th, dquot->dq_sb, REISERFS_QUOTA_DEL_BLOCKS(dquot->dq_sb)); if (!ret && err) ret = err; + out: reiserfs_write_unlock(dquot->dq_sb); -out: return ret; } @@ -2195,13 +2174,11 @@ static int reiserfs_write_info(struct super_block *sb, int type) ret = journal_begin(&th, sb, 2); if (ret) goto out; - reiserfs_write_unlock(sb); ret = dquot_commit_info(sb, type); - reiserfs_write_lock(sb); err = journal_end(&th, sb, 2); if (!ret && err) ret = err; -out: + out: reiserfs_write_unlock(sb); return ret; } @@ -2226,11 +2203,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, struct reiserfs_transaction_handle th; int opt = type == USRQUOTA ? REISERFS_USRQUOTA : REISERFS_GRPQUOTA; - reiserfs_write_lock(sb); - if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) { - err = -EINVAL; - goto out; - } + if (!(REISERFS_SB(sb)->s_mount_opt & (1 << opt))) + return -EINVAL; /* Quotafile not on the same filesystem? */ if (path->dentry->d_sb != sb) { @@ -2272,10 +2246,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, if (err) goto out; } - reiserfs_write_unlock(sb); - return dquot_quota_on(sb, type, format_id, path); + err = dquot_quota_on(sb, type, format_id, path); out: - reiserfs_write_unlock(sb); return err; } @@ -2348,9 +2320,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type, tocopy = sb->s_blocksize - offset < towrite ? sb->s_blocksize - offset : towrite; tmp_bh.b_state = 0; - reiserfs_write_lock(sb); err = reiserfs_get_block(inode, blk, &tmp_bh, GET_BLOCK_CREATE); - reiserfs_write_unlock(sb); if (err) goto out; if (offset || tocopy != sb->s_blocksize) @@ -2366,12 +2336,10 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type, flush_dcache_page(bh->b_page); set_buffer_uptodate(bh); unlock_buffer(bh); - reiserfs_write_lock(sb); reiserfs_prepare_for_journal(sb, bh, 1); journal_mark_dirty(current->journal_info, sb, bh); if (!journal_quota) reiserfs_add_ordered_list(inode, bh); - reiserfs_write_unlock(sb); brelse(bh); offset = 0; towrite -= tocopy; diff --git a/trunk/fs/xfs/xfs_aops.c b/trunk/fs/xfs/xfs_aops.c index e57e2daa357c..e562dd43f41f 100644 --- a/trunk/fs/xfs/xfs_aops.c +++ b/trunk/fs/xfs/xfs_aops.c @@ -481,17 +481,11 @@ static inline int bio_add_buffer(struct bio *bio, struct buffer_head *bh) * * The fix is two passes across the ioend list - one to start writeback on the * buffer_heads, and then submit them for I/O on the second pass. - * - * If @fail is non-zero, it means that we have a situation where some part of - * the submission process has failed after we have marked paged for writeback - * and unlocked them. In this situation, we need to fail the ioend chain rather - * than submit it to IO. This typically only happens on a filesystem shutdown. */ STATIC void xfs_submit_ioend( struct writeback_control *wbc, - xfs_ioend_t *ioend, - int fail) + xfs_ioend_t *ioend) { xfs_ioend_t *head = ioend; xfs_ioend_t *next; @@ -512,18 +506,6 @@ xfs_submit_ioend( next = ioend->io_list; bio = NULL; - /* - * If we are failing the IO now, just mark the ioend with an - * error and finish it. This will run IO completion immediately - * as there is only one reference to the ioend at this point in - * time. - */ - if (fail) { - ioend->io_error = -fail; - xfs_finish_ioend(ioend); - continue; - } - for (bh = ioend->io_buffer_head; bh; bh = bh->b_private) { if (!bio) { @@ -1078,18 +1060,7 @@ xfs_vm_writepage( xfs_start_page_writeback(page, 1, count); - /* if there is no IO to be submitted for this page, we are done */ - if (!ioend) - return 0; - - ASSERT(iohead); - - /* - * Any errors from this point onwards need tobe reported through the IO - * completion path as we have marked the initial page as under writeback - * and unlocked it. - */ - if (imap_valid) { + if (ioend && imap_valid) { xfs_off_t end_index; end_index = imap.br_startoff + imap.br_blockcount; @@ -1108,15 +1079,20 @@ xfs_vm_writepage( wbc, end_index); } + if (iohead) { + /* + * Reserve log space if we might write beyond the on-disk + * inode size. + */ + if (ioend->io_type != XFS_IO_UNWRITTEN && + xfs_ioend_is_append(ioend)) { + err = xfs_setfilesize_trans_alloc(ioend); + if (err) + goto error; + } - /* - * Reserve log space if we might write beyond the on-disk inode size. - */ - err = 0; - if (ioend->io_type != XFS_IO_UNWRITTEN && xfs_ioend_is_append(ioend)) - err = xfs_setfilesize_trans_alloc(ioend); - - xfs_submit_ioend(wbc, iohead, err); + xfs_submit_ioend(wbc, iohead); + } return 0; diff --git a/trunk/fs/xfs/xfs_attr_leaf.c b/trunk/fs/xfs/xfs_attr_leaf.c index 70eec1829776..d330111ca738 100644 --- a/trunk/fs/xfs/xfs_attr_leaf.c +++ b/trunk/fs/xfs/xfs_attr_leaf.c @@ -1291,7 +1291,6 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, leaf2 = blk2->bp->b_addr; ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)); - ASSERT(leaf2->hdr.count == 0); args = state->args; trace_xfs_attr_leaf_rebalance(args); @@ -1362,7 +1361,6 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, * I assert that since all callers pass in an empty * second buffer, this code should never execute. */ - ASSERT(0); /* * Figure the total bytes to be added to the destination leaf. @@ -1424,24 +1422,10 @@ xfs_attr_leaf_rebalance(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, args->index2 = 0; args->blkno2 = blk2->blkno; } else { - /* - * On a double leaf split, the original attr location - * is already stored in blkno2/index2, so don't - * overwrite it overwise we corrupt the tree. - */ blk2->index = blk1->index - be16_to_cpu(leaf1->hdr.count); - args->index = blk2->index; - args->blkno = blk2->blkno; - if (!state->extravalid) { - /* - * set the new attr location to match the old - * one and let the higher level split code - * decide where in the leaf to place it. - */ - args->index2 = blk2->index; - args->blkno2 = blk2->blkno; - } + args->index = args->index2 = blk2->index; + args->blkno = args->blkno2 = blk2->blkno; } } else { ASSERT(state->inleaf == 1); diff --git a/trunk/fs/xfs/xfs_buf.c b/trunk/fs/xfs/xfs_buf.c index 4b0b8dd1b7b0..933b7930b863 100644 --- a/trunk/fs/xfs/xfs_buf.c +++ b/trunk/fs/xfs/xfs_buf.c @@ -1197,14 +1197,9 @@ xfs_buf_bio_end_io( { xfs_buf_t *bp = (xfs_buf_t *)bio->bi_private; - /* - * don't overwrite existing errors - otherwise we can lose errors on - * buffers that require multiple bios to complete. - */ - if (!bp->b_error) - xfs_buf_ioerror(bp, -error); + xfs_buf_ioerror(bp, -error); - if (!bp->b_error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ)) + if (!error && xfs_buf_is_vmapped(bp) && (bp->b_flags & XBF_READ)) invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp)); _xfs_buf_ioend(bp, 1); @@ -1284,11 +1279,6 @@ xfs_buf_ioapply_map( if (size) goto next_chunk; } else { - /* - * This is guaranteed not to be the last io reference count - * because the caller (xfs_buf_iorequest) holds a count itself. - */ - atomic_dec(&bp->b_io_remaining); xfs_buf_ioerror(bp, EIO); bio_put(bio); } diff --git a/trunk/include/drm/drm_pciids.h b/trunk/include/drm/drm_pciids.h index c5c35e629426..af1cbaf535ed 100644 --- a/trunk/include/drm/drm_pciids.h +++ b/trunk/include/drm/drm_pciids.h @@ -210,7 +210,6 @@ {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x679B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ {0x1002, 0x679E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ {0x1002, 0x679F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ diff --git a/trunk/include/linux/i2c-omap.h b/trunk/include/linux/i2c-omap.h index 92a0dc75bc74..df804ba73e0b 100644 --- a/trunk/include/linux/i2c-omap.h +++ b/trunk/include/linux/i2c-omap.h @@ -34,7 +34,6 @@ struct omap_i2c_bus_platform_data { u32 clkrate; u32 rev; u32 flags; - void (*set_mpu_wkup_lat)(struct device *dev, long set); }; #endif diff --git a/trunk/include/linux/mfd/arizona/registers.h b/trunk/include/linux/mfd/arizona/registers.h index ba26e99c388d..7671a287dfee 100644 --- a/trunk/include/linux/mfd/arizona/registers.h +++ b/trunk/include/linux/mfd/arizona/registers.h @@ -76,7 +76,6 @@ #define ARIZONA_RATE_ESTIMATOR_3 0x154 #define ARIZONA_RATE_ESTIMATOR_4 0x155 #define ARIZONA_RATE_ESTIMATOR_5 0x156 -#define ARIZONA_DYNAMIC_FREQUENCY_SCALING_1 0x161 #define ARIZONA_FLL1_CONTROL_1 0x171 #define ARIZONA_FLL1_CONTROL_2 0x172 #define ARIZONA_FLL1_CONTROL_3 0x173 @@ -111,7 +110,6 @@ #define ARIZONA_FLL2_GPIO_CLOCK 0x1AA #define ARIZONA_MIC_CHARGE_PUMP_1 0x200 #define ARIZONA_LDO1_CONTROL_1 0x210 -#define ARIZONA_LDO1_CONTROL_2 0x212 #define ARIZONA_LDO2_CONTROL_1 0x213 #define ARIZONA_MIC_BIAS_CTRL_1 0x218 #define ARIZONA_MIC_BIAS_CTRL_2 0x219 @@ -1575,13 +1573,6 @@ #define ARIZONA_SAMPLE_RATE_DETECT_D_SHIFT 0 /* SAMPLE_RATE_DETECT_D - [4:0] */ #define ARIZONA_SAMPLE_RATE_DETECT_D_WIDTH 5 /* SAMPLE_RATE_DETECT_D - [4:0] */ -/* - * R353 (0x161) - Dynamic Frequency Scaling 1 - */ -#define ARIZONA_SUBSYS_MAX_FREQ 0x0001 /* SUBSYS_MAX_FREQ */ -#define ARIZONA_SUBSYS_MAX_FREQ_SHIFT 0 /* SUBSYS_MAX_FREQ */ -#define ARIZONA_SUBSYS_MAX_FREQ_WIDTH 1 /* SUBSYS_MAX_FREQ */ - /* * R369 (0x171) - FLL1 Control 1 */ @@ -1897,13 +1888,6 @@ #define ARIZONA_LDO1_ENA_SHIFT 0 /* LDO1_ENA */ #define ARIZONA_LDO1_ENA_WIDTH 1 /* LDO1_ENA */ -/* - * R530 (0x212) - LDO1 Control 2 - */ -#define ARIZONA_LDO1_HI_PWR 0x0001 /* LDO1_HI_PWR */ -#define ARIZONA_LDO1_HI_PWR_SHIFT 0 /* LDO1_HI_PWR */ -#define ARIZONA_LDO1_HI_PWR_WIDTH 1 /* LDO1_HI_PWR */ - /* * R531 (0x213) - LDO2 Control 1 */ diff --git a/trunk/include/linux/mfd/da9055/pdata.h b/trunk/include/linux/mfd/da9055/pdata.h index f87a6c172a91..147293b4471d 100644 --- a/trunk/include/linux/mfd/da9055/pdata.h +++ b/trunk/include/linux/mfd/da9055/pdata.h @@ -25,29 +25,8 @@ struct da9055_pdata { int gpio_base; struct regulator_init_data *regulators[DA9055_MAX_REGULATORS]; - /* Enable RTC in RESET Mode */ - bool reset_enable; - /* - * GPI muxed pin to control - * regulator state A/B, 0 if not available. - */ - int *gpio_ren; - /* - * GPI muxed pin to control - * regulator set, 0 if not available. - */ - int *gpio_rsel; - /* - * Regulator mode control bits value (GPI offset) that - * that controls the regulator state, 0 if not available. - */ - enum gpio_select *reg_ren; - /* - * Regulator mode control bits value (GPI offset) that - * controls the regulator set A/B, 0 if not available. - */ - enum gpio_select *reg_rsel; - /* GPIOs to enable regulator, 0 if not available */ - int *ena_gpio; + bool reset_enable; /* Enable RTC in RESET Mode */ + enum gpio_select *gpio_rsel; /* Select regulator set thru GPIO 1/2 */ + enum gpio_select *gpio_ren; /* Enable regulator thru GPIO 1/2 */ }; #endif /* __DA9055_PDATA_H */ diff --git a/trunk/include/linux/mfd/max8997-private.h b/trunk/include/linux/mfd/max8997-private.h index 6ae21bf47d64..830152cfae33 100644 --- a/trunk/include/linux/mfd/max8997-private.h +++ b/trunk/include/linux/mfd/max8997-private.h @@ -316,7 +316,6 @@ enum max8997_irq { #define MAX8997_NUM_GPIO 12 struct max8997_dev { struct device *dev; - struct max8997_platform_data *pdata; struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ struct i2c_client *rtc; /* slave addr 0x0c */ struct i2c_client *haptic; /* slave addr 0x90 */ diff --git a/trunk/include/linux/mfd/max8997.h b/trunk/include/linux/mfd/max8997.h index 1d4a4fe6ac33..328d8e24b533 100644 --- a/trunk/include/linux/mfd/max8997.h +++ b/trunk/include/linux/mfd/max8997.h @@ -75,7 +75,6 @@ enum max8998_regulators { struct max8997_regulator_data { int id; struct regulator_init_data *initdata; - struct device_node *reg_node; }; enum max8997_muic_usb_type { diff --git a/trunk/include/linux/mfd/tps65090.h b/trunk/include/linux/mfd/tps65090.h index 804e280c1e1d..6bc31d854626 100644 --- a/trunk/include/linux/mfd/tps65090.h +++ b/trunk/include/linux/mfd/tps65090.h @@ -24,25 +24,6 @@ #include -/* TPS65090 Regulator ID */ -enum { - TPS65090_REGULATOR_DCDC1, - TPS65090_REGULATOR_DCDC2, - TPS65090_REGULATOR_DCDC3, - TPS65090_REGULATOR_FET1, - TPS65090_REGULATOR_FET2, - TPS65090_REGULATOR_FET3, - TPS65090_REGULATOR_FET4, - TPS65090_REGULATOR_FET5, - TPS65090_REGULATOR_FET6, - TPS65090_REGULATOR_FET7, - TPS65090_REGULATOR_LDO1, - TPS65090_REGULATOR_LDO2, - - /* Last entry for maximum ID */ - TPS65090_REGULATOR_MAX, -}; - struct tps65090 { struct mutex lock; struct device *dev; @@ -60,26 +41,10 @@ struct tps65090_subdev_info { void *platform_data; }; -/* - * struct tps65090_regulator_plat_data - * - * @reg_init_data: The regulator init data. - * @enable_ext_control: Enable extrenal control or not. Only available for - * DCDC1, DCDC2 and DCDC3. - * @gpio: Gpio number if external control is enabled and controlled through - * gpio. - */ -struct tps65090_regulator_plat_data { - struct regulator_init_data *reg_init_data; - bool enable_ext_control; - int gpio; -}; - struct tps65090_platform_data { int irq_base; int num_subdevs; struct tps65090_subdev_info *subdevs; - struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX]; }; /* diff --git a/trunk/include/linux/mfd/tps6586x.h b/trunk/include/linux/mfd/tps6586x.h index f8da0e152567..2dd123194958 100644 --- a/trunk/include/linux/mfd/tps6586x.h +++ b/trunk/include/linux/mfd/tps6586x.h @@ -29,7 +29,6 @@ enum { TPS6586X_ID_LDO_8, TPS6586X_ID_LDO_9, TPS6586X_ID_LDO_RTC, - TPS6586X_ID_MAX_REGULATOR, }; enum { @@ -80,8 +79,6 @@ struct tps6586x_platform_data { int gpio_base; int irq_base; bool pm_off; - - struct regulator_init_data *reg_init_data[TPS6586X_ID_MAX_REGULATOR]; }; /* diff --git a/trunk/include/linux/of_address.h b/trunk/include/linux/of_address.h index 0506eb53519b..e20e3af68fb6 100644 --- a/trunk/include/linux/of_address.h +++ b/trunk/include/linux/of_address.h @@ -42,12 +42,10 @@ static inline struct device_node *of_find_matching_node_by_address( { return NULL; } -#ifndef of_iomap static inline void __iomem *of_iomap(struct device_node *device, int index) { return NULL; } -#endif static inline const __be32 *of_get_address(struct device_node *dev, int index, u64 *size, unsigned int *flags) { diff --git a/trunk/include/linux/regulator/consumer.h b/trunk/include/linux/regulator/consumer.h index 5d0f7c10bef1..4e3ec91bc639 100644 --- a/trunk/include/linux/regulator/consumer.h +++ b/trunk/include/linux/regulator/consumer.h @@ -160,7 +160,6 @@ int regulator_bulk_force_disable(int num_consumers, void regulator_bulk_free(int num_consumers, struct regulator_bulk_data *consumers); -int regulator_can_change_voltage(struct regulator *regulator); int regulator_count_voltages(struct regulator *regulator); int regulator_list_voltage(struct regulator *regulator, unsigned selector); int regulator_is_supported_voltage(struct regulator *regulator, @@ -359,6 +358,10 @@ static inline void regulator_set_drvdata(struct regulator *regulator, { } +static inline int regulator_count_voltages(struct regulator *regulator) +{ + return 0; +} #endif static inline int regulator_set_voltage_tol(struct regulator *regulator, diff --git a/trunk/include/linux/regulator/driver.h b/trunk/include/linux/regulator/driver.h index d10bb0f39c5e..7932a3bf21bd 100644 --- a/trunk/include/linux/regulator/driver.h +++ b/trunk/include/linux/regulator/driver.h @@ -181,13 +181,10 @@ enum regulator_type { * @type: Indicates if the regulator is a voltage or current regulator. * @owner: Module providing the regulator, used for refcounting. * - * @continuous_voltage_range: Indicates if the regulator can set any - * voltage within constrains range. * @n_voltages: Number of selectors available for ops.list_voltage(). * * @min_uV: Voltage given by the lowest selector (if linear mapping) * @uV_step: Voltage increase with each selector (if linear mapping) - * @linear_min_sel: Minimal selector for starting linear mapping * @ramp_delay: Time to settle down after voltage change (unit: uV/us) * @volt_table: Voltage mapping table (if table based mapping) * @@ -202,7 +199,6 @@ struct regulator_desc { const char *name; const char *supply_name; int id; - bool continuous_voltage_range; unsigned n_voltages; struct regulator_ops *ops; int irq; @@ -211,7 +207,6 @@ struct regulator_desc { unsigned int min_uV; unsigned int uV_step; - unsigned int linear_min_sel; unsigned int ramp_delay; const unsigned int *volt_table; diff --git a/trunk/include/linux/regulator/max8973-regulator.h b/trunk/include/linux/regulator/max8973-regulator.h deleted file mode 100644 index f8acc052e353..000000000000 --- a/trunk/include/linux/regulator/max8973-regulator.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * max8973-regulator.h -- MAXIM 8973 regulator - * - * Interface for regulator driver for MAXIM 8973 DC-DC step-down - * switching regulator. - * - * Copyright (C) 2012 NVIDIA Corporation - - * Author: Laxman Dewangan - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __LINUX_REGULATOR_MAX8973_H -#define __LINUX_REGULATOR_MAX8973_H - -/* - * Control flags for configuration of the device. - * Client need to pass this information with ORed - */ -#define MAX8973_CONTROL_REMOTE_SENSE_ENABLE 0x00000001 -#define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE 0x00000002 -#define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE 0x00000004 -#define MAX8973_CONTROL_BIAS_ENABLE 0x00000008 -#define MAX8973_CONTROL_PULL_DOWN_ENABLE 0x00000010 -#define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE 0x00000020 - -#define MAX8973_CONTROL_CLKADV_TRIP_DISABLED 0x00000000 -#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US 0x00010000 -#define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US 0x00020000 -#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS 0x00030000 - -#define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL 0x00000000 -#define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER 0x00100000 -#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER 0x00200000 -#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER 0x00300000 - -/* - * struct max8973_regulator_platform_data - max8973 regulator platform data. - * - * @reg_init_data: The regulator init data. - * @control_flags: Control flags which are ORed value of above flags to - * configure device. - * @enable_ext_control: Enable the voltage enable/disable through external - * control signal from EN input pin. If it is false then - * voltage output will be enabled/disabled through EN bit of - * device register. - * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic. - * @dvs_def_state: Default state of dvs. 1 if it is high else 0. - */ -struct max8973_regulator_platform_data { - struct regulator_init_data *reg_init_data; - unsigned long control_flags; - bool enable_ext_control; - int dvs_gpio; - unsigned dvs_def_state:1; -}; - -#endif /* __LINUX_REGULATOR_MAX8973_H */ diff --git a/trunk/include/linux/regulator/tps51632-regulator.h b/trunk/include/linux/regulator/tps51632-regulator.h deleted file mode 100644 index d00841e1a75a..000000000000 --- a/trunk/include/linux/regulator/tps51632-regulator.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * tps51632-regulator.h -- TPS51632 regulator - * - * Interface for regulator driver for TPS51632 3-2-1 Phase D-Cap Step Down - * Driverless Controller with serial VID control and DVFS. - * - * Copyright (C) 2012 NVIDIA Corporation - - * Author: Laxman Dewangan - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __LINUX_REGULATOR_TPS51632_H -#define __LINUX_REGULATOR_TPS51632_H - -/* - * struct tps51632_regulator_platform_data - tps51632 regulator platform data. - * - * @reg_init_data: The regulator init data. - * @enable_pwm_dvfs: Enable PWM DVFS or not. - * @dvfs_step_20mV: Step for DVFS is 20mV or 10mV. - * @max_voltage_uV: Maximum possible voltage in PWM-DVFS mode. - * @base_voltage_uV: Base voltage when PWM-DVFS enabled. - */ -struct tps51632_regulator_platform_data { - struct regulator_init_data *reg_init_data; - bool enable_pwm_dvfs; - bool dvfs_step_20mV; - int max_voltage_uV; - int base_voltage_uV; -}; - -#endif /* __LINUX_REGULATOR_TPS51632_H */ diff --git a/trunk/include/linux/regulator/tps65090-regulator.h b/trunk/include/linux/regulator/tps65090-regulator.h new file mode 100644 index 000000000000..0fa04b64db3e --- /dev/null +++ b/trunk/include/linux/regulator/tps65090-regulator.h @@ -0,0 +1,50 @@ +/* + * Regulator driver interface for TI TPS65090 PMIC family + * + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __REGULATOR_TPS65090_H +#define __REGULATOR_TPS65090_H + +#include + +#define tps65090_rails(_name) "tps65090_"#_name + +enum { + TPS65090_ID_DCDC1, + TPS65090_ID_DCDC2, + TPS65090_ID_DCDC3, + TPS65090_ID_FET1, + TPS65090_ID_FET2, + TPS65090_ID_FET3, + TPS65090_ID_FET4, + TPS65090_ID_FET5, + TPS65090_ID_FET6, + TPS65090_ID_FET7, +}; + +/* + * struct tps65090_regulator_platform_data + * + * @regulator: The regulator init data. + * @slew_rate_uV_per_us: Slew rate microvolt per microsec. + */ + +struct tps65090_regulator_platform_data { + struct regulator_init_data regulator; +}; + +#endif /* __REGULATOR_TPS65090_H */ diff --git a/trunk/include/linux/spi/ads7846.h b/trunk/include/linux/spi/ads7846.h index 2f694f3846a9..c64de9dd7631 100644 --- a/trunk/include/linux/spi/ads7846.h +++ b/trunk/include/linux/spi/ads7846.h @@ -46,9 +46,8 @@ struct ads7846_platform_data { u16 debounce_rep; /* additional consecutive good readings * required after the first two */ int gpio_pendown; /* the GPIO used to decide the pendown - * state if get_pendown_state == NULL */ - int gpio_pendown_debounce; /* platform specific debounce time for - * the gpio_pendown */ + * state if get_pendown_state == NULL + */ int (*get_pendown_state)(void); int (*filter_init) (const struct ads7846_platform_data *pdata, void **filter_data); diff --git a/trunk/include/net/xfrm.h b/trunk/include/net/xfrm.h index 63445ede48bb..6f0ba01afe73 100644 --- a/trunk/include/net/xfrm.h +++ b/trunk/include/net/xfrm.h @@ -1351,7 +1351,7 @@ struct xfrm6_tunnel { }; extern void xfrm_init(void); -extern void xfrm4_init(void); +extern void xfrm4_init(int rt_hash_size); extern int xfrm_state_init(struct net *net); extern void xfrm_state_fini(struct net *net); extern void xfrm4_state_init(void); diff --git a/trunk/include/scsi/scsi_device.h b/trunk/include/scsi/scsi_device.h index 55367b04dc94..88fae8d20154 100644 --- a/trunk/include/scsi/scsi_device.h +++ b/trunk/include/scsi/scsi_device.h @@ -135,8 +135,6 @@ struct scsi_device { * because we did a bus reset. */ unsigned use_10_for_rw:1; /* first try 10-byte read / write */ unsigned use_10_for_ms:1; /* first try 10-byte mode sense/select */ - unsigned no_report_opcodes:1; /* no REPORT SUPPORTED OPERATION CODES */ - unsigned no_write_same:1; /* no WRITE SAME command */ unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ unsigned skip_vpd_pages:1; /* do not read VPD pages */ @@ -364,8 +362,6 @@ extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, struct scsi_sense_hdr *sshdr); extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf, int buf_len); -extern int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, - unsigned int len, unsigned char opcode); extern int scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state); extern struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type, diff --git a/trunk/lib/mpi/longlong.h b/trunk/lib/mpi/longlong.h index 095ab157a521..678ce4f1e124 100644 --- a/trunk/lib/mpi/longlong.h +++ b/trunk/lib/mpi/longlong.h @@ -641,14 +641,7 @@ do { \ ************** MIPS ***************** ***************************************/ #if defined(__mips__) && W_TYPE_SIZE == 32 -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 -#define umul_ppmm(w1, w0, u, v) \ -do { \ - UDItype __ll = (UDItype)(u) * (v); \ - w1 = __ll >> 32; \ - w0 = __ll; \ -} while (0) -#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 #define umul_ppmm(w1, w0, u, v) \ __asm__ ("multu %2,%3" \ : "=l" ((USItype)(w0)), \ @@ -673,15 +666,7 @@ do { \ ************** MIPS/64 ************** ***************************************/ #if (defined(__mips) && __mips >= 3) && W_TYPE_SIZE == 64 -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 4 -#define umul_ppmm(w1, w0, u, v) \ -do { \ - typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \ - __ll_UTItype __ll = (__ll_UTItype)(u) * (v); \ - w1 = __ll >> 64; \ - w0 = __ll; \ -} while (0) -#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7 +#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 #define umul_ppmm(w1, w0, u, v) \ __asm__ ("dmultu %2,%3" \ : "=l" ((UDItype)(w0)), \ diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index bcb72c6e2b2d..7bb35ac0964a 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -1405,7 +1405,7 @@ int capture_free_page(struct page *page, int alloc_order, int migratetype) mt = get_pageblock_migratetype(page); if (unlikely(mt != MIGRATE_ISOLATE)) - __mod_zone_freepage_state(zone, -(1UL << alloc_order), mt); + __mod_zone_freepage_state(zone, -(1UL << order), mt); if (alloc_order != order) expand(zone, page, alloc_order, order, diff --git a/trunk/net/core/net-sysfs.c b/trunk/net/core/net-sysfs.c index 017a8bacfb27..bcf02f608cbf 100644 --- a/trunk/net/core/net-sysfs.c +++ b/trunk/net/core/net-sysfs.c @@ -429,17 +429,6 @@ static struct attribute_group netstat_group = { .name = "statistics", .attrs = netstat_attrs, }; - -#if IS_ENABLED(CONFIG_WIRELESS_EXT) || IS_ENABLED(CONFIG_CFG80211) -static struct attribute *wireless_attrs[] = { - NULL -}; - -static struct attribute_group wireless_group = { - .name = "wireless", - .attrs = wireless_attrs, -}; -#endif #endif /* CONFIG_SYSFS */ #ifdef CONFIG_RPS @@ -1420,15 +1409,6 @@ int netdev_register_kobject(struct net_device *net) groups++; *groups++ = &netstat_group; - -#if IS_ENABLED(CONFIG_WIRELESS_EXT) || IS_ENABLED(CONFIG_CFG80211) - if (net->ieee80211_ptr) - *groups++ = &wireless_group; -#if IS_ENABLED(CONFIG_WIRELESS_EXT) - else if (net->wireless_handlers) - *groups++ = &wireless_group; -#endif -#endif #endif /* CONFIG_SYSFS */ error = device_add(dev); diff --git a/trunk/net/ipv4/route.c b/trunk/net/ipv4/route.c index df251424d816..a8c651216fa6 100644 --- a/trunk/net/ipv4/route.c +++ b/trunk/net/ipv4/route.c @@ -1785,7 +1785,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res, if (dev_out->flags & IFF_LOOPBACK) flags |= RTCF_LOCAL; - do_cache = true; if (type == RTN_BROADCAST) { flags |= RTCF_BROADCAST | RTCF_LOCAL; fi = NULL; @@ -1794,8 +1793,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res, if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr, fl4->flowi4_proto)) flags &= ~RTCF_LOCAL; - else - do_cache = false; /* If multicast route do not exist use * default one, but do not gateway in this case. * Yes, it is hack. @@ -1805,8 +1802,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, } fnhe = NULL; - do_cache &= fi != NULL; - if (do_cache) { + do_cache = fi != NULL; + if (fi) { struct rtable __rcu **prth; struct fib_nh *nh = &FIB_RES_NH(*res); @@ -2600,7 +2597,7 @@ int __init ip_rt_init(void) pr_err("Unable to create route proc files\n"); #ifdef CONFIG_XFRM xfrm_init(); - xfrm4_init(); + xfrm4_init(ip_rt_max_size); #endif rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL); diff --git a/trunk/net/ipv4/xfrm4_policy.c b/trunk/net/ipv4/xfrm4_policy.c index 3be0ac2c1920..05c5ab8d983c 100644 --- a/trunk/net/ipv4/xfrm4_policy.c +++ b/trunk/net/ipv4/xfrm4_policy.c @@ -279,8 +279,19 @@ static void __exit xfrm4_policy_fini(void) xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo); } -void __init xfrm4_init(void) +void __init xfrm4_init(int rt_max_size) { + /* + * Select a default value for the gc_thresh based on the main route + * table hash size. It seems to me the worst case scenario is when + * we have ipsec operating in transport mode, in which we create a + * dst_entry per socket. The xfrm gc algorithm starts trying to remove + * entries at gc_thresh, and prevents new allocations as 2*gc_thresh + * so lets set an initial xfrm gc_thresh value at the rt_max_size/2. + * That will let us store an ipsec connection per route table entry, + * and start cleaning when were 1/2 full + */ + xfrm4_dst_ops.gc_thresh = rt_max_size/2; dst_entries_init(&xfrm4_dst_ops); xfrm4_state_init(); diff --git a/trunk/net/ipv6/inet6_connection_sock.c b/trunk/net/ipv6/inet6_connection_sock.c index 30647857a375..c4f934176cab 100644 --- a/trunk/net/ipv6/inet6_connection_sock.c +++ b/trunk/net/ipv6/inet6_connection_sock.c @@ -252,7 +252,6 @@ struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu) return NULL; dst->ops->update_pmtu(dst, sk, NULL, mtu); - dst = inet6_csk_route_socket(sk, &fl6); - return IS_ERR(dst) ? NULL : dst; + return inet6_csk_route_socket(sk, &fl6); } EXPORT_SYMBOL_GPL(inet6_csk_update_pmtu); diff --git a/trunk/net/mac80211/ibss.c b/trunk/net/mac80211/ibss.c index c21e33d1abd0..bf87c70ac6c5 100644 --- a/trunk/net/mac80211/ibss.c +++ b/trunk/net/mac80211/ibss.c @@ -1151,6 +1151,10 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) mutex_lock(&sdata->u.ibss.mtx); + sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; + memset(sdata->u.ibss.bssid, 0, ETH_ALEN); + sdata->u.ibss.ssid_len = 0; + active_ibss = ieee80211_sta_active_ibss(sdata); if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) { @@ -1171,10 +1175,6 @@ int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) } } - ifibss->state = IEEE80211_IBSS_MLME_SEARCH; - memset(ifibss->bssid, 0, ETH_ALEN); - ifibss->ssid_len = 0; - sta_info_flush(sdata->local, sdata); spin_lock_bh(&ifibss->incomplete_lock); diff --git a/trunk/net/netfilter/ipset/ip_set_hash_ip.c b/trunk/net/netfilter/ipset/ip_set_hash_ip.c index 5c0b78528e55..ec3dba5dcd62 100644 --- a/trunk/net/netfilter/ipset/ip_set_hash_ip.c +++ b/trunk/net/netfilter/ipset/ip_set_hash_ip.c @@ -173,7 +173,6 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], return adtfn(set, &nip, timeout, flags); } - ip_to = ip; if (tb[IPSET_ATTR_IP_TO]) { ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to); if (ret) @@ -186,7 +185,8 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[], if (!cidr || cidr > 32) return -IPSET_ERR_INVALID_CIDR; ip_set_mask_from_to(ip, ip_to, cidr); - } + } else + ip_to = ip; hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1); diff --git a/trunk/net/netfilter/ipset/ip_set_hash_ipport.c b/trunk/net/netfilter/ipset/ip_set_hash_ipport.c index 6283351f4eeb..0171f7502fa5 100644 --- a/trunk/net/netfilter/ipset/ip_set_hash_ipport.c +++ b/trunk/net/netfilter/ipset/ip_set_hash_ipport.c @@ -162,7 +162,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], const struct ip_set_hash *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_ipport4_elem data = { }; - u32 ip, ip_to, p = 0, port, port_to; + u32 ip, ip_to = 0, p = 0, port, port_to; u32 timeout = h->timeout; bool with_ports = false; int ret; @@ -210,7 +210,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], return ip_set_eexist(ret, flags) ? 0 : ret; } - ip_to = ip = ntohl(data.ip); + ip = ntohl(data.ip); if (tb[IPSET_ATTR_IP_TO]) { ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to); if (ret) @@ -223,7 +223,8 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[], if (!cidr || cidr > 32) return -IPSET_ERR_INVALID_CIDR; ip_set_mask_from_to(ip, ip_to, cidr); - } + } else + ip_to = ip; port_to = port = ntohs(data.port); if (with_ports && tb[IPSET_ATTR_PORT_TO]) { diff --git a/trunk/net/netfilter/ipset/ip_set_hash_ipportip.c b/trunk/net/netfilter/ipset/ip_set_hash_ipportip.c index 6a21271c8d5a..6344ef551ec8 100644 --- a/trunk/net/netfilter/ipset/ip_set_hash_ipportip.c +++ b/trunk/net/netfilter/ipset/ip_set_hash_ipportip.c @@ -166,7 +166,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], const struct ip_set_hash *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_ipportip4_elem data = { }; - u32 ip, ip_to, p = 0, port, port_to; + u32 ip, ip_to = 0, p = 0, port, port_to; u32 timeout = h->timeout; bool with_ports = false; int ret; @@ -218,7 +218,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], return ip_set_eexist(ret, flags) ? 0 : ret; } - ip_to = ip = ntohl(data.ip); + ip = ntohl(data.ip); if (tb[IPSET_ATTR_IP_TO]) { ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to); if (ret) @@ -231,7 +231,8 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[], if (!cidr || cidr > 32) return -IPSET_ERR_INVALID_CIDR; ip_set_mask_from_to(ip, ip_to, cidr); - } + } else + ip_to = ip; port_to = port = ntohs(data.port); if (with_ports && tb[IPSET_ATTR_PORT_TO]) { diff --git a/trunk/net/netfilter/ipset/ip_set_hash_ipportnet.c b/trunk/net/netfilter/ipset/ip_set_hash_ipportnet.c index 2d5cd4ee30eb..cb71f9a774e7 100644 --- a/trunk/net/netfilter/ipset/ip_set_hash_ipportnet.c +++ b/trunk/net/netfilter/ipset/ip_set_hash_ipportnet.c @@ -215,8 +215,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], const struct ip_set_hash *h = set->data; ipset_adtfn adtfn = set->variant->adt[adt]; struct hash_ipportnet4_elem data = { .cidr = HOST_MASK - 1 }; - u32 ip, ip_to, p = 0, port, port_to; - u32 ip2_from, ip2_to, ip2_last, ip2; + u32 ip, ip_to = 0, p = 0, port, port_to; + u32 ip2_from = 0, ip2_to, ip2_last, ip2; u32 timeout = h->timeout; bool with_ports = false; u8 cidr; @@ -286,7 +286,6 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], return ip_set_eexist(ret, flags) ? 0 : ret; } - ip_to = ip; if (tb[IPSET_ATTR_IP_TO]) { ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to); if (ret) @@ -307,8 +306,6 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[], if (port > port_to) swap(port, port_to); } - - ip2_to = ip2_from; if (tb[IPSET_ATTR_IP2_TO]) { ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to); if (ret) diff --git a/trunk/net/netfilter/nfnetlink_cttimeout.c b/trunk/net/netfilter/nfnetlink_cttimeout.c index 701c88a20fea..8847b4d8be06 100644 --- a/trunk/net/netfilter/nfnetlink_cttimeout.c +++ b/trunk/net/netfilter/nfnetlink_cttimeout.c @@ -41,8 +41,7 @@ MODULE_DESCRIPTION("cttimeout: Extended Netfilter Connection Tracking timeout tu static LIST_HEAD(cttimeout_list); static const struct nla_policy cttimeout_nla_policy[CTA_TIMEOUT_MAX+1] = { - [CTA_TIMEOUT_NAME] = { .type = NLA_NUL_STRING, - .len = CTNL_TIMEOUT_NAME_MAX - 1}, + [CTA_TIMEOUT_NAME] = { .type = NLA_NUL_STRING }, [CTA_TIMEOUT_L3PROTO] = { .type = NLA_U16 }, [CTA_TIMEOUT_L4PROTO] = { .type = NLA_U8 }, [CTA_TIMEOUT_DATA] = { .type = NLA_NESTED }, diff --git a/trunk/net/nfc/llcp/llcp.c b/trunk/net/nfc/llcp/llcp.c index 9e8f4b2801f6..cc10d073c338 100644 --- a/trunk/net/nfc/llcp/llcp.c +++ b/trunk/net/nfc/llcp/llcp.c @@ -1210,7 +1210,7 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) local->remote_miu = LLCP_DEFAULT_MIU; local->remote_lto = LLCP_DEFAULT_LTO; - list_add(&local->list, &llcp_devices); + list_add(&llcp_devices, &local->list); return 0; } diff --git a/trunk/scripts/sign-file b/trunk/scripts/sign-file index 974a20b661b7..87ca59d36e7e 100755 --- a/trunk/scripts/sign-file +++ b/trunk/scripts/sign-file @@ -156,12 +156,12 @@ sub asn1_extract($$@) if ($l == 0x1) { $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)); - } elsif ($l == 0x2) { + } elsif ($l = 0x2) { $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0], 2)); - } elsif ($l == 0x3) { + } elsif ($l = 0x3) { $len = unpack("C", substr(${$cursor->[2]}, $cursor->[0], 1)) << 16; $len = unpack("n", substr(${$cursor->[2]}, $cursor->[0] + 1, 2)); - } elsif ($l == 0x4) { + } elsif ($l = 0x4) { $len = unpack("N", substr(${$cursor->[2]}, $cursor->[0], 4)); } else { die $x509, ": ", $cursor->[0], ": ASN.1 element too long (", $l, ")\n"; diff --git a/trunk/security/selinux/netnode.c b/trunk/security/selinux/netnode.c index c5454c0477c3..28f911cdd7c7 100644 --- a/trunk/security/selinux/netnode.c +++ b/trunk/security/selinux/netnode.c @@ -174,8 +174,7 @@ static void sel_netnode_insert(struct sel_netnode *node) if (sel_netnode_hash[idx].size == SEL_NETNODE_HASH_BKT_LIMIT) { struct sel_netnode *tail; tail = list_entry( - rcu_dereference_protected(sel_netnode_hash[idx].list.prev, - lockdep_is_held(&sel_netnode_lock)), + rcu_dereference(sel_netnode_hash[idx].list.prev), struct sel_netnode, list); list_del_rcu(&tail->list); kfree_rcu(tail, rcu); diff --git a/trunk/sound/pci/hda/hda_codec.c b/trunk/sound/pci/hda/hda_codec.c index d010de12335e..70d4848b5cd0 100644 --- a/trunk/sound/pci/hda/hda_codec.c +++ b/trunk/sound/pci/hda/hda_codec.c @@ -95,7 +95,6 @@ int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); #ifdef CONFIG_PM -#define codec_in_pm(codec) ((codec)->in_pm) static void hda_power_work(struct work_struct *work); static void hda_keep_power_on(struct hda_codec *codec); #define hda_codec_is_power_on(codec) ((codec)->power_on) @@ -105,7 +104,6 @@ static inline void hda_call_pm_notify(struct hda_bus *bus, bool power_up) bus->ops.pm_notify(bus, power_up); } #else -#define codec_in_pm(codec) 0 static inline void hda_keep_power_on(struct hda_codec *codec) {} #define hda_codec_is_power_on(codec) 1 #define hda_call_pm_notify(bus, state) {} @@ -230,7 +228,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, } mutex_unlock(&bus->cmd_mutex); snd_hda_power_down(codec); - if (!codec_in_pm(codec) && res && *res == -1 && bus->rirb_error) { + if (res && *res == -1 && bus->rirb_error) { if (bus->response_reset) { snd_printd("hda_codec: resetting BUS due to " "fatal communication error\n"); @@ -240,7 +238,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, goto again; } /* clear reset-flag when the communication gets recovered */ - if (!err || codec_in_pm(codec)) + if (!err) bus->response_reset = 0; return err; } @@ -3618,8 +3616,6 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq) { unsigned int state; - codec->in_pm = 1; - if (codec->patch_ops.suspend) codec->patch_ops.suspend(codec); hda_cleanup_all_streams(codec); @@ -3634,7 +3630,6 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq) codec->power_transition = 0; codec->power_jiffies = jiffies; spin_unlock(&codec->power_lock); - codec->in_pm = 0; return state; } @@ -3643,8 +3638,6 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec, bool in_wq) */ static void hda_call_codec_resume(struct hda_codec *codec) { - codec->in_pm = 1; - /* set as if powered on for avoiding re-entering the resume * in the resume / power-save sequence */ @@ -3663,8 +3656,6 @@ static void hda_call_codec_resume(struct hda_codec *codec) snd_hda_codec_resume_cache(codec); } snd_hda_jack_report_sync(codec); - - codec->in_pm = 0; snd_hda_power_down(codec); /* flag down before returning */ } #endif /* CONFIG_PM */ diff --git a/trunk/sound/pci/hda/hda_codec.h b/trunk/sound/pci/hda/hda_codec.h index 4f4e545c0f4b..507fe8a917b6 100644 --- a/trunk/sound/pci/hda/hda_codec.h +++ b/trunk/sound/pci/hda/hda_codec.h @@ -869,7 +869,6 @@ struct hda_codec { unsigned int power_on :1; /* current (global) power-state */ unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ unsigned int pm_down_notified:1; /* PM notified to controller */ - unsigned int in_pm:1; /* suspend/resume being performed */ int power_transition; /* power-state in transition */ int power_count; /* current (global) power refcount */ struct delayed_work power_work; /* delayed task for powerdown */ diff --git a/trunk/sound/pci/hda/hda_intel.c b/trunk/sound/pci/hda/hda_intel.c index f9d870e554d9..cd2dbaf1be78 100644 --- a/trunk/sound/pci/hda/hda_intel.c +++ b/trunk/sound/pci/hda/hda_intel.c @@ -556,12 +556,6 @@ enum { #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */ #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ -#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ - -/* quirks for Intel PCH */ -#define AZX_DCAPS_INTEL_PCH \ - (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ - AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_PM_RUNTIME) /* quirks for ATI SB / AMD Hudson */ #define AZX_DCAPS_PRESET_ATI_SB \ @@ -2439,9 +2433,6 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up) { struct azx *chip = bus->private_data; - if (!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) - return; - if (power_up) pm_runtime_get_sync(&chip->pci->dev); else @@ -2557,8 +2548,7 @@ static int azx_runtime_suspend(struct device *dev) struct snd_card *card = dev_get_drvdata(dev); struct azx *chip = card->private_data; - if (!power_save_controller || - !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) + if (!power_save_controller) return -EAGAIN; azx_stop_chip(chip); @@ -3439,30 +3429,39 @@ static void __devexit azx_remove(struct pci_dev *pci) static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { /* CPT */ { PCI_DEVICE(0x8086, 0x1c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* PBG */ { PCI_DEVICE(0x8086, 0x1d20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE}, /* Panther Point */ { PCI_DEVICE(0x8086, 0x1e20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* Lynx Point */ { PCI_DEVICE(0x8086, 0x8c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* Lynx Point-LP */ { PCI_DEVICE(0x8086, 0x9c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* Lynx Point-LP */ { PCI_DEVICE(0x8086, 0x9c21), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* Haswell */ { PCI_DEVICE(0x8086, 0x0c0c), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, { PCI_DEVICE(0x8086, 0x0d0c), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* 5 Series/3400 */ { PCI_DEVICE(0x8086, 0x3b56), - .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, + .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | + AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY }, /* SCH */ { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | diff --git a/trunk/sound/pci/hda/patch_cirrus.c b/trunk/sound/pci/hda/patch_cirrus.c index 3bcb67172358..d5f3a26d608d 100644 --- a/trunk/sound/pci/hda/patch_cirrus.c +++ b/trunk/sound/pci/hda/patch_cirrus.c @@ -466,7 +466,6 @@ static int parse_output(struct hda_codec *codec) memcpy(cfg->speaker_pins, cfg->line_out_pins, sizeof(cfg->speaker_pins)); cfg->line_outs = 0; - memset(cfg->line_out_pins, 0, sizeof(cfg->line_out_pins)); } return 0; diff --git a/trunk/sound/pci/hda/patch_realtek.c b/trunk/sound/pci/hda/patch_realtek.c index ad68d223f8af..68fd49294b26 100644 --- a/trunk/sound/pci/hda/patch_realtek.c +++ b/trunk/sound/pci/hda/patch_realtek.c @@ -7065,7 +7065,6 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, - { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", .patch = patch_alc861 }, { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, diff --git a/trunk/sound/soc/codecs/arizona.c b/trunk/sound/soc/codecs/arizona.c index 054967d8bac2..c03b65af3059 100644 --- a/trunk/sound/soc/codecs/arizona.c +++ b/trunk/sound/soc/codecs/arizona.c @@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(arizona_out_ev); static unsigned int arizona_sysclk_48k_rates[] = { 6144000, 12288000, - 24576000, + 22579200, 49152000, 73728000, 98304000, @@ -278,7 +278,7 @@ static unsigned int arizona_sysclk_48k_rates[] = { static unsigned int arizona_sysclk_44k1_rates[] = { 5644800, 11289600, - 22579200, + 24576000, 45158400, 67737600, 90316800, diff --git a/trunk/sound/soc/codecs/cs4271.c b/trunk/sound/soc/codecs/cs4271.c index e3f0a7f3131e..f994af34f552 100644 --- a/trunk/sound/soc/codecs/cs4271.c +++ b/trunk/sound/soc/codecs/cs4271.c @@ -485,7 +485,7 @@ static int cs4271_probe(struct snd_soc_codec *codec) gpio_nreset = cs4271plat->gpio_nreset; if (gpio_nreset >= 0) - if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset")) + if (gpio_request(gpio_nreset, "CS4271 Reset")) gpio_nreset = -EINVAL; if (gpio_nreset >= 0) { /* Reset codec */ @@ -535,10 +535,15 @@ static int cs4271_probe(struct snd_soc_codec *codec) static int cs4271_remove(struct snd_soc_codec *codec) { struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); + int gpio_nreset; - if (gpio_is_valid(cs4271->gpio_nreset)) + gpio_nreset = cs4271->gpio_nreset; + + if (gpio_is_valid(gpio_nreset)) { /* Set codec to the reset state */ - gpio_set_value(cs4271->gpio_nreset, 0); + gpio_set_value(gpio_nreset, 0); + gpio_free(gpio_nreset); + } return 0; }; diff --git a/trunk/sound/soc/kirkwood/kirkwood-dma.c b/trunk/sound/soc/kirkwood/kirkwood-dma.c index 2ba08148655f..b9f16598324c 100644 --- a/trunk/sound/soc/kirkwood/kirkwood-dma.c +++ b/trunk/sound/soc/kirkwood/kirkwood-dma.c @@ -71,6 +71,7 @@ static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id) printk(KERN_WARNING "%s: got err interrupt 0x%lx\n", __func__, cause); writel(cause, priv->io + KIRKWOOD_ERR_CAUSE); + return IRQ_HANDLED; } /* we've enabled only bytes interrupts ... */ @@ -177,7 +178,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) } dram = mv_mbus_dram_info(); - addr = substream->dma_buffer.addr; + addr = virt_to_phys(substream->dma_buffer.area); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { prdata->play_stream = substream; kirkwood_dma_conf_mbus_windows(priv->io, diff --git a/trunk/sound/soc/kirkwood/kirkwood-i2s.c b/trunk/sound/soc/kirkwood/kirkwood-i2s.c index 1d5db484d2df..542538d10ab7 100644 --- a/trunk/sound/soc/kirkwood/kirkwood-i2s.c +++ b/trunk/sound/soc/kirkwood/kirkwood-i2s.c @@ -95,7 +95,7 @@ static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate) do { cpu_relax(); value = readl(io + KIRKWOOD_DCO_SPCR_STATUS); - value &= KIRKWOOD_DCO_SPCR_STATUS_DCO_LOCK; + value &= KIRKWOOD_DCO_SPCR_STATUS; } while (value == 0); } @@ -180,72 +180,67 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); - uint32_t ctl, value; - - ctl = readl(priv->io + KIRKWOOD_PLAYCTL); - if (ctl & KIRKWOOD_PLAYCTL_PAUSE) { - unsigned timeout = 5000; - /* - * The Armada510 spec says that if we enter pause mode, the - * busy bit must be read back as clear _twice_. Make sure - * we respect that otherwise we get DMA underruns. - */ - do { - value = ctl; - ctl = readl(priv->io + KIRKWOOD_PLAYCTL); - if (!((ctl | value) & KIRKWOOD_PLAYCTL_PLAY_BUSY)) - break; - udelay(1); - } while (timeout--); - - if ((ctl | value) & KIRKWOOD_PLAYCTL_PLAY_BUSY) - dev_notice(dai->dev, "timed out waiting for busy to deassert: %08x\n", - ctl); - } + unsigned long value; + + /* + * specs says KIRKWOOD_PLAYCTL must be read 2 times before + * changing it. So read 1 time here and 1 later. + */ + value = readl(priv->io + KIRKWOOD_PLAYCTL); switch (cmd) { case SNDRV_PCM_TRIGGER_START: + /* stop audio, enable interrupts */ + value = readl(priv->io + KIRKWOOD_PLAYCTL); + value |= KIRKWOOD_PLAYCTL_PAUSE; + writel(value, priv->io + KIRKWOOD_PLAYCTL); + value = readl(priv->io + KIRKWOOD_INT_MASK); value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES; writel(value, priv->io + KIRKWOOD_INT_MASK); /* configure audio & enable i2s playback */ - ctl &= ~KIRKWOOD_PLAYCTL_BURST_MASK; - ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE + value = readl(priv->io + KIRKWOOD_PLAYCTL); + value &= ~KIRKWOOD_PLAYCTL_BURST_MASK; + value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE | KIRKWOOD_PLAYCTL_SPDIF_EN); if (priv->burst == 32) - ctl |= KIRKWOOD_PLAYCTL_BURST_32; + value |= KIRKWOOD_PLAYCTL_BURST_32; else - ctl |= KIRKWOOD_PLAYCTL_BURST_128; - ctl |= KIRKWOOD_PLAYCTL_I2S_EN; - writel(ctl, priv->io + KIRKWOOD_PLAYCTL); + value |= KIRKWOOD_PLAYCTL_BURST_128; + value |= KIRKWOOD_PLAYCTL_I2S_EN; + writel(value, priv->io + KIRKWOOD_PLAYCTL); break; case SNDRV_PCM_TRIGGER_STOP: /* stop audio, disable interrupts */ - ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; - writel(ctl, priv->io + KIRKWOOD_PLAYCTL); + value = readl(priv->io + KIRKWOOD_PLAYCTL); + value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; + writel(value, priv->io + KIRKWOOD_PLAYCTL); value = readl(priv->io + KIRKWOOD_INT_MASK); value &= ~KIRKWOOD_INT_CAUSE_PLAY_BYTES; writel(value, priv->io + KIRKWOOD_INT_MASK); /* disable all playbacks */ - ctl &= ~(KIRKWOOD_PLAYCTL_I2S_EN | KIRKWOOD_PLAYCTL_SPDIF_EN); - writel(ctl, priv->io + KIRKWOOD_PLAYCTL); + value = readl(priv->io + KIRKWOOD_PLAYCTL); + value &= ~(KIRKWOOD_PLAYCTL_I2S_EN | KIRKWOOD_PLAYCTL_SPDIF_EN); + writel(value, priv->io + KIRKWOOD_PLAYCTL); break; case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_SUSPEND: - ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; - writel(ctl, priv->io + KIRKWOOD_PLAYCTL); + value = readl(priv->io + KIRKWOOD_PLAYCTL); + value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; + writel(value, priv->io + KIRKWOOD_PLAYCTL); break; case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); - writel(ctl, priv->io + KIRKWOOD_PLAYCTL); + value = readl(priv->io + KIRKWOOD_PLAYCTL); + value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); + writel(value, priv->io + KIRKWOOD_PLAYCTL); break; default: @@ -265,6 +260,11 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, switch (cmd) { case SNDRV_PCM_TRIGGER_START: + /* stop audio, enable interrupts */ + value = readl(priv->io + KIRKWOOD_RECCTL); + value |= KIRKWOOD_RECCTL_PAUSE; + writel(value, priv->io + KIRKWOOD_RECCTL); + value = readl(priv->io + KIRKWOOD_INT_MASK); value |= KIRKWOOD_INT_CAUSE_REC_BYTES; writel(value, priv->io + KIRKWOOD_INT_MASK); diff --git a/trunk/sound/soc/samsung/bells.c b/trunk/sound/soc/samsung/bells.c index a2ca1567b9e4..b56b9a3c6169 100644 --- a/trunk/sound/soc/samsung/bells.c +++ b/trunk/sound/soc/samsung/bells.c @@ -212,7 +212,7 @@ static struct snd_soc_dai_link bells_dai_wm5102[] = { { .name = "Sub", .stream_name = "Sub", - .cpu_dai_name = "wm5102-aif3", + .cpu_dai_name = "wm5110-aif3", .codec_dai_name = "wm9081-hifi", .codec_name = "wm9081.1-006c", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF @@ -247,7 +247,7 @@ static struct snd_soc_dai_link bells_dai_wm5110[] = { { .name = "Sub", .stream_name = "Sub", - .cpu_dai_name = "wm5110-aif3", + .cpu_dai_name = "wm5102-aif3", .codec_dai_name = "wm9081-hifi", .codec_name = "wm9081.1-006c", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF diff --git a/trunk/sound/usb/midi.c b/trunk/sound/usb/midi.c index eeefbce3873c..c83f6143c0eb 100644 --- a/trunk/sound/usb/midi.c +++ b/trunk/sound/usb/midi.c @@ -148,7 +148,6 @@ struct snd_usb_midi_out_endpoint { struct snd_usb_midi_out_endpoint* ep; struct snd_rawmidi_substream *substream; int active; - bool autopm_reference; uint8_t cable; /* cable number << 4 */ uint8_t state; #define STATE_UNKNOWN 0 @@ -1077,8 +1076,7 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) return -ENXIO; } err = usb_autopm_get_interface(umidi->iface); - port->autopm_reference = err >= 0; - if (err < 0 && err != -EACCES) + if (err < 0) return -EIO; substream->runtime->private_data = port; port->state = STATE_UNKNOWN; @@ -1089,11 +1087,9 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) { struct snd_usb_midi* umidi = substream->rmidi->private_data; - struct usbmidi_out_port *port = substream->runtime->private_data; substream_open(substream, 0); - if (port->autopm_reference) - usb_autopm_put_interface(umidi->iface); + usb_autopm_put_interface(umidi->iface); return 0; } diff --git a/trunk/sound/usb/pcm.c b/trunk/sound/usb/pcm.c index ef6fa24fc473..5c12a3fe8c3e 100644 --- a/trunk/sound/usb/pcm.c +++ b/trunk/sound/usb/pcm.c @@ -459,7 +459,7 @@ static int configure_endpoint(struct snd_usb_substream *subs) return ret; if (subs->sync_endpoint) - ret = snd_usb_endpoint_set_params(subs->sync_endpoint, + ret = snd_usb_endpoint_set_params(subs->data_endpoint, subs->pcm_format, subs->channels, subs->period_bytes,