From: Elaine Zhang Date: Mon, 27 Mar 2017 02:55:16 +0000 (+0800) Subject: rk808: rtc: set rtc stopped by default X-Git-Tag: firefly_0821_release~209 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3a455554602b8107d54180b065800709c65ca1ce;p=firefly-linux-kernel-4.4.55.git rk808: rtc: set rtc stopped by default set rtc stopped by default, start rtc in rtc device probe. add rtc node, whether RTC need to initialize. Change-Id: Ifab269786f316d33149a50a18e23af1b6206d57d Signed-off-by: Elaine Zhang --- diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 25ce26546cf0..313963c9aa72 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -184,6 +184,7 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = { { RK808_BUCK1_CONFIG_REG, BUCK1_RATE_MASK, BUCK_ILMIN_200MA }, { RK808_BUCK2_CONFIG_REG, BUCK2_RATE_MASK, BUCK_ILMIN_200MA }, { RK808_DCDC_UV_ACT_REG, BUCK_UV_ACT_MASK, BUCK_UV_ACT_DISABLE}, + { RK808_RTC_CTRL_REG, RTC_STOP, RTC_STOP}, { RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT | VB_LO_SEL_3500MV }, }; @@ -269,6 +270,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = { BOOST_EN_ENABLE | SWITCH_EN_ENABLE }, { RK818_SLEEP_SET_OFF_REG1, OTG_SLP_SET_MASK, OTG_SLP_SET_OFF }, { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_250MA }, + { RK808_RTC_CTRL_REG, RTC_STOP, RTC_STOP}, }; static const struct regmap_irq rk818_irqs[] = { @@ -416,6 +418,7 @@ static const struct mfd_cell rk805s[] = { static const struct rk808_reg_data rk805_pre_init_reg[] = { {RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA}, {RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN}, + {RK808_RTC_CTRL_REG, RTC_STOP, RTC_STOP}, {RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C}, }; diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c index e6274327b43d..13610ff51377 100644 --- a/drivers/rtc/rtc-rk808.c +++ b/drivers/rtc/rtc-rk808.c @@ -387,6 +387,20 @@ static int rk808_rtc_probe(struct platform_device *pdev) return -EINVAL; } break; + case RK808_ID: + np = of_get_child_by_name(pdev->dev.parent->of_node, "rtc"); + if (np && !of_device_is_available(np)) { + dev_info(&pdev->dev, "device is disabled\n"); + return -EINVAL; + } + break; + case RK818_ID: + np = of_get_child_by_name(pdev->dev.parent->of_node, "rtc"); + if (np && !of_device_is_available(np)) { + dev_info(&pdev->dev, "device is disabled\n"); + return -EINVAL; + } + break; default: break; } diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index fa86cea4f67a..d8f766135867 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -327,6 +327,7 @@ enum rk805_reg { #define SWITCH1_EN BIT(5) #define DEV_OFF_RST BIT(3) #define DEV_OFF BIT(0) +#define RTC_STOP BIT(0) #define VB_LO_ACT BIT(4) #define VB_LO_SEL_3500MV (7 << 0)