From 1008db9b220bd48e486aec9e979a5a0984516183 Mon Sep 17 00:00:00 2001 From: Josep Orga Date: Thu, 30 Apr 2020 12:45:01 +0200 Subject: [PATCH] rtc: pcf8563: Enable or disable clock out due to clk_disable_unused hang. Signed-off-by: Josep Orga --- drivers/rtc/rtc-pcf8563.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index a4b8b603c807..ee64ec8f53f4 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -23,6 +23,9 @@ #include #include +/*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 -- 2.17.1