Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soundwire: mipi-disco: add support for DP0/DPn 'lane-list' property

The SoundWire specification did not clearly require that ports could
use all Lanes. Some SoundWire/SDCA peripheral adopters added
restrictions on which lanes can be used by what port, and the DisCo
for SoundWire 2.1 specification added a 'lane-list' property to model
this hardware limitation.

When not specified, the ports can use all Lanes. Otherwise, the
'lane-list' indicates which Lanes can be used, sorted by order of
preference (most-preferred-first).

This patch only reads the properties, the use of this property will
come at a later time with multi-lane support.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20241003070650.62787-15-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Vinod Koul
71b405b1 543bd28a

+40
+32
drivers/soundwire/mipi_disco.c
··· 197 197 dp0->imp_def_interrupts = mipi_fwnode_property_read_bool(port, 198 198 "mipi-sdw-imp-def-dp0-interrupts-supported"); 199 199 200 + nval = fwnode_property_count_u32(port, "mipi-sdw-lane-list"); 201 + if (nval > 0) { 202 + dp0->num_lanes = nval; 203 + dp0->lane_list = devm_kcalloc(&slave->dev, 204 + dp0->num_lanes, sizeof(*dp0->lane_list), 205 + GFP_KERNEL); 206 + if (!dp0->lane_list) 207 + return -ENOMEM; 208 + 209 + ret = fwnode_property_read_u32_array(port, 210 + "mipi-sdw-lane-list", 211 + dp0->lane_list, dp0->num_lanes); 212 + if (ret < 0) 213 + return ret; 214 + } 215 + 200 216 return 0; 201 217 } 202 218 ··· 341 325 342 326 fwnode_property_read_u32(node, "mipi-sdw-port-encoding-type", 343 327 &dpn[i].port_encoding); 328 + 329 + nval = fwnode_property_count_u32(node, "mipi-sdw-lane-list"); 330 + if (nval > 0) { 331 + dpn[i].num_lanes = nval; 332 + dpn[i].lane_list = devm_kcalloc(&slave->dev, 333 + dpn[i].num_lanes, sizeof(*dpn[i].lane_list), 334 + GFP_KERNEL); 335 + if (!dpn[i].lane_list) 336 + return -ENOMEM; 337 + 338 + ret = fwnode_property_read_u32_array(node, 339 + "mipi-sdw-lane-list", 340 + dpn[i].lane_list, dpn[i].num_lanes); 341 + if (ret < 0) 342 + return ret; 343 + } 344 344 345 345 fwnode_handle_put(node); 346 346
+8
include/linux/soundwire/sdw.h
··· 238 238 * @simple_ch_prep_sm: If channel prepare sequence is required 239 239 * @imp_def_interrupts: If set, each bit corresponds to support for 240 240 * implementation-defined interrupts 241 + * @num_lanes: array size of @lane_list 242 + * @lane_list: indicates which Lanes can be used by DP0 241 243 * 242 244 * The wordlengths are specified by Spec as max, min AND number of 243 245 * discrete values, implementation can define based on the wordlengths they ··· 254 252 bool BRA_flow_controlled; 255 253 bool simple_ch_prep_sm; 256 254 bool imp_def_interrupts; 255 + int num_lanes; 256 + u32 *lane_list; 257 257 }; 258 258 259 259 /** ··· 279 275 * @num_ch_combinations: Number of channel combinations supported 280 276 * @channels: Discrete channels supported 281 277 * @ch_combinations: Channel combinations supported 278 + * @lane_list: indicates which Lanes can be used by DPn 279 + * @num_lanes: array size of @lane_list 282 280 * @modes: SDW mode supported 283 281 * @max_async_buffer: Number of samples that this port can buffer in 284 282 * asynchronous modes ··· 306 300 u32 num_ch_combinations; 307 301 u32 *channels; 308 302 u32 *ch_combinations; 303 + u32 *lane_list; 304 + int num_lanes; 309 305 u32 modes; 310 306 u32 max_async_buffer; 311 307 u32 port_encoding;