diff options
author | a0220410 | 2016-09-08 20:43:04 -0500 |
---|---|---|
committer | a0220410 | 2016-09-08 20:43:04 -0500 |
commit | 61dd2fb4e715e320ab3ad41bf48a84863a815212 (patch) | |
tree | 82205009e7d2ab910d9445f22261f78a27f64096 | |
parent | 02ee71336b12b9ae2efa537ba44f78afcb83b816 (diff) | |
download | tas2560-stereo-android-driver-61dd2fb4e715e320ab3ad41bf48a84863a815212.tar.gz tas2560-stereo-android-driver-61dd2fb4e715e320ab3ad41bf48a84863a815212.tar.xz tas2560-stereo-android-driver-61dd2fb4e715e320ab3ad41bf48a84863a815212.zip |
disable the old ALSA command and add 30ms delay for powering down device
-rwxr-xr-x | tas2560-codec.c | 25 | ||||
-rwxr-xr-x | tas2560-core.c | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tas2560-codec.c b/tas2560-codec.c index 0ddda50..695c8be 100755 --- a/tas2560-codec.c +++ b/tas2560-codec.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include "tas2560-core.h" | 50 | #include "tas2560-core.h" |
51 | 51 | ||
52 | #define TAS2560_MDELAY 0xFFFFFFFE | 52 | #define TAS2560_MDELAY 0xFFFFFFFE |
53 | #define KCONTROL_CODEC | ||
53 | 54 | ||
54 | #define MAX_CLIENTS 8 | 55 | #define MAX_CLIENTS 8 |
55 | static struct i2c_client *g_client[MAX_CLIENTS]; | 56 | static struct i2c_client *g_client[MAX_CLIENTS]; |
@@ -268,7 +269,11 @@ static int tas2560_codec_remove(struct snd_soc_codec *codec) | |||
268 | static int tas2560_get_load(struct snd_kcontrol *pKcontrol, | 269 | static int tas2560_get_load(struct snd_kcontrol *pKcontrol, |
269 | struct snd_ctl_elem_value *pUcontrol) | 270 | struct snd_ctl_elem_value *pUcontrol) |
270 | { | 271 | { |
272 | #ifdef KCONTROL_CODEC | ||
273 | struct snd_soc_codec *pCodec = snd_soc_kcontrol_codec(pKcontrol); | ||
274 | #else | ||
271 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); | 275 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); |
276 | #endif | ||
272 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); | 277 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); |
273 | 278 | ||
274 | pUcontrol->value.integer.value[0] = pTAS2560->mnLoad; | 279 | pUcontrol->value.integer.value[0] = pTAS2560->mnLoad; |
@@ -279,7 +284,11 @@ static int tas2560_get_load(struct snd_kcontrol *pKcontrol, | |||
279 | static int tas2560_set_load(struct snd_kcontrol *pKcontrol, | 284 | static int tas2560_set_load(struct snd_kcontrol *pKcontrol, |
280 | struct snd_ctl_elem_value *pUcontrol) | 285 | struct snd_ctl_elem_value *pUcontrol) |
281 | { | 286 | { |
287 | #ifdef KCONTROL_CODEC | ||
288 | struct snd_soc_codec *pCodec = snd_soc_kcontrol_codec(pKcontrol); | ||
289 | #else | ||
282 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); | 290 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); |
291 | #endif | ||
283 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); | 292 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); |
284 | 293 | ||
285 | pTAS2560->mnLoad = pUcontrol->value.integer.value[0]; | 294 | pTAS2560->mnLoad = pUcontrol->value.integer.value[0]; |
@@ -293,7 +302,11 @@ static int tas2560_set_load(struct snd_kcontrol *pKcontrol, | |||
293 | static int tas2560_get_Sampling_Rate(struct snd_kcontrol *pKcontrol, | 302 | static int tas2560_get_Sampling_Rate(struct snd_kcontrol *pKcontrol, |
294 | struct snd_ctl_elem_value *pUcontrol) | 303 | struct snd_ctl_elem_value *pUcontrol) |
295 | { | 304 | { |
305 | #ifdef KCONTROL_CODEC | ||
306 | struct snd_soc_codec *pCodec = snd_soc_kcontrol_codec(pKcontrol); | ||
307 | #else | ||
296 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); | 308 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); |
309 | #endif | ||
297 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); | 310 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); |
298 | 311 | ||
299 | pUcontrol->value.integer.value[0] = pTAS2560->mnSamplingRate; | 312 | pUcontrol->value.integer.value[0] = pTAS2560->mnSamplingRate; |
@@ -305,7 +318,11 @@ static int tas2560_get_Sampling_Rate(struct snd_kcontrol *pKcontrol, | |||
305 | static int tas2560_set_Sampling_Rate(struct snd_kcontrol *pKcontrol, | 318 | static int tas2560_set_Sampling_Rate(struct snd_kcontrol *pKcontrol, |
306 | struct snd_ctl_elem_value *pUcontrol) | 319 | struct snd_ctl_elem_value *pUcontrol) |
307 | { | 320 | { |
321 | #ifdef KCONTROL_CODEC | ||
322 | struct snd_soc_codec *pCodec = snd_soc_kcontrol_codec(pKcontrol); | ||
323 | #else | ||
308 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); | 324 | struct snd_soc_codec *pCodec = snd_kcontrol_chip(pKcontrol); |
325 | #endif | ||
309 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); | 326 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(pCodec); |
310 | 327 | ||
311 | int sampleRate = pUcontrol->value.integer.value[0]; | 328 | int sampleRate = pUcontrol->value.integer.value[0]; |
@@ -318,7 +335,11 @@ static int tas2560_set_Sampling_Rate(struct snd_kcontrol *pKcontrol, | |||
318 | static int tas2560_power_ctrl_get(struct snd_kcontrol *pKcontrol, | 335 | static int tas2560_power_ctrl_get(struct snd_kcontrol *pKcontrol, |
319 | struct snd_ctl_elem_value *pValue) | 336 | struct snd_ctl_elem_value *pValue) |
320 | { | 337 | { |
338 | #ifdef KCONTROL_CODEC | ||
339 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol); | ||
340 | #else | ||
321 | struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol); | 341 | struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol); |
342 | #endif | ||
322 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(codec); | 343 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(codec); |
323 | 344 | ||
324 | pValue->value.integer.value[0] = pTAS2560->mbPowerUp; | 345 | pValue->value.integer.value[0] = pTAS2560->mbPowerUp; |
@@ -331,7 +352,11 @@ static int tas2560_power_ctrl_get(struct snd_kcontrol *pKcontrol, | |||
331 | static int tas2560_power_ctrl_put(struct snd_kcontrol *pKcontrol, | 352 | static int tas2560_power_ctrl_put(struct snd_kcontrol *pKcontrol, |
332 | struct snd_ctl_elem_value *pValue) | 353 | struct snd_ctl_elem_value *pValue) |
333 | { | 354 | { |
355 | #ifdef KCONTROL_CODEC | ||
356 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(pKcontrol); | ||
357 | #else | ||
334 | struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol); | 358 | struct snd_soc_codec *codec = snd_kcontrol_chip(pKcontrol); |
359 | #endif | ||
335 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(codec); | 360 | struct tas2560_priv *pTAS2560 = snd_soc_codec_get_drvdata(codec); |
336 | 361 | ||
337 | int bPowerUp = pValue->value.integer.value[0]; | 362 | int bPowerUp = pValue->value.integer.value[0]; |
diff --git a/tas2560-core.c b/tas2560-core.c index f2622fd..b4eb7c8 100755 --- a/tas2560-core.c +++ b/tas2560-core.c | |||
@@ -637,6 +637,7 @@ void tas2560_enable(struct tas2560_priv *pTAS2560, bool bEnable) | |||
637 | dev_dbg(pTAS2560->dev,"%s power down\n",__func__); | 637 | dev_dbg(pTAS2560->dev,"%s power down\n",__func__); |
638 | pTAS2560->update_bits(pTAS2560, channel_both, TAS2560_PWR_REG, | 638 | pTAS2560->update_bits(pTAS2560, channel_both, TAS2560_PWR_REG, |
639 | TAS2560_PWR_BIT_MASK,0); | 639 | TAS2560_PWR_BIT_MASK,0); |
640 | mdelay(30); | ||
640 | pTAS2560->mbPowerUp = false; | 641 | pTAS2560->mbPowerUp = false; |
641 | } | 642 | } |
642 | } | 643 | } |