summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchasewu <chasewu@google.com>2022-03-17 14:12:06 +0800
committerChase Wu <chasewu@google.com>2022-03-17 09:14:05 +0000
commitcd1ebb608dce6155a1fb9641a73d818d4b1b874f (patch)
tree6b0e827b7be92e8bb7935bdbf8f2fbb6442d28bf
parent7ebeddfe8c51aefbcfedf2373e8efb1e24e6bdd5 (diff)
downloadamplifiers-cd1ebb608dce6155a1fb9641a73d818d4b1b874f.tar.gz
cs40l25: correct the maximum PWLE supported size
PWLE string needs to support to the maximum waveform length Bug: 200160363 Test: adb shell cmd vibrator_manager synced waveform -f -a -c 0 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 255 150 10 76 113 10 62 183 Signed-off-by: chasewu <chasewu@google.com> Change-Id: Iee93915a537bf161d4f5dd1a3a31d853af2f3438 Change-Id: Idbe5dafb8b7e7ab2daedecdaf8705e408a21890a
-rw-r--r--cs40l25/cs40l2x.c10
-rw-r--r--cs40l25/include/linux/mfd/cs40l2x.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/cs40l25/cs40l2x.c b/cs40l25/cs40l2x.c
index 1381118..a6d34c4 100644
--- a/cs40l25/cs40l2x.c
+++ b/cs40l25/cs40l2x.c
@@ -1717,12 +1717,12 @@ static int cs40l2x_save_packed_pwle_data(struct cs40l2x_private *cs40l2x,
char *zero_pad_data;
int ret;
- zero_pad_data = kzalloc(CS40L2X_PWLE_BYTES_MAX, GFP_KERNEL);
+ zero_pad_data = kzalloc(CS40L2X_MAX_WLEN, GFP_KERNEL);
if (!zero_pad_data)
return -ENOMEM;
ret = cs40l2x_write_pwle(cs40l2x, zero_pad_data,
- CS40L2X_PWLE_BYTES_MAX, pwle);
+ CS40L2X_MAX_WLEN, pwle);
if (ret > (cs40l2x->comp_bytes / CS40L2X_WT_NUM_VIRT_SLOTS)) {
dev_err(cs40l2x->dev, "PWLE size exceeds available space\n");
@@ -1928,8 +1928,8 @@ static ssize_t cs40l2x_pwle_store(struct device *dev,
bool a = false, v = false;
int ret;
- if (count > CS40L2X_PWLE_BYTES_MAX - 1) {
- dev_err(dev, "PWLE string too large\n");
+ if (count > CS40L2X_MAX_WLEN - 1) {
+ dev_err(dev, "PWLE string too large: %lu\n", count);
return -E2BIG;
}
@@ -2159,7 +2159,7 @@ static ssize_t cs40l2x_pwle_store(struct device *dev,
pwle->nsections = num_segs;
- ret = strscpy_pad(cs40l2x->pwle_str, buf, CS40L2X_PWLE_BYTES_MAX);
+ ret = strscpy_pad(cs40l2x->pwle_str, buf, CS40L2X_MAX_WLEN);
if (ret == -E2BIG) {
goto err_exit;
}
diff --git a/cs40l25/include/linux/mfd/cs40l2x.h b/cs40l25/include/linux/mfd/cs40l2x.h
index ee2b9e3..97bc1f4 100644
--- a/cs40l25/include/linux/mfd/cs40l2x.h
+++ b/cs40l25/include/linux/mfd/cs40l2x.h
@@ -1436,7 +1436,7 @@ struct cs40l2x_private {
bool xm_append;
char wt_file[CS40L2X_WT_FILE_NAME_LEN_MAX];
char wt_date[CS40L2X_WT_FILE_DATE_LEN_MAX];
- char pwle_str[CS40L2X_PWLE_BYTES_MAX];
+ char pwle_str[CS40L2X_MAX_WLEN];
bool exc_available;
struct cs40l2x_dblk_desc pre_dblks[CS40L2X_MAX_A2H_LEVELS];
struct cs40l2x_dblk_desc a2h_dblks[CS40L2X_MAX_A2H_LEVELS];