Re: [PATCH v10 2/4] input: pm8xxx-vibrator: refactor to support new SPMI vibrator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 4/12/24 14:36, Fenglin Wu via B4 Relay wrote:
From: Fenglin Wu <quic_fenglinw@xxxxxxxxxxx>

Currently, vibrator control register addresses are hard coded,
including the base address and offsets, it's not flexible to
support new SPMI vibrator module which is usually included in
different PMICs with different base address. Refactor it by using
the base address defined in devicetree.

Signed-off-by: Fenglin Wu <quic_fenglinw@xxxxxxxxxxx>
---

[...]

  static const struct pm8xxx_regs pm8058_regs = {
-	.drv_addr = 0x4A,
+	.drv_offset = 0,
  	.drv_mask = 0xf8,

Since you're nearby anyway:

GENMASK(7, 3)

  	.drv_shift = 3,
  	.drv_en_manual_mask = 0xfc,
  };
static struct pm8xxx_regs pm8916_regs = {
-	.enable_addr = 0xc046,
+	.enable_offset = 0x46,
  	.enable_mask = BIT(7),
-	.drv_addr = 0xc041,
-	.drv_mask = 0x1F,
+	.drv_offset = 0x41,
+	.drv_mask = 0x1f,

GENMASK(4, 0)

[...]

+ 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;

return dev_err_probe() instead

Konrad




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux