misc: cs40l20: Update wavetable validation scheme

* Corrected the calculation of algorithm revision
* Limited the comparison of algorithm revisions to the MAJOR field

Change-Id: I903802f98c472109aa5d62915ab611b1ff869c80
Signed-off-by: Jeff LaBundy <jeff.labundy@cirrus.com>
Signed-off-by: Ravi Vembu <raviv@motorola.com>
This commit is contained in:
Jeff LaBundy 2018-02-28 21:18:44 -06:00 • committed by a7301c
commit 26f267a2f3
2 changed files with 11 additions and 6 deletions

View file

@ -1032,11 +1032,13 @@ static void cs40l20_waveform_load(const struct firmware *fw, void *context)
goto err_rls_fw;
}
if (algo_rev != cs40l20->vibegen_rev) {
if (((algo_rev >> 8) & CS40L20_ALGO_REV_MASK)
!= (cs40l20->vibegen_rev
& CS40L20_ALGO_REV_MASK)) {
dev_err(dev, "Invalid algo. rev.: %d.%d.%d\n",
(algo_rev & 0xFF000000) >> 24,
(algo_rev & 0xFF0000) >> 16,
(algo_rev & 0xFF00) >> 8,
algo_rev & 0xFF);
(algo_rev & 0xFF00) >> 8);
goto err_rls_fw;
}
@ -1065,11 +1067,13 @@ static void cs40l20_waveform_load(const struct firmware *fw, void *context)
goto err_rls_fw;
}
if (algo_rev != cs40l20->vibegen_rev) {
if (((algo_rev >> 8) & CS40L20_ALGO_REV_MASK)
!= (cs40l20->vibegen_rev
& CS40L20_ALGO_REV_MASK)) {
dev_err(dev, "Invalid algo. rev.: %d.%d.%d\n",
(algo_rev & 0xFF000000) >> 24,
(algo_rev & 0xFF0000) >> 16,
(algo_rev & 0xFF00) >> 8,
algo_rev & 0xFF);
(algo_rev & 0xFF00) >> 8);
goto err_rls_fw;
}

View file

@ -702,6 +702,7 @@
#define CS40L20_ALGO_YM_SIZE_OFFSET 20
#define CS40L20_ALGO_ENTRY_SIZE 24
#define CS40L20_ALGO_LIST_TERM 0xBEDEAD
#define CS40L20_ALGO_REV_MASK 0xFF0000
#define CS40L20_NUM_ALGOS_MAX 16
#define CS40L20_FW_REV_MIN 0x000300