Skip to contentSkip to conversation

rtc: add support for Maxim rtc max6916 v3.0

PATCH New [email protected] 1 participant 1 message May 13, 2016 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: add support for Maxim rtc max6916 v3.0

From: venkat-prashanth <[email protected]>

                     #Change Log: from v2.0 to v3.0

                     - fixed the out-of-tree Makefile and suitably added
                       the modifications in the Makefile

                     - fixed the bad indented Kconfig file

                     -used a define instead of 0x1B as follows
		                #define MAX6916_REG_MAP_ADDRESS 0x1B

                     -moved and placed the test at the begining of the function
                      after the range is properly enforced
		               if (dt->tm_year < 100 || dt->tm_year > 199) {
                      dev_err(&spi->dev,"Year must be between 2000 and 2099.
                      It's %d.\n", dt->tm_year + 1900);
                      return -EINVAL;
                      }

                     - A magic number is a direct usage of a number
                       in the code,instead has been refactored in  the
                       current version v3.0 which use defines as follows:-
                     -max6916_read_reg(&spi->dev,
                      int MAX6916_CONTROL_REG = 0x08, &data);
                     -max6916_write_reg(&spi->dev,
                      int MAX6916_CONTROL_REG= 0x08, data);
                     -max6916_write_reg(&spi->dev,
                      int MAX6916_STATUS_REG = 0x0C, data);
                     -max6916_read_reg(&spi->dev,
                      int MAX6916_CONTROL_REG = 0x08, &data);
		               -max6916_read_reg(&spi->dev,
                      int MAX6916_STATUS_REG  = 0X0C,  &data);
                     -Unnecessary test function if(dt->tm_year >= 100)
                                                  dt->tm_year -= 100;
                      is deleted after the range is properly enforced.
                     -seperated logical code sections with an empty line
                      and used indentation after if-statements.
---
---
 Kconfig       |   9 ++++
 Makefile      |   1 +
 rtc-max6916.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+)
driver/rtc/Kconfig +9 -0
index fcf87da..5321e8f 100644
@@ -699,6 +699,15 @@
  
               This driver can also be built as a module. If so, the module
               will be called rtc-max6902.
+    config RTC_DRV_MAX6916
+            tristate "Maxim MAX6916"
+            help
+              If you say yes here you will get support for the
+              Maxim MAX6916 SPI RTC chip.
+
+              This driver can also be built as a module. If so, the module
+              will be called rtc-max6916.
+
  
     config RTC_DRV_R9701
             tristate "Epson RTC-9701JE"
driver/rtc/Makefile +0 -0
index 9421959..0b3fded 100644
@@ -85,6 +85,7 @@
     obj-$(CONFIG_RTC_DRV_M48T86)    += rtc-m48t86.o
     obj-$(CONFIG_RTC_DRV_MAX6900)   += rtc-max6900.o
     obj-$(CONFIG_RTC_DRV_MAX6902)   += rtc-max6902.o
    +obj-$(CONFIG_RTC_DRV_MAX6916)   += rtc-max6916.o
     obj-$(CONFIG_RTC_DRV_MAX77686)  += rtc-max77686.o
     obj-$(CONFIG_RTC_DRV_MAX77802)  += rtc-max77802.o
     obj-$(CONFIG_RTC_DRV_MAX8907)   += rtc-max8907.o
driver/rtc/rtc-max6916.c +162 -0

162 lines not on this page · raw message

Signature · 12 lines
1.9.2

-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.