Merge branches 'acpi-tables', 'acpi-pmic', 'acpi-dptf' and 'acpi-soc'

* acpi-tables:
  ACPI: NFIT: Use kobj_to_dev() instead

* acpi-pmic:
  MAINTAINERS: Use my kernel.org address for Intel PMIC work
  ACPI / PMIC: Move TPS68470 OpRegion driver to drivers/acpi/pmic/
  ACPI / PMIC: Split out Kconfig and Makefile specific for ACPI PMIC

* acpi-dptf:
  ACPI: DPTF: Add PCH FIVR participant driver

* acpi-soc:
  ACPI: APD: Clean up header file include statements
  ACPI: APD: Remove unnecessary APD_ADDR() macro stub
  ACPI: APD: Remove ACPI_MODULE_NAME()
  ACPI: APD: Remove flags from struct apd_device_desc
  ACPI: APD: Add kerneldoc for properties in struct apd_device_desc
This commit is contained in:
Rafael J. Wysocki 2020-10-13 14:43:16 +02:00
12 changed files with 249 additions and 101 deletions

View File

@ -92,3 +92,19 @@ Contact: linux-acpi@vger.kernel.org
Description:
(RO) The battery discharge current capability obtained from battery fuel gauge in
milli Amps.
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/freq_mhz_low_clock
Date: November, 2020
KernelVersion: v5.10
Contact: linux-acpi@vger.kernel.org
Description:
(RW) The PCH FIVR (Fully Integrated Voltage Regulator) switching frequency in MHz,
when FIVR clock is 19.2MHz or 24MHz.
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/freq_mhz_high_clock
Date: November, 2020
KernelVersion: v5.10
Contact: linux-acpi@vger.kernel.org
Description:
(RW) The PCH FIVR (Fully Integrated Voltage Regulator) switching frequency in MHz,
when FIVR clock is 38.4MHz.

View File

@ -405,7 +405,7 @@ F: drivers/platform/x86/i2c-multi-instantiate.c
ACPI PMIC DRIVERS
M: "Rafael J. Wysocki" <rjw@rjwysocki.net>
M: Len Brown <lenb@kernel.org>
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
R: Andy Shevchenko <andy@kernel.org>
R: Mika Westerberg <mika.westerberg@linux.intel.com>
L: linux-acpi@vger.kernel.org
S: Supported
@ -8939,7 +8939,7 @@ F: drivers/gpio/gpio-*cove.c
F: drivers/gpio/gpio-msic.c
INTEL PMIC MULTIFUNCTION DEVICE DRIVERS
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
M: Andy Shevchenko <andy@kernel.org>
S: Maintained
F: drivers/mfd/intel_msic.c
F: drivers/mfd/intel_soc_pmic*

View File

@ -504,55 +504,6 @@ config ACPI_EXTLOG
config ACPI_ADXL
bool
menuconfig PMIC_OPREGION
bool "PMIC (Power Management Integrated Circuit) operation region support"
help
Select this option to enable support for ACPI operation
region of the PMIC chip. The operation region can be used
to control power rails and sensor reading/writing on the
PMIC chip.
if PMIC_OPREGION
config BYTCRC_PMIC_OPREGION
bool "ACPI operation region support for Bay Trail Crystal Cove PMIC"
depends on INTEL_SOC_PMIC
help
This config adds ACPI operation region support for the Bay Trail
version of the Crystal Cove PMIC.
config CHTCRC_PMIC_OPREGION
bool "ACPI operation region support for Cherry Trail Crystal Cove PMIC"
depends on INTEL_SOC_PMIC
help
This config adds ACPI operation region support for the Cherry Trail
version of the Crystal Cove PMIC.
config XPOWER_PMIC_OPREGION
bool "ACPI operation region support for XPower AXP288 PMIC"
depends on MFD_AXP20X_I2C && IOSF_MBI=y
help
This config adds ACPI operation region support for XPower AXP288 PMIC.
config BXT_WC_PMIC_OPREGION
bool "ACPI operation region support for BXT WhiskeyCove PMIC"
depends on INTEL_SOC_PMIC_BXTWC
help
This config adds ACPI operation region support for BXT WhiskeyCove PMIC.
config CHT_WC_PMIC_OPREGION
bool "ACPI operation region support for CHT Whiskey Cove PMIC"
depends on INTEL_SOC_PMIC_CHTWC
help
This config adds ACPI operation region support for CHT Whiskey Cove PMIC.
config CHT_DC_TI_PMIC_OPREGION
bool "ACPI operation region support for Dollar Cove TI PMIC"
depends on INTEL_SOC_PMIC_CHTDC_TI
help
This config adds ACPI operation region support for Dollar Cove TI PMIC.
endif
config ACPI_CONFIGFS
tristate "ACPI configfs support"
select CONFIGFS_FS
@ -568,21 +519,7 @@ config ACPI_PPTT
bool
endif
config TPS68470_PMIC_OPREGION
bool "ACPI operation region support for TPS68470 PMIC"
depends on MFD_TPS68470
help
This config adds ACPI operation region support for TI TPS68470 PMIC.
TPS68470 device is an advanced power management unit that powers
a Compact Camera Module (CCM), generates clocks for image sensors,
drives a dual LED for flash and incorporates two LED drivers for
general purpose indicators.
This driver enables ACPI operation region support control voltage
regulators and clocks.
This option is a bool as it provides an ACPI operation
region, which must be available before any of the devices
using this, are probed.
source "drivers/acpi/pmic/Kconfig"
endif # ACPI

