diff mbox series

[4/6] mfd: bcm590xx: Add compatible for BCM59054

Message ID 20231030-bcm59054-v1-4-3517f980c1e3@gmail.com
State New
Headers show
Series mfd: bcm590xx: Add support for BCM59054 | expand

Commit Message

Artur Weber Oct. 30, 2023, 7:36 p.m. UTC
The BCM59056 supported by the bcm590xx driver is similar to the
BCM59054 MFD. Add a compatible for it in the driver, in preparation
for adding support for this chip in the bcm590xx regulator driver.

Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
---
 drivers/mfd/bcm590xx.c       | 5 ++++-
 include/linux/mfd/bcm590xx.h | 7 +++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

kernel test robot Nov. 6, 2023, 9:46 a.m. UTC | #1
Hi Artur,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1]

url:    https://github.com/intel-lab-lkp/linux/commits/Artur-Weber/dt-bindings-mfd-brcm-bcm59056-Convert-to-YAML/20231031-040046
base:   05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1
patch link:    https://lore.kernel.org/r/20231030-bcm59054-v1-4-3517f980c1e3%40gmail.com
patch subject: [PATCH 4/6] mfd: bcm590xx: Add compatible for BCM59054
config: powerpc64-allyesconfig (https://download.01.org/0day-ci/archive/20231106/202311061654.4074XhbV-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231106/202311061654.4074XhbV-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311061654.4074XhbV-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mfd/bcm590xx.c:53:26: warning: cast to smaller integer type 'unsigned int' from 'const void *' [-Wvoid-pointer-to-int-cast]
      53 |         bcm590xx->device_type = (unsigned int)of_device_get_match_data(bcm590xx->dev);
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +53 drivers/mfd/bcm590xx.c

    39	
    40	static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri)
    41	{
    42		struct bcm590xx *bcm590xx;
    43		int ret;
    44	
    45		bcm590xx = devm_kzalloc(&i2c_pri->dev, sizeof(*bcm590xx), GFP_KERNEL);
    46		if (!bcm590xx)
    47			return -ENOMEM;
    48	
    49		i2c_set_clientdata(i2c_pri, bcm590xx);
    50		bcm590xx->dev = &i2c_pri->dev;
    51		bcm590xx->i2c_pri = i2c_pri;
    52	
  > 53		bcm590xx->device_type = (unsigned int)of_device_get_match_data(bcm590xx->dev);
    54	
    55		bcm590xx->regmap_pri = devm_regmap_init_i2c(i2c_pri,
    56							 &bcm590xx_regmap_config_pri);
    57		if (IS_ERR(bcm590xx->regmap_pri)) {
    58			ret = PTR_ERR(bcm590xx->regmap_pri);
    59			dev_err(&i2c_pri->dev, "primary regmap init failed: %d\n", ret);
    60			return ret;
    61		}
    62	
    63		/* Secondary I2C slave address is the base address with A(2) asserted */
    64		bcm590xx->i2c_sec = i2c_new_dummy_device(i2c_pri->adapter,
    65						  i2c_pri->addr | BIT(2));
    66		if (IS_ERR(bcm590xx->i2c_sec)) {
    67			dev_err(&i2c_pri->dev, "failed to add secondary I2C device\n");
    68			return PTR_ERR(bcm590xx->i2c_sec);
    69		}
    70		i2c_set_clientdata(bcm590xx->i2c_sec, bcm590xx);
    71	
    72		bcm590xx->regmap_sec = devm_regmap_init_i2c(bcm590xx->i2c_sec,
    73							&bcm590xx_regmap_config_sec);
    74		if (IS_ERR(bcm590xx->regmap_sec)) {
    75			ret = PTR_ERR(bcm590xx->regmap_sec);
    76			dev_err(&bcm590xx->i2c_sec->dev,
    77				"secondary regmap init failed: %d\n", ret);
    78			goto err;
    79		}
    80	
    81		ret = devm_mfd_add_devices(&i2c_pri->dev, -1, bcm590xx_devs,
    82					   ARRAY_SIZE(bcm590xx_devs), NULL, 0, NULL);
    83		if (ret < 0) {
    84			dev_err(&i2c_pri->dev, "failed to add sub-devices: %d\n", ret);
    85			goto err;
    86		}
    87	
    88		return 0;
    89	
    90	err:
    91		i2c_unregister_device(bcm590xx->i2c_sec);
    92		return ret;
    93	}
    94
diff mbox series

Patch

diff --git a/drivers/mfd/bcm590xx.c b/drivers/mfd/bcm590xx.c
index 92eede9a5e61..f5c5fa97ca9a 100644
--- a/drivers/mfd/bcm590xx.c
+++ b/drivers/mfd/bcm590xx.c
@@ -50,6 +50,8 @@  static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri)
 	bcm590xx->dev = &i2c_pri->dev;
 	bcm590xx->i2c_pri = i2c_pri;
 
+	bcm590xx->device_type = (unsigned int)of_device_get_match_data(bcm590xx->dev);
+
 	bcm590xx->regmap_pri = devm_regmap_init_i2c(i2c_pri,
 						 &bcm590xx_regmap_config_pri);
 	if (IS_ERR(bcm590xx->regmap_pri)) {
@@ -91,7 +93,8 @@  static int bcm590xx_i2c_probe(struct i2c_client *i2c_pri)
 }
 
 static const struct of_device_id bcm590xx_of_match[] = {
-	{ .compatible = "brcm,bcm59056" },
+	{ .compatible = "brcm,bcm59054", .data = (void *)BCM59054_TYPE },
+	{ .compatible = "brcm,bcm59056", .data = (void *)BCM59056_TYPE },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, bcm590xx_of_match);
diff --git a/include/linux/mfd/bcm590xx.h b/include/linux/mfd/bcm590xx.h
index 6b8791da6119..ed0d8be6387c 100644
--- a/include/linux/mfd/bcm590xx.h
+++ b/include/linux/mfd/bcm590xx.h
@@ -13,12 +13,19 @@ 
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 
+/* device types */
+enum {
+	BCM59054_TYPE,
+	BCM59056_TYPE,
+};
+
 /* max register address */
 #define BCM590XX_MAX_REGISTER_PRI	0xe7
 #define BCM590XX_MAX_REGISTER_SEC	0xf0
 
 struct bcm590xx {
 	struct device *dev;
+	unsigned int device_type;
 	struct i2c_client *i2c_pri;
 	struct i2c_client *i2c_sec;
 	struct regmap *regmap_pri;