adau1781.c (a02001086bbfb4da35d1228bebc2f1b442db455f) | adau1781.c (dee9cec42fc9cc4635ea2f45939e443210a638f8) |
---|---|
1/* 2 * Driver for ADAU1781/ADAU1781 codec 3 * 4 * Copyright 2011-2013 Analog Devices Inc. 5 * Author: Lars-Peter Clausen <lars@metafoo.de> 6 * 7 * Licensed under the GPL-2 or later. 8 */ --- 371 unchanged lines hidden (view full) --- 380 return regmap_update_bits(adau->regmap, reg, 381 ADAU1781_INPUT_DIFFERNTIAL, val); 382} 383 384static int adau1781_codec_probe(struct snd_soc_codec *codec) 385{ 386 struct adau1781_platform_data *pdata = dev_get_platdata(codec->dev); 387 struct adau *adau = snd_soc_codec_get_drvdata(codec); | 1/* 2 * Driver for ADAU1781/ADAU1781 codec 3 * 4 * Copyright 2011-2013 Analog Devices Inc. 5 * Author: Lars-Peter Clausen <lars@metafoo.de> 6 * 7 * Licensed under the GPL-2 or later. 8 */ --- 371 unchanged lines hidden (view full) --- 380 return regmap_update_bits(adau->regmap, reg, 381 ADAU1781_INPUT_DIFFERNTIAL, val); 382} 383 384static int adau1781_codec_probe(struct snd_soc_codec *codec) 385{ 386 struct adau1781_platform_data *pdata = dev_get_platdata(codec->dev); 387 struct adau *adau = snd_soc_codec_get_drvdata(codec); |
388 const char *firmware; | |
389 int ret; 390 391 ret = adau17x1_add_widgets(codec); 392 if (ret) 393 return ret; 394 395 if (pdata) { 396 ret = adau1781_set_input_mode(adau, ADAU1781_LEFT_PGA, --- 20 unchanged lines hidden (view full) --- 417 } else { 418 ret = snd_soc_dapm_add_routes(&codec->dapm, 419 adau1781_adc_dapm_routes, 420 ARRAY_SIZE(adau1781_adc_dapm_routes)); 421 if (ret) 422 return ret; 423 } 424 | 388 int ret; 389 390 ret = adau17x1_add_widgets(codec); 391 if (ret) 392 return ret; 393 394 if (pdata) { 395 ret = adau1781_set_input_mode(adau, ADAU1781_LEFT_PGA, --- 20 unchanged lines hidden (view full) --- 416 } else { 417 ret = snd_soc_dapm_add_routes(&codec->dapm, 418 adau1781_adc_dapm_routes, 419 ARRAY_SIZE(adau1781_adc_dapm_routes)); 420 if (ret) 421 return ret; 422 } 423 |
425 switch (adau->type) { 426 case ADAU1381: 427 firmware = ADAU1381_FIRMWARE; 428 break; 429 case ADAU1781: 430 firmware = ADAU1781_FIRMWARE; 431 break; 432 default: 433 return -EINVAL; 434 } 435 | |
436 ret = adau17x1_add_routes(codec); 437 if (ret < 0) 438 return ret; 439 | 424 ret = adau17x1_add_routes(codec); 425 if (ret < 0) 426 return ret; 427 |
440 ret = adau17x1_load_firmware(adau, codec->dev, firmware); 441 if (ret) 442 dev_warn(codec->dev, "Failed to load firmware\n"); 443 | |
444 return 0; 445} 446 447static const struct snd_soc_codec_driver adau1781_codec_driver = { 448 .probe = adau1781_codec_probe, 449 .resume = adau17x1_resume, 450 .set_bias_level = adau1781_set_bias_level, 451 .suspend_bias_off = true, --- 31 unchanged lines hidden (view full) --- 483const struct regmap_config adau1781_regmap_config = { 484 .val_bits = 8, 485 .reg_bits = 16, 486 .max_register = 0x40f8, 487 .reg_defaults = adau1781_reg_defaults, 488 .num_reg_defaults = ARRAY_SIZE(adau1781_reg_defaults), 489 .readable_reg = adau1781_readable_register, 490 .volatile_reg = adau17x1_volatile_register, | 428 return 0; 429} 430 431static const struct snd_soc_codec_driver adau1781_codec_driver = { 432 .probe = adau1781_codec_probe, 433 .resume = adau17x1_resume, 434 .set_bias_level = adau1781_set_bias_level, 435 .suspend_bias_off = true, --- 31 unchanged lines hidden (view full) --- 467const struct regmap_config adau1781_regmap_config = { 468 .val_bits = 8, 469 .reg_bits = 16, 470 .max_register = 0x40f8, 471 .reg_defaults = adau1781_reg_defaults, 472 .num_reg_defaults = ARRAY_SIZE(adau1781_reg_defaults), 473 .readable_reg = adau1781_readable_register, 474 .volatile_reg = adau17x1_volatile_register, |
475 .precious_reg = adau17x1_precious_register, |
|
491 .cache_type = REGCACHE_RBTREE, 492}; 493EXPORT_SYMBOL_GPL(adau1781_regmap_config); 494 495int adau1781_probe(struct device *dev, struct regmap *regmap, 496 enum adau17x1_type type, void (*switch_mode)(struct device *dev)) 497{ | 476 .cache_type = REGCACHE_RBTREE, 477}; 478EXPORT_SYMBOL_GPL(adau1781_regmap_config); 479 480int adau1781_probe(struct device *dev, struct regmap *regmap, 481 enum adau17x1_type type, void (*switch_mode)(struct device *dev)) 482{ |
483 const char *firmware_name; |
|
498 int ret; 499 | 484 int ret; 485 |
500 ret = adau17x1_probe(dev, regmap, type, switch_mode); | 486 switch (type) { 487 case ADAU1381: 488 firmware_name = ADAU1381_FIRMWARE; 489 break; 490 case ADAU1781: 491 firmware_name = ADAU1781_FIRMWARE; 492 break; 493 default: 494 return -EINVAL; 495 } 496 497 ret = adau17x1_probe(dev, regmap, type, switch_mode, firmware_name); |
501 if (ret) 502 return ret; 503 504 return snd_soc_register_codec(dev, &adau1781_codec_driver, 505 &adau1781_dai_driver, 1); 506} 507EXPORT_SYMBOL_GPL(adau1781_probe); 508 509MODULE_DESCRIPTION("ASoC ADAU1381/ADAU1781 driver"); 510MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 511MODULE_LICENSE("GPL"); | 498 if (ret) 499 return ret; 500 501 return snd_soc_register_codec(dev, &adau1781_codec_driver, 502 &adau1781_dai_driver, 1); 503} 504EXPORT_SYMBOL_GPL(adau1781_probe); 505 506MODULE_DESCRIPTION("ASoC ADAU1381/ADAU1781 driver"); 507MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 508MODULE_LICENSE("GPL"); |