Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge (most of) tag 'mfd-next-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
"New Drivers:
- Intel Cherry Trail Whiskey Cove PMIC
- TI LP87565 PMIC

New Device Support:
- Add support for Cannonlake to intel-lpss-pci
- Add support for Simatic IOT2000 to intel_quark_i2c_gpio

New Functionality:
- Add Regulator support (axp20x)

Fix-ups:
- Rework IRQ handling (intel_soc_pmic_bxtwc, rtsx_pcr, cros_ec)
- Remove unused/unwelcome code (ipaq-micro, wm831x-core, da9062-core)
- Provide deregistration on unbind (rn5t618)
- Rework DT code/documentation (arizona)
- Constify things (fsl-imx25-tsadc)
- MAINTAINERS updates (DA9062/61)
- Kconfig configuration adaptions (INTEL_SOC_PMIC, MFD_AXP20X_I2C)
- Switch to DMI matching (intel_quark_i2c_gpio)
- Provide an appropriate level of error checking (wm831x-{i2c,spi},
twl4030-irq, tc6393xb)
- Make use of devm_* (resource handling) calls (intel_soc_pmic_bxtwc,
stm32-timers, atmel-flexcom, cros_ec, fsl-imx25-tsadc,
exynos-lpass, palmas, qcom-spmi-pmic, smsc-ece1099,
motorola-cpcap)"

[ Skipped the last commit in that series that added eight thousand
lines of pointless repeated register definitions. - Linus ]

* tag 'mfd-next-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (38 commits)
mfd: Add LP87565 PMIC support
mfd: cros_ec: Free IRQ on exit
dt-bindings: vendor-prefixes: Add arctic to vendor prefix
mfd: da9061: Fix to remove BBAT_CONT register from chip model
mfd: da9061: Fix to remove BBAT_CONT register from chip model
mfd: axp20x-i2c: Document that this must be builtin on x86
mfd: Add Cherry Trail Whiskey Cove PMIC driver
mfd: tc6393xb: Handle return value of clk_prepare_enable
mfd: intel_quark_i2c_gpio: Add support for SIMATIC IOT2000 platform
mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency
mfd: motorola-cpcap: Use devm_of_platform_populate()
mfd: smsc-ece: Use devm_of_platform_populate()
mfd: qcom-spmi-pmic: Use devm_of_platform_populate()
mfd: palmas: Use devm_of_platform_populate()
mfd: exynos: Use devm_of_platform_populate()
mfd: fsl-imx25: Use devm_of_platform_populate()
mfd: cros_ec: Use devm_of_platform_populate()
mfd: atmel: Use devm_of_platform_populate()
mfd: stm32-timers: Use devm_of_platform_populate()
mfd: intel_soc_pmic: Select designware i2c-bus driver
...

