Skip to content

Commit fe1de55

Browse files
committed
Merge tag 'soundwire-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire
Pull soundwire updates from Vinod Koul: - Stream handling and slave alert handling - Qualcomm Soundwire v2.0.0 controller support - Intel ACE2.x initial support and code reorganization * tag 'soundwire-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: (55 commits) soundwire: stream: Make master_list ordered to prevent deadlocks soundwire: bus: Prevent lockdep asserts when stream has multiple buses soundwire: qcom: fix storing port config out-of-bounds soundwire: intel_ace2x: fix SND_SOC_SOF_HDA_MLINK dependency soundwire: debugfs: Add missing SCP registers soundwire: stream: Remove unnecessary gotos soundwire: stream: Invert logic on runtime alloc flags soundwire: stream: Remove unneeded checks for NULL bus soundwire: bandwidth allocation: Remove pointless variable soundwire: cadence: revisit parity injection soundwire: intel/cadence: update hardware reset sequence soundwire: intel_bus_common: enable interrupts last soundwire: intel_bus_common: update error log soundwire: amd: Improve error message in remove callback soundwire: debugfs: fix unbalanced pm_runtime_put() soundwire: qcom: fix unbalanced pm_runtime_put() soundwire: qcom: set clk stop need reset flag at runtime soundwire: qcom: add software workaround for bus clash interrupt assertion soundwire: qcom: wait for fifo to be empty before suspend soundwire: qcom: drop unused struct qcom_swrm_ctrl members ...
2 parents 15ac468 + a4857d1 commit fe1de55

File tree

22 files changed

+1289
-404
lines changed

22 files changed

+1289
-404
lines changed

Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ properties:
2121
- qcom,soundwire-v1.5.1
2222
- qcom,soundwire-v1.6.0
2323
- qcom,soundwire-v1.7.0
24+
- qcom,soundwire-v2.0.0
2425

2526
reg:
2627
maxItems: 1
@@ -80,18 +81,29 @@ properties:
8081
or applicable for the respective data port.
8182
More info in MIPI Alliance SoundWire 1.0 Specifications.
8283
minItems: 3
83-
maxItems: 8
84+
maxItems: 16
8485

8586
qcom,ports-sinterval-low:
8687
$ref: /schemas/types.yaml#/definitions/uint8-array
8788
description:
88-
Sample interval low of each data port.
89+
Sample interval (only lowest byte) of each data port.
8990
Out ports followed by In ports. Used for Sample Interval calculation.
9091
Value of 0xff indicates that this option is not implemented
9192
or applicable for the respective data port.
9293
More info in MIPI Alliance SoundWire 1.0 Specifications.
9394
minItems: 3
94-
maxItems: 8
95+
maxItems: 16
96+
97+
qcom,ports-sinterval:
98+
$ref: /schemas/types.yaml#/definitions/uint16-array
99+
description:
100+
Sample interval of each data port.
101+
Out ports followed by In ports. Used for Sample Interval calculation.
102+
Value of 0xffff indicates that this option is not implemented
103+
or applicable for the respective data port.
104+
More info in MIPI Alliance SoundWire 1.0 Specifications.
105+
minItems: 3
106+
maxItems: 16
95107

96108
qcom,ports-offset1:
97109
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -102,7 +114,7 @@ properties:
102114
or applicable for the respective data port.
103115
More info in MIPI Alliance SoundWire 1.0 Specifications.
104116
minItems: 3
105-
maxItems: 8
117+
maxItems: 16
106118

107119
qcom,ports-offset2:
108120
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -113,7 +125,7 @@ properties:
113125
or applicable for the respective data port.
114126
More info in MIPI Alliance SoundWire 1.0 Specifications.
115127
minItems: 3
116-
maxItems: 8
128+
maxItems: 16
117129

118130
qcom,ports-lane-control:
119131
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -124,7 +136,7 @@ properties:
124136
or applicable for the respective data port.
125137
More info in MIPI Alliance SoundWire 1.0 Specifications.
126138
minItems: 3
127-
maxItems: 8
139+
maxItems: 16
128140

