Skip to content

Commit b0c40b4

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 b0c40b4

2 files changed

Lines changed: 12 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,8 @@ 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: The threshold of message size in byte to use write bra.
1032+
* @bra_r_threshold: The threshold of message size in byte to use read bra.
10311033
*/
10321034
struct sdw_bus {
10331035
struct device *dev;
@@ -1063,6 +1065,8 @@ struct sdw_bus {
10631065
#endif
10641066
bool multi_link;
10651067
unsigned int lane_used_bandwidth[SDW_MAX_LANES];
1068+
unsigned int bra_w_threshold;
1069+
unsigned int bra_r_threshold;
10661070
};
10671071

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

0 commit comments

Comments
 (0)