mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
soundwire updates for 6.7
- Core: add concept of controller_id to deal with clear Controller/Manager hierarchy - bunch of qcom driver refactoring for qcom_swrm_stream_alloc_ports(), qcom_swrm_stream_alloc_ports() and setting controller id to hw master id -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmWpV0gACgkQfBQHDyUj g0ebow/+Ot1EFq8ADVjCnR4noelvlvfwhNHwM5PSN+GMkSmkTOI6lr4mueDFkEfT S2yFuKCtO7gIjV+EWt5G0uWAGM33E0aWwcJ+ubw95p+m1lilo2EYgQU3NDTfb+SK dUxSbwVDHl2jYTQHSV4UzuA66J9xyK7x5WdUuPvLVSzF5thXvu5g1hcXyd0zqDDT 3i+WKkvhquOFOjsexSEAjXsbfa8XNM2R/7iiGlxZUdTh2NwSR5dyQ8WuyhEkw0Gb 23KEOw9wPj1Gcp0JTQ1tSr7C/Ag9jC0QBZLI4ggdivXPUO9NuUHT1owHxLrwXr9R uz0zzbBBNvPGOOeW9C8CetcSXVvZAVmgPHZumiuXBZMcuDLyrS0BoQyNzl/yTflB ZBlXbzt7C9l6udHxG+4gLy2Xur0wwzBrH8ZqjItkp6MZTBUxcoMgIY6Y24e0DHsn cwgsuRblsnL7+JHcq5DL8KYBOnBmexxMCaFtKWGdlU9dWOQtPPe20yIwQACzxUrC VpvthWTk4P2KZB2hlP8xGbX9IZmINABN0vwQgf2wfUnRGzmyx7wdLXElXXahim4A cyIIjk9AiM2wglUQxKccKqdntg2SAwMeUE0YuMbBzAlzR8fgIklWzFvahOHLED0L kvPg1fr/dM5TN9PraptbrML+D5IHXCyCTThZB7ujTTMF4ekwdCo= =N74M -----END PGP SIGNATURE----- Merge tag 'soundwire-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire Pull soundwire updates from Vinod Koul: - Core: add concept of controller_id to deal with clear Controller / Manager hierarchy - bunch of qcom driver refactoring for qcom_swrm_stream_alloc_ports(), qcom_swrm_stream_alloc_ports() and setting controller id to hw master id * tag 'soundwire-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: soundwire: amd: drop bus freq calculation and set 'max_clk_freq' soundwire: generic_bandwidth_allocation use bus->params.max_dr_freq soundwire: qcom: set controller id to hw master id soundwire: fix initializing sysfs for same devices on different buses soundwire: bus: introduce controller_id soundwire: stream: constify sdw_port_config when adding devices soundwire: qcom: move sconfig in qcom_swrm_stream_alloc_ports() out of critical section soundwire: qcom: drop unneeded qcom_swrm_stream_alloc_ports() cleanup
This commit is contained in:
commit
4d5d604cc4
@ -927,6 +927,14 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
|
||||
amd_manager->bus.clk_stop_timeout = 200;
|
||||
amd_manager->bus.link_id = amd_manager->instance;
|
||||
|
||||
/*
|
||||
* Due to BIOS compatibility, the two links are exposed within
|
||||
* the scope of a single controller. If this changes, the
|
||||
* controller_id will have to be updated with drv_data
|
||||
* information.
|
||||
*/
|
||||
amd_manager->bus.controller_id = 0;
|
||||
|
||||
switch (amd_manager->instance) {
|
||||
case ACP_SDW0:
|
||||
amd_manager->num_dout_ports = AMD_SDW0_MAX_TX_PORTS;
|
||||
@ -942,13 +950,13 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
|
||||
|
||||
amd_manager->reg_mask = &sdw_manager_reg_mask_array[amd_manager->instance];
|
||||
params = &amd_manager->bus.params;
|
||||
params->max_dr_freq = AMD_SDW_DEFAULT_CLK_FREQ * 2;
|
||||
params->curr_dr_freq = AMD_SDW_DEFAULT_CLK_FREQ * 2;
|
||||
|
||||
params->col = AMD_SDW_DEFAULT_COLUMNS;
|
||||
params->row = AMD_SDW_DEFAULT_ROWS;
|
||||
prop = &amd_manager->bus.prop;
|
||||
prop->clk_freq = &amd_sdw_freq_tbl[0];
|
||||
prop->mclk_freq = AMD_SDW_BUS_BASE_FREQ;
|
||||
prop->max_clk_freq = AMD_SDW_DEFAULT_CLK_FREQ;
|
||||
|
||||
ret = sdw_bus_master_add(&amd_manager->bus, dev, dev->fwnode);
|
||||
if (ret) {
|
||||
|
@ -22,6 +22,10 @@ static int sdw_get_id(struct sdw_bus *bus)
|
||||
return rc;
|
||||
|
||||
bus->id = rc;
|
||||
|
||||
if (bus->controller_id == -1)
|
||||
bus->controller_id = rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ void sdw_bus_debugfs_init(struct sdw_bus *bus)
|
||||
return;
|
||||
|
||||
/* create the debugfs master-N */
|
||||
snprintf(name, sizeof(name), "master-%d-%d", bus->id, bus->link_id);
|
||||
snprintf(name, sizeof(name), "master-%d-%d", bus->controller_id, bus->link_id);
|
||||
bus->debugfs = debugfs_create_dir(name, sdw_debugfs_root);
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ static int sdw_select_row_col(struct sdw_bus *bus, int clk_freq)
|
||||
*/
|
||||
static int sdw_compute_bus_params(struct sdw_bus *bus)
|
||||
{
|
||||
unsigned int max_dr_freq, curr_dr_freq = 0;
|
||||
unsigned int curr_dr_freq = 0;
|
||||
struct sdw_master_prop *mstr_prop = &bus->prop;
|
||||
int i, clk_values, ret;
|
||||
bool is_gear = false;
|
||||
@ -351,14 +351,12 @@ static int sdw_compute_bus_params(struct sdw_bus *bus)
|
||||
clk_buf = NULL;
|
||||
}
|
||||
|
||||
max_dr_freq = mstr_prop->max_clk_freq * SDW_DOUBLE_RATE_FACTOR;
|
||||
|
||||
for (i = 0; i < clk_values; i++) {
|
||||
if (!clk_buf)
|
||||
curr_dr_freq = max_dr_freq;
|
||||
curr_dr_freq = bus->params.max_dr_freq;
|
||||
else
|
||||
curr_dr_freq = (is_gear) ?
|
||||
(max_dr_freq >> clk_buf[i]) :
|
||||
(bus->params.max_dr_freq >> clk_buf[i]) :
|
||||
clk_buf[i] * SDW_DOUBLE_RATE_FACTOR;
|
||||
|
||||
if (curr_dr_freq <= bus->params.bandwidth)
|
||||
|
@ -234,6 +234,9 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
|
||||
cdns->instance = sdw->instance;
|
||||
cdns->msg_count = 0;
|
||||
|
||||
/* single controller for all SoundWire links */
|
||||
bus->controller_id = 0;
|
||||
|
||||
bus->link_id = auxdev->id;
|
||||
bus->clk_stop_timeout = 1;
|
||||
|
||||
|
@ -145,7 +145,7 @@ int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
|
||||
md->dev.fwnode = fwnode;
|
||||
md->dev.dma_mask = parent->dma_mask;
|
||||
|
||||
dev_set_name(&md->dev, "sdw-master-%d", bus->id);
|
||||
dev_set_name(&md->dev, "sdw-master-%d-%d", bus->controller_id, bus->link_id);
|
||||
|
||||
ret = device_register(&md->dev);
|
||||
if (ret) {
|
||||
|
@ -1157,9 +1157,20 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
|
||||
struct sdw_port_runtime *p_rt;
|
||||
struct sdw_slave *slave;
|
||||
unsigned long *port_mask;
|
||||
int i, maxport, pn, nports = 0, ret = 0;
|
||||
int maxport, pn, nports = 0, ret = 0;
|
||||
unsigned int m_port;
|
||||
|
||||
if (direction == SNDRV_PCM_STREAM_CAPTURE)
|
||||
sconfig.direction = SDW_DATA_DIR_TX;
|
||||
else
|
||||
sconfig.direction = SDW_DATA_DIR_RX;
|
||||
|
||||
/* hw parameters wil be ignored as we only support PDM */
|
||||
sconfig.ch_count = 1;
|
||||
sconfig.frame_rate = params_rate(params);
|
||||
sconfig.type = stream->type;
|
||||
sconfig.bps = 1;
|
||||
|
||||
mutex_lock(&ctrl->port_lock);
|
||||
list_for_each_entry(m_rt, &stream->master_list, stream_node) {
|
||||
if (m_rt->direction == SDW_DATA_DIR_RX) {
|
||||
@ -1183,7 +1194,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
|
||||
if (pn > maxport) {
|
||||
dev_err(ctrl->dev, "All ports busy\n");
|
||||
ret = -EBUSY;
|
||||
goto err;
|
||||
goto out;
|
||||
}
|
||||
set_bit(pn, port_mask);
|
||||
pconfig[nports].num = pn;
|
||||
@ -1193,24 +1204,9 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl,
|
||||
}
|
||||
}
|
||||
|
||||
if (direction == SNDRV_PCM_STREAM_CAPTURE)
|
||||
sconfig.direction = SDW_DATA_DIR_TX;
|
||||
else
|
||||
sconfig.direction = SDW_DATA_DIR_RX;
|
||||
|
||||
/* hw parameters wil be ignored as we only support PDM */
|
||||
sconfig.ch_count = 1;
|
||||
sconfig.frame_rate = params_rate(params);
|
||||
sconfig.type = stream->type;
|
||||
sconfig.bps = 1;
|
||||
sdw_stream_add_master(&ctrl->bus, &sconfig, pconfig,
|
||||
nports, stream);
|
||||
err:
|
||||
if (ret) {
|
||||
for (i = 0; i < nports; i++)
|
||||
clear_bit(pconfig[i].num, port_mask);
|
||||
}
|
||||
|
||||
out:
|
||||
mutex_unlock(&ctrl->port_lock);
|
||||
|
||||
return ret;
|
||||
@ -1593,6 +1589,13 @@ static int qcom_swrm_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
ctrl->bus.controller_id = -1;
|
||||
|
||||
if (ctrl->version > SWRM_VERSION_1_3_0) {
|
||||
ctrl->reg_read(ctrl, SWRM_COMP_MASTER_ID, &val);
|
||||
ctrl->bus.controller_id = val;
|
||||
}
|
||||
|
||||
ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to register Soundwire controller (%d)\n",
|
||||
|
@ -39,14 +39,14 @@ int sdw_slave_add(struct sdw_bus *bus,
|
||||
slave->dev.fwnode = fwnode;
|
||||
|
||||
if (id->unique_id == SDW_IGNORED_UNIQUE_ID) {
|
||||
/* name shall be sdw:link:mfg:part:class */
|
||||
dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x",
|
||||
bus->link_id, id->mfg_id, id->part_id,
|
||||
/* name shall be sdw:ctrl:link:mfg:part:class */
|
||||
dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x",
|
||||
bus->controller_id, bus->link_id, id->mfg_id, id->part_id,
|
||||
id->class_id);
|
||||
} else {
|
||||
/* name shall be sdw:link:mfg:part:class:unique */
|
||||
dev_set_name(&slave->dev, "sdw:%01x:%04x:%04x:%02x:%01x",
|
||||
bus->link_id, id->mfg_id, id->part_id,
|
||||
/* name shall be sdw:ctrl:link:mfg:part:class:unique */
|
||||
dev_set_name(&slave->dev, "sdw:%01x:%01x:%04x:%04x:%02x:%01x",
|
||||
bus->controller_id, bus->link_id, id->mfg_id, id->part_id,
|
||||
id->class_id, id->unique_id);
|
||||
}
|
||||
|
||||
|
@ -898,7 +898,7 @@ static struct sdw_port_runtime *sdw_port_alloc(struct list_head *port_list)
|
||||
}
|
||||
|
||||
static int sdw_port_config(struct sdw_port_runtime *p_rt,
|
||||
struct sdw_port_config *port_config,
|
||||
const struct sdw_port_config *port_config,
|
||||
int port_index)
|
||||
{
|
||||
p_rt->ch_mask = port_config[port_index].ch_mask;
|
||||
@ -971,7 +971,7 @@ static int sdw_slave_port_is_valid_range(struct device *dev, int num)
|
||||
|
||||
static int sdw_slave_port_config(struct sdw_slave *slave,
|
||||
struct sdw_slave_runtime *s_rt,
|
||||
struct sdw_port_config *port_config)
|
||||
const struct sdw_port_config *port_config)
|
||||
{
|
||||
struct sdw_port_runtime *p_rt;
|
||||
int ret;
|
||||
@ -1027,7 +1027,7 @@ static int sdw_master_port_alloc(struct sdw_master_runtime *m_rt,
|
||||
}
|
||||
|
||||
static int sdw_master_port_config(struct sdw_master_runtime *m_rt,
|
||||
struct sdw_port_config *port_config)
|
||||
const struct sdw_port_config *port_config)
|
||||
{
|
||||
struct sdw_port_runtime *p_rt;
|
||||
int ret;
|
||||
@ -1862,7 +1862,7 @@ EXPORT_SYMBOL(sdw_release_stream);
|
||||
*/
|
||||
int sdw_stream_add_master(struct sdw_bus *bus,
|
||||
struct sdw_stream_config *stream_config,
|
||||
struct sdw_port_config *port_config,
|
||||
const struct sdw_port_config *port_config,
|
||||
unsigned int num_ports,
|
||||
struct sdw_stream_runtime *stream)
|
||||
{
|
||||
@ -1982,7 +1982,7 @@ EXPORT_SYMBOL(sdw_stream_remove_master);
|
||||
*/
|
||||
int sdw_stream_add_slave(struct sdw_slave *slave,
|
||||
struct sdw_stream_config *stream_config,
|
||||
struct sdw_port_config *port_config,
|
||||
const struct sdw_port_config *port_config,
|
||||
unsigned int num_ports,
|
||||
struct sdw_stream_runtime *stream)
|
||||
{
|
||||
|
@ -886,7 +886,8 @@ struct sdw_master_ops {
|
||||
* struct sdw_bus - SoundWire bus
|
||||
* @dev: Shortcut to &bus->md->dev to avoid changing the entire code.
|
||||
* @md: Master device
|
||||
* @link_id: Link id number, can be 0 to N, unique for each Master
|
||||
* @controller_id: system-unique controller ID. If set to -1, the bus @id will be used.
|
||||
* @link_id: Link id number, can be 0 to N, unique for each Controller
|
||||
* @id: bus system-wide unique id
|
||||
* @slaves: list of Slaves on this bus
|
||||
* @assigned: Bitmap for Slave device numbers.
|
||||
@ -918,6 +919,7 @@ struct sdw_master_ops {
|
||||
struct sdw_bus {
|
||||
struct device *dev;
|
||||
struct sdw_master_device *md;
|
||||
int controller_id;
|
||||
unsigned int link_id;
|
||||
int id;
|
||||
struct list_head slaves;
|
||||
@ -1040,7 +1042,7 @@ int sdw_compute_params(struct sdw_bus *bus);
|
||||
|
||||
int sdw_stream_add_master(struct sdw_bus *bus,
|
||||
struct sdw_stream_config *stream_config,
|
||||
struct sdw_port_config *port_config,
|
||||
const struct sdw_port_config *port_config,
|
||||
unsigned int num_ports,
|
||||
struct sdw_stream_runtime *stream);
|
||||
int sdw_stream_remove_master(struct sdw_bus *bus,
|
||||
@ -1062,7 +1064,7 @@ void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id
|
||||
|
||||
int sdw_stream_add_slave(struct sdw_slave *slave,
|
||||
struct sdw_stream_config *stream_config,
|
||||
struct sdw_port_config *port_config,
|
||||
const struct sdw_port_config *port_config,
|
||||
unsigned int num_ports,
|
||||
struct sdw_stream_runtime *stream);
|
||||
int sdw_stream_remove_slave(struct sdw_slave *slave,
|
||||
@ -1084,7 +1086,7 @@ int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val);
|
||||
|
||||
static inline int sdw_stream_add_slave(struct sdw_slave *slave,
|
||||
struct sdw_stream_config *stream_config,
|
||||
struct sdw_port_config *port_config,
|
||||
const struct sdw_port_config *port_config,
|
||||
unsigned int num_ports,
|
||||
struct sdw_stream_runtime *stream)
|
||||
{
|
||||
|
@ -1256,11 +1256,11 @@ static int fill_sdw_codec_dlc(struct device *dev,
|
||||
else if (is_unique_device(adr_link, sdw_version, mfg_id, part_id,
|
||||
class_id, adr_index))
|
||||
codec->name = devm_kasprintf(dev, GFP_KERNEL,
|
||||
"sdw:%01x:%04x:%04x:%02x", link_id,
|
||||
"sdw:0:%01x:%04x:%04x:%02x", link_id,
|
||||
mfg_id, part_id, class_id);
|
||||
else
|
||||
codec->name = devm_kasprintf(dev, GFP_KERNEL,
|
||||
"sdw:%01x:%04x:%04x:%02x:%01x", link_id,
|
||||
"sdw:0:%01x:%04x:%04x:%02x:%01x", link_id,
|
||||
mfg_id, part_id, class_id, unique_id);
|
||||
|
||||
if (!codec->name)
|
||||
|
Loading…
Reference in New Issue
Block a user