Skip to content

Commit c20c76a

Browse files
committed
Merge tag 'soundwire-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-next
Vinod writes: soundwire updates for v5.6-rc1 This round we have bunch of updates to interfaces for ASoC (audio) subsystem by Intel and a new Qualcomm controller driver Details - Updates for sdw_slave interfaces for ASoC - Updates to cadence library and intel driver - New Soundwire controller for Qualcomm masters - Rework of device number assignment * tag 'soundwire-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: (27 commits) dt-bindings: soundwire: fix example soundwire: cadence: fix kernel-doc parameter descriptions soundwire: intel: report slave_ids for each link to SOF driver soundwire: intel: fix factor of two in MCLK handling soundwire: bus: fix device number leak on errors soundwire: cadence: remove useless variable incrementation soundwire: cadence: update kernel-doc parameter descriptions soundwire: qcom: add support for SoundWire controller dt-bindings: soundwire: add bindings for Qcom controller soundwire: bus: check first if Slaves become UNATTACHED soundwire: cadence_master: handle multiple status reports per Slave soundwire: cadence_master: remove config update for interrupt setting soundwire: cadence_master: log more useful information during timeouts soundwire: cadence_master: clear interrupt status before enabling interrupt soundwire: cadence_master: filter out bad interrupts soundwire: stream: remove redundant pr_err traces soundwire: intel: add clock stop quirks soundwire: intel: add mutex for shared SHIM register access soundwire: intel: add prototype for WAKEEN interrupt processing soundwire: intel: add link_list to handle interrupts with a single thread ...
2 parents 1660557 + 5098cae commit c20c76a

File tree

13 files changed

+1351
-79
lines changed

13 files changed

