diff --git a/sound/soc/codecs/tas5805m_20w.c b/sound/soc/codecs/tas5805m_20w.c index 7ec4cde..226fba5 100644 --- a/sound/soc/codecs/tas5805m_20w.c +++ b/sound/soc/codecs/tas5805m_20w.c @@ -29,6 +29,7 @@ #include #include #include +#include "tas5805m.h" /* Datasheet-defined registers on page 0, book 0 */ #define REG_PAGE 0x00 @@ -451,39 +452,12 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c) return PTR_ERR(tas5805m->gpio_pdn_n); } - /* This configuration must be generated by PPC3. The file loaded - * consists of a sequence of register writes, where bytes at - * even indices are register addresses and those at odd indices - * are register values. - * - * The fixed portion of PPC3's output prior to the 5ms delay - * should be omitted. - */ - if (device_property_read_string(dev, "ti,dsp-config-name", - &config_name)) - config_name = "default"; - - snprintf(filename, sizeof(filename), "tas5805m_dsp_%s.bin", - config_name); - ret = request_firmware(&fw, filename, dev); - if (ret) - return ret; - - if ((fw->size < 2) || (fw->size & 1)) { - dev_err(dev, "firmware is invalid\n"); - release_firmware(fw); - return -EINVAL; - } - - tas5805m->dsp_cfg_len = fw->size; - tas5805m->dsp_cfg_data = devm_kmalloc(dev, fw->size, GFP_KERNEL); - if (!tas5805m->dsp_cfg_data) { - release_firmware(fw); - return -ENOMEM; + ret = regmap_register_patch(regmap, tas5805m_init_sequence, ARRAY_SIZE(tas5805m_init_sequence)); + if (ret != 0) + { + dev_err(dev, "Failed to initialize TAS5805M: %d\n",ret); + goto err; } - memcpy(tas5805m->dsp_cfg_data, fw->data, fw->size); - - release_firmware(fw); /* Do the first part of the power-on here, while we can expect * the I2S interface to be quiet. We must raise PDN# and then @@ -521,6 +495,9 @@ static int tas5805m_i2c_probe(struct i2c_client *i2c) } return 0; + +err: + return ret; } static int tas5805m_i2c_remove(struct i2c_client *i2c) @@ -564,4 +541,4 @@ static int tas5805m_i2c_remove(struct i2c_client *i2c) MODULE_AUTHOR("Andy Liu "); MODULE_AUTHOR("Daniel Beer "); MODULE_DESCRIPTION("TAS5805M Audio Amplifier Driver"); -MODULE_LICENSE("GPL v2"); \ No newline at end of file +MODULE_LICENSE("GPL v2");