rtc: pcf8563: Enable or disable clock out due to clk_disable_unused hang. imx_4.9.88_2.0.0_ga-somdevices.y
authorJosep Orga <jorga@somdevices.com>
Thu, 30 Apr 2020 10:45:01 +0000 (12:45 +0200)
committerJosep Orga <jorga@somdevices.com>
Thu, 30 Apr 2020 10:45:01 +0000 (12:45 +0200)
Signed-off-by: Josep Orga <jorga@somdevices.com>
drivers/rtc/rtc-pcf8563.c

index a4b8b60..ee64ec8 100644 (file)
@@ -23,6 +23,9 @@
 #include <linux/of.h>
 #include <linux/err.h>
 
+/*Enable or disable clock out due to clk_disable_unused hang*/
+//#define PCF8563_ENABLE_CLKO
+
 #define PCF8563_REG_ST1                0x00 /* status */
 #define PCF8563_REG_ST2                0x01
 #define PCF8563_BIT_AIE                (1 << 1)
@@ -82,7 +85,7 @@ struct pcf8563 {
        int voltage_low; /* incicates if a low_voltage was detected */
 
        struct i2c_client *client;
-#ifdef CONFIG_COMMON_CLK
+#if defined(CONFIG_COMMON_CLK) && defined(PCF8563_ENABLE_CLKO)
        struct clk_hw           clkout_hw;
 #endif
 };
@@ -387,7 +390,7 @@ static int pcf8563_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *tm)
        if (err)
                return err;
 
-       return pcf8563_set_alarm_mode(client, 1);
+       return pcf8563_set_alarm_mode(client, !!tm->enabled);
 }
 
 static int pcf8563_irq_enable(struct device *dev, unsigned int enabled)
@@ -396,7 +399,7 @@ static int pcf8563_irq_enable(struct device *dev, unsigned int enabled)
        return pcf8563_set_alarm_mode(to_i2c_client(dev), !!enabled);
 }
 
-#ifdef CONFIG_COMMON_CLK
+#if defined(CONFIG_COMMON_CLK) && defined(PCF8563_ENABLE_CLKO)
 /*
  * Handling of the clkout
  */
@@ -606,7 +609,7 @@ static int pcf8563_probe(struct i2c_client *client,
                err = devm_request_threaded_irq(&client->dev, client->irq,
                                NULL, pcf8563_irq,
                                IRQF_SHARED|IRQF_ONESHOT|IRQF_TRIGGER_FALLING,
-                               pcf8563->rtc->name, client);
+                               pcf8563_driver.driver.name, client);
                if (err) {
                        dev_err(&client->dev, "unable to request IRQ %d\n",
                                                                client->irq);
@@ -615,7 +618,7 @@ static int pcf8563_probe(struct i2c_client *client,
 
        }
 
-#ifdef CONFIG_COMMON_CLK
+#if defined(CONFIG_COMMON_CLK) && defined(PCF8563_ENABLE_CLKO)
        /* register clk in common clk framework */
        pcf8563_clkout_register_clk(pcf8563);
 #endif