| OLD | NEW |
| 1 /* | 1 /* |
| 2 * File: sound/soc/blackfin/bf5xx-tdm.c | 2 * File: sound/soc/blackfin/bf5xx-tdm.c |
| 3 * Author: Barry Song <Barry.Song@analog.com> | 3 * Author: Barry Song <Barry.Song@analog.com> |
| 4 * | 4 * |
| 5 * Created: Thurs June 04 2009 | 5 * Created: Thurs June 04 2009 |
| 6 * Description: Blackfin I2S(TDM) CPU DAI driver | 6 * Description: Blackfin I2S(TDM) CPU DAI driver |
| 7 * Even though TDM mode can be as part of I2S DAI, but there | 7 * Even though TDM mode can be as part of I2S DAI, but there |
| 8 * are so much difference in configuration and data flow, | 8 * are so much difference in configuration and data flow, |
| 9 * it's very ugly to integrate I2S and TDM into a module | 9 * it's very ugly to integrate I2S and TDM into a module |
| 10 * | 10 * |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } else | 203 } else |
| 204 return -EINVAL; | 204 return -EINVAL; |
| 205 } | 205 } |
| 206 | 206 |
| 207 return 0; | 207 return 0; |
| 208 } | 208 } |
| 209 | 209 |
| 210 #ifdef CONFIG_PM | 210 #ifdef CONFIG_PM |
| 211 static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) | 211 static int bf5xx_tdm_suspend(struct snd_soc_dai *dai) |
| 212 { | 212 { |
| 213 » struct sport_device *sport = dai->private_data; | 213 » struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
| 214 | 214 |
| 215 if (!dai->active) | 215 if (!dai->active) |
| 216 return 0; | 216 return 0; |
| 217 if (dai->capture_active) | 217 if (dai->capture_active) |
| 218 sport_rx_stop(sport); | 218 sport_rx_stop(sport); |
| 219 if (dai->playback_active) | 219 if (dai->playback_active) |
| 220 sport_tx_stop(sport); | 220 sport_tx_stop(sport); |
| 221 return 0; | 221 return 0; |
| 222 } | 222 } |
| 223 | 223 |
| 224 static int bf5xx_tdm_resume(struct snd_soc_dai *dai) | 224 static int bf5xx_tdm_resume(struct snd_soc_dai *dai) |
| 225 { | 225 { |
| 226 int ret; | 226 int ret; |
| 227 struct sport_device *sport = snd_soc_dai_get_drvdata(dai); | 227 struct sport_device *sport = snd_soc_dai_get_drvdata(dai); |
| 228 | 228 |
| 229 if (!dai->active) | 229 if (!dai->active) |
| 230 return 0; | 230 return 0; |
| 231 | 231 |
| 232 ret = sport_set_multichannel(sport, 8, 0xFF, 1); | 232 ret = sport_set_multichannel(sport, 8, 0xFF, 1); |
| 233 if (ret) { | 233 if (ret) { |
| 234 pr_err("SPORT is busy!\n"); | 234 pr_err("SPORT is busy!\n"); |
| 235 ret = -EBUSY; | 235 ret = -EBUSY; |
| 236 } | 236 } |
| 237 | 237 |
| 238 » ret = sport_config_rx(sport, IRFS, 0x1F, 0, 0); | 238 » ret = sport_config_rx(sport, 0, 0x1F, 0, 0); |
| 239 if (ret) { | 239 if (ret) { |
| 240 pr_err("SPORT is busy!\n"); | 240 pr_err("SPORT is busy!\n"); |
| 241 ret = -EBUSY; | 241 ret = -EBUSY; |
| 242 } | 242 } |
| 243 | 243 |
| 244 » ret = sport_config_tx(sport, ITFS, 0x1F, 0, 0); | 244 » ret = sport_config_tx(sport, 0, 0x1F, 0, 0); |
| 245 if (ret) { | 245 if (ret) { |
| 246 pr_err("SPORT is busy!\n"); | 246 pr_err("SPORT is busy!\n"); |
| 247 ret = -EBUSY; | 247 ret = -EBUSY; |
| 248 } | 248 } |
| 249 | 249 |
| 250 return 0; | 250 return 0; |
| 251 } | 251 } |
| 252 | 252 |
| 253 #else | 253 #else |
| 254 #define bf5xx_tdm_suspend NULL | 254 #define bf5xx_tdm_suspend NULL |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 | 297 |
| 298 /* SPORT works in TDM mode */ | 298 /* SPORT works in TDM mode */ |
| 299 ret = sport_set_multichannel(sport_handle, 8, 0xFF, 1); | 299 ret = sport_set_multichannel(sport_handle, 8, 0xFF, 1); |
| 300 if (ret) { | 300 if (ret) { |
| 301 pr_err("SPORT is busy!\n"); | 301 pr_err("SPORT is busy!\n"); |
| 302 ret = -EBUSY; | 302 ret = -EBUSY; |
| 303 goto sport_config_err; | 303 goto sport_config_err; |
| 304 } | 304 } |
| 305 | 305 |
| 306 » ret = sport_config_rx(sport_handle, IRFS, 0x1F, 0, 0); | 306 » ret = sport_config_rx(sport_handle, 0, 0x1F, 0, 0); |
| 307 if (ret) { | 307 if (ret) { |
| 308 pr_err("SPORT is busy!\n"); | 308 pr_err("SPORT is busy!\n"); |
| 309 ret = -EBUSY; | 309 ret = -EBUSY; |
| 310 goto sport_config_err; | 310 goto sport_config_err; |
| 311 } | 311 } |
| 312 | 312 |
| 313 » ret = sport_config_tx(sport_handle, ITFS, 0x1F, 0, 0); | 313 » ret = sport_config_tx(sport_handle, 0, 0x1F, 0, 0); |
| 314 if (ret) { | 314 if (ret) { |
| 315 pr_err("SPORT is busy!\n"); | 315 pr_err("SPORT is busy!\n"); |
| 316 ret = -EBUSY; | 316 ret = -EBUSY; |
| 317 goto sport_config_err; | 317 goto sport_config_err; |
| 318 } | 318 } |
| 319 | 319 |
| 320 ret = snd_soc_register_dai(&pdev->dev, &bf5xx_tdm_dai); | 320 ret = snd_soc_register_dai(&pdev->dev, &bf5xx_tdm_dai); |
| 321 if (ret) { | 321 if (ret) { |
| 322 pr_err("Failed to register DAI: %d\n", ret); | 322 pr_err("Failed to register DAI: %d\n", ret); |
| 323 goto sport_config_err; | 323 goto sport_config_err; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 { | 358 { |
| 359 platform_driver_unregister(&bfin_tdm_driver); | 359 platform_driver_unregister(&bfin_tdm_driver); |
| 360 } | 360 } |
| 361 module_exit(bfin_tdm_exit); | 361 module_exit(bfin_tdm_exit); |
| 362 | 362 |
| 363 /* Module information */ | 363 /* Module information */ |
| 364 MODULE_AUTHOR("Barry Song"); | 364 MODULE_AUTHOR("Barry Song"); |
| 365 MODULE_DESCRIPTION("TDM driver for ADI Blackfin"); | 365 MODULE_DESCRIPTION("TDM driver for ADI Blackfin"); |
| 366 MODULE_LICENSE("GPL"); | 366 MODULE_LICENSE("GPL"); |
| 367 | 367 |
| OLD | NEW |