.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * An rtc driver for the Dallas/Maxim DS1685/DS1687 and related real-time |
---|
3 | 4 | * chips. |
---|
.. | .. |
---|
10 | 11 | * DS17x85/DS17x87 3V/5V Real-Time Clocks, 19-5222, Rev 4/10. |
---|
11 | 12 | * DS1689/DS1693 3V/5V Serialized Real-Time Clocks, Rev 112105. |
---|
12 | 13 | * Application Note 90, Using the Multiplex Bus RTC Extended Features. |
---|
13 | | - * |
---|
14 | | - * This program is free software; you can redistribute it and/or modify |
---|
15 | | - * it under the terms of the GNU General Public License version 2 as |
---|
16 | | - * published by the Free Software Foundation. |
---|
17 | 14 | */ |
---|
18 | 15 | |
---|
19 | 16 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
34 | 31 | |
---|
35 | 32 | |
---|
36 | 33 | /* ----------------------------------------------------------------------- */ |
---|
37 | | -/* Standard read/write functions if platform does not provide overrides */ |
---|
| 34 | +/* |
---|
| 35 | + * Standard read/write |
---|
| 36 | + * all registers are mapped in CPU address space |
---|
| 37 | + */ |
---|
38 | 38 | |
---|
39 | 39 | /** |
---|
40 | 40 | * ds1685_read - read a value from an rtc register. |
---|
.. | .. |
---|
62 | 62 | } |
---|
63 | 63 | /* ----------------------------------------------------------------------- */ |
---|
64 | 64 | |
---|
| 65 | +/* |
---|
| 66 | + * Indirect read/write functions |
---|
| 67 | + * access happens via address and data register mapped in CPU address space |
---|
| 68 | + */ |
---|
| 69 | + |
---|
| 70 | +/** |
---|
| 71 | + * ds1685_indirect_read - read a value from an rtc register. |
---|
| 72 | + * @rtc: pointer to the ds1685 rtc structure. |
---|
| 73 | + * @reg: the register address to read. |
---|
| 74 | + */ |
---|
| 75 | +static u8 |
---|
| 76 | +ds1685_indirect_read(struct ds1685_priv *rtc, int reg) |
---|
| 77 | +{ |
---|
| 78 | + writeb(reg, rtc->regs); |
---|
| 79 | + return readb(rtc->data); |
---|
| 80 | +} |
---|
| 81 | + |
---|
| 82 | +/** |
---|
| 83 | + * ds1685_indirect_write - write a value to an rtc register. |
---|
| 84 | + * @rtc: pointer to the ds1685 rtc structure. |
---|
| 85 | + * @reg: the register address to write. |
---|
| 86 | + * @value: value to write to the register. |
---|
| 87 | + */ |
---|
| 88 | +static void |
---|
| 89 | +ds1685_indirect_write(struct ds1685_priv *rtc, int reg, u8 value) |
---|
| 90 | +{ |
---|
| 91 | + writeb(reg, rtc->regs); |
---|
| 92 | + writeb(value, rtc->data); |
---|
| 93 | +} |
---|
65 | 94 | |
---|
66 | 95 | /* ----------------------------------------------------------------------- */ |
---|
67 | 96 | /* Inlined functions */ |
---|
.. | .. |
---|
164 | 193 | rtc->write(rtc, RTC_CTRL_B, |
---|
165 | 194 | (rtc->read(rtc, RTC_CTRL_B) | RTC_CTRL_B_SET)); |
---|
166 | 195 | |
---|
| 196 | + /* Switch to Bank 1 */ |
---|
| 197 | + ds1685_rtc_switch_to_bank1(rtc); |
---|
| 198 | + |
---|
167 | 199 | /* Read Ext Ctrl 4A and check the INCR bit to avoid a lockout. */ |
---|
168 | 200 | while (rtc->read(rtc, RTC_EXT_CTRL_4A) & RTC_CTRL_4A_INCR) |
---|
169 | 201 | cpu_relax(); |
---|
170 | | - |
---|
171 | | - /* Switch to Bank 1 */ |
---|
172 | | - ds1685_rtc_switch_to_bank1(rtc); |
---|
173 | 202 | } |
---|
174 | 203 | |
---|
175 | 204 | /** |
---|
.. | .. |
---|
184 | 213 | ds1685_rtc_end_data_access(struct ds1685_priv *rtc) |
---|
185 | 214 | { |
---|
186 | 215 | /* Switch back to Bank 0 */ |
---|
187 | | - ds1685_rtc_switch_to_bank1(rtc); |
---|
| 216 | + ds1685_rtc_switch_to_bank0(rtc); |
---|
188 | 217 | |
---|
189 | 218 | /* Clear the SET bit in Ctrl B */ |
---|
190 | 219 | rtc->write(rtc, RTC_CTRL_B, |
---|
191 | 220 | (rtc->read(rtc, RTC_CTRL_B) & ~(RTC_CTRL_B_SET))); |
---|
192 | | -} |
---|
193 | | - |
---|
194 | | -/** |
---|
195 | | - * ds1685_rtc_begin_ctrl_access - prepare the rtc for ctrl access. |
---|
196 | | - * @rtc: pointer to the ds1685 rtc structure. |
---|
197 | | - * @flags: irq flags variable for spin_lock_irqsave. |
---|
198 | | - * |
---|
199 | | - * This takes several steps to prepare the rtc for access to read just the |
---|
200 | | - * control registers: |
---|
201 | | - * - Sets a spinlock on the rtc IRQ. |
---|
202 | | - * - Switches the rtc to bank 1. This allows access to the two extended |
---|
203 | | - * control registers. |
---|
204 | | - * |
---|
205 | | - * Only use this where you are certain another lock will not be held. |
---|
206 | | - */ |
---|
207 | | -static inline void |
---|
208 | | -ds1685_rtc_begin_ctrl_access(struct ds1685_priv *rtc, unsigned long *flags) |
---|
209 | | -{ |
---|
210 | | - spin_lock_irqsave(&rtc->lock, *flags); |
---|
211 | | - ds1685_rtc_switch_to_bank1(rtc); |
---|
212 | | -} |
---|
213 | | - |
---|
214 | | -/** |
---|
215 | | - * ds1685_rtc_end_ctrl_access - end ctrl access on the rtc. |
---|
216 | | - * @rtc: pointer to the ds1685 rtc structure. |
---|
217 | | - * @flags: irq flags variable for spin_unlock_irqrestore. |
---|
218 | | - * |
---|
219 | | - * This ends what was started by ds1685_rtc_begin_ctrl_access: |
---|
220 | | - * - Switches the rtc back to bank 0. |
---|
221 | | - * - Unsets the spinlock on the rtc IRQ. |
---|
222 | | - */ |
---|
223 | | -static inline void |
---|
224 | | -ds1685_rtc_end_ctrl_access(struct ds1685_priv *rtc, unsigned long flags) |
---|
225 | | -{ |
---|
226 | | - ds1685_rtc_switch_to_bank0(rtc); |
---|
227 | | - spin_unlock_irqrestore(&rtc->lock, flags); |
---|
228 | 221 | } |
---|
229 | 222 | |
---|
230 | 223 | /** |
---|
.. | .. |
---|
268 | 261 | ds1685_rtc_read_time(struct device *dev, struct rtc_time *tm) |
---|
269 | 262 | { |
---|
270 | 263 | struct ds1685_priv *rtc = dev_get_drvdata(dev); |
---|
271 | | - u8 ctrlb, century; |
---|
| 264 | + u8 century; |
---|
272 | 265 | u8 seconds, minutes, hours, wday, mday, month, years; |
---|
273 | 266 | |
---|
274 | 267 | /* Fetch the time info from the RTC registers. */ |
---|
.. | .. |
---|
281 | 274 | month = rtc->read(rtc, RTC_MONTH); |
---|
282 | 275 | years = rtc->read(rtc, RTC_YEAR); |
---|
283 | 276 | century = rtc->read(rtc, RTC_CENTURY); |
---|
284 | | - ctrlb = rtc->read(rtc, RTC_CTRL_B); |
---|
285 | 277 | ds1685_rtc_end_data_access(rtc); |
---|
286 | 278 | |
---|
287 | 279 | /* bcd2bin if needed, perform fixups, and store to rtc_time. */ |
---|
.. | .. |
---|
546 | 538 | ds1685_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
---|
547 | 539 | { |
---|
548 | 540 | struct ds1685_priv *rtc = dev_get_drvdata(dev); |
---|
549 | | - unsigned long flags = 0; |
---|
550 | | - |
---|
551 | | - /* Enable/disable the Alarm IRQ-Enable flag. */ |
---|
552 | | - spin_lock_irqsave(&rtc->lock, flags); |
---|
553 | 541 | |
---|
554 | 542 | /* Flip the requisite interrupt-enable bit. */ |
---|
555 | 543 | if (enabled) |
---|
.. | .. |
---|
561 | 549 | |
---|
562 | 550 | /* Read Control C to clear all the flag bits. */ |
---|
563 | 551 | rtc->read(rtc, RTC_CTRL_C); |
---|
564 | | - spin_unlock_irqrestore(&rtc->lock, flags); |
---|
565 | 552 | |
---|
566 | 553 | return 0; |
---|
567 | 554 | } |
---|
.. | .. |
---|
569 | 556 | |
---|
570 | 557 | |
---|
571 | 558 | /* ----------------------------------------------------------------------- */ |
---|
572 | | -/* IRQ handler & workqueue. */ |
---|
| 559 | +/* IRQ handler */ |
---|
573 | 560 | |
---|
574 | 561 | /** |
---|
575 | | - * ds1685_rtc_irq_handler - IRQ handler. |
---|
576 | | - * @irq: IRQ number. |
---|
577 | | - * @dev_id: platform device pointer. |
---|
578 | | - */ |
---|
579 | | -static irqreturn_t |
---|
580 | | -ds1685_rtc_irq_handler(int irq, void *dev_id) |
---|
581 | | -{ |
---|
582 | | - struct platform_device *pdev = dev_id; |
---|
583 | | - struct ds1685_priv *rtc = platform_get_drvdata(pdev); |
---|
584 | | - u8 ctrlb, ctrlc; |
---|
585 | | - unsigned long events = 0; |
---|
586 | | - u8 num_irqs = 0; |
---|
587 | | - |
---|
588 | | - /* Abort early if the device isn't ready yet (i.e., DEBUG_SHIRQ). */ |
---|
589 | | - if (unlikely(!rtc)) |
---|
590 | | - return IRQ_HANDLED; |
---|
591 | | - |
---|
592 | | - /* Ctrlb holds the interrupt-enable bits and ctrlc the flag bits. */ |
---|
593 | | - spin_lock(&rtc->lock); |
---|
594 | | - ctrlb = rtc->read(rtc, RTC_CTRL_B); |
---|
595 | | - ctrlc = rtc->read(rtc, RTC_CTRL_C); |
---|
596 | | - |
---|
597 | | - /* Is the IRQF bit set? */ |
---|
598 | | - if (likely(ctrlc & RTC_CTRL_C_IRQF)) { |
---|
599 | | - /* |
---|
600 | | - * We need to determine if it was one of the standard |
---|
601 | | - * events: PF, AF, or UF. If so, we handle them and |
---|
602 | | - * update the RTC core. |
---|
603 | | - */ |
---|
604 | | - if (likely(ctrlc & RTC_CTRL_B_PAU_MASK)) { |
---|
605 | | - events = RTC_IRQF; |
---|
606 | | - |
---|
607 | | - /* Check for a periodic interrupt. */ |
---|
608 | | - if ((ctrlb & RTC_CTRL_B_PIE) && |
---|
609 | | - (ctrlc & RTC_CTRL_C_PF)) { |
---|
610 | | - events |= RTC_PF; |
---|
611 | | - num_irqs++; |
---|
612 | | - } |
---|
613 | | - |
---|
614 | | - /* Check for an alarm interrupt. */ |
---|
615 | | - if ((ctrlb & RTC_CTRL_B_AIE) && |
---|
616 | | - (ctrlc & RTC_CTRL_C_AF)) { |
---|
617 | | - events |= RTC_AF; |
---|
618 | | - num_irqs++; |
---|
619 | | - } |
---|
620 | | - |
---|
621 | | - /* Check for an update interrupt. */ |
---|
622 | | - if ((ctrlb & RTC_CTRL_B_UIE) && |
---|
623 | | - (ctrlc & RTC_CTRL_C_UF)) { |
---|
624 | | - events |= RTC_UF; |
---|
625 | | - num_irqs++; |
---|
626 | | - } |
---|
627 | | - |
---|
628 | | - rtc_update_irq(rtc->dev, num_irqs, events); |
---|
629 | | - } else { |
---|
630 | | - /* |
---|
631 | | - * One of the "extended" interrupts was received that |
---|
632 | | - * is not recognized by the RTC core. These need to |
---|
633 | | - * be handled in task context as they can call other |
---|
634 | | - * functions and the time spent in irq context needs |
---|
635 | | - * to be minimized. Schedule them into a workqueue |
---|
636 | | - * and inform the RTC core that the IRQs were handled. |
---|
637 | | - */ |
---|
638 | | - spin_unlock(&rtc->lock); |
---|
639 | | - schedule_work(&rtc->work); |
---|
640 | | - rtc_update_irq(rtc->dev, 0, 0); |
---|
641 | | - return IRQ_HANDLED; |
---|
642 | | - } |
---|
643 | | - } |
---|
644 | | - spin_unlock(&rtc->lock); |
---|
645 | | - |
---|
646 | | - return events ? IRQ_HANDLED : IRQ_NONE; |
---|
647 | | -} |
---|
648 | | - |
---|
649 | | -/** |
---|
650 | | - * ds1685_rtc_work_queue - work queue handler. |
---|
651 | | - * @work: work_struct containing data to work on in task context. |
---|
| 562 | + * ds1685_rtc_extended_irq - take care of extended interrupts |
---|
| 563 | + * @rtc: pointer to the ds1685 rtc structure. |
---|
| 564 | + * @pdev: platform device pointer. |
---|
652 | 565 | */ |
---|
653 | 566 | static void |
---|
654 | | -ds1685_rtc_work_queue(struct work_struct *work) |
---|
| 567 | +ds1685_rtc_extended_irq(struct ds1685_priv *rtc, struct platform_device *pdev) |
---|
655 | 568 | { |
---|
656 | | - struct ds1685_priv *rtc = container_of(work, |
---|
657 | | - struct ds1685_priv, work); |
---|
658 | | - struct platform_device *pdev = to_platform_device(&rtc->dev->dev); |
---|
659 | | - struct mutex *rtc_mutex = &rtc->dev->ops_lock; |
---|
660 | 569 | u8 ctrl4a, ctrl4b; |
---|
661 | | - |
---|
662 | | - mutex_lock(rtc_mutex); |
---|
663 | 570 | |
---|
664 | 571 | ds1685_rtc_switch_to_bank1(rtc); |
---|
665 | 572 | ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A); |
---|
.. | .. |
---|
739 | 646 | "RAM-Clear IRQ just occurred!\n"); |
---|
740 | 647 | } |
---|
741 | 648 | ds1685_rtc_switch_to_bank0(rtc); |
---|
| 649 | +} |
---|
742 | 650 | |
---|
| 651 | +/** |
---|
| 652 | + * ds1685_rtc_irq_handler - IRQ handler. |
---|
| 653 | + * @irq: IRQ number. |
---|
| 654 | + * @dev_id: platform device pointer. |
---|
| 655 | + */ |
---|
| 656 | +static irqreturn_t |
---|
| 657 | +ds1685_rtc_irq_handler(int irq, void *dev_id) |
---|
| 658 | +{ |
---|
| 659 | + struct platform_device *pdev = dev_id; |
---|
| 660 | + struct ds1685_priv *rtc = platform_get_drvdata(pdev); |
---|
| 661 | + struct mutex *rtc_mutex; |
---|
| 662 | + u8 ctrlb, ctrlc; |
---|
| 663 | + unsigned long events = 0; |
---|
| 664 | + u8 num_irqs = 0; |
---|
| 665 | + |
---|
| 666 | + /* Abort early if the device isn't ready yet (i.e., DEBUG_SHIRQ). */ |
---|
| 667 | + if (unlikely(!rtc)) |
---|
| 668 | + return IRQ_HANDLED; |
---|
| 669 | + |
---|
| 670 | + rtc_mutex = &rtc->dev->ops_lock; |
---|
| 671 | + mutex_lock(rtc_mutex); |
---|
| 672 | + |
---|
| 673 | + /* Ctrlb holds the interrupt-enable bits and ctrlc the flag bits. */ |
---|
| 674 | + ctrlb = rtc->read(rtc, RTC_CTRL_B); |
---|
| 675 | + ctrlc = rtc->read(rtc, RTC_CTRL_C); |
---|
| 676 | + |
---|
| 677 | + /* Is the IRQF bit set? */ |
---|
| 678 | + if (likely(ctrlc & RTC_CTRL_C_IRQF)) { |
---|
| 679 | + /* |
---|
| 680 | + * We need to determine if it was one of the standard |
---|
| 681 | + * events: PF, AF, or UF. If so, we handle them and |
---|
| 682 | + * update the RTC core. |
---|
| 683 | + */ |
---|
| 684 | + if (likely(ctrlc & RTC_CTRL_B_PAU_MASK)) { |
---|
| 685 | + events = RTC_IRQF; |
---|
| 686 | + |
---|
| 687 | + /* Check for a periodic interrupt. */ |
---|
| 688 | + if ((ctrlb & RTC_CTRL_B_PIE) && |
---|
| 689 | + (ctrlc & RTC_CTRL_C_PF)) { |
---|
| 690 | + events |= RTC_PF; |
---|
| 691 | + num_irqs++; |
---|
| 692 | + } |
---|
| 693 | + |
---|
| 694 | + /* Check for an alarm interrupt. */ |
---|
| 695 | + if ((ctrlb & RTC_CTRL_B_AIE) && |
---|
| 696 | + (ctrlc & RTC_CTRL_C_AF)) { |
---|
| 697 | + events |= RTC_AF; |
---|
| 698 | + num_irqs++; |
---|
| 699 | + } |
---|
| 700 | + |
---|
| 701 | + /* Check for an update interrupt. */ |
---|
| 702 | + if ((ctrlb & RTC_CTRL_B_UIE) && |
---|
| 703 | + (ctrlc & RTC_CTRL_C_UF)) { |
---|
| 704 | + events |= RTC_UF; |
---|
| 705 | + num_irqs++; |
---|
| 706 | + } |
---|
| 707 | + } else { |
---|
| 708 | + /* |
---|
| 709 | + * One of the "extended" interrupts was received that |
---|
| 710 | + * is not recognized by the RTC core. |
---|
| 711 | + */ |
---|
| 712 | + ds1685_rtc_extended_irq(rtc, pdev); |
---|
| 713 | + } |
---|
| 714 | + } |
---|
| 715 | + rtc_update_irq(rtc->dev, num_irqs, events); |
---|
743 | 716 | mutex_unlock(rtc_mutex); |
---|
| 717 | + |
---|
| 718 | + return events ? IRQ_HANDLED : IRQ_NONE; |
---|
744 | 719 | } |
---|
745 | 720 | /* ----------------------------------------------------------------------- */ |
---|
746 | 721 | |
---|
.. | .. |
---|
770 | 745 | "512Hz", "256Hz", "128Hz", "64Hz", "32Hz", "16Hz", "8Hz", "4Hz", "2Hz" |
---|
771 | 746 | }; |
---|
772 | 747 | |
---|
773 | | -#ifdef CONFIG_RTC_DS1685_PROC_REGS |
---|
774 | | -/** |
---|
775 | | - * ds1685_rtc_print_regs - helper function to print register values. |
---|
776 | | - * @hex: hex byte to convert into binary bits. |
---|
777 | | - * @dest: destination char array. |
---|
778 | | - * |
---|
779 | | - * This is basically a hex->binary function, just with extra spacing between |
---|
780 | | - * the digits. It only works on 1-byte values (8 bits). |
---|
781 | | - */ |
---|
782 | | -static char* |
---|
783 | | -ds1685_rtc_print_regs(u8 hex, char *dest) |
---|
784 | | -{ |
---|
785 | | - u32 i, j; |
---|
786 | | - char *tmp = dest; |
---|
787 | | - |
---|
788 | | - for (i = 0; i < NUM_BITS; i++) { |
---|
789 | | - *tmp++ = ((hex & 0x80) != 0 ? '1' : '0'); |
---|
790 | | - for (j = 0; j < NUM_SPACES; j++) |
---|
791 | | - *tmp++ = ' '; |
---|
792 | | - hex <<= 1; |
---|
793 | | - } |
---|
794 | | - *tmp++ = '\0'; |
---|
795 | | - |
---|
796 | | - return dest; |
---|
797 | | -} |
---|
798 | | -#endif |
---|
799 | | - |
---|
800 | 748 | /** |
---|
801 | 749 | * ds1685_rtc_proc - procfs access function. |
---|
802 | 750 | * @dev: pointer to device structure. |
---|
.. | .. |
---|
805 | 753 | static int |
---|
806 | 754 | ds1685_rtc_proc(struct device *dev, struct seq_file *seq) |
---|
807 | 755 | { |
---|
808 | | - struct platform_device *pdev = to_platform_device(dev); |
---|
809 | | - struct ds1685_priv *rtc = platform_get_drvdata(pdev); |
---|
810 | | - u8 ctrla, ctrlb, ctrlc, ctrld, ctrl4a, ctrl4b, ssn[8]; |
---|
| 756 | + struct ds1685_priv *rtc = dev_get_drvdata(dev); |
---|
| 757 | + u8 ctrla, ctrlb, ctrld, ctrl4a, ctrl4b, ssn[8]; |
---|
811 | 758 | char *model; |
---|
812 | | -#ifdef CONFIG_RTC_DS1685_PROC_REGS |
---|
813 | | - char bits[NUM_REGS][(NUM_BITS * NUM_SPACES) + NUM_BITS + 1]; |
---|
814 | | -#endif |
---|
815 | 759 | |
---|
816 | 760 | /* Read all the relevant data from the control registers. */ |
---|
817 | 761 | ds1685_rtc_switch_to_bank1(rtc); |
---|
818 | 762 | ds1685_rtc_get_ssn(rtc, ssn); |
---|
819 | 763 | ctrla = rtc->read(rtc, RTC_CTRL_A); |
---|
820 | 764 | ctrlb = rtc->read(rtc, RTC_CTRL_B); |
---|
821 | | - ctrlc = rtc->read(rtc, RTC_CTRL_C); |
---|
822 | 765 | ctrld = rtc->read(rtc, RTC_CTRL_D); |
---|
823 | 766 | ctrl4a = rtc->read(rtc, RTC_EXT_CTRL_4A); |
---|
824 | 767 | ctrl4b = rtc->read(rtc, RTC_EXT_CTRL_4B); |
---|
.. | .. |
---|
859 | 802 | "Periodic IRQ\t: %s\n" |
---|
860 | 803 | "Periodic Rate\t: %s\n" |
---|
861 | 804 | "SQW Freq\t: %s\n" |
---|
862 | | -#ifdef CONFIG_RTC_DS1685_PROC_REGS |
---|
863 | | - "Serial #\t: %8phC\n" |
---|
864 | | - "Register Status\t:\n" |
---|
865 | | - " Ctrl A\t: UIP DV2 DV1 DV0 RS3 RS2 RS1 RS0\n" |
---|
866 | | - "\t\t: %s\n" |
---|
867 | | - " Ctrl B\t: SET PIE AIE UIE SQWE DM 2412 DSE\n" |
---|
868 | | - "\t\t: %s\n" |
---|
869 | | - " Ctrl C\t: IRQF PF AF UF --- --- --- ---\n" |
---|
870 | | - "\t\t: %s\n" |
---|
871 | | - " Ctrl D\t: VRT --- --- --- --- --- --- ---\n" |
---|
872 | | - "\t\t: %s\n" |
---|
873 | | -#if !defined(CONFIG_RTC_DRV_DS1685) && !defined(CONFIG_RTC_DRV_DS1689) |
---|
874 | | - " Ctrl 4A\t: VRT2 INCR BME --- PAB RF WF KF\n" |
---|
875 | | -#else |
---|
876 | | - " Ctrl 4A\t: VRT2 INCR --- --- PAB RF WF KF\n" |
---|
877 | | -#endif |
---|
878 | | - "\t\t: %s\n" |
---|
879 | | - " Ctrl 4B\t: ABE E32k CS RCE PRS RIE WIE KSE\n" |
---|
880 | | - "\t\t: %s\n", |
---|
881 | | -#else |
---|
882 | 805 | "Serial #\t: %8phC\n", |
---|
883 | | -#endif |
---|
884 | 806 | model, |
---|
885 | 807 | ((ctrla & RTC_CTRL_A_DV1) ? "enabled" : "disabled"), |
---|
886 | 808 | ((ctrlb & RTC_CTRL_B_2412) ? "24-hour" : "12-hour"), |
---|
.. | .. |
---|
894 | 816 | ds1685_rtc_pirq_rate[(ctrla & RTC_CTRL_A_RS_MASK)] : "none"), |
---|
895 | 817 | (!((ctrl4b & RTC_CTRL_4B_E32K)) ? |
---|
896 | 818 | ds1685_rtc_sqw_freq[(ctrla & RTC_CTRL_A_RS_MASK)] : "32768Hz"), |
---|
897 | | -#ifdef CONFIG_RTC_DS1685_PROC_REGS |
---|
898 | | - ssn, |
---|
899 | | - ds1685_rtc_print_regs(ctrla, bits[0]), |
---|
900 | | - ds1685_rtc_print_regs(ctrlb, bits[1]), |
---|
901 | | - ds1685_rtc_print_regs(ctrlc, bits[2]), |
---|
902 | | - ds1685_rtc_print_regs(ctrld, bits[3]), |
---|
903 | | - ds1685_rtc_print_regs(ctrl4a, bits[4]), |
---|
904 | | - ds1685_rtc_print_regs(ctrl4b, bits[5])); |
---|
905 | | -#else |
---|
906 | 819 | ssn); |
---|
907 | | -#endif |
---|
908 | 820 | return 0; |
---|
909 | 821 | } |
---|
910 | 822 | #else |
---|
.. | .. |
---|
927 | 839 | }; |
---|
928 | 840 | /* ----------------------------------------------------------------------- */ |
---|
929 | 841 | |
---|
930 | | - |
---|
931 | | -/* ----------------------------------------------------------------------- */ |
---|
932 | | -/* SysFS interface */ |
---|
933 | | - |
---|
934 | | -#ifdef CONFIG_SYSFS |
---|
935 | | -/** |
---|
936 | | - * ds1685_rtc_sysfs_nvram_read - reads rtc nvram via sysfs. |
---|
937 | | - * @file: pointer to file structure. |
---|
938 | | - * @kobj: pointer to kobject structure. |
---|
939 | | - * @bin_attr: pointer to bin_attribute structure. |
---|
940 | | - * @buf: pointer to char array to hold the output. |
---|
941 | | - * @pos: current file position pointer. |
---|
942 | | - * @size: size of the data to read. |
---|
943 | | - */ |
---|
944 | | -static ssize_t |
---|
945 | | -ds1685_rtc_sysfs_nvram_read(struct file *filp, struct kobject *kobj, |
---|
946 | | - struct bin_attribute *bin_attr, char *buf, |
---|
947 | | - loff_t pos, size_t size) |
---|
| 842 | +static int ds1685_nvram_read(void *priv, unsigned int pos, void *val, |
---|
| 843 | + size_t size) |
---|
948 | 844 | { |
---|
949 | | - struct platform_device *pdev = |
---|
950 | | - to_platform_device(container_of(kobj, struct device, kobj)); |
---|
951 | | - struct ds1685_priv *rtc = platform_get_drvdata(pdev); |
---|
| 845 | + struct ds1685_priv *rtc = priv; |
---|
| 846 | + struct mutex *rtc_mutex = &rtc->dev->ops_lock; |
---|
952 | 847 | ssize_t count; |
---|
953 | | - unsigned long flags = 0; |
---|
| 848 | + u8 *buf = val; |
---|
| 849 | + int err; |
---|
954 | 850 | |
---|
955 | | - spin_lock_irqsave(&rtc->lock, flags); |
---|
| 851 | + err = mutex_lock_interruptible(rtc_mutex); |
---|
| 852 | + if (err) |
---|
| 853 | + return err; |
---|
| 854 | + |
---|
956 | 855 | ds1685_rtc_switch_to_bank0(rtc); |
---|
957 | 856 | |
---|
958 | 857 | /* Read NVRAM in time and bank0 registers. */ |
---|
.. | .. |
---|
1002 | 901 | ds1685_rtc_switch_to_bank0(rtc); |
---|
1003 | 902 | } |
---|
1004 | 903 | #endif /* !CONFIG_RTC_DRV_DS1689 */ |
---|
1005 | | - spin_unlock_irqrestore(&rtc->lock, flags); |
---|
| 904 | + mutex_unlock(rtc_mutex); |
---|
1006 | 905 | |
---|
1007 | | - /* |
---|
1008 | | - * XXX: Bug? this appears to cause the function to get executed |
---|
1009 | | - * several times in succession. But it's the only way to actually get |
---|
1010 | | - * data written out to a file. |
---|
1011 | | - */ |
---|
1012 | | - return count; |
---|
| 906 | + return 0; |
---|
1013 | 907 | } |
---|
1014 | 908 | |
---|
1015 | | -/** |
---|
1016 | | - * ds1685_rtc_sysfs_nvram_write - writes rtc nvram via sysfs. |
---|
1017 | | - * @file: pointer to file structure. |
---|
1018 | | - * @kobj: pointer to kobject structure. |
---|
1019 | | - * @bin_attr: pointer to bin_attribute structure. |
---|
1020 | | - * @buf: pointer to char array to hold the input. |
---|
1021 | | - * @pos: current file position pointer. |
---|
1022 | | - * @size: size of the data to write. |
---|
1023 | | - */ |
---|
1024 | | -static ssize_t |
---|
1025 | | -ds1685_rtc_sysfs_nvram_write(struct file *filp, struct kobject *kobj, |
---|
1026 | | - struct bin_attribute *bin_attr, char *buf, |
---|
1027 | | - loff_t pos, size_t size) |
---|
| 909 | +static int ds1685_nvram_write(void *priv, unsigned int pos, void *val, |
---|
| 910 | + size_t size) |
---|
1028 | 911 | { |
---|
1029 | | - struct platform_device *pdev = |
---|
1030 | | - to_platform_device(container_of(kobj, struct device, kobj)); |
---|
1031 | | - struct ds1685_priv *rtc = platform_get_drvdata(pdev); |
---|
| 912 | + struct ds1685_priv *rtc = priv; |
---|
| 913 | + struct mutex *rtc_mutex = &rtc->dev->ops_lock; |
---|
1032 | 914 | ssize_t count; |
---|
1033 | | - unsigned long flags = 0; |
---|
| 915 | + u8 *buf = val; |
---|
| 916 | + int err; |
---|
1034 | 917 | |
---|
1035 | | - spin_lock_irqsave(&rtc->lock, flags); |
---|
| 918 | + err = mutex_lock_interruptible(rtc_mutex); |
---|
| 919 | + if (err) |
---|
| 920 | + return err; |
---|
| 921 | + |
---|
1036 | 922 | ds1685_rtc_switch_to_bank0(rtc); |
---|
1037 | 923 | |
---|
1038 | 924 | /* Write NVRAM in time and bank0 registers. */ |
---|
.. | .. |
---|
1082 | 968 | ds1685_rtc_switch_to_bank0(rtc); |
---|
1083 | 969 | } |
---|
1084 | 970 | #endif /* !CONFIG_RTC_DRV_DS1689 */ |
---|
1085 | | - spin_unlock_irqrestore(&rtc->lock, flags); |
---|
| 971 | + mutex_unlock(rtc_mutex); |
---|
1086 | 972 | |
---|
1087 | | - return count; |
---|
| 973 | + return 0; |
---|
1088 | 974 | } |
---|
1089 | 975 | |
---|
1090 | | -/** |
---|
1091 | | - * struct ds1685_rtc_sysfs_nvram_attr - sysfs attributes for rtc nvram. |
---|
1092 | | - * @attr: nvram attributes. |
---|
1093 | | - * @read: nvram read function. |
---|
1094 | | - * @write: nvram write function. |
---|
1095 | | - * @size: nvram total size (bank0 + extended). |
---|
1096 | | - */ |
---|
1097 | | -static struct bin_attribute |
---|
1098 | | -ds1685_rtc_sysfs_nvram_attr = { |
---|
1099 | | - .attr = { |
---|
1100 | | - .name = "nvram", |
---|
1101 | | - .mode = S_IRUGO | S_IWUSR, |
---|
1102 | | - }, |
---|
1103 | | - .read = ds1685_rtc_sysfs_nvram_read, |
---|
1104 | | - .write = ds1685_rtc_sysfs_nvram_write, |
---|
1105 | | - .size = NVRAM_TOTAL_SZ |
---|
1106 | | -}; |
---|
| 976 | +/* ----------------------------------------------------------------------- */ |
---|
| 977 | +/* SysFS interface */ |
---|
1107 | 978 | |
---|
1108 | 979 | /** |
---|
1109 | 980 | * ds1685_rtc_sysfs_battery_show - sysfs file for main battery status. |
---|
.. | .. |
---|
1115 | 986 | ds1685_rtc_sysfs_battery_show(struct device *dev, |
---|
1116 | 987 | struct device_attribute *attr, char *buf) |
---|
1117 | 988 | { |
---|
1118 | | - struct ds1685_priv *rtc = dev_get_drvdata(dev); |
---|
| 989 | + struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); |
---|
1119 | 990 | u8 ctrld; |
---|
1120 | 991 | |
---|
1121 | 992 | ctrld = rtc->read(rtc, RTC_CTRL_D); |
---|
.. | .. |
---|
1135 | 1006 | ds1685_rtc_sysfs_auxbatt_show(struct device *dev, |
---|
1136 | 1007 | struct device_attribute *attr, char *buf) |
---|
1137 | 1008 | { |
---|
1138 | | - struct ds1685_priv *rtc = dev_get_drvdata(dev); |
---|
| 1009 | + struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); |
---|
1139 | 1010 | u8 ctrl4a; |
---|
1140 | 1011 | |
---|
1141 | 1012 | ds1685_rtc_switch_to_bank1(rtc); |
---|
.. | .. |
---|
1157 | 1028 | ds1685_rtc_sysfs_serial_show(struct device *dev, |
---|
1158 | 1029 | struct device_attribute *attr, char *buf) |
---|
1159 | 1030 | { |
---|
1160 | | - struct ds1685_priv *rtc = dev_get_drvdata(dev); |
---|
| 1031 | + struct ds1685_priv *rtc = dev_get_drvdata(dev->parent); |
---|
1161 | 1032 | u8 ssn[8]; |
---|
1162 | 1033 | |
---|
1163 | 1034 | ds1685_rtc_switch_to_bank1(rtc); |
---|
.. | .. |
---|
1168 | 1039 | } |
---|
1169 | 1040 | static DEVICE_ATTR(serial, S_IRUGO, ds1685_rtc_sysfs_serial_show, NULL); |
---|
1170 | 1041 | |
---|
1171 | | -/** |
---|
| 1042 | +/* |
---|
1172 | 1043 | * struct ds1685_rtc_sysfs_misc_attrs - list for misc RTC features. |
---|
1173 | 1044 | */ |
---|
1174 | 1045 | static struct attribute* |
---|
.. | .. |
---|
1179 | 1050 | NULL, |
---|
1180 | 1051 | }; |
---|
1181 | 1052 | |
---|
1182 | | -/** |
---|
| 1053 | +/* |
---|
1183 | 1054 | * struct ds1685_rtc_sysfs_misc_grp - attr group for misc RTC features. |
---|
1184 | 1055 | */ |
---|
1185 | 1056 | static const struct attribute_group |
---|
.. | .. |
---|
1187 | 1058 | .name = "misc", |
---|
1188 | 1059 | .attrs = ds1685_rtc_sysfs_misc_attrs, |
---|
1189 | 1060 | }; |
---|
1190 | | - |
---|
1191 | | -/** |
---|
1192 | | - * ds1685_rtc_sysfs_register - register sysfs files. |
---|
1193 | | - * @dev: pointer to device structure. |
---|
1194 | | - */ |
---|
1195 | | -static int |
---|
1196 | | -ds1685_rtc_sysfs_register(struct device *dev) |
---|
1197 | | -{ |
---|
1198 | | - int ret = 0; |
---|
1199 | | - |
---|
1200 | | - sysfs_bin_attr_init(&ds1685_rtc_sysfs_nvram_attr); |
---|
1201 | | - ret = sysfs_create_bin_file(&dev->kobj, &ds1685_rtc_sysfs_nvram_attr); |
---|
1202 | | - if (ret) |
---|
1203 | | - return ret; |
---|
1204 | | - |
---|
1205 | | - ret = sysfs_create_group(&dev->kobj, &ds1685_rtc_sysfs_misc_grp); |
---|
1206 | | - if (ret) |
---|
1207 | | - return ret; |
---|
1208 | | - |
---|
1209 | | - return 0; |
---|
1210 | | -} |
---|
1211 | | - |
---|
1212 | | -/** |
---|
1213 | | - * ds1685_rtc_sysfs_unregister - unregister sysfs files. |
---|
1214 | | - * @dev: pointer to device structure. |
---|
1215 | | - */ |
---|
1216 | | -static int |
---|
1217 | | -ds1685_rtc_sysfs_unregister(struct device *dev) |
---|
1218 | | -{ |
---|
1219 | | - sysfs_remove_bin_file(&dev->kobj, &ds1685_rtc_sysfs_nvram_attr); |
---|
1220 | | - sysfs_remove_group(&dev->kobj, &ds1685_rtc_sysfs_misc_grp); |
---|
1221 | | - |
---|
1222 | | - return 0; |
---|
1223 | | -} |
---|
1224 | | -#endif /* CONFIG_SYSFS */ |
---|
1225 | | - |
---|
1226 | | - |
---|
1227 | 1061 | |
---|
1228 | 1062 | /* ----------------------------------------------------------------------- */ |
---|
1229 | 1063 | /* Driver Probe/Removal */ |
---|
.. | .. |
---|
1236 | 1070 | ds1685_rtc_probe(struct platform_device *pdev) |
---|
1237 | 1071 | { |
---|
1238 | 1072 | struct rtc_device *rtc_dev; |
---|
1239 | | - struct resource *res; |
---|
1240 | 1073 | struct ds1685_priv *rtc; |
---|
1241 | 1074 | struct ds1685_rtc_platform_data *pdata; |
---|
1242 | 1075 | u8 ctrla, ctrlb, hours; |
---|
1243 | 1076 | unsigned char am_pm; |
---|
1244 | 1077 | int ret = 0; |
---|
| 1078 | + struct nvmem_config nvmem_cfg = { |
---|
| 1079 | + .name = "ds1685_nvram", |
---|
| 1080 | + .size = NVRAM_TOTAL_SZ, |
---|
| 1081 | + .reg_read = ds1685_nvram_read, |
---|
| 1082 | + .reg_write = ds1685_nvram_write, |
---|
| 1083 | + }; |
---|
1245 | 1084 | |
---|
1246 | 1085 | /* Get the platform data. */ |
---|
1247 | 1086 | pdata = (struct ds1685_rtc_platform_data *) pdev->dev.platform_data; |
---|
.. | .. |
---|
1253 | 1092 | if (!rtc) |
---|
1254 | 1093 | return -ENOMEM; |
---|
1255 | 1094 | |
---|
1256 | | - /* |
---|
1257 | | - * Allocate/setup any IORESOURCE_MEM resources, if required. Not all |
---|
1258 | | - * platforms put the RTC in an easy-access place. Like the SGI Octane, |
---|
1259 | | - * which attaches the RTC to a "ByteBus", hooked to a SuperIO chip |
---|
1260 | | - * that sits behind the IOC3 PCI metadevice. |
---|
1261 | | - */ |
---|
1262 | | - if (pdata->alloc_io_resources) { |
---|
1263 | | - /* Get the platform resources. */ |
---|
1264 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
1265 | | - if (!res) |
---|
1266 | | - return -ENXIO; |
---|
1267 | | - rtc->size = resource_size(res); |
---|
1268 | | - |
---|
1269 | | - /* Request a memory region. */ |
---|
1270 | | - /* XXX: mmio-only for now. */ |
---|
1271 | | - if (!devm_request_mem_region(&pdev->dev, res->start, rtc->size, |
---|
1272 | | - pdev->name)) |
---|
1273 | | - return -EBUSY; |
---|
1274 | | - |
---|
1275 | | - /* |
---|
1276 | | - * Set the base address for the rtc, and ioremap its |
---|
1277 | | - * registers. |
---|
1278 | | - */ |
---|
1279 | | - rtc->baseaddr = res->start; |
---|
1280 | | - rtc->regs = devm_ioremap(&pdev->dev, res->start, rtc->size); |
---|
1281 | | - if (!rtc->regs) |
---|
1282 | | - return -ENOMEM; |
---|
| 1095 | + /* Setup resources and access functions */ |
---|
| 1096 | + switch (pdata->access_type) { |
---|
| 1097 | + case ds1685_reg_direct: |
---|
| 1098 | + rtc->regs = devm_platform_ioremap_resource(pdev, 0); |
---|
| 1099 | + if (IS_ERR(rtc->regs)) |
---|
| 1100 | + return PTR_ERR(rtc->regs); |
---|
| 1101 | + rtc->read = ds1685_read; |
---|
| 1102 | + rtc->write = ds1685_write; |
---|
| 1103 | + break; |
---|
| 1104 | + case ds1685_reg_indirect: |
---|
| 1105 | + rtc->regs = devm_platform_ioremap_resource(pdev, 0); |
---|
| 1106 | + if (IS_ERR(rtc->regs)) |
---|
| 1107 | + return PTR_ERR(rtc->regs); |
---|
| 1108 | + rtc->data = devm_platform_ioremap_resource(pdev, 1); |
---|
| 1109 | + if (IS_ERR(rtc->data)) |
---|
| 1110 | + return PTR_ERR(rtc->data); |
---|
| 1111 | + rtc->read = ds1685_indirect_read; |
---|
| 1112 | + rtc->write = ds1685_indirect_write; |
---|
| 1113 | + break; |
---|
1283 | 1114 | } |
---|
1284 | | - rtc->alloc_io_resources = pdata->alloc_io_resources; |
---|
| 1115 | + |
---|
| 1116 | + if (!rtc->read || !rtc->write) |
---|
| 1117 | + return -ENXIO; |
---|
1285 | 1118 | |
---|
1286 | 1119 | /* Get the register step size. */ |
---|
1287 | 1120 | if (pdata->regstep > 0) |
---|
1288 | 1121 | rtc->regstep = pdata->regstep; |
---|
1289 | 1122 | else |
---|
1290 | 1123 | rtc->regstep = 1; |
---|
1291 | | - |
---|
1292 | | - /* Platform read function, else default if mmio setup */ |
---|
1293 | | - if (pdata->plat_read) |
---|
1294 | | - rtc->read = pdata->plat_read; |
---|
1295 | | - else |
---|
1296 | | - if (pdata->alloc_io_resources) |
---|
1297 | | - rtc->read = ds1685_read; |
---|
1298 | | - else |
---|
1299 | | - return -ENXIO; |
---|
1300 | | - |
---|
1301 | | - /* Platform write function, else default if mmio setup */ |
---|
1302 | | - if (pdata->plat_write) |
---|
1303 | | - rtc->write = pdata->plat_write; |
---|
1304 | | - else |
---|
1305 | | - if (pdata->alloc_io_resources) |
---|
1306 | | - rtc->write = ds1685_write; |
---|
1307 | | - else |
---|
1308 | | - return -ENXIO; |
---|
1309 | 1124 | |
---|
1310 | 1125 | /* Platform pre-shutdown function, if defined. */ |
---|
1311 | 1126 | if (pdata->plat_prepare_poweroff) |
---|
.. | .. |
---|
1319 | 1134 | if (pdata->plat_post_ram_clear) |
---|
1320 | 1135 | rtc->post_ram_clear = pdata->plat_post_ram_clear; |
---|
1321 | 1136 | |
---|
1322 | | - /* Init the spinlock, workqueue, & set the driver data. */ |
---|
1323 | | - spin_lock_init(&rtc->lock); |
---|
1324 | | - INIT_WORK(&rtc->work, ds1685_rtc_work_queue); |
---|
| 1137 | + /* set the driver data. */ |
---|
1325 | 1138 | platform_set_drvdata(pdev, rtc); |
---|
1326 | 1139 | |
---|
1327 | 1140 | /* Turn the oscillator on if is not already on (DV1 = 1). */ |
---|
.. | .. |
---|
1463 | 1276 | /* See if the platform doesn't support UIE. */ |
---|
1464 | 1277 | if (pdata->uie_unsupported) |
---|
1465 | 1278 | rtc_dev->uie_unsupported = 1; |
---|
1466 | | - rtc->uie_unsupported = pdata->uie_unsupported; |
---|
1467 | 1279 | |
---|
1468 | 1280 | rtc->dev = rtc_dev; |
---|
1469 | 1281 | |
---|
.. | .. |
---|
1477 | 1289 | */ |
---|
1478 | 1290 | if (!pdata->no_irq) { |
---|
1479 | 1291 | ret = platform_get_irq(pdev, 0); |
---|
1480 | | - if (ret > 0) { |
---|
1481 | | - rtc->irq_num = ret; |
---|
1482 | | - |
---|
1483 | | - /* Request an IRQ. */ |
---|
1484 | | - ret = devm_request_irq(&pdev->dev, rtc->irq_num, |
---|
1485 | | - ds1685_rtc_irq_handler, |
---|
1486 | | - IRQF_SHARED, pdev->name, pdev); |
---|
1487 | | - |
---|
1488 | | - /* Check to see if something came back. */ |
---|
1489 | | - if (unlikely(ret)) { |
---|
1490 | | - dev_warn(&pdev->dev, |
---|
1491 | | - "RTC interrupt not available\n"); |
---|
1492 | | - rtc->irq_num = 0; |
---|
1493 | | - } |
---|
1494 | | - } else |
---|
| 1292 | + if (ret <= 0) |
---|
1495 | 1293 | return ret; |
---|
| 1294 | + |
---|
| 1295 | + rtc->irq_num = ret; |
---|
| 1296 | + |
---|
| 1297 | + /* Request an IRQ. */ |
---|
| 1298 | + ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_num, |
---|
| 1299 | + NULL, ds1685_rtc_irq_handler, |
---|
| 1300 | + IRQF_SHARED | IRQF_ONESHOT, |
---|
| 1301 | + pdev->name, pdev); |
---|
| 1302 | + |
---|
| 1303 | + /* Check to see if something came back. */ |
---|
| 1304 | + if (unlikely(ret)) { |
---|
| 1305 | + dev_warn(&pdev->dev, |
---|
| 1306 | + "RTC interrupt not available\n"); |
---|
| 1307 | + rtc->irq_num = 0; |
---|
| 1308 | + } |
---|
1496 | 1309 | } |
---|
1497 | 1310 | rtc->no_irq = pdata->no_irq; |
---|
1498 | 1311 | |
---|
1499 | 1312 | /* Setup complete. */ |
---|
1500 | 1313 | ds1685_rtc_switch_to_bank0(rtc); |
---|
1501 | 1314 | |
---|
1502 | | -#ifdef CONFIG_SYSFS |
---|
1503 | | - ret = ds1685_rtc_sysfs_register(&pdev->dev); |
---|
| 1315 | + ret = rtc_add_group(rtc_dev, &ds1685_rtc_sysfs_misc_grp); |
---|
1504 | 1316 | if (ret) |
---|
1505 | 1317 | return ret; |
---|
1506 | | -#endif |
---|
| 1318 | + |
---|
| 1319 | + rtc_dev->nvram_old_abi = true; |
---|
| 1320 | + nvmem_cfg.priv = rtc; |
---|
| 1321 | + ret = rtc_nvmem_register(rtc_dev, &nvmem_cfg); |
---|
| 1322 | + if (ret) |
---|
| 1323 | + return ret; |
---|
1507 | 1324 | |
---|
1508 | 1325 | return rtc_register_device(rtc_dev); |
---|
1509 | 1326 | } |
---|
.. | .. |
---|
1516 | 1333 | ds1685_rtc_remove(struct platform_device *pdev) |
---|
1517 | 1334 | { |
---|
1518 | 1335 | struct ds1685_priv *rtc = platform_get_drvdata(pdev); |
---|
1519 | | - |
---|
1520 | | -#ifdef CONFIG_SYSFS |
---|
1521 | | - ds1685_rtc_sysfs_unregister(&pdev->dev); |
---|
1522 | | -#endif |
---|
1523 | 1336 | |
---|
1524 | 1337 | /* Read Ctrl B and clear PIE/AIE/UIE. */ |
---|
1525 | 1338 | rtc->write(rtc, RTC_CTRL_B, |
---|
.. | .. |
---|
1539 | 1352 | (rtc->read(rtc, RTC_EXT_CTRL_4A) & |
---|
1540 | 1353 | ~(RTC_CTRL_4A_RWK_MASK))); |
---|
1541 | 1354 | |
---|
1542 | | - cancel_work_sync(&rtc->work); |
---|
1543 | | - |
---|
1544 | 1355 | return 0; |
---|
1545 | 1356 | } |
---|
1546 | 1357 | |
---|
1547 | | -/** |
---|
| 1358 | +/* |
---|
1548 | 1359 | * ds1685_rtc_driver - rtc driver properties. |
---|
1549 | 1360 | */ |
---|
1550 | 1361 | static struct platform_driver ds1685_rtc_driver = { |
---|
.. | .. |
---|
1630 | 1441 | unreachable(); |
---|
1631 | 1442 | } |
---|
1632 | 1443 | } |
---|
1633 | | -EXPORT_SYMBOL(ds1685_rtc_poweroff); |
---|
| 1444 | +EXPORT_SYMBOL_GPL(ds1685_rtc_poweroff); |
---|
1634 | 1445 | /* ----------------------------------------------------------------------- */ |
---|
1635 | 1446 | |
---|
1636 | 1447 | |
---|