Commit 51d69817 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'platform-drivers-x86-v5.5-3' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver fixes from Andy Shevchenko:

 - Fix keyboard brightness control for ASUS laptops

 - Better handling parameters of GPD pocket fan module to avoid
   thermal shock

 - Add IDs to PMC platform driver to support Intel Comet Lake

 - Fix potential dead lock in Mellanox TM FIFO driver and ABI
   documentation

* tag 'platform-drivers-x86-v5.5-3' of git://git.infradead.org/linux-platform-drivers-x86:
  Documentation/ABI: Add missed attribute for mlxreg-io sysfs interfaces
  Documentation/ABI: Fix documentation inconsistency for mlxreg-io sysfs interfaces
  platform/x86: asus-wmi: Fix keyboard brightness cannot be set to 0
  platform/x86: intel_pmc_core: update Comet Lake platform driver
  platform/x86: GPD pocket fan: Allow somewhat lower/higher temperature limits
  platform/x86: GPD pocket fan: Use default values when wrong modparams are given
  platform/mellanox: fix potential deadlock in the tmfifo driver
  platform/x86: intel-ips: Use the correct style for SPDX License Identifier
parents 0174cb6c f3efc406
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -29,13 +29,13 @@ Description: This file shows the system fans direction:

		The files are read only.

What:		/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/jtag_enable
What:		/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld3_version

Date:		November 2018
KernelVersion:	5.0
Contact:	Vadim Pasternak <vadimpmellanox.com>
Description:	These files show with which CPLD versions have been burned
		on LED board.
		on LED or Gearbox board.

		The files are read only.

@@ -121,6 +121,15 @@ Description: These files show the system reset cause, as following: ComEx

		The files are read only.

What:		/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/cpld4_version
Date:		November 2018
KernelVersion:	5.0
Contact:	Vadim Pasternak <vadimpmellanox.com>
Description:	These files show with which CPLD versions have been burned
		on LED board.

		The files are read only.

Date:		June 2019
KernelVersion:	5.3
Contact:	Vadim Pasternak <vadimpmellanox.com>
+10 −9
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ struct mlxbf_tmfifo_irq_info {
 * @work: work struct for deferred process
 * @timer: background timer
 * @vring: Tx/Rx ring
 * @spin_lock: spin lock
 * @spin_lock: Tx/Rx spin lock
 * @is_ready: ready flag
 */
struct mlxbf_tmfifo {
@@ -164,7 +164,7 @@ struct mlxbf_tmfifo {
	struct work_struct work;
	struct timer_list timer;
	struct mlxbf_tmfifo_vring *vring[2];
	spinlock_t spin_lock;		/* spin lock */
	spinlock_t spin_lock[2];	/* spin lock */
	bool is_ready;
};

@@ -525,7 +525,7 @@ static void mlxbf_tmfifo_console_tx(struct mlxbf_tmfifo *fifo, int avail)
	writeq(*(u64 *)&hdr, fifo->tx_base + MLXBF_TMFIFO_TX_DATA);

	/* Use spin-lock to protect the 'cons->tx_buf'. */
	spin_lock_irqsave(&fifo->spin_lock, flags);
	spin_lock_irqsave(&fifo->spin_lock[0], flags);

	while (size > 0) {
		addr = cons->tx_buf.buf + cons->tx_buf.tail;
@@ -552,7 +552,7 @@ static void mlxbf_tmfifo_console_tx(struct mlxbf_tmfifo *fifo, int avail)
		}
	}

	spin_unlock_irqrestore(&fifo->spin_lock, flags);
	spin_unlock_irqrestore(&fifo->spin_lock[0], flags);
}

/* Rx/Tx one word in the descriptor buffer. */
@@ -731,9 +731,9 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring,
		fifo->vring[is_rx] = NULL;

		/* Notify upper layer that packet is done. */
		spin_lock_irqsave(&fifo->spin_lock, flags);
		spin_lock_irqsave(&fifo->spin_lock[is_rx], flags);
		vring_interrupt(0, vring->vq);
		spin_unlock_irqrestore(&fifo->spin_lock, flags);
		spin_unlock_irqrestore(&fifo->spin_lock[is_rx], flags);
	}

