Skip to content

Commit 09a0bd0

Browse files
committed
Merge tag 'platform-drivers-x86-v5.9-1' of git://git.infradead.org/linux-platform-drivers-x86
Pull x86 platform driver updates from Andy Shevchenko: - ASUS WMI driver honors BAT1 name of the battery (quite a few new laptops are using it) - Dell WMI driver supports new key codes and backlight events - ThinkPad ACPI driver now may use standard charge threshold interface, it also has been updated to provide Laptop or Desktop mode to the user - Intel Speed Select Technology gained support on Sapphire Rapids platform - Regular update of Speed Select Technology tools - Mellanox has been updated to support complex attributes - PMC core driver has been fixed to show correct names for LPM0 register - HTTP links were replaced by HTTPS ones where it applies - Miscellaneous fixes and cleanups here and there * tag 'platform-drivers-x86-v5.9-1' of git://git.infradead.org/linux-platform-drivers-x86: (42 commits) platform/x86: asus-nb-wmi: Drop duplicate DMI quirk structures platform/x86: thinkpad_acpi: Make some symbols static platform/x86: thinkpad_acpi: add documentation for battery charge control platform/x86: thinkpad_acpi: use standard charge control attribute names platform/x86: thinkpad_acpi: remove unused defines platform/x86: ISST: drop a duplicated word in isst_if.h tools/power/x86/intel-speed-select: Update version for v5.9 tools/power/x86/intel-speed-select: Add retries for mail box commands tools/power/x86/intel-speed-select: Add option to delay mbox commands tools/power/x86/intel-speed-select: Ignore -o option processing on error tools/power/x86/intel-speed-select: Change path for caching topology info platform/x86: acerhdf: Replace HTTP links with HTTPS ones platform/x86: apple-gmux: Replace HTTP links with HTTPS ones platform/x86: pcengines-apuv2: revert wiring up simswitch GPIO as LED platform/x86: mlx-platform: Extend FAN platform data description platform_data/mlxreg: Add presence register field for FAN devices Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces platform/mellanox: mlxreg-io: Add support for complex attributes platform/x86: mlx-platform: Add more definitions for system attributes platform_data/mlxreg: Add support for complex attributes ...
2 parents e53bc3f + 6718665 commit 09a0bd0

File tree

25 files changed

+846
-135
lines changed

25 files changed

+846
-135
lines changed

Documentation/ABI/stable/sysfs-driver-mlxreg-io

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,20 @@ Description: This file exposes the firmware version of burnable voltage
206206
regulator devices.
207207

208208
The file is read only.
209+
210+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld1_pn
211+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld2_pn
212+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld3_pn
213+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld4_pn
214+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld1_version_min
215+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld2_version_min
216+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld3_version_min
217+
What: /sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld4_version_min
218+
Date: July 2020
219+
KernelVersion: 5.9
220+
Contact: Vadim Pasternak <vadimpmellanox.com>
221+
Description: These files show with which CPLD part numbers and minor
222+
versions have been burned CPLD devices equipped on a
223+
system.
224+
225+
The files are read only.

Documentation/admin-guide/laptops/thinkpad-acpi.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ detailed description):
5050
- WAN enable and disable
5151
- UWB enable and disable
5252
- LCD Shadow (PrivacyGuard) enable and disable
53+
- Lap mode sensor
5354

5455
A compatibility table by model and feature is maintained on the web
5556
site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -1432,6 +1433,20 @@ The first command ensures the best viewing angle and the latter one turns
14321433
on the feature, restricting the viewing angles.
14331434

14341435

1436+
DYTC Lapmode sensor
1437+
------------------
1438+
1439+
sysfs: dytc_lapmode
1440+
1441+
Newer thinkpads and mobile workstations have the ability to determine if
1442+
the device is in deskmode or lapmode. This feature is used by user space
1443+
to decide if WWAN transmission can be increased to maximum power and is
1444+
also useful for understanding the different thermal modes available as
1445+
they differ between desk and lap mode.
1446+
1447+
The property is read-only. If the platform doesn't have support the sysfs
1448+
class is not created.
1449+
14351450
EXPERIMENTAL: UWB
14361451
-----------------
14371452

@@ -1470,6 +1485,23 @@ For more details about which buttons will appear depending on the mode, please
14701485
review the laptop's user guide:
14711486
http://www.lenovo.com/shop/americas/content/user_guides/x1carbon_2_ug_en.pdf
14721487

