input: misc: qcom-hv-haptics: check nvmem before using it

Currently, nvmem device is used to store closed loop brake settings. If
nvmem-cells is not specified for closed loop brake, then nvmem device
can be NULL. For such case, skip updating closed loop brake settings by
not writing to the nvmem device.

Change-Id: I18d455814f3731af519949f21a3a553bd1692548
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
This commit is contained in:
Fenglin Wu 2020-04-28 09:00:52 +08:00 committed by David Collins
parent d768902aed
commit 6992edc015

View File

@ -1628,6 +1628,9 @@ static int haptics_store_cl_brake_settings(struct haptics_chip *chip)
int rc = 0;
u8 val;
if (!chip->cl_brake_nvmem)
return 0;
val = MOD_STATUS_SEL_BRAKE_CAL_RNAT_RCAL_VAL;
rc = haptics_write(chip, chip->cfg_addr_base,
HAP_CFG_MOD_STATUS_SEL_REG, &val, 1);