mlxbf_tmfifo_desc_done:
@@ -852,10 +852,10 @@ static bool mlxbf_tmfifo_virtio_notify(struct virtqueue *vq)
		 * worker handler.
		 */
		if (vring->vdev_id == VIRTIO_ID_CONSOLE) {
			spin_lock_irqsave(&fifo->spin_lock, flags);
			spin_lock_irqsave(&fifo->spin_lock[0], flags);
			tm_vdev = fifo->vdev[VIRTIO_ID_CONSOLE];
			mlxbf_tmfifo_console_output(tm_vdev, vring);
			spin_unlock_irqrestore(&fifo->spin_lock, flags);
			spin_unlock_irqrestore(&fifo->spin_lock[0], flags);
		} else if (test_and_set_bit(MLXBF_TM_TX_LWM_IRQ,
					    &fifo->pend_events)) {
			return true;
@@ -1189,7 +1189,8 @@ static int mlxbf_tmfifo_probe(struct platform_device *pdev)
	if (!fifo)
		return -ENOMEM;

	spin_lock_init(&fifo->spin_lock);
	spin_lock_init(&fifo->spin_lock[0]);
	spin_lock_init(&fifo->spin_lock[1]);
	INIT_WORK(&fifo->work, mlxbf_tmfifo_work_handler);
	mutex_init(&fifo->lock);

+1 −7
Original line number Diff line number Diff line
@@ -512,13 +512,7 @@ static void kbd_led_update(struct asus_wmi *asus)
{
	int ctrl_param = 0;

	/*
	 * bits 0-2: level
	 * bit 7: light on/off
	 */
	if (asus->kbd_led_wk > 0)
	ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F);

	asus_wmi_set_devstate(ASUS_WMI_DEVID_KBD_BACKLIGHT, ctrl_param, NULL);
}

+20 −7
Original line number Diff line number Diff line
@@ -16,17 +16,27 @@

#define MAX_SPEED 3

static int temp_limits[3] = { 55000, 60000, 65000 };
#define TEMP_LIMIT0_DEFAULT	55000
#define TEMP_LIMIT1_DEFAULT	60000
#define TEMP_LIMIT2_DEFAULT	65000

#define HYSTERESIS_DEFAULT	3000

#define SPEED_ON_AC_DEFAULT	2

static int temp_limits[3] = {
	TEMP_LIMIT0_DEFAULT, TEMP_LIMIT1_DEFAULT, TEMP_LIMIT2_DEFAULT,
};
module_param_array(temp_limits, int, NULL, 0444);
MODULE_PARM_DESC(temp_limits,
		 "Millicelsius values above which the fan speed increases");

static int hysteresis = 3000;
static int hysteresis = HYSTERESIS_DEFAULT;
module_param(hysteresis, int, 0444);
MODULE_PARM_DESC(hysteresis,
		 "Hysteresis in millicelsius before lowering the fan speed");

static int speed_on_ac = 2;
static int speed_on_ac = SPEED_ON_AC_DEFAULT;
module_param(speed_on_ac, int, 0444);
MODULE_PARM_DESC(speed_on_ac,
		 "minimum fan speed to allow when system is powered by AC");
@@ -117,21 +127,24 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev)
	int i;

	for (i = 0; i < ARRAY_SIZE(temp_limits); i++) {
		if (temp_limits[i] < 40000 || temp_limits[i] > 70000) {
		if (temp_limits[i] < 20000 || temp_limits[i] > 90000) {
			dev_err(&pdev->dev, "Invalid temp-limit %d (must be between 40000 and 70000)\n",
				temp_limits[i]);
			return -EINVAL;
			temp_limits[0] = TEMP_LIMIT0_DEFAULT;
			temp_limits[1] = TEMP_LIMIT1_DEFAULT;
			temp_limits[2] = TEMP_LIMIT2_DEFAULT;
			break;
		}
	}
	if (hysteresis < 1000 || hysteresis > 10000) {
		dev_err(&pdev->dev, "Invalid hysteresis %d (must be between 1000 and 10000)\n",
			hysteresis);
		return -EINVAL;
		hysteresis = HYSTERESIS_DEFAULT;
	}
	if (speed_on_ac < 0 || speed_on_ac > MAX_SPEED) {
		dev_err(&pdev->dev, "Invalid speed_on_ac %d (must be between 0 and 3)\n",
			speed_on_ac);
		return -EINVAL;
		speed_on_ac = SPEED_ON_AC_DEFAULT;
	}

	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
+1 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2010 Intel Corporation
 */
Loading