Skip to content

Commit acd448f

Browse files
committed
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
5 parents 9a15da1 + 5f15551 + 399e08f + 2ce6324 + 32c6f3f commit acd448f

12 files changed

Lines changed: 249 additions & 101 deletions

File tree

Documentation/ABI/testing/sysfs-platform-dptf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,19 @@ Contact: linux-acpi@vger.kernel.org
9292
Description:
9393
(RO) The battery discharge current capability obtained from battery fuel gauge in
9494
milli Amps.
95+
96+
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/freq_mhz_low_clock
97+
Date: November, 2020
98+
KernelVersion: v5.10
99+
Contact: linux-acpi@vger.kernel.org
100+
Description:
101+
(RW) The PCH FIVR (Fully Integrated Voltage Regulator) switching frequency in MHz,
102+
when FIVR clock is 19.2MHz or 24MHz.
103+
104+
What: /sys/bus/platform/devices/INTC1045:00/pch_fivr_switch_frequency/freq_mhz_high_clock
105+
Date: November, 2020
106+
KernelVersion: v5.10
107+
Contact: linux-acpi@vger.kernel.org
108+
Description:
109+
(RW) The PCH FIVR (Fully Integrated Voltage Regulator) switching frequency in MHz,
110+
when FIVR clock is 38.4MHz.

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ F: drivers/platform/x86/i2c-multi-instantiate.c
405405
ACPI PMIC DRIVERS
406406
M: "Rafael J. Wysocki" <rjw@rjwysocki.net>
407407
M: Len Brown <lenb@kernel.org>
408-
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
408+
R: Andy Shevchenko <andy@kernel.org>
409409
R: Mika Westerberg <mika.westerberg@linux.intel.com>
410410
L: linux-acpi@vger.kernel.org
411411
S: Supported
@@ -8939,7 +8939,7 @@ F: drivers/gpio/gpio-*cove.c
89398939
F: drivers/gpio/gpio-msic.c
89408940

89418941
INTEL PMIC MULTIFUNCTION DEVICE DRIVERS
8942-
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8942+
M: Andy Shevchenko <andy@kernel.org>
89438943
S: Maintained
89448944
F: drivers/mfd/intel_msic.c
89458945
F: drivers/mfd/intel_soc_pmic*

drivers/acpi/Kconfig

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -504,55 +504,6 @@ config ACPI_EXTLOG
504504
config ACPI_ADXL
505505
bool
506506

507-
menuconfig PMIC_OPREGION
508-
bool "PMIC (Power Management Integrated Circuit) operation region support"
509-
help
510-
Select this option to enable support for ACPI operation
511-
region of the PMIC chip. The operation region can be used
512-
to control power rails and sensor reading/writing on the
513-
PMIC chip.
514-
515-
if PMIC_OPREGION
516-
config BYTCRC_PMIC_OPREGION
517-
bool "ACPI operation region support for Bay Trail Crystal Cove PMIC"
518-
depends on INTEL_SOC_PMIC
519-
help
520-
This config adds ACPI operation region support for the Bay Trail
521-
version of the Crystal Cove PMIC.
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-
530-
config XPOWER_PMIC_OPREGION
531-
bool "ACPI operation region support for XPower AXP288 PMIC"
532-
depends on MFD_AXP20X_I2C && IOSF_MBI=y
533-
help
534-
This config adds ACPI operation region support for XPower AXP288 PMIC.
535-
536-
config BXT_WC_PMIC_OPREGION
537-
bool "ACPI operation region support for BXT WhiskeyCove PMIC"
538-
depends on INTEL_SOC_PMIC_BXTWC
539-
help
540-
This config adds ACPI operation region support for BXT WhiskeyCove PMIC.
541-
542-
config CHT_WC_PMIC_OPREGION
543-
bool "ACPI operation region support for CHT Whiskey Cove PMIC"
544-
depends on INTEL_SOC_PMIC_CHTWC
545-
help
546-
This config adds ACPI operation region support for CHT Whiskey Cove PMIC.
547-
548-
config CHT_DC_TI_PMIC_OPREGION
549-
bool "ACPI operation region support for Dollar Cove TI PMIC"
550-
depends on INTEL_SOC_PMIC_CHTDC_TI
551-
help
552-
This config adds ACPI operation region support for Dollar Cove TI PMIC.
553-
554-
endif
555-
556507
config ACPI_CONFIGFS
557508
tristate "ACPI configfs support"
558509
select CONFIGFS_FS
@@ -568,21 +519,7 @@ config ACPI_PPTT
568519
bool
569520
endif
570521