129141
qcom,ports-block-pack-mode:
130142
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -137,7 +149,7 @@ properties:
137149
or applicable for the respective data port.
138150
More info in MIPI Alliance SoundWire 1.0 Specifications.
139151
minItems: 3
140-
maxItems: 8
152+
maxItems: 16
141153
items:
142154
oneOf:
143155
- minimum: 0
@@ -154,7 +166,7 @@ properties:
154166
or applicable for the respective data port.
155167
More info in MIPI Alliance SoundWire 1.0 Specifications.
156168
minItems: 3
157-
maxItems: 8
169+
maxItems: 16
158170
items:
159171
oneOf:
160172
- minimum: 0
@@ -171,7 +183,7 @@ properties:
171183
or applicable for the respective data port.
172184
More info in MIPI Alliance SoundWire 1.0 Specifications.
173185
minItems: 3
174-
maxItems: 8
186+
maxItems: 16
175187
items:
176188
oneOf:
177189
- minimum: 0
@@ -187,7 +199,7 @@ properties:
187199
or applicable for the respective data port.
188200
More info in MIPI Alliance SoundWire 1.0 Specifications.
189201
minItems: 3
190-
maxItems: 8
202+
maxItems: 16
191203
items:
192204
oneOf:
193205
- minimum: 0
@@ -219,10 +231,15 @@ required:
219231
- '#size-cells'
220232
- qcom,dout-ports
221233
- qcom,din-ports
222-
- qcom,ports-sinterval-low
223234
- qcom,ports-offset1
224235
- qcom,ports-offset2
225236

237+
oneOf:
238+
- required:
239+
- qcom,ports-sinterval-low
240+
- required:
241+
- qcom,ports-sinterval
242+
226243
additionalProperties: false
227244

228245
examples:

drivers/soundwire/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ config SOUNDWIRE_INTEL
3737
select SOUNDWIRE_GENERIC_ALLOCATION
3838
select AUXILIARY_BUS
3939
depends on ACPI && SND_SOC
40+
depends on SND_SOC_SOF_HDA_MLINK || !SND_SOC_SOF_HDA_MLINK
4041
help
4142
SoundWire Intel Master driver.
4243
If you have an Intel platform which has a SoundWire Master then

drivers/soundwire/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ soundwire-cadence-y := cadence_master.o
2424
obj-$(CONFIG_SOUNDWIRE_CADENCE) += soundwire-cadence.o
2525

2626
#Intel driver
27-
soundwire-intel-y := intel.o intel_auxdevice.o intel_init.o dmi-quirks.o \
27+
soundwire-intel-y := intel.o intel_ace2x.o intel_ace2x_debugfs.o \
28+
intel_auxdevice.o intel_init.o dmi-quirks.o \
2829
intel_bus_common.o
2930
obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel.o
3031

drivers/soundwire/amd_manager.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -972,15 +972,18 @@ static int amd_sdw_manager_probe(struct platform_device *pdev)
972972
return 0;
973973
}
974974

975-
static int amd_sdw_manager_remove(struct platform_device *pdev)
975+
static void amd_sdw_manager_remove(struct platform_device *pdev)
976976
{
977977
struct amd_sdw_manager *amd_manager = dev_get_drvdata(&pdev->dev);
978+
int ret;
978979

979980
pm_runtime_disable(&pdev->dev);
980981
cancel_work_sync(&amd_manager->probe_work);
981982
amd_disable_sdw_interrupts(amd_manager);
982983
sdw_bus_master_delete(&amd_manager->bus);
983-
return amd_disable_sdw_manager(amd_manager);
984+
ret = amd_disable_sdw_manager(amd_manager);
985+
if (ret)
986+
dev_err(&pdev->dev, "Failed to disable device (%pe)\n", ERR_PTR(ret));
984987
}
985988

986989
static int amd_sdw_clock_stop(struct amd_sdw_manager *amd_manager)
@@ -1194,7 +1197,7 @@ static const struct dev_pm_ops amd_pm = {
11941197

11951198
static struct platform_driver amd_sdw_driver = {
11961199
.probe = &amd_sdw_manager_probe,
1197-
.remove = &amd_sdw_manager_remove,
1200+
.remove_new = &amd_sdw_manager_remove,
11981201
.driver = {
11991202
.name = "amd_sdw_manager",
12001203
.pm = &amd_pm,

drivers/soundwire/bus.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,17 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
6969
return -EINVAL;
7070
}
7171

72-
mutex_init(&bus->msg_lock);
73-
mutex_init(&bus->bus_lock);
72+
/*
73+
* Give each bus_lock and msg_lock a unique key so that lockdep won't
74+
* trigger a deadlock warning when the locks of several buses are
75+
* grabbed during configuration of a multi-bus stream.
76+
*/
77+
lockdep_register_key(&bus->msg_lock_key);
78+
__mutex_init(&bus->msg_lock, "msg_lock", &bus->msg_lock_key);
79+
80+
lockdep_register_key(&bus->bus_lock_key);
81+
__mutex_init(&bus->bus_lock, "bus_lock", &bus->bus_lock_key);
82+
7483
INIT_LIST_HEAD(&bus->slaves);
7584
INIT_LIST_HEAD(&bus->m_rt_list);
7685

@@ -181,6 +190,8 @@ void sdw_bus_master_delete(struct sdw_bus *bus)
181190
sdw_master_device_del(bus);
182191

183192
sdw_bus_debugfs_exit(bus);
193+
lockdep_unregister_key(&bus->bus_lock_key);
194+
lockdep_unregister_key(&bus->msg_lock_key);
184195
ida_free(&sdw_bus_ida, bus->id);
185196
}
186197
EXPORT_SYMBOL(sdw_bus_master_delete);
@@ -769,6 +780,9 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
769780
/* After xfer of msg, restore dev_num */
770781
slave->dev_num = slave->dev_num_sticky;
771782

783+
if (bus->ops && bus->ops->new_peripheral_assigned)
784+
bus->ops->new_peripheral_assigned(bus, dev_num);
785+
772786
return 0;
773787
}
774788