+987 -185
+2 -1
Documentation/devicetree/bindings/mfd/arizona.txt
··· 30 30 31 31 - gpio-controller : Indicates this device is a GPIO controller. 32 32 - #gpio-cells : Must be 2. The first cell is the pin number and the 33 - second cell is used to specify optional parameters (currently unused). 33 + second cell is used to specify optional parameters, see ../gpio/gpio.txt 34 + for details. 34 35 35 36 - AVDD-supply, DBVDD1-supply, CPVDD-supply : Power supplies for the device, 36 37 as covered in Documentation/devicetree/bindings/regulator/regulator.txt
+43
Documentation/devicetree/bindings/mfd/lp87565.txt
··· 1 + TI LP87565 PMIC MFD driver 2 + 3 + Required properties: 4 + - compatible: "ti,lp87565", "ti,lp87565-q1" 5 + - reg: I2C slave address. 6 + - gpio-controller: Marks the device node as a GPIO Controller. 7 + - #gpio-cells: Should be two. The first cell is the pin number and 8 + the second cell is used to specify flags. 9 + See ../gpio/gpio.txt for more information. 10 + - xxx-in-supply: Phandle to parent supply node of each regulator 11 + populated under regulators node. xxx should match 12 + the supply_name populated in driver. 13 + Example: 14 + 15 + lp87565_pmic: pmic@60 { 16 + compatible = "ti,lp87565-q1"; 17 + reg = <0x60>; 18 + gpio-controller; 19 + #gpio-cells = <2>; 20 + 21 + buck10-in-supply = <&vsys_3v3>; 22 + buck23-in-supply = <&vsys_3v3>; 23 + 24 + regulators: regulators { 25 + buck10_reg: buck10 { 26 + /* VDD_MPU */ 27 + regulator-name = "buck10"; 28 + regulator-min-microvolt = <850000>; 29 + regulator-max-microvolt = <1250000>; 30 + regulator-always-on; 31 + regulator-boot-on; 32 + }; 33 + 34 + buck23_reg: buck23 { 35 + /* VDD_GPU */ 36 + regulator-name = "buck23"; 37 + regulator-min-microvolt = <850000>; 38 + regulator-max-microvolt = <1250000>; 39 + regulator-boot-on; 40 + regulator-always-on; 41 + }; 42 + }; 43 + };
+1
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 29 29 apm Applied Micro Circuits Corporation (APM) 30 30 aptina Aptina Imaging 31 31 arasan Arasan Chip Systems 32 + arctic Arctic Sand 32 33 aries Aries Embedded GmbH 33 34 arm ARM Ltd. 34 35 armadeus ARMadeus Systems SARL
+4
MAINTAINERS
··· 4048 4048 S: Supported 4049 4049 F: Documentation/hwmon/da90?? 4050 4050 F: Documentation/devicetree/bindings/mfd/da90*.txt 4051 + F: Documentation/devicetree/bindings/input/da90??-onkey.txt 4052 + F: Documentation/devicetree/bindings/thermal/da90??-thermal.txt 4051 4053 F: Documentation/devicetree/bindings/regulator/da92*.txt 4054 + F: Documentation/devicetree/bindings/watchdog/da92??-wdt.txt 4052 4055 F: Documentation/devicetree/bindings/sound/da[79]*.txt 4053 4056 F: drivers/gpio/gpio-da90??.c 4054 4057 F: drivers/hwmon/da90??-hwmon.c ··· 4066 4063 F: drivers/power/supply/da91??-*.c 4067 4064 F: drivers/regulator/da903x.c 4068 4065 F: drivers/regulator/da9???-regulator.[ch] 4066 + F: drivers/thermal/da90??-thermal.c 4069 4067 F: drivers/rtc/rtc-da90??.c 4070 4068 F: drivers/video/backlight/da90??_bl.c 4071 4069 F: drivers/watchdog/da90??_wdt.c
+13 -1
drivers/gpio/gpio-wcove.c
··· 428 428 if (!wg) 429 429 return -ENOMEM; 430 430 431 - wg->regmap_irq_chip = pmic->irq_chip_data_level2; 431 + wg->regmap_irq_chip = pmic->irq_chip_data; 432 432 433 433 platform_set_drvdata(pdev, wg); 434 434 ··· 475 475 } 476 476 477 477 gpiochip_set_nested_irqchip(&wg->chip, &wcove_irqchip, virq); 478 + 479 + /* Enable GPIO0 interrupts */ 480 + ret = regmap_update_bits(wg->regmap, IRQ_MASK_BASE, GPIO_IRQ0_MASK, 481 + 0x00); 482 + if (ret) 483 + return ret; 484 + 485 + /* Enable GPIO1 interrupts */ 486 + ret = regmap_update_bits(wg->regmap, IRQ_MASK_BASE + 1, GPIO_IRQ1_MASK, 487 + 0x00); 488 + if (ret) 489 + return ret; 478 490 479 491 return 0; 480 492 }
+42 -2
drivers/mfd/Kconfig
··· 160 160 components like regulators or the PEK (Power Enable Key) under the 161 161 corresponding menus. 162 162 163 + Note on x86 this provides an ACPI OpRegion, so this must be 'y' 164 + (builtin) and not a module, as the OpRegion must be available as 165 + soon as possible. For the same reason the I2C bus driver options 166 + I2C_DESIGNWARE_PLATFORM and I2C_DESIGNWARE_BAYTRAIL must be 'y' too. 167 + 163 168 config MFD_AXP20X_RSB 164 169 tristate "X-Powers AXP series PMICs with RSB" 165 170 select MFD_AXP20X ··· 453 448 454 449 config INTEL_SOC_PMIC 455 450 bool "Support for Crystal Cove PMIC" 456 - depends on GPIOLIB 457 - depends on I2C=y 451 + depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK 452 + depends on X86 || COMPILE_TEST 458 453 select MFD_CORE 459 454 select REGMAP_I2C 460 455 select REGMAP_IRQ 456 + select I2C_DESIGNWARE_PLATFORM if ACPI 461 457 help 462 458 Select this option to enable support for Crystal Cove PMIC 463 459 on some Intel SoC systems. The PMIC provides ADC, GPIO, 464 460 thermal, charger and related power management functions 465 461 on these systems. 462 + 463 + This option is a bool as it provides an ACPI OpRegion which must be 464 + available before any devices using it are probed. This option also 465 + causes the designware-i2c driver to be builtin for the same reason. 466 466 467 467 config INTEL_SOC_PMIC_BXTWC 468 468 tristate "Support for Intel Broxton Whiskey Cove PMIC" ··· 479 469 on Intel Broxton systems. The PMIC provides ADC, GPIO, 480 470 thermal, charger and related power management functions 481 471 on these systems. 472 + 473 + config INTEL_SOC_PMIC_CHTWC 474 + tristate "Support for Intel Cherry Trail Whiskey Cove PMIC" 475 + depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK 476 + depends on X86 || COMPILE_TEST 477 + select MFD_CORE 478 + select REGMAP_I2C 479 + select REGMAP_IRQ 480 + select I2C_DESIGNWARE_PLATFORM 481 + help 482 + Select this option to enable support for the Intel Cherry Trail 483 + Whiskey Cove PMIC found on some Intel Cherry Trail systems. 484 + 485 + This option is a bool as it provides an ACPI OpRegion which must be 486 + available before any devices using it are probed. This option also 487 + causes the designware-i2c driver to be builtin for the same reason. 482 488 483 489 config MFD_INTEL_LPSS 484 490 tristate ··· 1350 1324 1351 1325 This driver can also be built as a module. If so, the module 1352 1326 will be called lp873x. 1327 + 1328 + config MFD_TI_LP87565 1329 + tristate "TI LP87565 Power Management IC" 1330 + depends on I2C && OF 1331 + select MFD_CORE 1332 + select REGMAP_I2C 1333 + help 1334 + If you say yes here then you get support for the LP87565 series of 1335 + Power Management Integrated Circuits (PMIC). 1336 + These include voltage regulators, thermal protection, configurable 1337 + General Purpose Outputs (GPO) that are used in portable devices. 1338 + 1339 + This driver can also be built as a module. If so, the module 1340 + will be called lp87565. 1353 1341 1354 1342 config MFD_TPS65218 1355 1343 tristate "TI TPS65218 Power Management chips"
+2
drivers/mfd/Makefile
··· 25 25 obj-$(CONFIG_HTC_I2CPLD) += htc-i2cpld.o 26 26 27 27 obj-$(CONFIG_MFD_TI_LP873X) += lp873x.o 28 + obj-$(CONFIG_MFD_TI_LP87565) += lp87565.o 28 29 29 30 obj-$(CONFIG_MFD_DAVINCI_VOICECODEC) += davinci_voicecodec.o 30 31 obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o ··· 215 214 intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o 216 215 obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o 217 216 obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC) += intel_soc_pmic_bxtwc.o 217 + obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC) += intel_soc_pmic_chtwc.o 218 218 obj-$(CONFIG_MFD_MT6397) += mt6397-core.o 219 219 220 220 obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
+1 -1
drivers/mfd/atmel-flexcom.c
··· 80 80 81 81 clk_disable_unprepare(clk); 82 82 83 - return of_platform_populate(np, NULL, NULL, &pdev->dev); 83 + return devm_of_platform_populate(&pdev->dev); 84 84 } 85 85 86 86 static const struct of_device_id atmel_flexcom_of_match[] = {
+2 -1
drivers/mfd/axp20x.c
··· 848 848 .name = "axp20x-pek", 849 849 .num_resources = ARRAY_SIZE(axp803_pek_resources), 850 850 .resources = axp803_pek_resources, 851 - } 851 + }, 852 + { .name = "axp20x-regulator" }, 852 853 }; 853 854 854 855 static struct mfd_cell axp806_cells[] = {
+4 -1
drivers/mfd/cros_ec.c
··· 147 147 } 148 148 149 149 if (IS_ENABLED(CONFIG_OF) && dev->of_node) { 150 - err = of_platform_populate(dev->of_node, NULL, NULL, dev); 150 + err = devm_of_platform_populate(dev); 151 151 if (err) { 152 152 mfd_remove_devices(dev); 153 153 dev_err(dev, "Failed to register sub-devices\n"); ··· 182 182 mfd_remove_devices(ec_dev->dev); 183 183 184 184 cros_ec_acpi_remove_gpe_handler(); 185 + 186 + if (ec_dev->irq) 187 + free_irq(ec_dev->irq, ec_dev); 185 188 186 189 return 0; 187 190 }
-12
drivers/mfd/da9062-core.c
··· 429 429 .range_min = DA9062AA_VLDO1_B, 430 430 .range_max = DA9062AA_VLDO4_B, 431 431 }, { 432 - .range_min = DA9062AA_BBAT_CONT, 433 - .range_max = DA9062AA_BBAT_CONT, 434 - }, { 435 432 .range_min = DA9062AA_INTERFACE, 436 433 .range_max = DA9062AA_CONFIG_E, 437 434 }, { ··· 510 513 }, { 511 514 .range_min = DA9062AA_VLDO1_B, 512 515 .range_max = DA9062AA_VLDO4_B, 513 - }, { 514 - .range_min = DA9062AA_BBAT_CONT, 515 - .range_max = DA9062AA_BBAT_CONT, 516 516 }, { 517 517 .range_min = DA9062AA_GP_ID_0, 518 518 .range_max = DA9062AA_GP_ID_19, ··· 645 651 .range_min = DA9062AA_VLDO1_B, 646 652 .range_max = DA9062AA_VLDO4_B, 647 653 }, { 648 - .range_min = DA9062AA_BBAT_CONT, 649 - .range_max = DA9062AA_BBAT_CONT, 650 - }, { 651 654 .range_min = DA9062AA_INTERFACE, 652 655 .range_max = DA9062AA_CONFIG_E, 653 656 }, { ··· 720 729 }, { 721 730 .range_min = DA9062AA_VLDO1_B, 722 731 .range_max = DA9062AA_VLDO4_B, 723 - }, { 724 - .range_min = DA9062AA_BBAT_CONT, 725 - .range_max = DA9062AA_BBAT_CONT, 726 732 }, { 727 733 .range_min = DA9062AA_GP_ID_0, 728 734 .range_max = DA9062AA_GP_ID_19,
+1 -1
drivers/mfd/exynos-lpass.c
··· 138 138 pm_runtime_enable(dev); 139 139 exynos_lpass_enable(lpass); 140 140 141 - return of_platform_populate(dev->of_node, NULL, NULL, dev); 141 + return devm_of_platform_populate(dev); 142 142 } 143 143 144 144 static int exynos_lpass_remove(struct platform_device *pdev)
+2 -5
drivers/mfd/fsl-imx25-tsadc.c
··· 59 59 return 0; 60 60 } 61 61 62 - static struct irq_domain_ops mx25_tsadc_domain_ops = { 62 + static const struct irq_domain_ops mx25_tsadc_domain_ops = { 63 63 .map = mx25_tsadc_domain_map, 64 64 .xlate = irq_domain_xlate_onecell, 65 65 }; ··· 129 129 static int mx25_tsadc_probe(struct platform_device *pdev) 130 130 { 131 131 struct device *dev = &pdev->dev; 132 - struct device_node *np = dev->of_node; 133 132 struct mx25_tsadc *tsadc; 134 133 struct resource *res; 135 134 int ret; ··· 177 178 178 179 platform_set_drvdata(pdev, tsadc); 179 180 180 - of_platform_populate(np, NULL, NULL, dev); 181 - 182 - return 0; 181 + return devm_of_platform_populate(dev); 183 182 } 184 183 185 184 static const struct of_device_id mx25_tsadc_ids[] = {
+24
drivers/mfd/intel-lpss-pci.c
··· 201 201 { PCI_VDEVICE(INTEL, 0x9d64), (kernel_ulong_t)&spt_i2c_info }, 202 202 { PCI_VDEVICE(INTEL, 0x9d65), (kernel_ulong_t)&spt_i2c_info }, 203 203 { PCI_VDEVICE(INTEL, 0x9d66), (kernel_ulong_t)&spt_uart_info }, 204 + /* CNL-LP */ 205 + { PCI_VDEVICE(INTEL, 0x9da8), (kernel_ulong_t)&spt_uart_info }, 206 + { PCI_VDEVICE(INTEL, 0x9da9), (kernel_ulong_t)&spt_uart_info }, 207 + { PCI_VDEVICE(INTEL, 0x9daa), (kernel_ulong_t)&spt_info }, 208 + { PCI_VDEVICE(INTEL, 0x9dab), (kernel_ulong_t)&spt_info }, 209 + { PCI_VDEVICE(INTEL, 0x9dfb), (kernel_ulong_t)&spt_info }, 210 + { PCI_VDEVICE(INTEL, 0x9dc5), (kernel_ulong_t)&spt_i2c_info }, 211 + { PCI_VDEVICE(INTEL, 0x9dc6), (kernel_ulong_t)&spt_i2c_info }, 212 + { PCI_VDEVICE(INTEL, 0x9dc7), (kernel_ulong_t)&spt_uart_info }, 213 + { PCI_VDEVICE(INTEL, 0x9de8), (kernel_ulong_t)&spt_i2c_info }, 214 + { PCI_VDEVICE(INTEL, 0x9de9), (kernel_ulong_t)&spt_i2c_info }, 215 + { PCI_VDEVICE(INTEL, 0x9dea), (kernel_ulong_t)&spt_i2c_info }, 216 + { PCI_VDEVICE(INTEL, 0x9deb), (kernel_ulong_t)&spt_i2c_info }, 204 217 /* SPT-H */ 205 218 { PCI_VDEVICE(INTEL, 0xa127), (kernel_ulong_t)&spt_uart_info }, 206 219 { PCI_VDEVICE(INTEL, 0xa128), (kernel_ulong_t)&spt_uart_info }, ··· 232 219 { PCI_VDEVICE(INTEL, 0xa2e2), (kernel_ulong_t)&spt_i2c_info }, 233 220 { PCI_VDEVICE(INTEL, 0xa2e3), (kernel_ulong_t)&spt_i2c_info }, 234 221 { PCI_VDEVICE(INTEL, 0xa2e6), (kernel_ulong_t)&spt_uart_info }, 222 + /* CNL-H */ 223 + { PCI_VDEVICE(INTEL, 0xa328), (kernel_ulong_t)&spt_uart_info }, 224 + { PCI_VDEVICE(INTEL, 0xa329), (kernel_ulong_t)&spt_uart_info }, 225 + { PCI_VDEVICE(INTEL, 0xa32a), (kernel_ulong_t)&spt_info }, 226 + { PCI_VDEVICE(INTEL, 0xa32b), (kernel_ulong_t)&spt_info }, 227 + { PCI_VDEVICE(INTEL, 0xa37b), (kernel_ulong_t)&spt_info }, 228 + { PCI_VDEVICE(INTEL, 0xa347), (kernel_ulong_t)&spt_uart_info }, 229 + { PCI_VDEVICE(INTEL, 0xa368), (kernel_ulong_t)&spt_i2c_info }, 230 + { PCI_VDEVICE(INTEL, 0xa369), (kernel_ulong_t)&spt_i2c_info }, 231 + { PCI_VDEVICE(INTEL, 0xa36a), (kernel_ulong_t)&spt_i2c_info }, 232 + { PCI_VDEVICE(INTEL, 0xa36b), (kernel_ulong_t)&spt_i2c_info }, 235 233 { } 236 234 }; 237 235 MODULE_DEVICE_TABLE(pci, intel_lpss_pci_ids);
+29 -20
drivers/mfd/intel_quark_i2c_gpio.c
··· 58 58 struct clk_lookup *i2c_clk_lookup; 59 59 }; 60 60 61 - struct i2c_mode_info { 62 - const char *name; 63 - unsigned int i2c_scl_freq; 64 - }; 65 - 66 - static const struct i2c_mode_info platform_i2c_mode_info[] = { 61 + static const struct dmi_system_id dmi_platform_info[] = { 67 62 { 68 - .name = "Galileo", 69 - .i2c_scl_freq = 100000, 63 + .matches = { 64 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Galileo"), 65 + }, 66 + .driver_data = (void *)100000, 70 67 }, 71 68 { 72 - .name = "GalileoGen2", 73 - .i2c_scl_freq = 400000, 69 + .matches = { 70 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"), 71 + }, 72 + .driver_data = (void *)400000, 73 + }, 74 + { 75 + .matches = { 76 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 77 + DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 78 + "6ES7647-0AA00-0YA2"), 79 + }, 80 + .driver_data = (void *)400000, 81 + }, 82 + { 83 + .matches = { 84 + DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), 85 + DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, 86 + "6ES7647-0AA00-1YA2"), 87 + }, 88 + .driver_data = (void *)400000, 74 89 }, 75 90 {} 76 91 }; ··· 175 160 176 161 static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell) 177 162 { 178 - const char *board_name = dmi_get_system_info(DMI_BOARD_NAME); 179 - const struct i2c_mode_info *info; 163 + const struct dmi_system_id *dmi_id; 180 164 struct dw_i2c_platform_data *pdata; 181 165 struct resource *res = (struct resource *)cell->resources; 182 166 struct device *dev = &pdev->dev; ··· 195 181 /* Normal mode by default */ 196 182 pdata->i2c_scl_freq = 100000; 197 183 198 - if (board_name) { 199 - for (info = platform_i2c_mode_info; info->name; info++) { 200 - if (!strcmp(board_name, info->name)) { 201 - pdata->i2c_scl_freq = info->i2c_scl_freq; 202 - break; 203 - } 204 - } 205 - } 184 + dmi_id = dmi_first_match(dmi_platform_info); 185 + if (dmi_id) 186 + pdata->i2c_scl_freq = (uintptr_t)dmi_id->driver_data; 206 187 207 188 cell->platform_data = pdata; 208 189 cell->pdata_size = sizeof(*pdata);
+158 -78
drivers/mfd/intel_soc_pmic_bxtwc.c
··· 82 82 BXTWC_PWRBTN_IRQ, 83 83 }; 84 84 85 - enum bxtwc_irqs_level2 { 86 - /* Level 2 */ 87 - BXTWC_THRM0_IRQ = 0, 88 - BXTWC_THRM1_IRQ, 89 - BXTWC_THRM2_IRQ, 90 - BXTWC_BCU_IRQ, 91 - BXTWC_ADC_IRQ, 92 - BXTWC_USBC_IRQ, 85 + enum bxtwc_irqs_bcu { 86 + BXTWC_BCU_IRQ = 0, 87 + }; 88 + 89 + enum bxtwc_irqs_adc { 90 + BXTWC_ADC_IRQ = 0, 91 + }; 92 + 93 + enum bxtwc_irqs_chgr { 94 + BXTWC_USBC_IRQ = 0, 93 95 BXTWC_CHGR0_IRQ, 94 96 BXTWC_CHGR1_IRQ, 95 - BXTWC_GPIO0_IRQ, 96 - BXTWC_GPIO1_IRQ, 97 - BXTWC_CRIT_IRQ, 98 - BXTWC_TMU_IRQ, 97 + }; 98 + 99 + enum bxtwc_irqs_tmu { 100 + BXTWC_TMU_IRQ = 0, 101 + }; 102 + 103 + enum bxtwc_irqs_crit { 104 + BXTWC_CRIT_IRQ = 0, 99 105 }; 100 106 101 107 static const struct regmap_irq bxtwc_regmap_irqs[] = { ··· 116 110 REGMAP_IRQ_REG(BXTWC_PWRBTN_IRQ, 1, 0x03), 117 111 }; 118 112 119 - static const struct regmap_irq bxtwc_regmap_irqs_level2[] = { 120 - REGMAP_IRQ_REG(BXTWC_THRM0_IRQ, 0, 0xff), 121 - REGMAP_IRQ_REG(BXTWC_THRM1_IRQ, 1, 0xbf), 122 - REGMAP_IRQ_REG(BXTWC_THRM2_IRQ, 2, 0xff), 123 - REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 3, 0x1f), 124 - REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 4, 0xff), 125 - REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 5, BIT(5)), 126 - REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 5, 0x1f), 127 - REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 6, 0x1f), 128 - REGMAP_IRQ_REG(BXTWC_GPIO0_IRQ, 7, 0xff), 129 - REGMAP_IRQ_REG(BXTWC_GPIO1_IRQ, 8, 0x3f), 130 - REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 9, 0x03), 113 + static const struct regmap_irq bxtwc_regmap_irqs_bcu[] = { 114 + REGMAP_IRQ_REG(BXTWC_BCU_IRQ, 0, 0x1f), 115 + }; 116 + 117 + static const struct regmap_irq bxtwc_regmap_irqs_adc[] = { 118 + REGMAP_IRQ_REG(BXTWC_ADC_IRQ, 0, 0xff), 119 + }; 120 + 121 + static const struct regmap_irq bxtwc_regmap_irqs_chgr[] = { 122 + REGMAP_IRQ_REG(BXTWC_USBC_IRQ, 0, BIT(5)), 123 + REGMAP_IRQ_REG(BXTWC_CHGR0_IRQ, 0, 0x1f), 124 + REGMAP_IRQ_REG(BXTWC_CHGR1_IRQ, 1, 0x1f), 131 125 }; 132 126 133 127 static const struct regmap_irq bxtwc_regmap_irqs_tmu[] = { 134 128 REGMAP_IRQ_REG(BXTWC_TMU_IRQ, 0, 0x06), 129 + }; 130 + 131 + static const struct regmap_irq bxtwc_regmap_irqs_crit[] = { 132 + REGMAP_IRQ_REG(BXTWC_CRIT_IRQ, 0, 0x03), 135 133 }; 136 134 137 135 static struct regmap_irq_chip bxtwc_regmap_irq_chip = { ··· 147 137 .num_regs = 2, 148 138 }; 149 139 150 - static struct regmap_irq_chip bxtwc_regmap_irq_chip_level2 = { 151 - .name = "bxtwc_irq_chip_level2", 152 - .status_base = BXTWC_THRM0IRQ, 153 - .mask_base = BXTWC_MTHRM0IRQ, 154 - .irqs = bxtwc_regmap_irqs_level2, 155 - .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_level2), 156 - .num_regs = 10, 157 - }; 158 - 159 140 static struct regmap_irq_chip bxtwc_regmap_irq_chip_tmu = { 160 141 .name = "bxtwc_irq_chip_tmu", 161 142 .status_base = BXTWC_TMUIRQ, ··· 156 155 .num_regs = 1, 157 156 }; 158 157 158 + static struct regmap_irq_chip bxtwc_regmap_irq_chip_bcu = { 159 + .name = "bxtwc_irq_chip_bcu", 160 + .status_base = BXTWC_BCUIRQ, 161 + .mask_base = BXTWC_MBCUIRQ, 162 + .irqs = bxtwc_regmap_irqs_bcu, 163 + .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_bcu), 164 + .num_regs = 1, 165 + }; 166 + 167 + static struct regmap_irq_chip bxtwc_regmap_irq_chip_adc = { 168 + .name = "bxtwc_irq_chip_adc", 169 + .status_base = BXTWC_ADCIRQ, 170 + .mask_base = BXTWC_MADCIRQ, 171 + .irqs = bxtwc_regmap_irqs_adc, 172 + .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_adc), 173 + .num_regs = 1, 174 + }; 175 + 176 + static struct regmap_irq_chip bxtwc_regmap_irq_chip_chgr = { 177 + .name = "bxtwc_irq_chip_chgr", 178 + .status_base = BXTWC_CHGR0IRQ, 179 + .mask_base = BXTWC_MCHGR0IRQ, 180 + .irqs = bxtwc_regmap_irqs_chgr, 181 + .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_chgr), 182 + .num_regs = 2, 183 + }; 184 + 185 + static struct regmap_irq_chip bxtwc_regmap_irq_chip_crit = { 186 + .name = "bxtwc_irq_chip_crit", 187 + .status_base = BXTWC_CRITIRQ, 188 + .mask_base = BXTWC_MCRITIRQ, 189 + .irqs = bxtwc_regmap_irqs_crit, 190 + .num_irqs = ARRAY_SIZE(bxtwc_regmap_irqs_crit), 191 + .num_regs = 1, 192 + }; 193 + 159 194 static struct resource gpio_resources[] = { 160 - DEFINE_RES_IRQ_NAMED(BXTWC_GPIO0_IRQ, "GPIO0"), 161 - DEFINE_RES_IRQ_NAMED(BXTWC_GPIO1_IRQ, "GPIO1"), 195 + DEFINE_RES_IRQ_NAMED(BXTWC_GPIO_LVL1_IRQ, "GPIO"), 162 196 }; 163 197 164 198 static struct resource adc_resources[] = { ··· 210 174 }; 211 175 212 176 static struct resource thermal_resources[] = { 213 - DEFINE_RES_IRQ(BXTWC_THRM0_IRQ), 214 - DEFINE_RES_IRQ(BXTWC_THRM1_IRQ), 215 - DEFINE_RES_IRQ(BXTWC_THRM2_IRQ), 177 + DEFINE_RES_IRQ(BXTWC_THRM_LVL1_IRQ), 216 178 }; 217 179 218 180 static struct resource bcu_resources[] = { ··· 401 367 .reg_read = regmap_ipc_byte_reg_read, 402 368 }; 403 369 370 + static int bxtwc_add_chained_irq_chip(struct intel_soc_pmic *pmic, 371 + struct regmap_irq_chip_data *pdata, 372 + int pirq, int irq_flags, 373 + const struct regmap_irq_chip *chip, 374 + struct regmap_irq_chip_data **data) 375 + { 376 + int irq; 377 + 378 + irq = regmap_irq_get_virq(pdata, pirq); 379 + if (irq < 0) { 380 + dev_err(pmic->dev, 381 + "Failed to get parent vIRQ(%d) for chip %s, ret:%d\n", 382 + pirq, chip->name, irq); 383 + return irq; 384 + } 385 + 386 + return devm_regmap_add_irq_chip(pmic->dev, pmic->regmap, irq, irq_flags, 387 + 0, chip, data); 388 + } 389 + 404 390 static int bxtwc_probe(struct platform_device *pdev) 405 391 { 406 392 int ret; ··· 463 409 return ret; 464 410 } 465 411 466 - ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, 467 - IRQF_ONESHOT | IRQF_SHARED, 468 - 0, &bxtwc_regmap_irq_chip, 469 - &pmic->irq_chip_data); 412 + ret = devm_regmap_add_irq_chip(&pdev->dev, pmic->regmap, pmic->irq, 413 + IRQF_ONESHOT | IRQF_SHARED, 414 + 0, &bxtwc_regmap_irq_chip, 415 + &pmic->irq_chip_data); 470 416 if (ret) { 471 417 dev_err(&pdev->dev, "Failed to add IRQ chip\n"); 472 418 return ret; 473 419 } 474 420 475 - ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, 476 - IRQF_ONESHOT | IRQF_SHARED, 477 - 0, &bxtwc_regmap_irq_chip_level2, 478 - &pmic->irq_chip_data_level2); 479 - if (ret) { 480 - dev_err(&pdev->dev, "Failed to add secondary IRQ chip\n"); 481 - goto err_irq_chip_level2; 482 - } 483 - 484 - ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, 485 - IRQF_ONESHOT | IRQF_SHARED, 486 - 0, &bxtwc_regmap_irq_chip_tmu, 487 - &pmic->irq_chip_data_tmu); 421 + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, 422 + BXTWC_TMU_LVL1_IRQ, 423 + IRQF_ONESHOT, 424 + &bxtwc_regmap_irq_chip_tmu, 425 + &pmic->irq_chip_data_tmu); 488 426 if (ret) { 489 427 dev_err(&pdev->dev, "Failed to add TMU IRQ chip\n"); 490 - goto err_irq_chip_tmu; 428 + return ret; 491 429 } 492 430 493 - ret = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, bxt_wc_dev, 494 - ARRAY_SIZE(bxt_wc_dev), NULL, 0, 495 - NULL); 431 + /* Add chained IRQ handler for BCU IRQs */ 432 + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, 433 + BXTWC_BCU_LVL1_IRQ, 434 + IRQF_ONESHOT, 435 + &bxtwc_regmap_irq_chip_bcu, 436 + &pmic->irq_chip_data_bcu); 437 + 438 + 439 + if (ret) { 440 + dev_err(&pdev->dev, "Failed to add BUC IRQ chip\n"); 441 + return ret; 442 + } 443 + 444 + /* Add chained IRQ handler for ADC IRQs */ 445 + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, 446 + BXTWC_ADC_LVL1_IRQ, 447 + IRQF_ONESHOT, 448 + &bxtwc_regmap_irq_chip_adc, 449 + &pmic->irq_chip_data_adc); 450 + 451 + 452 + if (ret) { 453 + dev_err(&pdev->dev, "Failed to add ADC IRQ chip\n"); 454 + return ret; 455 + } 456 + 457 + /* Add chained IRQ handler for CHGR IRQs */ 458 + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, 459 + BXTWC_CHGR_LVL1_IRQ, 460 + IRQF_ONESHOT, 461 + &bxtwc_regmap_irq_chip_chgr, 462 + &pmic->irq_chip_data_chgr); 463 + 464 + 465 + if (ret) { 466 + dev_err(&pdev->dev, "Failed to add CHGR IRQ chip\n"); 467 + return ret; 468 + } 469 + 470 + /* Add chained IRQ handler for CRIT IRQs */ 471 + ret = bxtwc_add_chained_irq_chip(pmic, pmic->irq_chip_data, 472 + BXTWC_CRIT_LVL1_IRQ, 473 + IRQF_ONESHOT, 474 + &bxtwc_regmap_irq_chip_crit, 475 + &pmic->irq_chip_data_crit); 476 + 477 + 478 + if (ret) { 479 + dev_err(&pdev->dev, "Failed to add CRIT IRQ chip\n"); 480 + return ret; 481 + } 482 + 483 + ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, bxt_wc_dev, 484 + ARRAY_SIZE(bxt_wc_dev), NULL, 0, NULL); 496 485 if (ret) { 497 486 dev_err(&pdev->dev, "Failed to add devices\n"); 498 - goto err_mfd; 487 + return ret; 499 488 } 500 489 501 490 ret = sysfs_create_group(&pdev->dev.kobj, &bxtwc_group); 502 491 if (ret) { 503 492 dev_err(&pdev->dev, "Failed to create sysfs group %d\n", ret); 504 - goto err_sysfs; 493 + return ret; 505 494 } 506 495 507 496 /* ··· 558 461 BXTWC_MIRQLVL1_MCHGR, 0); 559 462 560 463 return 0; 561 - 562 - err_sysfs: 563 - mfd_remove_devices(&pdev->dev); 564 - err_mfd: 565 - regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_tmu); 566 - err_irq_chip_tmu: 567 - regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_level2); 568 - err_irq_chip_level2: 569 - regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); 570 - 571 - return ret; 572 464 } 573 465 574 466 static int bxtwc_remove(struct platform_device *pdev) 575 467 { 576 - struct intel_soc_pmic *pmic = dev_get_drvdata(&pdev->dev); 577 - 578 468 sysfs_remove_group(&pdev->dev.kobj, &bxtwc_group); 579 - mfd_remove_devices(&pdev->dev); 580 - regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); 581 - regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_level2); 582 - regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data_tmu); 583 469 584 470 return 0; 585 471 }
+230
drivers/mfd/intel_soc_pmic_chtwc.c
··· 1 + /* 2 + * MFD core driver for Intel Cherrytrail Whiskey Cove PMIC 3 + * 4 + * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> 5 + * 6 + * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: 7 + * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + */ 13 + 14 + #include <linux/acpi.h> 15 + #include <linux/delay.h> 16 + #include <linux/err.h> 17 + #include <linux/i2c.h> 18 + #include <linux/interrupt.h> 19 + #include <linux/kernel.h> 20 + #include <linux/mfd/core.h> 21 + #include <linux/mfd/intel_soc_pmic.h> 22 + #include <linux/regmap.h> 23 + 24 + /* PMIC device registers */ 25 + #define REG_OFFSET_MASK GENMASK(7, 0) 26 + #define REG_ADDR_MASK GENMASK(15, 8) 27 + #define REG_ADDR_SHIFT 8 28 + 29 + #define CHT_WC_IRQLVL1 0x6e02 30 + #define CHT_WC_IRQLVL1_MASK 0x6e0e 31 + 32 + /* Whiskey Cove PMIC share same ACPI ID between different platforms */ 33 + #define CHT_WC_HRV 3 34 + 35 + /* Level 1 IRQs (level 2 IRQs are handled in the child device drivers) */ 36 + enum { 37 + CHT_WC_PWRSRC_IRQ = 0, 38 + CHT_WC_THRM_IRQ, 39 + CHT_WC_BCU_IRQ, 40 + CHT_WC_ADC_IRQ, 41 + CHT_WC_EXT_CHGR_IRQ, 42 + CHT_WC_GPIO_IRQ, 43 + /* There is no irq 6 */ 44 + CHT_WC_CRIT_IRQ = 7, 45 + }; 46 + 47 + static struct resource cht_wc_pwrsrc_resources[] = { 48 + DEFINE_RES_IRQ(CHT_WC_PWRSRC_IRQ), 49 + }; 50 + 51 + static struct resource cht_wc_ext_charger_resources[] = { 52 + DEFINE_RES_IRQ(CHT_WC_EXT_CHGR_IRQ), 53 + }; 54 + 55 + static struct mfd_cell cht_wc_dev[] = { 56 + { 57 + .name = "cht_wcove_pwrsrc", 58 + .num_resources = ARRAY_SIZE(cht_wc_pwrsrc_resources), 59 + .resources = cht_wc_pwrsrc_resources, 60 + }, { 61 + .name = "cht_wcove_ext_chgr", 62 + .num_resources = ARRAY_SIZE(cht_wc_ext_charger_resources), 63 + .resources = cht_wc_ext_charger_resources, 64 + }, 65 + { .name = "cht_wcove_region", }, 66 + }; 67 + 68 + /* 69 + * The CHT Whiskey Cove covers multiple I2C addresses, with a 1 Byte 70 + * register address space per I2C address, so we use 16 bit register 71 + * addresses where the high 8 bits contain the I2C client address. 72 + */ 73 + static int cht_wc_byte_reg_read(void *context, unsigned int reg, 74 + unsigned int *val) 75 + { 76 + struct i2c_client *client = context; 77 + int ret, orig_addr = client->addr; 78 + 79 + if (!(reg & REG_ADDR_MASK)) { 80 + dev_err(&client->dev, "Error I2C address not specified\n"); 81 + return -EINVAL; 82 + } 83 + 84 + client->addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT; 85 + ret = i2c_smbus_read_byte_data(client, reg & REG_OFFSET_MASK); 86 + client->addr = orig_addr; 87 + 88 + if (ret < 0) 89 + return ret; 90 + 91 + *val = ret; 92 + return 0; 93 + } 94 + 95 + static int cht_wc_byte_reg_write(void *context, unsigned int reg, 96 + unsigned int val) 97 + { 98 + struct i2c_client *client = context; 99 + int ret, orig_addr = client->addr; 100 + 101 + if (!(reg & REG_ADDR_MASK)) { 102 + dev_err(&client->dev, "Error I2C address not specified\n"); 103 + return -EINVAL; 104 + } 105 + 106 + client->addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT; 107 + ret = i2c_smbus_write_byte_data(client, reg & REG_OFFSET_MASK, val); 108 + client->addr = orig_addr; 109 + 110 + return ret; 111 + } 112 + 113 + static const struct regmap_config cht_wc_regmap_cfg = { 114 + .reg_bits = 16, 115 + .val_bits = 8, 116 + .reg_write = cht_wc_byte_reg_write, 117 + .reg_read = cht_wc_byte_reg_read, 118 + }; 119 + 120 + static const struct regmap_irq cht_wc_regmap_irqs[] = { 121 + REGMAP_IRQ_REG(CHT_WC_PWRSRC_IRQ, 0, BIT(CHT_WC_PWRSRC_IRQ)), 122 + REGMAP_IRQ_REG(CHT_WC_THRM_IRQ, 0, BIT(CHT_WC_THRM_IRQ)), 123 + REGMAP_IRQ_REG(CHT_WC_BCU_IRQ, 0, BIT(CHT_WC_BCU_IRQ)), 124 + REGMAP_IRQ_REG(CHT_WC_ADC_IRQ, 0, BIT(CHT_WC_ADC_IRQ)), 125 + REGMAP_IRQ_REG(CHT_WC_EXT_CHGR_IRQ, 0, BIT(CHT_WC_EXT_CHGR_IRQ)), 126 + REGMAP_IRQ_REG(CHT_WC_GPIO_IRQ, 0, BIT(CHT_WC_GPIO_IRQ)), 127 + REGMAP_IRQ_REG(CHT_WC_CRIT_IRQ, 0, BIT(CHT_WC_CRIT_IRQ)), 128 + }; 129 + 130 + static const struct regmap_irq_chip cht_wc_regmap_irq_chip = { 131 + .name = "cht_wc_irq_chip", 132 + .status_base = CHT_WC_IRQLVL1, 133 + .mask_base = CHT_WC_IRQLVL1_MASK, 134 + .irqs = cht_wc_regmap_irqs, 135 + .num_irqs = ARRAY_SIZE(cht_wc_regmap_irqs), 136 + .num_regs = 1, 137 + }; 138 + 139 + static int cht_wc_probe(struct i2c_client *client) 140 + { 141 + struct device *dev = &client->dev; 142 + struct intel_soc_pmic *pmic; 143 + acpi_status status; 144 + unsigned long long hrv; 145 + int ret; 146 + 147 + status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_HRV", NULL, &hrv); 148 + if (ACPI_FAILURE(status)) { 149 + dev_err(dev, "Failed to get PMIC hardware revision\n"); 150 + return -ENODEV; 151 + } 152 + if (hrv != CHT_WC_HRV) { 153 + dev_err(dev, "Invalid PMIC hardware revision: %llu\n", hrv); 154 + return -ENODEV; 155 + } 156 + if (client->irq < 0) { 157 + dev_err(dev, "Invalid IRQ\n"); 158 + return -EINVAL; 159 + } 160 + 161 + pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL); 162 + if (!pmic) 163 + return -ENOMEM; 164 + 165 + pmic->irq = client->irq; 166 + pmic->dev = dev; 167 + i2c_set_clientdata(client, pmic); 168 + 169 + pmic->regmap = devm_regmap_init(dev, NULL, client, &cht_wc_regmap_cfg); 170 + if (IS_ERR(pmic->regmap)) 171 + return PTR_ERR(pmic->regmap); 172 + 173 + ret = devm_regmap_add_irq_chip(dev, pmic->regmap, pmic->irq, 174 + IRQF_ONESHOT | IRQF_SHARED, 0, 175 + &cht_wc_regmap_irq_chip, 176 + &pmic->irq_chip_data); 177 + if (ret) 178 + return ret; 179 + 180 + return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, 181 + cht_wc_dev, ARRAY_SIZE(cht_wc_dev), NULL, 0, 182 + regmap_irq_get_domain(pmic->irq_chip_data)); 183 + } 184 + 185 + static void cht_wc_shutdown(struct i2c_client *client) 186 + { 187 + struct intel_soc_pmic *pmic = i2c_get_clientdata(client); 188 + 189 + disable_irq(pmic->irq); 190 + } 191 + 192 + static int __maybe_unused cht_wc_suspend(struct device *dev) 193 + { 194 + struct intel_soc_pmic *pmic = dev_get_drvdata(dev); 195 + 196 + disable_irq(pmic->irq); 197 + 198 + return 0; 199 + } 200 + 201 + static int __maybe_unused cht_wc_resume(struct device *dev) 202 + { 203 + struct intel_soc_pmic *pmic = dev_get_drvdata(dev); 204 + 205 + enable_irq(pmic->irq); 206 + 207 + return 0; 208 + } 209 + static SIMPLE_DEV_PM_OPS(cht_wc_pm_ops, cht_wc_suspend, cht_wc_resume); 210 + 211 + static const struct i2c_device_id cht_wc_i2c_id[] = { 212 + { } 213 + }; 214 + 215 + static const struct acpi_device_id cht_wc_acpi_ids[] = { 216 + { "INT34D3", }, 217 + { } 218 + }; 219 + 220 + static struct i2c_driver cht_wc_driver = { 221 + .driver = { 222 + .name = "CHT Whiskey Cove PMIC", 223 + .pm = &cht_wc_pm_ops, 224 + .acpi_match_table = cht_wc_acpi_ids, 225 + }, 226 + .probe_new = cht_wc_probe, 227 + .shutdown = cht_wc_shutdown, 228 + .id_table = cht_wc_i2c_id, 229 + }; 230 + builtin_i2c_driver(cht_wc_driver);
-5
drivers/mfd/ipaq-micro.c
··· 53 53 tx->buf[bp++] = checksum; 54 54 tx->len = bp; 55 55 tx->index = 0; 56 - print_hex_dump_debug("data: ", DUMP_PREFIX_OFFSET, 16, 1, 57 - tx->buf, tx->len, true); 58 56 59 57 /* Enable interrupt */ 60 58 val = readl(micro->base + UTCR3); ··· 279 281 dev_info(micro->dev, "RAM size: %u KiB\n", ipaq_micro_to_u16(dump+92)); 280 282 dev_info(micro->dev, "screen: %u x %u\n", 281 283 ipaq_micro_to_u16(dump+94), ipaq_micro_to_u16(dump+96)); 282 - print_hex_dump_debug("eeprom: ", DUMP_PREFIX_OFFSET, 16, 1, 283 - dump, 256, true); 284 - 285 284 } 286 285 287 286 static void micro_tx_chars(struct ipaq_micro *micro)
+100
drivers/mfd/lp87565.c
··· 1 + /* 2 + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ 3 + * 4 + * Author: Keerthy <j-keerthy@ti.com> 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License as 8 + * published by the Free Software Foundation version 2. 9 + */ 10 + 11 + #include <linux/interrupt.h> 12 + #include <linux/mfd/core.h> 13 + #include <linux/module.h> 14 + #include <linux/of_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include <linux/mfd/lp87565.h> 18 + 19 + static const struct regmap_config lp87565_regmap_config = { 20 + .reg_bits = 8, 21 + .val_bits = 8, 22 + .max_register = LP87565_REG_MAX, 23 + }; 24 + 25 + static const struct mfd_cell lp87565_cells[] = { 26 + { .name = "lp87565-q1-regulator", }, 27 + { .name = "lp87565-q1-gpio", }, 28 + }; 29 + 30 + static const struct of_device_id of_lp87565_match_table[] = { 31 + { .compatible = "ti,lp87565", }, 32 + { 33 + .compatible = "ti,lp87565-q1", 34 + .data = (void *)LP87565_DEVICE_TYPE_LP87565_Q1, 35 + }, 36 + {} 37 + }; 38 + MODULE_DEVICE_TABLE(of, of_lp87565_match_table); 39 + 40 + static int lp87565_probe(struct i2c_client *client, 41 + const struct i2c_device_id *ids) 42 + { 43 + struct lp87565 *lp87565; 44 + const struct of_device_id *of_id; 45 + int ret; 46 + unsigned int otpid; 47 + 48 + lp87565 = devm_kzalloc(&client->dev, sizeof(*lp87565), GFP_KERNEL); 49 + if (!lp87565) 50 + return -ENOMEM; 51 + 52 + lp87565->dev = &client->dev; 53 + 54 + lp87565->regmap = devm_regmap_init_i2c(client, &lp87565_regmap_config); 55 + if (IS_ERR(lp87565->regmap)) { 56 + ret = PTR_ERR(lp87565->regmap); 57 + dev_err(lp87565->dev, 58 + "Failed to initialize register map: %d\n", ret); 59 + return ret; 60 + } 61 + 62 + ret = regmap_read(lp87565->regmap, LP87565_REG_OTP_REV, &otpid); 63 + if (ret) { 64 + dev_err(lp87565->dev, "Failed to read OTP ID\n"); 65 + return ret; 66 + } 67 + 68 + lp87565->rev = otpid & LP87565_OTP_REV_OTP_ID; 69 + 70 + of_id = of_match_device(of_lp87565_match_table, &client->dev); 71 + if (of_id) 72 + lp87565->dev_type = (enum lp87565_device_type)of_id->data; 73 + 74 + i2c_set_clientdata(client, lp87565); 75 + 76 + ret = mfd_add_devices(lp87565->dev, PLATFORM_DEVID_AUTO, lp87565_cells, 77 + ARRAY_SIZE(lp87565_cells), NULL, 0, NULL); 78 + 79 + return ret; 80 + } 81 + 82 + static const struct i2c_device_id lp87565_id_table[] = { 83 + { "lp87565-q1", 0 }, 84 + { }, 85 + }; 86 + MODULE_DEVICE_TABLE(i2c, lp87565_id_table); 87 + 88 + static struct i2c_driver lp87565_driver = { 89 + .driver = { 90 + .name = "lp87565", 91 + .of_match_table = of_lp87565_match_table, 92 + }, 93 + .probe = lp87565_probe, 94 + .id_table = lp87565_id_table, 95 + }; 96 + module_i2c_driver(lp87565_driver); 97 + 98 + MODULE_AUTHOR("J Keerthy <j-keerthy@ti.com>"); 99 + MODULE_DESCRIPTION("lp87565 chip family Multi-Function Device driver"); 100 + MODULE_LICENSE("GPL v2");
+1 -12
drivers/mfd/motorola-cpcap.c
··· 260 260 if (ret) 261 261 return ret; 262 262 263 - return of_platform_populate(spi->dev.of_node, NULL, NULL, 264 - &cpcap->spi->dev); 265 - } 266 - 267 - static int cpcap_remove(struct spi_device *pdev) 268 - { 269 - struct cpcap_ddata *cpcap = spi_get_drvdata(pdev); 270 - 271 - of_platform_depopulate(&cpcap->spi->dev); 272 - 273 - return 0; 263 + return devm_of_platform_populate(&cpcap->spi->dev); 274 264 } 275 265 276 266 static struct spi_driver cpcap_driver = { ··· 269 279 .of_match_table = cpcap_of_match, 270 280 }, 271 281 .probe = cpcap_probe, 272 - .remove = cpcap_remove, 273 282 }; 274 283 module_spi_driver(cpcap_driver); 275 284
+1 -1
drivers/mfd/palmas.c
··· 676 676 * otherwise continue and add devices using mfd helpers. 677 677 */ 678 678 if (node) { 679 - ret = of_platform_populate(node, NULL, NULL, &i2c->dev); 679 + ret = devm_of_platform_populate(&i2c->dev); 680 680 if (ret < 0) { 681 681 goto err_irq; 682 682 } else if (pdata->pm_off && !pm_power_off) {
+1 -8
drivers/mfd/qcom-spmi-pmic.c
··· 120 120 121 121 static int pmic_spmi_probe(struct spmi_device *sdev) 122 122 { 123 - struct device_node *root = sdev->dev.of_node; 124 123 struct regmap *regmap; 125 124 126 125 regmap = devm_regmap_init_spmi_ext(sdev, &spmi_regmap_config); ··· 130 131 if (sdev->usid % 2 == 0) 131 132 pmic_spmi_show_revid(regmap, &sdev->dev); 132 133 133 - return of_platform_populate(root, NULL, NULL, &sdev->dev); 134 - } 135 - 136 - static void pmic_spmi_remove(struct spmi_device *sdev) 137 - { 138 - of_platform_depopulate(&sdev->dev); 134 + return devm_of_platform_populate(&sdev->dev); 139 135 } 140 136 141 137 MODULE_DEVICE_TABLE(of, pmic_spmi_id_table); 142 138 143 139 static struct spmi_driver pmic_spmi_driver = { 144 140 .probe = pmic_spmi_probe, 145 - .remove = pmic_spmi_remove, 146 141 .driver = { 147 142 .name = "pmic-spmi", 148 143 .of_match_table = pmic_spmi_id_table,
+2
drivers/mfd/rn5t618.c
··· 155 155 pm_power_off = NULL; 156 156 } 157 157 158 + unregister_restart_handler(&rn5t618_restart_handler); 159 + 158 160 return 0; 159 161 } 160 162
+15 -2
drivers/mfd/rtsx_pcr.c
··· 30 30 #include <linux/platform_device.h> 31 31 #include <linux/mfd/core.h> 32 32 #include <linux/mfd/rtsx_pci.h> 33 + #include <linux/mmc/card.h> 33 34 #include <asm/unaligned.h> 34 35 35 36 #include "rtsx_pcr.h" ··· 453 452 } 454 453 455 454 spin_lock_irqsave(&pcr->lock, flags); 456 - if (pcr->trans_result == TRANS_RESULT_FAIL) 457 - err = -EINVAL; 455 + if (pcr->trans_result == TRANS_RESULT_FAIL) { 456 + err = -EILSEQ; 457 + if (pcr->dma_error_count < RTS_MAX_TIMES_FREQ_REDUCTION) 458 + pcr->dma_error_count++; 459 + } 460 + 458 461 else if (pcr->trans_result == TRANS_NO_DEVICE) 459 462 err = -ENODEV; 460 463 spin_unlock_irqrestore(&pcr->lock, flags); ··· 663 658 SD_CLK_DIVIDE_MASK, clk_divider); 664 659 if (err < 0) 665 660 return err; 661 + 662 + /* Reduce card clock by 20MHz each time a DMA transfer error occurs */ 663 + if (card_clock == UHS_SDR104_MAX_DTR && 664 + pcr->dma_error_count && 665 + PCI_PID(pcr) == RTS5227_DEVICE_ID) 666 + card_clock = UHS_SDR104_MAX_DTR - 667 + (pcr->dma_error_count * 20000000); 666 668 667 669 card_clock /= 1000000; 668 670 pcr_dbg(pcr, "Switch card clock to %dMHz\n", card_clock); ··· 906 894 pcr->card_removed |= SD_EXIST; 907 895 pcr->card_inserted &= ~SD_EXIST; 908 896 } 897 + pcr->dma_error_count = 0; 909 898 } 910 899 911 900 if (int_reg & MS_INT) {
+1 -2
drivers/mfd/smsc-ece1099.c
··· 69 69 70 70 #ifdef CONFIG_OF 71 71 if (i2c->dev.of_node) 72 - ret = of_platform_populate(i2c->dev.of_node, 73 - NULL, NULL, &i2c->dev); 72 + ret = devm_of_platform_populate(&i2c->dev); 74 73 #endif 75 74 76 75 return ret;
+1 -9
drivers/mfd/stm32-timers.c
··· 58 58 59 59 platform_set_drvdata(pdev, ddata); 60 60 61 - return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); 62 - } 63 - 64 - static int stm32_timers_remove(struct platform_device *pdev) 65 - { 66 - of_platform_depopulate(&pdev->dev); 67 - 68 - return 0; 61 + return devm_of_platform_populate(&pdev->dev); 69 62 } 70 63 71 64 static const struct of_device_id stm32_timers_of_match[] = { ··· 69 76 70 77 static struct platform_driver stm32_timers_driver = { 71 78 .probe = stm32_timers_probe, 72 - .remove = stm32_timers_remove, 73 79 .driver = { 74 80 .name = "stm32-timers", 75 81 .of_match_table = stm32_timers_of_match,
+3 -1
drivers/mfd/tc6393xb.c
··· 797 797 int ret; 798 798 int i; 799 799 800 - clk_prepare_enable(tc6393xb->clk); 800 + ret = clk_prepare_enable(tc6393xb->clk); 801 + if (ret) 802 + return ret; 801 803 802 804 ret = tcpd->resume(dev); 803 805 if (ret)
+3 -1
drivers/mfd/twl4030-irq.c
··· 638 638 } 639 639 } 640 640 641 - if (status < 0) 641 + if (status < 0) { 642 + dev_err(dev, "module to setup SIH for not found\n"); 642 643 return status; 644 + } 643 645 644 646 agent = kzalloc(sizeof(*agent), GFP_KERNEL); 645 647 if (!agent)
+12 -14
drivers/mfd/wm831x-core.c
··· 1766 1766 } 1767 1767 wm831x->locked = 1; 1768 1768 1769 - if (pdata && pdata->pre_init) { 1769 + if (pdata->pre_init) { 1770 1770 ret = pdata->pre_init(wm831x); 1771 1771 if (ret != 0) { 1772 1772 dev_err(wm831x->dev, "pre_init() failed: %d\n", ret); ··· 1774 1774 } 1775 1775 } 1776 1776 1777 - if (pdata) { 1778 - for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) { 1779 - if (!pdata->gpio_defaults[i]) 1780 - continue; 1777 + for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) { 1778 + if (!pdata->gpio_defaults[i]) 1779 + continue; 1781 1780 1782 - wm831x_reg_write(wm831x, 1783 - WM831X_GPIO1_CONTROL + i, 1784 - pdata->gpio_defaults[i] & 0xffff); 1785 - } 1781 + wm831x_reg_write(wm831x, 1782 + WM831X_GPIO1_CONTROL + i, 1783 + pdata->gpio_defaults[i] & 0xffff); 1786 1784 } 1787 1785 1788 1786 /* Multiply by 10 as we have many subdevices of the same type */ 1789 - if (pdata && pdata->wm831x_num) 1787 + if (pdata->wm831x_num) 1790 1788 wm831x_num = pdata->wm831x_num * 10; 1791 1789 else 1792 1790 wm831x_num = -1; ··· 1807 1809 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1808 1810 wm8311_devs, ARRAY_SIZE(wm8311_devs), 1809 1811 NULL, 0, NULL); 1810 - if (!pdata || !pdata->disable_touch) 1812 + if (!pdata->disable_touch) 1811 1813 mfd_add_devices(wm831x->dev, wm831x_num, 1812 1814 touch_devs, ARRAY_SIZE(touch_devs), 1813 1815 NULL, 0, NULL); ··· 1817 1819 ret = mfd_add_devices(wm831x->dev, wm831x_num, 1818 1820 wm8312_devs, ARRAY_SIZE(wm8312_devs), 1819 1821 NULL, 0, NULL); 1820 - if (!pdata || !pdata->disable_touch) 1822 + if (!pdata->disable_touch) 1821 1823 mfd_add_devices(wm831x->dev, wm831x_num, 1822 1824 touch_devs, ARRAY_SIZE(touch_devs), 1823 1825 NULL, 0, NULL); ··· 1863 1865 dev_info(wm831x->dev, "32.768kHz clock disabled, no RTC\n"); 1864 1866 } 1865 1867 1866 - if (pdata && pdata->backlight) { 1868 + if (pdata->backlight) { 1867 1869 /* Treat errors as non-critical */ 1868 1870 ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs, 1869 1871 ARRAY_SIZE(backlight_devs), NULL, ··· 1875 1877 1876 1878 wm831x_otp_init(wm831x); 1877 1879 1878 - if (pdata && pdata->post_init) { 1880 + if (pdata->post_init) { 1879 1881 ret = pdata->post_init(wm831x); 1880 1882 if (ret != 0) { 1881 1883 dev_err(wm831x->dev, "post_init() failed: %d\n", ret);
+4
drivers/mfd/wm831x-i2c.c
··· 37 37 38 38 if (i2c->dev.of_node) { 39 39 of_id = of_match_device(wm831x_of_match, &i2c->dev); 40 + if (!of_id) { 41 + dev_err(&i2c->dev, "Failed to match device\n"); 42 + return -ENODEV; 43 + } 40 44 type = (enum wm831x_parent)of_id->data; 41 45 } else { 42 46 type = (enum wm831x_parent)id->driver_data;
+4
drivers/mfd/wm831x-spi.c
··· 34 34 35 35 if (spi->dev.of_node) { 36 36 of_id = of_match_device(wm831x_of_match, &spi->dev); 37 + if (!of_id) { 38 + dev_err(&spi->dev, "Failed to match device\n"); 39 + return -ENODEV; 40 + } 37 41 type = (enum wm831x_parent)of_id->data; 38 42 } else { 39 43 type = (enum wm831x_parent)id->driver_data;
-4
drivers/platform/x86/intel_bxtwc_tmu.c
··· 92 92 } 93 93 wctmu->irq = virq; 94 94 95 - /* Enable TMU interrupts */ 96 - regmap_update_bits(wctmu->regmap, BXTWC_MIRQLVL1, 97 - BXTWC_MIRQLVL1_MTMU, 0); 98 - 99 95 /* Unmask TMU second level Wake & System alarm */ 100 96 regmap_update_bits(wctmu->regmap, BXTWC_MTMUIRQ_REG, 101 97 BXTWC_TMU_ALRM_MASK, 0);
+1 -1
drivers/thermal/intel_bxt_pmic_thermal.c
··· 241 241 } 242 242 243 243 regmap = pmic->regmap; 244 - regmap_irq_chip = pmic->irq_chip_data_level2; 244 + regmap_irq_chip = pmic->irq_chip_data; 245 245 246 246 pmic_irq_count = 0; 247 247 while ((irq = platform_get_irq(pdev, pmic_irq_count)) != -ENXIO) {
+1 -1
drivers/usb/typec/typec_wcove.c
··· 303 303 wcove->dev = &pdev->dev; 304 304 wcove->regmap = pmic->regmap; 305 305 306 - ret = regmap_irq_get_virq(pmic->irq_chip_data_level2, 306 + ret = regmap_irq_get_virq(pmic->irq_chip_data_chgr, 307 307 platform_get_irq(pdev, 0)); 308 308 if (ret < 0) 309 309 return ret;
+4 -1
include/linux/mfd/intel_soc_pmic.h
··· 25 25 int irq; 26 26 struct regmap *regmap; 27 27 struct regmap_irq_chip_data *irq_chip_data; 28 - struct regmap_irq_chip_data *irq_chip_data_level2; 29 28 struct regmap_irq_chip_data *irq_chip_data_tmu; 29 + struct regmap_irq_chip_data *irq_chip_data_bcu; 30 + struct regmap_irq_chip_data *irq_chip_data_adc; 31 + struct regmap_irq_chip_data *irq_chip_data_chgr; 32 + struct regmap_irq_chip_data *irq_chip_data_crit; 30 33 struct device *dev; 31 34 }; 32 35
+270
include/linux/mfd/lp87565.h
··· 1 + /* 2 + * Functions to access LP87565 power management chip. 3 + * 4 + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License as 8 + * published by the Free Software Foundation version 2. 9 + */ 10 + 11 + #ifndef __LINUX_MFD_LP87565_H 12 + #define __LINUX_MFD_LP87565_H 13 + 14 + #include <linux/i2c.h> 15 + #include <linux/regulator/driver.h> 16 + #include <linux/regulator/machine.h> 17 + 18 + enum lp87565_device_type { 19 + LP87565_DEVICE_TYPE_UNKNOWN = 0, 20 + LP87565_DEVICE_TYPE_LP87565_Q1, 21 + }; 22 + 23 + /* All register addresses */ 24 + #define LP87565_REG_DEV_REV 0X00 25 + #define LP87565_REG_OTP_REV 0X01 26 + #define LP87565_REG_BUCK0_CTRL_1 0X02 27 + #define LP87565_REG_BUCK0_CTRL_2 0X03 28 + 29 + #define LP87565_REG_BUCK1_CTRL_1 0X04 30 + #define LP87565_REG_BUCK1_CTRL_2 0X05 31 + 32 + #define LP87565_REG_BUCK2_CTRL_1 0X06 33 + #define LP87565_REG_BUCK2_CTRL_2 0X07 34 + 35 + #define LP87565_REG_BUCK3_CTRL_1 0X08 36 + #define LP87565_REG_BUCK3_CTRL_2 0X09 37 + 38 + #define LP87565_REG_BUCK0_VOUT 0X0A 39 + #define LP87565_REG_BUCK0_FLOOR_VOUT 0X0B 40 + 41 + #define LP87565_REG_BUCK1_VOUT 0X0C 42 + #define LP87565_REG_BUCK1_FLOOR_VOUT 0X0D 43 + 44 + #define LP87565_REG_BUCK2_VOUT 0X0E 45 + #define LP87565_REG_BUCK2_FLOOR_VOUT 0X0F 46 + 47 + #define LP87565_REG_BUCK3_VOUT 0X10 48 + #define LP87565_REG_BUCK3_FLOOR_VOUT 0X11 49 + 50 + #define LP87565_REG_BUCK0_DELAY 0X12 51 + #define LP87565_REG_BUCK1_DELAY 0X13 52 + 53 + #define LP87565_REG_BUCK2_DELAY 0X14 54 + #define LP87565_REG_BUCK3_DELAY 0X15 55 + 56 + #define LP87565_REG_GPO2_DELAY 0X16 57 + #define LP87565_REG_GPO3_DELAY 0X17 58 + #define LP87565_REG_RESET 0X18 59 + #define LP87565_REG_CONFIG 0X19 60 + 61 + #define LP87565_REG_INT_TOP_1 0X1A 62 + #define LP87565_REG_INT_TOP_2 0X1B 63 + 64 + #define LP87565_REG_INT_BUCK_0_1 0X1C 65 + #define LP87565_REG_INT_BUCK_2_3 0X1D 66 + #define LP87565_REG_TOP_STAT 0X1E 67 + #define LP87565_REG_BUCK_0_1_STAT 0X1F 68 + #define LP87565_REG_BUCK_2_3_STAT 0x20 69 + 70 + #define LP87565_REG_TOP_MASK_1 0x21 71 + #define LP87565_REG_TOP_MASK_2 0x22 72 + 73 + #define LP87565_REG_BUCK_0_1_MASK 0x23 74 + #define LP87565_REG_BUCK_2_3_MASK 0x24 75 + #define LP87565_REG_SEL_I_LOAD 0x25 76 + 77 + #define LP87565_REG_I_LOAD_2 0x26 78 + #define LP87565_REG_I_LOAD_1 0x27 79 + 80 + #define LP87565_REG_PGOOD_CTRL1 0x28 81 + #define LP87565_REG_PGOOD_CTRL2 0x29 82 + #define LP87565_REG_PGOOD_FLT 0x2A 83 + #define LP87565_REG_PLL_CTRL 0x2B 84 + #define LP87565_REG_PIN_FUNCTION 0x2C 85 + #define LP87565_REG_GPIO_CONFIG 0x2D 86 + #define LP87565_REG_GPIO_IN 0x2E 87 + #define LP87565_REG_GPIO_OUT 0x2F 88 + 89 + #define LP87565_REG_MAX LP87565_REG_GPIO_OUT 90 + 91 + /* Register field definitions */ 92 + #define LP87565_DEV_REV_DEV_ID 0xC0 93 + #define LP87565_DEV_REV_ALL_LAYER 0x30 94 + #define LP87565_DEV_REV_METAL_LAYER 0x0F 95 + 96 + #define LP87565_OTP_REV_OTP_ID 0xFF 97 + 98 + #define LP87565_BUCK_CTRL_1_EN BIT(7) 99 + #define LP87565_BUCK_CTRL_1_EN_PIN_CTRL BIT(6) 100 + #define LP87565_BUCK_CTRL_1_PIN_SELECT_EN 0x30 101 + 102 + #define LP87565_BUCK_CTRL_1_ROOF_FLOOR_EN BIT(3) 103 + #define LP87565_BUCK_CTRL_1_RDIS_EN BIT(2) 104 + #define LP87565_BUCK_CTRL_1_FPWM BIT(1) 105 + /* Bit0 is reserved for BUCK1 and BUCK3 and valid only for BUCK0 and BUCK2 */ 106 + #define LP87565_BUCK_CTRL_1_FPWM_MP_0_2 BIT(0) 107 + 108 + #define LP87565_BUCK_CTRL_2_ILIM 0x38 109 + #define LP87565_BUCK_CTRL_2_SLEW_RATE 0x07 110 + 111 + #define LP87565_BUCK_VSET 0xFF 112 + #define LP87565_BUCK_FLOOR_VSET 0xFF 113 + 114 + #define LP87565_BUCK_SHUTDOWN_DELAY 0xF0 115 + #define LP87565_BUCK_STARTUP_DELAY 0x0F 116 + 117 + #define LP87565_GPIO_SHUTDOWN_DELAY 0xF0 118 + #define LP87565_GPIO_STARTUP_DELAY 0x0F 119 + 120 + #define LP87565_RESET_SW_RESET BIT(0) 121 + 122 + #define LP87565_CONFIG_DOUBLE_DELAY BIT(7) 123 + #define LP87565_CONFIG_CLKIN_PD BIT(6) 124 + #define LP87565_CONFIG_EN4_PD BIT(5) 125 + #define LP87565_CONFIG_EN3_PD BIT(4) 126 + #define LP87565_CONFIG_TDIE_WARN_LEVEL BIT(3) 127 + #define LP87565_CONFIG_EN2_PD BIT(2) 128 + #define LP87565_CONFIG_EN1_PD BIT(1) 129 + 130 + #define LP87565_INT_GPIO BIT(7) 131 + #define LP87565_INT_BUCK23 BIT(6) 132 + #define LP87565_INT_BUCK01 BIT(5) 133 + #define LP87565_NO_SYNC_CLK BIT(4) 134 + #define LP87565_TDIE_SD BIT(3) 135 + #define LP87565_TDIE_WARN BIT(2) 136 + #define LP87565_INT_OVP BIT(1) 137 + #define LP87565_I_LOAD_READY BIT(0) 138 + 139 + #define LP87565_INT_TOP2_RESET_REG BIT(0) 140 + 141 + #define LP87565_BUCK1_PG_INT BIT(6) 142 + #define LP87565_BUCK1_SC_INT BIT(5) 143 + #define LP87565_BUCK1_ILIM_INT BIT(4) 144 + #define LP87565_BUCK0_PG_INT BIT(2) 145 + #define LP87565_BUCK0_SC_INT BIT(1) 146 + #define LP87565_BUCK0_ILIM_INT BIT(0) 147 + 148 + #define LP87565_BUCK3_PG_INT BIT(6) 149 + #define LP87565_BUCK3_SC_INT BIT(5) 150 + #define LP87565_BUCK3_ILIM_INT BIT(4) 151 + #define LP87565_BUCK2_PG_INT BIT(2) 152 + #define LP87565_BUCK2_SC_INT BIT(1) 153 + #define LP87565_BUCK2_ILIM_INT BIT(0) 154 + 155 + #define LP87565_SYNC_CLK_STAT BIT(4) 156 + #define LP87565_TDIE_SD_STAT BIT(3) 157 + #define LP87565_TDIE_WARN_STAT BIT(2) 158 + #define LP87565_OVP_STAT BIT(1) 159 + 160 + #define LP87565_BUCK1_STAT BIT(7) 161 + #define LP87565_BUCK1_PG_STAT BIT(6) 162 + #define LP87565_BUCK1_ILIM_STAT BIT(4) 163 + #define LP87565_BUCK0_STAT BIT(3) 164 + #define LP87565_BUCK0_PG_STAT BIT(2) 165 + #define LP87565_BUCK0_ILIM_STAT BIT(0) 166 + 167 + #define LP87565_BUCK3_STAT BIT(7) 168 + #define LP87565_BUCK3_PG_STAT BIT(6) 169 + #define LP87565_BUCK3_ILIM_STAT BIT(4) 170 + #define LP87565_BUCK2_STAT BIT(3) 171 + #define LP87565_BUCK2_PG_STAT BIT(2) 172 + #define LP87565_BUCK2_ILIM_STAT BIT(0) 173 + 174 + #define LPL87565_GPIO_MASK BIT(7) 175 + #define LPL87565_SYNC_CLK_MASK BIT(4) 176 + #define LPL87565_TDIE_WARN_MASK BIT(2) 177 + #define LPL87565_I_LOAD_READY_MASK BIT(0) 178 + 179 + #define LPL87565_RESET_REG_MASK BIT(0) 180 + 181 + #define LPL87565_BUCK1_PG_MASK BIT(6) 182 + #define LPL87565_BUCK1_ILIM_MASK BIT(4) 183 + #define LPL87565_BUCK0_PG_MASK BIT(2) 184 + #define LPL87565_BUCK0_ILIM_MASK BIT(0) 185 + 186 + #define LPL87565_BUCK3_PG_MASK BIT(6) 187 + #define LPL87565_BUCK3_ILIM_MASK BIT(4) 188 + #define LPL87565_BUCK2_PG_MASK BIT(2) 189 + #define LPL87565_BUCK2_ILIM_MASK BIT(0) 190 + 191 + #define LP87565_LOAD_CURRENT_BUCK_SELECT 0x3 192 + 193 + #define LP87565_I_LOAD2_BUCK_LOAD_CURRENT 0x3 194 + #define LP87565_I_LOAD1_BUCK_LOAD_CURRENT 0xFF 195 + 196 + #define LP87565_PG3_SEL 0xC0 197 + #define LP87565_PG2_SEL 0x30 198 + #define LP87565_PG1_SEL 0x0C 199 + #define LP87565_PG0_SEL 0x03 200 + 201 + #define LP87565_HALF_DAY BIT(7) 202 + #define LP87565_EN_PG0_NINT BIT(6) 203 + #define LP87565_PGOOD_SET_DELAY BIT(5) 204 + #define LP87565_EN_PGFLT_STAT BIT(4) 205 + #define LP87565_PGOOD_WINDOW BIT(2) 206 + #define LP87565_PGOOD_OD BIT(1) 207 + #define LP87565_PGOOD_POL BIT(0) 208 + 209 + #define LP87565_PG3_FLT BIT(3) 210 + #define LP87565_PG2_FLT BIT(2) 211 + #define LP87565_PG1_FLT BIT(1) 212 + #define LP87565_PG0_FLT BIT(0) 213 + 214 + #define LP87565_PLL_MODE 0xC0 215 + #define LP87565_EXT_CLK_FREQ 0x1F 216 + 217 + #define LP87565_EN_SPREAD_SPEC BIT(7) 218 + #define LP87565_EN_PIN_CTRL_GPIO3 BIT(6) 219 + #define LP87565_EN_PIN_SELECT_GPIO3 BIT(5) 220 + #define LP87565_EN_PIN_CTRL_GPIO2 BIT(4) 221 + #define LP87565_EN_PIN_SELECT_GPIO2 BIT(3) 222 + #define LP87565_GPIO3_SEL BIT(2) 223 + #define LP87565_GPIO2_SEL BIT(1) 224 + #define LP87565_GPIO1_SEL BIT(0) 225 + 226 + #define LP87565_GOIO3_OD BIT(6) 227 + #define LP87565_GOIO2_OD BIT(5) 228 + #define LP87565_GOIO1_OD BIT(4) 229 + #define LP87565_GOIO3_DIR BIT(2) 230 + #define LP87565_GOIO2_DIR BIT(1) 231 + #define LP87565_GOIO1_DIR BIT(0) 232 + 233 + #define LP87565_GOIO3_IN BIT(2) 234 + #define LP87565_GOIO2_IN BIT(1) 235 + #define LP87565_GOIO1_IN BIT(0) 236 + 237 + #define LP87565_GOIO3_OUT BIT(2) 238 + #define LP87565_GOIO2_OUT BIT(1) 239 + #define LP87565_GOIO1_OUT BIT(0) 240 + 241 + /* Number of step-down converters available */ 242 + #define LP87565_NUM_BUCK 6 243 + 244 + enum LP87565_regulator_id { 245 + /* BUCK's */ 246 + LP87565_BUCK_0, 247 + LP87565_BUCK_1, 248 + LP87565_BUCK_2, 249 + LP87565_BUCK_3, 250 + LP87565_BUCK_10, 251 + LP87565_BUCK_23, 252 + }; 253 + 254 + /** 255 + * struct LP87565 - state holder for the LP87565 driver 256 + * @dev: struct device pointer for MFD device 257 + * @rev: revision of the LP87565 258 + * @dev_type: The device type for example lp87565-q1 259 + * @lock: lock guarding the data structure 260 + * @regmap: register map of the LP87565 PMIC 261 + * 262 + * Device data may be used to access the LP87565 chip 263 + */ 264 + struct lp87565 { 265 + struct device *dev; 266 + u8 rev; 267 + u8 dev_type; 268 + struct regmap *regmap; 269 + }; 270 + #endif /* __LINUX_MFD_LP87565_H */
+5
include/linux/mfd/rtsx_pci.h
··· 850 850 851 851 #define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) 852 852 853 + #define RTS5227_DEVICE_ID 0x5227 854 + #define RTS_MAX_TIMES_FREQ_REDUCTION 8 855 + 853 856 struct rtsx_pcr; 854 857 855 858 struct pcr_handle { ··· 960 957 961 958 int num_slots; 962 959 struct rtsx_slot *slots; 960 + 961 + u8 dma_error_count; 963 962 }; 964 963 965 964 #define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))