Skip to content

Commit 9e3bd69

Browse files
committed
soundwire: intel_ace2x: add new_peripheral_assigned callback
Add the abstraction needed to only program the LSDIID registers for the HDaudio extended links. It's perfectly fine to program this register multiple times in case devices lose sync and reattach. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
1 parent 1e327e9 commit 9e3bd69

3 files changed

Lines changed: 31 additions & 0 deletions

File tree

drivers/soundwire/intel_ace2x.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ static int intel_register_dai(struct sdw_intel *sdw)
350350
dais, num_dai);
351351
}
352352

353+
static void intel_program_sdi(struct sdw_intel *sdw, int dev_num)
354+
{
355+
int ret;
356+
357+
ret = hdac_bus_eml_sdw_set_lsdiid(sdw->link_res->hbus, sdw->instance, dev_num);
358+
if (ret < 0)
359+
dev_err(sdw->cdns.dev, "%s: could not set lsdiid for link %d %d\n",
360+
__func__, sdw->instance, dev_num);
361+
}
362+
353363
const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
354364
.debugfs_init = intel_ace2x_debugfs_init,
355365
.debugfs_exit = intel_ace2x_debugfs_exit,
@@ -372,6 +382,8 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
372382
.sync_go_unlocked = intel_sync_go_unlocked,
373383
.sync_go = intel_sync_go,
374384
.sync_check_cmdsync_unlocked = intel_check_cmdsync_unlocked,
385+
386+
.program_sdi = intel_program_sdi,
375387
};
376388
EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
377389

drivers/soundwire/intel_auxdevice.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ static int generic_post_bank_switch(struct sdw_bus *bus)
6060
return sdw->link_res->hw_ops->post_bank_switch(sdw);
6161
}
6262

63+
static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_num)
64+
{
65+
struct sdw_cdns *cdns = bus_to_cdns(bus);
66+
struct sdw_intel *sdw = cdns_to_intel(cdns);
67+
68+
/* paranoia check, this should never happen */
69+
if (dev_num < INTEL_DEV_NUM_IDA_MIN || dev_num > SDW_MAX_DEVICES) {
70+
dev_err(bus->dev, "%s: invalid dev_num %d\n", __func__, dev_num);
71+
return;
72+
}
73+
74+
if (sdw->link_res->hw_ops->program_sdi)
75+
sdw->link_res->hw_ops->program_sdi(sdw, dev_num);
76+
}
77+
6378
static int sdw_master_read_intel_prop(struct sdw_bus *bus)
6479
{
6580
struct sdw_master_prop *prop = &bus->prop;
@@ -117,6 +132,7 @@ static struct sdw_master_ops sdw_intel_ops = {
117132
.pre_bank_switch = generic_pre_bank_switch,
118133
.post_bank_switch = generic_post_bank_switch,
119134
.read_ping_status = cdns_read_ping_status,
135+
.new_peripheral_assigned = generic_new_peripheral_assigned,
120136
};
121137

122138
/*

include/linux/soundwire/sdw_intel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ struct sdw_intel;
399399
* @sync_go: helper for multi-link synchronization
400400
* @sync_check_cmdsync_unlocked: helper for multi-link synchronization
401401
* and bank switch - shim_lock is assumed to be locked at higher level
402+
* @program_sdi: helper for codec command/control based on dev_num
402403
*/
403404
struct sdw_intel_hw_ops {
404405
void (*debugfs_init)(struct sdw_intel *sdw);
@@ -425,6 +426,8 @@ struct sdw_intel_hw_ops {
425426
int (*sync_go_unlocked)(struct sdw_intel *sdw);
426427
int (*sync_go)(struct sdw_intel *sdw);
427428
bool (*sync_check_cmdsync_unlocked)(struct sdw_intel *sdw);
429+
430+
void (*program_sdi)(struct sdw_intel *sdw, int dev_num);
428431
};
429432

430433
extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops;

0 commit comments

Comments
 (0)