Skip to content

Commit 6b50fac

Browse files
Javier Martinez Canillastorvalds
authored andcommitted
rtc: max77686: remove dead code for SMPL and WTSR
The MAX77686 RTC chip has two features called SMPL (Sudden Momentary Power Loss) and WTSR (Watchdog Timeout and Software Resets). Support for these features seems to be implemented in the driver but compilation is disabled using a C pre-processor conditional. This code has been disabled since the driver was original merged in commit fca1dd0 ("rtc: max77686: add Maxim 77686 driver"). So, since this code has never been built, let's just remove it. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Cc: Doug Anderson <dianders@chromium.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Olof Johansson <olof@lixom.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e7f7fc7 commit 6b50fac

1 file changed

Lines changed: 0 additions & 101 deletions

File tree

‎drivers/rtc/rtc-max77686.c‎

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@
3232
#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
3333
#define RTC_RBUDR_SHIFT 4
3434
#define RTC_RBUDR_MASK (1 << RTC_RBUDR_SHIFT)
35-
/* WTSR and SMPL Register */
36-
#define WTSRT_SHIFT 0
37-
#define SMPLT_SHIFT 2
38-
#define WTSR_EN_SHIFT 6
39-
#define SMPL_EN_SHIFT 7
40-
#define WTSRT_MASK (3 << WTSRT_SHIFT)
41-
#define SMPLT_MASK (3 << SMPLT_SHIFT)
42-
#define WTSR_EN_MASK (1 << WTSR_EN_SHIFT)
43-
#define SMPL_EN_MASK (1 << SMPL_EN_SHIFT)
4435
/* RTC Hour register */
4536
#define HOUR_PM_SHIFT 6
4637
#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
@@ -49,7 +40,6 @@
4940
#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
5041

5142
#define MAX77686_RTC_UPDATE_DELAY 16
52-
#undef MAX77686_RTC_WTSR_SMPL
5343

5444
enum {
5545
RTC_SEC = 0,
@@ -412,64 +402,6 @@ static const struct rtc_class_ops max77686_rtc_ops = {
412402
.alarm_irq_enable = max77686_rtc_alarm_irq_enable,
413403
};
414404

415-
#ifdef MAX77686_RTC_WTSR_SMPL
416-
static void max77686_rtc_enable_wtsr(struct max77686_rtc_info *info, bool enable)
417-
{
418-
int ret;
419-
unsigned int val, mask;
420-
421-
if (enable)
422-
val = (1 << WTSR_EN_SHIFT) | (3 << WTSRT_SHIFT);
423-
else
424-
val = 0;
425-
426-
mask = WTSR_EN_MASK | WTSRT_MASK;
427-
428-
dev_info(info->dev, "%s: %s WTSR\n", __func__,
429-
enable ? "enable" : "disable");
430-
431-
ret = regmap_update_bits(info->max77686->rtc_regmap,
432-
MAX77686_WTSR_SMPL_CNTL, mask, val);
433-
if (ret < 0) {
434-
dev_err(info->dev, "%s: fail to update WTSR reg(%d)\n",
435-
__func__, ret);
436-
return;
437-
}
438-
439-
max77686_rtc_update(info, MAX77686_RTC_WRITE);
440-
}
441-
442-
static void max77686_rtc_enable_smpl(struct max77686_rtc_info *info, bool enable)
443-
{
444-
int ret;
445-
unsigned int val, mask;
446-
447-
if (enable)
448-
val = (1 << SMPL_EN_SHIFT) | (0 << SMPLT_SHIFT);
449-
else
450-
val = 0;
451-
452-
mask = SMPL_EN_MASK | SMPLT_MASK;
453-
454-
dev_info(info->dev, "%s: %s SMPL\n", __func__,
455-
enable ? "enable" : "disable");
456-
457-
ret = regmap_update_bits(info->max77686->rtc_regmap,
458-
MAX77686_WTSR_SMPL_CNTL, mask, val);
459-
if (ret < 0) {
460-
dev_err(info->dev, "%s: fail to update SMPL reg(%d)\n",
461-
__func__, ret);
462-
return;
463-
}
464-
465-
max77686_rtc_update(info, MAX77686_RTC_WRITE);
466-
467-
val = 0;
468-
regmap_read(info->max77686->rtc_regmap, MAX77686_WTSR_SMPL_CNTL, &val);
469-
dev_info(info->dev, "%s: WTSR_SMPL(0x%02x)\n", __func__, val);
470-
}
471-
#endif /* MAX77686_RTC_WTSR_SMPL */
472-
473405
static int max77686_rtc_init_reg(struct max77686_rtc_info *info)
474406
{
475407
u8 data[2];
@@ -519,11 +451,6 @@ static int max77686_rtc_probe(struct platform_device *pdev)
519451
goto err_rtc;
520452
}
521453

522-
#ifdef MAX77686_RTC_WTSR_SMPL
523-
max77686_rtc_enable_wtsr(info, true);
524-
max77686_rtc_enable_smpl(info, true);
525-
#endif
526-
527454
device_init_wakeup(&pdev->dev, 1);
528455

529456
info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max77686-rtc",
@@ -556,33 +483,6 @@ static int max77686_rtc_probe(struct platform_device *pdev)
556483
return ret;
557484
}
558485

559-
static void max77686_rtc_shutdown(struct platform_device *pdev)
560-
{
561-
#ifdef MAX77686_RTC_WTSR_SMPL
562-
struct max77686_rtc_info *info = platform_get_drvdata(pdev);
563-
int i;
564-
u8 val = 0;
565-
566-
for (i = 0; i < 3; i++) {
567-
max77686_rtc_enable_wtsr(info, false);
568-
regmap_read(info->max77686->rtc_regmap, MAX77686_WTSR_SMPL_CNTL, &val);
569-
dev_info(info->dev, "%s: WTSR_SMPL reg(0x%02x)\n", __func__,
570-
val);
571-
if (val & WTSR_EN_MASK) {
572-
dev_emerg(info->dev, "%s: fail to disable WTSR\n",
573-
__func__);
574-
} else {
575-
dev_info(info->dev, "%s: success to disable WTSR\n",
576-
__func__);
577-
break;
578-
}
579-
}
580-
581-
/* Disable SMPL when power off */
582-
max77686_rtc_enable_smpl(info, false);
583-
#endif /* MAX77686_RTC_WTSR_SMPL */
584-
}
585-
586486
#ifdef CONFIG_PM_SLEEP
587487
static int max77686_rtc_suspend(struct device *dev)
588488
{
@@ -622,7 +522,6 @@ static struct platform_driver max77686_rtc_driver = {
622522
.pm = &max77686_rtc_pm_ops,
623523
},
624524
.probe = max77686_rtc_probe,
625-
.shutdown = max77686_rtc_shutdown,
626525
.id_table = rtc_id,
627526
};
628527

0 commit comments

Comments
 (0)