Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbe173e3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull RTC updates from Alexandre Belloni:
 "This contains a few series that have been in preparation for a while
  and that will help systems with RTCs that will fail in 2038, 2069 or
  2100.

  Subsystem:
   - Add tracepoints
   - Rework of the RTC/nvmem API to allow drivers to discard struct
     nvmem_config after registration
   - New range API, drivers can now expose the useful range of the RTC
   - New offset API the core is now able to add an offset to the RTC
     time, modifying the supported range.
   - Multiple rtc_time64_to_tm fixes
   - Handle time_t overflow on 32 bit platforms in the core instead of
     letting drivers do crazy things.
   - remove rtc_control API

  New driver:
   - Intersil ISL12026

  Drivers:
   - Drivers exposing the RTC non volatile memory have been converted to
     use nvmem
   - Removed useless time and date validation
   - Removed an indirection pattern that was a cargo cult from ancient
     drivers
   - Removed VLA usage
   - Fixed a possible race condition in probe functions
   - AB8540 support is dropped from ab8500
   - pcf85363 now has alarm support"

* tag 'rtc-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (128 commits)
  rtc: snvs: Fix usage of snvs_rtc_enable
  rtc: mt7622: fix module autoloading for OF platform drivers
  rtc: isl12022: use true and false for boolean values
  rtc: ab8500: Drop AB8540 support
  rtc: remove a warning during scripts/kernel-doc step
  rtc: 88pm860x: remove artificial limitation
  rtc: 88pm80x: remove artificial limitation
  rtc: st-lpc: remove artificial limitation
  rtc: mrst: remove artificial limitation
  rtc: mv: remove artificial limitation
  rtc: hctosys: Ensure system time doesn't overflow time_t
  parisc: time: stop validating rtc_time in .read_time
  rtc: pcf85063: fix clearing bits in pcf85063_start_clock
  rtc: at91sam9: Set name of regmap_config
  rtc: s5m: Remove VLA usage
  rtc: s5m: Move enum from rtc.h to rtc-s5m.c
  rtc: remove VLA usage
  rtc: Add useful timestamp definitions
  rtc: Add one offset seconds to expand RTC range
  rtc: Factor out the RTC range validation into rtc_valid_range()
  ...
parents 5e630afd 1485991c
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -43,6 +43,14 @@ Contact: linux-rtc@vger.kernel.org
Description:
Description:
		(RO) The name of the RTC corresponding to this sysfs directory
		(RO) The name of the RTC corresponding to this sysfs directory


What:		/sys/class/rtc/rtcX/range
Date:		January 2018
KernelVersion:	4.16
Contact:	linux-rtc@vger.kernel.org
Description:
		Valid time range for the RTC, as seconds from epoch, formatted
		as [min, max]

What:		/sys/class/rtc/rtcX/since_epoch
What:		/sys/class/rtc/rtcX/since_epoch
Date:		March 2006
Date:		March 2006
KernelVersion:	2.6.17
KernelVersion:	2.6.17
@@ -57,14 +65,6 @@ Contact: linux-rtc@vger.kernel.org
Description:
Description:
		(RO) RTC-provided time in 24-hour notation (hh:mm:ss)
		(RO) RTC-provided time in 24-hour notation (hh:mm:ss)