+1351
-79
lines changed
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
Qualcomm SoundWire Controller Bindings
2+
3+
4+
This binding describes the Qualcomm SoundWire Controller along with its
5+
board specific bus parameters.
6+
7+
- compatible:
8+
Usage: required
9+
Value type: <stringlist>
10+
Definition: must be "qcom,soundwire-v<MAJOR>.<MINOR>.<STEP>",
11+
Example:
12+
"qcom,soundwire-v1.3.0"
13+
"qcom,soundwire-v1.5.0"
14+
"qcom,soundwire-v1.6.0"
15+
- reg:
16+
Usage: required
17+
Value type: <prop-encoded-array>
18+
Definition: the base address and size of SoundWire controller
19+
address space.
20+
21+
- interrupts:
22+
Usage: required
23+
Value type: <prop-encoded-array>
24+
Definition: should specify the SoundWire Controller IRQ
25+
26+
- clock-names:
27+
Usage: required
28+
Value type: <stringlist>
29+
Definition: should be "iface" for SoundWire Controller interface clock
30+
31+
- clocks:
32+
Usage: required
33+
Value type: <prop-encoded-array>
34+
Definition: should specify the SoundWire Controller interface clock
35+
36+
- #sound-dai-cells:
37+
Usage: required
38+
Value type: <u32>
39+
Definition: must be 1 for digital audio interfaces on the controller.
40+
41+
- qcom,dout-ports:
42+
Usage: required
43+
Value type: <u32>
44+
Definition: must be count of data out ports
45+
46+
- qcom,din-ports:
47+
Usage: required
48+
Value type: <u32>
49+
Definition: must be count of data in ports
50+
51+
- qcom,ports-offset1:
52+
Usage: required
53+
Value type: <prop-encoded-array>
54+
Definition: should specify payload transport window offset1 of each
55+
data port. Out ports followed by In ports.
56+
More info in MIPI Alliance SoundWire 1.0 Specifications.
57+
58+
- qcom,ports-offset2:
59+
Usage: required
60+
Value type: <prop-encoded-array>
61+
Definition: should specify payload transport window offset2 of each
62+
data port. Out ports followed by In ports.
63+
More info in MIPI Alliance SoundWire 1.0 Specifications.
64+
65+
- qcom,ports-sinterval-low:
66+
Usage: required
67+
Value type: <prop-encoded-array>
68+
Definition: should be sample interval low of each data port.
69+
Out ports followed by In ports. Used for Sample Interval
70+
calculation.
71+
More info in MIPI Alliance SoundWire 1.0 Specifications.
72+
73+
- qcom,ports-word-length:
74+
Usage: optional
75+
Value type: <prop-encoded-array>
76+
Definition: should be size of payload channel sample.
77+
More info in MIPI Alliance SoundWire 1.0 Specifications.
78+
79+
- qcom,ports-block-pack-mode:
80+
Usage: optional
81+
Value type: <prop-encoded-array>
82+
Definition: should be 0 or 1 to indicate the block packing mode.
83+
0 to indicate Blocks are per Channel
84+
1 to indicate Blocks are per Port.
85+
Out ports followed by In ports.
86+
More info in MIPI Alliance SoundWire 1.0 Specifications.
87+
88+
- qcom,ports-block-group-count:
89+
Usage: optional
90+
Value type: <prop-encoded-array>
91+
Definition: should be in range 1 to 4 to indicate how many sample
92+
intervals are combined into a payload.
93+
Out ports followed by In ports.
94+
More info in MIPI Alliance SoundWire 1.0 Specifications.
95+
96+
- qcom,ports-lane-control:
97+
Usage: optional
98+
Value type: <prop-encoded-array>
99+
Definition: should be in range 0 to 7 to identify which data lane
100+
the data port uses.
101+
Out ports followed by In ports.
102+
More info in MIPI Alliance SoundWire 1.0 Specifications.
103+
104+
- qcom,ports-hstart:
105+
Usage: optional
106+
Value type: <prop-encoded-array>
107+
Definition: should be number identifying lowerst numbered coloum in
108+
SoundWire Frame, i.e. left edge of the Transport sub-frame
109+
for each port. Values between 0 and 15 are valid.
110+
Out ports followed by In ports.
111+
More info in MIPI Alliance SoundWire 1.0 Specifications.
112+
113+
- qcom,ports-hstop:
114+
Usage: optional
115+
Value type: <prop-encoded-array>
116+
Definition: should be number identifying highest numbered coloum in
117+
SoundWire Frame, i.e. the right edge of the Transport
118+
sub-frame for each port. Values between 0 and 15 are valid.
119+
Out ports followed by In ports.
120+
More info in MIPI Alliance SoundWire 1.0 Specifications.
121+
122+
- qcom,dports-type:
123+
Usage: optional
124+
Value type: <prop-encoded-array>
125+
Definition: should be one of the following types
126+
0 for reduced port
127+
1 for simple ports
128+
2 for full port
129+
Out ports followed by In ports.
130+
More info in MIPI Alliance SoundWire 1.0 Specifications.
131+
132+
Note:
133+
More Information on detail of encoding of these fields can be
134+
found in MIPI Alliance SoundWire 1.0 Specifications.
135+
136+
= SoundWire devices
137+
Each subnode of the bus represents SoundWire device attached to it.
138+
The properties of these nodes are defined by the individual bindings.
139+
140+
= EXAMPLE
141+
The following example represents a SoundWire controller on DB845c board
142+
which has controller integrated inside WCD934x codec on SDM845 SoC.
143+
144+
soundwire: soundwire@c85 {
145+
compatible = "qcom,soundwire-v1.3.0";
146+
reg = <0xc85 0x20>;
147+
interrupts = <20 IRQ_TYPE_EDGE_RISING>;
148+
clocks = <&wcc>;
149+
clock-names = "iface";
150+
#sound-dai-cells = <1>;
151+
qcom,dports-type = <0>;
152+
qcom,dout-ports = <6>;
153+
qcom,din-ports = <2>;
154+
qcom,ports-sinterval-low = /bits/ 8 <0x07 0x1F 0x3F 0x7 0x1F 0x3F 0x0F 0x0F>;
155+
qcom,ports-offset1 = /bits/ 8 <0x01 0x02 0x0C 0x6 0x12 0x0D 0x07 0x0A >;
156+
qcom,ports-offset2 = /bits/ 8 <0x00 0x00 0x1F 0x00 0x00 0x1F 0x00 0x00>;
157+
158+
/* Left Speaker */
159+
left{
160+
....
161+
};
162+
163+
/* Right Speaker */
164+
right{
165+
....
166+
};
167+
};

Documentation/devicetree/bindings/soundwire/soundwire-controller.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ examples:
6969
reg = <0 1>;
7070
powerdown-gpios = <&wcdpinctrl 2 0>;
7171
#thermal-sensor-cells = <0>;
72+
#sound-dai-cells = <0>;
7273
};
7374
7475
speaker@0,2 {
7576
compatible = "sdw10217201000";
7677
reg = <0 2>;
7778
powerdown-gpios = <&wcdpinctrl 2 0>;
7879
#thermal-sensor-cells = <0>;
80+
#sound-dai-cells = <0>;
7981
};
8082
};
8183