1488+
Battery charge control
1489+
----------------------
1490+
1491+
sysfs attributes:
1492+
/sys/class/power_supply/BAT*/charge_control_{start,end}_threshold
1493+
1494+
These two attributes are created for those batteries that are supported by the
1495+
driver. They enable the user to control the battery charge thresholds of the
1496+
given battery. Both values may be read and set. `charge_control_start_threshold`
1497+
accepts an integer between 0 and 99 (inclusive); this value represents a battery
1498+
percentage level, below which charging will begin. `charge_control_end_threshold`
1499+
accepts an integer between 1 and 100 (inclusive); this value represents a battery
1500+
percentage level, above which charging will stop.
1501+
1502+
The exact semantics of the attributes may be found in
1503+
Documentation/ABI/testing/sysfs-class-power.
1504+
14731505
Multiple Commands, Module Parameters
14741506
------------------------------------
14751507

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8610,6 +8610,12 @@ L: [email protected]
86108610
S: Maintained
86118611
F: drivers/platform/x86/intel_atomisp2_pm.c
86128612

8613+
INTEL ATOMISP2 LED DRIVER
8614+
M: Hans de Goede <[email protected]>
8615+
8616+
S: Maintained
8617+
F: drivers/platform/x86/intel_atomisp2_led.c
8618+
86138619
INTEL BROXTON PMC DRIVER
86148620
M: Mika Westerberg <[email protected]>
86158621
M: Zha Qipeng <[email protected]>

drivers/platform/mellanox/mlxreg-hotplug.c

Lines changed: 64 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
2-
* Copyright (c) 2016-2018 Mellanox Technologies. All rights reserved.
3-
* Copyright (c) 2016-2018 Vadim Pasternak <[email protected]>
3+
* Mellanox hotplug driver
44
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* 1. Redistributions of source code must retain the above copyright
9-
* notice, this list of conditions and the following disclaimer.
10-
* 2. Redistributions in binary form must reproduce the above copyright
11-
* notice, this list of conditions and the following disclaimer in the
12-
* documentation and/or other materials provided with the distribution.
13-
* 3. Neither the names of the copyright holders nor the names of its
14-
* contributors may be used to endorse or promote products derived from
15-
* this software without specific prior written permission.
16-
*
17-
* Alternatively, this software may be distributed under the terms of the
18-
* GNU General Public License ("GPL") version 2 as published by the Free
19-
* Software Foundation.
20-
*
21-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31-
* POSSIBILITY OF SUCH DAMAGE.
5+
* Copyright (C) 2016-2020 Mellanox Technologies
326
*/
337

348
#include <linux/bitops.h>
@@ -42,6 +16,7 @@
4216
#include <linux/platform_data/mlxreg.h>
4317
#include <linux/platform_device.h>
4418
#include <linux/spinlock.h>
19+
#include <linux/string_helpers.h>
4520
#include <linux/regmap.h>
4621
#include <linux/workqueue.h>
4722

@@ -97,14 +72,31 @@ struct mlxreg_hotplug_priv_data {
9772
u8 not_asserted;
9873
};
9974