What:		/sys/class/rtc/rtcX/*/nvmem
Date:		February 2016
KernelVersion:	4.6
Contact:	linux-rtc@vger.kernel.org
Description:
		(RW) The non volatile storage exported as a raw file, as
		described in Documentation/nvmem/nvmem.txt

What:		/sys/class/rtc/rtcX/offset
What:		/sys/class/rtc/rtcX/offset
Date:		February 2016
Date:		February 2016
KernelVersion:	4.6
KernelVersion:	4.6
+28 −0
Original line number Original line Diff line number Diff line
ISL12026 I2C RTC/EEPROM

ISL12026 is an I2C RTC/EEPROM combination device.  The RTC and control
registers respond at bus address 0x6f, and the EEPROM array responds
at bus address 0x57.  The canonical "reg" value will be for the RTC portion.

Required properties supported by the device:

 - "compatible": must be "isil,isl12026"
 - "reg": I2C bus address of the device (always 0x6f)

Optional properties:

 - "isil,pwr-bsw": If present PWR.BSW bit must be set to the specified
                   value for proper operation.

 - "isil,pwr-sbib": If present PWR.SBIB bit must be set to the specified
                    value for proper operation.


Example:

	rtc@6f {
		compatible = "isil,isl12026";
		reg = <0x6f>;
		isil,pwr-bsw = <0>;
		isil,pwr-sbib = <1>;
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -11810,7 +11810,7 @@ X: kernel/torture.c


REAL TIME CLOCK (RTC) SUBSYSTEM
REAL TIME CLOCK (RTC) SUBSYSTEM
M:	Alessandro Zummo <a.zummo@towertech.it>
M:	Alessandro Zummo <a.zummo@towertech.it>
M:	Alexandre Belloni <alexandre.belloni@free-electrons.com>
M:	Alexandre Belloni <alexandre.belloni@bootlin.com>
L:	linux-rtc@vger.kernel.org
L:	linux-rtc@vger.kernel.org
Q:	http://patchwork.ozlabs.org/project/rtc-linux/list/
Q:	http://patchwork.ozlabs.org/project/rtc-linux/list/
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git
+1 −1
Original line number Original line Diff line number Diff line
@@ -174,7 +174,7 @@ static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)


	/* we treat tod_sec as unsigned, so this can work until year 2106 */
	/* we treat tod_sec as unsigned, so this can work until year 2106 */
	rtc_time64_to_tm(tod_data.tod_sec, tm);
	rtc_time64_to_tm(tod_data.tod_sec, tm);
	return rtc_valid_tm(tm);
	return 0;
}
}


static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
+0 −83
Original line number Original line Diff line number Diff line
@@ -809,89 +809,6 @@ static __poll_t rtc_poll(struct file *file, poll_table *wait)
}
}
#endif
#endif


int rtc_register(rtc_task_t *task)
{
#ifndef RTC_IRQ
	return -EIO;
#else
	if (task == NULL || task->func == NULL)
		return -EINVAL;
	spin_lock_irq(&rtc_lock);
	if (rtc_status & RTC_IS_OPEN) {
		spin_unlock_irq(&rtc_lock);
		return -EBUSY;
	}
	spin_lock(&rtc_task_lock);
	if (rtc_callback) {
		spin_unlock(&rtc_task_lock);
		spin_unlock_irq(&rtc_lock);
		return -EBUSY;
	}
	rtc_status |= RTC_IS_OPEN;
	rtc_callback = task;
	spin_unlock(&rtc_task_lock);
	spin_unlock_irq(&rtc_lock);
	return 0;
#endif
}
EXPORT_SYMBOL(rtc_register);

int rtc_unregister(rtc_task_t *task)
{
#ifndef RTC_IRQ
	return -EIO;
#else
	unsigned char tmp;

	spin_lock_irq(&rtc_lock);
	spin_lock(&rtc_task_lock);
	if (rtc_callback != task) {
		spin_unlock(&rtc_task_lock);
		spin_unlock_irq(&rtc_lock);
		return -ENXIO;
	}
	rtc_callback = NULL;

	/* disable controls */
	if (!hpet_mask_rtc_irq_bit(RTC_PIE | RTC_AIE | RTC_UIE)) {
		tmp = CMOS_READ(RTC_CONTROL);
		tmp &= ~RTC_PIE;
		tmp &= ~RTC_AIE;
		tmp &= ~RTC_UIE;
		CMOS_WRITE(tmp, RTC_CONTROL);
		CMOS_READ(RTC_INTR_FLAGS);
	}
	if (rtc_status & RTC_TIMER_ON) {
		rtc_status &= ~RTC_TIMER_ON;
		del_timer(&rtc_irq_timer);
	}
	rtc_status &= ~RTC_IS_OPEN;
	spin_unlock(&rtc_task_lock);
	spin_unlock_irq(&rtc_lock);
	return 0;
#endif
}
EXPORT_SYMBOL(rtc_unregister);

int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg)
{
#ifndef RTC_IRQ
	return -EIO;
#else
	unsigned long flags;
	if (cmd != RTC_PIE_ON && cmd != RTC_PIE_OFF && cmd != RTC_IRQP_SET)
		return -EINVAL;
	spin_lock_irqsave(&rtc_task_lock, flags);
	if (rtc_callback != task) {
		spin_unlock_irqrestore(&rtc_task_lock, flags);
		return -ENXIO;
	}
	spin_unlock_irqrestore(&rtc_task_lock, flags);
	return rtc_do_ioctl(cmd, arg, 1);
#endif
}
EXPORT_SYMBOL(rtc_control);

/*
/*
 *	The various file operations we support.
 *	The various file operations we support.
 */
 */
Loading