Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

ivsc usb and probe order fix #24

Merged
merged 2 commits into from
Nov 18, 2022

Conversation

jwrdegoede
Copy link
Contributor

I have been working on making the ipu6-driver stack work on a Lenovo Thinkpad X1 Yoga gen 7 (alderlake) with a 6.0 kernel and using the INT3472 mainline kernel driver for power-control.

With the ipu6 code using acpi_dev_ready_for_enumeration() for kernel versions >= 5.17 ipu_psys_init() was returning -EPROBE_DEFER (and still does a number of time when letting udev automatically load the modules).

Getting acpi_dev_ready_for_enumeration() to return true requires the ljca-i2c bus driver to call acpi_dev_clear_dependencies() to signal that the ACPI _DEV on it has been fulfilled / met.

While working on this I also noticed a kernel oops related to the ljca code calling a sleeping function from a non-sleeping kernel context. A fix for this is also included.

Together with intel/ipu6-drivers#58 and this mainline kernel patch (+ the "standard" mainline patches) this results in a working camera on the Lenovo Thinkpad X1 Yoga gen 7 for me, with the modules autoloaded by udev and with the module load ordering not mattering.

Cc: @mrhpearson, @vicamo , @cjechlitschek

USB URB completion handlers run in interrupt context,
so the URB resubmission must use GFP_ATOMIC.

This fixes the following WARN()/BUG() log messages:

[   28.493744] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:274
[   28.493746] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 0, name: swapper/9
[   28.493748] preempt_count: 101, expected: 0
[   28.493749] RCU nest depth: 0, expected: 0
[   28.493750] INFO: lockdep is turned off.
[   28.493750] Preemption disabled at:
[   28.493751] [<ffffffff983b1736>] ___slab_alloc+0x8d6/0xea0
[   28.493754] CPU: 9 PID: 0 Comm: swapper/9 Tainted: G           O       6.0.0+ #508
[   28.493755] Hardware name: LENOVO 21CEZ9Q3US/21CEZ9Q3US, BIOS N3AET66W (1.31 ) 09/09/2022
[   28.493756] Call Trace:
[   28.493757]  <IRQ>
[   28.493758]  dump_stack_lvl+0x5b/0x77
[   28.493761]  __might_resched.cold+0xff/0x13a
[   28.493763]  __kmalloc+0x209/0x3d0
[   28.493765]  xhci_urb_enqueue+0xee/0x5a0
[   28.493768]  usb_hcd_submit_urb+0xbd/0xb80
[   28.493770]  ? _raw_spin_unlock_irqrestore+0x30/0x60
[   28.493772]  ? _raw_spin_unlock_irqrestore+0x30/0x60
[   28.493773]  ? lockdep_hardirqs_on+0x7d/0x100
[   28.493776]  ? _raw_spin_unlock_irqrestore+0x40/0x60
[   28.493777]  ? __wake_up_common_lock+0x77/0x90
[   28.493780]  ljca_read_complete+0x12c/0x28b [ljca]

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Call acpi_dev_clear_dependencies() to mark _DEP ACPI dependencies on
the I2C controller as satisfied so that acpi_dev_ready_for_enumeration()
for the I2C device nodes in APCI will return true once the I2C controller
is registered.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
@wentongwu wentongwu merged commit 70d9526 into intel:main Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants