@@ -424,7 +424,7 @@ struct zl3073x_dev *zl3073x_dev_alloc(struct device *dev)
}
EXPORT_SYMBOL_NS_GPL(zl3073x_dev_alloc, "ZL3073X");
-int zl3073x_dev_init(struct zl3073x_dev *zldev)
+int zl3073x_dev_init(struct zl3073x_dev *zldev, u8 dev_id)
{
u16 id, revision, fw_ver;
struct devlink *devlink;
@@ -448,6 +448,9 @@ int zl3073x_dev_init(struct zl3073x_dev *zldev)
return rc;
}
+ /* Use chip ID and given dev ID as clock ID */
+ zldev->clock_id = ((u64)id << 8) | dev_id;
+
dev_info(zldev->dev, "ChipID(%X), ChipRev(%X), FwVer(%u)\n",
id, revision, fw_ver);
dev_info(zldev->dev, "Custom config version: %lu.%lu.%lu.%lu\n",
@@ -41,7 +41,8 @@ static int zl3073x_i2c_probe(struct i2c_client *client)
i2c_set_clientdata(client, zldev);
- return zl3073x_dev_init(zldev);
+ /* Initialize device and use I2C address as dev ID */
+ return zl3073x_dev_init(zldev, client->addr);
}
static void zl3073x_i2c_remove(struct i2c_client *client)
@@ -42,7 +42,8 @@ static int zl3073x_spi_probe(struct spi_device *spidev)
spi_set_drvdata(spidev, zldev);
- return zl3073x_dev_init(zldev);
+ /* Initialize device and use SPI chip select value as dev ID */
+ return zl3073x_dev_init(zldev, spi_get_chipselect(spidev, 0));
}
static void zl3073x_spi_remove(struct spi_device *spidev)
@@ -6,7 +6,7 @@
#include <linux/mfd/zl3073x.h>
struct zl3073x_dev *zl3073x_dev_alloc(struct device *dev);
-int zl3073x_dev_init(struct zl3073x_dev *zldev);
+int zl3073x_dev_init(struct zl3073x_dev *zldev, u8 dev_id);
void zl3073x_dev_exit(struct zl3073x_dev *zldev);
const struct regmap_config *zl3073x_get_regmap_config(void);
@@ -9,6 +9,7 @@
struct zl3073x_dev {
struct device *dev;
struct regmap *regmap;
+ u64 clock_id;
struct mutex lock;
};