2016-12-25 06:58:29

by Venkat Prashanth B U

[permalink] [raw]
Subject: [PATCH] rtc: add support for rtc NXP pca21125 and pca8565

This is a patch to support the SPI compatible PCA21125 device
with the I2C based rtc-pcf8563 driver using regmap layer.
Further this patch adds "pca8565" to the set of i2c ids.

Signed-off-by: Venkat Prashanth B U <[email protected]>
---
change log v3:
1. Add a regmap layer to I2C PCF8563 to support SPI PCA21125.
2. Add pca8565 to the set of i2c ids of rtc-pcf8563.
---
---
drivers/rtc/rtc-pcf8563.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)

diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 1227cea..26c8b9b 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -22,6 +22,8 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/err.h>
+#include <linux/spi/spi.h>
+#include <linux/regmap.h>

#define PCF8563_REG_ST1 0x00 /* status */
#define PCF8563_REG_ST2 0x01
@@ -59,6 +61,7 @@

#define PCF8563_SC_LV 0x80 /* low voltage */
#define PCF8563_MO_C 0x80 /* century */
+#define PCF8563_REG_SR 0x01 /*control-status register*/

static struct i2c_driver pcf8563_driver;

@@ -84,6 +87,9 @@ struct pcf8563 {
struct i2c_client *client;
#ifdef CONFIG_COMMON_CLK
struct clk_hw clkout_hw;
+const struct device *dev;
+const struct regmap *regmap;
+ bool suspended;
#endif
};