571-
config TPS68470_PMIC_OPREGION
572-
bool "ACPI operation region support for TPS68470 PMIC"
573-
depends on MFD_TPS68470
574-
help
575-
This config adds ACPI operation region support for TI TPS68470 PMIC.
576-
TPS68470 device is an advanced power management unit that powers
577-
a Compact Camera Module (CCM), generates clocks for image sensors,
578-
drives a dual LED for flash and incorporates two LED drivers for
579-
general purpose indicators.
580-
This driver enables ACPI operation region support control voltage
581-
regulators and clocks.
582-
583-
This option is a bool as it provides an ACPI operation
584-
region, which must be available before any of the devices
585-
using this, are probed.
522+
source "drivers/acpi/pmic/Kconfig"
586523

587524
endif # ACPI
588525

drivers/acpi/Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,9 @@ obj-$(CONFIG_ACPI_APEI) += apei/
107107

108108
obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o
109109

110-
obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o
111-
obj-$(CONFIG_BYTCRC_PMIC_OPREGION) += pmic/intel_pmic_bytcrc.o
112-
obj-$(CONFIG_CHTCRC_PMIC_OPREGION) += pmic/intel_pmic_chtcrc.o
113-
obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o
114-
obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += pmic/intel_pmic_bxtwc.o
115-
obj-$(CONFIG_CHT_WC_PMIC_OPREGION) += pmic/intel_pmic_chtwc.o
116-
obj-$(CONFIG_CHT_DC_TI_PMIC_OPREGION) += pmic/intel_pmic_chtdc_ti.o
117-
118110
obj-$(CONFIG_ACPI_CONFIGFS) += acpi_configfs.o
119111

120-
obj-$(CONFIG_TPS68470_PMIC_OPREGION) += pmic/tps68470_pmic.o
112+
obj-y += pmic/
121113

122114
video-objs += acpi_video.o video_detect.o
123115
obj-y += dptf/

drivers/acpi/acpi_apd.c

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,28 @@
77
* Wu, Jeff <Jeff.Wu@amd.com>
88
*/
99

10-
#include <linux/clk-provider.h>
11-
#include <linux/platform_data/clk-fch.h>
12-
#include <linux/platform_device.h>
13-
#include <linux/pm_domain.h>
14-
#include <linux/clkdev.h>
1510
#include <linux/acpi.h>
11+
#include <linux/clkdev.h>
12+
#include <linux/clk-provider.h>
1613
#include <linux/err.h>
1714
#include <linux/io.h>
18-
#include <linux/pm.h>
15+
#include <linux/platform_data/clk-fch.h>
16+
#include <linux/platform_device.h>
1917

2018
#include "internal.h"
2119

22-
ACPI_MODULE_NAME("acpi_apd");
2320
struct apd_private_data;
2421

25-
/**
26-
* ACPI_APD_SYSFS : add device attributes in sysfs
27-
* ACPI_APD_PM : attach power domain to device
28-
*/
29-
#define ACPI_APD_SYSFS BIT(0)
30-
#define ACPI_APD_PM BIT(1)
31-
3222
/**
3323
* struct apd_device_desc - a descriptor for apd device
34-
* @flags: device flags like %ACPI_APD_SYSFS, %ACPI_APD_PM
3524
* @fixed_clk_rate: fixed rate input clock source for acpi device;
3625
* 0 means no fixed rate input clock source
26+
* @properties: build-in properties of the device such as UART
3727
* @setup: a hook routine to set device resource during create platform device
3828
*
3929
* Device description defined as acpi_device_id.driver_data
4030
*/
4131
struct apd_device_desc {
42-
unsigned int flags;
4332
unsigned int fixed_clk_rate;
4433
struct property_entry *properties;
4534
int (*setup)(struct apd_private_data *pdata);
@@ -71,7 +60,6 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
7160
}
7261

