diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f46f7e89f33d..5c1ceeba4515 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -45,6 +45,12 @@ #define adsp_dbg(_dsp, fmt, ...) \ dev_dbg(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__) +/* + * Max I2C transfer size on Qcom platform, 3840 bytes (15 buffers * 256b) + */ + +#define MAX_I2C_TX_SIZE 0xf00 + #define ADSP1_CONTROL_1 0x00 #define ADSP1_CONTROL_2 0x02 #define ADSP1_CONTROL_3 0x03 @@ -1329,8 +1335,8 @@ static int wm_coeff_read_control(struct wm_coeff_ctl *ctl, return ret; while ((len - read_len) > 0) { - toread_len = (len - read_len) > PAGE_SIZE ? - PAGE_SIZE : (len - read_len); + toread_len = (len - read_len) > MAX_I2C_TX_SIZE ? + MAX_I2C_TX_SIZE : (len - read_len); scratch = wm_adsp_buf_alloc(NULL, toread_len, &buf_list); if (!scratch) { @@ -1959,7 +1965,7 @@ static int wm_adsp_write_blocks(struct wm_adsp *dsp, const u8 *data, size_t len, size_t burst_multiple) { - size_t to_write = PAGE_SIZE - (PAGE_SIZE % burst_multiple); + size_t to_write = MAX_I2C_TX_SIZE - (MAX_I2C_TX_SIZE % burst_multiple); size_t remain = len; struct wm_adsp_buf *buf; unsigned int addr_div;