@@ -629,6 +635,7 @@ static int pcf8563_probe(struct i2c_client *client,
static const struct i2c_device_id pcf8563_id[] = {
{ "pcf8563", 0 },
{ "rtc8564", 0 },
+ { "pca8565", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, pcf8563_id);
@@ -636,11 +643,86 @@ MODULE_DEVICE_TABLE(i2c, pcf8563_id);
#ifdef CONFIG_OF
static const struct of_device_id pcf8563_of_match[] = {
{ .compatible = "nxp,pcf8563" },
+ { .compatible = "nxp,pca8565" },
{}
};
MODULE_DEVICE_TABLE(of, pcf8563_of_match);
#endif

+#if IS_ENABLED(CONFIG_SPI_MASTER)
+
+static int pca21125_probe(const struct spi_device *spi)
+{
+ int res;
+ unsigned int tmp;
+ static const struct regmap_config config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .write_flag_mask = 0x80,
+ };
+const struct regmap *regmap;
+const struct pcf8563 *pcf8563;
+
+ regmap = devm_regmap_init_spi(spi, &config);
+
+ if (IS_ERR(regmap)) {
+ dev_err(&spi->dev, "%s: regmap allocation failed: %ld\n",
+ __func__, PTR_ERR(regmap));
+ return PTR_ERR(regmap);
+ }
+
+ spi->mode = SPI_MODE_3;
+ spi->bits_per_word = 8;
+ spi_setup(spi);
+
+ res = regmap_read(regmap, PCF8563_REG_SC, &tmp);
+
+ if (res)
+ return res;
+ res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
+
+ if (res)
+ return res;
+
+ res = regmap_write(regmap, PCF8563_REG_CLKO, tmp & 0x1c);
+
+ if (res)
+ return res;
+
+ res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
+
+ if (res)
+ return res;
+
+ res = regmap_write(regmap, PCF8563_REG_SR, tmp & 0x88);
+
+ if (res)
+ return res;
+
+ /* Print our settings */
+ res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
+
+ if (res)
+ return res;
+
+ dev_info(&spi->dev, "Control Reg: 0x%02x\n", tmp);
+ res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
+
+ if (res)
+ return res;
+
+ dev_info(&spi->dev, "Ctrl/Stat Reg: 0x%02x\n", tmp);
+
+ pcf8563->rtc = devm_rtc_device_register(&spi->dev,
+ "pcf8563",
+ &pcf8563_rtc_ops, THIS_MODULE);
+}
+
+const struct spi_driver pca21125_driver = {
+ .driver = {
+ .name = "pca21125",
+ },
+
static struct i2c_driver pcf8563_driver = {
.driver = {
.name = "rtc-pcf8563",
--
1.9.2


2016-12-25 07:37:06

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] rtc: add support for rtc NXP pca21125 and pca8565

Hi Venkat,

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v4.9 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Venkat-Prashanth-B-U/rtc-add-support-for-rtc-NXP-pca21125-and-pca8565/20161225-150140
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All warnings (new ones prefixed by >>):

In file included from drivers/rtc/rtc-pcf8563.c:26:0:
drivers/rtc/rtc-pcf8563.c: In function 'pca21125_probe':
>> include/linux/regmap.h:667:27: warning: passing argument 1 of '__devm_regmap_init_spi' discards 'const' qualifier from pointer target type
__regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
^
include/linux/regmap.h:505:3: note: in definition of macro '__regmap_lockdep_wrapper'
fn(__VA_ARGS__, &_key, \
^
drivers/rtc/rtc-pcf8563.c:666:11: note: in expansion of macro 'devm_regmap_init_spi'
regmap = devm_regmap_init_spi(spi, &config);
^
include/linux/regmap.h:470:16: note: expected 'struct spi_device *' but argument is of type 'const struct spi_device *'
struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
^
drivers/rtc/rtc-pcf8563.c:674:12: error: assignment of member 'mode' in read-only object
spi->mode = SPI_MODE_3;
^
drivers/rtc/rtc-pcf8563.c:675:21: error: assignment of member 'bits_per_word' in read-only object
spi->bits_per_word = 8;
^
drivers/rtc/rtc-pcf8563.c:676:2: warning: passing argument 1 of 'spi_setup' discards 'const' qualifier from pointer target type
spi_setup(spi);
^
In file included from drivers/rtc/rtc-pcf8563.c:25:0:
include/linux/spi/spi.h:905:12: note: expected 'struct spi_device *' but argument is of type 'const struct spi_device *'
extern int spi_setup(struct spi_device *spi);
^
drivers/rtc/rtc-pcf8563.c:678:8: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type
res = regmap_read(regmap, PCF8563_REG_SC, &tmp);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^
drivers/rtc/rtc-pcf8563.c:682:8: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type
res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^
drivers/rtc/rtc-pcf8563.c:687:8: warning: passing argument 1 of 'regmap_write' discards 'const' qualifier from pointer target type
res = regmap_write(regmap, PCF8563_REG_CLKO, tmp & 0x1c);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:745:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
^
drivers/rtc/rtc-pcf8563.c:692:8: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type
res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^
drivers/rtc/rtc-pcf8563.c:697:8: warning: passing argument 1 of 'regmap_write' discards 'const' qualifier from pointer target type
res = regmap_write(regmap, PCF8563_REG_SR, tmp & 0x88);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:745:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
^
drivers/rtc/rtc-pcf8563.c:703:8: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type
res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^
drivers/rtc/rtc-pcf8563.c:709:8: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type
res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
^
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^
drivers/rtc/rtc-pcf8563.c:716:17: warning: passing argument 1 of 'devm_rtc_device_register' discards 'const' qualifier from pointer target type
pcf8563->rtc = devm_rtc_device_register(&spi->dev,
^
In file included from drivers/rtc/rtc-pcf8563.c:20:0:
include/linux/rtc.h:163:27: note: expected 'struct device *' but argument is of type 'const struct device *'
extern struct rtc_device *devm_rtc_device_register(struct device *dev,
^
drivers/rtc/rtc-pcf8563.c:716:15: error: assignment of member 'rtc' in read-only object
pcf8563->rtc = devm_rtc_device_register(&spi->dev,
^
drivers/rtc/rtc-pcf8563.c: At top level:
drivers/rtc/rtc-pcf8563.c:726:1: error: expected expression before 'static'
static struct i2c_driver pcf8563_driver = {
^
drivers/rtc/rtc-pcf8563.c:726:1: warning: excess elements in struct initializer
drivers/rtc/rtc-pcf8563.c:726:1: warning: (near initialization for 'pca21125_driver')
drivers/rtc/rtc-pcf8563.c:652:0: error: unterminated #if
#if IS_ENABLED(CONFIG_SPI_MASTER)
^
drivers/rtc/rtc-pcf8563.c:566:12: warning: 'pcf8563_probe' defined but not used [-Wunused-function]
static int pcf8563_probe(struct i2c_client *client,
^
drivers/rtc/rtc-pcf8563.c:654:12: warning: 'pca21125_probe' defined but not used [-Wunused-function]
static int pca21125_probe(const struct spi_device *spi)
^

vim +667 include/linux/regmap.h

1ed81114 Nicolas Boichat 2015-08-11 651 */
3cfe7a74 Nicolas Boichat 2015-07-08 652 #define devm_regmap_init_i2c(i2c, config) \
3cfe7a74 Nicolas Boichat 2015-07-08 653 __regmap_lockdep_wrapper(__devm_regmap_init_i2c, #config, \
3cfe7a74 Nicolas Boichat 2015-07-08 654 i2c, config)
1ed81114 Nicolas Boichat 2015-08-11 655
1ed81114 Nicolas Boichat 2015-08-11 656 /**
1ed81114 Nicolas Boichat 2015-08-11 657 * devm_regmap_init_spi(): Initialise register map
1ed81114 Nicolas Boichat 2015-08-11 658 *
1ed81114 Nicolas Boichat 2015-08-11 659 * @spi: Device that will be interacted with
1ed81114 Nicolas Boichat 2015-08-11 660 * @config: Configuration for register map
1ed81114 Nicolas Boichat 2015-08-11 661 *
1ed81114 Nicolas Boichat 2015-08-11 662 * The return value will be an ERR_PTR() on error or a valid pointer
1ed81114 Nicolas Boichat 2015-08-11 663 * to a struct regmap. The map will be automatically freed by the
1ed81114 Nicolas Boichat 2015-08-11 664 * device management code.
1ed81114 Nicolas Boichat 2015-08-11 665 */
3cfe7a74 Nicolas Boichat 2015-07-08 666 #define devm_regmap_init_spi(dev, config) \
3cfe7a74 Nicolas Boichat 2015-07-08 @667 __regmap_lockdep_wrapper(__devm_regmap_init_spi, #config, \
3cfe7a74 Nicolas Boichat 2015-07-08 668 dev, config)
1ed81114 Nicolas Boichat 2015-08-11 669
1ed81114 Nicolas Boichat 2015-08-11 670 /**
1ed81114 Nicolas Boichat 2015-08-11 671 * devm_regmap_init_spmi_base(): Create managed regmap for Base register space
1ed81114 Nicolas Boichat 2015-08-11 672 * @sdev: SPMI device that will be interacted with
1ed81114 Nicolas Boichat 2015-08-11 673 * @config: Configuration for register map
1ed81114 Nicolas Boichat 2015-08-11 674 *
1ed81114 Nicolas Boichat 2015-08-11 675 * The return value will be an ERR_PTR() on error or a valid pointer

:::::: The code at line 667 was first introduced by commit
:::::: 3cfe7a74d42b7e3644f8b2b26aa20146d4f90f0f regmap: Use different lockdep class for each regmap init call

:::::: TO: Nicolas Boichat <[email protected]>
:::::: CC: Mark Brown <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (9.18 kB)
.config.gz (45.92 kB)
Download all attachments

2016-12-25 07:53:02

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] rtc: add support for rtc NXP pca21125 and pca8565

Hi Venkat,

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v4.9 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Venkat-Prashanth-B-U/rtc-add-support-for-rtc-NXP-pca21125-and-pca8565/20161225-150140
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-randconfig-x016-201652 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All error/warnings (new ones prefixed by >>):

In file included from drivers/rtc/rtc-pcf8563.c:26:0:
drivers/rtc/rtc-pcf8563.c: In function 'pca21125_probe':
>> drivers/rtc/rtc-pcf8563.c:666:32: warning: passing argument 1 of '__devm_regmap_init_spi' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
regmap = devm_regmap_init_spi(spi, &config);
^
include/linux/regmap.h:505:6: note: in definition of macro '__regmap_lockdep_wrapper'
fn(__VA_ARGS__, &_key, \
^~~~~~~~~~~
>> drivers/rtc/rtc-pcf8563.c:666:11: note: in expansion of macro 'devm_regmap_init_spi'
regmap = devm_regmap_init_spi(spi, &config);
^~~~~~~~~~~~~~~~~~~~
include/linux/regmap.h:470:16: note: expected 'struct spi_device *' but argument is of type 'const struct spi_device *'
struct regmap *__devm_regmap_init_spi(struct spi_device *dev,
^~~~~~~~~~~~~~~~~~~~~~
>> drivers/rtc/rtc-pcf8563.c:674:12: error: assignment of member 'mode' in read-only object
spi->mode = SPI_MODE_3;
^
>> drivers/rtc/rtc-pcf8563.c:675:21: error: assignment of member 'bits_per_word' in read-only object
spi->bits_per_word = 8;
^
>> drivers/rtc/rtc-pcf8563.c:676:12: warning: passing argument 1 of 'spi_setup' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
spi_setup(spi);
^~~
In file included from drivers/rtc/rtc-pcf8563.c:25:0:
include/linux/spi/spi.h:905:12: note: expected 'struct spi_device *' but argument is of type 'const struct spi_device *'
extern int spi_setup(struct spi_device *spi);
^~~~~~~~~
>> drivers/rtc/rtc-pcf8563.c:678:20: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_read(regmap, PCF8563_REG_SC, &tmp);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^~~~~~~~~~~
drivers/rtc/rtc-pcf8563.c:682:20: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^~~~~~~~~~~
>> drivers/rtc/rtc-pcf8563.c:687:21: warning: passing argument 1 of 'regmap_write' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_write(regmap, PCF8563_REG_CLKO, tmp & 0x1c);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:745:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
^~~~~~~~~~~~
drivers/rtc/rtc-pcf8563.c:692:20: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^~~~~~~~~~~
drivers/rtc/rtc-pcf8563.c:697:21: warning: passing argument 1 of 'regmap_write' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_write(regmap, PCF8563_REG_SR, tmp & 0x88);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:745:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
^~~~~~~~~~~~
drivers/rtc/rtc-pcf8563.c:703:20: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^~~~~~~~~~~
drivers/rtc/rtc-pcf8563.c:709:20: warning: passing argument 1 of 'regmap_read' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
^~~~~~
In file included from drivers/rtc/rtc-pcf8563.c:26:0:
include/linux/regmap.h:758:5: note: expected 'struct regmap *' but argument is of type 'const struct regmap *'
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
^~~~~~~~~~~
>> drivers/rtc/rtc-pcf8563.c:716:42: warning: passing argument 1 of 'devm_rtc_device_register' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
pcf8563->rtc = devm_rtc_device_register(&spi->dev,
^
In file included from drivers/rtc/rtc-pcf8563.c:20:0:
include/linux/rtc.h:163:27: note: expected 'struct device *' but argument is of type 'const struct device *'
extern struct rtc_device *devm_rtc_device_register(struct device *dev,
^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/rtc/rtc-pcf8563.c:716:15: error: assignment of member 'rtc' in read-only object
pcf8563->rtc = devm_rtc_device_register(&spi->dev,
^
drivers/rtc/rtc-pcf8563.c: At top level:
>> drivers/rtc/rtc-pcf8563.c:726:1: error: expected expression before 'static'
static struct i2c_driver pcf8563_driver = {
^~~~~~
>> drivers/rtc/rtc-pcf8563.c:726:1: warning: excess elements in struct initializer
drivers/rtc/rtc-pcf8563.c:726:1: note: (near initialization for 'pca21125_driver')
>> drivers/rtc/rtc-pcf8563.c:652:0: error: unterminated #if
#if IS_ENABLED(CONFIG_SPI_MASTER)

drivers/rtc/rtc-pcf8563.c:654:12: warning: 'pca21125_probe' defined but not used [-Wunused-function]
static int pca21125_probe(const struct spi_device *spi)
^~~~~~~~~~~~~~
drivers/rtc/rtc-pcf8563.c:566:12: warning: 'pcf8563_probe' defined but not used [-Wunused-function]
static int pcf8563_probe(struct i2c_client *client,
^~~~~~~~~~~~~

vim +/mode +674 drivers/rtc/rtc-pcf8563.c

646 { .compatible = "nxp,pca8565" },
647 {}
648 };
649 MODULE_DEVICE_TABLE(of, pcf8563_of_match);
650 #endif
651
> 652 #if IS_ENABLED(CONFIG_SPI_MASTER)
653
654 static int pca21125_probe(const struct spi_device *spi)
655 {
656 int res;
657 unsigned int tmp;
658 static const struct regmap_config config = {
659 .reg_bits = 8,
660 .val_bits = 8,
661 .write_flag_mask = 0x80,
662 };
663 const struct regmap *regmap;
664 const struct pcf8563 *pcf8563;
665
> 666 regmap = devm_regmap_init_spi(spi, &config);
667
668 if (IS_ERR(regmap)) {
669 dev_err(&spi->dev, "%s: regmap allocation failed: %ld\n",
670 __func__, PTR_ERR(regmap));
671 return PTR_ERR(regmap);
672 }
673
> 674 spi->mode = SPI_MODE_3;
> 675 spi->bits_per_word = 8;
> 676 spi_setup(spi);
677
> 678 res = regmap_read(regmap, PCF8563_REG_SC, &tmp);
679
680 if (res)
681 return res;
> 682 res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
683
684 if (res)
685 return res;
686
> 687 res = regmap_write(regmap, PCF8563_REG_CLKO, tmp & 0x1c);
688
689 if (res)
690 return res;
691
692 res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
693
694 if (res)
695 return res;
696
697 res = regmap_write(regmap, PCF8563_REG_SR, tmp & 0x88);
698
699 if (res)
700 return res;
701
702 /* Print our settings */
703 res = regmap_read(regmap, PCF8563_REG_CLKO, &tmp);
704
705 if (res)
706 return res;
707
708 dev_info(&spi->dev, "Control Reg: 0x%02x\n", tmp);
> 709 res = regmap_read(regmap, PCF8563_REG_SR, &tmp);
710
711 if (res)
712 return res;
713
714 dev_info(&spi->dev, "Ctrl/Stat Reg: 0x%02x\n", tmp);
715
> 716 pcf8563->rtc = devm_rtc_device_register(&spi->dev,
717 "pcf8563",
718 &pcf8563_rtc_ops, THIS_MODULE);
719 }
720
721 const struct spi_driver pca21125_driver = {
722 .driver = {
723 .name = "pca21125",
724 },
725
> 726 static struct i2c_driver pcf8563_driver = {
727 .driver = {
728 .name = "rtc-pcf8563",
729 .of_match_table = of_match_ptr(pcf8563_of_match),

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (9.77 kB)
.config.gz (24.87 kB)
Download all attachments