diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index fbfbd0c5353245..79ae8a4babf97f 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -161,13 +161,7 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, bus->params.curr_dr_freq = bus->params.max_dr_freq; bus->params.curr_bank = SDW_BANK0; bus->params.next_bank = SDW_BANK1; - /* - * Set is_present = true by default. It will be set to false when no peripherals - * are attached on the bus. - */ - bus->is_present = true; - init_completion(&bus->enumeration_complete); return 0; } EXPORT_SYMBOL(sdw_bus_master_add); @@ -859,7 +853,6 @@ static int sdw_program_device_num(struct sdw_bus *bus, bool *programmed) if (ret == -ENODATA) { /* end of device id reads */ dev_dbg(bus->dev, "No more devices to enumerate\n"); ret = 0; - complete_all(&bus->enumeration_complete); break; } if (ret < 0) { diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 326db122bbe6ea..5df2363a24d1d8 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -1003,8 +1003,6 @@ struct sdw_stream_runtime { * transport and port parameters * @defer_msg: Defer message * @params: Current bus parameters - * @enumeration_complete: completion utility to control potential races between - * enumeration completion and peripheral presence checks. * @stream_refcount: number of streams currently using this bus * @bpt_stream_refcount: number of BTP streams currently using this bus (should * be zero or one, multiple streams per link is not supported). @@ -1032,7 +1030,6 @@ struct sdw_stream_runtime { * @multi_link: Store bus property that indicates if multi links * are supported. This flag is populated by drivers after reading * appropriate firmware (ACPI/DT). - * @is_present: indicates whether any peripheral is present on the bus. */ struct sdw_bus { struct device *dev; @@ -1046,7 +1043,6 @@ struct sdw_bus { struct list_head m_rt_list; struct sdw_defer defer_msg; struct sdw_bus_params params; - struct completion enumeration_complete; int stream_refcount; int bpt_stream_refcount; struct sdw_stream_runtime *bpt_stream; @@ -1068,7 +1064,6 @@ struct sdw_bus { struct dentry *debugfs; #endif bool multi_link; - bool is_present; }; struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type); diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index b836f7f48f1ccb..45e968fb19104b 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1432,37 +1432,24 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev for (i = 0; i < peripherals->num_peripherals; i++) { slave = peripherals->array[i]; - if (!slave->bus->is_present) - continue; - - if (link_mask & BIT(slave->bus->link_id)) { - /* - * At least one peripheral is present on the link which means that this - * link has already been enumerated - */ + if (slave->dev_num_sticky) goto skip_wait_link_enumeration; - } - - if (sdw_show_ping_status(slave->bus, true) == 0) { - /* no peripherals attached on this link */ - slave->bus->is_present = false; - continue; - } - time = wait_for_completion_timeout(&slave->bus->enumeration_complete, + time = wait_for_completion_timeout(&slave->enumeration_complete, msecs_to_jiffies(SDW_ENUM_TIMEOUT_MS)); if (!time) { - dev_warn(slave->bus->dev, "No peripheral is present\n"); - slave->bus->is_present = false; + dev_warn(&slave->dev, "The peripheral is not present\n"); continue; } -skip_wait_link_enumeration: /* Check if the SoundWire peripheral is present */ if (!slave->dev_num_sticky) { dev_warn(&slave->dev, "SoundWire peripheral is not present\n"); continue; } + +skip_wait_link_enumeration: + /* link_index = the number of used links below the current link */ link_index = hweight32(link_mask & (BIT(slave->bus->link_id) - 1)); links[link_index].adr_d = find_acpi_adr_device(sdev->dev, slave,