75+
/* Environment variables array for udev. */
76+
static char *mlxreg_hotplug_udev_envp[] = { NULL, NULL };
77+
78+
static int
79+
mlxreg_hotplug_udev_event_send(struct kobject *kobj,
80+
struct mlxreg_core_data *data, bool action)
81+
{
82+
char event_str[MLXREG_CORE_LABEL_MAX_SIZE + 2];
83+
char label[MLXREG_CORE_LABEL_MAX_SIZE] = { 0 };
84+
85+
mlxreg_hotplug_udev_envp[0] = event_str;
86+
string_upper(label, data->label);
87+
snprintf(event_str, MLXREG_CORE_LABEL_MAX_SIZE, "%s=%d", label, !!action);
88+
89+
return kobject_uevent_env(kobj, KOBJ_CHANGE, mlxreg_hotplug_udev_envp);
90+
}
91+
10092
static int mlxreg_hotplug_device_create(struct mlxreg_hotplug_priv_data *priv,
10193
struct mlxreg_core_data *data)
10294
{
10395
struct mlxreg_core_hotplug_platform_data *pdata;
10496
struct i2c_client *client;
10597

10698
/* Notify user by sending hwmon uevent. */
107-
kobject_uevent(&priv->hwmon->kobj, KOBJ_CHANGE);
99+
mlxreg_hotplug_udev_event_send(&priv->hwmon->kobj, data, true);
108100

109101
/*
110102
* Return if adapter number is negative. It could be in case hotplug
@@ -144,7 +136,7 @@ mlxreg_hotplug_device_destroy(struct mlxreg_hotplug_priv_data *priv,
144136
struct mlxreg_core_data *data)
145137
{
146138
/* Notify user by sending hwmon uevent. */
147-
kobject_uevent(&priv->hwmon->kobj, KOBJ_CHANGE);
139+
mlxreg_hotplug_udev_event_send(&priv->hwmon->kobj, data, false);
148140

149141
if (data->hpdev.client) {
150142
i2c_unregister_device(data->hpdev.client);
@@ -199,17 +191,49 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv)
199191
struct mlxreg_core_hotplug_platform_data *pdata;
200192
struct mlxreg_core_item *item;
201193
struct mlxreg_core_data *data;
202-
int num_attrs = 0, id = 0, i, j;
194+
unsigned long mask;
195+
u32 regval;
196+
int num_attrs = 0, id = 0, i, j, k, ret;
203197

204198
pdata = dev_get_platdata(&priv->pdev->dev);
205199
item = pdata->items;
206200

207201
/* Go over all kinds of items - psu, pwr, fan. */
208202
for (i = 0; i < pdata->counter; i++, item++) {
209-
num_attrs += item->count;
203+
if (item->capability) {
204+
/*
205+
* Read group capability register to get actual number
206+
* of interrupt capable components and set group mask
207+
* accordingly.
208+
*/
209+
ret = regmap_read(priv->regmap, item->capability,
210+
&regval);
211+
if (ret)
212+
return ret;
213+
214+
item->mask = GENMASK((regval & item->mask) - 1, 0);
215+
}
216+
210217
data = item->data;
211-
/* Go over all units within the item. */
212-
for (j = 0; j < item->count; j++, data++, id++) {
218+
219+
/* Go over all unmasked units within item. */
220+
mask = item->mask;
221+
k = 0;
222+
for_each_set_bit(j, &mask, item->count) {
223+
if (data->capability) {
224+
/*
225+
* Read capability register and skip non
226+
* relevant attributes.
227+
*/
228+
ret = regmap_read(priv->regmap,
229+
data->capability, &regval);
230+
if (ret)
231+
return ret;
232+
if (!(regval & data->bit)) {
233+
data++;
234+
continue;
235+
}
236+
}
213237
PRIV_ATTR(id) = &PRIV_DEV_ATTR(id).dev_attr.attr;
214238
PRIV_ATTR(id)->name = devm_kasprintf(&priv->pdev->dev,
215239
GFP_KERNEL,
@@ -227,9 +251,13 @@ static int mlxreg_hotplug_attr_init(struct mlxreg_hotplug_priv_data *priv)
227251
PRIV_DEV_ATTR(id).dev_attr.show =
228252
mlxreg_hotplug_attr_show;
229253
PRIV_DEV_ATTR(id).nr = i;
230-
PRIV_DEV_ATTR(id).index = j;
254+
PRIV_DEV_ATTR(id).index = k;
231255
sysfs_attr_init(&PRIV_DEV_ATTR(id).dev_attr.attr);
256+
data++;
257+
id++;
258+
k++;
232259
}
260+
num_attrs += k;
233261
}
234262

235263
priv->group.attrs = devm_kcalloc(&priv->pdev->dev,
@@ -507,20 +535,6 @@ static int mlxreg_hotplug_set_irq(struct mlxreg_hotplug_priv_data *priv)
507535
item = pdata->items;
508536

509537
for (i = 0; i < pdata->counter; i++, item++) {
510-
if (item->capability) {
511-
/*
512-
* Read group capability register to get actual number
513-
* of interrupt capable components and set group mask
514-
* accordingly.
515-
*/
516-
ret = regmap_read(priv->regmap, item->capability,
517-
&regval);
518-
if (ret)
519-
goto out;
520-
521-
item->mask = GENMASK((regval & item->mask) - 1, 0);
522-
}
523-
524538
/* Clear group presense event. */
525539
ret = regmap_write(priv->regmap, item->reg +
526540
MLXREG_HOTPLUG_EVENT_OFF, 0);

drivers/platform/mellanox/mlxreg-io.c

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* @mlxreg_io_dev_attr: sysfs sensor device attribute array;
3131
* @group: sysfs attribute group;
3232
* @groups: list of sysfs attribute group for hwmon registration;
33+
* @regsize: size of a register value;
3334
*/
3435
struct mlxreg_io_priv_data {
3536
struct platform_device *pdev;
@@ -39,27 +40,30 @@ struct mlxreg_io_priv_data {
3940
struct sensor_device_attribute mlxreg_io_dev_attr[MLXREG_IO_ATT_NUM];
4041
struct attribute_group group;
4142
const struct attribute_group *groups[2];
43+
int regsize;
4244
};
4345

4446
static int
4547
mlxreg_io_get_reg(void *regmap, struct mlxreg_core_data *data, u32 in_val,
46-
bool rw_flag, u32 *regval)
48+
bool rw_flag, int regsize, u32 *regval)
4749
{
48-
int ret;
50+
int i, val, ret;
4951

5052
ret = regmap_read(regmap, data->reg, regval);
5153
if (ret)
5254
goto access_error;
5355

5456
/*
55-
* There are three kinds of attributes: single bit, full register's
56-
* bits and bit sequence. For the first kind field mask indicates which
57-
* bits are not related and field bit is set zero. For the second kind
58-
* field mask is set to zero and field bit is set with all bits one.
59-
* No special handling for such kind of attributes - pass value as is.
60-
* For the third kind, field mask indicates which bits are related and
61-
* field bit is set to the first bit number (from 1 to 32) is the bit
62-
* sequence.
57+
* There are four kinds of attributes: single bit, full register's
58+
* bits, bit sequence, bits in few registers For the first kind field
59+
* mask indicates which bits are not related and field bit is set zero.
60+
* For the second kind field mask is set to zero and field bit is set
61+
* with all bits one. No special handling for such kind of attributes -
62+
* pass value as is. For the third kind, the field mask indicates which
63+
* bits are related and the field bit is set to the first bit number
64+
* (from 1 to 32) is the bit sequence. For the fourth kind - the number
65+
* of registers which should be read for getting an attribute are
66+
* specified through 'data->regnum' field.
6367
*/
6468
if (!data->bit) {
6569
/* Single bit. */
@@ -83,6 +87,19 @@ mlxreg_io_get_reg(void *regmap, struct mlxreg_core_data *data, u32 in_val,
8387
/* Clear relevant bits and set them to new value. */
8488
*regval = (*regval & ~data->mask) | in_val;
8589
}
90+
} else {
91+
/*
92+
* Some attributes could occupied few registers in case regmap
93+
* bit size is 8 or 16. Compose such attributes from 'regnum'
94+
* registers. Such attributes contain read-only data.
95+
*/
96+
for (i = 1; i < data->regnum; i++) {
97+
ret = regmap_read(regmap, data->reg + i, &val);
98+
if (ret)
99+
goto access_error;
100+
101+
*regval |= rol32(val, regsize * i);
102+
}
86103
}
87104

88105
access_error:
@@ -99,7 +116,8 @@ mlxreg_io_attr_show(struct device *dev, struct device_attribute *attr,
99116
u32 regval = 0;
100117
int ret;
101118

102-
ret = mlxreg_io_get_reg(priv->pdata->regmap, data, 0, true, &regval);
119+
ret = mlxreg_io_get_reg(priv->pdata->regmap, data, 0, true,
120+
priv->regsize, &regval);
103121
if (ret)
104122
goto access_error;
105123

@@ -128,7 +146,7 @@ mlxreg_io_attr_store(struct device *dev, struct device_attribute *attr,
128146
return ret;
129147

130148
ret = mlxreg_io_get_reg(priv->pdata->regmap, data, input_val, false,
131-
&regval);
149+
priv->regsize, &regval);
132150
if (ret)
133151
goto access_error;
134152

@@ -207,6 +225,9 @@ static int mlxreg_io_probe(struct platform_device *pdev)
207225
}
208226

209227
priv->pdev = pdev;
228+
priv->regsize = regmap_get_val_bytes(priv->pdata->regmap);
229+
if (priv->regsize < 0)
230+
return priv->regsize;
210231

211232
err = mlxreg_io_attr_init(priv);
212233
if (err) {

drivers/platform/x86/Kconfig

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ config ACERHDF
140140
in the same node directory will tell you if it is "acerhdf".
141141

142142
For more information about this driver see
143-
<http://piie.net/files/acerhdf_README.txt>
143+
<https://piie.net/files/acerhdf_README.txt>
144144

145145
If you have an Acer Aspire One netbook, say Y or M
146146
here.
@@ -748,6 +748,27 @@ config THINKPAD_ACPI_HOTKEY_POLL
748748
If you are not sure, say Y here. The driver enables polling only if
749749
it is strictly necessary to do so.
750750

751+
config INTEL_ATOMISP2_LED
752+
tristate "Intel AtomISP2 camera LED driver"
753+
depends on GPIOLIB && LEDS_GPIO
754+
help
755+
Many Bay Trail and Cherry Trail devices come with a camera attached
756+
to Intel's Image Signal Processor. Linux currently does not have a
757+
driver for these, so they do not work as a camera. Some of these
758+
camera's have a LED which is controlled through a GPIO.
759+
760+
Some of these devices have a firmware issue where the LED gets turned
761+
on at boot. This driver will turn the LED off at boot and also allows
762+
controlling the LED (repurposing it) through the sysfs LED interface.
763+
764+
Which GPIO is attached to the LED is usually not described in the
765+
ACPI tables, so this driver contains per-system info about the GPIO
766+
inside the driver, this means that this driver only works on systems
767+
the driver knows about.
768+
769+
To compile this driver as a module, choose M here: the module
770+
will be called intel_atomisp2_led.
771+
751772
config INTEL_ATOMISP2_PM
752773
tristate "Intel AtomISP2 dummy / power-management driver"
753774
depends on PCI && IOSF_MBI && PM

0 commit comments

Comments
 (0)