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

ACPI / PMIC: Add Cherry Trail Crystal Cove PMIC OpRegion driver

We have no docs for the CHT Crystal Cove PMIC. The Asus Zenfone-2 kernel
code has 2 Crystal Cove regulator drivers, one calls the PMIC a "Crystal
Cove Plus" PMIC and talks about Cherry Trail, so presuambly that one
could be used to get register info for the regulators if we need to
implement regulator support in the future.

For now the sole purpose of this driver is to make
intel_soc_pmic_exec_mipi_pmic_seq_element work on devices with a
CHT Crystal Cove PMIC.

Specifically this fixes the following MIPI PMIC sequence related errors
on e.g. an Asus T100HA:

[ 178.211801] intel_soc_pmic_exec_mipi_pmic_seq_element: No PMIC registered
[ 178.211897] [drm:intel_dsi_dcs_init_backlight_funcs [i915]] *ERROR* mipi_exec_pmic failed, error: -6

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Hans de Goede and committed by
Rafael J. Wysocki
cefe6aac ed852cde

+52
+7
drivers/acpi/Kconfig
··· 520 520 This config adds ACPI operation region support for the Bay Trail 521 521 version of the Crystal Cove PMIC. 522 522 523 + config CHTCRC_PMIC_OPREGION 524 + bool "ACPI operation region support for Cherry Trail Crystal Cove PMIC" 525 + depends on INTEL_SOC_PMIC 526 + help 527 + This config adds ACPI operation region support for the Cherry Trail 528 + version of the Crystal Cove PMIC. 529 + 523 530 config XPOWER_PMIC_OPREGION 524 531 bool "ACPI operation region support for XPower AXP288 PMIC" 525 532 depends on MFD_AXP20X_I2C && IOSF_MBI=y
+1
drivers/acpi/Makefile
··· 110 110 111 111 obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o 112 112 obj-$(CONFIG_BYTCRC_PMIC_OPREGION) += pmic/intel_pmic_bytcrc.o 113 + obj-$(CONFIG_CHTCRC_PMIC_OPREGION) += pmic/intel_pmic_chtcrc.o 113 114 obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o 114 115 obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += pmic/intel_pmic_bxtwc.o 115 116 obj-$(CONFIG_CHT_WC_PMIC_OPREGION) += pmic/intel_pmic_chtwc.o
+44
drivers/acpi/pmic/intel_pmic_chtcrc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Intel Cherry Trail Crystal Cove PMIC operation region driver 4 + * 5 + * Copyright (C) 2019 Hans de Goede <hdegoede@redhat.com> 6 + */ 7 + 8 + #include <linux/acpi.h> 9 + #include <linux/init.h> 10 + #include <linux/mfd/intel_soc_pmic.h> 11 + #include <linux/platform_device.h> 12 + #include <linux/regmap.h> 13 + #include "intel_pmic.h" 14 + 15 + /* 16 + * We have no docs for the CHT Crystal Cove PMIC. The Asus Zenfone-2 kernel 17 + * code has 2 Crystal Cove regulator drivers, one calls the PMIC a "Crystal 18 + * Cove Plus" PMIC and talks about Cherry Trail, so presuambly that one 19 + * could be used to get register info for the regulators if we need to 20 + * implement regulator support in the future. 21 + * 22 + * For now the sole purpose of this driver is to make 23 + * intel_soc_pmic_exec_mipi_pmic_seq_element work on devices with a 24 + * CHT Crystal Cove PMIC. 25 + */ 26 + static struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = { 27 + .pmic_i2c_address = 0x6e, 28 + }; 29 + 30 + static int intel_chtcrc_pmic_opregion_probe(struct platform_device *pdev) 31 + { 32 + struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent); 33 + return intel_pmic_install_opregion_handler(&pdev->dev, 34 + ACPI_HANDLE(pdev->dev.parent), pmic->regmap, 35 + &intel_chtcrc_pmic_opregion_data); 36 + } 37 + 38 + static struct platform_driver intel_chtcrc_pmic_opregion_driver = { 39 + .probe = intel_chtcrc_pmic_opregion_probe, 40 + .driver = { 41 + .name = "cht_crystal_cove_pmic", 42 + }, 43 + }; 44 + builtin_platform_driver(intel_chtcrc_pmic_opregion_driver);