aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Austin <brian.austin@cirrus.com>2013-10-25 11:01:14 -0400
committerMark Brown <broonie@linaro.org>2013-10-25 11:37:58 -0400
commit6dd17757927ba9d23c604fee6fe72b4755c7ea7f (patch)
treede40e4d181b47784c4dd108fc569d5177d649443
parent31d141e3a666269a3b6fcccddb0351caf7454240 (diff)
ASoC: cs42l52: Add platform data for reset gpio
This patch adds platform data support for a reset GPIO. Also uses reset_gpio to toggle reset of the CODEC Signed-off-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--include/sound/cs42l52.h2
-rw-r--r--sound/soc/codecs/cs42l52.c21
2 files changed, 19 insertions, 4 deletions
diff --git a/include/sound/cs42l52.h b/include/sound/cs42l52.h
index 4c68955f7330..7c2be4a51894 100644
--- a/include/sound/cs42l52.h
+++ b/include/sound/cs42l52.h
@@ -31,6 +31,8 @@ struct cs42l52_platform_data {
31 /* Charge Pump Freq. Check datasheet Pg73 */ 31 /* Charge Pump Freq. Check datasheet Pg73 */
32 unsigned int chgfreq; 32 unsigned int chgfreq;
33 33
34 /* Reset GPIO */
35 unsigned int reset_gpio;
34}; 36};
35 37
36#endif /* __CS42L52_H */ 38#endif /* __CS42L52_H */
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index be2ba1b6fe4a..8367f3c571eb 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/gpio.h>
20#include <linux/pm.h> 21#include <linux/pm.h>
21#include <linux/i2c.h> 22#include <linux/i2c.h>
22#include <linux/input.h> 23#include <linux/input.h>
@@ -1205,6 +1206,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
1205 const struct i2c_device_id *id) 1206 const struct i2c_device_id *id)
1206{ 1207{
1207 struct cs42l52_private *cs42l52; 1208 struct cs42l52_private *cs42l52;
1209 struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
1208 int ret; 1210 int ret;
1209 unsigned int devid = 0; 1211 unsigned int devid = 0;
1210 unsigned int reg; 1212 unsigned int reg;
@@ -1222,11 +1224,22 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
1222 return ret; 1224 return ret;
1223 } 1225 }
1224 1226
1225 i2c_set_clientdata(i2c_client, cs42l52); 1227 if (pdata)
1228 cs42l52->pdata = *pdata;
1226 1229
1227 if (dev_get_platdata(&i2c_client->dev)) 1230 if (cs42l52->pdata.reset_gpio) {
1228 memcpy(&cs42l52->pdata, dev_get_platdata(&i2c_client->dev), 1231 ret = gpio_request_one(cs42l52->pdata.reset_gpio,
1229 sizeof(cs42l52->pdata)); 1232 GPIOF_OUT_INIT_HIGH, "CS42L52 /RST");
1233 if (ret < 0) {
1234 dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n",
1235 cs42l52->pdata.reset_gpio, ret);
1236 return ret;
1237 }
1238 gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 0);
1239 gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 1);
1240 }
1241
1242 i2c_set_clientdata(i2c_client, cs42l52);
1230 1243
1231 ret = regmap_register_patch(cs42l52->regmap, cs42l52_threshold_patch, 1244 ret = regmap_register_patch(cs42l52->regmap, cs42l52_threshold_patch,
1232 ARRAY_SIZE(cs42l52_threshold_patch)); 1245 ARRAY_SIZE(cs42l52_threshold_patch));