Commit 4672c2f2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull RTC updates from Alexandre Belloni:
 "A lot of unnecessary code removal in here that ends up decreasing the
  number of lines in the subsystem. The ds1343 and ds1347 drivers got
  cleaned up. The rest are the usual fixes and new features.

  Subsystem:
   - fix warnings and errors with make W=1
   - UIE are now disabled while setting the RTC time
   - UIE are now disallowed when the RTC time is not set.

  Drivers:
   - remove unecessary .remove callbacks
   - Set RTC range for cros-ec, ds1343, ds1347, m41t80, s35390a, vt8500
   - Use devm_platform_ioremap_resource where applicable
   - rv3028: add clock out support"

* tag 'rtc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (81 commits)
  rtc: Fix Kconfig indentation
  rtc: xgene: Remove unused struct device in struct xgene_rtc_dev
  rtc: sun6i: Remove struct device from sun6i_rtc_dev
  rtc: st-lpc: Remove struct resource from struct st_rtc
  rtc: pcf8523: Remove struct pcf8523
  rtc: meson: remove redundant assignment to variable retries
  rtc: v3020: remove set but unused variable
  rtc: tegra: remove set but unused variable
  rtc: pm8xxx: update kerneldoc for struct pm8xxx_rtc
  rtc: m41t80: remove excess kerneldoc
  rtc: ds1685: fix build error with make W=1
  rtc: ds1685: remove set but unused variables
  rtc: ds1374: remove unused variable
  rtc: sysfs: fix hctosys_show kerneldoc
  rtc: interface: fix kerneldoc comments
  rtc: msm6242: Remove unneeded msm6242_set()/msm6242_clear() functions
  rtc: msm6242: Fix reading of 10-hour digit
  rtc: tps65910: allow using RTC without alarm interrupt
  rtc: fsl-ftm-alarm: remove select FSL_RCPM and default y from Kconfig
  rtc: pcf8563: Constify clkout_rates
  ...
parents 2a31aca5 f830f7cf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ ip32_rtc_platform_data[] = {
		.bcd_mode = true,
		.no_irq = false,
		.uie_unsupported = false,
		.alloc_io_resources = true,
		.access_type = ds1685_reg_direct,
		.plat_prepare_poweroff = ip32_prepare_poweroff,
	},
};
+15 −16
Original line number Diff line number Diff line
@@ -373,17 +373,6 @@ config RTC_DRV_MAX77686
	  This driver can also be built as a module. If so, the module
	  will be called rtc-max77686.

config RTC_DRV_MESON_VRTC
	tristate "Amlogic Meson Virtual RTC"
	depends on ARCH_MESON || COMPILE_TEST
	default m if ARCH_MESON
	help
	  If you say yes here you will get support for the
	  Virtual RTC of Amlogic SoCs.

	  This driver can also be built as a module. If so, the module
	  will be called rtc-meson-vrtc.

config RTC_DRV_RK808
	tristate "Rockchip RK805/RK808/RK809/RK817/RK818 RTC"
	depends on MFD_RK808
@@ -1337,8 +1326,6 @@ config RTC_DRV_IMXDI
config RTC_DRV_FSL_FTM_ALARM
	tristate "Freescale FlexTimer alarm timer"
	depends on ARCH_LAYERSCAPE || SOC_LS1021A
	select FSL_RCPM
	default y
	help
	   For the FlexTimer in LS1012A, LS1021A, LS1028A, LS1043A, LS1046A,
	   LS1088A, LS208xA, we can use FTM as the wakeup source.
@@ -1360,6 +1347,17 @@ config RTC_DRV_MESON
	   This driver can also be built as a module, if so, the module
	   will be called "rtc-meson".

config RTC_DRV_MESON_VRTC
	tristate "Amlogic Meson Virtual RTC"
	depends on ARCH_MESON || COMPILE_TEST
	default m if ARCH_MESON
	help
	  If you say yes here you will get support for the
	  Virtual RTC of Amlogic SoCs.

	  This driver can also be built as a module. If so, the module
	  will be called rtc-meson-vrtc.

config RTC_DRV_OMAP
	tristate "TI OMAP Real Time Clock"
	depends on ARCH_OMAP || ARCH_DAVINCI || COMPILE_TEST
@@ -1459,6 +1457,7 @@ config RTC_DRV_PL031
config RTC_DRV_AT91RM9200
	tristate "AT91RM9200 or some AT91SAM9 RTC"
	depends on ARCH_AT91 || COMPILE_TEST
	depends on OF
	help
	  Driver for the internal RTC (Realtime Clock) module found on
	  Atmel AT91RM9200's and some  AT91SAM9 chips. On AT91SAM9 chips
+44 −14
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static int rtc_valid_range(struct rtc_device *rtc, struct rtc_time *tm)
		time64_t time = rtc_tm_to_time64(tm);
		time64_t range_min = rtc->set_start_time ? rtc->start_secs :
			rtc->range_min;
		time64_t range_max = rtc->set_start_time ?
		timeu64_t range_max = rtc->set_start_time ?
			(rtc->start_secs + rtc->range_max - rtc->range_min) :
			rtc->range_max;

@@ -125,7 +125,7 @@ EXPORT_SYMBOL_GPL(rtc_read_time);

int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
{
	int err;
	int err, uie;

	err = rtc_valid_tm(tm);
	if (err != 0)
@@ -137,6 +137,17 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)

	rtc_subtract_offset(rtc, tm);

