soundwire: mipi_disco: add MIPI-specific property_read_bool() helpers
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 3 Oct 2024 07:06:37 +0000 (15:06 +0800)
committerVinod Koul <vkoul@kernel.org>
Thu, 3 Oct 2024 07:58:50 +0000 (13:28 +0530)
commit093227bc53a023991ba04315f42839a22b613113
treee27ec198a53f133c1c6d35fd76e7db31eccf1f72
parenta54dc8c68a5b33ca00b8dcd3b87681aacfbfc9dc
soundwire: mipi_disco: add MIPI-specific property_read_bool() helpers

The existing device/fwnode_property_read_bool() helpers only check if
the property is present.

The MIPI DisCo for SoundWire specification allows properties to be
exposed with a value of 'false'. Using the standard helpers to
retrieve the MIPI-defined properties causes all kinds of logical
inversions leading to loss of functionality - such as jack detection
in clock-stop mode broken when the device properties are read in
Realtek codec drivers.

This patch adds new MIPI/SoundWire helpers which first check if the
property is present, and then return the actual value extracted from
platform firmware.

Modifying the default property handling was considered as a possible
solution, but it could lead to other types of logical inversions
breaking 'working' setups. Andy Shevchenko also pointed out that DT
keeps values in the BE32 format, it's probably best to avoid
endianness complications.

The path of least resistance was chosen, with MIPI-specific helpers
which can be tested and with no side effects outside of the SoundWire
subsystem.

Closes: https://github.com/thesofproject/linux/issues/5129
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20241003070650.62787-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/mipi_disco.c