View File

@ -107,17 +107,9 @@ obj-$(CONFIG_ACPI_APEI) += apei/
obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o
obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o
obj-$(CONFIG_BYTCRC_PMIC_OPREGION) += pmic/intel_pmic_bytcrc.o
obj-$(CONFIG_CHTCRC_PMIC_OPREGION) += pmic/intel_pmic_chtcrc.o
obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o
obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += pmic/intel_pmic_bxtwc.o
obj-$(CONFIG_CHT_WC_PMIC_OPREGION) += pmic/intel_pmic_chtwc.o
obj-$(CONFIG_CHT_DC_TI_PMIC_OPREGION) += pmic/intel_pmic_chtdc_ti.o
obj-$(CONFIG_ACPI_CONFIGFS) += acpi_configfs.o
obj-$(CONFIG_TPS68470_PMIC_OPREGION) += pmic/tps68470_pmic.o
obj-y += pmic/
video-objs += acpi_video.o video_detect.o
obj-y += dptf/

View File

@ -7,39 +7,28 @@
* Wu, Jeff <Jeff.Wu@amd.com>
*/
#include <linux/clk-provider.h>
#include <linux/platform_data/clk-fch.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/clkdev.h>
#include <linux/acpi.h>
#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/pm.h>
#include <linux/platform_data/clk-fch.h>
#include <linux/platform_device.h>
#include "internal.h"
ACPI_MODULE_NAME("acpi_apd");
struct apd_private_data;
/**
* ACPI_APD_SYSFS : add device attributes in sysfs
* ACPI_APD_PM : attach power domain to device
*/
#define ACPI_APD_SYSFS BIT(0)
#define ACPI_APD_PM BIT(1)
/**
* struct apd_device_desc - a descriptor for apd device
* @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
* @fixed_clk_rate: fixed rate input clock source for acpi device;
* 0 means no fixed rate input clock source
* @properties: build-in properties of the device such as UART
* @setup: a hook routine to set device resource during create platform device
*
* Device description defined as acpi_device_id.driver_data
*/
struct apd_device_desc {
unsigned int flags;
unsigned int fixed_clk_rate;
struct property_entry *properties;
int (*setup)(struct apd_private_data *pdata);
@ -71,7 +60,6 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
}
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
static int misc_check_res(struct acpi_resource *ares, void *data)
{
struct resource res;
@ -142,7 +130,7 @@ static const struct apd_device_desc cz_uart_desc = {
static const struct apd_device_desc fch_misc_desc = {
.setup = fch_misc_setup,
};
#endif
#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
#ifdef CONFIG_ARM64
static const struct apd_device_desc xgene_i2c_desc = {
@ -184,14 +172,10 @@ static const struct apd_device_desc hip08_spi_desc = {
.setup = acpi_apd_setup,
.fixed_clk_rate = 250000000,
};
#endif /* CONFIG_ARM64 */
#endif
#else
#define APD_ADDR(desc) (0UL)
#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
/**
* Create platform device during acpi scan attach handle.
* Return value > 0 on success of creating device.

View File

@ -14,3 +14,17 @@ config DPTF_POWER
To compile this driver as a module, choose M here:
the module will be called dptf_power.
config DPTF_PCH_FIVR
tristate "DPTF PCH FIVR Participant"
depends on X86
help
This driver adds support for Dynamic Platform and Thermal Framework
(DPTF) PCH FIVR Participant device support. This driver allows to
switch PCH FIVR (Fully Integrated Voltage Regulator) frequency.
This participant is responsible for exposing:
freq_mhz_low_clock
freq_mhz_high_clock
To compile this driver as a module, choose M here:
the module will be called dptf_pch_fivr.

View File

@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_ACPI) += int340x_thermal.o
obj-$(CONFIG_DPTF_POWER) += dptf_power.o
obj-$(CONFIG_DPTF_PCH_FIVR) += dptf_pch_fivr.o

View File

@ -0,0 +1,126 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* dptf_pch_fivr: DPTF PCH FIVR Participant driver
* Copyright (c) 2020, Intel Corporation.
*/
#include <linux/acpi.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
/*
* Presentation of attributes which are defined for INT1045
* They are:
* freq_mhz_low_clock : Set PCH FIVR switching freq for
* FIVR clock 19.2MHz and 24MHz
* freq_mhz_high_clock : Set PCH FIVR switching freq for
* FIVR clock 38.4MHz
*/
#define PCH_FIVR_SHOW(name, method) \
static ssize_t name##_show(struct device *dev,\
struct device_attribute *attr,\
char *buf)\
{\
struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
unsigned long long val;\
acpi_status status;\
\
status = acpi_evaluate_integer(acpi_dev->handle, #method,\
NULL, &val);\
if (ACPI_SUCCESS(status))\
return sprintf(buf, "%d\n", (int)val);\
else\
return -EINVAL;\
}
#define PCH_FIVR_STORE(name, method) \
static ssize_t name##_store(struct device *dev,\
struct device_attribute *attr,\
const char *buf, size_t count)\
{\
struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
acpi_status status;\
u32 val;\
\
if (kstrtouint(buf, 0, &val) < 0)\
return -EINVAL;\
\
status = acpi_execute_simple_method(acpi_dev->handle, #method, val);\
if (ACPI_SUCCESS(status))\
return count;\
\
return -EINVAL;\
}
PCH_FIVR_SHOW(freq_mhz_low_clock, GFC0)
PCH_FIVR_SHOW(freq_mhz_high_clock, GFC1)
PCH_FIVR_STORE(freq_mhz_low_clock, RFC0)
PCH_FIVR_STORE(freq_mhz_high_clock, RFC1)
static DEVICE_ATTR_RW(freq_mhz_low_clock);
static DEVICE_ATTR_RW(freq_mhz_high_clock);
static struct attribute *fivr_attrs[] = {
&dev_attr_freq_mhz_low_clock.attr,
&dev_attr_freq_mhz_high_clock.attr,
NULL
};
static const struct attribute_group pch_fivr_attribute_group = {
.attrs = fivr_attrs,
.name = "pch_fivr_switch_frequency"
};
static int pch_fivr_add(struct platform_device *pdev)
{
struct acpi_device *acpi_dev;
unsigned long long ptype;
acpi_status status;
int result;
acpi_dev = ACPI_COMPANION(&(pdev->dev));
if (!acpi_dev)
return -ENODEV;
status = acpi_evaluate_integer(acpi_dev->handle, "PTYP", NULL, &ptype);
if (ACPI_FAILURE(status) || ptype != 0x05)
return -ENODEV;
result = sysfs_create_group(&pdev->dev.kobj,
&pch_fivr_attribute_group);
if (result)
return result;
platform_set_drvdata(pdev, acpi_dev);
return 0;
}
static int pch_fivr_remove(struct platform_device *pdev)
{
sysfs_remove_group(&pdev->dev.kobj, &pch_fivr_attribute_group);
return 0;
}
static const struct acpi_device_id pch_fivr_device_ids[] = {
{"INTC1045", 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, pch_fivr_device_ids);
static struct platform_driver pch_fivr_driver = {
.probe = pch_fivr_add,
.remove = pch_fivr_remove,
.driver = {
.name = "DPTF PCH FIVR",
.acpi_match_table = pch_fivr_device_ids,
},
};
module_platform_driver(pch_fivr_driver);
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("ACPI DPTF PCH FIVR driver");

View File

@ -27,6 +27,7 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {
{"INTC1040"},
{"INTC1043"},
{"INTC1044"},
{"INTC1045"},
{"INTC1047"},
{""},
};

View File

@ -1389,7 +1389,7 @@ static bool ars_supported(struct nvdimm_bus *nvdimm_bus)
static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct device *dev = kobj_to_dev(kobj);
struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
if (a == &dev_attr_scrub.attr)
@ -1679,7 +1679,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj,
struct attribute *a, int n)
{
struct device *dev = container_of(kobj, struct device, kobj);
struct device *dev = kobj_to_dev(kobj);
struct nvdimm *nvdimm = to_nvdimm(dev);
struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);

67
drivers/acpi/pmic/Kconfig Normal file
View File

@ -0,0 +1,67 @@
# SPDX-License-Identifier: GPL-2.0
menuconfig PMIC_OPREGION
bool "PMIC (Power Management Integrated Circuit) operation region support"
help
Select this option to enable support for ACPI operation
region of the PMIC chip. The operation region can be used
to control power rails and sensor reading/writing on the
PMIC chip.
if PMIC_OPREGION
config BYTCRC_PMIC_OPREGION
bool "ACPI operation region support for Bay Trail Crystal Cove PMIC"
depends on INTEL_SOC_PMIC
help
This config adds ACPI operation region support for the Bay Trail
version of the Crystal Cove PMIC.
config CHTCRC_PMIC_OPREGION
bool "ACPI operation region support for Cherry Trail Crystal Cove PMIC"
depends on INTEL_SOC_PMIC
help
This config adds ACPI operation region support for the Cherry Trail
version of the Crystal Cove PMIC.
config XPOWER_PMIC_OPREGION
bool "ACPI operation region support for XPower AXP288 PMIC"
depends on MFD_AXP20X_I2C && IOSF_MBI=y
help
This config adds ACPI operation region support for XPower AXP288 PMIC.
config BXT_WC_PMIC_OPREGION
bool "ACPI operation region support for BXT WhiskeyCove PMIC"
depends on INTEL_SOC_PMIC_BXTWC
help
This config adds ACPI operation region support for BXT WhiskeyCove PMIC.
config CHT_WC_PMIC_OPREGION
bool "ACPI operation region support for CHT Whiskey Cove PMIC"
depends on INTEL_SOC_PMIC_CHTWC
help
This config adds ACPI operation region support for CHT Whiskey Cove PMIC.
config CHT_DC_TI_PMIC_OPREGION
bool "ACPI operation region support for Dollar Cove TI PMIC"
depends on INTEL_SOC_PMIC_CHTDC_TI
help
This config adds ACPI operation region support for Dollar Cove TI PMIC.
endif # PMIC_OPREGION
config TPS68470_PMIC_OPREGION
bool "ACPI operation region support for TPS68470 PMIC"
depends on MFD_TPS68470
help
This config adds ACPI operation region support for TI TPS68470 PMIC.
TPS68470 device is an advanced power management unit that powers
a Compact Camera Module (CCM), generates clocks for image sensors,
drives a dual LED for flash and incorporates two LED drivers for
general purpose indicators.
This driver enables ACPI operation region support control voltage
regulators and clocks.
This option is a bool as it provides an ACPI operation
region, which must be available before any of the devices
using this, are probed.

View File

@ -0,0 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_PMIC_OPREGION) += intel_pmic.o
obj-$(CONFIG_BYTCRC_PMIC_OPREGION) += intel_pmic_bytcrc.o
obj-$(CONFIG_CHTCRC_PMIC_OPREGION) += intel_pmic_chtcrc.o
obj-$(CONFIG_XPOWER_PMIC_OPREGION) += intel_pmic_xpower.o
obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += intel_pmic_bxtwc.o
obj-$(CONFIG_CHT_WC_PMIC_OPREGION) += intel_pmic_chtwc.o
obj-$(CONFIG_CHT_DC_TI_PMIC_OPREGION) += intel_pmic_chtdc_ti.o
obj-$(CONFIG_TPS68470_PMIC_OPREGION) += tps68470_pmic.o