ASoC: tlv320aic3x: Use driver_data field of struct i2c_device_id to identify models
Save model information in driver_data so we can simplify the implementation. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
@@ -1493,9 +1493,9 @@ static struct snd_soc_codec_driver soc_codec_dev_aic3x = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static const struct i2c_device_id aic3x_i2c_id[] = {
|
static const struct i2c_device_id aic3x_i2c_id[] = {
|
||||||
[AIC3X_MODEL_3X] = { "tlv320aic3x", 0 },
|
{ "tlv320aic3x", AIC3X_MODEL_3X },
|
||||||
[AIC3X_MODEL_33] = { "tlv320aic33", 0 },
|
{ "tlv320aic33", AIC3X_MODEL_33 },
|
||||||
[AIC3X_MODEL_3007] = { "tlv320aic3007", 0 },
|
{ "tlv320aic3007", AIC3X_MODEL_3007 },
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id);
|
MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id);
|
||||||
@@ -1510,7 +1510,6 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
|
|||||||
struct aic3x_pdata *pdata = i2c->dev.platform_data;
|
struct aic3x_pdata *pdata = i2c->dev.platform_data;
|
||||||
struct aic3x_priv *aic3x;
|
struct aic3x_priv *aic3x;
|
||||||
int ret;
|
int ret;
|
||||||
const struct i2c_device_id *tbl;
|
|
||||||
|
|
||||||
aic3x = kzalloc(sizeof(struct aic3x_priv), GFP_KERNEL);
|
aic3x = kzalloc(sizeof(struct aic3x_priv), GFP_KERNEL);
|
||||||
if (aic3x == NULL) {
|
if (aic3x == NULL) {
|
||||||
@@ -1528,11 +1527,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
|
|||||||
aic3x->gpio_reset = -1;
|
aic3x->gpio_reset = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (tbl = aic3x_i2c_id; tbl->name[0]; tbl++) {
|
aic3x->model = id->driver_data;
|
||||||
if (!strcmp(tbl->name, id->name))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
aic3x->model = tbl - aic3x_i2c_id;
|
|
||||||
|
|
||||||
ret = snd_soc_register_codec(&i2c->dev,
|
ret = snd_soc_register_codec(&i2c->dev,
|
||||||
&soc_codec_dev_aic3x, &aic3x_dai, 1);
|
&soc_codec_dev_aic3x, &aic3x_dai, 1);
|
||||||
|
Reference in New Issue
Block a user