diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-25 13:56:18 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-03-25 13:56:18 -0700 |
commit | 8350e8331b3971533d6e6112ab596eda2c2ffffd (patch) | |
tree | 1add05c103644650616f17f1ae90ae2fc91482ee /drivers/mfd/arizona-spi.c | |
parent | e35a4a4e13c35f500a8d38e836b5e335c7515494 (diff) | |
parent | d99460ed5cdcc28feba6b992630b04650e410902 (diff) |
Merge tag 'mfd-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones:
"New Drivers:
- Add support for Maxim MAX77714 PMIC
Removed Drivers:
- Remove support for ST-Ericsson AB8500 DebugFS
New Device Support:
- Add support for Silergy SY7636A to Simple MFD I2C
- Add support for MediaTek MT6366 PMIC to MT6358 IRQ
- Add support for Charger to Intel PMIC CRC
- Add support for Raptor Lake to Intel LPSS PCI
New Functionality:
- Add support for Reboot to Rockchip RK808
Fix-ups:
- Device Tree changes (includcing YAML conversion) for
silergy,sy7636a, maxim,max77843, google,cros-ec, maxim,max14577,
maxim,max77802, maxim,max77714, qcom,tcsr, qcom,spmi-pmic,
stericsson,ab8500, stericsson,db8500-prcmu,
samsung,exynos5433-lpass, mt6397, syscon, brcm,cru
- Visible to menuconfig; simple-mfd-i2c
- Clean-up or clarify code; max77686, intel_soc_pmic_crc
- Improve error handling; mc13xxx-core, stmfx, asic3
- Pass device information to child devices; iqs62x, intel-lpss-acpi
- Individually identify IRQ domains; intel_soc_pmic_core
- Remove superfluous code; dbx500-prcmu, exynos-lpass
- Staticify and constify; arizona-i2c
- Mark sometimes used data as __maybe_unused; atmel-flexcom
- Account for different ACPI tables on AOSP/Windows platforms; arizona-spi
- Use provided (platform) APIs; ab8500-core
- Trivial (whitespace, spelling); rohm-bd9576"
* tag 'mfd-next-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (50 commits)
dt-bindings: mfd: syscon: Add microchip,lan966x-cpu-syscon compatible
mfd: bd9576: fix typos in comments
mfd: Use platform_get_irq() to get the interrupt
mfd: db8500-prcmu: Remove unused inline function
mfd: arizona-spi: Add Android board ACPI table handling
mfd: arizona-spi: Split Windows ACPI init code into its own function
mfd: asic3: Add missing iounmap() on error asic3_mfd_probe
MAINTAINERS: Rectify entry for ROHM MULTIFUNCTION BD9571MWV-M PMIC DEVICE DRIVERS
mfd: intel-lpss: Provide an SSP type to the driver
dt-bindings: mfd: brcm,cru: Rename pinctrl node
dt-bindings: Add compatibles for undocumented trivial syscons
mfd: atmel-flexcom: Fix compilation warning
dt-bindings: mfd: Add compatible for the MediaTek MT6366 PMIC
dt-bindings: mfd: samsung,exynos5433-lpass: Convert to dtschema
mfd: exynos-lpass: Drop unneeded syscon.h include
mfd: intel-lpss: Add Intel Raptor Lake PCH-S PCI IDs
mfd: ab8500: Drop debugfs module
mfd: sta2x11: Use GFP_KERNEL instead of GFP_ATOMIC
mfd: ab8500: Rewrite bindings in YAML
mfd: qcom-spmi-pmic: Add pm8953 compatible
...
Diffstat (limited to 'drivers/mfd/arizona-spi.c')
-rw-r--r-- | drivers/mfd/arizona-spi.c | 87 |
1 files changed, 66 insertions, 21 deletions
diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c index 03620c8efe34..941b0267d09d 100644 --- a/drivers/mfd/arizona-spi.c +++ b/drivers/mfd/arizona-spi.c @@ -43,31 +43,13 @@ static const struct gpiod_lookup arizona_soc_gpios[] = { { "arizona", 4, "wlf,micd-pol", 0, GPIO_ACTIVE_LOW }, }; -/* - * The AOSP 3.5 mm Headset: Accessory Specification gives the following values: - * Function A Play/Pause: 0 ohm - * Function D Voice assistant: 135 ohm - * Function B Volume Up 240 ohm - * Function C Volume Down 470 ohm - * Minimum Mic DC resistance 1000 ohm - * Minimum Ear speaker impedance 16 ohm - * Note the first max value below must be less then the min. speaker impedance, - * to allow CTIA/OMTP detection to work. The other max values are the closest - * value from extcon-arizona.c:arizona_micd_levels halfway 2 button resistances. - */ -static const struct arizona_micd_range arizona_micd_aosp_ranges[] = { - { .max = 11, .key = KEY_PLAYPAUSE }, - { .max = 186, .key = KEY_VOICECOMMAND }, - { .max = 348, .key = KEY_VOLUMEUP }, - { .max = 752, .key = KEY_VOLUMEDOWN }, -}; - static void arizona_spi_acpi_remove_lookup(void *lookup) { gpiod_remove_lookup_table(lookup); } -static int arizona_spi_acpi_probe(struct arizona *arizona) +/* For ACPI tables from boards which ship with Windows as factory OS */ +static int arizona_spi_acpi_windows_probe(struct arizona *arizona) { struct gpiod_lookup_table *lookup; acpi_status status; @@ -96,6 +78,65 @@ static int arizona_spi_acpi_probe(struct arizona *arizona) if (ACPI_FAILURE(status)) dev_warn(arizona->dev, "Failed to enable 32KHz clk ACPI error %d\n", status); + return 0; +} + +/* For ACPI tables from boards which ship with Android as factory OS */ +static int arizona_spi_acpi_android_probe(struct arizona *arizona) +{ + int ret; + + /* + * Get the reset GPIO, treating -ENOENT as -EPROBE_DEFER to wait for + * the x86-android-tablets module to register the board specific GPIO + * lookup table. + */ + arizona->pdata.reset = devm_gpiod_get(arizona->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(arizona->pdata.reset)) { + ret = PTR_ERR(arizona->pdata.reset); + if (ret == -ENOENT) { + dev_info_once(arizona->dev, + "Deferring probe till GPIO lookup is registered\n"); + ret = -EPROBE_DEFER; + } + return dev_err_probe(arizona->dev, ret, "getting reset GPIO\n"); + } + + return 0; +} + +/* + * The AOSP 3.5 mm Headset: Accessory Specification gives the following values: + * Function A Play/Pause: 0 ohm + * Function D Voice assistant: 135 ohm + * Function B Volume Up 240 ohm + * Function C Volume Down 470 ohm + * Minimum Mic DC resistance 1000 ohm + * Minimum Ear speaker impedance 16 ohm + * Note the first max value below must be less then the min. speaker impedance, + * to allow CTIA/OMTP detection to work. The other max values are the closest + * value from extcon-arizona.c:arizona_micd_levels halfway 2 button resistances. + */ +static const struct arizona_micd_range arizona_micd_aosp_ranges[] = { + { .max = 11, .key = KEY_PLAYPAUSE }, + { .max = 186, .key = KEY_VOICECOMMAND }, + { .max = 348, .key = KEY_VOLUMEUP }, + { .max = 752, .key = KEY_VOLUMEDOWN }, +}; + +static int arizona_spi_acpi_probe(struct arizona *arizona) +{ + struct acpi_device *adev = ACPI_COMPANION(arizona->dev); + int ret; + + if (acpi_dev_hid_uid_match(adev, "10WM5102", NULL)) + ret = arizona_spi_acpi_android_probe(arizona); + else + ret = arizona_spi_acpi_windows_probe(arizona); + + if (ret) + return ret; + /* * Some DSDTs wrongly declare the IRQ trigger-type as IRQF_TRIGGER_FALLING * The IRQ line will stay low when a new IRQ event happens between reading @@ -130,6 +171,10 @@ static const struct acpi_device_id arizona_acpi_match[] = { .id = "WM510205", .driver_data = WM5102, }, + { + .id = "10WM5102", + .driver_data = WM5102, + }, { } }; MODULE_DEVICE_TABLE(acpi, arizona_acpi_match); @@ -224,7 +269,7 @@ static const struct spi_device_id arizona_spi_ids[] = { MODULE_DEVICE_TABLE(spi, arizona_spi_ids); #ifdef CONFIG_OF -const struct of_device_id arizona_spi_of_match[] = { +static const struct of_device_id arizona_spi_of_match[] = { { .compatible = "wlf,wm5102", .data = (void *)WM5102 }, { .compatible = "wlf,wm5110", .data = (void *)WM5110 }, { .compatible = "wlf,wm8280", .data = (void *)WM8280 }, |