Re: [PATCH v8 3/3] input: pm8xxx-vibrator: add new SPMI vibrator support

From: Fenglin Wu
Date: Thu Apr 11 2024 - 02:58:50 EST


Hi Konrad,

On 4/11/2024 2:10 AM, Konrad Dybcio wrote:


+    if (regs->drv2_mask) {
+        if (on)
+            val = (vib->level << regs->drv2_shift) & regs->drv2_mask;
+        else
+            val = 0;
+        rc = regmap_write(vib->regmap, vib->drv2_addr, val);

Are you purposefuly zeroing out the other bits?

If yes, consider regmap_write_bits here
If not, consider regmap_update_bits here

+        if (rc < 0)
+            return rc;

Ignore regmap_r/w errors, these mean a complete failure of the API and
we don't generally assume MMIO accesses can fail

Unless SPMI is known to have issues here

Sorry, forgot to reply on this comment. Yes, SPMI transaction would fail (even with very low odds) on some boards if the layout of SPMI lines is not good enough. I'd like to keep the consistence since the whole driver also checks the regmap_r/w errors.