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

Configure Feed

Select the types of activity you want to include in your feed.

soundwire: bus: add sdw_slave_get_current_bank helper

There has been 2 instances of this helper in codec drivers,
it does not make sense to keep duplicating this part of code.

Lets add a helper sdw_get_current_bank() for codec drivers to use it.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20250909121954.225833-5-srinivas.kandagatla@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Srinivas Kandagatla and committed by
Mark Brown
2e07017b 76cffc3e

+20
+12
drivers/soundwire/bus.c
··· 1360 1360 } 1361 1361 EXPORT_SYMBOL(sdw_slave_get_scale_index); 1362 1362 1363 + int sdw_slave_get_current_bank(struct sdw_slave *slave) 1364 + { 1365 + int tmp; 1366 + 1367 + tmp = sdw_read(slave, SDW_SCP_CTRL); 1368 + if (tmp < 0) 1369 + return tmp; 1370 + 1371 + return FIELD_GET(SDW_SCP_STAT_CURR_BANK, tmp); 1372 + } 1373 + EXPORT_SYMBOL_GPL(sdw_slave_get_current_bank); 1374 + 1363 1375 static int sdw_slave_set_frequency(struct sdw_slave *slave) 1364 1376 { 1365 1377 int scale_index;
+8
include/linux/soundwire/sdw.h
··· 1089 1089 1090 1090 struct device *of_sdw_find_device_by_node(struct device_node *np); 1091 1091 1092 + int sdw_slave_get_current_bank(struct sdw_slave *sdev); 1093 + 1092 1094 int sdw_slave_get_scale_index(struct sdw_slave *slave, u8 *base); 1093 1095 1094 1096 /* messaging and data APIs */ ··· 1128 1126 { 1129 1127 WARN_ONCE(1, "SoundWire API is disabled"); 1130 1128 return NULL; 1129 + } 1130 + 1131 + static inline int sdw_slave_get_current_bank(struct sdw_slave *sdev) 1132 + { 1133 + WARN_ONCE(1, "SoundWire API is disabled"); 1134 + return -EINVAL; 1131 1135 } 1132 1136 1133 1137 /* messaging and data APIs */