Skip to content

Commit 72deda0

Browse files
committed
Merge tag 'soundwire-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire
Pull soundwire updates from Vinod Koul: - SoundWire multi lane support to use multiple lanes if supported - Stream handling of DEPREPARED state - AMD wake register programming for power off mode * tag 'soundwire-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: soundwire: amd: clear wake enable register for power off mode soundwire: generic_bandwidth_allocation: count the bandwidth of active streams only SoundWire: pass stream to compute_params() soundwire: generic_bandwidth_allocation: add lane in sdw_group_params soundwire: generic_bandwidth_allocation: select data lane soundwire: generic_bandwidth_allocation: check required freq accurately soundwire: generic_bandwidth_allocation: correct clk_freq check in sdw_select_row_col Soundwire: generic_bandwidth_allocation: set frame shape on fly Soundwire: stream: program BUSCLOCK_SCALE Soundwire: add sdw_slave_get_scale_index helper soundwire: generic_bandwidth_allocation: skip DEPREPARED streams soundwire: stream: set DEPREPARED state earlier soundwire: add lane_used_bandwidth in struct sdw_bus soundwire: mipi_disco: read lane mapping properties from ACPI soundwire: add lane field in sdw_port_runtime soundwire: bus: Move irq mapping cleanup into devres
2 parents 9f10e7f + 74148bb commit 72deda0

File tree

11 files changed

+513
-163
lines changed

11 files changed

+513
-163
lines changed

drivers/soundwire/amd_manager.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static u32 amd_sdw_read_ping_status(struct sdw_bus *bus)
384384
return slave_stat;
385385
}
386386

387-
static int amd_sdw_compute_params(struct sdw_bus *bus)
387+
static int amd_sdw_compute_params(struct sdw_bus *bus, struct sdw_stream_runtime *stream)
388388
{
389389
struct sdw_transport_data t_data = {0};
390390
struct sdw_master_runtime *m_rt;
@@ -410,7 +410,7 @@ static int amd_sdw_compute_params(struct sdw_bus *bus)
410410
sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
411411
false, SDW_BLK_GRP_CNT_1, sample_int,
412412
port_bo, port_bo >> 8, hstart, hstop,
413-
SDW_BLK_PKG_PER_PORT, 0x0);
413+
SDW_BLK_PKG_PER_PORT, p_rt->lane);
414414

