diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-07-29 11:27:18 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-08-02 03:10:38 -0400 |
commit | eaefb38f344d12321cd5372d1c8ad35d264d1b35 (patch) | |
tree | 4f3c887f9262f7a31788119e54b497f32db7b22d /sound/soc/codecs/wm1250-ev1.c | |
parent | c56c5d08e121d103adc026df112ed11ee3a8d1d1 (diff) |
ASoC: Parse board ID/revision information from WM1250-EV1 board
The WM1250-EV1 board has an ID chip on it, check the board ID and display
the board revision during startup.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/codecs/wm1250-ev1.c')
-rw-r--r-- | sound/soc/codecs/wm1250-ev1.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c index bcc208967917..bbcf9ec34759 100644 --- a/sound/soc/codecs/wm1250-ev1.c +++ b/sound/soc/codecs/wm1250-ev1.c | |||
@@ -56,8 +56,26 @@ static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | static int __devinit wm1250_ev1_probe(struct i2c_client *i2c, | 58 | static int __devinit wm1250_ev1_probe(struct i2c_client *i2c, |
59 | const struct i2c_device_id *id) | 59 | const struct i2c_device_id *i2c_id) |
60 | { | 60 | { |
61 | int ret, id, board, rev; | ||
62 | |||
63 | board = i2c_smbus_read_byte_data(i2c, 0); | ||
64 | if (board < 0) { | ||
65 | dev_err(&i2c->dev, "Failed to read ID: %d\n", ret); | ||
66 | return ret; | ||
67 | } | ||
68 | |||
69 | id = (board & 0xfe) >> 2; | ||
70 | rev = board & 0x3; | ||
71 | |||
72 | if (id != 1) { | ||
73 | dev_err(&i2c->dev, "Unknown board ID %d\n", id); | ||
74 | return -ENODEV; | ||
75 | } | ||
76 | |||
77 | dev_info(&i2c->dev, "revision %d\n", rev); | ||
78 | |||
61 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm1250_ev1, | 79 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm1250_ev1, |
62 | &wm1250_ev1_dai, 1); | 80 | &wm1250_ev1_dai, 1); |
63 | } | 81 | } |