mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe()
Add enum aic32x4_type to aic32x4_probe() and drop using dev_set_drvdata() from tlv320aic32x4_{i2c,spi} drivers. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230831194622.87653-2-biju.das.jz@bp.renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
0bb80ecc33
commit
cac1636e21
@ -23,6 +23,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c)
|
|||||||
{
|
{
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
struct regmap_config config;
|
struct regmap_config config;
|
||||||
|
enum aic32x4_type type;
|
||||||
|
|
||||||
config = aic32x4_regmap_config;
|
config = aic32x4_regmap_config;
|
||||||
config.reg_bits = 8;
|
config.reg_bits = 8;
|
||||||
@ -34,15 +35,15 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c)
|
|||||||
const struct of_device_id *oid;
|
const struct of_device_id *oid;
|
||||||
|
|
||||||
oid = of_match_node(aic32x4_of_id, i2c->dev.of_node);
|
oid = of_match_node(aic32x4_of_id, i2c->dev.of_node);
|
||||||
dev_set_drvdata(&i2c->dev, (void *)oid->data);
|
type = (uintptr_t)oid->data;
|
||||||
} else {
|
} else {
|
||||||
const struct i2c_device_id *id;
|
const struct i2c_device_id *id;
|
||||||
|
|
||||||
id = i2c_match_id(aic32x4_i2c_id, i2c);
|
id = i2c_match_id(aic32x4_i2c_id, i2c);
|
||||||
dev_set_drvdata(&i2c->dev, (void *)id->driver_data);
|
type = id->driver_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aic32x4_probe(&i2c->dev, regmap);
|
return aic32x4_probe(&i2c->dev, regmap, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aic32x4_i2c_remove(struct i2c_client *i2c)
|
static void aic32x4_i2c_remove(struct i2c_client *i2c)
|
||||||
|
@ -22,6 +22,7 @@ static int aic32x4_spi_probe(struct spi_device *spi)
|
|||||||
{
|
{
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
struct regmap_config config;
|
struct regmap_config config;
|
||||||
|
enum aic32x4_type type;
|
||||||
|
|
||||||
config = aic32x4_regmap_config;
|
config = aic32x4_regmap_config;
|
||||||
config.reg_bits = 7;
|
config.reg_bits = 7;
|
||||||
@ -35,15 +36,15 @@ static int aic32x4_spi_probe(struct spi_device *spi)
|
|||||||
const struct of_device_id *oid;
|
const struct of_device_id *oid;
|
||||||
|
|
||||||
oid = of_match_node(aic32x4_of_id, spi->dev.of_node);
|
oid = of_match_node(aic32x4_of_id, spi->dev.of_node);
|
||||||
dev_set_drvdata(&spi->dev, (void *)oid->data);
|
type = (uintptr_t)oid->data;
|
||||||
} else {
|
} else {
|
||||||
const struct spi_device_id *id_entry;
|
const struct spi_device_id *id_entry;
|
||||||
|
|
||||||
id_entry = spi_get_device_id(spi);
|
id_entry = spi_get_device_id(spi);
|
||||||
dev_set_drvdata(&spi->dev, (void *)id_entry->driver_data);
|
type = id_entry->driver_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aic32x4_probe(&spi->dev, regmap);
|
return aic32x4_probe(&spi->dev, regmap, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void aic32x4_spi_remove(struct spi_device *spi)
|
static void aic32x4_spi_remove(struct spi_device *spi)
|
||||||
|
@ -1333,7 +1333,8 @@ static int aic32x4_setup_regulators(struct device *dev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aic32x4_probe(struct device *dev, struct regmap *regmap)
|
int aic32x4_probe(struct device *dev, struct regmap *regmap,
|
||||||
|
enum aic32x4_type type)
|
||||||
{
|
{
|
||||||
struct aic32x4_priv *aic32x4;
|
struct aic32x4_priv *aic32x4;
|
||||||
struct aic32x4_pdata *pdata = dev->platform_data;
|
struct aic32x4_pdata *pdata = dev->platform_data;
|
||||||
@ -1349,7 +1350,7 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
aic32x4->dev = dev;
|
aic32x4->dev = dev;
|
||||||
aic32x4->type = (uintptr_t)dev_get_drvdata(dev);
|
aic32x4->type = type;
|
||||||
|
|
||||||
dev_set_drvdata(dev, aic32x4);
|
dev_set_drvdata(dev, aic32x4);
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ enum aic32x4_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern const struct regmap_config aic32x4_regmap_config;
|
extern const struct regmap_config aic32x4_regmap_config;
|
||||||
int aic32x4_probe(struct device *dev, struct regmap *regmap);
|
int aic32x4_probe(struct device *dev, struct regmap *regmap,
|
||||||
|
enum aic32x4_type type);
|
||||||
void aic32x4_remove(struct device *dev);
|
void aic32x4_remove(struct device *dev);
|
||||||
int aic32x4_register_clocks(struct device *dev, const char *mclk_name);
|
int aic32x4_register_clocks(struct device *dev, const char *mclk_name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user