415415
sdw_fill_port_params(&p_rt->port_params,
416416
p_rt->num, bps,
@@ -1190,6 +1190,7 @@ static int __maybe_unused amd_resume_runtime(struct device *dev)
11901190
if (amd_manager->power_mode_mask & AMD_SDW_CLK_STOP_MODE) {
11911191
return amd_sdw_clock_stop_exit(amd_manager);
11921192
} else if (amd_manager->power_mode_mask & AMD_SDW_POWER_OFF_MODE) {
1193+
writel(0x00, amd_manager->acp_mmio + ACP_SW_WAKE_EN(amd_manager->instance));
11931194
val = readl(amd_manager->mmio + ACP_SW_CLK_RESUME_CTRL);
11941195
if (val) {
11951196
val |= AMD_SDW_CLK_RESUME_REQ;

drivers/soundwire/bus.c

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,16 @@ void sdw_extract_slave_id(struct sdw_bus *bus,
813813
}
814814
EXPORT_SYMBOL(sdw_extract_slave_id);
815815

816+
bool is_clock_scaling_supported_by_slave(struct sdw_slave *slave)
817+
{
818+
/*
819+
* Dynamic scaling is a defined by SDCA. However, some devices expose the class ID but
820+
* can't support dynamic scaling. We might need a quirk to handle such devices.
821+
*/
822+
return slave->id.class_id;
823+
}
824+
EXPORT_SYMBOL(is_clock_scaling_supported_by_slave);
825+
816826
static int sdw_program_device_num(struct sdw_bus *bus, bool *programmed)
817827
{
818828
u8 buf[SDW_NUM_DEV_ID_REGISTERS] = {0};
@@ -1276,23 +1286,12 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave,
12761286
return ret;
12771287
}
12781288

1279-
static int sdw_slave_set_frequency(struct sdw_slave *slave)
1289+
int sdw_slave_get_scale_index(struct sdw_slave *slave, u8 *base)
12801290
{
12811291
u32 mclk_freq = slave->bus->prop.mclk_freq;
12821292
u32 curr_freq = slave->bus->params.curr_dr_freq >> 1;
12831293
unsigned int scale;
12841294
u8 scale_index;
1285-
u8 base;
1286-
int ret;
1287-
1288-
/*
1289-
* frequency base and scale registers are required for SDCA
1290-
* devices. They may also be used for 1.2+/non-SDCA devices.
1291-
* Driver can set the property, we will need a DisCo property
1292-
* to discover this case from platform firmware.
1293-
*/
1294-
if (!slave->id.class_id && !slave->prop.clock_reg_supported)
1295-
return 0;
12961295

12971296
if (!mclk_freq) {
12981297
dev_err(&slave->dev,
@@ -1311,19 +1310,19 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
13111310
*/
13121311
if (!(19200000 % mclk_freq)) {
13131312
mclk_freq = 19200000;
1314-
base = SDW_SCP_BASE_CLOCK_19200000_HZ;
1313+
*base = SDW_SCP_BASE_CLOCK_19200000_HZ;
13151314
} else if (!(22579200 % mclk_freq)) {
13161315
mclk_freq = 22579200;
1317-
base = SDW_SCP_BASE_CLOCK_22579200_HZ;
1316+
*base = SDW_SCP_BASE_CLOCK_22579200_HZ;
13181317
} else if (!(24576000 % mclk_freq)) {
13191318
mclk_freq = 24576000;
1320-
base = SDW_SCP_BASE_CLOCK_24576000_HZ;
1319+
*base = SDW_SCP_BASE_CLOCK_24576000_HZ;
13211320
} else if (!(32000000 % mclk_freq)) {
13221321
mclk_freq = 32000000;
1323-
base = SDW_SCP_BASE_CLOCK_32000000_HZ;
1322+
*base = SDW_SCP_BASE_CLOCK_32000000_HZ;
13241323
} else if (!(96000000 % mclk_freq)) {
13251324
mclk_freq = 24000000;
1326-
base = SDW_SCP_BASE_CLOCK_24000000_HZ;
1325+
*base = SDW_SCP_BASE_CLOCK_24000000_HZ;
13271326
} else {
13281327
dev_err(&slave->dev,
13291328
"Unsupported clock base, mclk %d\n",
@@ -1354,6 +1353,34 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
13541353
}
13551354
scale_index++;
13561355

1356+
dev_dbg(&slave->dev,
1357+
"Configured bus base %d, scale %d, mclk %d, curr_freq %d\n",
1358+
*base, scale_index, mclk_freq, curr_freq);
1359+
1360+
return scale_index;
1361+
}
1362+
EXPORT_SYMBOL(sdw_slave_get_scale_index);
1363+
1364+
static int sdw_slave_set_frequency(struct sdw_slave *slave)
1365+
{
1366+
int scale_index;
1367+
u8 base;
1368+
int ret;
1369+
1370+
/*
1371+
* frequency base and scale registers are required for SDCA
1372+
* devices. They may also be used for 1.2+/non-SDCA devices.
1373+
* Driver can set the property directly, for now there's no
1374+
* DisCo property to discover support for the scaling registers
1375+
* from platform firmware.
1376+
*/
1377+
if (!slave->id.class_id && !slave->prop.clock_reg_supported)
1378+
return 0;
1379+
1380+
scale_index = sdw_slave_get_scale_index(slave, &base);
1381+
if (scale_index < 0)
1382+
return scale_index;
1383+
13571384
ret = sdw_write_no_pm(slave, SDW_SCP_BUS_CLOCK_BASE, base);
13581385
if (ret < 0) {
13591386
dev_err(&slave->dev,
@@ -1373,10 +1400,6 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
13731400
dev_err(&slave->dev,
13741401
"SDW_SCP_BUSCLOCK_SCALE_B1 write failed:%d\n", ret);
13751402

1376-
dev_dbg(&slave->dev,
1377-
"Configured bus base %d, scale %d, mclk %d, curr_freq %d\n",
1378-
base, scale_index, mclk_freq, curr_freq);
1379-
13801403
return ret;
13811404
}
13821405

drivers/soundwire/bus.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ int sdw_find_col_index(int col);
9090
* @transport_params: Transport parameters
9191
* @port_params: Port parameters
9292
* @port_node: List node for Master or Slave port_list
93+
* @lane: Which lane is used
9394
*
9495
* SoundWire spec has no mention of ports for Master interface but the
9596
* concept is logically extended.
@@ -100,6 +101,7 @@ struct sdw_port_runtime {
100101
struct sdw_transport_params transport_params;
101102
struct sdw_port_params port_params;
102103
struct list_head port_node;
104+
unsigned int lane;
103105
};
104106

105107
/**
@@ -149,6 +151,7 @@ struct sdw_transport_data {
149151
int hstop;
150152
int block_offset;
151153
int sub_block_offset;
154+
unsigned int lane;
152155
};
153156

154157
struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave,

drivers/soundwire/bus_type.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ static int sdw_drv_remove(struct device *dev)
167167

168168
slave->probed = false;
169169

170-
if (slave->prop.use_domain_irq)
171-
sdw_irq_dispose_mapping(slave);
172-
173170
mutex_unlock(&slave->sdw_dev_lock);
174171

175172
if (drv->remove)

0 commit comments

Comments
 (0)