Re: [RESEND PATCH v6 1/3] input: pm8xxx-vib: refactor to easily support new SPMI vibrator

From: Fenglin Wu
Date: Sun Sep 24 2023 - 22:52:36 EST




On 9/24/2023 3:05 AM, Dmitry Baryshkov wrote:
+#define SSBL_VIB_DRV_REG 0x4A
SSBI_VIB....


Thanks for catching the typo, I will fix it in next patch.

+#define SSBI_VIB_DRV_EN_MANUAL_MASK GENMASK(7, 2)
- /* operate in manual mode */
- error = regmap_read(vib->regmap, regs->drv_addr, &val);
- if (error < 0)
- return error;
+ if (data->hw_type != SSBI_VIB) {
You can drop this condition, if ssbi_vib_data.drv_addr is 0.

I am not sure if I understood this comment: 1st, ssbi_vib_data.drv_addr is defined as a constant value 0x4A, so it would never be 0. 2nd, The condition check here is to ignore reading the register base address for SSBI_VIB HW, so we should do the check based on the HW type.


+ error = fwnode_property_read_u32(pdev->dev.fwnode, "reg", &reg_base);
+ if (error < 0) {
+ dev_err(&pdev->dev, "Failed to read reg address, rc=%d\n", error);
+ return error;
+ }
+
+ vib->reg_base += reg_base;