aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/adau1781.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-11-19 12:29:05 -0500
committerMark Brown <broonie@kernel.org>2014-11-20 04:55:34 -0500
commitd48b088e3ec45eeccf0fce0b75378e41428f47e9 (patch)
tree2a81e6d82c6aeeaf35620938f4079d290748b4bf /sound/soc/codecs/adau1781.c
parent6b25730f68073ee95079d241ea6aa7be00805254 (diff)
ASoC: sigmadsp: Restructure in preparation for fw v2 support
The v2 file format of the SigmaDSP takes a more declarative style compared to the imperative style of the v1 format. In addition some features that are supported with v2 require the driver to keep state around for the firmware. This requires a bit of restructuring of both the firmware loader itself and the drivers making use of the firmware loader. Instead of loading and executing the firmware in place when the DSP is configured the firmware is now loaded at driver probe time. This is required since the new firmware format will in addition to the firmware data itself contain meta information describing the firmware and its requirements and capabilities. Those will for example be used to restrict the supported samplerates advertised by the driver to userspace to the list of samplerates supported for the firmware. This only does the restructuring required by the v2 format, but does not yet add support for the new format itself. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/adau1781.c')
-rw-r--r--sound/soc/codecs/adau1781.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/sound/soc/codecs/adau1781.c b/sound/soc/codecs/adau1781.c
index e9fc00fb13dd..4c8ddc3c69e1 100644
--- a/sound/soc/codecs/adau1781.c
+++ b/sound/soc/codecs/adau1781.c
@@ -385,7 +385,6 @@ static int adau1781_codec_probe(struct snd_soc_codec *codec)
385{ 385{
386 struct adau1781_platform_data *pdata = dev_get_platdata(codec->dev); 386 struct adau1781_platform_data *pdata = dev_get_platdata(codec->dev);
387 struct adau *adau = snd_soc_codec_get_drvdata(codec); 387 struct adau *adau = snd_soc_codec_get_drvdata(codec);
388 const char *firmware;
389 int ret; 388 int ret;
390 389
391 ret = adau17x1_add_widgets(codec); 390 ret = adau17x1_add_widgets(codec);
@@ -422,25 +421,10 @@ static int adau1781_codec_probe(struct snd_soc_codec *codec)
422 return ret; 421 return ret;
423 } 422 }
424 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); 424 ret = adau17x1_add_routes(codec);
437 if (ret < 0) 425 if (ret < 0)
438 return ret; 426 return ret;
439 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; 428 return 0;
445} 429}
446 430
@@ -495,9 +479,21 @@ EXPORT_SYMBOL_GPL(adau1781_regmap_config);
495int adau1781_probe(struct device *dev, struct regmap *regmap, 479int adau1781_probe(struct device *dev, struct regmap *regmap,
496 enum adau17x1_type type, void (*switch_mode)(struct device *dev)) 480 enum adau17x1_type type, void (*switch_mode)(struct device *dev))
497{ 481{
482 const char *firmware_name;
498 int ret; 483 int ret;
499 484
500 ret = adau17x1_probe(dev, regmap, type, switch_mode); 485 switch (type) {
486 case ADAU1381:
487 firmware_name = ADAU1381_FIRMWARE;
488 break;
489 case ADAU1781:
490 firmware_name = ADAU1781_FIRMWARE;
491 break;
492 default:
493 return -EINVAL;
494 }
495
496 ret = adau17x1_probe(dev, regmap, type, switch_mode, firmware_name);
501 if (ret) 497 if (ret)
502 return ret; 498 return ret;
503 499