soundwire: add override addr ops

Platform firmware may have incorrect _ADR values causing the driver
probes to fail. Add the override_ops, which when configured will allow
for quirks based on DMI etc to override the addr values.

Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210302075105.11515-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Vinod Koul 2021-03-02 15:51:03 +08:00
parent a38fd87484
commit 6558b667a7
2 changed files with 10 additions and 2 deletions

View File

@ -95,7 +95,7 @@ static bool find_slave(struct sdw_bus *bus,
struct acpi_device *adev, struct acpi_device *adev,
struct sdw_slave_id *id) struct sdw_slave_id *id)
{ {
unsigned long long addr; u64 addr;
unsigned int link_id; unsigned int link_id;
acpi_status status; acpi_status status;
@ -108,6 +108,12 @@ static bool find_slave(struct sdw_bus *bus,
return false; return false;
} }
if (bus->ops->override_adr)
addr = bus->ops->override_adr(bus, addr);
if (!addr)
return false;
/* Extract link id from ADR, Bit 51 to 48 (included) */ /* Extract link id from ADR, Bit 51 to 48 (included) */
link_id = SDW_DISCO_LINK_ID(addr); link_id = SDW_DISCO_LINK_ID(addr);

View File

@ -804,6 +804,7 @@ struct sdw_defer {
/** /**
* struct sdw_master_ops - Master driver ops * struct sdw_master_ops - Master driver ops
* @read_prop: Read Master properties * @read_prop: Read Master properties
* @override_adr: Override value read from firmware (quirk for buggy firmware)
* @xfer_msg: Transfer message callback * @xfer_msg: Transfer message callback
* @xfer_msg_defer: Defer version of transfer message callback * @xfer_msg_defer: Defer version of transfer message callback
* @reset_page_addr: Reset the SCP page address registers * @reset_page_addr: Reset the SCP page address registers
@ -813,7 +814,8 @@ struct sdw_defer {
*/ */
struct sdw_master_ops { struct sdw_master_ops {
int (*read_prop)(struct sdw_bus *bus); int (*read_prop)(struct sdw_bus *bus);
u64 (*override_adr)
(struct sdw_bus *bus, u64 addr);
enum sdw_command_response (*xfer_msg) enum sdw_command_response (*xfer_msg)
(struct sdw_bus *bus, struct sdw_msg *msg); (struct sdw_bus *bus, struct sdw_msg *msg);
enum sdw_command_response (*xfer_msg_defer) enum sdw_command_response (*xfer_msg_defer)