[RFC] rtc: rv3032: Add devicetree parameter to enable level switching mode

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

 



When the Micro Crystal RV3032 rtc is used with a primary coin-cell for power backup, the backup switching mode LSM (level switching mode) should be used according to the technical support from the manufacturer of this device.

Currently there is no way to set this mode by the driver.

Thererfore, i suggest to introduce an additional parameter for the devicetree to enable this backup switchover mode
and to extend the probe function to look for that parameter and activate the LSM.

Is this an appropriate solution? Does it need improvements?

Signed-off-by: Stefan Hager <s.hager@xxxxxxxxx>

---
diff --git a/Documentation/devicetree/bindings/rtc/microcrystal,rv3032.yaml b/Documentation/devicetree/bindings/rtc/microcrystal,rv3032.yaml
index a2c55303810d..b948e19e358b 100644
--- a/Documentation/devicetree/bindings/rtc/microcrystal,rv3032.yaml
+++ b/Documentation/devicetree/bindings/rtc/microcrystal,rv3032.yaml
@@ -37,6 +37,10 @@ properties:
       - 3000
       - 4400
 
+  backup-switchover-mode-level:
+    description:
+      Use level switching mode for backup switchover mode
+
 required:
   - compatible
   - reg
diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c
index d63102d5cb1e..a28a3e0172d0 100644
--- a/drivers/rtc/rtc-rv3032.c
+++ b/drivers/rtc/rtc-rv3032.c
@@ -881,6 +881,12 @@ static int rv3032_probe(struct i2c_client *client)
        if (ret)
                return ret;
 
+       if (device_property_read_bool(&client->dev, "backup-switchover-mode-level")) {
+               ret = regmap_update_bits(rv3032->regmap, RV3032_PMU, RV3032_PMU_BSM, (RV3032_PMU_BSM_LSM) << 4);
+               if (ret)
+                       return ret;
+       }
+
        rv3032_trickle_charger_setup(&client->dev, rv3032);
 
        rv3032->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux