Commit graph

15 commits

Author SHA1 Message Date
Hans de Goede 72ebe5a0b3 ACPI / PMIC: xpower: Add support for the GPI1 regulator to the OpRegion handler
Some Bay Trail devices use a GPI1 regulator field (address 0x4c) in
their 0x8d power OpRegion, add support for this.

This fixes AE_BAD_PARAMETER errors getting thrown on these devices and
fixes these errors causing these devices to not suspend.

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>
2017-06-22 02:15:05 +02:00
Hans de Goede 2bde7c32b1 ACPI / PMIC: xpower: Fix power_table addresses
The power table addresses should be contiguous, but there was a hole
where 0x34 was missing. On most devices this is not a problem as
addresses above 0x34 are used for the BUC# convertors which are not
used in the DSDTs I've access to but after the BUC# convertors
there is a field named GPI1 in the DSTDs, which does get used in some
cases and ended up turning BUC6 on and off due to the wrong addresses,
resulting in turning the entire device off (or causing it to reboot).

Removing the hole in the addresses fixes this, fixing one of my
Bay Trail tablets turning off while booting the mainline kernel.

While at it add comments with the field names used in the DSDTs to
make it easier to compare the register and bits used at each address
with the datasheet.

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>
2017-04-28 23:32:44 +02:00
Hans de Goede 2e5a7f7109 ACPI / PMIC: Stop xpower OPRegion handler relying on IIO
The intel_pmic_xpower code provides an OPRegion handler, which must be
available before other drivers using it are loaded, which can only be
ensured if both the mfd and opregion drivers are built in, which is why
the Kconfig option for intel_pmic_xpower is a bool.

The use of IIO is causing trouble for generic distro configs here as
distros will typically want to build IIO drivers as modules and there
really is no reason to use IIO here. The reading of the ADC value is a
single regmap_bulk_read, which is already protected against races by
the regmap-lock.

This commit removes the use of IIO, allowing distros to enable the
driver without needing to built IIO in and also actually simplifies
the code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-04-20 12:43:43 +02:00
Hans de Goede ac2c4936e9 ACPI / PMIC: Add opregion driver for Intel CHT Whiskey Cove PMIC
Add opregion driver for Intel CHT Whiskey Cove PMIC, based on various
non upstreamed CHT Whiskey Cove PMIC patches. This does not include
support for the Thermal opregion (DPTF) due to lacking documentation.

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>
2017-04-20 12:43:41 +02:00
Paul Gortmaker 6d3ef8d8f9 ACPI / PMIC: remove modular references from non-modular code
The Kconfig currently controlling compilation of these files are:

drivers/acpi/Kconfig:menuconfig PMIC_OPREGION
drivers/acpi/Kconfig:   bool "PMIC (Power Management Integrated Circuit) operation region support"

drivers/acpi/Kconfig:config BXT_WC_PMIC_OPREGION
drivers/acpi/Kconfig:   bool "ACPI operation region support for BXT WhiskeyCove PMIC"

drivers/acpi/Kconfig:config XPOWER_PMIC_OPREGION
drivers/acpi/Kconfig:   bool "ACPI operation region support for XPower AXP288 PMIC"

...meaning they currently are not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the code there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

One file was using module_init.  Since module_init translates to
device_initcall in the non-modular case, the init ordering remains
unchanged with this commit.

In one case we replace the module.h with export.h since that file
is exporting some symbols, but does not use __init.  The other two
are using __init and so module.h gets replaced with init.h there.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-07-16 03:03:14 +02:00
Felipe Balbi 730de199b3 ACPI / PMIC: intel: initialize result to 0
Fixes compiler warning.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-06-27 15:24:09 +02:00
Felipe Balbi 0afa877a56 ACPI / PMIC: intel: add REGS operation region support
At least some of the Broxtons have a third custom OpRegion
named REGS. This adds handling for it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-06-27 15:24:05 +02:00
Bin Gao 9b928c78bb ACPI / PMIC: Add opregion driver for Intel BXT WhiskeyCove PMIC
This patch adds operation region driver for Intel BXT WhiskeyCove
PMIC. The register mapping is done as per the BXT WC data sheet.

Signed-off-by: Ajay Thomas <ajay.thomas.david.rajamanickam@intel.com>
Signed-off-by: Bin Gao <bin.gao@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-06-24 15:25:38 +02:00
Bin Gao d8ba819124 ACPI / PMIC: modify the pen function signature to take bit field
Issue description: On some pmics, the policy enable for thermal alerts
refers to different bit fields of the same registers, whereas on other
pmics, the policy enable refers to the same bit field on different
registers. Previous implementation did not provide the flexibility for
supporting the first approach.

Solution: Modified the policy enable function to take bit field as well.
The use of bit field is left to the pmic specific opregion driver.

Signed-off-by: Yegnesh Iyer <yegnesh.s.iyer@intel.com>
Signed-off-by: Bin Gao <bin.gao@intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-06-24 15:25:37 +02:00
Paul Gortmaker 75829dcf10 drivers/acpi: make pmic/intel_pmic_crc.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:

drivers/acpi/Kconfig:config CRC_PMIC_OPREGION
drivers/acpi/Kconfig:   bool "ACPI operation region support for CrystalCove PMIC"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple modular references, so that when reading
the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-03-09 23:46:07 +01:00
Masanari Iida dff1eb047f ACPI/PMIC: Fix typo in MODULE_DESCRIPTION in intel_pmic_crc.c
This patch fix a spelling typo in MODULE_DESCRIPTION within intel_pmic_crc.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-03-26 21:34:51 +01:00
Srinivas Pandruvada ac586e2d6a ACPI / PMIC: Use common LPAT table handling functions
The LPAT table processing functions from this modules are moved to a
standalone module with exported interface functions.
Using new interface functions in this module.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-01-29 21:02:11 +08:00
Aaron Lu 491cb357de ACPI / PMIC: AXP288: support virtual GPIO in ACPI table
The same virtual GPIO strategy is also used for the AXP288 PMIC in that
various control methods that are used to do power rail handling and
sensor reading/setting will touch GPIO fields defined under the PMIC
device. The GPIO fileds are only defined by the ACPI code while the
actual hardware doesn't really have a GPIO controller, but to make those
control method execution succeed, we have to install a GPIO handler for
the PMIC device handle. Since we do not need the virtual GPIO strategy,
we can simply do nothing in that handler.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-11-26 23:32:06 +01:00
Aaron Lu d8139f6311 ACPI / PMIC: support PMIC operation region for XPower AXP288
The Baytrail-T-CR platform firmware has defined two customized operation
regions for PMIC chip Dollar Cove XPower - one is for power resource
handling and one is for thermal just like the CrystalCove one. This patch
adds support for them on top of the common PMIC opregion region code.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org> for the MFD part
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-11-26 23:32:05 +01:00
Aaron Lu b1eea857d8 ACPI / PMIC: support PMIC operation region for CrystalCove
The Baytrail-T platform firmware has defined two customized operation
regions for PMIC chip Crystal Cove - one is for power resource handling
and one is for thermal: sensor temperature reporting, trip point setting,
etc. This patch adds support for them on top of the existing Crystal Cove
PMIC driver.

The reason to split code into a separate file intel_pmic.c is that there
are more PMIC drivers with ACPI operation region support coming and we can
re-use those code. The intel_pmic_opregion_data structure is created also
for this purpose: when we need to support a new PMIC's operation region,
we just need to fill those callbacks and the two register mapping tables.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org> for the MFD part
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-11-26 23:32:05 +01:00