WM8580-I2C控制注册到总线,设备驱动中probe失败
# cd devices
# ls
i2c-0
0-0066
i2c-1
1-003a
i2c-2
2-001b
如上可以看到I2C-2 中的001B对应
/* I2C0 */
static struct i2c_board_info i2c_devs2[] __initdata = {
#ifdef CONFIG_SND_SOC_WM8580
{
I2C_BOARD_INFO("wm8580", 0x1b),
},
#endif
};
然后 i2c_register_board_info(2, i2c_devs2, ARRAY_SIZE(i2c_devs2));注册到平台。。
原先默认是用I2C-0这路的,现在我只想换到I2C--2这路。
结果WM8580.C下面
static int wm8580_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct wm8580_priv *wm8580;
struct snd_soc_codec *codec;
wm8580 = kzalloc(sizeof(struct wm8580_priv), GFP_KERNEL);
if (wm8580 == NULL)
return -ENOMEM;
codec = &wm8580->codec;
i2c_set_clientdata(i2c, wm8580);
codec->control_data = i2c;
printk("i2c1 = %d\n",i2c);
codec->dev = &i2c->dev;
return wm8580_register(wm8580, SND_SOC_I2C);}
wm8580_register注册失败
/* Get the codec into a known state */
ret = snd_soc_write(codec, WM8580_RESET, 0);
if (ret != 0) {
dev_err(codec->dev, "Failed to reset codec: %d\n", ret);
goto err_regulator_enable;
}
哪里还要设置吗?
设备驱动中怎么知道是从I2C-0还是I2C-2去找我的8580呢?。。。