Skip to content

Commit db9c438

Browse files
committed
Merge tag 'soundwire-6.19-rc1_updated' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire
Pull soundwire updates from Vinod Koul: - Support for multiple sections in a BPT stream - Align DMA frame with BPT frames - Qualcomm support for v3.1.0 controllers * tag 'soundwire-6.19-rc1_updated' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: soundwire: intel_ace2x: handle multi BPT sections soundwire: pass sdw_bpt_section to cdns BPT helpers soundwire: introduce BPT section soundwire: intel_ace2x: add fake frame to BRA read command soundwire: cadence_master: add fake_size parameter to sdw_cdns_prepare_read_dma_buffer ASoC: SOF: Intel: export hda_sdw_bpt_get_buf_size_aligment soundwire: cadence: export sdw_cdns_bpt_find_bandwidth soundwire: cadence_master: set data_per_frame as frame capability soundwire: only compute BPT stream in sdw_compute_dp0_port_params soundwire: cadence_master: make frame index trace more readable soundwire: qcom: adding support for v3.1.0 dt-bindings: soundwire: qcom: Document v3.1.0 version of IP block soundwire: qcom: prepare for v3.x soundwire: qcom: deprecate qcom,din/out-ports dt-bindings: soundwire: qcom: deprecate qcom,din/out-ports soundwire: qcom: remove unused rd_fifo_depth of: base: Add of_property_read_u8_index
2 parents 7f3c8f9 + 188d194 commit db9c438

13 files changed

Lines changed: 531 additions & 207 deletions

File tree

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ properties:
2323
- qcom,soundwire-v1.6.0
2424
- qcom,soundwire-v1.7.0
2525
- qcom,soundwire-v2.0.0
26+
- qcom,soundwire-v3.1.0
2627
- items:
2728
- enum:
2829
- qcom,soundwire-v2.1.0
@@ -73,10 +74,12 @@ properties:
7374
qcom,din-ports:
7475
$ref: /schemas/types.yaml#/definitions/uint32
7576
description: count of data in ports
77+
deprecated: true
7678

7779
qcom,dout-ports:
7880
$ref: /schemas/types.yaml#/definitions/uint32
7981
description: count of data out ports
82+
deprecated: true
8083

8184
qcom,ports-word-length:
8285
$ref: /schemas/types.yaml#/definitions/uint8-array
@@ -223,8 +226,6 @@ required:
223226
- '#sound-dai-cells'
224227
- '#address-cells'
225228
- '#size-cells'
226-
- qcom,dout-ports
227-
- qcom,din-ports
228229
- qcom,ports-offset1
229230
- qcom,ports-offset2
230231

@@ -257,9 +258,6 @@ examples:
257258
clocks = <&lpass_rx_macro>;
258259
clock-names = "iface";
259260
260-
qcom,din-ports = <0>;
261-
qcom,dout-ports = <5>;
262-
263261
resets = <&lpass_audiocc LPASS_AUDIO_SWR_RX_CGCR>;
264262
reset-names = "swr_audio_cgcr";
265263

drivers/of/property.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,39 @@ static void *of_find_property_value_of_size(const struct device_node *np,
147147
return prop->value;
148148
}
149149

150+
/**
151+
* of_property_read_u8_index - Find and read a u8 from a multi-value property.
152+
*
153+
* @np: device node from which the property value is to be read.
154+
* @propname: name of the property to be searched.
155+
* @index: index of the u8 in the list of values
156+
* @out_value: pointer to return value, modified only if no error.
157+
*
158+
* Search for a property in a device node and read nth 8-bit value from
159+
* it.
160+
*
161+
* Return: 0 on success, -EINVAL if the property does not exist,
162+
* -ENODATA if property does not have a value, and -EOVERFLOW if the
163+
* property data isn't large enough.
164+
*
165+
* The out_value is modified only if a valid u8 value can be decoded.
166+
*/
167+
int of_property_read_u8_index(const struct device_node *np,
168+
const char *propname,
169+
u32 index, u8 *out_value)
170+
{
171+
const u8 *val = of_find_property_value_of_size(np, propname,
172+
((index + 1) * sizeof(*out_value)),
173+
0, NULL);
174+
175+
if (IS_ERR(val))
176+
return PTR_ERR(val);
177+
178+
*out_value = val[index];
179+
return 0;
180+
}
181+
EXPORT_SYMBOL_GPL(of_property_read_u8_index);
182+
150183
/**
151184
* of_property_read_u16_index - Find and read a u16 from a multi-value property.
152185
*

drivers/soundwire/bus.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,8 +2052,14 @@ EXPORT_SYMBOL(sdw_clear_slave_status);
20522052

20532053
int sdw_bpt_send_async(struct sdw_bus *bus, struct sdw_slave *slave, struct sdw_bpt_msg *msg)
20542054
{
2055-
if (msg->len > SDW_BPT_MSG_MAX_BYTES) {
2056-
dev_err(bus->dev, "Invalid BPT message length %d\n", msg->len);
2055+
int len = 0;
2056+
int i;
2057+
2058+
for (i = 0; i < msg->sections; i++)
2059+
len += msg->sec[i].len;
2060+
2061+
if (len > SDW_BPT_MSG_MAX_BYTES) {
2062+
dev_err(bus->dev, "Invalid BPT message length %d\n", len);
20572063
return -EINVAL;
20582064
}
20592065

drivers/soundwire/bus.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,31 @@ struct sdw_msg {
7373
};
7474

7575
/**
76-
* struct sdw_btp_msg - Message structure
76+
* struct sdw_btp_section - Message section structure
7777
* @addr: Start Register address accessed in the Slave
7878
* @len: number of bytes to transfer. More than 64Kb can be transferred
7979
* but a practical limit of SDW_BPT_MSG_MAX_BYTES is enforced.
80-
* @dev_num: Slave device number
81-
* @flags: transfer flags, indicate if xfer is read or write
82-
* @buf: message data buffer (filled by host for write, filled
80+
* @buf: section data buffer (filled by host for write, filled
8381
* by Peripheral hardware for reads)
8482
*/
85-
struct sdw_bpt_msg {
83+
struct sdw_bpt_section {
8684
u32 addr;
8785
u32 len;
86+
u8 *buf;
87+
};
88+
89+
/**
90+
* struct sdw_btp_msg - Message structure
91+
* @sec: Pointer to array of sections
92+
* @sections: Number of sections in the array
93+
* @dev_num: Slave device number
94+
* @flags: transfer flags, indicate if xfer is read or write
95+
*/
96+
struct sdw_bpt_msg {
97+
struct sdw_bpt_section *sec;
98+
int sections;
8899
u8 dev_num;
89100
u8 flags;
90-
u8 *buf;
91101
};
92102

93103
#define SDW_DOUBLE_RATE_FACTOR 2

0 commit comments

Comments
 (0)