Pull RTC updates from Alexandre Belloni: "Not much this cycle, there are multiple small fixes. Core: - use boolean values with device_init_wakeup() Drivers: - pcf2127: add BSM support - pcf85063: fix possible out of bounds write" * tag 'rtc-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: rtc: pcf2127: add BSM support rtc: Remove hpet_rtc_dropped_irq() dt-bindings: rtc: mxc: Document fsl,imx31-rtc rtc: stm32: Use syscon_regmap_lookup_by_phandle_args rtc: zynqmp: Fix optional clock name property rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr() rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read rtc: tps6594: Fix integer overflow on 32bit systems rtc: use boolean values with device_init_wakeup() rtc: RTC_DRV_SPEAR should not default to y when compile-testing
Unified · Split
| @@ -14,9 +14,13 @@ maintainers: · 13 unmodified lines | |||
| 14 | 14 | ||
| 15 | properties: | 15 | properties: |
| 16 | compatible: | 16 | compatible: |
| 17 | enum: | 17 | oneOf: |
| 18 | - fsl,imx1-rtc | 18 | - const: fsl,imx1-rtc |
| 19 | - fsl,imx21-rtc | 19 | - const: fsl,imx21-rtc |
| 20 | - items: | ||
| 21 | - enum: | ||
| 22 | - fsl,imx31-rtc | ||
| 23 | - const: fsl,imx21-rtc | ||
| 20 | 24 | ||
| 21 | reg: | 25 | reg: |
| 22 | maxItems: 1 | 26 | maxItems: 1 |
| @@ -84,7 +84,6 @@ extern int hpet_set_rtc_irq_bit(unsigned long bit_mask); · 83 unmodified lines | |||
| 84 | extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, | 84 | extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min, |
| 85 | unsigned char sec); | 85 | unsigned char sec); |
| 86 | extern int hpet_set_periodic_freq(unsigned long freq); | 86 | extern int hpet_set_periodic_freq(unsigned long freq); |
| 87 | extern int hpet_rtc_dropped_irq(void); | ||
| 88 | extern int hpet_rtc_timer_init(void); | 87 | extern int hpet_rtc_timer_init(void); |
| 89 | extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); | 88 | extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id); |
| 90 | extern int hpet_register_irq_handler(rtc_irq_handler handler); | 89 | extern int hpet_register_irq_handler(rtc_irq_handler handler); |
| @@ -1382,12 +1382,6 @@ int hpet_set_periodic_freq(unsigned long freq) · 1381 unmodified lines | |||
| 1382 | } | 1382 | } |
| 1383 | EXPORT_SYMBOL_GPL(hpet_set_periodic_freq); | 1383 | EXPORT_SYMBOL_GPL(hpet_set_periodic_freq); |
| 1384 | 1384 | ||
| 1385 | int hpet_rtc_dropped_irq(void) | ||
| 1386 | { | ||
| 1387 | return is_hpet_enabled(); | ||
| 1388 | } | ||
| 1389 | EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq); | ||
| 1390 | |||
| 1391 | static void hpet_rtc_timer_reinit(void) | 1385 | static void hpet_rtc_timer_reinit(void) |
| 1392 | { | 1386 | { |
| 1393 | unsigned int delta; | 1387 | unsigned int delta; |
| @@ -1316,7 +1316,7 @@ config RTC_DRV_SC27XX · 1315 unmodified lines | |||
| 1316 | config RTC_DRV_SPEAR | 1316 | config RTC_DRV_SPEAR |
| 1317 | tristate "SPEAR ST RTC" | 1317 | tristate "SPEAR ST RTC" |
| 1318 | depends on PLAT_SPEAR || COMPILE_TEST | 1318 | depends on PLAT_SPEAR || COMPILE_TEST |
| 1319 | default y | 1319 | default PLAT_SPEAR |
| 1320 | help | 1320 | help |
| 1321 | If you say Y here you will get support for the RTC found on | 1321 | If you say Y here you will get support for the RTC found on |
| 1322 | spear | 1322 | spear |
| @@ -308,7 +308,7 @@ static int pm80x_rtc_probe(struct platform_device *pdev) · 307 unmodified lines | |||
| 308 | /* remember whether this power up is caused by PMIC RTC or not */ | 308 | /* remember whether this power up is caused by PMIC RTC or not */ |
| 309 | info->rtc_dev->dev.platform_data = &pdata->rtc_wakeup; | 309 | info->rtc_dev->dev.platform_data = &pdata->rtc_wakeup; |
| 310 | 310 | ||
| 311 | device_init_wakeup(&pdev->dev, 1); | 311 | device_init_wakeup(&pdev->dev, true); |
| 312 | 312 | ||
| 313 | return 0; | 313 | return 0; |
| 314 | out_rtc: | 314 | out_rtc: |
| @@ -326,7 +326,7 @@ static int pm860x_rtc_probe(struct platform_device *pdev) · 325 unmodified lines | |||
| 326 | schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); | 326 | schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); |
| 327 | #endif /* VRTC_CALIBRATION */ | 327 | #endif /* VRTC_CALIBRATION */ |
| 328 | 328 | ||
| 329 | device_init_wakeup(&pdev->dev, 1); | 329 | device_init_wakeup(&pdev->dev, true); |
| 330 | 330 | ||
| 331 | return 0; | 331 | return 0; |
| 332 | } | 332 | } |
| @@ -361,7 +361,7 @@ static int aml_rtc_probe(struct platform_device *pdev) · 360 unmodified lines | |||
| 361 | "failed to get_enable rtc sys clk\n"); | 361 | "failed to get_enable rtc sys clk\n"); |
| 362 | aml_rtc_init(rtc); | 362 | aml_rtc_init(rtc); |
| 363 | 363 | ||
| 364 | device_init_wakeup(dev, 1); | 364 | device_init_wakeup(dev, true); |
| 365 | platform_set_drvdata(pdev, rtc); | 365 | platform_set_drvdata(pdev, rtc); |
| 366 | 366 | ||
| 367 | rtc->rtc_dev = devm_rtc_allocate_device(dev); | 367 | rtc->rtc_dev = devm_rtc_allocate_device(dev); |
| @@ -391,7 +391,7 @@ static int aml_rtc_probe(struct platform_device *pdev) · 23 unmodified lines | |||
| 391 | return 0; | 391 | return 0; |
| 392 | err_clk: | 392 | err_clk: |
| 393 | clk_disable_unprepare(rtc->sys_clk); | 393 | clk_disable_unprepare(rtc->sys_clk); |
| 394 | device_init_wakeup(dev, 0); | 394 | device_init_wakeup(dev, false); |
| 395 | 395 | ||
| 396 | return ret; | 396 | return ret; |
| 397 | } | 397 | } |
| @@ -426,7 +426,7 @@ static void aml_rtc_remove(struct platform_device *pdev) · 28 unmodified lines | |||
| 426 | struct aml_rtc_data *rtc = dev_get_drvdata(&pdev->dev); | 426 | struct aml_rtc_data *rtc = dev_get_drvdata(&pdev->dev); |
| 427 | 427 | ||
| 428 | clk_disable_unprepare(rtc->sys_clk); | 428 | clk_disable_unprepare(rtc->sys_clk); |
| 429 | device_init_wakeup(&pdev->dev, 0); | 429 | device_init_wakeup(&pdev->dev, false); |
| 430 | } | 430 | } |
| 431 | 431 | ||
| 432 | static const struct aml_rtc_config a5_rtc_config = { | 432 | static const struct aml_rtc_config a5_rtc_config = { |
| @@ -527,7 +527,7 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev) · 526 unmodified lines | |||
| 527 | platform_set_drvdata(pdev, rtc); | 527 | platform_set_drvdata(pdev, rtc); |
| 528 | 528 | ||
| 529 | if (rtc->irq != -1) | 529 | if (rtc->irq != -1) |
| 530 | device_init_wakeup(&pdev->dev, 1); | 530 | device_init_wakeup(&pdev->dev, true); |
| 531 | else | 531 | else |
| 532 | clear_bit(RTC_FEATURE_ALARM, rtc->rtc_dev->features); | 532 | clear_bit(RTC_FEATURE_ALARM, rtc->rtc_dev->features); |
| 533 | 533 | ||
| @@ -187,7 +187,7 @@ static int as3722_rtc_probe(struct platform_device *pdev) · 186 unmodified lines | |||
| 187 | return ret; | 187 | return ret; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | device_init_wakeup(&pdev->dev, 1); | 190 | device_init_wakeup(&pdev->dev, true); |
| 191 | 191 | ||
| 192 | as3722_rtc->rtc = devm_rtc_device_register(&pdev->dev, "as3722-rtc", | 192 | as3722_rtc->rtc = devm_rtc_device_register(&pdev->dev, "as3722-rtc", |
| 193 | &as3722_rtc_ops, THIS_MODULE); | 193 | &as3722_rtc_ops, THIS_MODULE); |
| @@ -528,7 +528,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) · 527 unmodified lines | |||
| 528 | * being wake-capable; if it didn't, do that here. | 528 | * being wake-capable; if it didn't, do that here. |
| 529 | */ | 529 | */ |
| 530 | if (!device_can_wakeup(&pdev->dev)) | 530 | if (!device_can_wakeup(&pdev->dev)) |
| 531 | device_init_wakeup(&pdev->dev, 1); | 531 | device_init_wakeup(&pdev->dev, true); |
| 532 | 532 | ||
| 533 | if (at91_rtc_config->has_correction) | 533 | if (at91_rtc_config->has_correction) |
| 534 | rtc->ops = &sama5d4_rtc_ops; | 534 | rtc->ops = &sama5d4_rtc_ops; |
| @@ -353,7 +353,7 @@ static int at91_rtc_probe(struct platform_device *pdev) · 352 unmodified lines | |||
| 353 | 353 | ||
| 354 | /* platform setup code should have handled this; sigh */ | 354 | /* platform setup code should have handled this; sigh */ |
| 355 | if (!device_can_wakeup(&pdev->dev)) | 355 | if (!device_can_wakeup(&pdev->dev)) |
| 356 | device_init_wakeup(&pdev->dev, 1); | 356 | device_init_wakeup(&pdev->dev, true); |
| 357 | 357 | ||
| 358 | platform_set_drvdata(pdev, rtc); | 358 | platform_set_drvdata(pdev, rtc); |
| 359 | 359 | ||
| @@ -359,7 +359,7 @@ static void cdns_rtc_remove(struct platform_device *pdev) · 358 unmodified lines | |||
| 359 | struct cdns_rtc *crtc = platform_get_drvdata(pdev); | 359 | struct cdns_rtc *crtc = platform_get_drvdata(pdev); |
| 360 | 360 | ||
| 361 | cdns_rtc_alarm_irq_enable(&pdev->dev, 0); | 361 | cdns_rtc_alarm_irq_enable(&pdev->dev, 0); |
| 362 | device_init_wakeup(&pdev->dev, 0); | 362 | device_init_wakeup(&pdev->dev, false); |
| 363 | 363 | ||
| 364 | clk_disable_unprepare(crtc->pclk); | 364 | clk_disable_unprepare(crtc->pclk); |
| 365 | clk_disable_unprepare(crtc->ref_clk); | 365 | clk_disable_unprepare(crtc->ref_clk); |
| @@ -151,11 +151,6 @@ static inline int hpet_set_periodic_freq(unsigned long freq) · 150 unmodified lines | |||
| 151 | return 0; | 151 | return 0; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static inline int hpet_rtc_dropped_irq(void) | ||
| 155 | { | ||
| 156 | return 0; | ||
| 157 | } | ||
| 158 | |||
| 159 | static inline int hpet_rtc_timer_init(void) | 154 | static inline int hpet_rtc_timer_init(void) |
| 160 | { | 155 | { |
| 161 | return 0; | 156 | return 0; |
| @@ -864,7 +859,7 @@ static void acpi_cmos_wake_setup(struct device *dev) · 702 unmodified lines | |||
| 864 | dev_info(dev, "RTC can wake from S4\n"); | 859 | dev_info(dev, "RTC can wake from S4\n"); |
| 865 | 860 | ||
| 866 | /* RTC always wakes from S1/S2/S3, and often S4/STD */ | 861 | /* RTC always wakes from S1/S2/S3, and often S4/STD */ |
| 867 | device_init_wakeup(dev, 1); | 862 | device_init_wakeup(dev, true); |
| 868 | } | 863 | } |
| 869 | 864 | ||
| 870 | static void cmos_check_acpi_rtc_status(struct device *dev, | 865 | static void cmos_check_acpi_rtc_status(struct device *dev, |
| @@ -295,7 +295,7 @@ static int cpcap_rtc_probe(struct platform_device *pdev) · 294 unmodified lines | |||
| 295 | } | 295 | } |
| 296 | disable_irq(rtc->update_irq); | 296 | disable_irq(rtc->update_irq); |
| 297 | 297 | ||
| 298 | err = device_init_wakeup(dev, 1); | 298 | err = device_init_wakeup(dev, true); |
| 299 | if (err) { | 299 | if (err) { |
| 300 | dev_err(dev, "wakeup initialization failed (%d)\n", err); | 300 | dev_err(dev, "wakeup initialization failed (%d)\n", err); |
| 301 | /* ignore error and continue without wakeup support */ | 301 | /* ignore error and continue without wakeup support */ |
| @@ -337,7 +337,7 @@ static int cros_ec_rtc_probe(struct platform_device *pdev) · 336 unmodified lines | |||
| 337 | return ret; | 337 | return ret; |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | ret = device_init_wakeup(&pdev->dev, 1); | 340 | ret = device_init_wakeup(&pdev->dev, true); |
| 341 | if (ret) { | 341 | if (ret) { |
| 342 | dev_err(&pdev->dev, "failed to initialize wakeup\n"); | 342 | dev_err(&pdev->dev, "failed to initialize wakeup\n"); |
| 343 | return ret; | 343 | return ret; |
| @@ -288,7 +288,7 @@ static int da9055_rtc_probe(struct platform_device *pdev) · 287 unmodified lines | |||
| 288 | if (ret & DA9055_RTC_ALM_EN) | 288 | if (ret & DA9055_RTC_ALM_EN) |
| 289 | rtc->alarm_enable = 1; | 289 | rtc->alarm_enable = 1; |
| 290 | 290 | ||
| 291 | device_init_wakeup(&pdev->dev, 1); | 291 | device_init_wakeup(&pdev->dev, true); |
| 292 | 292 | ||
| 293 | rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, | 293 | rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
| 294 | &da9055_rtc_ops, THIS_MODULE); | 294 | &da9055_rtc_ops, THIS_MODULE); |
| @@ -508,7 +508,7 @@ static int ds3232_probe(struct device *dev, struct regmap *regmap, int irq, · 507 unmodified lines | |||
| 508 | return ret; | 508 | return ret; |
| 509 | 509 | ||
| 510 | if (ds3232->irq > 0) | 510 | if (ds3232->irq > 0) |
| 511 | device_init_wakeup(dev, 1); | 511 | device_init_wakeup(dev, true); |
| 512 | 512 | ||
| 513 | ds3232_hwmon_register(dev, name); | 513 | ds3232_hwmon_register(dev, name); |
| 514 | 514 | ||
| @@ -830,7 +830,7 @@ static int isl1208_setup_irq(struct i2c_client *client, int irq) · 829 unmodified lines | |||
| 830 | isl1208_driver.driver.name, | 830 | isl1208_driver.driver.name, |
| 831 | client); | 831 | client); |
| 832 | if (!rc) { | 832 | if (!rc) { |
| 833 | device_init_wakeup(&client->dev, 1); | 833 | device_init_wakeup(&client->dev, true); |
| 834 | enable_irq_wake(irq); | 834 | enable_irq_wake(irq); |
| 835 | } else { | 835 | } else { |
| 836 | dev_err(&client->dev, | 836 | dev_err(&client->dev, |
| @@ -367,7 +367,7 @@ static int jz4740_rtc_probe(struct platform_device *pdev) · 366 unmodified lines | |||
| 367 | 367 | ||
| 368 | platform_set_drvdata(pdev, rtc); | 368 | platform_set_drvdata(pdev, rtc); |
| 369 | 369 | ||
| 370 | device_init_wakeup(dev, 1); | 370 | device_init_wakeup(dev, true); |
| 371 | 371 | ||
| 372 | ret = dev_pm_set_wake_irq(dev, irq); | 372 | ret = dev_pm_set_wake_irq(dev, irq); |
| 373 | if (ret) | 373 | if (ret) |
| @@ -114,6 +114,13 @@ static irqreturn_t loongson_rtc_isr(int irq, void *id) · 113 unmodified lines | |||
| 114 | struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id; | 114 | struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id; |
| 115 | 115 | ||
| 116 | rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF); | 116 | rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF); |
| 117 | |||
| 118 | /* | ||
| 119 | * The TOY_MATCH0_REG should be cleared 0 here, | ||
| 120 | * otherwise the interrupt cannot be cleared. | ||
| 121 | */ | ||
| 122 | regmap_write(priv->regmap, TOY_MATCH0_REG, 0); | ||
| 123 | |||
| 117 | return IRQ_HANDLED; | 124 | return IRQ_HANDLED; |
| 118 | } | 125 | } |
| 119 | 126 | ||
| @@ -131,11 +138,7 @@ static u32 loongson_rtc_handler(void *id) · 11 unmodified lines | |||
| 131 | writel(RTC_STS, priv->pm_base + PM1_STS_REG); | 138 | writel(RTC_STS, priv->pm_base + PM1_STS_REG); |
| 132 | spin_unlock(&priv->lock); | 139 | spin_unlock(&priv->lock); |
| 133 | 140 | ||
| 134 | /* | 141 | return ACPI_INTERRUPT_HANDLED; |
| 135 | * The TOY_MATCH0_REG should be cleared 0 here, | ||
| 136 | * otherwise the interrupt cannot be cleared. | ||
| 137 | */ | ||
| 138 | return regmap_write(priv->regmap, TOY_MATCH0_REG, 0); | ||
| 139 | } | 142 | } |
| 140 | 143 | ||
| 141 | static int loongson_rtc_set_enabled(struct device *dev) | 144 | static int loongson_rtc_set_enabled(struct device *dev) |
| @@ -329,7 +332,7 @@ static int loongson_rtc_probe(struct platform_device *pdev) · 187 unmodified lines | |||
| 329 | alarm_irq); | 332 | alarm_irq); |
| 330 | 333 | ||
| 331 | priv->pm_base = regs - priv->config->pm_offset; | 334 | priv->pm_base = regs - priv->config->pm_offset; |
| 332 | device_init_wakeup(dev, 1); | 335 | device_init_wakeup(dev, true); |
| 333 | 336 | ||
| 334 | if (has_acpi_companion(dev)) | 337 | if (has_acpi_companion(dev)) |
| 335 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, | 338 | acpi_install_fixed_event_handler(ACPI_EVENT_RTC, |
| @@ -360,7 +363,7 @@ static void loongson_rtc_remove(struct platform_device *pdev) · 24 unmodified lines | |||
| 360 | acpi_remove_fixed_event_handler(ACPI_EVENT_RTC, | 363 | acpi_remove_fixed_event_handler(ACPI_EVENT_RTC, |
| 361 | loongson_rtc_handler); | 364 | loongson_rtc_handler); |
| 362 | 365 | ||
| 363 | device_init_wakeup(dev, 0); | 366 | device_init_wakeup(dev, false); |
| 364 | loongson_rtc_alarm_irq_enable(dev, 0); | 367 | loongson_rtc_alarm_irq_enable(dev, 0); |
| 365 | } | 368 | } |
| 366 | 369 | ||
| @@ -293,7 +293,7 @@ static int lp8788_rtc_probe(struct platform_device *pdev) · 292 unmodified lines | |||
| 293 | rtc->alarm = lp->pdata ? lp->pdata->alarm_sel : DEFAULT_ALARM_SEL; | 293 | rtc->alarm = lp->pdata ? lp->pdata->alarm_sel : DEFAULT_ALARM_SEL; |
| 294 | platform_set_drvdata(pdev, rtc); | 294 | platform_set_drvdata(pdev, rtc); |
| 295 | 295 | ||
| 296 | device_init_wakeup(dev, 1); | 296 | device_init_wakeup(dev, true); |
| 297 | 297 | ||
| 298 | rtc->rdev = devm_rtc_device_register(dev, "lp8788_rtc", | 298 | rtc->rdev = devm_rtc_device_register(dev, "lp8788_rtc", |
| 299 | &lp8788_rtc_ops, THIS_MODULE); | 299 | &lp8788_rtc_ops, THIS_MODULE); |
| @@ -257,7 +257,7 @@ static int lpc32xx_rtc_probe(struct platform_device *pdev) · 256 unmodified lines | |||
| 257 | dev_warn(&pdev->dev, "Can't request interrupt.\n"); | 257 | dev_warn(&pdev->dev, "Can't request interrupt.\n"); |
| 258 | rtc->irq = -1; | 258 | rtc->irq = -1; |
| 259 | } else { | 259 | } else { |
| 260 | device_init_wakeup(&pdev->dev, 1); | 260 | device_init_wakeup(&pdev->dev, true); |
| 261 | } | 261 | } |
| 262 | } | 262 | } |
| 263 | 263 | ||
| @@ -770,7 +770,7 @@ static int max77686_rtc_probe(struct platform_device *pdev) · 769 unmodified lines | |||
| 770 | goto err_rtc; | 770 | goto err_rtc; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | device_init_wakeup(&pdev->dev, 1); | 773 | device_init_wakeup(&pdev->dev, true); |
| 774 | 774 | ||
| 775 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, id->name, | 775 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, id->name, |
| 776 | &max77686_rtc_ops, THIS_MODULE); | 776 | &max77686_rtc_ops, THIS_MODULE); |
| @@ -270,7 +270,7 @@ static int max8925_rtc_probe(struct platform_device *pdev) · 269 unmodified lines | |||
| 270 | /* XXX - isn't this redundant? */ | 270 | /* XXX - isn't this redundant? */ |
| 271 | platform_set_drvdata(pdev, info); | 271 | platform_set_drvdata(pdev, info); |
| 272 | 272 | ||
| 273 | device_init_wakeup(&pdev->dev, 1); | 273 | device_init_wakeup(&pdev->dev, true); |
| 274 | 274 | ||
| 275 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8925-rtc", | 275 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8925-rtc", |
| 276 | &max8925_rtc_ops, THIS_MODULE); | 276 | &max8925_rtc_ops, THIS_MODULE); |
| @@ -473,7 +473,7 @@ static int max8997_rtc_probe(struct platform_device *pdev) · 472 unmodified lines | |||
| 473 | max8997_rtc_enable_wtsr(info, true); | 473 | max8997_rtc_enable_wtsr(info, true); |
| 474 | max8997_rtc_enable_smpl(info, true); | 474 | max8997_rtc_enable_smpl(info, true); |
| 475 | 475 | ||
| 476 | device_init_wakeup(&pdev->dev, 1); | 476 | device_init_wakeup(&pdev->dev, true); |
| 477 | 477 | ||
| 478 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8997-rtc", | 478 | info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max8997-rtc", |
| 479 | &max8997_rtc_ops, THIS_MODULE); | 479 | &max8997_rtc_ops, THIS_MODULE); |
| @@ -74,7 +74,7 @@ static int meson_vrtc_probe(struct platform_device *pdev) · 73 unmodified lines | |||
| 74 | if (IS_ERR(vrtc->io_alarm)) | 74 | if (IS_ERR(vrtc->io_alarm)) |
| 75 | return PTR_ERR(vrtc->io_alarm); | 75 | return PTR_ERR(vrtc->io_alarm); |
| 76 | 76 | ||
| 77 | device_init_wakeup(&pdev->dev, 1); | 77 | device_init_wakeup(&pdev->dev, true); |
| 78 | 78 | ||
| 79 | platform_set_drvdata(pdev, vrtc); | 79 | platform_set_drvdata(pdev, vrtc); |
| 80 | 80 | ||
| @@ -303,7 +303,7 @@ static int mpc5121_rtc_probe(struct platform_device *op) · 302 unmodified lines | |||
| 303 | return PTR_ERR(rtc->regs); | 303 | return PTR_ERR(rtc->regs); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | device_init_wakeup(&op->dev, 1); | 306 | device_init_wakeup(&op->dev, true); |
| 307 | 307 | ||
| 308 | platform_set_drvdata(op, rtc); | 308 | platform_set_drvdata(op, rtc); |
| 309 | 309 | ||
| @@ -286,7 +286,7 @@ static int mtk_rtc_probe(struct platform_device *pdev) · 285 unmodified lines | |||
| 286 | return ret; | 286 | return ret; |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | device_init_wakeup(&pdev->dev, 1); | 289 | device_init_wakeup(&pdev->dev, true); |
| 290 | 290 | ||
| 291 | rtc->rtc_dev->ops = &mtk_rtc_ops; | 291 | rtc->rtc_dev->ops = &mtk_rtc_ops; |
| 292 | rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; | 292 | rtc->rtc_dev->range_min = RTC_TIMESTAMP_BEGIN_1900; |
| @@ -264,7 +264,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev) · 263 unmodified lines | |||
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | if (pdata->irq >= 0) | 266 | if (pdata->irq >= 0) |
| 267 | device_init_wakeup(&pdev->dev, 1); | 267 | device_init_wakeup(&pdev->dev, true); |
| 268 | else | 268 | else |
| 269 | clear_bit(RTC_FEATURE_ALARM, pdata->rtc->features); | 269 | clear_bit(RTC_FEATURE_ALARM, pdata->rtc->features); |
| 270 | 270 | ||
| @@ -287,7 +287,7 @@ static void __exit mv_rtc_remove(struct platform_device *pdev) · 16 unmodified lines | |||
| 287 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 287 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
| 288 | 288 | ||
| 289 | if (pdata->irq >= 0) | 289 | if (pdata->irq >= 0) |
| 290 | device_init_wakeup(&pdev->dev, 0); | 290 | device_init_wakeup(&pdev->dev, false); |
| 291 | 291 | ||
| 292 | if (!IS_ERR(pdata->clk)) | 292 | if (!IS_ERR(pdata->clk)) |
| 293 | clk_disable_unprepare(pdata->clk); | 293 | clk_disable_unprepare(pdata->clk); |
| @@ -377,7 +377,7 @@ static int mxc_rtc_probe(struct platform_device *pdev) · 376 unmodified lines | |||
| 377 | } | 377 | } |
| 378 | 378 | ||
| 379 | if (pdata->irq >= 0) { | 379 | if (pdata->irq >= 0) { |
| 380 | device_init_wakeup(&pdev->dev, 1); | 380 | device_init_wakeup(&pdev->dev, true); |
| 381 | ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq); | 381 | ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq); |
| 382 | if (ret) | 382 | if (ret) |
| 383 | dev_err(&pdev->dev, "failed to enable irq wake\n"); | 383 | dev_err(&pdev->dev, "failed to enable irq wake\n"); |
| @@ -302,7 +302,7 @@ static int mxc_rtc_probe(struct platform_device *pdev) · 301 unmodified lines | |||
| 302 | if (pdata->irq < 0) | 302 | if (pdata->irq < 0) |
| 303 | return pdata->irq; | 303 | return pdata->irq; |
| 304 | 304 | ||
| 305 | device_init_wakeup(&pdev->dev, 1); | 305 | device_init_wakeup(&pdev->dev, true); |
| 306 | ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq); | 306 | ret = dev_pm_set_wake_irq(&pdev->dev, pdata->irq); |
| 307 | if (ret) | 307 | if (ret) |
| 308 | dev_err(&pdev->dev, "failed to enable irq wake\n"); | 308 | dev_err(&pdev->dev, "failed to enable irq wake\n"); |
| @@ -920,7 +920,7 @@ static void omap_rtc_remove(struct platform_device *pdev) · 919 unmodified lines | |||
| 920 | omap_rtc_power_off_rtc = NULL; | 920 | omap_rtc_power_off_rtc = NULL; |
| 921 | } | 921 | } |
| 922 | 922 | ||
| 923 | device_init_wakeup(&pdev->dev, 0); | 923 | device_init_wakeup(&pdev->dev, false); |
| 924 | 924 | ||
| 925 | if (!IS_ERR(rtc->clk)) | 925 | if (!IS_ERR(rtc->clk)) |
| 926 | clk_disable_unprepare(rtc->clk); | 926 | clk_disable_unprepare(rtc->clk); |
| @@ -287,7 +287,7 @@ static int palmas_rtc_probe(struct platform_device *pdev) · 286 unmodified lines | |||
| 287 | 287 | ||
| 288 | palmas_rtc->irq = platform_get_irq(pdev, 0); | 288 | palmas_rtc->irq = platform_get_irq(pdev, 0); |
| 289 | 289 | ||
| 290 | device_init_wakeup(&pdev->dev, 1); | 290 | device_init_wakeup(&pdev->dev, true); |
| 291 | palmas_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, | 291 | palmas_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
| 292 | &palmas_rtc_ops, THIS_MODULE); | 292 | &palmas_rtc_ops, THIS_MODULE); |
| 293 | if (IS_ERR(palmas_rtc->rtc)) { | 293 | if (IS_ERR(palmas_rtc->rtc)) { |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
| 21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
| 22 | #include <linux/bcd.h> | 22 | #include <linux/bcd.h> |
| 23 | #include <linux/bitfield.h> | ||
| 23 | #include <linux/rtc.h> | 24 | #include <linux/rtc.h> |
| 24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 25 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| @@ -48,6 +49,7 @@ · 22 unmodified lines | |||
| 48 | #define PCF2127_BIT_CTRL3_BLF BIT(2) | 49 | #define PCF2127_BIT_CTRL3_BLF BIT(2) |
| 49 | #define PCF2127_BIT_CTRL3_BF BIT(3) | 50 | #define PCF2127_BIT_CTRL3_BF BIT(3) |
| 50 | #define PCF2127_BIT_CTRL3_BTSE BIT(4) | 51 | #define PCF2127_BIT_CTRL3_BTSE BIT(4) |
| 52 | #define PCF2127_CTRL3_PM GENMASK(7, 5) | ||
| 51 | /* Time and date registers */ | 53 | /* Time and date registers */ |
| 52 | #define PCF2127_REG_TIME_BASE 0x03 | 54 | #define PCF2127_REG_TIME_BASE 0x03 |
| 53 | #define PCF2127_BIT_SC_OSF BIT(7) | 55 | #define PCF2127_BIT_SC_OSF BIT(7) |
| @@ -331,6 +333,84 @@ static int pcf2127_rtc_set_time(struct device *dev, struct rtc_time *tm) · 277 unmodified lines | |||
| 331 | return 0; | 333 | return 0; |
| 332 | } | 334 | } |
| 333 | 335 | ||
| 336 | static int pcf2127_param_get(struct device *dev, struct rtc_param *param) | ||
| 337 | { | ||
| 338 | struct pcf2127 *pcf2127 = dev_get_drvdata(dev); | ||
| 339 | u32 value; | ||
| 340 | int ret; | ||
| 341 | |||
| 342 | switch (param->param) { | ||
| 343 | case RTC_PARAM_BACKUP_SWITCH_MODE: | ||
| 344 | ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL3, &value); | ||
| 345 | if (ret < 0) | ||
| 346 | return ret; | ||
| 347 | |||
| 348 | value = FIELD_GET(PCF2127_CTRL3_PM, value); | ||
| 349 | |||
| 350 | if (value < 0x3) | ||
| 351 | param->uvalue = RTC_BSM_LEVEL; | ||
| 352 | else if (value < 0x6) | ||
| 353 | param->uvalue = RTC_BSM_DIRECT; | ||
| 354 | else | ||
| 355 | param->uvalue = RTC_BSM_DISABLED; | ||
| 356 | |||
| 357 | break; | ||
| 358 | |||
| 359 | default: | ||
| 360 | return -EINVAL; | ||
| 361 | } | ||
| 362 | |||
| 363 | return 0; | ||
| 364 | } | ||
| 365 | |||
| 366 | static int pcf2127_param_set(struct device *dev, struct rtc_param *param) | ||
| 367 | { | ||
| 368 | struct pcf2127 *pcf2127 = dev_get_drvdata(dev); | ||
| 369 | u8 mode = 0; | ||
| 370 | u32 value; | ||
| 371 | int ret; | ||
| 372 | |||
| 373 | switch (param->param) { | ||
| 374 | case RTC_PARAM_BACKUP_SWITCH_MODE: | ||
| 375 | ret = regmap_read(pcf2127->regmap, PCF2127_REG_CTRL3, &value); | ||
| 376 | if (ret < 0) | ||
| 377 | return ret; | ||
| 378 | |||
| 379 | value = FIELD_GET(PCF2127_CTRL3_PM, value); | ||
| 380 | |||
| 381 | if (value > 5) | ||
| 382 | value -= 5; | ||
| 383 | else if (value > 2) | ||
| 384 | value -= 3; | ||
| 385 | |||
| 386 | switch (param->uvalue) { | ||
| 387 | case RTC_BSM_LEVEL: | ||
| 388 | break; | ||
| 389 | case RTC_BSM_DIRECT: | ||
| 390 | mode = 3; | ||
| 391 | break; | ||
| 392 | case RTC_BSM_DISABLED: | ||
| 393 | if (value == 0) | ||
| 394 | value = 1; | ||
| 395 | mode = 5; | ||
| 396 | break; | ||
| 397 | default: | ||
| 398 | return -EINVAL; | ||
| 399 | } | ||
| 400 | |||
| 401 | return regmap_update_bits(pcf2127->regmap, PCF2127_REG_CTRL3, | ||
| 402 | PCF2127_CTRL3_PM, | ||
| 403 | FIELD_PREP(PCF2127_CTRL3_PM, mode + value)); | ||
| 404 | |||
| 405 | break; | ||
| 406 | |||
| 407 | default: | ||
| 408 | return -EINVAL; | ||
| 409 | } | ||
| 410 | |||
| 411 | return 0; | ||
| 412 | } | ||
| 413 | |||
| 334 | static int pcf2127_rtc_ioctl(struct device *dev, | 414 | static int pcf2127_rtc_ioctl(struct device *dev, |
| 335 | unsigned int cmd, unsigned long arg) | 415 | unsigned int cmd, unsigned long arg) |
| 336 | { | 416 | { |
| @@ -741,6 +821,8 @@ static const struct rtc_class_ops pcf2127_rtc_ops = { · 404 unmodified lines | |||
| 741 | .read_alarm = pcf2127_rtc_read_alarm, | 821 | .read_alarm = pcf2127_rtc_read_alarm, |
| 742 | .set_alarm = pcf2127_rtc_set_alarm, | 822 | .set_alarm = pcf2127_rtc_set_alarm, |
| 743 | .alarm_irq_enable = pcf2127_rtc_alarm_irq_enable, | 823 | .alarm_irq_enable = pcf2127_rtc_alarm_irq_enable, |
| 824 | .param_get = pcf2127_param_get, | ||
| 825 | .param_set = pcf2127_param_set, | ||
| 744 | }; | 826 | }; |
| 745 | 827 | ||
| 746 | /* sysfs interface */ | 828 | /* sysfs interface */ |
| @@ -322,7 +322,16 @@ static const struct rtc_class_ops pcf85063_rtc_ops = { · 321 unmodified lines | |||
| 322 | static int pcf85063_nvmem_read(void *priv, unsigned int offset, | 322 | static int pcf85063_nvmem_read(void *priv, unsigned int offset, |
| 323 | void *val, size_t bytes) | 323 | void *val, size_t bytes) |
| 324 | { | 324 | { |
| 325 | return regmap_read(priv, PCF85063_REG_RAM, val); | 325 | unsigned int tmp; |
| 326 | int ret; | ||
| 327 | |||
| 328 | ret = regmap_read(priv, PCF85063_REG_RAM, &tmp); | ||
| 329 | if (ret < 0) | ||
| 330 | return ret; | ||
| 331 | |||
| 332 | *(u8 *)val = tmp; | ||
| 333 | |||
| 334 | return 0; | ||
| 326 | } | 335 | } |
| 327 | 336 | ||
| 328 | static int pcf85063_nvmem_write(void *priv, unsigned int offset, | 337 | static int pcf85063_nvmem_write(void *priv, unsigned int offset, |
| @@ -330,7 +330,7 @@ static int pic32_rtc_probe(struct platform_device *pdev) · 329 unmodified lines | |||
| 330 | 330 | ||
| 331 | pic32_rtc_enable(pdata, 1); | 331 | pic32_rtc_enable(pdata, 1); |
| 332 | 332 | ||
| 333 | device_init_wakeup(&pdev->dev, 1); | 333 | device_init_wakeup(&pdev->dev, true); |
| 334 | 334 | ||
| 335 | pdata->rtc->ops = &pic32_rtcops; | 335 | pdata->rtc->ops = &pic32_rtcops; |
| 336 | pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; | 336 | pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; |
| @@ -503,7 +503,7 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) · 502 unmodified lines | |||
| 503 | 503 | ||
| 504 | platform_set_drvdata(pdev, rtc_dd); | 504 | platform_set_drvdata(pdev, rtc_dd); |
| 505 | 505 | ||
| 506 | device_init_wakeup(&pdev->dev, 1); | 506 | device_init_wakeup(&pdev->dev, true); |
| 507 | 507 | ||
| 508 | rtc_dd->rtc = devm_rtc_allocate_device(&pdev->dev); | 508 | rtc_dd->rtc = devm_rtc_allocate_device(&pdev->dev); |
| 509 | if (IS_ERR(rtc_dd->rtc)) | 509 | if (IS_ERR(rtc_dd->rtc)) |
| @@ -360,7 +360,7 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) · 359 unmodified lines | |||
| 360 | return ret; | 360 | return ret; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | device_init_wakeup(dev, 1); | 363 | device_init_wakeup(dev, true); |
| 364 | 364 | ||
| 365 | return 0; | 365 | return 0; |
| 366 | } | 366 | } |
| @@ -245,7 +245,7 @@ static int rc5t583_rtc_probe(struct platform_device *pdev) · 244 unmodified lines | |||
| 245 | dev_err(&pdev->dev, "IRQ is not free.\n"); | 245 | dev_err(&pdev->dev, "IRQ is not free.\n"); |
| 246 | return ret; | 246 | return ret; |
| 247 | } | 247 | } |
| 248 | device_init_wakeup(&pdev->dev, 1); | 248 | device_init_wakeup(&pdev->dev, true); |
| 249 | 249 | ||
| 250 | ricoh_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, | 250 | ricoh_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
| 251 | &rc5t583_rtc_ops, THIS_MODULE); | 251 | &rc5t583_rtc_ops, THIS_MODULE); |
| @@ -414,7 +414,7 @@ static int rc5t619_rtc_probe(struct platform_device *pdev) · 413 unmodified lines | |||
| 414 | 414 | ||
| 415 | } else { | 415 | } else { |
| 416 | /* enable wake */ | 416 | /* enable wake */ |
| 417 | device_init_wakeup(&pdev->dev, 1); | 417 | device_init_wakeup(&pdev->dev, true); |
| 418 | enable_irq_wake(rtc->irq); | 418 | enable_irq_wake(rtc->irq); |
| 419 | } | 419 | } |
| 420 | } else { | 420 | } else { |
| @@ -768,7 +768,7 @@ static int rtca3_probe(struct platform_device *pdev) · 767 unmodified lines | |||
| 768 | if (ret) | 768 | if (ret) |
| 769 | return ret; | 769 | return ret; |
| 770 | 770 | ||
| 771 | device_init_wakeup(&pdev->dev, 1); | 771 | device_init_wakeup(&pdev->dev, true); |
| 772 | 772 | ||
| 773 | priv->rtc_dev = devm_rtc_allocate_device(&pdev->dev); | 773 | priv->rtc_dev = devm_rtc_allocate_device(&pdev->dev); |
| 774 | if (IS_ERR(priv->rtc_dev)) | 774 | if (IS_ERR(priv->rtc_dev)) |
| @@ -418,7 +418,7 @@ static int rk808_rtc_probe(struct platform_device *pdev) · 417 unmodified lines | |||
| 418 | return ret; | 418 | return ret; |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | device_init_wakeup(&pdev->dev, 1); | 421 | device_init_wakeup(&pdev->dev, true); |
| 422 | 422 | ||
| 423 | rk808_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); | 423 | rk808_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
| 424 | if (IS_ERR(rk808_rtc->rtc)) | 424 | if (IS_ERR(rk808_rtc->rtc)) |
| @@ -456,7 +456,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) · 455 unmodified lines | |||
| 456 | dev_dbg(&pdev->dev, "s3c2410_rtc: RTCCON=%02x\n", | 456 | dev_dbg(&pdev->dev, "s3c2410_rtc: RTCCON=%02x\n", |
| 457 | readw(info->base + S3C2410_RTCCON)); | 457 | readw(info->base + S3C2410_RTCCON)); |
| 458 | 458 | ||
| 459 | device_init_wakeup(&pdev->dev, 1); | 459 | device_init_wakeup(&pdev->dev, true); |
| 460 | 460 | ||
| 461 | info->rtc = devm_rtc_allocate_device(&pdev->dev); | 461 | info->rtc = devm_rtc_allocate_device(&pdev->dev); |
| 462 | if (IS_ERR(info->rtc)) { | 462 | if (IS_ERR(info->rtc)) { |
| @@ -729,7 +729,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) · 728 unmodified lines | |||
| 729 | info->irq, ret); | 729 | info->irq, ret); |
| 730 | return ret; | 730 | return ret; |
| 731 | } | 731 | } |
| 732 | device_init_wakeup(&pdev->dev, 1); | 732 | device_init_wakeup(&pdev->dev, true); |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | return devm_rtc_register_device(info->rtc_dev); | 735 | return devm_rtc_register_device(info->rtc_dev); |
| @@ -292,7 +292,7 @@ static int sa1100_rtc_probe(struct platform_device *pdev) · 291 unmodified lines | |||
| 292 | } | 292 | } |
| 293 | 293 | ||
| 294 | platform_set_drvdata(pdev, info); | 294 | platform_set_drvdata(pdev, info); |
| 295 | device_init_wakeup(&pdev->dev, 1); | 295 | device_init_wakeup(&pdev->dev, true); |
| 296 | 296 | ||
| 297 | return sa1100_rtc_init(pdev, info); | 297 | return sa1100_rtc_init(pdev, info); |
| 298 | } | 298 | } |
| @@ -613,14 +613,14 @@ static int sprd_rtc_probe(struct platform_device *pdev) · 612 unmodified lines | |||
| 613 | return ret; | 613 | return ret; |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | device_init_wakeup(&pdev->dev, 1); | 616 | device_init_wakeup(&pdev->dev, true); |
| 617 | 617 | ||
| 618 | rtc->rtc->ops = &sprd_rtc_ops; | 618 | rtc->rtc->ops = &sprd_rtc_ops; |
| 619 | rtc->rtc->range_min = 0; | 619 | rtc->rtc->range_min = 0; |
| 620 | rtc->rtc->range_max = 5662310399LL; | 620 | rtc->rtc->range_max = 5662310399LL; |
| 621 | ret = devm_rtc_register_device(rtc->rtc); | 621 | ret = devm_rtc_register_device(rtc->rtc); |
| 622 | if (ret) { | 622 | if (ret) { |
| 623 | device_init_wakeup(&pdev->dev, 0); | 623 | device_init_wakeup(&pdev->dev, false); |
| 624 | return ret; | 624 | return ret; |
| 625 | } | 625 | } |
| 626 | 626 | ||
| @@ -611,7 +611,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev) · 610 unmodified lines | |||
| 611 | if (ret) | 611 | if (ret) |
| 612 | goto err_unmap; | 612 | goto err_unmap; |
| 613 | 613 | ||
| 614 | device_init_wakeup(&pdev->dev, 1); | 614 | device_init_wakeup(&pdev->dev, true); |
| 615 | return 0; | 615 | return 0; |
| 616 | 616 | ||
| 617 | err_unmap: | 617 | err_unmap: |
| @@ -395,7 +395,7 @@ static int spear_rtc_probe(struct platform_device *pdev) · 394 unmodified lines | |||
| 395 | goto err_disable_clock; | 395 | goto err_disable_clock; |
| 396 | 396 | ||
| 397 | if (!device_can_wakeup(&pdev->dev)) | 397 | if (!device_can_wakeup(&pdev->dev)) |
| 398 | device_init_wakeup(&pdev->dev, 1); | 398 | device_init_wakeup(&pdev->dev, true); |
| 399 | 399 | ||
| 400 | return 0; | 400 | return 0; |
| 401 | 401 | ||
| @@ -411,7 +411,7 @@ static void spear_rtc_remove(struct platform_device *pdev) · 9 unmodified lines | |||
| 411 | 411 | ||
| 412 | spear_rtc_disable_interrupt(config); | 412 | spear_rtc_disable_interrupt(config); |
| 413 | clk_disable_unprepare(config->clk); | 413 | clk_disable_unprepare(config->clk); |
| 414 | device_init_wakeup(&pdev->dev, 0); | 414 | device_init_wakeup(&pdev->dev, false); |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | #ifdef CONFIG_PM_SLEEP | 417 | #ifdef CONFIG_PM_SLEEP |
| @@ -1074,26 +1074,18 @@ static int stm32_rtc_probe(struct platform_device *pdev) · 1073 unmodified lines | |||
| 1074 | regs = &rtc->data->regs; | 1074 | regs = &rtc->data->regs; |
| 1075 | 1075 | ||
| 1076 | if (rtc->data->need_dbp) { | 1076 | if (rtc->data->need_dbp) { |
| 1077 | rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, | 1077 | unsigned int args[2]; |
| 1078 | "st,syscfg"); | 1078 | |
| 1079 | rtc->dbp = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node, | ||
| 1080 | "st,syscfg", | ||
| 1081 | 2, args); | ||
| 1079 | if (IS_ERR(rtc->dbp)) { | 1082 | if (IS_ERR(rtc->dbp)) { |
| 1080 | dev_err(&pdev->dev, "no st,syscfg\n"); | 1083 | dev_err(&pdev->dev, "no st,syscfg\n"); |
| 1081 | return PTR_ERR(rtc->dbp); | 1084 | return PTR_ERR(rtc->dbp); |
| 1082 | } | 1085 | } |
| 1083 | 1086 | ||
| 1084 | ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg", | 1087 | rtc->dbp_reg = args[0]; |
| 1085 | 1, &rtc->dbp_reg); | 1088 | rtc->dbp_mask = args[1]; |
| 1086 | if (ret) { | ||
| 1087 | dev_err(&pdev->dev, "can't read DBP register offset\n"); | ||
| 1088 | return ret; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg", | ||
| 1092 | 2, &rtc->dbp_mask); | ||
| 1093 | if (ret) { | ||
| 1094 | dev_err(&pdev->dev, "can't read DBP register mask\n"); | ||
| 1095 | return ret; | ||
| 1096 | } | ||
| 1097 | } | 1089 | } |
| 1098 | 1090 | ||
| 1099 | if (!rtc->data->has_pclk) { | 1091 | if (!rtc->data->has_pclk) { |
| @@ -826,7 +826,7 @@ static int sun6i_rtc_probe(struct platform_device *pdev) · 825 unmodified lines | |||
| 826 | 826 | ||
| 827 | clk_prepare_enable(chip->losc); | 827 | clk_prepare_enable(chip->losc); |
| 828 | 828 | ||
| 829 | device_init_wakeup(&pdev->dev, 1); | 829 | device_init_wakeup(&pdev->dev, true); |
| 830 | 830 | ||
| 831 | chip->rtc = devm_rtc_allocate_device(&pdev->dev); | 831 | chip->rtc = devm_rtc_allocate_device(&pdev->dev); |
| 832 | if (IS_ERR(chip->rtc)) | 832 | if (IS_ERR(chip->rtc)) |
| @@ -269,7 +269,7 @@ static int sp_rtc_probe(struct platform_device *plat_dev) · 268 unmodified lines | |||
| 269 | if (ret) | 269 | if (ret) |
| 270 | goto free_reset_assert; | 270 | goto free_reset_assert; |
| 271 | 271 | ||
| 272 | device_init_wakeup(&plat_dev->dev, 1); | 272 | device_init_wakeup(&plat_dev->dev, true); |
| 273 | dev_set_drvdata(&plat_dev->dev, sp_rtc); | 273 | dev_set_drvdata(&plat_dev->dev, sp_rtc); |
| 274 | 274 | ||
| 275 | sp_rtc->rtc = devm_rtc_allocate_device(&plat_dev->dev); | 275 | sp_rtc->rtc = devm_rtc_allocate_device(&plat_dev->dev); |
| @@ -307,7 +307,7 @@ static void sp_rtc_remove(struct platform_device *plat_dev) · 31 unmodified lines | |||
| 307 | { | 307 | { |
| 308 | struct sunplus_rtc *sp_rtc = dev_get_drvdata(&plat_dev->dev); | 308 | struct sunplus_rtc *sp_rtc = dev_get_drvdata(&plat_dev->dev); |
| 309 | 309 | ||
| 310 | device_init_wakeup(&plat_dev->dev, 0); | 310 | device_init_wakeup(&plat_dev->dev, false); |
| 311 | reset_control_assert(sp_rtc->rstc); | 311 | reset_control_assert(sp_rtc->rstc); |
| 312 | clk_disable_unprepare(sp_rtc->rtcclk); | 312 | clk_disable_unprepare(sp_rtc->rtcclk); |
| 313 | } | 313 | } |
| @@ -319,7 +319,7 @@ static int tegra_rtc_probe(struct platform_device *pdev) · 318 unmodified lines | |||
| 319 | writel(0xffffffff, info->base + TEGRA_RTC_REG_INTR_STATUS); | 319 | writel(0xffffffff, info->base + TEGRA_RTC_REG_INTR_STATUS); |
| 320 | writel(0, info->base + TEGRA_RTC_REG_INTR_MASK); | 320 | writel(0, info->base + TEGRA_RTC_REG_INTR_MASK); |
| 321 | 321 | ||
| 322 | device_init_wakeup(&pdev->dev, 1); | 322 | device_init_wakeup(&pdev->dev, true); |
| 323 | 323 | ||
| 324 | ret = devm_request_irq(&pdev->dev, info->irq, tegra_rtc_irq_handler, | 324 | ret = devm_request_irq(&pdev->dev, info->irq, tegra_rtc_irq_handler, |
| 325 | IRQF_TRIGGER_HIGH, dev_name(&pdev->dev), | 325 | IRQF_TRIGGER_HIGH, dev_name(&pdev->dev), |
| @@ -132,7 +132,7 @@ static int test_probe(struct platform_device *plat_dev) · 131 unmodified lines | |||
| 132 | break; | 132 | break; |
| 133 | default: | 133 | default: |
| 134 | rtd->rtc->ops = &test_rtc_ops; | 134 | rtd->rtc->ops = &test_rtc_ops; |
| 135 | device_init_wakeup(&plat_dev->dev, 1); | 135 | device_init_wakeup(&plat_dev->dev, true); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | timer_setup(&rtd->alarm, test_rtc_alarm_handler, 0); | 138 | timer_setup(&rtd->alarm, test_rtc_alarm_handler, 0); |
| @@ -241,7 +241,7 @@ static int tps6586x_rtc_probe(struct platform_device *pdev) · 240 unmodified lines | |||
| 241 | return ret; | 241 | return ret; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | device_init_wakeup(&pdev->dev, 1); | 244 | device_init_wakeup(&pdev->dev, true); |
| 245 | 245 | ||
| 246 | platform_set_drvdata(pdev, rtc); | 246 | platform_set_drvdata(pdev, rtc); |
| 247 | rtc->rtc = devm_rtc_allocate_device(&pdev->dev); | 247 | rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
| @@ -418,7 +418,7 @@ static int tps65910_rtc_probe(struct platform_device *pdev) · 417 unmodified lines | |||
| 418 | tps_rtc->irq = irq; | 418 | tps_rtc->irq = irq; |
| 419 | if (irq != -1) { | 419 | if (irq != -1) { |
| 420 | if (device_property_present(tps65910->dev, "wakeup-source")) | 420 | if (device_property_present(tps65910->dev, "wakeup-source")) |
| 421 | device_init_wakeup(&pdev->dev, 1); | 421 | device_init_wakeup(&pdev->dev, true); |
| 422 | else | 422 | else |
| 423 | device_set_wakeup_capable(&pdev->dev, 1); | 423 | device_set_wakeup_capable(&pdev->dev, 1); |
| 424 | } else { | 424 | } else { |
| @@ -37,7 +37,7 @@ · 36 unmodified lines | |||
| 37 | #define MAX_OFFSET (277774) | 37 | #define MAX_OFFSET (277774) |
| 38 | 38 | ||
| 39 | // Number of ticks per hour | 39 | // Number of ticks per hour |
| 40 | #define TICKS_PER_HOUR (32768 * 3600) | 40 | #define TICKS_PER_HOUR (32768 * 3600LL) |
| 41 | 41 | ||
| 42 | // Multiplier for ppb conversions | 42 | // Multiplier for ppb conversions |
| 43 | #define PPB_MULT NANO | 43 | #define PPB_MULT NANO |
| @@ -572,7 +572,7 @@ static int twl_rtc_probe(struct platform_device *pdev) · 571 unmodified lines | |||
| 572 | return ret; | 572 | return ret; |
| 573 | 573 | ||
| 574 | platform_set_drvdata(pdev, twl_rtc); | 574 | platform_set_drvdata(pdev, twl_rtc); |
| 575 | device_init_wakeup(&pdev->dev, 1); | 575 | device_init_wakeup(&pdev->dev, true); |
| 576 | 576 | ||
| 577 | twl_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, | 577 | twl_rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
| 578 | &twl_rtc_ops, THIS_MODULE); | 578 | &twl_rtc_ops, THIS_MODULE); |
| @@ -420,7 +420,7 @@ static int wm831x_rtc_probe(struct platform_device *pdev) · 419 unmodified lines | |||
| 420 | if (ret & WM831X_RTC_ALM_ENA) | 420 | if (ret & WM831X_RTC_ALM_ENA) |
| 421 | wm831x_rtc->alarm_enabled = 1; | 421 | wm831x_rtc->alarm_enabled = 1; |
| 422 | 422 | ||
| 423 | device_init_wakeup(&pdev->dev, 1); | 423 | device_init_wakeup(&pdev->dev, true); |
| 424 | 424 | ||
| 425 | wm831x_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); | 425 | wm831x_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); |
| 426 | if (IS_ERR(wm831x_rtc->rtc)) | 426 | if (IS_ERR(wm831x_rtc->rtc)) |
| @@ -420,7 +420,7 @@ static int wm8350_rtc_probe(struct platform_device *pdev) · 419 unmodified lines | |||
| 420 | } | 420 | } |
| 421 | } | 421 | } |
| 422 | 422 | ||
| 423 | device_init_wakeup(&pdev->dev, 1); | 423 | device_init_wakeup(&pdev->dev, true); |
| 424 | 424 | ||
| 425 | wm_rtc->rtc = devm_rtc_device_register(&pdev->dev, "wm8350", | 425 | wm_rtc->rtc = devm_rtc_device_register(&pdev->dev, "wm8350", |
| 426 | &wm8350_rtc_ops, THIS_MODULE); | 426 | &wm8350_rtc_ops, THIS_MODULE); |
| @@ -174,7 +174,7 @@ static int xgene_rtc_probe(struct platform_device *pdev) · 173 unmodified lines | |||
| 174 | /* Turn on the clock and the crystal */ | 174 | /* Turn on the clock and the crystal */ |
| 175 | writel(RTC_CCR_EN, pdata->csr_base + RTC_CCR); | 175 | writel(RTC_CCR_EN, pdata->csr_base + RTC_CCR); |
| 176 | 176 | ||
| 177 | ret = device_init_wakeup(&pdev->dev, 1); | 177 | ret = device_init_wakeup(&pdev->dev, true); |
| 178 | if (ret) { | 178 | if (ret) { |
| 179 | clk_disable_unprepare(pdata->clk); | 179 | clk_disable_unprepare(pdata->clk); |
| 180 | return ret; | 180 | return ret; |
| @@ -197,7 +197,7 @@ static void xgene_rtc_remove(struct platform_device *pdev) · 16 unmodified lines | |||
| 197 | struct xgene_rtc_dev *pdata = platform_get_drvdata(pdev); | 197 | struct xgene_rtc_dev *pdata = platform_get_drvdata(pdev); |
| 198 | 198 | ||
| 199 | xgene_rtc_alarm_irq_enable(&pdev->dev, 0); | 199 | xgene_rtc_alarm_irq_enable(&pdev->dev, 0); |
| 200 | device_init_wakeup(&pdev->dev, 0); | 200 | device_init_wakeup(&pdev->dev, false); |
| 201 | clk_disable_unprepare(pdata->clk); | 201 | clk_disable_unprepare(pdata->clk); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| @@ -318,8 +318,8 @@ static int xlnx_rtc_probe(struct platform_device *pdev) · 317 unmodified lines | |||
| 318 | return ret; | 318 | return ret; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | /* Getting the rtc_clk info */ | 321 | /* Getting the rtc info */ |
| 322 | xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc_clk"); | 322 | xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc"); |
| 323 | if (IS_ERR(xrtcdev->rtc_clk)) { | 323 | if (IS_ERR(xrtcdev->rtc_clk)) { |
| 324 | if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER) | 324 | if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER) |
| 325 | dev_warn(&pdev->dev, "Device clock not found.\n"); | 325 | dev_warn(&pdev->dev, "Device clock not found.\n"); |
| @@ -337,7 +337,7 @@ static int xlnx_rtc_probe(struct platform_device *pdev) · 11 unmodified lines | |||
| 337 | 337 | ||
| 338 | xlnx_init_rtc(xrtcdev); | 338 | xlnx_init_rtc(xrtcdev); |
| 339 | 339 | ||
| 340 | device_init_wakeup(&pdev->dev, 1); | 340 | device_init_wakeup(&pdev->dev, true); |
| 341 | 341 | ||
| 342 | return devm_rtc_register_device(xrtcdev->rtc); | 342 | return devm_rtc_register_device(xrtcdev->rtc); |
| 343 | } | 343 | } |
| @@ -345,7 +345,7 @@ static int xlnx_rtc_probe(struct platform_device *pdev) · 1 unmodified line | |||
| 345 | static void xlnx_rtc_remove(struct platform_device *pdev) | 345 | static void xlnx_rtc_remove(struct platform_device *pdev) |
| 346 | { | 346 | { |
| 347 | xlnx_rtc_alarm_irq_enable(&pdev->dev, 0); | 347 | xlnx_rtc_alarm_irq_enable(&pdev->dev, 0); |
| 348 | device_init_wakeup(&pdev->dev, 0); | 348 | device_init_wakeup(&pdev->dev, false); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | static int __maybe_unused xlnx_rtc_suspend(struct device *dev) | 351 | static int __maybe_unused xlnx_rtc_suspend(struct device *dev) |