@@ -1588,7 +1602,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
15881602
unsigned long port;
15891603
bool slave_notify;
15901604
u8 sdca_cascade = 0;
1591-
u8 buf, buf2[2], _buf, _buf2[2];
1605+
u8 buf, buf2[2];
15921606
bool parity_check;
15931607
bool parity_quirk;
15941608

@@ -1745,9 +1759,9 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
17451759
"SDW_SCP_INT1 recheck read failed:%d\n", ret);
17461760
goto io_err;
17471761
}
1748-
_buf = ret;
1762+
buf = ret;
17491763

1750-
ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, _buf2);
1764+
ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, buf2);
17511765
if (ret < 0) {
17521766
dev_err(&slave->dev,
17531767
"SDW_SCP_INT2/3 recheck read failed:%d\n", ret);
@@ -1765,12 +1779,8 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
17651779
}
17661780

17671781
/*
1768-
* Make sure no interrupts are pending, but filter to limit loop
1769-
* to interrupts identified in the first status read
1782+
* Make sure no interrupts are pending
17701783
*/
1771-
buf &= _buf;
1772-
buf2[0] &= _buf2[0];
1773-
buf2[1] &= _buf2[1];
17741784
stat = buf || buf2[0] || buf2[1] || sdca_cascade;
17751785

17761786
/*

drivers/soundwire/cadence_master.c

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,29 @@ static int cdns_config_update(struct sdw_cdns *cdns)
283283
return ret;
284284
}
285285

286+
/**
287+
* sdw_cdns_config_update() - Update configurations
288+
* @cdns: Cadence instance
289+
*/
290+
void sdw_cdns_config_update(struct sdw_cdns *cdns)
291+
{
292+
/* commit changes */
293+
cdns_writel(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT);
294+
}
295+
EXPORT_SYMBOL(sdw_cdns_config_update);
296+
297+
/**
298+
* sdw_cdns_config_update_set_wait() - wait until configuration update bit is self-cleared
299+
* @cdns: Cadence instance
300+
*/
301+
int sdw_cdns_config_update_set_wait(struct sdw_cdns *cdns)
302+
{
303+
/* the hardware recommendation is to wait at least 300us */
304+
return cdns_set_wait(cdns, CDNS_MCP_CONFIG_UPDATE,
305+
CDNS_MCP_CONFIG_UPDATE_BIT, 0);
306+
}
307+
EXPORT_SYMBOL(sdw_cdns_config_update_set_wait);
308+
286309
/*
287310
* debugfs
288311
*/
@@ -433,9 +456,9 @@ static int cdns_parity_error_injection(void *data, u64 value)
433456
CDNS_IP_MCP_CMDCTRL_INSERT_PARITY_ERR);
434457

435458
/* commit changes */
436-
cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE,
437-
CDNS_MCP_CONFIG_UPDATE_BIT,
438-
CDNS_MCP_CONFIG_UPDATE_BIT);
459+
ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT);
460+
if (ret < 0)
461+
goto unlock;
439462

440463
/* do a broadcast dummy read to avoid bus clashes */
441464
ret = sdw_bread_no_pm_unlocked(&cdns->bus, 0xf, SDW_SCP_DEVID_0);
@@ -447,16 +470,17 @@ static int cdns_parity_error_injection(void *data, u64 value)
447470
0);
448471

449472
/* commit changes */
450-
cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE,
451-
CDNS_MCP_CONFIG_UPDATE_BIT,
452-
CDNS_MCP_CONFIG_UPDATE_BIT);
453-
454-
/* Continue bus operation with parity error injection disabled */
455-
mutex_unlock(&bus->bus_lock);
473+
ret = cdns_clear_bit(cdns, CDNS_MCP_CONFIG_UPDATE, CDNS_MCP_CONFIG_UPDATE_BIT);
474+
if (ret < 0)
475+
goto unlock;
456476

457477
/* Userspace changed the hardware state behind the kernel's back */
458478
add_taint(TAINT_USER, LOCKDEP_STILL_OK);
459479

