Linux v4.15
This commit is contained in:
parent
622598fecf
commit
c41960f768
|
@ -0,0 +1,90 @@
|
|||
From 20eeb02a0a489e35de0830b2d61f09d43763c982 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 13 Nov 2017 09:23:19 +0100
|
||||
Subject: [PATCH] Bluetooth: btusb: Add a Kconfig option to enable USB
|
||||
autosuspend by default
|
||||
|
||||
On many laptops the btusb device is the only USB device not having USB
|
||||
autosuspend enabled, this causes not only the HCI but also the USB
|
||||
controller to stay awake, together using aprox. 0.4W of power.
|
||||
|
||||
Modern ultrabooks idle around 6W (at 50% screen brightness), 3.5W for
|
||||
Apollo Lake devices. 0.4W is a significant chunk of this (7 / 11%).
|
||||
|
||||
The btusb driver already contains code to allow enabling USB autosuspend,
|
||||
but currently leaves it up to the user / userspace to enable it. This
|
||||
means that for most people it will not be enabled, leading to an
|
||||
unnecessarily high power consumption.
|
||||
|
||||
Since enabling it is not entirely without risk of regressions, this
|
||||
commit adds a Kconfig option so that Linux distributions can choose to
|
||||
enable it by default. This commit also adds a module option so that when
|
||||
distros receive bugs they can easily ask the user to disable it again
|
||||
for easy debugging.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
Changes in v2:
|
||||
-s/BT_USB_AUTOSUSPEND/BT_HCIBTUSB_AUTOSUSPEND/
|
||||
-s/enable_usb_autosuspend/enable_autosuspend/
|
||||
---
|
||||
drivers/bluetooth/Kconfig | 10 ++++++++++
|
||||
drivers/bluetooth/btusb.c | 7 +++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
|
||||
index 6475f8c0d3b2..20940417d937 100644
|
||||
--- a/drivers/bluetooth/Kconfig
|
||||
+++ b/drivers/bluetooth/Kconfig
|
||||
@@ -30,6 +30,16 @@ config BT_HCIBTUSB
|
||||
Say Y here to compile support for Bluetooth USB devices into the
|
||||
kernel or say M to compile it as module (btusb).
|
||||
|
||||
+config BT_HCIBTUSB_AUTOSUSPEND
|
||||
+ bool "Enable USB autosuspend for Bluetooth USB devices by default"
|
||||
+ depends on BT_HCIBTUSB
|
||||
+ help
|
||||
+ Say Y here to enable USB autosuspend for Bluetooth USB devices by
|
||||
+ default.
|
||||
+
|
||||
+ This can be overridden by passing btusb.enable_autosuspend=[y|n]
|
||||
+ on the kernel commandline.
|
||||
+
|
||||
config BT_HCIBTUSB_BCM
|
||||
bool "Broadcom protocol support"
|
||||
depends on BT_HCIBTUSB
|
||||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
|
||||
index c054d7bce490..3386034a44aa 100644
|
||||
--- a/drivers/bluetooth/btusb.c
|
||||
+++ b/drivers/bluetooth/btusb.c
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
static bool disable_scofix;
|
||||
static bool force_scofix;
|
||||
+static bool enable_autosuspend = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTOSUSPEND);
|
||||
|
||||
static bool reset = true;
|
||||
|
||||
@@ -3175,6 +3176,9 @@ static int btusb_probe(struct usb_interface *intf,
|
||||
}
|
||||
#endif
|
||||
|
||||
+ if (enable_autosuspend)
|
||||
+ usb_enable_autosuspend(data->udev);
|
||||
+
|
||||
err = hci_register_dev(hdev);
|
||||
if (err < 0)
|
||||
goto out_free_dev;
|
||||
@@ -3387,6 +3391,9 @@ MODULE_PARM_DESC(disable_scofix, "Disable fixup of wrong SCO buffer size");
|
||||
module_param(force_scofix, bool, 0644);
|
||||
MODULE_PARM_DESC(force_scofix, "Force fixup of wrong SCO buffers size");
|
||||
|
||||
+module_param(enable_autosuspend, bool, 0644);
|
||||
+MODULE_PARM_DESC(enable_autosuspend, "Enable USB autosuspend by default");
|
||||
+
|
||||
module_param(reset, bool, 0644);
|
||||
MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
|
||||
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
From a5ffa27c07e06900fcfc50b08de6d11e45830168 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 3 Jan 2018 12:49:44 +0100
|
||||
Subject: [PATCH v2] Bluetooth: btusb: Disable autosuspend on QCA Rome devices
|
||||
|
||||
Commit fd865802c66b ("Bluetooth: btusb: fix QCA Rome suspend/resume") fixes
|
||||
a suspend/resume problem on QCA devices by doing a full reset on resume,
|
||||
reloading the firmware.
|
||||
|
||||
A similar problem happens when using runtime-pm / autosuspend, when this is
|
||||
enabled by the user the QCA Rome device stops working. Reloading the
|
||||
firmware after a runtime suspend is not really an option since the latency
|
||||
caused by this is unacceptable.
|
||||
|
||||
To fix the runtime-pm issues, this commit disables runtime-pm on QCA Rome
|
||||
HCIs, by getting (and not releasing) an usb autopm reference on the btusb
|
||||
interface.
|
||||
|
||||
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/bluetooth/btusb.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
|
||||
index 808c249845db..6ed3a0e5b8f6 100644
|
||||
--- a/drivers/bluetooth/btusb.c
|
||||
+++ b/drivers/bluetooth/btusb.c
|
||||
@@ -3122,8 +3122,15 @@ static int btusb_probe(struct usb_interface *intf,
|
||||
/* QCA Rome devices lose their updated firmware over suspend,
|
||||
* but the USB hub doesn't notice any status change.
|
||||
* Explicitly request a device reset on resume.
|
||||
+ * And disable runtime pm by getting a pm reference, the USB
|
||||
+ * core will drop our reference on disconnect.
|
||||
*/
|
||||
set_bit(BTUSB_RESET_RESUME, &data->flags);
|
||||
+ err = usb_autopm_get_interface(data->intf);
|
||||
+ if (err < 0) {
|
||||
+ BT_ERR("failed to get pm reference %d", err);
|
||||
+ goto out_free_dev;
|
||||
+ }
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_HCIBTUSB_RTL
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
From f5c1da991de077420fda17a236342de5a0068f5d Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 22 Nov 2017 12:57:08 +0100
|
||||
Subject: [PATCH v2 1/3] HID: multitouch: Properly deal with Win8 PTP reports
|
||||
with 0 touches
|
||||
|
||||
The Windows Precision Touchpad spec "Figure 4 Button Only Down and Up"
|
||||
and "Table 9 Report Sequence for Button Only Down and Up" indicate
|
||||
that the first packet of a (possibly hybrid mode multi-packet) frame
|
||||
may contain a contact-count of 0 if only a button is pressed and no
|
||||
fingers are detected.
|
||||
|
||||
This means that a value of 0 for contact-count is a valid value and
|
||||
should be used as expected contact count when it is the first packet
|
||||
(num_received == 0), as extra check to make sure that this is the first
|
||||
packet of a buttons only frame, we also check that the timestamp is
|
||||
different.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
||||
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
||||
---
|
||||
drivers/hid/hid-multitouch.c | 32 ++++++++++++++++++++++++++++++--
|
||||
1 file changed, 30 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
|
||||
index 9ef24b518f12..d8b1cad74faf 100644
|
||||
--- a/drivers/hid/hid-multitouch.c
|
||||
+++ b/drivers/hid/hid-multitouch.c
|
||||
@@ -119,6 +119,9 @@ struct mt_device {
|
||||
unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_*) */
|
||||
int cc_index; /* contact count field index in the report */
|
||||
int cc_value_index; /* contact count value index in the field */
|
||||
+ int scantime_index; /* scantime field index in the report */
|
||||
+ int scantime_val_index; /* scantime value index in the field */
|
||||
+ int prev_scantime; /* scantime reported in the previous packet */
|
||||
unsigned last_slot_field; /* the last field of a slot */
|
||||
unsigned mt_report_id; /* the report ID of the multitouch device */
|
||||
unsigned long initial_quirks; /* initial quirks state */
|
||||
@@ -599,6 +602,12 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
|
||||
EV_MSC, MSC_TIMESTAMP);
|
||||
input_set_capability(hi->input, EV_MSC, MSC_TIMESTAMP);
|
||||
mt_store_field(usage, td, hi);
|
||||
+ /* Ignore if indexes are out of bounds. */
|
||||
+ if (field->index >= field->report->maxfield ||
|
||||
+ usage->usage_index >= field->report_count)
|
||||
+ return 1;
|
||||
+ td->scantime_index = field->index;
|
||||
+ td->scantime_val_index = usage->usage_index;
|
||||
return 1;
|
||||
case HID_DG_CONTACTCOUNT:
|
||||
/* Ignore if indexes are out of bounds. */
|
||||
@@ -855,9 +864,10 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
|
||||
static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
|
||||
{
|
||||
struct mt_device *td = hid_get_drvdata(hid);
|
||||
+ __s32 cls = td->mtclass.name;
|
||||
struct hid_field *field;
|
||||
unsigned count;
|
||||
- int r, n;
|
||||
+ int r, n, scantime = 0;
|
||||
|
||||
/* sticky fingers release in progress, abort */
|
||||
if (test_and_set_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags))
|
||||
@@ -867,12 +877,29 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
|
||||
* Includes multi-packet support where subsequent
|
||||
* packets are sent with zero contactcount.
|
||||
*/
|
||||
+ if (td->scantime_index >= 0) {
|
||||
+ field = report->field[td->scantime_index];
|
||||
+ scantime = field->value[td->scantime_val_index];
|
||||
+ }
|
||||
if (td->cc_index >= 0) {
|
||||
struct hid_field *field = report->field[td->cc_index];
|
||||
int value = field->value[td->cc_value_index];
|
||||
- if (value)
|
||||
+
|
||||
+ /*
|
||||
+ * For Win8 PTPs the first packet (td->num_received == 0) may
|
||||
+ * have a contactcount of 0 if there only is a button event.
|
||||
+ * We double check that this is not a continuation packet
|
||||
+ * of a possible multi-packet frame be checking that the
|
||||
+ * timestamp has changed.
|
||||
+ */
|
||||
+ if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) &&
|
||||
+ td->num_received == 0 && td->prev_scantime != scantime)
|
||||
+ td->num_expected = value;
|
||||
+ /* A non 0 contact count always indicates a first packet */
|
||||
+ else if (value)
|
||||
td->num_expected = value;
|
||||
}
|
||||
+ td->prev_scantime = scantime;
|
||||
|
||||
for (r = 0; r < report->maxfield; r++) {
|
||||
field = report->field[r];
|
||||
@@ -1329,6 +1356,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
|
||||
td->maxcontact_report_id = -1;
|
||||
td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN;
|
||||
td->cc_index = -1;
|
||||
+ td->scantime_index = -1;
|
||||
td->mt_report_id = -1;
|
||||
hid_set_drvdata(hdev, td);
|
||||
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
From 25bb14c1e78e641049fd1ee0c404a9ccd2755e44 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 22 Jul 2017 13:00:05 +0200
|
||||
Subject: [PATCH 1/2] Input: gpio_keys - Allow suppression of input events for
|
||||
wakeup button presses
|
||||
|
||||
In some cases it is undesirable for a wakeup button to send input events
|
||||
to userspace if pressed to wakeup the system (if pressed during suspend).
|
||||
|
||||
A typical example of this is the power-button on laptops / tablets,
|
||||
sending a KEY_POWER event to userspace when woken up with the power-button
|
||||
will cause userspace to immediately suspend the system again which is
|
||||
undesirable.
|
||||
|
||||
For power-buttons attached to a PMIC, or handled by e.g. ACPI, not sending
|
||||
an input event in this case is take care of by the PMIC / ACPI hardware /
|
||||
code. But in the case of a GPIO button we need to explicitly suppress the
|
||||
sending of the input event.
|
||||
|
||||
This commit adds support for this by adding a no_wakeup_events bool to
|
||||
struct gpio_keys_button, which platform code can set to suppress the
|
||||
input events for presses of wakeup keys during suspend.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
Changes in v2:
|
||||
-This is a rewrite if my "Input: gpio_keys - Do not report wake button
|
||||
presses as evdev events" patch.
|
||||
-Instead of unconditionally ignoring presses of all wake-up buttons during
|
||||
suspend, this rewrite makes this configurable per button
|
||||
-This version uses a timer to delay clearing the suspended flag for software
|
||||
debouncing, rather then jiffy compare magic
|
||||
---
|
||||
drivers/input/keyboard/gpio_keys.c | 33 +++++++++++++++++++++++++++++++--
|
||||
include/linux/gpio_keys.h | 3 +++
|
||||
2 files changed, 34 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
|
||||
index a047b9af8369..fa3a58620407 100644
|
||||
--- a/drivers/input/keyboard/gpio_keys.c
|
||||
+++ b/drivers/input/keyboard/gpio_keys.c
|
||||
@@ -38,6 +38,7 @@ struct gpio_button_data {
|
||||
|
||||
unsigned short *code;
|
||||
|
||||
+ struct timer_list unsuspend_timer;
|
||||
struct timer_list release_timer;
|
||||
unsigned int release_delay; /* in msecs, for IRQ-only buttons */
|
||||
|
||||
@@ -371,6 +372,9 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (state && bdata->button->no_wakeup_events && bdata->suspended)
|
||||
+ return;
|
||||
+
|
||||
if (type == EV_ABS) {
|
||||
if (state)
|
||||
input_event(input, type, button->code, button->value);
|
||||
@@ -400,6 +404,9 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
|
||||
if (bdata->button->wakeup) {
|
||||
const struct gpio_keys_button *button = bdata->button;
|
||||
|
||||
+ if (bdata->button->no_wakeup_events && bdata->suspended)
|
||||
+ return IRQ_HANDLED;
|
||||
+
|
||||
pm_stay_awake(bdata->input->dev.parent);
|
||||
if (bdata->suspended &&
|
||||
(button->type == 0 || button->type == EV_KEY)) {
|
||||
@@ -445,9 +452,13 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
|
||||
spin_lock_irqsave(&bdata->lock, flags);
|
||||
|
||||
if (!bdata->key_pressed) {
|
||||
- if (bdata->button->wakeup)
|
||||
+ if (bdata->button->wakeup) {
|
||||
pm_wakeup_event(bdata->input->dev.parent, 0);
|
||||
|
||||
+ if (bdata->button->no_wakeup_events && bdata->suspended)
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
input_event(input, EV_KEY, *bdata->code, 1);
|
||||
input_sync(input);
|
||||
|
||||
@@ -468,6 +479,13 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
+static void gpio_keys_unsuspend_timer(unsigned long _data)
|
||||
+{
|
||||
+ struct gpio_button_data *bdata = (struct gpio_button_data *)_data;
|
||||
+
|
||||
+ bdata->suspended = false;
|
||||
+}
|
||||
+
|
||||
static void gpio_keys_quiesce_key(void *data)
|
||||
{
|
||||
struct gpio_button_data *bdata = data;
|
||||
@@ -476,6 +494,8 @@ static void gpio_keys_quiesce_key(void *data)
|
||||
cancel_delayed_work_sync(&bdata->work);
|
||||
else
|
||||
del_timer_sync(&bdata->release_timer);
|
||||
+
|
||||
+ del_timer_sync(&bdata->unsuspend_timer);
|
||||
}
|
||||
|
||||
static int gpio_keys_setup_key(struct platform_device *pdev,
|
||||
@@ -496,6 +516,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
|
||||
bdata->input = input;
|
||||
bdata->button = button;
|
||||
spin_lock_init(&bdata->lock);
|
||||
+ setup_timer(&bdata->unsuspend_timer, gpio_keys_unsuspend_timer,
|
||||
+ (unsigned long)bdata);
|
||||
|
||||
if (child) {
|
||||
bdata->gpiod = devm_fwnode_get_gpiod_from_child(dev, NULL,
|
||||
@@ -868,6 +890,7 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev)
|
||||
struct gpio_button_data *bdata = &ddata->data[i];
|
||||
if (bdata->button->wakeup)
|
||||
enable_irq_wake(bdata->irq);
|
||||
+ del_timer_sync(&bdata->unsuspend_timer);
|
||||
bdata->suspended = true;
|
||||
}
|
||||
} else {
|
||||
@@ -892,7 +915,13 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
|
||||
struct gpio_button_data *bdata = &ddata->data[i];
|
||||
if (bdata->button->wakeup)
|
||||
disable_irq_wake(bdata->irq);
|
||||
- bdata->suspended = false;
|
||||
+ if (bdata->button->no_wakeup_events) {
|
||||
+ mod_timer(&bdata->unsuspend_timer, jiffies +
|
||||
+ msecs_to_jiffies(
|
||||
+ bdata->software_debounce));
|
||||
+ } else {
|
||||
+ bdata->suspended = false;
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&input->mutex);
|
||||
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
|
||||
index 0b71024c082c..d8a85e52b6bb 100644
|
||||
--- a/include/linux/gpio_keys.h
|
||||
+++ b/include/linux/gpio_keys.h
|
||||
@@ -15,6 +15,8 @@ struct device;
|
||||
* @debounce_interval: debounce ticks interval in msecs
|
||||
* @can_disable: %true indicates that userspace is allowed to
|
||||
* disable button via sysfs
|
||||
+ * @no_wakeup_events: For wake-up source buttons only, if %true then no input
|
||||
+ * events will be generated if pressed while suspended
|
||||
* @value: axis value for %EV_ABS
|
||||
* @irq: Irq number in case of interrupt keys
|
||||
*/
|
||||
@@ -27,6 +29,7 @@ struct gpio_keys_button {
|
||||
int wakeup;
|
||||
int debounce_interval;
|
||||
bool can_disable;
|
||||
+ bool no_wakeup_events;
|
||||
int value;
|
||||
unsigned int irq;
|
||||
};
|
||||
--
|
||||
2.13.4
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
From 3ce5852ec6add45a28fe1706e9163351940e905c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 2 Oct 2017 18:25:29 -0400
|
||||
Subject: [PATCH 1/3] Make get_cert_list() not complain about cert lists that
|
||||
aren't present.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
certs/load_uefi.c | 37 ++++++++++++++++++++++---------------
|
||||
1 file changed, 22 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/certs/load_uefi.c b/certs/load_uefi.c
|
||||
index 3d884598601..9ef34c44fd1 100644
|
||||
--- a/certs/load_uefi.c
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -35,8 +35,8 @@ static __init bool uefi_check_ignore_db(void)
|
||||
/*
|
||||
* Get a certificate list blob from the named EFI variable.
|
||||
*/
|
||||
-static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
- unsigned long *size)
|
||||
+static __init int get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
+ unsigned long *size, void **cert_list)
|
||||
{
|
||||
efi_status_t status;
|
||||
unsigned long lsize = 4;
|
||||
@@ -44,26 +44,33 @@ static __init void *get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
void *db;
|
||||
|
||||
status = efi.get_variable(name, guid, NULL, &lsize, &tmpdb);
|
||||
+ if (status == EFI_NOT_FOUND) {
|
||||
+ *size = 0;
|
||||
+ *cert_list = NULL;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
pr_err("Couldn't get size: 0x%lx\n", status);
|
||||
- return NULL;
|
||||
+ return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
db = kmalloc(lsize, GFP_KERNEL);
|
||||
if (!db) {
|
||||
pr_err("Couldn't allocate memory for uefi cert list\n");
|
||||
- return NULL;
|
||||
+ return -ENOMEM;
|
||||
}
|
||||
|
||||
status = efi.get_variable(name, guid, NULL, &lsize, db);
|
||||
if (status != EFI_SUCCESS) {
|
||||
kfree(db);
|
||||
pr_err("Error reading db var: 0x%lx\n", status);
|
||||
- return NULL;
|
||||
+ return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
*size = lsize;
|
||||
- return db;
|
||||
+ *cert_list = db;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -152,10 +159,10 @@ static int __init load_uefi_certs(void)
|
||||
* an error if we can't get them.
|
||||
*/
|
||||
if (!uefi_check_ignore_db()) {
|
||||
- db = get_cert_list(L"db", &secure_var, &dbsize);
|
||||
- if (!db) {
|
||||
+ rc = get_cert_list(L"db", &secure_var, &dbsize, &db);
|
||||
+ if (rc < 0) {
|
||||
pr_err("MODSIGN: Couldn't get UEFI db list\n");
|
||||
- } else {
|
||||
+ } else if (dbsize != 0) {
|
||||
rc = parse_efi_signature_list("UEFI:db",
|
||||
db, dbsize, get_handler_for_db);
|
||||
if (rc)
|
||||
@@ -164,10 +171,10 @@ static int __init load_uefi_certs(void)
|
||||
}
|
||||
}
|
||||
|
||||
- mok = get_cert_list(L"MokListRT", &mok_var, &moksize);
|
||||
- if (!mok) {
|
||||
+ rc = get_cert_list(L"MokListRT", &mok_var, &moksize, &mok);
|
||||
+ if (rc < 0) {
|
||||
pr_info("MODSIGN: Couldn't get UEFI MokListRT\n");
|
||||
- } else {
|
||||
+ } else if (moksize != 0) {
|
||||
rc = parse_efi_signature_list("UEFI:MokListRT",
|
||||
mok, moksize, get_handler_for_db);
|
||||
if (rc)
|
||||
@@ -175,10 +182,10 @@ static int __init load_uefi_certs(void)
|
||||
kfree(mok);
|
||||
}
|
||||
|
||||
- dbx = get_cert_list(L"dbx", &secure_var, &dbxsize);
|
||||
- if (!dbx) {
|
||||
+ rc = get_cert_list(L"dbx", &secure_var, &dbxsize, &dbx);
|
||||
+ if (rc < 0) {
|
||||
pr_info("MODSIGN: Couldn't get UEFI dbx list\n");
|
||||
- } else {
|
||||
+ } else if (dbxsize != 0) {
|
||||
rc = parse_efi_signature_list("UEFI:dbx",
|
||||
dbx, dbxsize,
|
||||
get_handler_for_dbx);
|
||||
--
|
||||
2.15.0
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
From 37af97ef14c201b1db8dd341aabd262da23e48aa Mon Sep 17 00:00:00 2001
|
||||
From: Fedora Kernel Team <kernel-team@fedoraproject.org>
|
||||
Date: Mon, 30 Oct 2017 11:38:27 -0500
|
||||
Subject: [PATCH] [PATCH] staging: rtl8822be: fix wrong dma unmap len
|
||||
|
||||
Patch fixes splat:
|
||||
|
||||
r8822be 0000:04:00.0: DMA-API: device driver frees DMA memory with different size
|
||||
[device address=0x0000000078477000] [map size=4096 bytes] [unmap size=424 bytes]
|
||||
<snip>
|
||||
Call Trace:
|
||||
debug_dma_unmap_page+0xa5/0xb0
|
||||
? unmap_single+0x2f/0x40
|
||||
_rtl8822be_send_bcn_or_cmd_packet+0x2c5/0x300 [r8822be]
|
||||
? _rtl8822be_send_bcn_or_cmd_packet+0x2c5/0x300 [r8822be]
|
||||
rtl8822b_halmac_cb_write_data_rsvd_page+0x51/0xc0 [r8822be]
|
||||
_halmac_write_data_rsvd_page+0x22/0x30 [r8822be]
|
||||
halmac_download_rsvd_page_88xx+0xee/0x1f0 [r8822be]
|
||||
halmac_dlfw_to_mem_88xx+0x80/0x120 [r8822be]
|
||||
halmac_download_firmware_88xx.part.47+0x477/0x600 [r8822be]
|
||||
halmac_download_firmware_88xx+0x32/0x40 [r8822be]
|
||||
rtl_halmac_dlfw+0x70/0x120 [r8822be]
|
||||
rtl_halmac_init_hal+0x5f/0x1b0 [r8822be]
|
||||
rtl8822be_hw_init+0x8a2/0x1040 [r8822be]
|
||||
|
||||
Signed-off-by: Stanislaw Gruszka <sgruszka at redhat.com>
|
||||
---
|
||||
drivers/staging/rtlwifi/rtl8822be/fw.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/staging/rtlwifi/rtl8822be/fw.c b/drivers/staging/rtlwifi/rtl8822be/fw.c
|
||||
index 8e24da1..a2cc548 100644
|
||||
--- a/drivers/staging/rtlwifi/rtl8822be/fw.c
|
||||
+++ b/drivers/staging/rtlwifi/rtl8822be/fw.c
|
||||
@@ -419,7 +419,7 @@ static bool _rtl8822be_send_bcn_or_cmd_packet(struct ieee80211_hw *hw,
|
||||
dma_addr = rtlpriv->cfg->ops->get_desc(
|
||||
hw, (u8 *)pbd_desc, true, HW_DESC_TXBUFF_ADDR);
|
||||
|
||||
- pci_unmap_single(rtlpci->pdev, dma_addr, skb->len,
|
||||
+ pci_unmap_single(rtlpci->pdev, dma_addr, pskb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
kfree_skb(pskb);
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
From cb1072f66e72eda65a8f7ac37d32c9f4217af6ba Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Tue, 21 Nov 2017 14:44:15 +0100
|
||||
Subject: [PATCH 1/3] ahci: Annotate PCI ids for mobile Intel chipsets as such
|
||||
|
||||
Intel uses different SATA PCI ids for the Desktop and Mobile SKUs of their
|
||||
chipsets. For older models the comment describing which chipset the PCI id
|
||||
is for, aksi indicates when we're dealing with a mobile SKU. Extend the
|
||||
comments for recent chipsets to also indicate mobile SKUs.
|
||||
|
||||
The information this commit adds comes from Intel's chipset datasheets.
|
||||
|
||||
This commit is a preparation patch for allowing a different default
|
||||
sata link powermanagement policy for mobile chipsets.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/ata/ahci.c | 32 ++++++++++++++++----------------
|
||||
1 file changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
|
||||
index 5443cb71d7ba..9d842ff6ec51 100644
|
||||
--- a/drivers/ata/ahci.c
|
||||
+++ b/drivers/ata/ahci.c
|
||||
@@ -268,9 +268,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x3b23), board_ahci }, /* PCH AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x3b29), board_ahci }, /* PCH AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x3b29), board_ahci }, /* PCH M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */
|
||||
@@ -293,9 +293,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */
|
||||
@@ -304,20 +304,20 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e02), board_ahci }, /* Panther Point AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x1e03), board_ahci }, /* Panther Point AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1e03), board_ahci }, /* Panther Point M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e04), board_ahci }, /* Panther Point RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e0e), board_ahci }, /* Panther Point RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c02), board_ahci }, /* Lynx Point AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c03), board_ahci }, /* Lynx Point AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c03), board_ahci }, /* Lynx Point M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c04), board_ahci }, /* Lynx Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c05), board_ahci }, /* Lynx Point RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c05), board_ahci }, /* Lynx Point M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c06), board_ahci }, /* Lynx Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c07), board_ahci }, /* Lynx Point RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c07), board_ahci }, /* Lynx Point M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c0e), board_ahci }, /* Lynx Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c0f), board_ahci }, /* Lynx Point RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c0f), board_ahci }, /* Lynx Point M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x9c02), board_ahci }, /* Lynx Point-LP AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x9c03), board_ahci }, /* Lynx Point-LP AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x9c04), board_ahci }, /* Lynx Point-LP RAID */
|
||||
@@ -358,21 +358,21 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa102), board_ahci }, /* Sunrise Point-H AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa106), board_ahci }, /* Sunrise Point-H RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* Lewisburg RAID*/
|
||||
{ PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Lewisburg AHCI*/
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
From 6399f1fae4ec29fab5ec76070435555e256ca3a6 Mon Sep 17 00:00:00 2001
|
||||
From: Sabrina Dubroca <sd@queasysnail.net>
|
||||
Date: Wed, 19 Jul 2017 22:28:55 +0200
|
||||
Subject: [PATCH] ipv6: avoid overflow of offset in ip6_find_1stfragopt
|
||||
|
||||
In some cases, offset can overflow and can cause an infinite loop in
|
||||
ip6_find_1stfragopt(). Make it unsigned int to prevent the overflow, and
|
||||
cap it at IPV6_MAXPLEN, since packets larger than that should be invalid.
|
||||
|
||||
This problem has been here since before the beginning of git history.
|
||||
|
||||
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
|
||||
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
net/ipv6/output_core.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c
|
||||
index e9065b8..abb2c30 100644
|
||||
--- a/net/ipv6/output_core.c
|
||||
+++ b/net/ipv6/output_core.c
|
||||
@@ -78,7 +78,7 @@ EXPORT_SYMBOL(ipv6_select_ident);
|
||||
|
||||
int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
|
||||
{
|
||||
- u16 offset = sizeof(struct ipv6hdr);
|
||||
+ unsigned int offset = sizeof(struct ipv6hdr);
|
||||
unsigned int packet_len = skb_tail_pointer(skb) -
|
||||
skb_network_header(skb);
|
||||
int found_rhdr = 0;
|
||||
@@ -86,6 +86,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
|
||||
|
||||
while (offset <= packet_len) {
|
||||
struct ipv6_opt_hdr *exthdr;
|
||||
+ unsigned int len;
|
||||
|
||||
switch (**nexthdr) {
|
||||
|
||||
@@ -111,7 +112,10 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
|
||||
|
||||
exthdr = (struct ipv6_opt_hdr *)(skb_network_header(skb) +
|
||||
offset);
|
||||
- offset += ipv6_optlen(exthdr);
|
||||
+ len = ipv6_optlen(exthdr);
|
||||
+ if (len + offset >= IPV6_MAXPLEN)
|
||||
+ return -EINVAL;
|
||||
+ offset += len;
|
||||
*nexthdr = &exthdr->nexthdr;
|
||||
}
|
||||
|
||||
--
|
||||
2.9.4
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
From a8f97366452ed491d13cf1e44241bc0b5740b1f0 Mon Sep 17 00:00:00 2001
|
||||
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
|
||||
Date: Mon, 27 Nov 2017 06:21:25 +0300
|
||||
Subject: [PATCH] mm, thp: Do not make page table dirty unconditionally in
|
||||
touch_p[mu]d()
|
||||
|
||||
Currently, we unconditionally make page table dirty in touch_pmd().
|
||||
It may result in false-positive can_follow_write_pmd().
|
||||
|
||||
We may avoid the situation, if we would only make the page table entry
|
||||
dirty if caller asks for write access -- FOLL_WRITE.
|
||||
|
||||
The patch also changes touch_pud() in the same way.
|
||||
|
||||
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
|
||||
Cc: Michal Hocko <mhocko@suse.com>
|
||||
Cc: Hugh Dickins <hughd@google.com>
|
||||
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
---
|
||||
mm/huge_memory.c | 36 +++++++++++++-----------------------
|
||||
1 file changed, 13 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
|
||||
index 86fe697e8bfb..0e7ded98d114 100644
|
||||
--- a/mm/huge_memory.c
|
||||
+++ b/mm/huge_memory.c
|
||||
@@ -842,20 +842,15 @@ EXPORT_SYMBOL_GPL(vmf_insert_pfn_pud);
|
||||
#endif /* CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD */
|
||||
|
||||
static void touch_pmd(struct vm_area_struct *vma, unsigned long addr,
|
||||
- pmd_t *pmd)
|
||||
+ pmd_t *pmd, int flags)
|
||||
{
|
||||
pmd_t _pmd;
|
||||
|
||||
- /*
|
||||
- * We should set the dirty bit only for FOLL_WRITE but for now
|
||||
- * the dirty bit in the pmd is meaningless. And if the dirty
|
||||
- * bit will become meaningful and we'll only set it with
|
||||
- * FOLL_WRITE, an atomic set_bit will be required on the pmd to
|
||||
- * set the young bit, instead of the current set_pmd_at.
|
||||
- */
|
||||
- _pmd = pmd_mkyoung(pmd_mkdirty(*pmd));
|
||||
+ _pmd = pmd_mkyoung(*pmd);
|
||||
+ if (flags & FOLL_WRITE)
|
||||
+ _pmd = pmd_mkdirty(_pmd);
|
||||
if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK,
|
||||
- pmd, _pmd, 1))
|
||||
+ pmd, _pmd, flags & FOLL_WRITE))
|
||||
update_mmu_cache_pmd(vma, addr, pmd);
|
||||
}
|
||||
|
||||
@@ -884,7 +879,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
|
||||
return NULL;
|
||||
|
||||
if (flags & FOLL_TOUCH)
|
||||
- touch_pmd(vma, addr, pmd);
|
||||
+ touch_pmd(vma, addr, pmd, flags);
|
||||
|
||||
/*
|
||||
* device mapped pages can only be returned if the
|
||||
@@ -995,20 +990,15 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
|
||||
|
||||
#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
|
||||
static void touch_pud(struct vm_area_struct *vma, unsigned long addr,
|
||||
- pud_t *pud)
|
||||
+ pud_t *pud, int flags)
|
||||
{
|
||||
pud_t _pud;
|
||||
|
||||
- /*
|
||||
- * We should set the dirty bit only for FOLL_WRITE but for now
|
||||
- * the dirty bit in the pud is meaningless. And if the dirty
|
||||
- * bit will become meaningful and we'll only set it with
|
||||
- * FOLL_WRITE, an atomic set_bit will be required on the pud to
|
||||
- * set the young bit, instead of the current set_pud_at.
|
||||
- */
|
||||
- _pud = pud_mkyoung(pud_mkdirty(*pud));
|
||||
+ _pud = pud_mkyoung(*pud);
|
||||
+ if (flags & FOLL_WRITE)
|
||||
+ _pud = pud_mkdirty(_pud);
|
||||
if (pudp_set_access_flags(vma, addr & HPAGE_PUD_MASK,
|
||||
- pud, _pud, 1))
|
||||
+ pud, _pud, flags & FOLL_WRITE))
|
||||
update_mmu_cache_pud(vma, addr, pud);
|
||||
}
|
||||
|
||||
@@ -1031,7 +1021,7 @@ struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
|
||||
return NULL;
|
||||
|
||||
if (flags & FOLL_TOUCH)
|
||||
- touch_pud(vma, addr, pud);
|
||||
+ touch_pud(vma, addr, pud, flags);
|
||||
|
||||
/*
|
||||
* device mapped pages can only be returned if the
|
||||
@@ -1424,7 +1414,7 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
|
||||
page = pmd_page(*pmd);
|
||||
VM_BUG_ON_PAGE(!PageHead(page) && !is_zone_device_page(page), page);
|
||||
if (flags & FOLL_TOUCH)
|
||||
- touch_pmd(vma, addr, pmd);
|
||||
+ touch_pmd(vma, addr, pmd, flags);
|
||||
if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) {
|
||||
/*
|
||||
* We don't mlock() pte-mapped THPs. This way we can avoid
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,339 +0,0 @@
|
|||
From 3bbfe49a1d965b951527cde0da48f5d7677db264 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sun, 21 May 2017 13:15:11 +0200
|
||||
Subject: [PATCH 01/16] platform/x86: Add driver for ACPI INT0002 Virtual GPIO
|
||||
device
|
||||
|
||||
Some peripherals on Bay Trail and Cherry Trail platforms signal a
|
||||
Power Management Event (PME) to the Power Management Controller (PMC)
|
||||
to wakeup the system. When this happens software needs to explicitly
|
||||
clear the PME bus 0 status bit in the GPE0a_STS register to avoid an
|
||||
IRQ storm on IRQ 9.
|
||||
|
||||
This is modelled in ACPI through the INT0002 ACPI device, which is
|
||||
called a "Virtual GPIO controller" in ACPI because it defines the
|
||||
event handler to call when the PME triggers through _AEI and _L02
|
||||
methods as would be done for a real GPIO interrupt in ACPI.
|
||||
|
||||
This commit adds a driver which registers the Virtual GPIOs expected
|
||||
by the DSDT on these devices, letting gpiolib-acpi claim the
|
||||
virtual GPIO and install a GPIO-interrupt handler which call the _L02
|
||||
handler as it would for a real GPIO controller.
|
||||
|
||||
Cc: joeyli <jlee@suse.com>
|
||||
Cc: Takashi Iwai <tiwai@suse.de>
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
||||
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
||||
---
|
||||
Changes in v2:
|
||||
-Remove dev_err after malloc failure
|
||||
-Remove unused empty runtime pm callbacks
|
||||
-s/GPE0A_PME_/GPE0A_PME_B0_/
|
||||
-Fixed some checkpatch warnings (I forgot to run checkpatch on v1)
|
||||
|
||||
Changes in v3:
|
||||
-Rewrite as gpiochip driver letting gpiolib-acpi deal with claiming the pin
|
||||
0x0002 and calling the _L02 event handler when the virtual gpio-irq triggers
|
||||
-Rebase on 4.12-rc1
|
||||
|
||||
Changes in v4:
|
||||
-Drop device_init_wakeup() from _probe(), use pm_system_wakeup() instead
|
||||
of pm_wakeup_hard_event(chip->parent)
|
||||
-Improve commit message
|
||||
|
||||
Changes in v5:
|
||||
-Use BIT() macro for FOO_BIT defines
|
||||
-Drop unneeded ACPI_PTR macro usage
|
||||
|
||||
Changes in v6:
|
||||
-Move back to drivers/platform/x86
|
||||
-Expand certain acronyms (PME, PMC)
|
||||
-Use linux/gpio/driver.h include instead of linux/gpio.h
|
||||
-Document why the get / set / direction_output functions are dummys
|
||||
-No functional changes
|
||||
|
||||
Changes in v7:
|
||||
-Some minor cleanups from Andy:
|
||||
-Move asm/ includes below linux/ includes
|
||||
-s/APCI/ACPI/
|
||||
-Use bitmap_clear on chip->irq_valid_mask
|
||||
-Add Linus Walleij's Reviewed-by
|
||||
---
|
||||
drivers/platform/x86/Kconfig | 19 +++
|
||||
drivers/platform/x86/Makefile | 1 +
|
||||
drivers/platform/x86/intel_int0002_vgpio.c | 219 +++++++++++++++++++++++++++++
|
||||
3 files changed, 239 insertions(+)
|
||||
create mode 100644 drivers/platform/x86/intel_int0002_vgpio.c
|
||||
|
||||
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
|
||||
index 8489020ecf44..a3ccc3c795a5 100644
|
||||
--- a/drivers/platform/x86/Kconfig
|
||||
+++ b/drivers/platform/x86/Kconfig
|
||||
@@ -794,6 +794,25 @@ config INTEL_CHT_INT33FE
|
||||
This driver instantiates i2c-clients for these, so that standard
|
||||
i2c drivers for these chips can bind to the them.
|
||||
|
||||
+config INTEL_INT0002_VGPIO
|
||||
+ tristate "Intel ACPI INT0002 Virtual GPIO driver"
|
||||
+ depends on GPIOLIB && ACPI
|
||||
+ select GPIOLIB_IRQCHIP
|
||||
+ ---help---
|
||||
+ Some peripherals on Bay Trail and Cherry Trail platforms signal a
|
||||
+ Power Management Event (PME) to the Power Management Controller (PMC)
|
||||
+ to wakeup the system. When this happens software needs to explicitly
|
||||
+ clear the PME bus 0 status bit in the GPE0a_STS register to avoid an
|
||||
+ IRQ storm on IRQ 9.
|
||||
+
|
||||
+ This is modelled in ACPI through the INT0002 ACPI device, which is
|
||||
+ called a "Virtual GPIO controller" in ACPI because it defines the
|
||||
+ event handler to call when the PME triggers through _AEI and _L02
|
||||
+ methods as would be done for a real GPIO interrupt in ACPI.
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the module will
|
||||
+ be called intel_int0002_vgpio.
|
||||
+
|
||||
config INTEL_HID_EVENT
|
||||
tristate "INTEL HID Event"
|
||||
depends on ACPI
|
||||
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
|
||||
index 182a3ed6605a..ab22ce77fb66 100644
|
||||
--- a/drivers/platform/x86/Makefile
|
||||
+++ b/drivers/platform/x86/Makefile
|
||||
@@ -46,6 +46,7 @@ obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o
|
||||
obj-$(CONFIG_TOSHIBA_HAPS) += toshiba_haps.o
|
||||
obj-$(CONFIG_TOSHIBA_WMI) += toshiba-wmi.o
|
||||
obj-$(CONFIG_INTEL_CHT_INT33FE) += intel_cht_int33fe.o
|
||||
+obj-$(CONFIG_INTEL_INT0002_VGPIO) += intel_int0002_vgpio.o
|
||||
obj-$(CONFIG_INTEL_HID_EVENT) += intel-hid.o
|
||||
obj-$(CONFIG_INTEL_VBTN) += intel-vbtn.o
|
||||
obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o
|
||||
diff --git a/drivers/platform/x86/intel_int0002_vgpio.c b/drivers/platform/x86/intel_int0002_vgpio.c
|
||||
new file mode 100644
|
||||
index 000000000000..92dc230ef5b2
|
||||
--- /dev/null
|
||||
+++ b/drivers/platform/x86/intel_int0002_vgpio.c
|
||||
@@ -0,0 +1,219 @@
|
||||
+/*
|
||||
+ * Intel INT0002 "Virtual GPIO" driver
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
|
||||
+ *
|
||||
+ * Loosely based on android x86 kernel code which is:
|
||||
+ *
|
||||
+ * Copyright (c) 2014, Intel Corporation.
|
||||
+ *
|
||||
+ * Author: Dyut Kumar Sil <dyut.k.sil@intel.com>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * Some peripherals on Bay Trail and Cherry Trail platforms signal a Power
|
||||
+ * Management Event (PME) to the Power Management Controller (PMC) to wakeup
|
||||
+ * the system. When this happens software needs to clear the PME bus 0 status
|
||||
+ * bit in the GPE0a_STS register to avoid an IRQ storm on IRQ 9.
|
||||
+ *
|
||||
+ * This is modelled in ACPI through the INT0002 ACPI device, which is
|
||||
+ * called a "Virtual GPIO controller" in ACPI because it defines the event
|
||||
+ * handler to call when the PME triggers through _AEI and _L02 / _E02
|
||||
+ * methods as would be done for a real GPIO interrupt in ACPI. Note this
|
||||
+ * is a hack to define an AML event handler for the PME while using existing
|
||||
+ * ACPI mechanisms, this is not a real GPIO at all.
|
||||
+ *
|
||||
+ * This driver will bind to the INT0002 device, and register as a GPIO
|
||||
+ * controller, letting gpiolib-acpi.c call the _L02 handler as it would
|
||||
+ * for a real GPIO controller.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/acpi.h>
|
||||
+#include <linux/bitmap.h>
|
||||
+#include <linux/gpio/driver.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/suspend.h>
|
||||
+
|
||||
+#include <asm/cpu_device_id.h>
|
||||
+#include <asm/intel-family.h>
|
||||
+
|
||||
+#define DRV_NAME "INT0002 Virtual GPIO"
|
||||
+
|
||||
+/* For some reason the virtual GPIO pin tied to the GPE is numbered pin 2 */
|
||||
+#define GPE0A_PME_B0_VIRT_GPIO_PIN 2
|
||||
+
|
||||
+#define GPE0A_PME_B0_STS_BIT BIT(13)
|
||||
+#define GPE0A_PME_B0_EN_BIT BIT(13)
|
||||
+#define GPE0A_STS_PORT 0x420
|
||||
+#define GPE0A_EN_PORT 0x428
|
||||
+
|
||||
+#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, }
|
||||
+
|
||||
+static const struct x86_cpu_id int0002_cpu_ids[] = {
|
||||
+/*
|
||||
+ * Limit ourselves to Cherry Trail for now, until testing shows we
|
||||
+ * need to handle the INT0002 device on Baytrail too.
|
||||
+ * ICPU(INTEL_FAM6_ATOM_SILVERMONT1), * Valleyview, Bay Trail *
|
||||
+ */
|
||||
+ ICPU(INTEL_FAM6_ATOM_AIRMONT), /* Braswell, Cherry Trail */
|
||||
+ {}
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * As this is not a real GPIO at all, but just a hack to model an event in
|
||||
+ * ACPI the get / set functions are dummy functions.
|
||||
+ */
|
||||
+
|
||||
+static int int0002_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void int0002_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||
+ int value)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static int int0002_gpio_direction_output(struct gpio_chip *chip,
|
||||
+ unsigned int offset, int value)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void int0002_irq_ack(struct irq_data *data)
|
||||
+{
|
||||
+ outl(GPE0A_PME_B0_STS_BIT, GPE0A_STS_PORT);
|
||||
+}
|
||||
+
|
||||
+static void int0002_irq_unmask(struct irq_data *data)
|
||||
+{
|
||||
+ u32 gpe_en_reg;
|
||||
+
|
||||
+ gpe_en_reg = inl(GPE0A_EN_PORT);
|
||||
+ gpe_en_reg |= GPE0A_PME_B0_EN_BIT;
|
||||
+ outl(gpe_en_reg, GPE0A_EN_PORT);
|
||||
+}
|
||||
+
|
||||
+static void int0002_irq_mask(struct irq_data *data)
|
||||
+{
|
||||
+ u32 gpe_en_reg;
|
||||
+
|
||||
+ gpe_en_reg = inl(GPE0A_EN_PORT);
|
||||
+ gpe_en_reg &= ~GPE0A_PME_B0_EN_BIT;
|
||||
+ outl(gpe_en_reg, GPE0A_EN_PORT);
|
||||
+}
|
||||
+
|
||||
+static irqreturn_t int0002_irq(int irq, void *data)
|
||||
+{
|
||||
+ struct gpio_chip *chip = data;
|
||||
+ u32 gpe_sts_reg;
|
||||
+
|
||||
+ gpe_sts_reg = inl(GPE0A_STS_PORT);
|
||||
+ if (!(gpe_sts_reg & GPE0A_PME_B0_STS_BIT))
|
||||
+ return IRQ_NONE;
|
||||
+
|
||||
+ generic_handle_irq(irq_find_mapping(chip->irqdomain,
|
||||
+ GPE0A_PME_B0_VIRT_GPIO_PIN));
|
||||
+
|
||||
+ pm_system_wakeup();
|
||||
+
|
||||
+ return IRQ_HANDLED;
|
||||
+}
|
||||
+
|
||||
+static struct irq_chip int0002_irqchip = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .irq_ack = int0002_irq_ack,
|
||||
+ .irq_mask = int0002_irq_mask,
|
||||
+ .irq_unmask = int0002_irq_unmask,
|
||||
+};
|
||||
+
|
||||
+static int int0002_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ const struct x86_cpu_id *cpu_id;
|
||||
+ struct gpio_chip *chip;
|
||||
+ int irq, ret;
|
||||
+
|
||||
+ /* Menlow has a different INT0002 device? <sigh> */
|
||||
+ cpu_id = x86_match_cpu(int0002_cpu_ids);
|
||||
+ if (!cpu_id)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ irq = platform_get_irq(pdev, 0);
|
||||
+ if (irq < 0) {
|
||||
+ dev_err(dev, "Error getting IRQ: %d\n", irq);
|
||||
+ return irq;
|
||||
+ }
|
||||
+
|
||||
+ chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
|
||||
+ if (!chip)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ chip->label = DRV_NAME;
|
||||
+ chip->parent = dev;
|
||||
+ chip->owner = THIS_MODULE;
|
||||
+ chip->get = int0002_gpio_get;
|
||||
+ chip->set = int0002_gpio_set;
|
||||
+ chip->direction_input = int0002_gpio_get;
|
||||
+ chip->direction_output = int0002_gpio_direction_output;
|
||||
+ chip->base = -1;
|
||||
+ chip->ngpio = GPE0A_PME_B0_VIRT_GPIO_PIN + 1;
|
||||
+ chip->irq_need_valid_mask = true;
|
||||
+
|
||||
+ ret = devm_gpiochip_add_data(&pdev->dev, chip, NULL);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Error adding gpio chip: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ bitmap_clear(chip->irq_valid_mask, 0, GPE0A_PME_B0_VIRT_GPIO_PIN);
|
||||
+
|
||||
+ /*
|
||||
+ * We manually request the irq here instead of passing a flow-handler
|
||||
+ * to gpiochip_set_chained_irqchip, because the irq is shared.
|
||||
+ */
|
||||
+ ret = devm_request_irq(dev, irq, int0002_irq,
|
||||
+ IRQF_SHARED | IRQF_NO_THREAD, "INT0002", chip);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Error requesting IRQ %d: %d\n", irq, ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = gpiochip_irqchip_add(chip, &int0002_irqchip, 0, handle_edge_irq,
|
||||
+ IRQ_TYPE_NONE);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Error adding irqchip: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ gpiochip_set_chained_irqchip(chip, &int0002_irqchip, irq, NULL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct acpi_device_id int0002_acpi_ids[] = {
|
||||
+ { "INT0002", 0 },
|
||||
+ { },
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(acpi, int0002_acpi_ids);
|
||||
+
|
||||
+static struct platform_driver int0002_driver = {
|
||||
+ .driver = {
|
||||
+ .name = DRV_NAME,
|
||||
+ .acpi_match_table = int0002_acpi_ids,
|
||||
+ },
|
||||
+ .probe = int0002_probe,
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(int0002_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
|
||||
+MODULE_DESCRIPTION("Intel INT0002 Virtual GPIO driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
From 714fe15daa07e7691c9731c88de71aa57f84b6c2 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 3 Jan 2018 11:13:54 +0100
|
||||
Subject: [PATCH] platform/x86: dell-laptop: Filter out spurious keyboard
|
||||
backlight change events
|
||||
|
||||
On some Dell XPS models WMI events of type 0x0000 reporting a keycode of
|
||||
0xe00c get reported when the brightness of the LCD panel changes.
|
||||
|
||||
This leads to us reporting false-positive kbd_led change events to
|
||||
userspace which in turn leads to the kbd backlight OSD showing when it
|
||||
should not.
|
||||
|
||||
We already read the current keyboard backlight brightness value when
|
||||
reporting events because the led_classdev_notify_brightness_hw_changed
|
||||
API requires this. Compare this value to the last known value and filter
|
||||
out duplicate events, fixing this.
|
||||
|
||||
Note the fixed issue is esp. a problem on XPS models with an ambient light
|
||||
sensor and automatic brightness adjustments turned on, this causes the kbd
|
||||
backlight OSD to show all the time there.
|
||||
|
||||
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514969
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/platform/x86/dell-laptop.c | 24 ++++++++++++++++++++++--
|
||||
1 file changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
|
||||
index cd4725e7e0b5..2ef3297a9efc 100644
|
||||
--- a/drivers/platform/x86/dell-laptop.c
|
||||
+++ b/drivers/platform/x86/dell-laptop.c
|
||||
@@ -1133,6 +1133,7 @@ static u8 kbd_previous_mode_bit;
|
||||
|
||||
static bool kbd_led_present;
|
||||
static DEFINE_MUTEX(kbd_led_mutex);
|
||||
+static enum led_brightness kbd_led_level;
|
||||
|
||||
/*
|
||||
* NOTE: there are three ways to set the keyboard backlight level.
|
||||
@@ -1947,6 +1948,7 @@ static enum led_brightness kbd_led_level_get(struct led_classdev *led_cdev)
|
||||
static int kbd_led_level_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness value)
|
||||
{
|
||||
+ enum led_brightness new_value = value;
|
||||
struct kbd_state state;
|
||||
struct kbd_state new_state;
|
||||
u16 num;
|
||||
@@ -1976,6 +1978,9 @@ static int kbd_led_level_set(struct led_classdev *led_cdev,
|
||||
}
|
||||
|
||||
out:
|
||||
+ if (ret == 0)
|
||||
+ kbd_led_level = new_value;
|
||||
+
|
||||
mutex_unlock(&kbd_led_mutex);
|
||||
return ret;
|
||||
}
|
||||
@@ -2003,6 +2008,9 @@ static int __init kbd_led_init(struct device *dev)
|
||||
if (kbd_led.max_brightness)
|
||||
kbd_led.max_brightness--;
|
||||
}
|
||||
+
|
||||
+ kbd_led_level = kbd_led_level_get(NULL);
|
||||
+
|
||||
ret = led_classdev_register(dev, &kbd_led);
|
||||
if (ret)
|
||||
kbd_led_present = false;
|
||||
@@ -2027,13 +2035,25 @@ static void kbd_led_exit(void)
|
||||
static int dell_laptop_notifier_call(struct notifier_block *nb,
|
||||
unsigned long action, void *data)
|
||||
{
|
||||
+ bool changed = false;
|
||||
+ enum led_brightness new_kbd_led_level;
|
||||
+
|
||||
switch (action) {
|
||||
case DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED:
|
||||
if (!kbd_led_present)
|
||||
break;
|
||||
|
||||
- led_classdev_notify_brightness_hw_changed(&kbd_led,
|
||||
- kbd_led_level_get(&kbd_led));
|
||||
+ mutex_lock(&kbd_led_mutex);
|
||||
+ new_kbd_led_level = kbd_led_level_get(&kbd_led);
|
||||
+ if (kbd_led_level != new_kbd_led_level) {
|
||||
+ kbd_led_level = new_kbd_led_level;
|
||||
+ changed = true;
|
||||
+ }
|
||||
+ mutex_unlock(&kbd_led_mutex);
|
||||
+
|
||||
+ if (changed)
|
||||
+ led_classdev_notify_brightness_hw_changed(&kbd_led,
|
||||
+ kbd_led_level);
|
||||
break;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -0,0 +1,183 @@
|
|||
From c8218e9b3c38fcd36a2d06eec09952a0c6cee9e0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 2 Oct 2017 18:22:13 -0400
|
||||
Subject: [PATCH 2/3] Add efi_status_to_str() and rework efi_status_to_err().
|
||||
|
||||
This adds efi_status_to_str() for use when printing efi_status_t
|
||||
messages, and reworks efi_status_to_err() so that the two use a common
|
||||
list of errors.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
include/linux/efi.h | 3 ++
|
||||
drivers/firmware/efi/efi.c | 122 ++++++++++++++++++++++++++++++++++-----------
|
||||
2 files changed, 95 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/include/linux/efi.h b/include/linux/efi.h
|
||||
index 18b16bf5ce1..436b3c93c3d 100644
|
||||
--- a/include/linux/efi.h
|
||||
+++ b/include/linux/efi.h
|
||||
@@ -42,6 +42,8 @@
|
||||
#define EFI_ABORTED (21 | (1UL << (BITS_PER_LONG-1)))
|
||||
#define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1)))
|
||||
|
||||
+#define EFI_IS_ERROR(x) ((x) & (1UL << (BITS_PER_LONG-1)))
|
||||
+
|
||||
typedef unsigned long efi_status_t;
|
||||
typedef u8 efi_bool_t;
|
||||
typedef u16 efi_char16_t; /* UNICODE character */
|
||||
@@ -1183,6 +1185,7 @@ static inline void efi_set_secure_boot(enum efi_secureboot_mode mode) {}
|
||||
#endif
|
||||
|
||||
extern int efi_status_to_err(efi_status_t status);
|
||||
+extern const char *efi_status_to_str(efi_status_t status);
|
||||
|
||||
/*
|
||||
* Variable Attributes
|
||||
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
|
||||
index 557a47829d0..e8f9c7d84e9 100644
|
||||
--- a/drivers/firmware/efi/efi.c
|
||||
+++ b/drivers/firmware/efi/efi.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/ucs2_string.h>
|
||||
#include <linux/memblock.h>
|
||||
+#include <linux/bsearch.h>
|
||||
|
||||
#include <asm/early_ioremap.h>
|
||||
|
||||
@@ -865,40 +866,101 @@ int efi_mem_type(unsigned long phys_addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
+struct efi_error_code {
|
||||
+ efi_status_t status;
|
||||
+ int errno;
|
||||
+ const char *description;
|
||||
+};
|
||||
+
|
||||
+static const struct efi_error_code efi_error_codes[] = {
|
||||
+ { EFI_SUCCESS, 0, "Success"},
|
||||
+#if 0
|
||||
+ { EFI_LOAD_ERROR, -EPICK_AN_ERRNO, "Load Error"},
|
||||
+#endif
|
||||
+ { EFI_INVALID_PARAMETER, -EINVAL, "Invalid Parameter"},
|
||||
+ { EFI_UNSUPPORTED, -ENOSYS, "Unsupported"},
|
||||
+ { EFI_BAD_BUFFER_SIZE, -ENOSPC, "Bad Buffer Size"},
|
||||
+ { EFI_BUFFER_TOO_SMALL, -ENOSPC, "Buffer Too Small"},
|
||||
+ { EFI_NOT_READY, -EAGAIN, "Not Ready"},
|
||||
+ { EFI_DEVICE_ERROR, -EIO, "Device Error"},
|
||||
+ { EFI_WRITE_PROTECTED, -EROFS, "Write Protected"},
|
||||
+ { EFI_OUT_OF_RESOURCES, -ENOMEM, "Out of Resources"},
|
||||
+#if 0
|
||||
+ { EFI_VOLUME_CORRUPTED, -EPICK_AN_ERRNO, "Volume Corrupt"},
|
||||
+ { EFI_VOLUME_FULL, -EPICK_AN_ERRNO, "Volume Full"},
|
||||
+ { EFI_NO_MEDIA, -EPICK_AN_ERRNO, "No Media"},
|
||||
+ { EFI_MEDIA_CHANGED, -EPICK_AN_ERRNO, "Media changed"},
|
||||
+#endif
|
||||
+ { EFI_NOT_FOUND, -ENOENT, "Not Found"},
|
||||
+#if 0
|
||||
+ { EFI_ACCESS_DENIED, -EPICK_AN_ERRNO, "Access Denied"},
|
||||
+ { EFI_NO_RESPONSE, -EPICK_AN_ERRNO, "No Response"},
|
||||
+ { EFI_NO_MAPPING, -EPICK_AN_ERRNO, "No mapping"},
|
||||
+ { EFI_TIMEOUT, -EPICK_AN_ERRNO, "Time out"},
|
||||
+ { EFI_NOT_STARTED, -EPICK_AN_ERRNO, "Not started"},
|
||||
+ { EFI_ALREADY_STARTED, -EPICK_AN_ERRNO, "Already started"},
|
||||
+#endif
|
||||
+ { EFI_ABORTED, -EINTR, "Aborted"},
|
||||
+#if 0
|
||||
+ { EFI_ICMP_ERROR, -EPICK_AN_ERRNO, "ICMP Error"},
|
||||
+ { EFI_TFTP_ERROR, -EPICK_AN_ERRNO, "TFTP Error"},
|
||||
+ { EFI_PROTOCOL_ERROR, -EPICK_AN_ERRNO, "Protocol Error"},
|
||||
+ { EFI_INCOMPATIBLE_VERSION, -EPICK_AN_ERRNO, "Incompatible Version"},
|
||||
+#endif
|
||||
+ { EFI_SECURITY_VIOLATION, -EACCES, "Security Policy Violation"},
|
||||
+#if 0
|
||||
+ { EFI_CRC_ERROR, -EPICK_AN_ERRNO, "CRC Error"},
|
||||
+ { EFI_END_OF_MEDIA, -EPICK_AN_ERRNO, "End of Media"},
|
||||
+ { EFI_END_OF_FILE, -EPICK_AN_ERRNO, "End of File"},
|
||||
+ { EFI_INVALID_LANGUAGE, -EPICK_AN_ERRNO, "Invalid Languages"},
|
||||
+ { EFI_COMPROMISED_DATA, -EPICK_AN_ERRNO, "Compromised Data"},
|
||||
+
|
||||
+ // warnings
|
||||
+ { EFI_WARN_UNKOWN_GLYPH, -EPICK_AN_ERRNO, "Warning Unknown Glyph"},
|
||||
+ { EFI_WARN_DELETE_FAILURE, -EPICK_AN_ERRNO, "Warning Delete Failure"},
|
||||
+ { EFI_WARN_WRITE_FAILURE, -EPICK_AN_ERRNO, "Warning Write Failure"},
|
||||
+ { EFI_WARN_BUFFER_TOO_SMALL, -EPICK_AN_ERRNO, "Warning Buffer Too Small"},
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+static int
|
||||
+efi_status_cmp_bsearch(const void *key, const void *item)
|
||||
+{
|
||||
+ u64 status = (u64)(uintptr_t)key;
|
||||
+ struct efi_error_code *code = (struct efi_error_code *)item;
|
||||
+
|
||||
+ if (status < code->status)
|
||||
+ return -1;
|
||||
+ if (status > code->status)
|
||||
+ return 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int efi_status_to_err(efi_status_t status)
|
||||
{
|
||||
- int err;
|
||||
+ struct efi_error_code *found;
|
||||
+ size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
|
||||
|
||||
- switch (status) {
|
||||
- case EFI_SUCCESS:
|
||||
- err = 0;
|
||||
- break;
|
||||
- case EFI_INVALID_PARAMETER:
|
||||
- err = -EINVAL;
|
||||
- break;
|
||||
- case EFI_OUT_OF_RESOURCES:
|
||||
- err = -ENOSPC;
|
||||
- break;
|
||||
- case EFI_DEVICE_ERROR:
|
||||
- err = -EIO;
|
||||
- break;
|
||||
- case EFI_WRITE_PROTECTED:
|
||||
- err = -EROFS;
|
||||
- break;
|
||||
- case EFI_SECURITY_VIOLATION:
|
||||
- err = -EACCES;
|
||||
- break;
|
||||
- case EFI_NOT_FOUND:
|
||||
- err = -ENOENT;
|
||||
- break;
|
||||
- case EFI_ABORTED:
|
||||
- err = -EINTR;
|
||||
- break;
|
||||
- default:
|
||||
- err = -EINVAL;
|
||||
- }
|
||||
+ found = bsearch((void *)(uintptr_t)status, efi_error_codes,
|
||||
+ sizeof(struct efi_error_code), num,
|
||||
+ efi_status_cmp_bsearch);
|
||||
+ if (!found)
|
||||
+ return -EINVAL;
|
||||
+ return found->errno;
|
||||
+}
|
||||
|
||||
- return err;
|
||||
+const char *
|
||||
+efi_status_to_str(efi_status_t status)
|
||||
+{
|
||||
+ struct efi_error_code *found;
|
||||
+ size_t num = sizeof(efi_error_codes) / sizeof(struct efi_error_code);
|
||||
+
|
||||
+ found = bsearch((void *)(uintptr_t)status, efi_error_codes,
|
||||
+ sizeof(struct efi_error_code), num,
|
||||
+ efi_status_cmp_bsearch);
|
||||
+ if (!found)
|
||||
+ return "Unknown error code";
|
||||
+ return found->description;
|
||||
}
|
||||
|
||||
bool efi_is_table_address(unsigned long phys_addr)
|
||||
--
|
||||
2.15.0
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
From c25d877f4ee97deb92170129eee4777a5d5997d9 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 22 Nov 2017 12:57:09 +0100
|
||||
Subject: [PATCH v2 2/3] HID: multitouch: Only look at non touch fields in
|
||||
first packet of a frame
|
||||
|
||||
Devices in "single finger hybrid mode" will send one report per finger,
|
||||
on some devices only the first report of such a multi-packet frame will
|
||||
contain a value for BTN_LEFT, in subsequent reports (if multiple fingers
|
||||
are down) the value is always 0, causing hid-mt to report BTN_LEFT going
|
||||
1 - 0 - 1 - 0 when pressing a clickpad and putting down a second finger.
|
||||
This happens for example on USB 0603:0002 mt touchpads.
|
||||
|
||||
This commit fixes this by only reporting non touch fields for the first
|
||||
packet of a (possibly) multi-packet frame.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
||||
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
||||
---
|
||||
drivers/hid/hid-multitouch.c | 17 +++++++++++++++--
|
||||
1 file changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
|
||||
index d8b1cad74faf..760c4a042e6a 100644
|
||||
--- a/drivers/hid/hid-multitouch.c
|
||||
+++ b/drivers/hid/hid-multitouch.c
|
||||
@@ -787,9 +787,11 @@ static int mt_touch_event(struct hid_device *hid, struct hid_field *field,
|
||||
}
|
||||
|
||||
static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
|
||||
- struct hid_usage *usage, __s32 value)
|
||||
+ struct hid_usage *usage, __s32 value,
|
||||
+ bool first_packet)
|
||||
{
|
||||
struct mt_device *td = hid_get_drvdata(hid);
|
||||
+ __s32 cls = td->mtclass.name;
|
||||
__s32 quirks = td->mtclass.quirks;
|
||||
struct input_dev *input = field->hidinput->input;
|
||||
|
||||
@@ -846,6 +848,15 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
|
||||
break;
|
||||
|
||||
default:
|
||||
+ /*
|
||||
+ * For Win8 PTP touchpads we should only look at
|
||||
+ * non finger/touch events in the first_packet of
|
||||
+ * a (possible) multi-packet frame.
|
||||
+ */
|
||||
+ if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) &&
|
||||
+ !first_packet)
|
||||
+ return;
|
||||
+
|
||||
if (usage->type)
|
||||
input_event(input, usage->type, usage->code,
|
||||
value);
|
||||
@@ -866,6 +877,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
|
||||
struct mt_device *td = hid_get_drvdata(hid);
|
||||
__s32 cls = td->mtclass.name;
|
||||
struct hid_field *field;
|
||||
+ bool first_packet;
|
||||
unsigned count;
|
||||
int r, n, scantime = 0;
|
||||
|
||||
@@ -901,6 +913,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
|
||||
}
|
||||
td->prev_scantime = scantime;
|
||||
|
||||
+ first_packet = td->num_received == 0;
|
||||
for (r = 0; r < report->maxfield; r++) {
|
||||
field = report->field[r];
|
||||
count = field->report_count;
|
||||
@@ -910,7 +923,7 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
|
||||
|
||||
for (n = 0; n < count; n++)
|
||||
mt_process_mt_event(hid, field, &field->usage[n],
|
||||
- field->value[n]);
|
||||
+ field->value[n], first_packet);
|
||||
}
|
||||
|
||||
if (td->num_received >= td->num_expected)
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
From d561f0543506bc12e7b3355efddb0bfd7ca83c74 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 22 Jul 2017 13:17:36 +0200
|
||||
Subject: [PATCH 2/2] Input: soc_button_array - Suppress power button presses
|
||||
during suspend
|
||||
|
||||
If the power-button is pressed to wakeup the laptop/tablet from suspend
|
||||
and we report a KEY_POWER event to userspace when woken up this will cause
|
||||
userspace to immediately suspend the system again which is undesirable.
|
||||
|
||||
This commit sets the new no_wakeup_events flag in the gpio_keys_button
|
||||
struct for the power-button suppressing the undesirable KEY_POWER input
|
||||
events on wake-up.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
Changes in v2:
|
||||
-New patch in v2 of this patch-set
|
||||
---
|
||||
drivers/input/misc/soc_button_array.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
|
||||
index f600f3a7a3c6..27b99831cb97 100644
|
||||
--- a/drivers/input/misc/soc_button_array.c
|
||||
+++ b/drivers/input/misc/soc_button_array.c
|
||||
@@ -27,6 +27,7 @@ struct soc_button_info {
|
||||
unsigned int event_code;
|
||||
bool autorepeat;
|
||||
bool wakeup;
|
||||
+ bool no_wakeup_events;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -100,6 +101,7 @@ soc_button_device_create(struct platform_device *pdev,
|
||||
gpio_keys[n_buttons].active_low = 1;
|
||||
gpio_keys[n_buttons].desc = info->name;
|
||||
gpio_keys[n_buttons].wakeup = info->wakeup;
|
||||
+ gpio_keys[n_buttons].no_wakeup_events = info->no_wakeup_events;
|
||||
/* These devices often use cheap buttons, use 50 ms debounce */
|
||||
gpio_keys[n_buttons].debounce_interval = 50;
|
||||
n_buttons++;
|
||||
@@ -185,6 +187,7 @@ static int soc_button_parse_btn_desc(struct device *dev,
|
||||
info->name = "power";
|
||||
info->event_code = KEY_POWER;
|
||||
info->wakeup = true;
|
||||
+ info->no_wakeup_events = true;
|
||||
} else if (upage == 0x07 && usage == 0xe3) {
|
||||
info->name = "home";
|
||||
info->event_code = KEY_LEFTMETA;
|
||||
@@ -369,7 +372,7 @@ static int soc_button_probe(struct platform_device *pdev)
|
||||
* Platforms"
|
||||
*/
|
||||
static struct soc_button_info soc_button_PNP0C40[] = {
|
||||
- { "power", 0, EV_KEY, KEY_POWER, false, true },
|
||||
+ { "power", 0, EV_KEY, KEY_POWER, false, true, true },
|
||||
{ "home", 1, EV_KEY, KEY_LEFTMETA, false, true },
|
||||
{ "volume_up", 2, EV_KEY, KEY_VOLUMEUP, true, false },
|
||||
{ "volume_down", 3, EV_KEY, KEY_VOLUMEDOWN, true, false },
|
||||
--
|
||||
2.13.4
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
From eab582db4b6c04a20a8bd792faa9ebf7adf1ec17 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 27 Nov 2017 12:07:34 +0100
|
||||
Subject: [PATCH 2/3] ahci: Add PCI ids for Intel Bay Trail, Cherry Trail and
|
||||
Apollo Lake AHCI
|
||||
|
||||
Add PCI ids for Intel Bay Trail, Cherry Trail and Apollo Lake AHCI
|
||||
SATA controllers. This commit is a preparation patch for allowing a
|
||||
different default sata link powermanagement policy for mobile chipsets.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/ata/ahci.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
|
||||
index 9d842ff6ec51..844f697bedbf 100644
|
||||
--- a/drivers/ata/ahci.c
|
||||
+++ b/drivers/ata/ahci.c
|
||||
@@ -386,6 +386,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0xa206), board_ahci }, /* Lewisburg RAID*/
|
||||
{ PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/
|
||||
{ PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*/
|
||||
+ { PCI_VDEVICE(INTEL, 0x0f22), board_ahci }, /* Bay Trail AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x0f23), board_ahci }, /* Bay Trail AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x22a3), board_ahci }, /* Cherry Trail AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci }, /* Apollo Lake AHCI */
|
||||
|
||||
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
|
||||
{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
From c0f9254fdd0703ade018b2ff3a8cca433f781a11 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sun, 26 Feb 2017 21:07:29 +0100
|
||||
Subject: [PATCH 02/16] mfd: Add Cherry Trail Whiskey Cove PMIC driver
|
||||
|
||||
Add mfd driver for Intel CHT Whiskey Cove PMIC, based on various non
|
||||
upstreamed CHT Whiskey Cove PMIC patches.
|
||||
|
||||
This is a somewhat minimal version which adds irqchip support and cells
|
||||
for: ACPI PMIC opregion support, the i2c-controller driving the external
|
||||
charger irc and the pwrsrc/extcon block.
|
||||
|
||||
Further cells can be added in the future if/when drivers are upstreamed
|
||||
for them.
|
||||
|
||||
Cc: Bin Gao <bin.gao@intel.com>
|
||||
Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
|
||||
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
||||
---
|
||||
Changes in v2:
|
||||
-Since this uses plain mfd and not the intel_soc_pmic stuff give it
|
||||
its own Kconfig and allow this to be built as a module
|
||||
-Add missing #include <acpi/acpi_bus.h>
|
||||
|
||||
Changes in v3:
|
||||
-Drop #include <acpi/acpi_bus.h> again, not the right fix for the build errors
|
||||
-Error out when the upper byte of the register-address passed to the regmap
|
||||
functions is 0 rather then hardcoding an address in that case
|
||||
-Various minor style tweaks / cleanups
|
||||
-Move defines of regulator register addresses to intel_pmic_chtwc.c,
|
||||
it is the only place where they are used
|
||||
-Drop now empty include/linux/mfd/intel_chtwc.h
|
||||
-Rename intel_soc_pmic_chtwc.c to intel_cht_wc.c to match Kconfig option name
|
||||
-Add irqchip support
|
||||
-Add external charger cell
|
||||
-Add pwrsrc cell
|
||||
|
||||
Changes in v4:
|
||||
-Use PLATFORM_DEVID_NONE
|
||||
|
||||
Changes in v5:
|
||||
-Change Kconfig option from tristate to boolean and add a select for the
|
||||
i2c-bus driver, this is necessary because the chtwc PMIC provides an ACPI
|
||||
OPRegion handler, which must be available before other drivers using it
|
||||
are loaded, which can only be ensured if the mfd, opregion and i2c-bus
|
||||
drivers are built in. This fixes errors like these during boot:
|
||||
mmc0: SDHCI controller on ACPI [80860F14:00] using ADMA
|
||||
ACPI Error: No handler for Region [REGS] (ffff93543b0cc3a8) [UserDefinedRegion] (20170119/evregion-166)
|
||||
ACPI Error: Region UserDefinedRegion (ID=143) has no handler (20170119/exfldio-299)
|
||||
ACPI Error: Method parse/execution failed [\_SB.PCI0.I2C7.PMI5.GET] (Node ffff93543b0cde10), AE_NOT_EXIST (20170119/psparse-543)
|
||||
ACPI Error: Method parse/execution failed [\_SB.PCI0.SHC1._PS0] (Node ffff93543b0b5cd0), AE_NOT_EXIST (20170119/psparse-543)
|
||||
acpi 80860F14:02: Failed to change power state to D0
|
||||
-Some minor style and capitalization fixes from review by Lee Jones
|
||||
|
||||
Changes in v6:
|
||||
-Fix Kconfig depends and selects to fix warning reported by kbuild test robot
|
||||
|
||||
Changes in v7:
|
||||
-Add explanation why this is a bool and why it selects i2c-designwaree
|
||||
to the help text rather then as comments in the Kconfig
|
||||
|
||||
Changes in v8:
|
||||
-Remove MODULE macros, etc. now that this driver is a bool in Kconfig
|
||||
|
||||
Changes in v9:
|
||||
-Some whitespace tweaks
|
||||
-Return -EINVAL from probe on invalid irq
|
||||
-Use probe_new i2c_driver callback
|
||||
---
|
||||
drivers/mfd/Kconfig | 16 +++
|
||||
drivers/mfd/Makefile | 1 +
|
||||
drivers/mfd/intel_soc_pmic_chtwc.c | 230 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 247 insertions(+)
|
||||
create mode 100644 drivers/mfd/intel_soc_pmic_chtwc.c
|
||||
|
||||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
|
||||
index 3eb5c93595f6..5203a86b8f6c 100644
|
||||
--- a/drivers/mfd/Kconfig
|
||||
+++ b/drivers/mfd/Kconfig
|
||||
@@ -470,6 +470,22 @@ config INTEL_SOC_PMIC_BXTWC
|
||||
thermal, charger and related power management functions
|
||||
on these systems.
|
||||
|
||||
+config INTEL_SOC_PMIC_CHTWC
|
||||
+ bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
|
||||
+ depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
|
||||
+ depends on X86 || COMPILE_TEST
|
||||
+ select MFD_CORE
|
||||
+ select REGMAP_I2C
|
||||
+ select REGMAP_IRQ
|
||||
+ select I2C_DESIGNWARE_PLATFORM
|
||||
+ help
|
||||
+ Select this option to enable support for the Intel Cherry Trail
|
||||
+ Whiskey Cove PMIC found on some Intel Cherry Trail systems.
|
||||
+
|
||||
+ This option is a bool as it provides an ACPI OpRegion which must be
|
||||
+ available before any devices using it are probed. This option also
|
||||
+ causes the designware-i2c driver to be builtin for the same reason.
|
||||
+
|
||||
config MFD_INTEL_LPSS
|
||||
tristate
|
||||
select COMMON_CLK
|
||||
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
|
||||
index c16bf1ea0ea9..6f6aed8cfccc 100644
|
||||
--- a/drivers/mfd/Makefile
|
||||
+++ b/drivers/mfd/Makefile
|
||||
@@ -214,6 +214,7 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o
|
||||
intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
|
||||
obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
|
||||
obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC) += intel_soc_pmic_bxtwc.o
|
||||
+obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC) += intel_soc_pmic_chtwc.o
|
||||
obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
|
||||
|
||||
obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
|
||||
diff --git a/drivers/mfd/intel_soc_pmic_chtwc.c b/drivers/mfd/intel_soc_pmic_chtwc.c
|
||||
new file mode 100644
|
||||
index 000000000000..b35da01d5bcf
|
||||
--- /dev/null
|
||||
+++ b/drivers/mfd/intel_soc_pmic_chtwc.c
|
||||
@@ -0,0 +1,230 @@
|
||||
+/*
|
||||
+ * MFD core driver for Intel Cherrytrail Whiskey Cove PMIC
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
|
||||
+ *
|
||||
+ * Based on various non upstream patches to support the CHT Whiskey Cove PMIC:
|
||||
+ * Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/acpi.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/i2c.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mfd/core.h>
|
||||
+#include <linux/mfd/intel_soc_pmic.h>
|
||||
+#include <linux/regmap.h>
|
||||
+
|
||||
+/* PMIC device registers */
|
||||
+#define REG_OFFSET_MASK GENMASK(7, 0)
|
||||
+#define REG_ADDR_MASK GENMASK(15, 8)
|
||||
+#define REG_ADDR_SHIFT 8
|
||||
+
|
||||
+#define CHT_WC_IRQLVL1 0x6e02
|
||||
+#define CHT_WC_IRQLVL1_MASK 0x6e0e
|
||||
+
|
||||
+/* Whiskey Cove PMIC share same ACPI ID between different platforms */
|
||||
+#define CHT_WC_HRV 3
|
||||
+
|
||||
+/* Level 1 IRQs (level 2 IRQs are handled in the child device drivers) */
|
||||
+enum {
|
||||
+ CHT_WC_PWRSRC_IRQ = 0,
|
||||
+ CHT_WC_THRM_IRQ,
|
||||
+ CHT_WC_BCU_IRQ,
|
||||
+ CHT_WC_ADC_IRQ,
|
||||
+ CHT_WC_EXT_CHGR_IRQ,
|
||||
+ CHT_WC_GPIO_IRQ,
|
||||
+ /* There is no irq 6 */
|
||||
+ CHT_WC_CRIT_IRQ = 7,
|
||||
+};
|
||||
+
|
||||
+static struct resource cht_wc_pwrsrc_resources[] = {
|
||||
+ DEFINE_RES_IRQ(CHT_WC_PWRSRC_IRQ),
|
||||
+};
|
||||
+
|
||||
+static struct resource cht_wc_ext_charger_resources[] = {
|
||||
+ DEFINE_RES_IRQ(CHT_WC_EXT_CHGR_IRQ),
|
||||
+};
|
||||
+
|
||||
+static struct mfd_cell cht_wc_dev[] = {
|
||||
+ {
|
||||
+ .name = "cht_wcove_pwrsrc",
|
||||
+ .num_resources = ARRAY_SIZE(cht_wc_pwrsrc_resources),
|
||||
+ .resources = cht_wc_pwrsrc_resources,
|
||||
+ }, {
|
||||
+ .name = "cht_wcove_ext_chgr",
|
||||
+ .num_resources = ARRAY_SIZE(cht_wc_ext_charger_resources),
|
||||
+ .resources = cht_wc_ext_charger_resources,
|
||||
+ },
|
||||
+ { .name = "cht_wcove_region", },
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * The CHT Whiskey Cove covers multiple I2C addresses, with a 1 Byte
|
||||
+ * register address space per I2C address, so we use 16 bit register
|
||||
+ * addresses where the high 8 bits contain the I2C client address.
|
||||
+ */
|
||||
+static int cht_wc_byte_reg_read(void *context, unsigned int reg,
|
||||
+ unsigned int *val)
|
||||
+{
|
||||
+ struct i2c_client *client = context;
|
||||
+ int ret, orig_addr = client->addr;
|
||||
+
|
||||
+ if (!(reg & REG_ADDR_MASK)) {
|
||||
+ dev_err(&client->dev, "Error I2C address not specified\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ client->addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
|
||||
+ ret = i2c_smbus_read_byte_data(client, reg & REG_OFFSET_MASK);
|
||||
+ client->addr = orig_addr;
|
||||
+
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ *val = ret;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int cht_wc_byte_reg_write(void *context, unsigned int reg,
|
||||
+ unsigned int val)
|
||||
+{
|
||||
+ struct i2c_client *client = context;
|
||||
+ int ret, orig_addr = client->addr;
|
||||
+
|
||||
+ if (!(reg & REG_ADDR_MASK)) {
|
||||
+ dev_err(&client->dev, "Error I2C address not specified\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ client->addr = (reg & REG_ADDR_MASK) >> REG_ADDR_SHIFT;
|
||||
+ ret = i2c_smbus_write_byte_data(client, reg & REG_OFFSET_MASK, val);
|
||||
+ client->addr = orig_addr;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static const struct regmap_config cht_wc_regmap_cfg = {
|
||||
+ .reg_bits = 16,
|
||||
+ .val_bits = 8,
|
||||
+ .reg_write = cht_wc_byte_reg_write,
|
||||
+ .reg_read = cht_wc_byte_reg_read,
|
||||
+};
|
||||
+
|
||||
+static const struct regmap_irq cht_wc_regmap_irqs[] = {
|
||||
+ REGMAP_IRQ_REG(CHT_WC_PWRSRC_IRQ, 0, BIT(CHT_WC_PWRSRC_IRQ)),
|
||||
+ REGMAP_IRQ_REG(CHT_WC_THRM_IRQ, 0, BIT(CHT_WC_THRM_IRQ)),
|
||||
+ REGMAP_IRQ_REG(CHT_WC_BCU_IRQ, 0, BIT(CHT_WC_BCU_IRQ)),
|
||||
+ REGMAP_IRQ_REG(CHT_WC_ADC_IRQ, 0, BIT(CHT_WC_ADC_IRQ)),
|
||||
+ REGMAP_IRQ_REG(CHT_WC_EXT_CHGR_IRQ, 0, BIT(CHT_WC_EXT_CHGR_IRQ)),
|
||||
+ REGMAP_IRQ_REG(CHT_WC_GPIO_IRQ, 0, BIT(CHT_WC_GPIO_IRQ)),
|
||||
+ REGMAP_IRQ_REG(CHT_WC_CRIT_IRQ, 0, BIT(CHT_WC_CRIT_IRQ)),
|
||||
+};
|
||||
+
|
||||
+static const struct regmap_irq_chip cht_wc_regmap_irq_chip = {
|
||||
+ .name = "cht_wc_irq_chip",
|
||||
+ .status_base = CHT_WC_IRQLVL1,
|
||||
+ .mask_base = CHT_WC_IRQLVL1_MASK,
|
||||
+ .irqs = cht_wc_regmap_irqs,
|
||||
+ .num_irqs = ARRAY_SIZE(cht_wc_regmap_irqs),
|
||||
+ .num_regs = 1,
|
||||
+};
|
||||
+
|
||||
+static int cht_wc_probe(struct i2c_client *client)
|
||||
+{
|
||||
+ struct device *dev = &client->dev;
|
||||
+ struct intel_soc_pmic *pmic;
|
||||
+ acpi_status status;
|
||||
+ unsigned long long hrv;
|
||||
+ int ret;
|
||||
+
|
||||
+ status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_HRV", NULL, &hrv);
|
||||
+ if (ACPI_FAILURE(status)) {
|
||||
+ dev_err(dev, "Failed to get PMIC hardware revision\n");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+ if (hrv != CHT_WC_HRV) {
|
||||
+ dev_err(dev, "Invalid PMIC hardware revision: %llu\n", hrv);
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+ if (client->irq < 0) {
|
||||
+ dev_err(dev, "Invalid IRQ\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
|
||||
+ if (!pmic)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ pmic->irq = client->irq;
|
||||
+ pmic->dev = dev;
|
||||
+ i2c_set_clientdata(client, pmic);
|
||||
+
|
||||
+ pmic->regmap = devm_regmap_init(dev, NULL, client, &cht_wc_regmap_cfg);
|
||||
+ if (IS_ERR(pmic->regmap))
|
||||
+ return PTR_ERR(pmic->regmap);
|
||||
+
|
||||
+ ret = devm_regmap_add_irq_chip(dev, pmic->regmap, pmic->irq,
|
||||
+ IRQF_ONESHOT | IRQF_SHARED, 0,
|
||||
+ &cht_wc_regmap_irq_chip,
|
||||
+ &pmic->irq_chip_data);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
|
||||
+ cht_wc_dev, ARRAY_SIZE(cht_wc_dev), NULL, 0,
|
||||
+ regmap_irq_get_domain(pmic->irq_chip_data));
|
||||
+}
|
||||
+
|
||||
+static void cht_wc_shutdown(struct i2c_client *client)
|
||||
+{
|
||||
+ struct intel_soc_pmic *pmic = i2c_get_clientdata(client);
|
||||
+
|
||||
+ disable_irq(pmic->irq);
|
||||
+}
|
||||
+
|
||||
+static int __maybe_unused cht_wc_suspend(struct device *dev)
|
||||
+{
|
||||
+ struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
|
||||
+
|
||||
+ disable_irq(pmic->irq);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int __maybe_unused cht_wc_resume(struct device *dev)
|
||||
+{
|
||||
+ struct intel_soc_pmic *pmic = dev_get_drvdata(dev);
|
||||
+
|
||||
+ enable_irq(pmic->irq);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+static SIMPLE_DEV_PM_OPS(cht_wc_pm_ops, cht_wc_suspend, cht_wc_resume);
|
||||
+
|
||||
+static const struct i2c_device_id cht_wc_i2c_id[] = {
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+static const struct acpi_device_id cht_wc_acpi_ids[] = {
|
||||
+ { "INT34D3", },
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+static struct i2c_driver cht_wc_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "CHT Whiskey Cove PMIC",
|
||||
+ .pm = &cht_wc_pm_ops,
|
||||
+ .acpi_match_table = cht_wc_acpi_ids,
|
||||
+ },
|
||||
+ .probe_new = cht_wc_probe,
|
||||
+ .shutdown = cht_wc_shutdown,
|
||||
+ .id_table = cht_wc_i2c_id,
|
||||
+};
|
||||
+builtin_i2c_driver(cht_wc_driver);
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
From 1719566899e5a69b4ba767beb07dab7ceb9ae5a8 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 22 Nov 2017 12:57:10 +0100
|
||||
Subject: [PATCH v2 3/3] HID: multitouch: Combine all left-button events in a
|
||||
frame
|
||||
|
||||
According to the Win8 Precision Touchpad spec, inside the HID_UP_BUTTON
|
||||
usage-page usage 1 is for a clickpad getting clicked, 2 for an external
|
||||
left button and 3 for an external right button. Since Linux uses
|
||||
BTN_LEFT for a clickpad being clicked we end up mapping both usage 1
|
||||
and 2 to BTN_LEFT and if a single report contains both then we ended
|
||||
up always reporting the value of both in a single SYN, e.g. :
|
||||
BTN_LEFT 1, BTN_LEFT 0, SYN. This happens for example with Hantick
|
||||
HTT5288 i2c mt touchpads.
|
||||
|
||||
This commit fixes this by not immediately reporting left button when we
|
||||
parse the report, but instead storing or-ing together the values and
|
||||
reporting the result from mt_sync_frame() when we've a complete frame.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
|
||||
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
||||
---
|
||||
drivers/hid/hid-multitouch.c | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
|
||||
index 760c4a042e6a..76088f2cf598 100644
|
||||
--- a/drivers/hid/hid-multitouch.c
|
||||
+++ b/drivers/hid/hid-multitouch.c
|
||||
@@ -122,6 +122,7 @@ struct mt_device {
|
||||
int scantime_index; /* scantime field index in the report */
|
||||
int scantime_val_index; /* scantime value index in the field */
|
||||
int prev_scantime; /* scantime reported in the previous packet */
|
||||
+ int left_button_state; /* left button state */
|
||||
unsigned last_slot_field; /* the last field of a slot */
|
||||
unsigned mt_report_id; /* the report ID of the multitouch device */
|
||||
unsigned long initial_quirks; /* initial quirks state */
|
||||
@@ -743,10 +744,16 @@ static void mt_complete_slot(struct mt_device *td, struct input_dev *input)
|
||||
*/
|
||||
static void mt_sync_frame(struct mt_device *td, struct input_dev *input)
|
||||
{
|
||||
+ __s32 cls = td->mtclass.name;
|
||||
+
|
||||
+ if (cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL)
|
||||
+ input_event(input, EV_KEY, BTN_LEFT, td->left_button_state);
|
||||
+
|
||||
input_mt_sync_frame(input);
|
||||
input_event(input, EV_MSC, MSC_TIMESTAMP, td->timestamp);
|
||||
input_sync(input);
|
||||
td->num_received = 0;
|
||||
+ td->left_button_state = 0;
|
||||
if (test_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags))
|
||||
set_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags);
|
||||
else
|
||||
@@ -857,6 +864,19 @@ static void mt_process_mt_event(struct hid_device *hid, struct hid_field *field,
|
||||
!first_packet)
|
||||
return;
|
||||
|
||||
+ /*
|
||||
+ * For Win8 PTP touchpads we map both the clickpad click
|
||||
+ * and any "external" left buttons to BTN_LEFT if a
|
||||
+ * device claims to have both we need to report 1 for
|
||||
+ * BTN_LEFT if either is pressed, so we or all values
|
||||
+ * together and report the result in mt_sync_frame().
|
||||
+ */
|
||||
+ if ((cls == MT_CLS_WIN_8 || cls == MT_CLS_WIN_8_DUAL) &&
|
||||
+ usage->type == EV_KEY && usage->code == BTN_LEFT) {
|
||||
+ td->left_button_state |= value;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (usage->type)
|
||||
input_event(input, usage->type, usage->code,
|
||||
value);
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 520e902d864930e2d4f329983d9ae9781a24231f Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 2 Oct 2017 18:18:30 -0400
|
||||
Subject: [PATCH 3/3] Make get_cert_list() use efi_status_to_str() to print
|
||||
error messages.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
certs/load_uefi.c | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/certs/load_uefi.c b/certs/load_uefi.c
|
||||
index 9ef34c44fd1..13a2826715d 100644
|
||||
--- a/certs/load_uefi.c
|
||||
+++ b/certs/load_uefi.c
|
||||
@@ -51,7 +51,8 @@ static __init int get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
}
|
||||
|
||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||
- pr_err("Couldn't get size: 0x%lx\n", status);
|
||||
+ pr_err("Couldn't get size: %s (0x%lx)\n",
|
||||
+ efi_status_to_str(status), status);
|
||||
return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
@@ -64,7 +65,8 @@ static __init int get_cert_list(efi_char16_t *name, efi_guid_t *guid,
|
||||
status = efi.get_variable(name, guid, NULL, &lsize, db);
|
||||
if (status != EFI_SUCCESS) {
|
||||
kfree(db);
|
||||
- pr_err("Error reading db var: 0x%lx\n", status);
|
||||
+ pr_err("Error reading db var: %s (0x%lx)\n",
|
||||
+ efi_status_to_str(status), status);
|
||||
return efi_status_to_err(status);
|
||||
}
|
||||
|
||||
--
|
||||
2.15.0
|
||||
|
|
@ -0,0 +1,274 @@
|
|||
From 262135cf058c28d248b997bd11b2c124e27d8d47 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 27 Nov 2017 15:32:01 +0100
|
||||
Subject: [PATCH 3/3] ahci: Allow setting a default LPM policy for mobile
|
||||
chipsets
|
||||
|
||||
On many laptops setting a different LPM policy then unknown /
|
||||
max_performance can lead to power-savings of 1.0 - 1.5 Watts (when idle).
|
||||
|
||||
Modern ultrabooks idle around 6W (at 50% screen brightness), 1.0 - 1.5W
|
||||
is a significant chunk of this.
|
||||
|
||||
There are some performance / latency costs to enabling LPM by default,
|
||||
so it is desirable to make it possible to set a different LPM policy
|
||||
for mobile / laptop variants of chipsets / "South Bridges" vs their
|
||||
desktop / server counterparts. Also enabling LPM by default is not
|
||||
entirely without risk of regressions. At least min_power is known to
|
||||
cause issues with some disks, including some reports of data corruption.
|
||||
|
||||
This commits adds a new ahci.mobile_lpm_policy kernel cmdline option,
|
||||
which defaults to a new SATA_MOBILE_LPM_POLICY Kconfig option so that
|
||||
Linux distributions can choose to set a LPM policy for mobile chipsets
|
||||
by default.
|
||||
|
||||
The reason to have both a kernel cmdline option and a Kconfig default
|
||||
value for it, is to allow easy overriding of the default to allow
|
||||
trouble-shooting without needing to rebuild the kernel.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
Changes in v2:
|
||||
-Remove .config changes from the patch
|
||||
---
|
||||
drivers/ata/Kconfig | 19 +++++++++++
|
||||
drivers/ata/ahci.c | 97 +++++++++++++++++++++++++++++++----------------------
|
||||
drivers/ata/ahci.h | 3 ++
|
||||
3 files changed, 78 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
|
||||
index cb5339166563..b3fad5663aeb 100644
|
||||
--- a/drivers/ata/Kconfig
|
||||
+++ b/drivers/ata/Kconfig
|
||||
@@ -92,6 +92,25 @@ config SATA_AHCI
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
+config SATA_MOBILE_LPM_POLICY
|
||||
+ int "Default SATA Link Power Management policy for mobile chipsets"
|
||||
+ range 0 4
|
||||
+ default 0
|
||||
+ depends on SATA_AHCI
|
||||
+ help
|
||||
+ Select the Default SATA Link Power Management (LPM) policy to use
|
||||
+ for mobile / laptop variants of chipsets / "South Bridges".
|
||||
+
|
||||
+ The value set has the following meanings:
|
||||
+ 0 => Keep firmware settings
|
||||
+ 1 => Maximum performance
|
||||
+ 2 => Medium power
|
||||
+ 3 => Medium power with Device Initiated PM enabled
|
||||
+ 4 => Minimum power
|
||||
+
|
||||
+ Note "Minimum power" is known to cause issues, including disk
|
||||
+ corruption, with some disks and should not be used.
|
||||
+
|
||||
config SATA_AHCI_PLATFORM
|
||||
tristate "Platform AHCI SATA support"
|
||||
help
|
||||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
|
||||
index 844f697bedbf..8e910fae8892 100644
|
||||
--- a/drivers/ata/ahci.c
|
||||
+++ b/drivers/ata/ahci.c
|
||||
@@ -65,6 +65,7 @@ enum board_ids {
|
||||
/* board IDs by feature in alphabetical order */
|
||||
board_ahci,
|
||||
board_ahci_ign_iferr,
|
||||
+ board_ahci_mobile,
|
||||
board_ahci_nomsi,
|
||||
board_ahci_noncq,
|
||||
board_ahci_nosntf,
|
||||
@@ -140,6 +141,13 @@ static const struct ata_port_info ahci_port_info[] = {
|
||||
.udma_mask = ATA_UDMA6,
|
||||
.port_ops = &ahci_ops,
|
||||
},
|
||||
+ [board_ahci_mobile] = {
|
||||
+ AHCI_HFLAGS (AHCI_HFLAG_IS_MOBILE),
|
||||
+ .flags = AHCI_FLAG_COMMON,
|
||||
+ .pio_mask = ATA_PIO4,
|
||||
+ .udma_mask = ATA_UDMA6,
|
||||
+ .port_ops = &ahci_ops,
|
||||
+ },
|
||||
[board_ahci_nomsi] = {
|
||||
AHCI_HFLAGS (AHCI_HFLAG_NO_MSI),
|
||||
.flags = AHCI_FLAG_COMMON,
|
||||
@@ -252,13 +260,13 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x2924), board_ahci }, /* ICH9 */
|
||||
{ PCI_VDEVICE(INTEL, 0x2925), board_ahci }, /* ICH9 */
|
||||
{ PCI_VDEVICE(INTEL, 0x2927), board_ahci }, /* ICH9 */
|
||||
- { PCI_VDEVICE(INTEL, 0x2929), board_ahci }, /* ICH9M */
|
||||
- { PCI_VDEVICE(INTEL, 0x292a), board_ahci }, /* ICH9M */
|
||||
- { PCI_VDEVICE(INTEL, 0x292b), board_ahci }, /* ICH9M */
|
||||
- { PCI_VDEVICE(INTEL, 0x292c), board_ahci }, /* ICH9M */
|
||||
- { PCI_VDEVICE(INTEL, 0x292f), board_ahci }, /* ICH9M */
|
||||
+ { PCI_VDEVICE(INTEL, 0x2929), board_ahci_mobile }, /* ICH9M */
|
||||
+ { PCI_VDEVICE(INTEL, 0x292a), board_ahci_mobile }, /* ICH9M */
|
||||
+ { PCI_VDEVICE(INTEL, 0x292b), board_ahci_mobile }, /* ICH9M */
|
||||
+ { PCI_VDEVICE(INTEL, 0x292c), board_ahci_mobile }, /* ICH9M */
|
||||
+ { PCI_VDEVICE(INTEL, 0x292f), board_ahci_mobile }, /* ICH9M */
|
||||
{ PCI_VDEVICE(INTEL, 0x294d), board_ahci }, /* ICH9 */
|
||||
- { PCI_VDEVICE(INTEL, 0x294e), board_ahci }, /* ICH9M */
|
||||
+ { PCI_VDEVICE(INTEL, 0x294e), board_ahci_mobile }, /* ICH9M */
|
||||
{ PCI_VDEVICE(INTEL, 0x502a), board_ahci }, /* Tolapai */
|
||||
{ PCI_VDEVICE(INTEL, 0x502b), board_ahci }, /* Tolapai */
|
||||
{ PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */
|
||||
@@ -268,9 +276,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x3b23), board_ahci }, /* PCH AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x3b29), board_ahci }, /* PCH M AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x3b29), board_ahci_mobile }, /* PCH M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci_mobile }, /* PCH M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */
|
||||
@@ -293,9 +301,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT M AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1c03), board_ahci_mobile }, /* CPT M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x1c05), board_ahci }, /* CPT M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1c05), board_ahci_mobile }, /* CPT M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c06), board_ahci }, /* CPT RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1c07), board_ahci }, /* CPT RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1d02), board_ahci }, /* PBG AHCI */
|
||||
@@ -304,28 +312,28 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x2826), board_ahci }, /* PBG RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x2323), board_ahci }, /* DH89xxCC AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e02), board_ahci }, /* Panther Point AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x1e03), board_ahci }, /* Panther Point M AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1e03), board_ahci_mobile }, /* Panther M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e04), board_ahci }, /* Panther Point RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e05), board_ahci }, /* Panther Point RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e06), board_ahci }, /* Panther Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x1e07), board_ahci }, /* Panther Point M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x1e07), board_ahci_mobile }, /* Panther M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1e0e), board_ahci }, /* Panther Point RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c02), board_ahci }, /* Lynx Point AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c03), board_ahci }, /* Lynx Point M AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c03), board_ahci_mobile }, /* Lynx M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c04), board_ahci }, /* Lynx Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c05), board_ahci }, /* Lynx Point M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c05), board_ahci_mobile }, /* Lynx M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c06), board_ahci }, /* Lynx Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c07), board_ahci }, /* Lynx Point M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c07), board_ahci_mobile }, /* Lynx M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c0e), board_ahci }, /* Lynx Point RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c0f), board_ahci }, /* Lynx Point M RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c02), board_ahci }, /* Lynx Point-LP AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c03), board_ahci }, /* Lynx Point-LP AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c04), board_ahci }, /* Lynx Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c05), board_ahci }, /* Lynx Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c06), board_ahci }, /* Lynx Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c07), board_ahci }, /* Lynx Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c0e), board_ahci }, /* Lynx Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c0f), board_ahci }, /* Lynx Point-LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c0f), board_ahci_mobile }, /* Lynx M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c02), board_ahci_mobile }, /* Lynx LP AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c03), board_ahci_mobile }, /* Lynx LP AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c04), board_ahci_mobile }, /* Lynx LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c05), board_ahci_mobile }, /* Lynx LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c06), board_ahci_mobile }, /* Lynx LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c07), board_ahci_mobile }, /* Lynx LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c0e), board_ahci_mobile }, /* Lynx LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c0f), board_ahci_mobile }, /* Lynx LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x1f22), board_ahci }, /* Avoton AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1f23), board_ahci }, /* Avoton AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x1f24), board_ahci }, /* Avoton RAID */
|
||||
@@ -353,26 +361,26 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c83), board_ahci }, /* Wildcat Point-LP AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c83), board_ahci_mobile }, /* Wildcat LP AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c85), board_ahci_mobile }, /* Wildcat LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c87), board_ahci_mobile }, /* Wildcat LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci_mobile }, /* Wildcat LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series M AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c83), board_ahci_mobile }, /* 9 Series M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c85), board_ahci_mobile }, /* 9 Series M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c87), board_ahci_mobile }, /* 9 Series M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series M RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9d03), board_ahci }, /* Sunrise Point-LP AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x9d05), board_ahci }, /* Sunrise Point-LP RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0x9d07), board_ahci }, /* Sunrise Point-LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci_mobile }, /* 9 Series M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9d03), board_ahci_mobile }, /* Sunrise LP AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9d05), board_ahci_mobile }, /* Sunrise LP RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0x9d07), board_ahci_mobile }, /* Sunrise LP RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa102), board_ahci }, /* Sunrise Point-H AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H M AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0xa103), board_ahci_mobile }, /* Sunrise M AHCI */
|
||||
{ PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa106), board_ahci }, /* Sunrise Point-H RAID */
|
||||
- { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H M RAID */
|
||||
+ { PCI_VDEVICE(INTEL, 0xa107), board_ahci_mobile }, /* Sunrise M RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */
|
||||
{ PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* Lewisburg RAID*/
|
||||
{ PCI_VDEVICE(INTEL, 0x2823), board_ahci }, /* Lewisburg AHCI*/
|
||||
@@ -386,10 +394,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, 0xa206), board_ahci }, /* Lewisburg RAID*/
|
||||
{ PCI_VDEVICE(INTEL, 0xa252), board_ahci }, /* Lewisburg RAID*/
|
||||
{ PCI_VDEVICE(INTEL, 0xa256), board_ahci }, /* Lewisburg RAID*/
|
||||
- { PCI_VDEVICE(INTEL, 0x0f22), board_ahci }, /* Bay Trail AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x0f23), board_ahci }, /* Bay Trail AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x22a3), board_ahci }, /* Cherry Trail AHCI */
|
||||
- { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci }, /* Apollo Lake AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x0f22), board_ahci_mobile }, /* Bay Trail AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_mobile }, /* Bay Trail AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
|
||||
+ { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */
|
||||
|
||||
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
|
||||
{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
|
||||
@@ -597,6 +605,9 @@ static int marvell_enable = 1;
|
||||
module_param(marvell_enable, int, 0644);
|
||||
MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)");
|
||||
|
||||
+static int mobile_lpm_policy = CONFIG_SATA_MOBILE_LPM_POLICY;
|
||||
+module_param(mobile_lpm_policy, int, 0644);
|
||||
+MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets");
|
||||
|
||||
static void ahci_pci_save_initial_config(struct pci_dev *pdev,
|
||||
struct ahci_host_priv *hpriv)
|
||||
@@ -1732,6 +1743,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
if (ap->flags & ATA_FLAG_EM)
|
||||
ap->em_message_type = hpriv->em_msg_type;
|
||||
|
||||
+ if ((hpriv->flags & AHCI_HFLAG_IS_MOBILE) &&
|
||||
+ mobile_lpm_policy >= ATA_LPM_UNKNOWN &&
|
||||
+ mobile_lpm_policy <= ATA_LPM_MIN_POWER)
|
||||
+ ap->target_lpm_policy = mobile_lpm_policy;
|
||||
|
||||
/* disabled/not-implemented port */
|
||||
if (!(hpriv->port_map & (1 << i)))
|
||||
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
|
||||
index 749fd94441b0..a9d996e17d75 100644
|
||||
--- a/drivers/ata/ahci.h
|
||||
+++ b/drivers/ata/ahci.h
|
||||
@@ -251,6 +251,9 @@ enum {
|
||||
AHCI_HFLAG_YES_ALPM = (1 << 23), /* force ALPM cap on */
|
||||
AHCI_HFLAG_NO_WRITE_TO_RO = (1 << 24), /* don't write to read
|
||||
only registers */
|
||||
+ AHCI_HFLAG_IS_MOBILE = (1 << 25), /* mobile chipset, use
|
||||
+ SATA_MOBILE_LPM_POLICY
|
||||
+ as default lpm_policy */
|
||||
|
||||
/* ap->flags bits */
|
||||
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
From 69dd0606a0d8680fe0a5e9b959f6662e582e1674 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Tue, 2 May 2017 13:43:34 +0200
|
||||
Subject: [PATCH 03/16] power: supply: core: Add support for supplied-from
|
||||
device-property
|
||||
|
||||
On devicetree using platforms the devicetree can provide info on which
|
||||
power-supplies supply another power-supply through phandles.
|
||||
|
||||
This commit adds support for providing this info on non devicetree
|
||||
platforms through the platform code setting a supplied-from
|
||||
device-property on the power-supplies parent device.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/power/supply/power_supply_core.c | 24 +++++++++++++++++++++++-
|
||||
1 file changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
|
||||
index 7ec7c7c202bd..0c09144193a6 100644
|
||||
--- a/drivers/power/supply/power_supply_core.c
|
||||
+++ b/drivers/power/supply/power_supply_core.c
|
||||
@@ -274,8 +274,30 @@ static int power_supply_check_supplies(struct power_supply *psy)
|
||||
return power_supply_populate_supplied_from(psy);
|
||||
}
|
||||
#else
|
||||
-static inline int power_supply_check_supplies(struct power_supply *psy)
|
||||
+static int power_supply_check_supplies(struct power_supply *psy)
|
||||
{
|
||||
+ int nval, ret;
|
||||
+
|
||||
+ if (!psy->dev.parent)
|
||||
+ return 0;
|
||||
+
|
||||
+ nval = device_property_read_string_array(psy->dev.parent,
|
||||
+ "supplied-from", NULL, 0);
|
||||
+ if (nval <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ psy->supplied_from = devm_kmalloc_array(&psy->dev, nval,
|
||||
+ sizeof(char *), GFP_KERNEL);
|
||||
+ if (!psy->supplied_from)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ ret = device_property_read_string_array(psy->dev.parent,
|
||||
+ "supplied-from", (const char **)psy->supplied_from, nval);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ psy->num_supplies = nval;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
From 99c44df299d96db6a170ccce9b8108fc2e7f8bae Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Tue, 2 May 2017 13:40:44 +0200
|
||||
Subject: [PATCH 04/16] platform/x86: intel_cht_int33fe: Set supplied-from
|
||||
property on max17047 dev
|
||||
|
||||
Devices with the intel_cht_int33fe ACPI device use a max17047 fuel-gauge
|
||||
combined with a bq24272i charger, in order for the fuel-gauge driver to
|
||||
correctly display charging / discharging status it needs to know which
|
||||
charger is supplying the battery.
|
||||
|
||||
This commit sets the supplied-from device property to the name of the
|
||||
bq24272i charger for this.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/platform/x86/intel_cht_int33fe.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/intel_cht_int33fe.c b/drivers/platform/x86/intel_cht_int33fe.c
|
||||
index 6a1b2ca5b6fe..da706e2c4232 100644
|
||||
--- a/drivers/platform/x86/intel_cht_int33fe.c
|
||||
+++ b/drivers/platform/x86/intel_cht_int33fe.c
|
||||
@@ -34,6 +34,13 @@ struct cht_int33fe_data {
|
||||
struct i2c_client *pi3usb30532;
|
||||
};
|
||||
|
||||
+static const char * const max17047_suppliers[] = { "bq24190-charger" };
|
||||
+
|
||||
+static const struct property_entry max17047_props[] = {
|
||||
+ PROPERTY_ENTRY_STRING_ARRAY("supplied-from", max17047_suppliers),
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
static int cht_int33fe_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
@@ -70,6 +77,7 @@ static int cht_int33fe_probe(struct i2c_client *client)
|
||||
|
||||
memset(&board_info, 0, sizeof(board_info));
|
||||
strlcpy(board_info.type, "max17047", I2C_NAME_SIZE);
|
||||
+ board_info.properties = max17047_props;
|
||||
|
||||
data->max17047 = i2c_acpi_new_device(dev, 1, &board_info);
|
||||
if (!data->max17047)
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
From cc2b0e2c164d02ab42efa736f91f53baf8d8bc36 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Thu, 20 Apr 2017 22:41:20 +0200
|
||||
Subject: [PATCH 05/16] 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>
|
||||
---
|
||||
Changes in v2:
|
||||
-Simplify reg == 0x92 handling (suggested by Andy Shevchenko)
|
||||
-Add special handling for reg == 0x92 to intel_xpower_pmic_get_power() too
|
||||
Changes in v3:
|
||||
-Use defines for GPI1 reg and bits, rather then hardcoded hex values
|
||||
---
|
||||
drivers/acpi/pmic/intel_pmic_xpower.c | 21 ++++++++++++++++++++-
|
||||
1 file changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c
|
||||
index 1a76c784cd4c..3b7d5be5b7ed 100644
|
||||
--- a/drivers/acpi/pmic/intel_pmic_xpower.c
|
||||
+++ b/drivers/acpi/pmic/intel_pmic_xpower.c
|
||||
@@ -21,6 +21,11 @@
|
||||
#include "intel_pmic.h"
|
||||
|
||||
#define XPOWER_GPADC_LOW 0x5b
|
||||
+#define XPOWER_GPI1_CTRL 0x92
|
||||
+
|
||||
+#define GPI1_LDO_MASK GENMASK(2, 0)
|
||||
+#define GPI1_LDO_ON (3 << 0)
|
||||
+#define GPI1_LDO_OFF (4 << 0)
|
||||
|
||||
static struct pmic_table power_table[] = {
|
||||
{
|
||||
@@ -118,6 +123,10 @@ static struct pmic_table power_table[] = {
|
||||
.reg = 0x10,
|
||||
.bit = 0x00
|
||||
}, /* BUC6 */
|
||||
+ {
|
||||
+ .address = 0x4c,
|
||||
+ .reg = 0x92,
|
||||
+ }, /* GPI1 */
|
||||
};
|
||||
|
||||
/* TMP0 - TMP5 are the same, all from GPADC */
|
||||
@@ -156,7 +165,12 @@ static int intel_xpower_pmic_get_power(struct regmap *regmap, int reg,
|
||||
if (regmap_read(regmap, reg, &data))
|
||||
return -EIO;
|
||||
|
||||
- *value = (data & BIT(bit)) ? 1 : 0;
|
||||
+ /* GPIO1 LDO regulator needs special handling */
|
||||
+ if (reg == XPOWER_GPI1_CTRL)
|
||||
+ *value = ((data & GPI1_LDO_MASK) == GPI1_LDO_ON);
|
||||
+ else
|
||||
+ *value = (data & BIT(bit)) ? 1 : 0;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -165,6 +179,11 @@ static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg,
|
||||
{
|
||||
int data;
|
||||
|
||||
+ /* GPIO1 LDO regulator needs special handling */
|
||||
+ if (reg == XPOWER_GPI1_CTRL)
|
||||
+ return regmap_update_bits(regmap, reg, GPI1_LDO_MASK,
|
||||
+ on ? GPI1_LDO_ON : GPI1_LDO_OFF);
|
||||
+
|
||||
if (regmap_read(regmap, reg, &data))
|
||||
return -EIO;
|
||||
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
From fbac4c05ec1d7c2d949f50baf1e934cbfbb6a494 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Mon, 17 Apr 2017 22:06:25 +0200
|
||||
Subject: [PATCH 06/16] Input: axp20x-pek - Add wakeup support
|
||||
|
||||
At least on devices with the AXP288 PMIC the device is expected to
|
||||
wakeup from suspend when the power-button gets pressed, add support
|
||||
for this.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/input/misc/axp20x-pek.c | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
|
||||
index 400869e61a06..5f16fceaae83 100644
|
||||
--- a/drivers/input/misc/axp20x-pek.c
|
||||
+++ b/drivers/input/misc/axp20x-pek.c
|
||||
@@ -253,6 +253,9 @@ static int axp20x_pek_probe_input_device(struct axp20x_pek *axp20x_pek,
|
||||
return error;
|
||||
}
|
||||
|
||||
+ if (axp20x_pek->axp20x->variant == AXP288_ID)
|
||||
+ enable_irq_wake(axp20x_pek->irq_dbr);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -331,10 +334,35 @@ static int axp20x_pek_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int __maybe_unused axp20x_pek_resume_noirq(struct device *dev)
|
||||
+{
|
||||
+ struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
|
||||
+
|
||||
+ if (axp20x_pek->axp20x->variant != AXP288_ID)
|
||||
+ return 0;
|
||||
+
|
||||
+ /*
|
||||
+ * Clear interrupts from button presses during suspend, to avoid
|
||||
+ * a wakeup power-button press getting reported to userspace.
|
||||
+ */
|
||||
+ regmap_write(axp20x_pek->axp20x->regmap,
|
||||
+ AXP20X_IRQ1_STATE + AXP288_IRQ_POKN / 8,
|
||||
+ BIT(AXP288_IRQ_POKN % 8));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+const struct dev_pm_ops axp20x_pek_pm_ops = {
|
||||
+#ifdef CONFIG_PM_SLEEP
|
||||
+ .resume_noirq = axp20x_pek_resume_noirq,
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
static struct platform_driver axp20x_pek_driver = {
|
||||
.probe = axp20x_pek_probe,
|
||||
.driver = {
|
||||
.name = "axp20x-pek",
|
||||
+ .pm = &axp20x_pek_pm_ops,
|
||||
},
|
||||
};
|
||||
module_platform_driver(axp20x_pek_driver);
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
From d95c127c48ef784214671359a41ac505ac30098a Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sun, 7 May 2017 12:32:11 +0200
|
||||
Subject: [PATCH 07/16] platform/x86: silead_dmi: Add touchscreen info for
|
||||
GP-electronic T701
|
||||
|
||||
Add touchscreen info for the GP-electronic T701 tablet.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/platform/x86/silead_dmi.c | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c
|
||||
index a3a57d93cf06..db3a877d2160 100644
|
||||
--- a/drivers/platform/x86/silead_dmi.c
|
||||
+++ b/drivers/platform/x86/silead_dmi.c
|
||||
@@ -80,6 +80,19 @@ static const struct silead_ts_dmi_data surftab_wintron70_st70416_6_data = {
|
||||
.properties = surftab_wintron70_st70416_6_props,
|
||||
};
|
||||
|
||||
+static const struct property_entry gp_electronic_t701_props[] = {
|
||||
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 960),
|
||||
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 640),
|
||||
+ PROPERTY_ENTRY_STRING("firmware-name",
|
||||
+ "gsl1680-gp-electronic-t701.fw"),
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+static const struct silead_ts_dmi_data gp_electronic_t701_data = {
|
||||
+ .acpi_name = "MSSL1680:00",
|
||||
+ .properties = gp_electronic_t701_props,
|
||||
+};
|
||||
+
|
||||
static const struct dmi_system_id silead_ts_dmi_table[] = {
|
||||
{
|
||||
/* CUBE iwork8 Air */
|
||||
@@ -117,6 +130,15 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
|
||||
DMI_MATCH(DMI_BIOS_VERSION, "TREK.G.WI71C.JGBMRBA04"),
|
||||
},
|
||||
},
|
||||
+ {
|
||||
+ /* GP-electronic T701 */
|
||||
+ .driver_data = (void *)&gp_electronic_t701_data,
|
||||
+ .matches = {
|
||||
+ DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
|
||||
+ DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
|
||||
+ DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
|
||||
+ },
|
||||
+ },
|
||||
{ },
|
||||
};
|
||||
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
From 55b347c61b2850d1e11e159ab02dc71f13b06481 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sun, 11 Jun 2017 17:42:31 +0200
|
||||
Subject: [PATCH 08/16] platform/x86: silead_dmi: Add touchscreen info for PoV
|
||||
mobii wintab p800w
|
||||
|
||||
Add touchscreen info for the Point of View mobii wintab p800w tablet.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/platform/x86/silead_dmi.c | 25 +++++++++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c
|
||||
index db3a877d2160..46c5e1ebfb53 100644
|
||||
--- a/drivers/platform/x86/silead_dmi.c
|
||||
+++ b/drivers/platform/x86/silead_dmi.c
|
||||
@@ -93,6 +93,20 @@ static const struct silead_ts_dmi_data gp_electronic_t701_data = {
|
||||
.properties = gp_electronic_t701_props,
|
||||
};
|
||||
|
||||
+static const struct property_entry pov_mobii_wintab_p800w_props[] = {
|
||||
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1800),
|
||||
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1150),
|
||||
+ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
|
||||
+ PROPERTY_ENTRY_STRING("firmware-name",
|
||||
+ "gsl3692-pov-mobii-wintab-p800w.fw"),
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+static const struct silead_ts_dmi_data pov_mobii_wintab_p800w_data = {
|
||||
+ .acpi_name = "MSSL1680:00",
|
||||
+ .properties = pov_mobii_wintab_p800w_props,
|
||||
+};
|
||||
+
|
||||
static const struct dmi_system_id silead_ts_dmi_table[] = {
|
||||
{
|
||||
/* CUBE iwork8 Air */
|
||||
@@ -139,6 +153,17 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
|
||||
DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
|
||||
},
|
||||
},
|
||||
+ {
|
||||
+ /* Point of View mobii wintab p800w */
|
||||
+ .driver_data = (void *)&pov_mobii_wintab_p800w_data,
|
||||
+ .matches = {
|
||||
+ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
|
||||
+ DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
|
||||
+ DMI_MATCH(DMI_BIOS_VERSION, "3BAIR1013"),
|
||||
+ /* Above matches are too generic, add bios-date match */
|
||||
+ DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
|
||||
+ },
|
||||
+ },
|
||||
{ },
|
||||
};
|
||||
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
From b239a7a0c2a1435aa5cbab3f233e0c37e82943dd Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Tue, 13 Jun 2017 18:17:07 +0200
|
||||
Subject: [PATCH 09/16] platform/x86: silead_dmi: Add touchscreen info for Pipo
|
||||
W2S tablet
|
||||
|
||||
Add touchscreen info for Pipo W2S tablet.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/platform/x86/silead_dmi.c | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/silead_dmi.c b/drivers/platform/x86/silead_dmi.c
|
||||
index 46c5e1ebfb53..25cbea307a5e 100644
|
||||
--- a/drivers/platform/x86/silead_dmi.c
|
||||
+++ b/drivers/platform/x86/silead_dmi.c
|
||||
@@ -107,6 +107,21 @@ static const struct silead_ts_dmi_data pov_mobii_wintab_p800w_data = {
|
||||
.properties = pov_mobii_wintab_p800w_props,
|
||||
};
|
||||
|
||||
+static const struct property_entry pipo_w2s_props[] = {
|
||||
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1660),
|
||||
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 880),
|
||||
+ PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
|
||||
+ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
|
||||
+ PROPERTY_ENTRY_STRING("firmware-name",
|
||||
+ "gsl1680-pipo-w2s.fw"),
|
||||
+ { }
|
||||
+};
|
||||
+
|
||||
+static const struct silead_ts_dmi_data pipo_w2s_data = {
|
||||
+ .acpi_name = "MSSL1680:00",
|
||||
+ .properties = pipo_w2s_props,
|
||||
+};
|
||||
+
|
||||
static const struct dmi_system_id silead_ts_dmi_table[] = {
|
||||
{
|
||||
/* CUBE iwork8 Air */
|
||||
@@ -164,6 +179,14 @@ static const struct dmi_system_id silead_ts_dmi_table[] = {
|
||||
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
|
||||
},
|
||||
},
|
||||
+ {
|
||||
+ /* Pipo W2S */
|
||||
+ .driver_data = (void *)&pipo_w2s_data,
|
||||
+ .matches = {
|
||||
+ DMI_MATCH(DMI_SYS_VENDOR, "PIPO"),
|
||||
+ DMI_MATCH(DMI_PRODUCT_NAME, "W2S"),
|
||||
+ },
|
||||
+ },
|
||||
{ },
|
||||
};
|
||||
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
From 02b823a4d28ffb5fde5192799abd934d9de95630 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Fri, 6 Jan 2017 20:08:11 +0100
|
||||
Subject: [PATCH 12/16] Input: gpio_keys - Do not report wake button presses as
|
||||
evdev events
|
||||
|
||||
If a button is a wake button, it may still be bouncing from the press
|
||||
to wakeup the device by the time the gpio interrupts get enabled again
|
||||
and / or the gpio_keys_report_state call from gpio_keys_resume may
|
||||
find the button still pressed and report this as a new press.
|
||||
|
||||
This is undesirable, esp. since the powerbutton on tablets is typically
|
||||
a wakeup source and uses the gpio_keys driver on some tablets, leading
|
||||
to userspace immediately re-suspending the tablet after the powerbutton
|
||||
is pressed, due to it seeing a powerbutton press.
|
||||
|
||||
This commit ignores wakeup button presses for the first 1 second after
|
||||
resume (and while resumed, as the workqueue may run before the resume
|
||||
function runs), avoiding this problem.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
Note: maybe we should make WAKE_DEBOUNCE part of gpio_keys_button and
|
||||
only do this when drivers / platform-data set this to a non-zero value ?
|
||||
---
|
||||
drivers/input/keyboard/gpio_keys.c | 49 ++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 47 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
|
||||
index da3d362f21b1..e1488b534e7d 100644
|
||||
--- a/drivers/input/keyboard/gpio_keys.c
|
||||
+++ b/drivers/input/keyboard/gpio_keys.c
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
+#define WAKE_DEBOUNCE msecs_to_jiffies(1000)
|
||||
+
|
||||
struct gpio_button_data {
|
||||
const struct gpio_keys_button *button;
|
||||
struct input_dev *input;
|
||||
@@ -44,10 +46,14 @@ struct gpio_button_data {
|
||||
struct delayed_work work;
|
||||
unsigned int software_debounce; /* in msecs, for GPIO-driven buttons */
|
||||
|
||||
+ unsigned long resume_time; /* in jiffies, for wakeup buttons */
|
||||
+
|
||||
unsigned int irq;
|
||||
spinlock_t lock;
|
||||
bool disabled;
|
||||
bool key_pressed;
|
||||
+ bool suspended;
|
||||
+ bool resume_time_valid;
|
||||
};
|
||||
|
||||
struct gpio_keys_drvdata {
|
||||
@@ -356,6 +362,27 @@ static struct attribute_group gpio_keys_attr_group = {
|
||||
.attrs = gpio_keys_attrs,
|
||||
};
|
||||
|
||||
+static bool gpio_keys_ignore_wakeup_button_press(struct gpio_button_data *bdata)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ bool ret = false;
|
||||
+
|
||||
+ if (!bdata->button->wakeup)
|
||||
+ return ret;
|
||||
+
|
||||
+ spin_lock_irqsave(&bdata->lock, flags);
|
||||
+
|
||||
+ if (bdata->suspended)
|
||||
+ ret = true; /* Our resume method did not run yet */
|
||||
+ else if (bdata->resume_time_valid &&
|
||||
+ time_before(jiffies, bdata->resume_time + WAKE_DEBOUNCE))
|
||||
+ ret = true; /* Assume this is a wakeup press and ignore */
|
||||
+
|
||||
+ spin_unlock_irqrestore(&bdata->lock, flags);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
|
||||
{
|
||||
const struct gpio_keys_button *button = bdata->button;
|
||||
@@ -370,6 +397,9 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
|
||||
return;
|
||||
}
|
||||
|
||||
+ if (state && gpio_keys_ignore_wakeup_button_press(bdata))
|
||||
+ return;
|
||||
+
|
||||
if (type == EV_ABS) {
|
||||
if (state)
|
||||
input_event(input, type, button->code, button->value);
|
||||
@@ -429,6 +459,9 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
|
||||
|
||||
BUG_ON(irq != bdata->irq);
|
||||
|
||||
+ if (gpio_keys_ignore_wakeup_button_press(bdata))
|
||||
+ return IRQ_HANDLED;
|
||||
+
|
||||
spin_lock_irqsave(&bdata->lock, flags);
|
||||
|
||||
if (!bdata->key_pressed) {
|
||||
@@ -848,13 +881,18 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev)
|
||||
{
|
||||
struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
|
||||
struct input_dev *input = ddata->input;
|
||||
+ unsigned long flags;
|
||||
int i;
|
||||
|
||||
if (device_may_wakeup(dev)) {
|
||||
for (i = 0; i < ddata->pdata->nbuttons; i++) {
|
||||
struct gpio_button_data *bdata = &ddata->data[i];
|
||||
- if (bdata->button->wakeup)
|
||||
+ if (bdata->button->wakeup) {
|
||||
+ spin_lock_irqsave(&bdata->lock, flags);
|
||||
+ bdata->suspended = true;
|
||||
+ spin_unlock_irqrestore(&bdata->lock, flags);
|
||||
enable_irq_wake(bdata->irq);
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&input->mutex);
|
||||
@@ -870,14 +908,21 @@ static int __maybe_unused gpio_keys_resume(struct device *dev)
|
||||
{
|
||||
struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev);
|
||||
struct input_dev *input = ddata->input;
|
||||
+ unsigned long flags;
|
||||
int error = 0;
|
||||
int i;
|
||||
|
||||
if (device_may_wakeup(dev)) {
|
||||
for (i = 0; i < ddata->pdata->nbuttons; i++) {
|
||||
struct gpio_button_data *bdata = &ddata->data[i];
|
||||
- if (bdata->button->wakeup)
|
||||
+ if (bdata->button->wakeup) {
|
||||
disable_irq_wake(bdata->irq);
|
||||
+ spin_lock_irqsave(&bdata->lock, flags);
|
||||
+ bdata->resume_time = jiffies;
|
||||
+ bdata->resume_time_valid = true;
|
||||
+ bdata->suspended = false;
|
||||
+ spin_unlock_irqrestore(&bdata->lock, flags);
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&input->mutex);
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
From 51eb7454942c68c84b82782e47637de3ba37f113 Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Hunter <adrian.hunter@intel.com>
|
||||
Date: Wed, 21 Jun 2017 15:08:39 +0300
|
||||
Subject: [PATCH 14/16] mmc: sdhci-acpi: Workaround conflict with PCI wifi on
|
||||
GPD Win handheld
|
||||
|
||||
GPDwin uses PCI wifi which conflicts with SDIO's use of
|
||||
acpi_device_fix_up_power() on child device nodes. Specifically
|
||||
acpi_device_fix_up_power() causes the wifi module to get turned off.
|
||||
Identifying GPDwin is problematic, but since SDIO is only used for wifi,
|
||||
the presence of the PCI wifi card in the expected slot with an ACPI
|
||||
companion node, is used to indicate that acpi_device_fix_up_power() should
|
||||
be avoided.
|
||||
|
||||
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
|
||||
Acked-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Tested-by: Hans de Goede <hdegoede@redhat.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
---
|
||||
drivers/mmc/host/sdhci-acpi.c | 70 +++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 64 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
|
||||
index c6a9a1bfaa22..b3fb155f50e4 100644
|
||||
--- a/drivers/mmc/host/sdhci-acpi.c
|
||||
+++ b/drivers/mmc/host/sdhci-acpi.c
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <asm/cpu_device_id.h>
|
||||
#include <asm/intel-family.h>
|
||||
#include <asm/iosf_mbi.h>
|
||||
+#include <linux/pci.h>
|
||||
#endif
|
||||
|
||||
#include "sdhci.h"
|
||||
@@ -134,6 +135,16 @@ static bool sdhci_acpi_byt(void)
|
||||
return x86_match_cpu(byt);
|
||||
}
|
||||
|
||||
+static bool sdhci_acpi_cht(void)
|
||||
+{
|
||||
+ static const struct x86_cpu_id cht[] = {
|
||||
+ { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_AIRMONT },
|
||||
+ {}
|
||||
+ };
|
||||
+
|
||||
+ return x86_match_cpu(cht);
|
||||
+}
|
||||
+
|
||||
#define BYT_IOSF_SCCEP 0x63
|
||||
#define BYT_IOSF_OCP_NETCTRL0 0x1078
|
||||
#define BYT_IOSF_OCP_TIMEOUT_BASE GENMASK(10, 8)
|
||||
@@ -178,6 +189,45 @@ static bool sdhci_acpi_byt_defer(struct device *dev)
|
||||
return false;
|
||||
}
|
||||
|
||||
+static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
|
||||
+ unsigned int slot, unsigned int parent_slot)
|
||||
+{
|
||||
+ struct pci_dev *dev, *parent, *from = NULL;
|
||||
+
|
||||
+ while (1) {
|
||||
+ dev = pci_get_device(vendor, device, from);
|
||||
+ pci_dev_put(from);
|
||||
+ if (!dev)
|
||||
+ break;
|
||||
+ parent = pci_upstream_bridge(dev);
|
||||
+ if (ACPI_COMPANION(&dev->dev) && PCI_SLOT(dev->devfn) == slot &&
|
||||
+ parent && PCI_SLOT(parent->devfn) == parent_slot &&
|
||||
+ !pci_upstream_bridge(parent)) {
|
||||
+ pci_dev_put(dev);
|
||||
+ return true;
|
||||
+ }
|
||||
+ from = dev;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * GPDwin uses PCI wifi which conflicts with SDIO's use of
|
||||
+ * acpi_device_fix_up_power() on child device nodes. Identifying GPDwin is
|
||||
+ * problematic, but since SDIO is only used for wifi, the presence of the PCI
|
||||
+ * wifi card in the expected slot with an ACPI companion node, is used to
|
||||
+ * indicate that acpi_device_fix_up_power() should be avoided.
|
||||
+ */
|
||||
+static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
|
||||
+ const char *uid)
|
||||
+{
|
||||
+ return sdhci_acpi_cht() &&
|
||||
+ !strcmp(hid, "80860F14") &&
|
||||
+ !strcmp(uid, "2") &&
|
||||
+ sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
|
||||
+}
|
||||
+
|
||||
#else
|
||||
|
||||
static inline void sdhci_acpi_byt_setting(struct device *dev)
|
||||
@@ -189,6 +239,12 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev)
|
||||
return false;
|
||||
}
|
||||
|
||||
+static inline bool sdhci_acpi_no_fixup_child_power(const char *hid,
|
||||
+ const char *uid)
|
||||
+{
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
#endif
|
||||
|
||||
static int bxt_get_cd(struct mmc_host *mmc)
|
||||
@@ -390,11 +446,16 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
|
||||
if (acpi_bus_get_device(handle, &device))
|
||||
return -ENODEV;
|
||||
|
||||
+ hid = acpi_device_hid(device);
|
||||
+ uid = device->pnp.unique_id;
|
||||
+
|
||||
/* Power on the SDHCI controller and its children */
|
||||
acpi_device_fix_up_power(device);
|
||||
- list_for_each_entry(child, &device->children, node)
|
||||
- if (child->status.present && child->status.enabled)
|
||||
- acpi_device_fix_up_power(child);
|
||||
+ if (!sdhci_acpi_no_fixup_child_power(hid, uid)) {
|
||||
+ list_for_each_entry(child, &device->children, node)
|
||||
+ if (child->status.present && child->status.enabled)
|
||||
+ acpi_device_fix_up_power(child);
|
||||
+ }
|
||||
|
||||
if (acpi_bus_get_status(device) || !device->status.present)
|
||||
return -ENODEV;
|
||||
@@ -402,9 +463,6 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
|
||||
if (sdhci_acpi_byt_defer(dev))
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
- hid = acpi_device_hid(device);
|
||||
- uid = device->pnp.unique_id;
|
||||
-
|
||||
iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!iomem)
|
||||
return -ENOMEM;
|
||||
--
|
||||
2.13.0
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
From fd4fb1f6633b21042ff084868323e15e708fe1cd Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sun, 1 Jan 2017 22:11:20 +0100
|
||||
Subject: [PATCH 16/16] Input: silead: Do not try to directly access the GPIO
|
||||
when using ACPI pm
|
||||
|
||||
On some x86 tablets we cannot directly access the GPIOs as they are
|
||||
claimed by the ACPI tables, so check it the i2c client is not being
|
||||
power-managed by ACPI before trying to get the power pin GPIO.
|
||||
|
||||
Note this is a workaround patch to fix this until Andy' gpiolib-ACPI
|
||||
patches which make gpiolib more strict land, once those are landed this
|
||||
patch is no longer needed.
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/input/touchscreen/silead.c | 22 ++++++++++++++++------
|
||||
1 file changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
|
||||
index c0ba40c09699..30fba3cbe277 100644
|
||||
--- a/drivers/input/touchscreen/silead.c
|
||||
+++ b/drivers/input/touchscreen/silead.c
|
||||
@@ -517,12 +518,21 @@ static int silead_ts_probe(struct i2c_client *client,
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
- /* Power GPIO pin */
|
||||
- data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
|
||||
- if (IS_ERR(data->gpio_power)) {
|
||||
- if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
|
||||
- dev_err(dev, "Shutdown GPIO request failed\n");
|
||||
- return PTR_ERR(data->gpio_power);
|
||||
+ /*
|
||||
+ * If device power is not managed by ACPI, get the power_gpio
|
||||
+ * and manage it ourselves.
|
||||
+ */
|
||||
+#ifdef CONFIG_ACPI
|
||||
+ if (!acpi_bus_power_manageable(ACPI_HANDLE(dev)))
|
||||
+#endif
|
||||
+ {
|
||||
+ data->gpio_power = devm_gpiod_get_optional(dev, "power",
|
||||
+ GPIOD_OUT_LOW);
|
||||
+ if (IS_ERR(data->gpio_power)) {
|
||||
+ if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
|
||||
+ dev_err(dev, "Power GPIO request failed\n");
|
||||
+ return PTR_ERR(data->gpio_power);
|
||||
+ }
|
||||
}
|
||||
|
||||
error = silead_ts_setup(client);
|
||||
--
|
||||
2.13.0
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,48 +0,0 @@
|
|||
From 70ac67826602edf8c0ccb413e5ba7eacf597a60c Mon Sep 17 00:00:00 2001
|
||||
From: Seunghun Han <kkamagui@gmail.com>
|
||||
Date: Tue, 18 Jul 2017 20:03:51 +0900
|
||||
Subject: x86/acpi: Prevent out of bound access caused by broken ACPI tables
|
||||
|
||||
The bus_irq argument of mp_override_legacy_irq() is used as the index into
|
||||
the isa_irq_to_gsi[] array. The bus_irq argument originates from
|
||||
ACPI_MADT_TYPE_IO_APIC and ACPI_MADT_TYPE_INTERRUPT items in the ACPI
|
||||
tables, but is nowhere sanity checked.
|
||||
|
||||
That allows broken or malicious ACPI tables to overwrite memory, which
|
||||
might cause malfunction, panic or arbitrary code execution.
|
||||
|
||||
Add a sanity check and emit a warning when that triggers.
|
||||
|
||||
[ tglx: Added warning and rewrote changelog ]
|
||||
|
||||
Signed-off-by: Seunghun Han <kkamagui@gmail.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: security@kernel.org
|
||||
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
|
||||
Cc: stable@vger.kernel.org
|
||||
---
|
||||
arch/x86/kernel/acpi/boot.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
|
||||
index 6bb6806..7491e73 100644
|
||||
--- a/arch/x86/kernel/acpi/boot.c
|
||||
+++ b/arch/x86/kernel/acpi/boot.c
|
||||
@@ -347,6 +347,14 @@ static void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
|
||||
struct mpc_intsrc mp_irq;
|
||||
|
||||
/*
|
||||
+ * Check bus_irq boundary.
|
||||
+ */
|
||||
+ if (bus_irq >= NR_IRQS_LEGACY) {
|
||||
+ pr_warn("Invalid bus_irq %u for legacy override\n", bus_irq);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
* Convert 'gsi' to 'ioapic.pin'.
|
||||
*/
|
||||
ioapic = mp_find_ioapic(gsi);
|
||||
--
|
||||
cgit v1.1
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
From 2a54526850121cd0d7cf649a321488b4dab5731d Mon Sep 17 00:00:00 2001
|
||||
From: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
Date: Fri, 26 Oct 2012 12:36:24 -0400
|
||||
Subject: [PATCH 17/20] KEYS: Add a system blacklist keyring
|
||||
|
||||
This adds an additional keyring that is used to store certificates that
|
||||
are blacklisted. This keyring is searched first when loading signed modules
|
||||
and if the module's certificate is found, it will refuse to load. This is
|
||||
useful in cases where third party certificates are used for module signing.
|
||||
|
||||
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
|
||||
---
|
||||
certs/system_keyring.c | 22 ++++++++++++++++++++++
|
||||
include/keys/system_keyring.h | 4 ++++
|
||||
init/Kconfig | 9 +++++++++
|
||||
3 files changed, 35 insertions(+)
|
||||
|
||||
diff --git a/certs/system_keyring.c b/certs/system_keyring.c
|
||||
index 50979d6dcecd..787eeead2f57 100644
|
||||
--- a/certs/system_keyring.c
|
||||
+++ b/certs/system_keyring.c
|
||||
@@ -22,6 +22,9 @@ static struct key *builtin_trusted_keys;
|
||||
#ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
|
||||
static struct key *secondary_trusted_keys;
|
||||
#endif
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+struct key *system_blacklist_keyring;
|
||||
+#endif
|
||||
|
||||
extern __initconst const u8 system_certificate_list[];
|
||||
extern __initconst const unsigned long system_certificate_list_size;
|
||||
@@ -99,6 +102,16 @@ static __init int system_trusted_keyring_init(void)
|
||||
if (key_link(secondary_trusted_keys, builtin_trusted_keys) < 0)
|
||||
panic("Can't link trusted keyrings\n");
|
||||
#endif
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+ system_blacklist_keyring = keyring_alloc(".system_blacklist_keyring",
|
||||
+ KUIDT_INIT(0), KGIDT_INIT(0), current_cred(),
|
||||
+ ((KEY_POS_ALL & ~KEY_POS_SETATTR) |
|
||||
+ KEY_USR_VIEW | KEY_USR_READ | KEY_USR_SEARCH),
|
||||
+ KEY_ALLOC_NOT_IN_QUOTA,
|
||||
+ NULL, NULL);
|
||||
+ if (IS_ERR(system_blacklist_keyring))
|
||||
+ panic("Can't allocate system blacklist keyring\n");
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -214,6 +227,15 @@ int verify_pkcs7_signature(const void *data, size_t len,
|
||||
trusted_keys = builtin_trusted_keys;
|
||||
#endif
|
||||
}
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+ ret = pkcs7_validate_trust(pkcs7, system_blacklist_keyring);
|
||||
+ if (!ret) {
|
||||
+ /* module is signed with a cert in the blacklist. reject */
|
||||
+ pr_err("Module key is in the blacklist\n");
|
||||
+ ret = -EKEYREJECTED;
|
||||
+ goto error;
|
||||
+ }
|
||||
+#endif
|
||||
ret = pkcs7_validate_trust(pkcs7, trusted_keys);
|
||||
if (ret < 0) {
|
||||
if (ret == -ENOKEY)
|
||||
diff --git a/include/keys/system_keyring.h b/include/keys/system_keyring.h
|
||||
index fbd4647767e9..5bc291a3d261 100644
|
||||
--- a/include/keys/system_keyring.h
|
||||
+++ b/include/keys/system_keyring.h
|
||||
@@ -33,6 +33,10 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
|
||||
#define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
|
||||
+extern struct key *system_blacklist_keyring;
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_IMA_BLACKLIST_KEYRING
|
||||
extern struct key *ima_blacklist_keyring;
|
||||
|
||||
diff --git a/init/Kconfig b/init/Kconfig
|
||||
index 34407f15e6d3..461ad575a608 100644
|
||||
--- a/init/Kconfig
|
||||
+++ b/init/Kconfig
|
||||
@@ -1859,6 +1859,15 @@ config SYSTEM_DATA_VERIFICATION
|
||||
module verification, kexec image verification and firmware blob
|
||||
verification.
|
||||
|
||||
+config SYSTEM_BLACKLIST_KEYRING
|
||||
+ bool "Provide system-wide ring of blacklisted keys"
|
||||
+ depends on KEYS
|
||||
+ help
|
||||
+ Provide a system keyring to which blacklisted keys can be added.
|
||||
+ Keys in the keyring are considered entirely untrusted. Keys in this
|
||||
+ keyring are used by the module signature checking to reject loading
|
||||
+ of modules signed with a blacklisted key.
|
||||
+
|
||||
config PROFILING
|
||||
bool "Profiling support"
|
||||
help
|
||||
--
|
||||
2.9.3
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
From 71db1b222ecdf6cb4356f6f1e2bd45cd2f0e85e1 Mon Sep 17 00:00:00 2001
|
||||
From: Laura Abbott <labbott@redhat.com>
|
||||
Date: Tue, 18 Oct 2016 13:58:44 -0700
|
||||
Subject: [PATCH] MODSIGN: Don't try secure boot if EFI runtime is disabled
|
||||
|
||||
Secure boot depends on having EFI runtime variable access. The code
|
||||
does not handle a lack of runtime variables gracefully. Add a check
|
||||
to just bail out of EFI runtime is disabled.
|
||||
|
||||
Signed-off-by: Laura Abbott <labbott@redhat.com>
|
||||
---
|
||||
kernel/modsign_uefi.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/kernel/modsign_uefi.c b/kernel/modsign_uefi.c
|
||||
index a41da14..2bdaf76 100644
|
||||
--- a/kernel/modsign_uefi.c
|
||||
+++ b/kernel/modsign_uefi.c
|
||||
@@ -71,6 +71,10 @@ static int __init load_uefi_certs(void)
|
||||
if (!efi_enabled(EFI_SECURE_BOOT))
|
||||
return 0;
|
||||
|
||||
+ /* Things blow up if efi runtime is disabled */
|
||||
+ if (efi_runtime_disabled())
|
||||
+ return 0;
|
||||
+
|
||||
keyring = get_system_keyring();
|
||||
if (!keyring) {
|
||||
pr_err("MODSIGN: Couldn't get system keyring\n");
|
||||
--
|
||||
2.7.4
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
From patchwork Mon Oct 2 14:08:40 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: PCI: aspm: deal with missing root ports in link state handling
|
||||
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
X-Patchwork-Id: 9980861
|
||||
Message-Id: <20171002140840.7767-1-ard.biesheuvel@linaro.org>
|
||||
To: linux-pci@vger.kernel.org, bhelgaas@google.com
|
||||
Cc: graeme.gregory@linaro.org, leif.lindholm@linaro.org,
|
||||
daniel.thompson@Linaro.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
Date: Mon, 2 Oct 2017 15:08:40 +0100
|
||||
|
||||
Even though it is unconventional, some PCIe host implementations omit
|
||||
the root ports entirely, and simply consist of a host bridge (which
|
||||
is not modeled as a device in the PCI hierarchy) and a link.
|
||||
|
||||
When the downstream device is an endpoint, our current code does not
|
||||
seem to mind this unusual configuration. However, when PCIe switches
|
||||
are involved, the ASPM code assumes that any downstream switch port
|
||||
has a parent, and blindly derefences the bus->parent->self field of
|
||||
the pci_dev struct to chain the downstream link state to the link
|
||||
state of the root port. Given that the root port is missing, the link
|
||||
is not modeled at all, and nor is the link state, and attempting to
|
||||
access it results in a NULL pointer dereference and a crash.
|
||||
|
||||
So let's avoid this by allowing the link state chain to terminate at
|
||||
the downstream port if no root port exists.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
---
|
||||
drivers/pci/pcie/aspm.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
|
||||
index 1dfa10cc566b..0bea8498b5a5 100644
|
||||
--- a/drivers/pci/pcie/aspm.c
|
||||
+++ b/drivers/pci/pcie/aspm.c
|
||||
@@ -802,10 +802,14 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
|
||||
|
||||
/*
|
||||
* Root Ports and PCI/PCI-X to PCIe Bridges are roots of PCIe
|
||||
- * hierarchies.
|
||||
+ * hierarchies. Note that some PCIe host implementations omit
|
||||
+ * the root ports entirely, in which case a downstream port on
|
||||
+ * a switch may become the root of the link state chain for all
|
||||
+ * its subordinate endpoints.
|
||||
*/
|
||||
if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT ||
|
||||
- pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE) {
|
||||
+ pci_pcie_type(pdev) == PCI_EXP_TYPE_PCIE_BRIDGE ||
|
||||
+ !pdev->bus->parent->self) {
|
||||
link->root = link;
|
||||
} else {
|
||||
struct pcie_link_state *parent;
|
|
@ -1,156 +0,0 @@
|
|||
From patchwork Thu Jun 15 15:28:58 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [RFC] audit: fix a race condition with the auditd tracking code
|
||||
From: Paul Moore <pmoore@redhat.com>
|
||||
X-Patchwork-Id: 9789009
|
||||
Message-Id: <149754053819.11365.5047864735077505545.stgit@sifl>
|
||||
To: linux-audit@redhat.com
|
||||
Cc: Dusty Mabe <dustymabe@redhat.com>
|
||||
Date: Thu, 15 Jun 2017 11:28:58 -0400
|
||||
|
||||
From: Paul Moore <paul@paul-moore.com>
|
||||
|
||||
Originally reported by Adam and Dusty, it appears we have a small
|
||||
race window in kauditd_thread(), as documented in the Fedora BZ:
|
||||
|
||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1459326#c35
|
||||
|
||||
"This issue is partly due to the read-copy nature of RCU, and
|
||||
partly due to how we sync the auditd_connection state across
|
||||
kauditd_thread and the audit control channel. The kauditd_thread
|
||||
thread is always running so it can service the record queues and
|
||||
emit the multicast messages, if it happens to be just past the
|
||||
"main_queue" label, but before the "if (sk == NULL || ...)"
|
||||
if-statement which calls auditd_reset() when the new auditd
|
||||
connection is registered it could end up resetting the auditd
|
||||
connection, regardless of if it is valid or not. This is a rather
|
||||
small window and the variable nature of multi-core scheduling
|
||||
explains why this is proving rather difficult to reproduce."
|
||||
|
||||
The fix is to have functions only call auditd_reset() when they
|
||||
believe that the kernel/auditd connection is still valid, e.g.
|
||||
non-NULL, and to have these callers pass their local copy of the
|
||||
auditd_connection pointer to auditd_reset() where it can be compared
|
||||
with the current connection state before resetting. If the caller
|
||||
has a stale state tracking pointer then the reset is ignored.
|
||||
|
||||
We also make a small change to kauditd_thread() so that if the
|
||||
kernel/auditd connection is dead we skip the retry queue and send the
|
||||
records straight to the hold queue. This is necessary as we used to
|
||||
rely on auditd_reset() to occasionally purge the retry queue but we
|
||||
are going to be calling the reset function much less now and we want
|
||||
to make sure the retry queue doesn't grow unbounded.
|
||||
|
||||
Reported-by: Adam Williamson <awilliam@redhat.com>
|
||||
Reported-by: Dusty Mabe <dustymabe@redhat.com>
|
||||
Signed-off-by: Paul Moore <paul@paul-moore.com>
|
||||
Reviewed-by: Richard Guy Briggs <rgb@redhat.com>
|
||||
---
|
||||
kernel/audit.c | 36 +++++++++++++++++++++++-------------
|
||||
1 file changed, 23 insertions(+), 13 deletions(-)
|
||||
|
||||
|
||||
--
|
||||
Linux-audit mailing list
|
||||
Linux-audit@redhat.com
|
||||
https://www.redhat.com/mailman/listinfo/linux-audit
|
||||
|
||||
diff --git a/kernel/audit.c b/kernel/audit.c
|
||||
index b2e877100242..e1e2b3abfb93 100644
|
||||
--- a/kernel/audit.c
|
||||
+++ b/kernel/audit.c
|
||||
@@ -575,12 +575,16 @@ static void kauditd_retry_skb(struct sk_buff *skb)
|
||||
|
||||
/**
|
||||
* auditd_reset - Disconnect the auditd connection
|
||||
+ * @ac: auditd connection state
|
||||
*
|
||||
* Description:
|
||||
* Break the auditd/kauditd connection and move all the queued records into the
|
||||
- * hold queue in case auditd reconnects.
|
||||
+ * hold queue in case auditd reconnects. It is important to note that the @ac
|
||||
+ * pointer should never be dereferenced inside this function as it may be NULL
|
||||
+ * or invalid, you can only compare the memory address! If @ac is NULL then
|
||||
+ * the connection will always be reset.
|
||||
*/
|
||||
-static void auditd_reset(void)
|
||||
+static void auditd_reset(const struct auditd_connection *ac)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct sk_buff *skb;
|
||||
@@ -590,6 +594,11 @@ static void auditd_reset(void)
|
||||
spin_lock_irqsave(&auditd_conn_lock, flags);
|
||||
ac_old = rcu_dereference_protected(auditd_conn,
|
||||
lockdep_is_held(&auditd_conn_lock));
|
||||
+ if (ac && ac != ac_old) {
|
||||
+ /* someone already registered a new auditd connection */
|
||||
+ spin_unlock_irqrestore(&auditd_conn_lock, flags);
|
||||
+ return;
|
||||
+ }
|
||||
rcu_assign_pointer(auditd_conn, NULL);
|
||||
spin_unlock_irqrestore(&auditd_conn_lock, flags);
|
||||
|
||||
@@ -649,8 +658,8 @@ static int auditd_send_unicast_skb(struct sk_buff *skb)
|
||||
return rc;
|
||||
|
||||
err:
|
||||
- if (rc == -ECONNREFUSED)
|
||||
- auditd_reset();
|
||||
+ if (ac && rc == -ECONNREFUSED)
|
||||
+ auditd_reset(ac);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -795,9 +804,9 @@ static int kauditd_thread(void *dummy)
|
||||
rc = kauditd_send_queue(sk, portid,
|
||||
&audit_hold_queue, UNICAST_RETRIES,
|
||||
NULL, kauditd_rehold_skb);
|
||||
- if (rc < 0) {
|
||||
+ if (ac && rc < 0) {
|
||||
sk = NULL;
|
||||
- auditd_reset();
|
||||
+ auditd_reset(ac);
|
||||
goto main_queue;
|
||||
}
|
||||
|
||||
@@ -805,9 +814,9 @@ static int kauditd_thread(void *dummy)
|
||||
rc = kauditd_send_queue(sk, portid,
|
||||
&audit_retry_queue, UNICAST_RETRIES,
|
||||
NULL, kauditd_hold_skb);
|
||||
- if (rc < 0) {
|
||||
+ if (ac && rc < 0) {
|
||||
sk = NULL;
|
||||
- auditd_reset();
|
||||
+ auditd_reset(ac);
|
||||
goto main_queue;
|
||||
}
|
||||
|
||||
@@ -815,12 +824,13 @@ static int kauditd_thread(void *dummy)
|
||||
/* process the main queue - do the multicast send and attempt
|
||||
* unicast, dump failed record sends to the retry queue; if
|
||||
* sk == NULL due to previous failures we will just do the
|
||||
- * multicast send and move the record to the retry queue */
|
||||
+ * multicast send and move the record to the hold queue */
|
||||
rc = kauditd_send_queue(sk, portid, &audit_queue, 1,
|
||||
kauditd_send_multicast_skb,
|
||||
- kauditd_retry_skb);
|
||||
- if (sk == NULL || rc < 0)
|
||||
- auditd_reset();
|
||||
+ (sk ?
|
||||
+ kauditd_retry_skb : kauditd_hold_skb));
|
||||
+ if (ac && rc < 0)
|
||||
+ auditd_reset(ac);
|
||||
sk = NULL;
|
||||
|
||||
/* drop our netns reference, no auditd sends past this line */
|
||||
@@ -1230,7 +1240,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
auditd_pid, 1);
|
||||
|
||||
/* unregister the auditd connection */
|
||||
- auditd_reset();
|
||||
+ auditd_reset(NULL);
|
||||
}
|
||||
}
|
||||
if (s.mask & AUDIT_STATUS_RATE_LIMIT) {
|
|
@ -1,48 +0,0 @@
|
|||
From patchwork Sat Nov 11 15:31:18 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: USB: ulpi: fix bus-node lookup
|
||||
From: Johan Hovold <johan@kernel.org>
|
||||
X-Patchwork-Id: 10054387
|
||||
Message-Id: <20171111153118.16038-1-johan@kernel.org>
|
||||
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
||||
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
|
||||
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
linux-arm-msm@vger.kernel.org, Rob Clark <robdclark@gmail.com>,
|
||||
Peter Robinson <pbrobinson@gmail.com>, Johan Hovold <johan@kernel.org>,
|
||||
stable <stable@vger.kernel.org>
|
||||
Date: Sat, 11 Nov 2017 16:31:18 +0100
|
||||
|
||||
Fix bus-node lookup during registration, which ended up searching the whole
|
||||
device tree depth-first starting at the parent (or grand parent) rather
|
||||
than just matching on its children.
|
||||
|
||||
To make things worse, the parent (or grand-parent) node could end being
|
||||
prematurely freed as well.
|
||||
|
||||
Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT")
|
||||
Reported-by: Peter Robinson <pbrobinson@gmail.com>
|
||||
Reported-by: Stephen Boyd <sboyd@codeaurora.org>
|
||||
Cc: stable <stable@vger.kernel.org> # 4.10
|
||||
Signed-off-by: Johan Hovold <johan@kernel.org>
|
||||
---
|
||||
drivers/usb/common/ulpi.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
|
||||
index 8b351444cc40..9a2ab6751a23 100644
|
||||
--- a/drivers/usb/common/ulpi.c
|
||||
+++ b/drivers/usb/common/ulpi.c
|
||||
@@ -180,9 +180,9 @@ static int ulpi_of_register(struct ulpi *ulpi)
|
||||
/* Find a ulpi bus underneath the parent or the grandparent */
|
||||
parent = ulpi->dev.parent;
|
||||
if (parent->of_node)
|
||||
- np = of_find_node_by_name(parent->of_node, "ulpi");
|
||||
+ np = of_get_child_by_name(parent->of_node, "ulpi");
|
||||
else if (parent->parent && parent->parent->of_node)
|
||||
- np = of_find_node_by_name(parent->parent->of_node, "ulpi");
|
||||
+ np = of_get_child_by_name(parent->parent->of_node, "ulpi");
|
||||
if (!np)
|
||||
return 0;
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,40 +0,0 @@
|
|||
From patchwork Mon May 22 14:51:38 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: arm: dts: boneblack-wireless: add WL1835 Bluetooth device node
|
||||
From: Ricardo Salveti <ricardo.salveti@linaro.org>
|
||||
X-Patchwork-Id: 9740719
|
||||
Message-Id: <1495464701-12046-1-git-send-email-ricardo.salveti@linaro.org>
|
||||
To: linux-omap@vger.kernel.org
|
||||
Cc: Mark Rutland <mark.rutland@arm.com>,
|
||||
Ricardo Salveti <ricardo.salveti@linaro.org>, devicetree@vger.kernel.org,
|
||||
Tony Lindgren <tony@atomide.com>, Russell King <linux@armlinux.org.uk>,
|
||||
linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
|
||||
=?UTF-8?q?Beno=C3=AEt=20Cousson?= <bcousson@baylibre.com>,
|
||||
robertcnelson@gmail.com, linux-arm-kernel@lists.infradead.org
|
||||
Date: Mon, 22 May 2017 11:51:38 -0300
|
||||
|
||||
This adds the serial slave device for the WL1835 Bluetooth interface.
|
||||
|
||||
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
|
||||
---
|
||||
arch/arm/boot/dts/am335x-boneblack-wireless.dts | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/am335x-boneblack-wireless.dts b/arch/arm/boot/dts/am335x-boneblack-wireless.dts
|
||||
index 105bd10..83f49f6 100644
|
||||
--- a/arch/arm/boot/dts/am335x-boneblack-wireless.dts
|
||||
+++ b/arch/arm/boot/dts/am335x-boneblack-wireless.dts
|
||||
@@ -97,6 +97,11 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart3_pins &bt_pins>;
|
||||
status = "okay";
|
||||
+
|
||||
+ bluetooth {
|
||||
+ compatible = "ti,wl1835-st";
|
||||
+ enable-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&gpio3 {
|
|
@ -0,0 +1,41 @@
|
|||
From patchwork Thu Jan 18 12:34:18 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: ARM: dts: imx6qdl-udoo: Disable usbh1 to avoid kernel hang
|
||||
From: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
X-Patchwork-Id: 10173115
|
||||
Message-Id: <1516278858-15464-1-git-send-email-fabio.estevam@nxp.com>
|
||||
To: <shawnguo@kernel.org>
|
||||
Cc: maggu2810@gmail.com, peter.chen@nxp.com, mail@maciej.szmigiero.name,
|
||||
Fabio Estevam <fabio.estevam@nxp.com>, linux-arm-kernel@lists.infradead.org
|
||||
Date: Thu, 18 Jan 2018 10:34:18 -0200
|
||||
|
||||
Currently the kernel hangs when USB Host1 is enabled due to the lack of
|
||||
support for controlling the USB hub clock and GPIO reset line.
|
||||
|
||||
Peter Chen has made several attempts to fix this problem, but his series
|
||||
has not been applied yet, so better disable USB host1 for now to avoid
|
||||
the kernel hang.
|
||||
|
||||
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
|
||||
Acked-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
|
||||
Tested-by: Markus Rathgeb <maggu2810@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/imx6qdl-udoo.dtsi | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
|
||||
index 4161b7d..1f0b9f6 100644
|
||||
--- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi
|
||||
+++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi
|
||||
@@ -274,7 +274,8 @@
|
||||
pinctrl-0 = <&pinctrl_usbh>;
|
||||
vbus-supply = <®_usb_h1_vbus>;
|
||||
clocks = <&clks IMX6QDL_CLK_CKO>;
|
||||
- status = "okay";
|
||||
+ /* currently USB support causes a kernel hang. Disable it for now */
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
&usdhc3 {
|
|
@ -1,411 +0,0 @@
|
|||
From patchwork Mon Oct 9 12:00:50 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [PATCHv4,1/2] drivers: phy: add calibrate method
|
||||
From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
|
||||
X-Patchwork-Id: 9992829
|
||||
Message-Id: <1507550451-21324-2-git-send-email-andrzej.p@samsung.com>
|
||||
To: linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org,
|
||||
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
|
||||
Cc: Mark Rutland <mark.rutland@arm.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
|
||||
Russell King <linux@armlinux.org.uk>,
|
||||
Krzysztof Kozlowski <krzk@kernel.org>,
|
||||
Kishon Vijay Abraham I <kishon@ti.com>,
|
||||
Rob Herring <robh+dt@kernel.org>, Kukjin Kim <kgene@kernel.org>,
|
||||
Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
|
||||
Marek Szyprowski <m.szyprowski@samsung.com>
|
||||
Date: Mon, 09 Oct 2017 14:00:50 +0200
|
||||
|
||||
Some quirky UDCs (like dwc3 on Exynos) need to have their phys calibrated e.g.
|
||||
for using super speed. This patch adds a new phy_calibrate() method.
|
||||
When the calibration should be used is dependent on actual chip.
|
||||
|
||||
In case of dwc3 on Exynos the calibration must happen after usb_add_hcd()
|
||||
(while in host mode), because certain phy parameters like Tx LOS levels
|
||||
and boost levels need to be calibrated further post initialization of xHCI
|
||||
controller, to get SuperSpeed operations working. But an hcd must be
|
||||
prepared first in order to pass it to usb_add_hcd(), so, in particular, dwc3
|
||||
registers must be available first, and in order for the latter to happen
|
||||
the phys must be initialized. This poses a chicken and egg problem if
|
||||
the calibration were to be performed in phy_init(). To break the circular
|
||||
dependency a separate method is added which can be called at a desired
|
||||
moment after phy intialization.
|
||||
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
|
||||
---
|
||||
drivers/phy/phy-core.c | 15 +++++++++++++++
|
||||
include/linux/phy/phy.h | 10 ++++++++++
|
||||
2 files changed, 25 insertions(+)
|
||||
|
||||
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
|
||||
index a268f4d..b4964b0 100644
|
||||
--- a/drivers/phy/phy-core.c
|
||||
+++ b/drivers/phy/phy-core.c
|
||||
@@ -372,6 +372,21 @@ int phy_reset(struct phy *phy)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(phy_reset);
|
||||
|
||||
+int phy_calibrate(struct phy *phy)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!phy || !phy->ops->calibrate)
|
||||
+ return 0;
|
||||
+
|
||||
+ mutex_lock(&phy->mutex);
|
||||
+ ret = phy->ops->calibrate(phy);
|
||||
+ mutex_unlock(&phy->mutex);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(phy_calibrate);
|
||||
+
|
||||
/**
|
||||
* _of_phy_get() - lookup and obtain a reference to a phy by phandle
|
||||
* @np: device_node for which to get the phy
|
||||
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
|
||||
index e694d40..87580c8 100644
|
||||
--- a/include/linux/phy/phy.h
|
||||
+++ b/include/linux/phy/phy.h
|
||||
@@ -39,6 +39,7 @@ enum phy_mode {
|
||||
* @power_off: powering off the phy
|
||||
* @set_mode: set the mode of the phy
|
||||
* @reset: resetting the phy
|
||||
+ * @calibrate: calibrate the phy
|
||||
* @owner: the module owner containing the ops
|
||||
*/
|
||||
struct phy_ops {
|
||||
@@ -48,6 +49,7 @@ struct phy_ops {
|
||||
int (*power_off)(struct phy *phy);
|
||||
int (*set_mode)(struct phy *phy, enum phy_mode mode);
|
||||
int (*reset)(struct phy *phy);
|
||||
+ int (*calibrate)(struct phy *phy);
|
||||
struct module *owner;
|
||||
};
|
||||
|
||||
@@ -141,6 +143,7 @@ static inline void *phy_get_drvdata(struct phy *phy)
|
||||
int phy_power_off(struct phy *phy);
|
||||
int phy_set_mode(struct phy *phy, enum phy_mode mode);
|
||||
int phy_reset(struct phy *phy);
|
||||
+int phy_calibrate(struct phy *phy);
|
||||
static inline int phy_get_bus_width(struct phy *phy)
|
||||
{
|
||||
return phy->attrs.bus_width;
|
||||
@@ -262,6 +265,13 @@ static inline int phy_reset(struct phy *phy)
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
+static inline int phy_calibrate(struct phy *phy)
|
||||
+{
|
||||
+ if (!phy)
|
||||
+ return 0;
|
||||
+ return -ENOSYS;
|
||||
+}
|
||||
+
|
||||
static inline int phy_get_bus_width(struct phy *phy)
|
||||
{
|
||||
return -ENOSYS;
|
||||
From patchwork Mon Oct 9 12:00:51 2017
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [PATCHv4,
|
||||
2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800
|
||||
From: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
|
||||
X-Patchwork-Id: 9992809
|
||||
Message-Id: <1507550451-21324-3-git-send-email-andrzej.p@samsung.com>
|
||||
To: linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org,
|
||||
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
|
||||
Cc: Mark Rutland <mark.rutland@arm.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
|
||||
Russell King <linux@armlinux.org.uk>,
|
||||
Krzysztof Kozlowski <krzk@kernel.org>,
|
||||
Kishon Vijay Abraham I <kishon@ti.com>,
|
||||
Rob Herring <robh+dt@kernel.org>, Kukjin Kim <kgene@kernel.org>,
|
||||
Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
|
||||
Marek Szyprowski <m.szyprowski@samsung.com>
|
||||
Date: Mon, 09 Oct 2017 14:00:51 +0200
|
||||
|
||||
From: Vivek Gautam <gautam.vivek@samsung.com>
|
||||
|
||||
Adding phy calibration sequence for USB 3.0 DRD PHY present on
|
||||
Exynos5420/5800 systems.
|
||||
This calibration facilitates setting certain PHY parameters viz.
|
||||
the Loss-of-Signal (LOS) Detector Threshold Level, as well as
|
||||
Tx-Vboost-Level for Super-Speed operations.
|
||||
Additionally we also set proper time to wait for RxDetect measurement,
|
||||
for desired PHY reference clock, so as to solve issue with enumeration
|
||||
of few USB 3.0 devices, like Samsung SUM-TSB16S 3.0 USB drive
|
||||
on the controller.
|
||||
|
||||
We are using CR_port for this purpose to send required data
|
||||
to override the LOS values.
|
||||
|
||||
On testing with USB 3.0 devices on USB 3.0 port present on
|
||||
SMDK5420, and peach-pit boards should see following message:
|
||||
usb 2-1: new SuperSpeed USB device number 2 using xhci-hcd
|
||||
|
||||
and without this patch, should see below shown message:
|
||||
usb 1-1: new high-speed USB device number 2 using xhci-hcd
|
||||
|
||||
[Also removed unnecessary extra lines in the register macro definitions]
|
||||
|
||||
Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
|
||||
[adapted to use phy_calibrate as entry point]
|
||||
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
|
||||
---
|
||||
drivers/phy/samsung/phy-exynos5-usbdrd.c | 183 +++++++++++++++++++++++++++++++
|
||||
drivers/usb/dwc3/core.c | 7 +-
|
||||
2 files changed, 188 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
|
||||
index 22c68f5..9e83c15 100644
|
||||
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
|
||||
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
|
||||
@@ -90,7 +90,17 @@
|
||||
#define PHYCLKRST_COMMONONN BIT(0)
|
||||
|
||||
#define EXYNOS5_DRD_PHYREG0 0x14
|
||||
+#define PHYREG0_SSC_REF_CLK_SEL BIT(21)
|
||||
+#define PHYREG0_SSC_RANGE BIT(20)
|
||||
+#define PHYREG0_CR_WRITE BIT(19)
|
||||
+#define PHYREG0_CR_READ BIT(18)
|
||||
+#define PHYREG0_CR_DATA_IN(_x) ((_x) << 2)
|
||||
+#define PHYREG0_CR_CAP_DATA BIT(1)
|
||||
+#define PHYREG0_CR_CAP_ADDR BIT(0)
|
||||
+
|
||||
#define EXYNOS5_DRD_PHYREG1 0x18
|
||||
+#define PHYREG1_CR_DATA_OUT(_x) ((_x) << 1)
|
||||
+#define PHYREG1_CR_ACK BIT(0)
|
||||
|
||||
#define EXYNOS5_DRD_PHYPARAM0 0x1c
|
||||
|
||||
@@ -119,6 +129,25 @@
|
||||
#define EXYNOS5_DRD_PHYRESUME 0x34
|
||||
#define EXYNOS5_DRD_LINKPORT 0x44
|
||||
|
||||
+/* USB 3.0 DRD PHY SS Function Control Reg; accessed by CR_PORT */
|
||||
+#define EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN (0x15)
|
||||
+#define LOSLEVEL_OVRD_IN_LOS_BIAS_5420 (0x5 << 13)
|
||||
+#define LOSLEVEL_OVRD_IN_LOS_BIAS_DEFAULT (0x0 << 13)
|
||||
+#define LOSLEVEL_OVRD_IN_EN (0x1 << 10)
|
||||
+#define LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT (0x9 << 0)
|
||||
+
|
||||
+#define EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN (0x12)
|
||||
+#define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420 (0x5 << 13)
|
||||
+#define TX_VBOOSTLEVEL_OVRD_IN_VBOOST_DEFAULT (0x4 << 13)
|
||||
+
|
||||
+#define EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG (0x1010)
|
||||
+#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M (0x4 << 4)
|
||||
+#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M (0x8 << 4)
|
||||
+#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_25M_26M (0x8 << 4)
|
||||
+#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M (0x20 << 4)
|
||||
+#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_62M5 (0x20 << 4)
|
||||
+#define LANE0_TX_DEBUG_RXDET_MEAS_TIME_96M_100M (0x40 << 4)
|
||||
+
|
||||
#define KHZ 1000
|
||||
#define MHZ (KHZ * KHZ)
|
||||
|
||||
@@ -527,6 +556,151 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int crport_handshake(struct exynos5_usbdrd_phy *phy_drd,
|
||||
+ u32 val, u32 cmd)
|
||||
+{
|
||||
+ u32 usec = 100;
|
||||
+ unsigned int result;
|
||||
+
|
||||
+ writel(val | cmd, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
|
||||
+
|
||||
+ do {
|
||||
+ result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1);
|
||||
+ if (result & PHYREG1_CR_ACK)
|
||||
+ break;
|
||||
+
|
||||
+ udelay(1);
|
||||
+ } while (usec-- > 0);
|
||||
+
|
||||
+ if (!usec) {
|
||||
+ dev_err(phy_drd->dev,
|
||||
+ "CRPORT handshake timeout1 (0x%08x)\n", val);
|
||||
+ return -ETIME;
|
||||
+ }
|
||||
+
|
||||
+ usec = 100;
|
||||
+
|
||||
+ writel(val, phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
|
||||
+
|
||||
+ do {
|
||||
+ result = readl(phy_drd->reg_phy + EXYNOS5_DRD_PHYREG1);
|
||||
+ if (!(result & PHYREG1_CR_ACK))
|
||||
+ break;
|
||||
+
|
||||
+ udelay(1);
|
||||
+ } while (usec-- > 0);
|
||||
+
|
||||
+ if (!usec) {
|
||||
+ dev_err(phy_drd->dev,
|
||||
+ "CRPORT handshake timeout2 (0x%08x)\n", val);
|
||||
+ return -ETIME;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int crport_ctrl_write(struct exynos5_usbdrd_phy *phy_drd,
|
||||
+ u32 addr, u32 data)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Write Address */
|
||||
+ writel(PHYREG0_CR_DATA_IN(addr),
|
||||
+ phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
|
||||
+ ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(addr),
|
||||
+ PHYREG0_CR_CAP_ADDR);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* Write Data */
|
||||
+ writel(PHYREG0_CR_DATA_IN(data),
|
||||
+ phy_drd->reg_phy + EXYNOS5_DRD_PHYREG0);
|
||||
+ ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data),
|
||||
+ PHYREG0_CR_CAP_DATA);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = crport_handshake(phy_drd, PHYREG0_CR_DATA_IN(data),
|
||||
+ PHYREG0_CR_WRITE);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Calibrate few PHY parameters using CR_PORT register to meet
|
||||
+ * SuperSpeed requirements on Exynos5420 and Exynos5800 systems,
|
||||
+ * which have 28nm USB 3.0 DRD PHY.
|
||||
+ */
|
||||
+static int exynos5420_usbdrd_phy_calibrate(struct exynos5_usbdrd_phy *phy_drd)
|
||||
+{
|
||||
+ unsigned int temp;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ /*
|
||||
+ * Change los_bias to (0x5) for 28nm PHY from a
|
||||
+ * default value (0x0); los_level is set as default
|
||||
+ * (0x9) as also reflected in los_level[30:26] bits
|
||||
+ * of PHYPARAM0 register.
|
||||
+ */
|
||||
+ temp = LOSLEVEL_OVRD_IN_LOS_BIAS_5420 |
|
||||
+ LOSLEVEL_OVRD_IN_EN |
|
||||
+ LOSLEVEL_OVRD_IN_LOS_LEVEL_DEFAULT;
|
||||
+ ret = crport_ctrl_write(phy_drd,
|
||||
+ EXYNOS5_DRD_PHYSS_LOSLEVEL_OVRD_IN,
|
||||
+ temp);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy_drd->dev,
|
||||
+ "Failed setting Loss-of-Signal level for SuperSpeed\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Set tx_vboost_lvl to (0x5) for 28nm PHY Tuning,
|
||||
+ * to raise Tx signal level from its default value of (0x4)
|
||||
+ */
|
||||
+ temp = TX_VBOOSTLEVEL_OVRD_IN_VBOOST_5420;
|
||||
+ ret = crport_ctrl_write(phy_drd,
|
||||
+ EXYNOS5_DRD_PHYSS_TX_VBOOSTLEVEL_OVRD_IN,
|
||||
+ temp);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy_drd->dev,
|
||||
+ "Failed setting Tx-Vboost-Level for SuperSpeed\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Set proper time to wait for RxDetect measurement, for
|
||||
+ * desired reference clock of PHY, by tuning the CR_PORT
|
||||
+ * register LANE0.TX_DEBUG which is internal to PHY.
|
||||
+ * This fixes issue with few USB 3.0 devices, which are
|
||||
+ * not detected (not even generate interrupts on the bus
|
||||
+ * on insertion) without this change.
|
||||
+ * e.g. Samsung SUM-TSB16S 3.0 USB drive.
|
||||
+ */
|
||||
+ switch (phy_drd->extrefclk) {
|
||||
+ case EXYNOS5_FSEL_50MHZ:
|
||||
+ temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_48M_50M_52M;
|
||||
+ break;
|
||||
+ case EXYNOS5_FSEL_20MHZ:
|
||||
+ case EXYNOS5_FSEL_19MHZ2:
|
||||
+ temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_19M2_20M;
|
||||
+ break;
|
||||
+ case EXYNOS5_FSEL_24MHZ:
|
||||
+ default:
|
||||
+ temp = LANE0_TX_DEBUG_RXDET_MEAS_TIME_24M;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ret = crport_ctrl_write(phy_drd,
|
||||
+ EXYNOS5_DRD_PHYSS_LANE0_TX_DEBUG,
|
||||
+ temp);
|
||||
+ if (ret)
|
||||
+ dev_err(phy_drd->dev,
|
||||
+ "Failed setting RxDetect measurement time for SuperSpeed\n");
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
|
||||
struct of_phandle_args *args)
|
||||
{
|
||||
@@ -538,11 +712,20 @@ static struct phy *exynos5_usbdrd_phy_xlate(struct device *dev,
|
||||
return phy_drd->phys[args->args[0]].phy;
|
||||
}
|
||||
|
||||
+static int exynos5_usbdrd_phy_calibrate(struct phy *phy)
|
||||
+{
|
||||
+ struct phy_usb_instance *inst = phy_get_drvdata(phy);
|
||||
+ struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
|
||||
+
|
||||
+ return exynos5420_usbdrd_phy_calibrate(phy_drd);
|
||||
+}
|
||||
+
|
||||
static const struct phy_ops exynos5_usbdrd_phy_ops = {
|
||||
.init = exynos5_usbdrd_phy_init,
|
||||
.exit = exynos5_usbdrd_phy_exit,
|
||||
.power_on = exynos5_usbdrd_phy_power_on,
|
||||
.power_off = exynos5_usbdrd_phy_power_off,
|
||||
+ .calibrate = exynos5_usbdrd_phy_calibrate,
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
|
||||
index 03474d3..224e0dd 100644
|
||||
--- a/drivers/usb/dwc3/core.c
|
||||
+++ b/drivers/usb/dwc3/core.c
|
||||
@@ -156,9 +156,10 @@ static void __dwc3_set_mode(struct work_struct *work)
|
||||
} else {
|
||||
if (dwc->usb2_phy)
|
||||
otg_set_vbus(dwc->usb2_phy->otg, true);
|
||||
- if (dwc->usb2_generic_phy)
|
||||
+ if (dwc->usb2_generic_phy) {
|
||||
phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
|
||||
-
|
||||
+ phy_calibrate(dwc->usb2_generic_phy);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case DWC3_GCTL_PRTCAP_DEVICE:
|
||||
@@ -955,6 +956,8 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
|
||||
dev_err(dev, "failed to initialize host\n");
|
||||
return ret;
|
||||
}
|
||||
+ if (dwc->usb2_generic_phy)
|
||||
+ phy_calibrate(dwc->usb2_generic_phy);
|
||||
break;
|
||||
case USB_DR_MODE_OTG:
|
||||
INIT_WORK(&dwc->drd_work, __dwc3_set_mode);
|
|
@ -1,224 +0,0 @@
|
|||
From 0fe4d2181cc4cb3eba303c0e03f878d2558d0f3a Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Date: Fri, 31 Mar 2017 20:03:04 +0000
|
||||
Subject: [PATCH] ARM: dts: bcm283x: Add CPU thermal zone with 1
|
||||
trip point
|
||||
|
||||
As suggested by Eduardo Valentin this adds the thermal zone for
|
||||
the bcm2835 SoC with its single thermal sensor. We start with
|
||||
the criticial trip point and leave the cooling devices empty
|
||||
since we don't have any at the moment. Since the coefficients
|
||||
could vary depending on the SoC we need to define them separate.
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Signed-off-by: Eric Anholt <eric@anholt.net>
|
||||
Acked-by: Eduardo Valentin <edubezval@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2835.dtsi | 4 ++++
|
||||
arch/arm/boot/dts/bcm2836.dtsi | 4 ++++
|
||||
arch/arm/boot/dts/bcm283x.dtsi | 21 +++++++++++++++++++++
|
||||
3 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
|
||||
index 0890d97e674d..659b6e9513b1 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm2835.dtsi
|
||||
@@ -24,6 +24,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&cpu_thermal {
|
||||
+ coefficients = <(-538) 407000>;
|
||||
+};
|
||||
+
|
||||
/* enable thermal sensor with the correct compatible property set */
|
||||
&thermal {
|
||||
compatible = "brcm,bcm2835-thermal";
|
||||
diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi
|
||||
index 519a44f5d25a..da3deeb42592 100644
|
||||
--- a/arch/arm/boot/dts/bcm2836.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm2836.dtsi
|
||||
@@ -77,6 +77,10 @@
|
||||
interrupts = <8>;
|
||||
};
|
||||
|
||||
+&cpu_thermal {
|
||||
+ coefficients = <(-538) 407000>;
|
||||
+};
|
||||
+
|
||||
/* enable thermal sensor with the correct compatible property set */
|
||||
&thermal {
|
||||
compatible = "brcm,bcm2836-thermal";
|
||||
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
|
||||
index 561f27d8d922..86a5db53da8f 100644
|
||||
--- a/arch/arm/boot/dts/bcm283x.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm283x.dtsi
|
||||
@@ -19,6 +19,26 @@
|
||||
bootargs = "earlyprintk console=ttyAMA0";
|
||||
};
|
||||
|
||||
+ thermal-zones {
|
||||
+ cpu_thermal: cpu-thermal {
|
||||
+ polling-delay-passive = <0>;
|
||||
+ polling-delay = <1000>;
|
||||
+
|
||||
+ thermal-sensors = <&thermal>;
|
||||
+
|
||||
+ trips {
|
||||
+ cpu-crit {
|
||||
+ temperature = <80000>;
|
||||
+ hysteresis = <0>;
|
||||
+ type = "critical";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cooling-maps {
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
soc {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <1>;
|
||||
@@ -430,6 +450,7 @@
|
||||
compatible = "brcm,bcm2835-thermal";
|
||||
reg = <0x7e212000 0x8>;
|
||||
clocks = <&clocks BCM2835_CLOCK_TSENS>;
|
||||
+ #thermal-sensor-cells = <0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 4ae6f954b96c1fea86c6f21ae8fc413f5fc3444e Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Date: Fri, 31 Mar 2017 20:03:05 +0000
|
||||
Subject: [PATCH] ARM64: dts: bcm2837: Define CPU thermal coefficients
|
||||
|
||||
This defines the bcm2837 SoC specific thermal coefficients in
|
||||
order to initialize the thermal driver correctly.
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Signed-off-by: Eric Anholt <eric@anholt.net>
|
||||
Acked-by: Eduardo Valentin <edubezval@gmail.com>
|
||||
---
|
||||
arch/arm64/boot/dts/broadcom/bcm2837.dtsi | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
|
||||
index 19f2fe620a21..2d5de6f0f78d 100644
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm2837.dtsi
|
||||
@@ -75,6 +75,10 @@
|
||||
interrupts = <8>;
|
||||
};
|
||||
|
||||
+&cpu_thermal {
|
||||
+ coefficients = <(-538) 412000>;
|
||||
+};
|
||||
+
|
||||
/* enable thermal sensor with the correct compatible property set */
|
||||
&thermal {
|
||||
compatible = "brcm,bcm2837-thermal";
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 1fe3854a83b580727c9464b37b62ba77ead1d6f6 Mon Sep 17 00:00:00 2001
|
||||
From: Dan Carpenter <dan.carpenter@oracle.com>
|
||||
Date: Wed, 14 Jun 2017 12:13:27 +0300
|
||||
Subject: [PATCH] thermal: bcm2835: fix an error code in probe()
|
||||
|
||||
This causes a static checker because we're passing a valid pointer to
|
||||
PTR_ERR(). "err" is already the correct error code, so we can just
|
||||
delete this line.
|
||||
|
||||
Fixes: bcb7dd9ef206 ("thermal: bcm2835: add thermal driver for bcm2835 SoC")
|
||||
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
|
||||
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
|
||||
---
|
||||
drivers/thermal/broadcom/bcm2835_thermal.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c
|
||||
index 0ecf80890c84..e6863c841662 100644
|
||||
--- a/drivers/thermal/broadcom/bcm2835_thermal.c
|
||||
+++ b/drivers/thermal/broadcom/bcm2835_thermal.c
|
||||
@@ -245,7 +245,6 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
|
||||
*/
|
||||
err = tz->ops->get_trip_temp(tz, 0, &trip_temp);
|
||||
if (err < 0) {
|
||||
- err = PTR_ERR(tz);
|
||||
dev_err(&pdev->dev,
|
||||
"Not able to read trip_temp: %d\n",
|
||||
err);
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From e3bdc8d7623d5875403ad40443e7b049ae200fcd Mon Sep 17 00:00:00 2001
|
||||
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
|
||||
Date: Tue, 6 Jun 2017 15:12:37 +0530
|
||||
Subject: [PATCH] thermal: imx: Handle return value of clk_prepare_enable
|
||||
|
||||
clk_prepare_enable() can fail here and we must check its return value.
|
||||
|
||||
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
|
||||
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
|
||||
---
|
||||
drivers/thermal/imx_thermal.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
|
||||
index f7ec39f46ee4..4798b4b1fd77 100644
|
||||
--- a/drivers/thermal/imx_thermal.c
|
||||
+++ b/drivers/thermal/imx_thermal.c
|
||||
@@ -660,8 +660,11 @@ static int imx_thermal_resume(struct device *dev)
|
||||
{
|
||||
struct imx_thermal_data *data = dev_get_drvdata(dev);
|
||||
struct regmap *map = data->tempmon;
|
||||
+ int ret;
|
||||
|
||||
- clk_prepare_enable(data->thermal_clk);
|
||||
+ ret = clk_prepare_enable(data->thermal_clk);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
/* Enabled thermal sensor after resume */
|
||||
regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
|
||||
regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
|
||||
--
|
||||
2.13.3
|
||||
|
||||
From 919054fdfc8adf58c5512fe9872eb53ea0f5525d Mon Sep 17 00:00:00 2001
|
||||
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
|
||||
Date: Tue, 6 Jun 2017 15:04:46 +0530
|
||||
Subject: [PATCH] thermal: hisilicon: Handle return value of clk_prepare_enable
|
||||
|
||||
clk_prepare_enable() can fail here and we must check its return value.
|
||||
|
||||
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
|
||||
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
|
||||
---
|
||||
drivers/thermal/hisi_thermal.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
|
||||
index f6429666a1cf..9c3ce341eb97 100644
|
||||
--- a/drivers/thermal/hisi_thermal.c
|
||||
+++ b/drivers/thermal/hisi_thermal.c
|
||||
@@ -397,8 +397,11 @@ static int hisi_thermal_suspend(struct device *dev)
|
||||
static int hisi_thermal_resume(struct device *dev)
|
||||
{
|
||||
struct hisi_thermal_data *data = dev_get_drvdata(dev);
|
||||
+ int ret;
|
||||
|
||||
- clk_prepare_enable(data->clk);
|
||||
+ ret = clk_prepare_enable(data->clk);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
|
||||
data->irq_enabled = true;
|
||||
hisi_thermal_enable_bind_irq_sensor(data);
|
||||
--
|
||||
2.13.3
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
From patchwork Mon Jan 8 15:44:19 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2] mmc: sdhci_f_sdh30: add ACPI support
|
||||
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
X-Patchwork-Id: 10149775
|
||||
Message-Id: <20180108154419.2821-1-ard.biesheuvel@linaro.org>
|
||||
To: linux-mmc@vger.kernel.org
|
||||
Cc: adrian.hunter@intel.com, ulf.hansson@linaro.org,
|
||||
Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
Date: Mon, 8 Jan 2018 15:44:19 +0000
|
||||
|
||||
The Fujitsu SDH30 SDHCI controller may be described as a SCX0002 ACPI
|
||||
device on ACPI platforms incorporating the Socionext SynQuacer SoC.
|
||||
|
||||
Given that mmc_of_parse() has already been made ACPI/DT agnostic,
|
||||
making the SDH30 driver ACPI capable is actually rather simple:
|
||||
all we need to do is make the call to sdhci_get_of_property() [which
|
||||
does not set any properties we care about] and the clock handling
|
||||
dependent on whether we are dealing with a DT device, and exposing
|
||||
the ACPI id via the platform_driver struct and the module metadata.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
|
||||
---
|
||||
v2: make OF optional now that ACPI is supported
|
||||
drop dev_of_node() check when disabling the clocks - those routines
|
||||
tolerate NULL pointers so there's no need
|
||||
|
||||
drivers/mmc/host/Kconfig | 2 +-
|
||||
drivers/mmc/host/sdhci_f_sdh30.c | 52 +++++++++++++-------
|
||||
2 files changed, 35 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
|
||||
index 567028c9219a..07ed947ed10b 100644
|
||||
--- a/drivers/mmc/host/Kconfig
|
||||
+++ b/drivers/mmc/host/Kconfig
|
||||
@@ -320,7 +320,7 @@ config MMC_SDHCI_BCM_KONA
|
||||
config MMC_SDHCI_F_SDH30
|
||||
tristate "SDHCI support for Fujitsu Semiconductor F_SDH30"
|
||||
depends on MMC_SDHCI_PLTFM
|
||||
- depends on OF
|
||||
+ depends on OF || ACPI
|
||||
help
|
||||
This selects the Secure Digital Host Controller Interface (SDHCI)
|
||||
Needed by some Fujitsu SoC for MMC / SD / SDIO support.
|
||||
diff --git a/drivers/mmc/host/sdhci_f_sdh30.c b/drivers/mmc/host/sdhci_f_sdh30.c
|
||||
index 04ca0d33a521..485f7591fae4 100644
|
||||
--- a/drivers/mmc/host/sdhci_f_sdh30.c
|
||||
+++ b/drivers/mmc/host/sdhci_f_sdh30.c
|
||||
@@ -10,9 +10,11 @@
|
||||
* the Free Software Foundation, version 2 of the License.
|
||||
*/
|
||||
|
||||
+#include <linux/acpi.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
@@ -146,7 +148,6 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
- sdhci_get_of_property(pdev);
|
||||
host->hw_name = "f_sdh30";
|
||||
host->ops = &sdhci_f_sdh30_ops;
|
||||
host->irq = irq;
|
||||
@@ -158,25 +159,29 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
- priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
|
||||
- if (IS_ERR(priv->clk_iface)) {
|
||||
- ret = PTR_ERR(priv->clk_iface);
|
||||
- goto err;
|
||||
- }
|
||||
+ if (dev_of_node(dev)) {
|
||||
+ sdhci_get_of_property(pdev);
|
||||
|
||||
- ret = clk_prepare_enable(priv->clk_iface);
|
||||
- if (ret)
|
||||
- goto err;
|
||||
+ priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
|
||||
+ if (IS_ERR(priv->clk_iface)) {
|
||||
+ ret = PTR_ERR(priv->clk_iface);
|
||||
+ goto err;
|
||||
+ }
|
||||
|
||||
- priv->clk = devm_clk_get(&pdev->dev, "core");
|
||||
- if (IS_ERR(priv->clk)) {
|
||||
- ret = PTR_ERR(priv->clk);
|
||||
- goto err_clk;
|
||||
- }
|
||||
+ ret = clk_prepare_enable(priv->clk_iface);
|
||||
+ if (ret)
|
||||
+ goto err;
|
||||
|
||||
- ret = clk_prepare_enable(priv->clk);
|
||||
- if (ret)
|
||||
- goto err_clk;
|
||||
+ priv->clk = devm_clk_get(&pdev->dev, "core");
|
||||
+ if (IS_ERR(priv->clk)) {
|
||||
+ ret = PTR_ERR(priv->clk);
|
||||
+ goto err_clk;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(priv->clk);
|
||||
+ if (ret)
|
||||
+ goto err_clk;
|
||||
+ }
|
||||
|
||||
/* init vendor specific regs */
|
||||
ctrl = sdhci_readw(host, F_SDH30_AHB_CONFIG);
|
||||
@@ -226,16 +231,27 @@ static int sdhci_f_sdh30_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_OF
|
||||
static const struct of_device_id f_sdh30_dt_ids[] = {
|
||||
{ .compatible = "fujitsu,mb86s70-sdhci-3.0" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, f_sdh30_dt_ids);
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CONFIG_ACPI
|
||||
+static const struct acpi_device_id f_sdh30_acpi_ids[] = {
|
||||
+ { "SCX0002" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(acpi, f_sdh30_acpi_ids);
|
||||
+#endif
|
||||
|
||||
static struct platform_driver sdhci_f_sdh30_driver = {
|
||||
.driver = {
|
||||
.name = "f_sdh30",
|
||||
- .of_match_table = f_sdh30_dt_ids,
|
||||
+ .of_match_table = of_match_ptr(f_sdh30_dt_ids),
|
||||
+ .acpi_match_table = ACPI_PTR(f_sdh30_acpi_ids),
|
||||
.pm = &sdhci_pltfm_pmops,
|
||||
},
|
||||
.probe = sdhci_f_sdh30_probe,
|
|
@ -1,423 +1,3 @@
|
|||
From 58be18a7bbf9dca67f4260ac172a44baa59d0ee9 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
Date: Mon, 21 Aug 2017 10:47:48 +0100
|
||||
Subject: arm64: acpi/gtdt: validate CNTFRQ after having enabled the frame
|
||||
|
||||
The ACPI GTDT code validates the CNTFRQ field of each MMIO timer
|
||||
frame against the CNTFRQ system register of the current CPU, to
|
||||
ensure that they are equal, which is mandated by the architecture.
|
||||
|
||||
However, reading the CNTFRQ field of a frame is not possible until
|
||||
the RFRQ bit in the frame's CNTACRn register is set, and doing so
|
||||
before that willl produce the following error:
|
||||
|
||||
arch_timer: [Firmware Bug]: CNTFRQ mismatch: frame @ 0x00000000e0be0000: (0x00000000), CPU: (0x0ee6b280)
|
||||
arch_timer: Disabling MMIO timers due to CNTFRQ mismatch
|
||||
arch_timer: Failed to initialize memory-mapped timer.
|
||||
|
||||
The reason is that the CNTFRQ field is RES0 if access is not enabled.
|
||||
|
||||
So move the validation of CNTFRQ into the loop that iterates over the
|
||||
timers to find the best frame, but defer it until after we have selected
|
||||
the best frame, which should also have enabled the RFRQ bit.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
---
|
||||
drivers/clocksource/arm_arch_timer.c | 38 ++++++++++++++++++++----------------
|
||||
1 file changed, 21 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
|
||||
index fd4b7f6..14e2419 100644
|
||||
--- a/drivers/clocksource/arm_arch_timer.c
|
||||
+++ b/drivers/clocksource/arm_arch_timer.c
|
||||
@@ -1268,10 +1268,6 @@ arch_timer_mem_find_best_frame(struct arch_timer_mem *timer_mem)
|
||||
|
||||
iounmap(cntctlbase);
|
||||
|
||||
- if (!best_frame)
|
||||
- pr_err("Unable to find a suitable frame in timer @ %pa\n",
|
||||
- &timer_mem->cntctlbase);
|
||||
-
|
||||
return best_frame;
|
||||
}
|
||||
|
||||
@@ -1372,6 +1368,8 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
|
||||
|
||||
frame = arch_timer_mem_find_best_frame(timer_mem);
|
||||
if (!frame) {
|
||||
+ pr_err("Unable to find a suitable frame in timer @ %pa\n",
|
||||
+ &timer_mem->cntctlbase);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -1420,7 +1418,7 @@ arch_timer_mem_verify_cntfrq(struct arch_timer_mem *timer_mem)
|
||||
static int __init arch_timer_mem_acpi_init(int platform_timer_count)
|
||||
{
|
||||
struct arch_timer_mem *timers, *timer;
|
||||
- struct arch_timer_mem_frame *frame;
|
||||
+ struct arch_timer_mem_frame *frame, *best_frame = NULL;
|
||||
int timer_count, i, ret = 0;
|
||||
|
||||
timers = kcalloc(platform_timer_count, sizeof(*timers),
|
||||
@@ -1432,14 +1430,6 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
|
||||
if (ret || !timer_count)
|
||||
goto out;
|
||||
|
||||
- for (i = 0; i < timer_count; i++) {
|
||||
- ret = arch_timer_mem_verify_cntfrq(&timers[i]);
|
||||
- if (ret) {
|
||||
- pr_err("Disabling MMIO timers due to CNTFRQ mismatch\n");
|
||||
- goto out;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/*
|
||||
* While unlikely, it's theoretically possible that none of the frames
|
||||
* in a timer expose the combination of feature we want.
|
||||
@@ -1448,12 +1438,26 @@ static int __init arch_timer_mem_acpi_init(int platform_timer_count)
|
||||
timer = &timers[i];
|
||||
|
||||
frame = arch_timer_mem_find_best_frame(timer);
|
||||
- if (frame)
|
||||
- break;
|
||||
+ if (!best_frame)
|
||||
+ best_frame = frame;
|
||||
+
|
||||
+ ret = arch_timer_mem_verify_cntfrq(timer);
|
||||
+ if (ret) {
|
||||
+ pr_err("Disabling MMIO timers due to CNTFRQ mismatch\n");
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (!best_frame) /* implies !frame */
|
||||
+ /*
|
||||
+ * Only complain about missing suitable frames if we
|
||||
+ * haven't already found one in a previous iteration.
|
||||
+ */
|
||||
+ pr_err("Unable to find a suitable frame in timer @ %pa\n",
|
||||
+ &timer->cntctlbase);
|
||||
}
|
||||
|
||||
- if (frame)
|
||||
- ret = arch_timer_mem_frame_register(frame);
|
||||
+ if (best_frame)
|
||||
+ ret = arch_timer_mem_frame_register(best_frame);
|
||||
out:
|
||||
kfree(timers);
|
||||
return ret;
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
From 33d983b5bb2929ae242606925e708092b1dfdd8f Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
Date: Sat, 2 Sep 2017 11:01:22 +0100
|
||||
Subject: drivers/irqchip: gicv3: add workaround for Synquacer pre-ITS
|
||||
|
||||
In their infinite wisdom, the Socionext engineers have decided
|
||||
that ITS device IDs should not be hardwired, but it should be
|
||||
left up to the software to assign them, by allowing it to
|
||||
redirect MSI doorbell writes via a separate hardware block
|
||||
that issues the doorbell write with a device ID that is
|
||||
derived from the memory address. This completely breaks any
|
||||
kind of isolation, or virtualization in general, for that
|
||||
matter, but add support for it nonetheless.
|
||||
|
||||
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
---
|
||||
arch/arm64/Kconfig | 8 +++++++
|
||||
drivers/irqchip/irq-gic-v3-its.c | 48 +++++++++++++++++++++++++++++++++++-----
|
||||
2 files changed, 51 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
|
||||
index 0df64a6..c4361df 100644
|
||||
--- a/arch/arm64/Kconfig
|
||||
+++ b/arch/arm64/Kconfig
|
||||
@@ -539,6 +539,14 @@ config QCOM_QDF2400_ERRATUM_0065
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
+config SOCIONEXT_SYNQUACER_PREITS
|
||||
+ bool "Socionext Synquacer: Workaround for GICv3 pre-ITS"
|
||||
+ default y
|
||||
+ help
|
||||
+ Socionext Synquacer SoCs implement a separate h/w block to generate
|
||||
+ MSI doorbell writes with non-zero values for the device ID.
|
||||
+
|
||||
+ If unsure, say Y.
|
||||
endmenu
|
||||
|
||||
|
||||
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
|
||||
index e8d8934..0d372f1 100644
|
||||
--- a/drivers/irqchip/irq-gic-v3-its.c
|
||||
+++ b/drivers/irqchip/irq-gic-v3-its.c
|
||||
@@ -46,6 +46,7 @@
|
||||
#define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0)
|
||||
#define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1)
|
||||
#define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2)
|
||||
+#define ITS_FLAGS_WORKAROUND_SOCIONEXT_PREITS (1ULL << 3)
|
||||
|
||||
#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
|
||||
|
||||
@@ -99,6 +100,10 @@ struct its_node {
|
||||
struct its_collection *collections;
|
||||
struct list_head its_device_list;
|
||||
u64 flags;
|
||||
+#ifdef CONFIG_SOCIONEXT_SYNQUACER_PREITS
|
||||
+ u64 pre_its_base;
|
||||
+ u64 pre_its_size;
|
||||
+#endif
|
||||
u32 ite_size;
|
||||
u32 device_ids;
|
||||
int numa_node;
|
||||
@@ -1102,13 +1107,29 @@ static void its_irq_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
|
||||
u64 addr;
|
||||
|
||||
its = its_dev->its;
|
||||
- addr = its->phys_base + GITS_TRANSLATER;
|
||||
+
|
||||
+#ifdef CONFIG_SOCIONEXT_SYNQUACER_PREITS
|
||||
+ if (its->flags & ITS_FLAGS_WORKAROUND_SOCIONEXT_PREITS)
|
||||
+
|
||||
+ /*
|
||||
+ * The Socionext Synquacer SoC has a so-called 'pre-ITS',
|
||||
+ * which maps 32-bit writes into a separate window of size
|
||||
+ * '4 << device_id_bits' onto writes to GITS_TRANSLATER with
|
||||
+ * device ID taken from bits [device_id_bits + 1:2] of the
|
||||
+ * window offset.
|
||||
+ */
|
||||
+ addr = its->pre_its_base + (its_dev->device_id << 2);
|
||||
+ else
|
||||
+#endif
|
||||
+ addr = its->phys_base + GITS_TRANSLATER;
|
||||
|
||||
msg->address_lo = lower_32_bits(addr);
|
||||
msg->address_hi = upper_32_bits(addr);
|
||||
msg->data = its_get_event_id(d);
|
||||
|
||||
- iommu_dma_map_msi_msg(d->irq, msg);
|
||||
+ if (!IS_ENABLED(CONFIG_SOCIONEXT_SYNQUACER_PREITS) ||
|
||||
+ !(its->flags & ITS_FLAGS_WORKAROUND_SOCIONEXT_PREITS))
|
||||
+ iommu_dma_map_msi_msg(d->irq, msg);
|
||||
}
|
||||
|
||||
static int its_irq_set_irqchip_state(struct irq_data *d,
|
||||
@@ -1666,6 +1687,11 @@ static int its_alloc_tables(struct its_node *its)
|
||||
ids = 0x14; /* 20 bits, 8MB */
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_SOCIONEXT_SYNQUACER_PREITS
|
||||
+ if (its->flags & ITS_FLAGS_WORKAROUND_SOCIONEXT_PREITS)
|
||||
+ ids = ilog2(its->pre_its_size) - 2;
|
||||
+#endif
|
||||
+
|
||||
its->device_ids = ids;
|
||||
|
||||
for (i = 0; i < GITS_BASER_NR_REGS; i++) {
|
||||
@@ -2788,11 +2814,21 @@ static const struct gic_quirk its_quirks[] = {
|
||||
}
|
||||
};
|
||||
|
||||
-static void its_enable_quirks(struct its_node *its)
|
||||
+static void its_enable_quirks(struct its_node *its,
|
||||
+ struct fwnode_handle *handle)
|
||||
{
|
||||
u32 iidr = readl_relaxed(its->base + GITS_IIDR);
|
||||
|
||||
gic_enable_quirks(iidr, its_quirks, its);
|
||||
+
|
||||
+#ifdef CONFIG_SOCIONEXT_SYNQUACER_PREITS
|
||||
+ if (!fwnode_property_read_u64_array(handle,
|
||||
+ "socionext,synquacer-pre-its",
|
||||
+ &its->pre_its_base, 2)) {
|
||||
+ its->flags |= ITS_FLAGS_WORKAROUND_SOCIONEXT_PREITS;
|
||||
+ pr_info("ITS: enabling workaround for Socionext Synquacer pre-ITS\n");
|
||||
+ }
|
||||
+#endif
|
||||
}
|
||||
|
||||
static int its_init_domain(struct fwnode_handle *handle, struct its_node *its)
|
||||
@@ -2812,7 +2848,9 @@ static int its_init_domain(struct fwnode_handle *handle, struct its_node *its)
|
||||
|
||||
inner_domain->parent = its_parent;
|
||||
irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_NEXUS);
|
||||
- inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_REMAP;
|
||||
+
|
||||
+ if (!(its->flags & ITS_FLAGS_WORKAROUND_SOCIONEXT_PREITS))
|
||||
+ inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_REMAP;
|
||||
info->ops = &its_msi_domain_ops;
|
||||
info->data = its;
|
||||
inner_domain->host_data = info;
|
||||
@@ -2966,7 +3004,7 @@ static int __init its_probe_one(struct resource *res,
|
||||
}
|
||||
its->cmd_write = its->cmd_base;
|
||||
|
||||
- its_enable_quirks(its);
|
||||
+ its_enable_quirks(its, handle);
|
||||
|
||||
err = its_alloc_tables(its);
|
||||
if (err)
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
From 26e7bb47b0fb03a01be1e391a08c7375b45335a2 Mon Sep 17 00:00:00 2001
|
||||
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
Date: Mon, 21 Aug 2017 20:29:05 +0100
|
||||
Subject: pci: designware: add driver for DWC controller in ECAM shift mode
|
||||
|
||||
Some implementations of the Synopsys Designware PCIe controller implement
|
||||
a so-called ECAM shift mode, which allows a static memory window to be
|
||||
configured that covers the configuration space of the entire bus range.
|
||||
|
||||
If the firmware performs all the low level configuration that is required
|
||||
to expose this controller in a fully ECAM compatible manner, we can
|
||||
simply describe it as "pci-host-ecam-generic" and be done with it.
|
||||
However, it appears that in some cases (one of which is the Armada 80x0),
|
||||
the IP is synthesized with an ATU window size that does not allow the
|
||||
first bus to be mapped in a way that prevents the device on the
|
||||
downstream port from appearing more than once.
|
||||
|
||||
So implement a driver that relies on the firmware to perform all low
|
||||
level initialization, and drives the controller in ECAM mode, but
|
||||
overrides the config space accessors to take the above quirk into
|
||||
account.
|
||||
|
||||
Note that, unlike most drivers for this IP, this driver does not expose
|
||||
a fake bridge device at B/D/F 00:00.0. There is no point in doing so,
|
||||
given that this is not a true bridge, and does not require any windows
|
||||
to be configured in order for the downstream device to operate correctly.
|
||||
Omitting it also prevents the PCI resource allocation routines from
|
||||
handing out BAR space to it unnecessarily.
|
||||
|
||||
Cc: Bjorn Helgaas <bhelgaas@google.com>
|
||||
Cc: Jingoo Han <jingoohan1@gmail.com>
|
||||
Cc: Joao Pinto <Joao.Pinto@synopsys.com>
|
||||
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
---
|
||||
drivers/pci/dwc/Kconfig | 11 +++++
|
||||
drivers/pci/dwc/Makefile | 1 +
|
||||
drivers/pci/dwc/pcie-designware-ecam.c | 77 ++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 89 insertions(+)
|
||||
create mode 100644 drivers/pci/dwc/pcie-designware-ecam.c
|
||||
|
||||
diff --git a/drivers/pci/dwc/Kconfig b/drivers/pci/dwc/Kconfig
|
||||
index 22ec82f..19856b1 100644
|
||||
--- a/drivers/pci/dwc/Kconfig
|
||||
+++ b/drivers/pci/dwc/Kconfig
|
||||
@@ -169,4 +169,15 @@ config PCIE_KIRIN
|
||||
Say Y here if you want PCIe controller support
|
||||
on HiSilicon Kirin series SoCs.
|
||||
|
||||
+config PCIE_DW_HOST_ECAM
|
||||
+ bool "Synopsys DesignWare PCIe controller in ECAM mode"
|
||||
+ depends on OF && PCI
|
||||
+ select PCI_HOST_COMMON
|
||||
+ select IRQ_DOMAIN
|
||||
+ help
|
||||
+ Add support for Synopsys DesignWare PCIe controllers configured
|
||||
+ by the firmware into ECAM shift mode. In some cases, these are
|
||||
+ fully ECAM compliant, in which case the pci-host-generic driver
|
||||
+ may be used instead.
|
||||
+
|
||||
endmenu
|
||||
diff --git a/drivers/pci/dwc/Makefile b/drivers/pci/dwc/Makefile
|
||||
index c61be97..7d5a23e 100644
|
||||
--- a/drivers/pci/dwc/Makefile
|
||||
+++ b/drivers/pci/dwc/Makefile
|
||||
@@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_PCIE_DW) += pcie-designware.o
|
||||
obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o
|
||||
+obj-$(CONFIG_PCIE_DW_HOST_ECAM) += pcie-designware-ecam.o
|
||||
obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o
|
||||
obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o
|
||||
ifneq ($(filter y,$(CONFIG_PCI_DRA7XX_HOST) $(CONFIG_PCI_DRA7XX_EP)),)
|
||||
diff --git a/drivers/pci/dwc/pcie-designware-ecam.c b/drivers/pci/dwc/pcie-designware-ecam.c
|
||||
new file mode 100644
|
||||
index 0000000..ede627d
|
||||
--- /dev/null
|
||||
+++ b/drivers/pci/dwc/pcie-designware-ecam.c
|
||||
@@ -0,0 +1,77 @@
|
||||
+/*
|
||||
+ * Driver for mostly ECAM compatible Synopsys dw PCIe controllers
|
||||
+ * configured by the firmware into RC mode
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License version 2 as
|
||||
+ * published by the Free Software Foundation.
|
||||
+ *
|
||||
+ * Copyright (C) 2014 ARM Limited
|
||||
+ * Copyright (C) 2017 Linaro Limited
|
||||
+ *
|
||||
+ * Authors: Will Deacon <will.deacon@arm.com>
|
||||
+ * Ard Biesheuvel <ard.biesheuvel@linaro.org>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/of_address.h>
|
||||
+#include <linux/of_pci.h>
|
||||
+#include <linux/pci-ecam.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+static int pci_dw_ecam_config_read(struct pci_bus *bus, u32 devfn, int where,
|
||||
+ int size, u32 *val)
|
||||
+{
|
||||
+ struct pci_config_window *cfg = bus->sysdata;
|
||||
+
|
||||
+ /*
|
||||
+ * The Synopsys dw PCIe controller in RC mode will not filter type 0
|
||||
+ * config TLPs sent to devices 1 and up on its downstream port,
|
||||
+ * resulting in devices appearing multiple times on bus 0 unless we
|
||||
+ * filter them here.
|
||||
+ */
|
||||
+ if (bus->number == cfg->busr.start && PCI_SLOT(devfn) > 0) {
|
||||
+ *val = 0xffffffff;
|
||||
+ return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
+ }
|
||||
+ return pci_generic_config_read(bus, devfn, where, size, val);
|
||||
+}
|
||||
+
|
||||
+static int pci_dw_ecam_config_write(struct pci_bus *bus, u32 devfn, int where,
|
||||
+ int size, u32 val)
|
||||
+{
|
||||
+ struct pci_config_window *cfg = bus->sysdata;
|
||||
+
|
||||
+ if (bus->number == cfg->busr.start && PCI_SLOT(devfn) > 0)
|
||||
+ return PCIBIOS_DEVICE_NOT_FOUND;
|
||||
+
|
||||
+ return pci_generic_config_write(bus, devfn, where, size, val);
|
||||
+}
|
||||
+
|
||||
+static struct pci_ecam_ops pci_dw_ecam_bus_ops = {
|
||||
+ .pci_ops.map_bus = pci_ecam_map_bus,
|
||||
+ .pci_ops.read = pci_dw_ecam_config_read,
|
||||
+ .pci_ops.write = pci_dw_ecam_config_write,
|
||||
+ .bus_shift = 20,
|
||||
+};
|
||||
+
|
||||
+static const struct of_device_id pci_dw_ecam_of_match[] = {
|
||||
+ { .compatible = "marvell,armada8k-pcie-ecam" },
|
||||
+ { .compatible = "socionext,synquacer-pcie-ecam" },
|
||||
+ { .compatible = "snps,dw-pcie-ecam" },
|
||||
+ { },
|
||||
+};
|
||||
+
|
||||
+static int pci_dw_ecam_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ return pci_host_common_probe(pdev, &pci_dw_ecam_bus_ops);
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver pci_dw_ecam_driver = {
|
||||
+ .driver.name = "pcie-designware-ecam",
|
||||
+ .driver.of_match_table = pci_dw_ecam_of_match,
|
||||
+ .driver.suppress_bind_attrs = true,
|
||||
+ .probe = pci_dw_ecam_probe,
|
||||
+};
|
||||
+builtin_platform_driver(pci_dw_ecam_driver);
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
From e3dff048a10f16aa0fd32438442ce39558bbdbef Mon Sep 17 00:00:00 2001
|
||||
From: Jassi Brar <jaswinder.singh@linaro.org>
|
||||
Date: Tue, 29 Aug 2017 22:45:59 +0530
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ACT200L_DONGLE=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ACTISYS_DONGLE=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ALI_FIR=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BOOTPARAM_LOCKDEP_CROSSRELEASE_FULLSTACK is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BPF_JIT_ALWAYS_ON=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BTRFS_FS_REF_VERIFY is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BT_HCIBTUSB_AUTOSUSPEND=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CHASH_SELFTEST is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CHASH_STATS is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CHT_DC_TI_PMIC_OPREGION=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CPU_ISOLATION is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRAMFS_MTD is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CRYPTO_SM3=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DEBUG_KERNEL_DC is not set
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_DEBUG_VM_RB is not set # revisit this if performance isn't horrible
|
|
@ -1 +0,0 @@
|
|||
CONFIG_DONGLE=y
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DP83822_PHY=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DRM_AMD_DC=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_AMD_DC_FBC is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_AMD_DC_PRE_VEGA is not set
|
|
@ -1 +1 @@
|
|||
CONFIG_DRM_I2C_ADV7511=m
|
||||
# CONFIG_DRM_I2C_ADV7511 is not set
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_I2C_ADV7511_CEC is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DRM_PANEL_ORISETECH_OTM8009A=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DRM_PANEL_SEIKO_43WVF1G=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_DRM_SII9234=m
|
|
@ -1 +1 @@
|
|||
CONFIG_DRM_SIL_SII8620=m
|
||||
# CONFIG_DRM_SIL_SII8620 is not set
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DS4424 is not set
|
|
@ -1 +0,0 @@
|
|||
CONFIG_ESI_DONGLE=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_GIRBIL_DONGLE=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_GPIO_MAX3191X is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_GPIO_MB86S7X is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_GPIO_TEGRA186 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_GUP_BENCHMARK is not set
|
|
@ -1 +1 @@
|
|||
# CONFIG_HID_CP2112 is not set
|
||||
CONFIG_HID_CP2112=m
|
||||
|
|
|
@ -1 +1 @@
|
|||
CONFIG_HWSPINLOCK=m
|
||||
CONFIG_HWSPINLOCK=y
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_IIO_CROS_EC_ACCEL_LEGACY=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_INTEL_SOC_PMIC_CHTDC_TI=m
|
|
@ -1 +1 @@
|
|||
# CONFIG_IP6_NF_TARGET_NPT is not set
|
||||
CONFIG_IP6_NF_TARGET_NPT=m
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_IPMI_PROC_INTERFACE is not set
|
|
@ -1 +1 @@
|
|||
CONFIG_IPX=m
|
||||
# CONFIG_IPX is not set
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
CONFIG_IRCOMM=m
|
|
@ -1 +1 @@
|
|||
CONFIG_IRDA=m
|
||||
# CONFIG_IRDA is not set
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
CONFIG_IRDA_CACHE_LAST_LSAP=y
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_IRDA_DEBUG is not set
|
|
@ -1 +0,0 @@
|
|||
CONFIG_IRDA_FAST_RR=y
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_IRDA_ULTRA is not set
|
|
@ -1 +0,0 @@
|
|||
CONFIG_IRLAN=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_IRNET=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_IRTTY_SIR=m
|
|
@ -1 +1 @@
|
|||
CONFIG_IR_SIR=m
|
||||
# CONFIG_IR_SIR is not set
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
CONFIG_KINGSUN_DONGLE=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_KS959_DONGLE=m
|
|
@ -1 +0,0 @@
|
|||
CONFIG_KSDAZZLE_DONGLE=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_LEDS_TRIGGER_ACTIVITY=m
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue