Skip to content

Commit d505544

Browse files
committed
Merge remote-tracking branch 'soundwire/next' into sound/upstream-20230606
2 parents e0678b9 + 94f8995 commit d505544

19 files changed

Lines changed: 1183 additions & 308 deletions

File tree

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/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: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
769769
/* After xfer of msg, restore dev_num */
770770
slave->dev_num = slave->dev_num_sticky;
771771

772+
if (bus->ops && bus->ops->new_peripheral_assigned)
773+
bus->ops->new_peripheral_assigned(bus, dev_num);
774+
772775
return 0;
773776
}
774777

@@ -1588,7 +1591,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
15881591
unsigned long port;
15891592
bool slave_notify;
15901593
u8 sdca_cascade = 0;
1591-
u8 buf, buf2[2], _buf, _buf2[2];
1594+
u8 buf, buf2[2];
15921595
bool parity_check;
15931596
bool parity_quirk;
15941597

@@ -1745,9 +1748,9 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
17451748
"SDW_SCP_INT1 recheck read failed:%d\n", ret);
17461749
goto io_err;
17471750
}
1748-
_buf = ret;
1751+
buf = ret;
17491752

1750-
ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, _buf2);
1753+
ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, buf2);
17511754
if (ret < 0) {
17521755
dev_err(&slave->dev,
17531756
"SDW_SCP_INT2/3 recheck read failed:%d\n", ret);
@@ -1765,12 +1768,8 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
17651768
}
17661769

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

17761775
/*

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: 2 additions & 1 deletion
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
}

0 commit comments

Comments
 (0)