drivers/soundwire/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,13 @@ config SOUNDWIRE_INTEL
3131
enable this config option to get the SoundWire support for that
3232
device.
3333

34+
config SOUNDWIRE_QCOM
35+
tristate "Qualcomm SoundWire Master driver"
36+
depends on SLIMBUS
37+
depends on SND_SOC
38+
help
39+
SoundWire Qualcomm Master driver.
40+
If you have an Qualcomm platform which has a SoundWire Master then
41+
enable this config option to get the SoundWire support for that
42+
device
3443
endif

drivers/soundwire/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel.o
2121

2222
soundwire-intel-init-objs := intel_init.o
2323
obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel-init.o
24+
25+
#Qualcomm driver
26+
soundwire-qcom-objs := qcom.o
27+
obj-$(CONFIG_SOUNDWIRE_QCOM) += soundwire-qcom.o

drivers/soundwire/bus.c

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -456,26 +456,35 @@ static int sdw_get_device_num(struct sdw_slave *slave)
456456
static int sdw_assign_device_num(struct sdw_slave *slave)
457457
{
458458
int ret, dev_num;
459+
bool new_device = false;
459460

460461
/* check first if device number is assigned, if so reuse that */
461462
if (!slave->dev_num) {
462-
mutex_lock(&slave->bus->bus_lock);
463-
dev_num = sdw_get_device_num(slave);
464-
mutex_unlock(&slave->bus->bus_lock);
465-
if (dev_num < 0) {
466-
dev_err(slave->bus->dev, "Get dev_num failed: %d\n",
467-
dev_num);
468-
return dev_num;
463+
if (!slave->dev_num_sticky) {
464+
mutex_lock(&slave->bus->bus_lock);
465+
dev_num = sdw_get_device_num(slave);
466+
mutex_unlock(&slave->bus->bus_lock);
467+
if (dev_num < 0) {
468+
dev_err(slave->bus->dev, "Get dev_num failed: %d\n",
469+
dev_num);
470+
return dev_num;
471+
}
472+
slave->dev_num = dev_num;
473+
slave->dev_num_sticky = dev_num;
474+
new_device = true;
475+
} else {
476+
slave->dev_num = slave->dev_num_sticky;
469477
}
470-
} else {
478+
}
479+
480+
if (!new_device)
471481
dev_info(slave->bus->dev,
472-
"Slave already registered dev_num:%d\n",
482+
"Slave already registered, reusing dev_num:%d\n",
473483
slave->dev_num);
474484

475-
/* Clear the slave->dev_num to transfer message on device 0 */
476-
dev_num = slave->dev_num;
477-
slave->dev_num = 0;
478-
}
485+
/* Clear the slave->dev_num to transfer message on device 0 */
486+
dev_num = slave->dev_num;
487+
slave->dev_num = 0;
479488

480489
ret = sdw_write(slave, SDW_SCP_DEVNUMBER, dev_num);
481490
if (ret < 0) {
@@ -485,7 +494,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
485494
}
486495

487496
/* After xfer of msg, restore dev_num */
488-
slave->dev_num = dev_num;
497+
slave->dev_num = slave->dev_num_sticky;
489498

490499
return 0;
491500
}
@@ -979,6 +988,24 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
979988
struct sdw_slave *slave;
980989
int i, ret = 0;
981990

991+
/* first check if any Slaves fell off the bus */
992+
for (i = 1; i <= SDW_MAX_DEVICES; i++) {
993+
mutex_lock(&bus->bus_lock);
994+
if (test_bit(i, bus->assigned) == false) {
995+
mutex_unlock(&bus->bus_lock);
996+
continue;
997+
}
998+
mutex_unlock(&bus->bus_lock);
999+
1000+
slave = sdw_get_slave(bus, i);
1001+
if (!slave)
1002+
continue;
1003+
1004+
if (status[i] == SDW_SLAVE_UNATTACHED &&
1005+
slave->status != SDW_SLAVE_UNATTACHED)
1006+
sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED);
1007+
}
1008+
9821009
if (status[0] == SDW_SLAVE_ATTACHED) {
9831010
dev_dbg(bus->dev, "Slave attached, programming device number\n");
9841011
ret = sdw_program_device_num(bus);

0 commit comments

Comments
 (0)