diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-13 08:43:01 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-20 08:58:20 -0500 |
commit | 391d9e4e5ce50bf14400ed04d13821e7b56e84f7 (patch) | |
tree | f4a65cf76a3bcc1555acf6d30aa8d1aa918e7a1d /sound/soc/codecs/wm9090.c | |
parent | ec2c0fec11f072222b63eb160da6be01773bfe65 (diff) |
ASoC: Move WM9090 device identification and reset to I2C probe
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm9090.c')
-rw-r--r-- | sound/soc/codecs/wm9090.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c index 4be5551f06a0..a2b9208a08f0 100644 --- a/sound/soc/codecs/wm9090.c +++ b/sound/soc/codecs/wm9090.c | |||
@@ -532,18 +532,6 @@ static int wm9090_probe(struct snd_soc_codec *codec) | |||
532 | return ret; | 532 | return ret; |
533 | } | 533 | } |
534 | 534 | ||
535 | ret = snd_soc_read(codec, WM9090_SOFTWARE_RESET); | ||
536 | if (ret < 0) | ||
537 | return ret; | ||
538 | if (ret != 0x9093) { | ||
539 | dev_err(codec->dev, "Device is not a WM9090, ID=%x\n", ret); | ||
540 | return -EINVAL; | ||
541 | } | ||
542 | |||
543 | ret = snd_soc_write(codec, WM9090_SOFTWARE_RESET, 0); | ||
544 | if (ret < 0) | ||
545 | return ret; | ||
546 | |||
547 | /* Configure some defaults; they will be written out when we | 535 | /* Configure some defaults; they will be written out when we |
548 | * bring the bias up. | 536 | * bring the bias up. |
549 | */ | 537 | */ |
@@ -631,6 +619,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c, | |||
631 | const struct i2c_device_id *id) | 619 | const struct i2c_device_id *id) |
632 | { | 620 | { |
633 | struct wm9090_priv *wm9090; | 621 | struct wm9090_priv *wm9090; |
622 | unsigned int reg; | ||
634 | int ret; | 623 | int ret; |
635 | 624 | ||
636 | wm9090 = devm_kzalloc(&i2c->dev, sizeof(*wm9090), GFP_KERNEL); | 625 | wm9090 = devm_kzalloc(&i2c->dev, sizeof(*wm9090), GFP_KERNEL); |
@@ -646,6 +635,19 @@ static int wm9090_i2c_probe(struct i2c_client *i2c, | |||
646 | return ret; | 635 | return ret; |
647 | } | 636 | } |
648 | 637 | ||
638 | ret = regmap_read(wm9090->regmap, WM9090_SOFTWARE_RESET, ®); | ||
639 | if (ret < 0) | ||
640 | goto err; | ||
641 | if (reg != 0x9093) { | ||
642 | dev_err(&i2c->dev, "Device is not a WM9090, ID=%x\n", ret); | ||
643 | ret = -ENODEV; | ||
644 | goto err; | ||
645 | } | ||
646 | |||
647 | ret = regmap_write(wm9090->regmap, WM9090_SOFTWARE_RESET, 0); | ||
648 | if (ret < 0) | ||
649 | goto err; | ||
650 | |||
649 | if (i2c->dev.platform_data) | 651 | if (i2c->dev.platform_data) |
650 | memcpy(&wm9090->pdata, i2c->dev.platform_data, | 652 | memcpy(&wm9090->pdata, i2c->dev.platform_data, |
651 | sizeof(wm9090->pdata)); | 653 | sizeof(wm9090->pdata)); |