Skip to content

Commit 769d698

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel_ace2x: move and extend clock selection
The input clock to the SoundWire IP can be 38.4 MHz (xtal clock source) 24.576 MHz (audio cardinal clock) 96 MHz (internal Audio PLL) This patch moves the clock selection outside the mutex and add the new choices for 24.576 and 96 MHz, but doesn't add any functionality. Follow-up patches will add support for clock selection. Signed-off-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Rander Wang <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 09ee49e commit 769d698

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/soundwire/intel_ace2x.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,29 @@ static int intel_link_power_up(struct sdw_intel *sdw)
7474
struct sdw_master_prop *prop = &bus->prop;
7575
u32 *shim_mask = sdw->link_res->shim_mask;
7676
unsigned int link_id = sdw->instance;
77+
u32 clock_source;
7778
u32 syncprd;
7879
int ret;
7980

81+
if (prop->mclk_freq % 6000000) {
82+
if (prop->mclk_freq % 2400000) {
83+
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_24_576;
84+
clock_source = SDW_SHIM2_MLCS_CARDINAL_CLK;
85+
} else {
86+
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_38_4;
87+
clock_source = SDW_SHIM2_MLCS_XTAL_CLK;
88+
}
89+
} else {
90+
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_96;
91+
clock_source = SDW_SHIM2_MLCS_AUDIO_PLL_CLK;
92+
}
93+
8094
mutex_lock(sdw->link_res->shim_lock);
8195

8296
if (!*shim_mask) {
8397
/* we first need to program the SyncPRD/CPU registers */
8498
dev_dbg(sdw->cdns.dev, "first link up, programming SYNCPRD\n");
8599

86-
if (prop->mclk_freq % 6000000)
87-
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_38_4;
88-
else
89-
syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_24;
90-
91100
ret = hdac_bus_eml_sdw_set_syncprd_unlocked(sdw->link_res->hbus, syncprd);
92101
if (ret < 0) {
93102
dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_set_syncprd failed: %d\n",

0 commit comments

Comments
 (0)