soundwire: intel_auxdevice: add hybrid IDA-based device_number allocation
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 31 Jul 2023 09:13:33 +0000 (17:13 +0800)
committerVinod Koul <vkoul@kernel.org>
Fri, 11 Aug 2023 06:59:25 +0000 (07:59 +0100)
commite66f91a2d10b9a25eedcaddee9d6f08c8132760a
tree8588630b9772f762501efe2ffb93cbea74736f2b
parent39d80b0e5fed2c32f66093fead626358b7106974
soundwire: intel_auxdevice: add hybrid IDA-based device_number allocation

The IDA-based allocation is useful to simplify debug, but it was also
introduced as a prerequisite to deal with the Intel Lunar Lake
hardware programming sequences: the wake-ups have to be handled with a
system-unique SDI address at the HDaudio controller level.

At the time, the restriction introduced by the IDA to 8 devices total
seemed perfectly fine, but recently hardware vendors created
configurations with more than 8 devices.

Add a new allocation strategy to allow for more than 8 devices using
information on the type of devices, and only use the IDA-based
allocation for devices capable of generating a wake.

In theory the information on wake capabilities should come from
firmware, but none of the existing ACPI tables provide it. The drivers
set the 'wake_capable' property, but this cannot be used reliably: if
the driver probe happens *after* the enumeration, then that property
is not initialized yet. Trying to modify the device_number on-the-fly
proved to be an impossible task generating race conditions left and
right.

The only reliable work-around to control the enumeration is to add a
quirk table. It's ugly but until platform firmware improves, hopefully as a
result of MIPI/SDCA stardization, we can expect that quirk table to
grow for each new headset or microphone codec.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230731091333.3593132-4-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/intel_auxdevice.c
include/linux/soundwire/sdw_intel.h