Skip to content

Commit a50261f

Browse files
committed
soundwire: bus: add bra_w/r_threshold
We need a threshold to use BRA. The threshold can be set in the bus struct when sdw_bus_master_add() is called. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 5709a51 commit a50261f

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

  • drivers/soundwire
  • include/linux/soundwire

drivers/soundwire/bus.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#include "irq.h"
1414
#include "sysfs_local.h"
1515

16+
#define DEFAULT_BRA_WRITE_THRESHOLD 800
17+
#define DEFAULT_BRA_READ_THRESHOLD 400
18+
1619
static DEFINE_IDA(sdw_bus_ida);
1720

1821
static int sdw_get_id(struct sdw_bus *bus)
@@ -163,6 +166,11 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
163166
bus->params.curr_bank = SDW_BANK0;
164167
bus->params.next_bank = SDW_BANK1;
165168

169+
if (!bus->bra_w_threshold)
170+
bus->bra_w_threshold = DEFAULT_BRA_WRITE_THRESHOLD;
171+
if (!bus->bra_r_threshold)
172+
bus->bra_r_threshold = DEFAULT_BRA_READ_THRESHOLD;
173+
166174
return 0;
167175
}
168176
EXPORT_SYMBOL(sdw_bus_master_add);

include/linux/soundwire/sdw.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,10 @@ struct sdw_stream_runtime {
10281028
* are supported. This flag is populated by drivers after reading
10291029
* appropriate firmware (ACPI/DT).
10301030
* @lane_used_bandwidth: how much bandwidth in bits per second is used by each lane
1031+
* @bra_w_threshold: Message-size threshold (bytes) above which BRA write is used.
1032+
* If set to 0, a default is used.
1033+
* @bra_r_threshold: Message-size threshold (bytes) above which BRA read is used.
1034+
* If set to 0, a default is used.
10311035
*/
10321036
struct sdw_bus {
10331037
struct device *dev;
@@ -1063,6 +1067,8 @@ struct sdw_bus {
10631067
#endif
10641068
bool multi_link;
10651069
unsigned int lane_used_bandwidth[SDW_MAX_LANES];
1070+
unsigned int bra_w_threshold;
1071+
unsigned int bra_r_threshold;
10661072
};
10671073

10681074
struct sdw_stream_runtime *sdw_alloc_stream(const char *stream_name, enum sdw_stream_type type);

0 commit comments

Comments
 (0)