480+
unlock:
481+
/* Continue bus operation with parity error injection disabled */
482+
mutex_unlock(&bus->bus_lock);
483+
460484
/*
461485
* allow Master device to enter pm_runtime suspend. This may
462486
* also result in Slave devices suspending.
@@ -1116,13 +1140,7 @@ int sdw_cdns_exit_reset(struct sdw_cdns *cdns)
11161140
CDNS_MCP_CONTROL_HW_RST);
11171141

11181142
/* commit changes */
1119-
cdns_updatel(cdns, CDNS_MCP_CONFIG_UPDATE,
1120-
CDNS_MCP_CONFIG_UPDATE_BIT,
1121-
CDNS_MCP_CONFIG_UPDATE_BIT);
1122-
1123-
/* don't wait here */
1124-
return 0;
1125-
1143+
return cdns_config_update(cdns);
11261144
}
11271145
EXPORT_SYMBOL(sdw_cdns_exit_reset);
11281146

drivers/soundwire/cadence_master.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*/
1515
#define CDNS_MCP_IP_MAX_CMD_LEN 32
1616

17+
#define SDW_CADENCE_MCP_IP_OFFSET 0x4000
18+
1719
/**
1820
* struct sdw_cdns_pdi: PDI (Physical Data Interface) instance
1921
*
@@ -197,4 +199,7 @@ int cdns_set_sdw_stream(struct snd_soc_dai *dai,
197199
void sdw_cdns_check_self_clearing_bits(struct sdw_cdns *cdns, const char *string,
198200
bool initial_delay, int reset_iterations);
199201

202+
void sdw_cdns_config_update(struct sdw_cdns *cdns);
203+
int sdw_cdns_config_update_set_wait(struct sdw_cdns *cdns);
204+
200205
#endif /* __SDW_CADENCE_H */

drivers/soundwire/debugfs.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
5656
if (!buf)
5757
return -ENOMEM;
5858

59-
ret = pm_runtime_resume_and_get(&slave->dev);
59+
ret = pm_runtime_get_sync(&slave->dev);
6060
if (ret < 0 && ret != -EACCES) {
61+
pm_runtime_put_noidle(&slave->dev);
6162
kfree(buf);
6263
return ret;
6364
}
@@ -85,10 +86,17 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
8586

8687
/* SCP registers */
8788
ret += scnprintf(buf + ret, RD_BUF - ret, "\nSCP\n");
88-
for (i = SDW_SCP_INT1; i <= SDW_SCP_BANKDELAY; i++)
89+
for (i = SDW_SCP_INT1; i <= SDW_SCP_BUS_CLOCK_BASE; i++)
8990
ret += sdw_sprintf(slave, buf, ret, i);
9091
for (i = SDW_SCP_DEVID_0; i <= SDW_SCP_DEVID_5; i++)
9192
ret += sdw_sprintf(slave, buf, ret, i);
93+
for (i = SDW_SCP_FRAMECTRL_B0; i <= SDW_SCP_BUSCLOCK_SCALE_B0; i++)
94+
ret += sdw_sprintf(slave, buf, ret, i);
95+
for (i = SDW_SCP_FRAMECTRL_B1; i <= SDW_SCP_BUSCLOCK_SCALE_B1; i++)
96+
ret += sdw_sprintf(slave, buf, ret, i);
97+
for (i = SDW_SCP_PHY_OUT_CTRL_0; i <= SDW_SCP_PHY_OUT_CTRL_7; i++)
98+
ret += sdw_sprintf(slave, buf, ret, i);
99+
92100

93101
/*
94102
* SCP Bank 0/1 registers are read-only and cannot be

drivers/soundwire/generic_bandwidth_allocation.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,16 @@ static void _sdw_compute_port_params(struct sdw_bus *bus,
139139
{
140140
struct sdw_master_runtime *m_rt;
141141
int hstop = bus->params.col - 1;
142-
int block_offset, port_bo, i;
142+
int port_bo, i;
143143

144144
/* Run loop for all groups to compute transport parameters */
145145
for (i = 0; i < count; i++) {
146146
port_bo = 1;
147-
block_offset = 1;
148147

149148
list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
150-
sdw_compute_master_ports(m_rt, &params[i],
151-
port_bo, hstop);
149+
sdw_compute_master_ports(m_rt, &params[i], port_bo, hstop);
152150

153-
block_offset += m_rt->ch_count *
154-
m_rt->stream->params.bps;
155-
port_bo = block_offset;
151+
port_bo += m_rt->ch_count * m_rt->stream->params.bps;
156152
}
157153

158154
hstop = hstop - params[i].hwidth;

0 commit comments

Comments
 (0)