#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
	uie = rtc->uie_rtctimer.enabled || rtc->uie_irq_active;
#else
	uie = rtc->uie_rtctimer.enabled;
#endif
	if (uie) {
		err = rtc_update_irq_enable(rtc, 0);
		if (err)
			return err;
	}

	err = mutex_lock_interruptible(&rtc->ops_lock);
	if (err)
		return err;
@@ -153,6 +164,12 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
	/* A timer might have just expired */
	schedule_work(&rtc->irqwork);

	if (uie) {
		err = rtc_update_irq_enable(rtc, 1);
		if (err)
			return err;
	}

	trace_rtc_set_time(rtc_tm_to_time64(tm), err);
	return err;
}
@@ -528,7 +545,7 @@ EXPORT_SYMBOL_GPL(rtc_alarm_irq_enable);

int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
{
	int err;
	int rc = 0, err;

	err = mutex_lock_interruptible(&rtc->ops_lock);
	if (err)
@@ -553,7 +570,9 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
		struct rtc_time tm;
		ktime_t now, onesec;

		__rtc_read_time(rtc, &tm);
		rc = __rtc_read_time(rtc, &tm);
		if (rc)
			goto out;
		onesec = ktime_set(1, 0);
		now = rtc_tm_to_ktime(tm);
		rtc->uie_rtctimer.node.expires = ktime_add(now, onesec);
@@ -565,6 +584,16 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)

out:
	mutex_unlock(&rtc->ops_lock);

	/*
	 * __rtc_read_time() failed, this probably means that the RTC time has
	 * never been set or less probably there is a transient error on the
	 * bus. In any case, avoid enabling emulation has this will fail when
	 * reading the time too.
	 */
	if (rc)
		return rc;

#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
	/*
	 * Enable emulation if the driver returned -EINVAL to signal that it has
@@ -581,6 +610,8 @@ EXPORT_SYMBOL_GPL(rtc_update_irq_enable);
/**
 * rtc_handle_legacy_irq - AIE, UIE and PIE event hook
 * @rtc: pointer to the rtc device
 * @num: number of occurence of the event
 * @mode: type of the event, RTC_AF, RTC_UF of RTC_PF
 *
 * This function is called when an AIE, UIE or PIE mode interrupt
 * has occurred (or been emulated).
@@ -761,8 +792,8 @@ int rtc_irq_set_freq(struct rtc_device *rtc, int freq)

/**
 * rtc_timer_enqueue - Adds a rtc_timer to the rtc_device timerqueue
 * @rtc rtc device
 * @timer timer being added.
 * @rtc: rtc device
 * @timer: timer being added.
 *
 * Enqueues a timer onto the rtc devices timerqueue and sets
 * the next alarm event appropriately.
@@ -821,8 +852,8 @@ static void rtc_alarm_disable(struct rtc_device *rtc)

/**
 * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue
 * @rtc rtc device
 * @timer timer being removed.
 * @rtc: rtc device
 * @timer: timer being removed.
 *
 * Removes a timer onto the rtc devices timerqueue and sets
 * the next alarm event appropriately.
@@ -859,8 +890,7 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)

/**
 * rtc_timer_do_work - Expires rtc timers
 * @rtc rtc device
 * @timer timer being removed.
 * @work: work item
 *
 * Expires rtc timers. Reprograms next alarm event if needed.
 * Called via worktask.
+0 −11
Original line number Diff line number Diff line
@@ -900,16 +900,6 @@ err:
	return ret;
}

static int abb5zes3_remove(struct i2c_client *client)
{
	struct abb5zes3_rtc_data *rtc_data = dev_get_drvdata(&client->dev);

	if (rtc_data->irq > 0)
		device_init_wakeup(&client->dev, false);

	return 0;
}

#ifdef CONFIG_PM_SLEEP
static int abb5zes3_rtc_suspend(struct device *dev)
{
@@ -956,7 +946,6 @@ static struct i2c_driver abb5zes3_driver = {
		.of_match_table = of_match_ptr(abb5zes3_dt_match),
	},
	.probe	  = abb5zes3_probe,
	.remove	  = abb5zes3_remove,
	.id_table = abb5zes3_id,
};
module_i2c_driver(abb5zes3_driver);
+3 −7
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ struct armada38x_rtc {
	int		    irq;
	bool		    initialized;
	struct value_to_freq *val_to_freq;
	struct armada38x_rtc_data *data;
	const struct armada38x_rtc_data *data;
};

#define ALARM1	0
@@ -501,17 +501,14 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
{
	struct resource *res;
	struct armada38x_rtc *rtc;
	const struct of_device_id *match;

	match = of_match_device(armada38x_rtc_of_match_table, &pdev->dev);
	if (!match)
		return -ENODEV;

	rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
			    GFP_KERNEL);
	if (!rtc)
		return -ENOMEM;

	rtc->data = of_device_get_match_data(&pdev->dev);

	rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
				sizeof(struct value_to_freq), GFP_KERNEL);
	if (!rtc->val_to_freq)
@@ -553,7 +550,6 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
		 */
		rtc->rtc_dev->ops = &armada38x_rtc_ops_noirq;
	}
	rtc->data = (struct armada38x_rtc_data *)match->data;

	/* Update RTC-MBUS bridge timing parameters */
	rtc->data->update_mbus_timing(rtc);
Loading