7362
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
74-
7563
static int misc_check_res(struct acpi_resource *ares, void *data)
7664
{
7765
struct resource res;
@@ -142,7 +130,7 @@ static const struct apd_device_desc cz_uart_desc = {
142130
static const struct apd_device_desc fch_misc_desc = {
143131
.setup = fch_misc_setup,
144132
};
145-
#endif
133+
#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
146134

147135
#ifdef CONFIG_ARM64
148136
static const struct apd_device_desc xgene_i2c_desc = {
@@ -184,13 +172,9 @@ static const struct apd_device_desc hip08_spi_desc = {
184172
.setup = acpi_apd_setup,
185173
.fixed_clk_rate = 250000000,
186174
};
187-
#endif
175+
#endif /* CONFIG_ARM64 */
188176

189-
#else
190-
191-
#define APD_ADDR(desc) (0UL)
192-
193-
#endif /* CONFIG_X86_AMD_PLATFORM_DEVICE */
177+
#endif
194178

195179
/**
196180
* Create platform device during acpi scan attach handle.

drivers/acpi/dptf/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,17 @@ config DPTF_POWER
1414

1515
To compile this driver as a module, choose M here:
1616
the module will be called dptf_power.
17+
18+
config DPTF_PCH_FIVR
19+
tristate "DPTF PCH FIVR Participant"
20+
depends on X86
21+
help
22+
This driver adds support for Dynamic Platform and Thermal Framework
23+
(DPTF) PCH FIVR Participant device support. This driver allows to
24+
switch PCH FIVR (Fully Integrated Voltage Regulator) frequency.
25+
This participant is responsible for exposing:
26+
freq_mhz_low_clock
27+
freq_mhz_high_clock
28+
29+
To compile this driver as a module, choose M here:
30+
the module will be called dptf_pch_fivr.

drivers/acpi/dptf/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_ACPI) += int340x_thermal.o
33
obj-$(CONFIG_DPTF_POWER) += dptf_power.o
4+
obj-$(CONFIG_DPTF_PCH_FIVR) += dptf_pch_fivr.o

drivers/acpi/dptf/dptf_pch_fivr.c

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* dptf_pch_fivr: DPTF PCH FIVR Participant driver
4+
* Copyright (c) 2020, Intel Corporation.
5+
*/
6+
7+
#include <linux/acpi.h>
8+
#include <linux/kernel.h>
9+
#include <linux/module.h>
10+
#include <linux/platform_device.h>
11+
12+
/*
13+
* Presentation of attributes which are defined for INT1045
14+
* They are:
15+
* freq_mhz_low_clock : Set PCH FIVR switching freq for
16+
* FIVR clock 19.2MHz and 24MHz
17+
* freq_mhz_high_clock : Set PCH FIVR switching freq for
18+
* FIVR clock 38.4MHz
19+
*/
20+
#define PCH_FIVR_SHOW(name, method) \
21+
static ssize_t name##_show(struct device *dev,\
22+
struct device_attribute *attr,\
23+
char *buf)\
24+
{\
25+
struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
26+
unsigned long long val;\
27+
acpi_status status;\
28+
\
29+
status = acpi_evaluate_integer(acpi_dev->handle, #method,\
30+
NULL, &val);\
31+
if (ACPI_SUCCESS(status))\
32+
return sprintf(buf, "%d\n", (int)val);\
33+
else\
34+
return -EINVAL;\
35+
}
36+
37+
#define PCH_FIVR_STORE(name, method) \
38+
static ssize_t name##_store(struct device *dev,\
39+
struct device_attribute *attr,\
40+
const char *buf, size_t count)\
41+
{\
42+
struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
43+
acpi_status status;\
44+
u32 val;\
45+
\
46+
if (kstrtouint(buf, 0, &val) < 0)\
47+
return -EINVAL;\
48+
\
49+
status = acpi_execute_simple_method(acpi_dev->handle, #method, val);\
50+
if (ACPI_SUCCESS(status))\
51+
return count;\
52+
\
53+
return -EINVAL;\
54+
}
55+
56+
PCH_FIVR_SHOW(freq_mhz_low_clock, GFC0)
57+
PCH_FIVR_SHOW(freq_mhz_high_clock, GFC1)
58+
PCH_FIVR_STORE(freq_mhz_low_clock, RFC0)
59+
PCH_FIVR_STORE(freq_mhz_high_clock, RFC1)
60+
61+
static DEVICE_ATTR_RW(freq_mhz_low_clock);
62+
static DEVICE_ATTR_RW(freq_mhz_high_clock);
63+
64+
static struct attribute *fivr_attrs[] = {
65+
&dev_attr_freq_mhz_low_clock.attr,
66+
&dev_attr_freq_mhz_high_clock.attr,
67+
NULL
68+
};
69+
70+
static const struct attribute_group pch_fivr_attribute_group = {
71+
.attrs = fivr_attrs,
72+
.name = "pch_fivr_switch_frequency"
73+
};
74+
75+
static int pch_fivr_add(struct platform_device *pdev)
76+
{
77+
struct acpi_device *acpi_dev;
78+
unsigned long long ptype;
79+
acpi_status status;
80+
int result;
81+
82+
acpi_dev = ACPI_COMPANION(&(pdev->dev));
83+
if (!acpi_dev)
84+
return -ENODEV;
85+
86+
status = acpi_evaluate_integer(acpi_dev->handle, "PTYP", NULL, &ptype);
87+
if (ACPI_FAILURE(status) || ptype != 0x05)
88+
return -ENODEV;
89+
90+
result = sysfs_create_group(&pdev->dev.kobj,
91+
&pch_fivr_attribute_group);
92+
if (result)
93+
return result;
94+
95+
platform_set_drvdata(pdev, acpi_dev);
96+
97+
return 0;
98+
}
99+
100+
static int pch_fivr_remove(struct platform_device *pdev)
101+
{
102+
sysfs_remove_group(&pdev->dev.kobj, &pch_fivr_attribute_group);
103+
104+
return 0;
105+
}
106+
107+
static const struct acpi_device_id pch_fivr_device_ids[] = {
108+
{"INTC1045", 0},
109+
{"", 0},
110+
};
111+
MODULE_DEVICE_TABLE(acpi, pch_fivr_device_ids);
112+
113+
static struct platform_driver pch_fivr_driver = {
114+
.probe = pch_fivr_add,
115+
.remove = pch_fivr_remove,
116+
.driver = {
117+
.name = "DPTF PCH FIVR",
118+
.acpi_match_table = pch_fivr_device_ids,
119+
},
120+
};
121+
122+
module_platform_driver(pch_fivr_driver);
123+
124+
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
125+
MODULE_LICENSE("GPL v2");
126+
MODULE_DESCRIPTION("ACPI DPTF PCH FIVR driver");

drivers/acpi/dptf/int340x_thermal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {
2727
{"INTC1040"},
2828
{"INTC1043"},
2929
{"INTC1044"},
30+
{"INTC1045"},
3031
{"INTC1047"},
3132
{""},
3233
};

drivers/acpi/nfit/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ static bool ars_supported(struct nvdimm_bus *nvdimm_bus)
13891389

13901390
static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
13911391
{
1392-
struct device *dev = container_of(kobj, struct device, kobj);
1392+
struct device *dev = kobj_to_dev(kobj);
13931393
struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
13941394

13951395
if (a == &dev_attr_scrub.attr)
@@ -1679,7 +1679,7 @@ static struct attribute *acpi_nfit_dimm_attributes[] = {
16791679
static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj,
16801680
struct attribute *a, int n)
16811681
{
1682-
struct device *dev = container_of(kobj, struct device, kobj);
1682+
struct device *dev = kobj_to_dev(kobj);
16831683
struct nvdimm *nvdimm = to_nvdimm(dev);
16841684
struct nfit_mem *nfit_mem = nvdimm_provider_data(nvdimm);
16851685

0 commit comments

Comments
 (0)