Skip to content

Commit 05057b0

Browse files
committed
Merge remote-tracking branch 'soundwire/next' into sound/upstream-20260508
2 parents 68dd1f6 + 35a5ab8 commit 05057b0

4 files changed

Lines changed: 36 additions & 27 deletions

File tree

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -299,39 +299,35 @@ static int sdw_add_element_group_count(struct sdw_group *group,
299299
int num = group->count;
300300
int i;
301301

302-
for (i = 0; i <= num; i++) {
302+
for (i = 0; i < num; i++) {
303303
if (rate == group->rates[i] && lane == group->lanes[i])
304-
break;
305-
306-
if (i != num)
307-
continue;
304+
return 0;
305+
}
308306

309-
if (group->count >= group->max_size) {
310-
unsigned int *rates;
311-
unsigned int *lanes;
307+
if (group->count >= group->max_size) {
308+
unsigned int *rates;
309+
unsigned int *lanes;
312310

313-
group->max_size += 1;
314-
rates = krealloc(group->rates,
315-
(sizeof(int) * group->max_size),
316-
GFP_KERNEL);
317-
if (!rates)
318-
return -ENOMEM;
311+
rates = krealloc_array(group->rates, group->max_size + 1,
312+
sizeof(*group->rates), GFP_KERNEL);
313+
if (!rates)
314+
return -ENOMEM;
319315

320-
group->rates = rates;
316+
group->rates = rates;
321317

322-
lanes = krealloc(group->lanes,
323-
(sizeof(int) * group->max_size),
324-
GFP_KERNEL);
325-
if (!lanes)
326-
return -ENOMEM;
318+
lanes = krealloc_array(group->lanes, group->max_size + 1,
319+
sizeof(*group->lanes), GFP_KERNEL);
320+
if (!lanes)
321+
return -ENOMEM;
327322

328-
group->lanes = lanes;
329-
}
323+
group->lanes = lanes;
330324

331-
group->rates[group->count] = rate;
332-
group->lanes[group->count++] = lane;
325+
group->max_size += 1;
333326
}
334327

328+
group->rates[group->count] = rate;
329+
group->lanes[group->count++] = lane;
330+
335331
return 0;
336332
}
337333

drivers/soundwire/intel_auxdevice.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ struct wake_capable_part {
5151
};
5252

5353
static struct wake_capable_part wake_capable_list[] = {
54+
{0x01fa, 0x2A30},
55+
{0x01fa, 0x2A3B},
5456
{0x01fa, 0x4243},
5557
{0x01fa, 0x4245},
5658
{0x01fa, 0x4249},

drivers/soundwire/slave.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ int sdw_of_find_slaves(struct sdw_bus *bus)
244244
struct sdw_slave_id id;
245245
const __be32 *addr;
246246

247-
compat = of_get_property(node, "compatible", NULL);
248-
if (!compat)
247+
ret = of_property_read_string(node, "compatible", &compat);
248+
if (ret)
249249
continue;
250250

251251
ret = sscanf(compat, "sdw%01x%04hx%04hx%02hhx", &sdw_version,

drivers/soundwire/stream.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,13 @@ static int sdw_program_params(struct sdw_bus *bus, bool prepare)
697697
if (scale_index < 0)
698698
return scale_index;
699699

700+
/* Skip the unattached Peripherals */
701+
if (!completion_done(&slave->enumeration_complete)) {
702+
dev_warn(&slave->dev,
703+
"Not enumerated, skip programming BUSCLOCK_SCALE\n");
704+
continue;
705+
}
706+
700707
ret = sdw_write_no_pm(slave, addr1, scale_index);
701708
if (ret < 0) {
702709
dev_err(&slave->dev, "SDW_SCP_BUSCLOCK_SCALE register write failed\n");
@@ -2229,11 +2236,15 @@ EXPORT_SYMBOL(sdw_stream_add_slave);
22292236
* @slave: SDW Slave instance
22302237
* @stream: SoundWire stream
22312238
*
2232-
* This removes and frees port_rt and slave_rt from a stream
2239+
* This removes and frees port_rt and slave_rt from a stream.
2240+
* If stream is NULL or an ERR_PTR, do nothing and return 0.
22332241
*/
22342242
int sdw_stream_remove_slave(struct sdw_slave *slave,
22352243
struct sdw_stream_runtime *stream)
22362244
{
2245+
if (IS_ERR_OR_NULL(stream))
2246+
return 0;
2247+
22372248
mutex_lock(&slave->bus->bus_lock);
22382249

22392250
sdw_slave_port_free(slave, stream);

0 commit comments

Comments
 (0)