Skip to content

Commit 9ff3f83

Browse files
committed
soundwire: bus: add bpt_w/r_threshold
We need a threshold to use BPT/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 35eb117 commit 9ff3f83

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)
@@ -165,6 +168,11 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
165168
bus->params.curr_bank = SDW_BANK0;
166169
bus->params.next_bank = SDW_BANK1;
167170

171+
if (!bus->bpt_w_threshold)
172+
bus->bpt_w_threshold = DEFAULT_BRA_WRITE_THRESHOLD;
173+
if (!bus->bpt_r_threshold)
174+
bus->bpt_r_threshold = DEFAULT_BRA_READ_THRESHOLD;
175+
168176
return 0;
169177
}
170178
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+
* @bpt_w_threshold: Message-size threshold (bytes) above which BPT write is used.
1032+
* If set to 0, a default is used.
1033+
* @bpt_r_threshold: Message-size threshold (bytes) above which BPT read is used.
1034+
* If set to 0, a default is used.
10311035
*/
10321036
struct sdw_bus {
10331037
struct device *dev;
@@ -1064,6 +1068,8 @@ struct sdw_bus {
10641068
#endif
10651069
bool multi_link;
10661070
unsigned int lane_used_bandwidth[SDW_MAX_LANES];
1071+
unsigned int bpt_w_threshold;
1072+
unsigned int bpt_r_threshold;
10671073
};
10681074

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

0 commit comments

Comments
 (0)