static int sta32x_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; }
static int __devexit lm4857_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); return 0; }
int pcm179x_common_exit(struct device *dev) { snd_soc_unregister_codec(dev); return 0; }
static __devexit int ak4642_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; }
static int msm_hdmi_audio_codec_rx_plat_remove( struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; }
static int es7134_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; }
static int __devexit cs4271_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; }
static int wm8741_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); kfree(i2c_get_clientdata(client)); return 0; }
static int iphone_wm8758_register(void) { int ret; int i; struct snd_soc_codec *codec = &priv.codec; pr_debug("ENTER iphone_wm8758_audio_probe\n"); mutex_init(&codec->mutex); INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths); codec->name = "wm8758"; codec->owner = THIS_MODULE; codec->dai = &iphone_wm8758_dai; codec->num_dai = 1; codec->reg_cache_size = ARRAY_SIZE(priv.reg_cache); codec->reg_cache = &priv.reg_cache; iphone_wm8758_dai.private_data = &priv; iphone_wm8758_dai.dev = codec->dev; memcpy(codec->reg_cache, wm8978_reg, sizeof(wm8978_reg)); ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_I2C); if (ret < 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); goto err; } ret = snd_soc_register_codec(codec); if (ret != 0) { dev_err(codec->dev, "Failed to register codec: %d\n", ret); goto err; } ret = snd_soc_register_dai(&iphone_wm8758_dai); if (ret != 0) { dev_err(codec->dev, "Failed to register DAI: %d\n", ret); snd_soc_unregister_codec(codec); goto err_codec; } priv.bb_volume_cache[2] = 100; priv.bb_volume_cache[0] = 68; snd_soc_write(codec, RESET, 0x1ff); /* Reset */ snd_soc_write(codec, LOUT1VOL, 0xc0); snd_soc_write(codec, ROUT1VOL, 0x1c0); snd_soc_write(codec, LOUT2VOL, 0xb9); snd_soc_write(codec, ROUT2VOL, 0x1b9); snd_soc_write(codec, BIASCTL, 0x100); /* BIASCUT = 1 */ snd_soc_write(codec, PWRMGMT1, 0x2d); /* BIASEN = 1, PLLEN = 1, BUFIOEN = 1, VMIDSEL = 1 */ snd_soc_write(codec, PWRMGMT2, 0x180); snd_soc_write(codec, PWRMGMT3, 0x6f); snd_soc_write(codec, AINTFCE, 0x10); /* 16-bit, I2S format */ snd_soc_write(codec, COMPAND, 0x0); snd_soc_write(codec, CLKGEN, 0x14d); snd_soc_write(codec, SRATECTRL, 0x0); snd_soc_write(codec, GPIOCTL, 0x0); snd_soc_write(codec, JACKDETECT0, 0x0); snd_soc_write(codec, DACCTRL, 0x3); snd_soc_write(codec, LDACVOL, 0xff); snd_soc_write(codec, RDACVOL, 0x1ff); snd_soc_write(codec, JACKDETECT1, 0x0); snd_soc_write(codec, ADCCTL, 0x0); snd_soc_write(codec, LADCVOL, 0xff); snd_soc_write(codec, RADCVOL, 0xff); snd_soc_write(codec, EQ1, 0x12c); snd_soc_write(codec, EQ2, 0x2c); snd_soc_write(codec, EQ3, 0x2c); snd_soc_write(codec, EQ4, 0x2c); snd_soc_write(codec, EQ5, 0x2c); snd_soc_write(codec, DACLIMIT1, 0x32); snd_soc_write(codec, DACLIMIT2, 0x0); snd_soc_write(codec, NOTCH1, 0x0); snd_soc_write(codec, NOTCH2, 0x0); snd_soc_write(codec, NOTCH3, 0x0); snd_soc_write(codec, NOTCH4, 0x0); snd_soc_write(codec, PLLN, 0xa); snd_soc_write(codec, PLLK1, 0x1); snd_soc_write(codec, PLLK2, 0x1fd); snd_soc_write(codec, PLLK3, 0x1e8); snd_soc_write(codec, THREEDCTL, 0x0); snd_soc_write(codec, OUT4ADC, 0x0); snd_soc_write(codec, BEEPCTRL, 0x0); snd_soc_write(codec, INCTRL, 0x0); snd_soc_write(codec, LINPGAGAIN, 0x40); snd_soc_write(codec, RINPGAGAIN, 0x140); snd_soc_write(codec, LADCBOOST, 0x0); snd_soc_write(codec, RADCBOOST, 0x0); snd_soc_write(codec, OUTCTRL, 0x186); /* Thermal shutdown, DACL2RMIX = 1, DACR2LMIX = 1, SPKBOOST = 1 */ snd_soc_write(codec, LOUTMIX, 0x15); snd_soc_write(codec, ROUTMIX, 0x15); snd_soc_write(codec, OUT3MIX, 0x40); snd_soc_write(codec, OUT4MIX, 0x40); snd_soc_write(codec, WMREG_3E, 0x8c90); for (i = 0; i < ARRAY_SIZE(update_reg); i++) ((u16 *)codec->reg_cache)[update_reg[i]] |= 0x100; dev_info(codec->dev, "DAI and codec registered\n"); return 0; err_codec: snd_soc_unregister_codec(codec); err: return ret; }
static int wm8961_register(struct wm8961_priv *wm8961) { struct snd_soc_codec *codec = &wm8961->codec; int ret; u16 reg; if (wm8961_codec) { dev_err(codec->dev, "Another WM8961 is registered\n"); ret = -EINVAL; goto err; } mutex_init(&codec->mutex); INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths); snd_soc_codec_set_drvdata(codec, wm8961); codec->name = "WM8961"; codec->owner = THIS_MODULE; codec->dai = &wm8961_dai; codec->num_dai = 1; codec->reg_cache_size = ARRAY_SIZE(wm8961->reg_cache); codec->reg_cache = &wm8961->reg_cache; codec->bias_level = SND_SOC_BIAS_OFF; codec->set_bias_level = wm8961_set_bias_level; codec->volatile_register = wm8961_volatile_register; memcpy(codec->reg_cache, wm8961_reg_defaults, sizeof(wm8961_reg_defaults)); ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); goto err; } reg = snd_soc_read(codec, WM8961_SOFTWARE_RESET); if (reg != 0x1801) { dev_err(codec->dev, "Device is not a WM8961: ID=0x%x\n", reg); ret = -EINVAL; goto err; } /* This isn't volatile - readback doesn't correspond to write */ reg = codec->hw_read(codec, WM8961_RIGHT_INPUT_VOLUME); dev_info(codec->dev, "WM8961 family %d revision %c\n", (reg & WM8961_DEVICE_ID_MASK) >> WM8961_DEVICE_ID_SHIFT, ((reg & WM8961_CHIP_REV_MASK) >> WM8961_CHIP_REV_SHIFT) + 'A'); ret = wm8961_reset(codec); if (ret < 0) { dev_err(codec->dev, "Failed to issue reset\n"); return ret; } /* Enable class W */ reg = snd_soc_read(codec, WM8961_CHARGE_PUMP_B); reg |= WM8961_CP_DYN_PWR_MASK; snd_soc_write(codec, WM8961_CHARGE_PUMP_B, reg); /* Latch volume update bits (right channel only, we always * write both out) and default ZC on. */ reg = snd_soc_read(codec, WM8961_ROUT1_VOLUME); snd_soc_write(codec, WM8961_ROUT1_VOLUME, reg | WM8961_LO1ZC | WM8961_OUT1VU); snd_soc_write(codec, WM8961_LOUT1_VOLUME, reg | WM8961_LO1ZC); reg = snd_soc_read(codec, WM8961_ROUT2_VOLUME); snd_soc_write(codec, WM8961_ROUT2_VOLUME, reg | WM8961_SPKRZC | WM8961_SPKVU); snd_soc_write(codec, WM8961_LOUT2_VOLUME, reg | WM8961_SPKLZC); reg = snd_soc_read(codec, WM8961_RIGHT_ADC_VOLUME); snd_soc_write(codec, WM8961_RIGHT_ADC_VOLUME, reg | WM8961_ADCVU); reg = snd_soc_read(codec, WM8961_RIGHT_INPUT_VOLUME); snd_soc_write(codec, WM8961_RIGHT_INPUT_VOLUME, reg | WM8961_IPVU); /* Use soft mute by default */ reg = snd_soc_read(codec, WM8961_ADC_DAC_CONTROL_2); reg |= WM8961_DACSMM; snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); /* Use automatic clocking mode by default; for now this is all * we support. */ reg = snd_soc_read(codec, WM8961_CLOCKING_3); reg &= ~WM8961_MANUAL_MODE; snd_soc_write(codec, WM8961_CLOCKING_3, reg); wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY); wm8961_dai.dev = codec->dev; wm8961_codec = codec; ret = snd_soc_register_codec(codec); if (ret != 0) { dev_err(codec->dev, "Failed to register codec: %d\n", ret); return ret; } ret = snd_soc_register_dai(&wm8961_dai); if (ret != 0) { dev_err(codec->dev, "Failed to register DAI: %d\n", ret); snd_soc_unregister_codec(codec); return ret; } return 0; err: kfree(wm8961); return ret; }
static int max98505_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct max98505_priv *max98505; struct max98505_pdata *pdata; int ret; int pinfo_status = 0; msg_maxim("enter, device '%s'", id->name); max98505 = devm_kzalloc(&i2c->dev, sizeof(struct max98505_priv), GFP_KERNEL); if (!max98505) { ret = -ENOMEM; goto err_allocate_priv; } max98505->pdata = devm_kzalloc(&i2c->dev, sizeof(struct max98505_pdata), GFP_KERNEL); if (!max98505->pdata) { ret = -ENOMEM; goto err_allocate_pdata; } i2c_set_clientdata(i2c, max98505); pdata = max98505->pdata; if (i2c->dev.of_node) { /* Read system clock */ ret = of_property_read_u32(i2c->dev.of_node, "maxim,sysclk", &pdata->sysclk); if (ret) { dev_err(&i2c->dev, "There is no sysclk property."); pdata->sysclk = 12288000; } /* Read speaker volume */ ret = of_property_read_u32(i2c->dev.of_node, "maxim,spk_vol", &pdata->spk_vol); if (ret) { dev_err(&i2c->dev, "There is no spk_vol property."); pdata->spk_vol = 0x14; } /* Read VMON slot info.*/ ret = of_property_read_u32(i2c->dev.of_node, "maxim,vmon_slot", &pdata->vmon_slot); if (ret) { dev_err(&i2c->dev, "There is no vmon_slot property."); pdata->vmon_slot = 0; } /* Regulator status */ pdata->i2c_pull_up = of_property_read_bool( i2c->dev.of_node, "maxim,i2c-pull-up"); if (pdata->i2c_pull_up) max98505_regulator_config(&i2c->dev); #ifdef USE_MAX98505_IRQ pdata->irq = of_get_named_gpio_flags( i2c->dev.of_node, "maxim,irq-gpio", 0, NULL); #endif /* USE_MAX98505_IRQ */ /* Read information related to DSM */ ret = of_property_read_u32_array(i2c->dev.of_node, "maxim,platform_info", (u32 *) &pdata->pinfo, sizeof(pdata->pinfo)/sizeof(uint32_t)); if (ret) dev_err(&i2c->dev, "There is no platform info. property.\n"); else pinfo_status = 1; ret = of_property_read_u32_array(i2c->dev.of_node, "maxim,boost_step", (uint32_t *) &pdata->vstep.boost_step, sizeof(pdata->vstep.boost_step)/sizeof(uint32_t)); if (ret) { dev_err(&i2c->dev, "There is no boost_step property.\n"); for (ret = 0; ret < MAX98505_VSTEP_14; ret++) pdata->vstep.boost_step[ret] = 0x0F; pdata->vstep.boost_step[MAX98505_VSTEP_14] = 0x02; pdata->vstep.boost_step[MAX98505_VSTEP_15] = 0x00; } ret = of_property_read_u32(i2c->dev.of_node, "maxim,adc_threshold", &pdata->vstep.adc_thres); if (ret) { dev_err(&i2c->dev, "There is no adc_threshold property."); pdata->vstep.adc_thres = MAX98505_VSTEP_7; } #ifdef USE_DSM_LOG ret = of_property_read_string(i2c->dev.of_node, "maxim,log_class", &class_name_log); if (ret) { dev_err(&i2c->dev, "There is no log_class property.\n"); class_name_log = DEFAULT_LOG_CLASS_NAME; } #endif /* USE_DSM_LOG */ } else { pdata->sysclk = 12288000; pdata->spk_vol = 0x14; pdata->vmon_slot = 0; } #ifdef USE_MAX98505_IRQ if (pdata != NULL && gpio_is_valid(pdata->irq)) { ret = gpio_request(pdata->irq, "max98505_irq_gpio"); if (ret) { dev_err(&i2c->dev, "unable to request gpio [%d]", pdata->irq); goto err_irq_gpio_req; } ret = gpio_direction_input(pdata->irq); if (ret) { dev_err(&i2c->dev, "unable to set direction for gpio [%d]", pdata->irq); goto err_irq_gpio_req; } i2c->irq = gpio_to_irq(pdata->irq); ret = request_threaded_irq(i2c->irq, NULL, max98505_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "max98505_interrupt", max98505); if (ret) dev_err(&i2c->dev, "Failed to register interrupt"); } else { dev_err(&i2c->dev, "irq gpio not provided\n"); } dev_dbg(&i2c->dev, "requested irq for max98505"); goto go_ahead_next_step; err_irq_gpio_req: if (gpio_is_valid(pdata->irq)) gpio_free(pdata->irq); go_ahead_next_step: #endif /* USE_MAX98505_IRQ */ #ifdef CONFIG_SND_SOC_MAXIM_DSM maxdsm_init(); if (pinfo_status) maxdsm_update_info(pdata->pinfo); #endif /* CONFIG_SND_SOC_MAXIM_DSM */ ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98505, max98505_dai, ARRAY_SIZE(max98505_dai)); if (ret) { dev_err(&i2c->dev, "Failed to register codec"); goto err_register_codec; } max98505->regmap = regmap_init_i2c(i2c, &max98505_regmap); if (IS_ERR(max98505->regmap)) { ret = PTR_ERR(max98505->regmap); dev_err(&i2c->dev, "Failed to initialize regmap: %d", ret); goto err_regmap; } msg_maxim("exit, device '%s'", id->name); return 0; err_regmap: snd_soc_unregister_codec(&i2c->dev); if (max98505->regmap) regmap_exit(max98505->regmap); err_register_codec: #ifdef CONFIG_SND_SOC_MAXIM_DSM maxdsm_deinit(); #endif /* CONFIG_SND_SOC_MAXIM_DSM */ devm_kfree(&i2c->dev, max98505->pdata); err_allocate_pdata: devm_kfree(&i2c->dev, max98505); err_allocate_priv: msg_maxim("exit with errors. ret=%d", ret); return ret; }
static int __devexit adau1373_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); kfree(dev_get_drvdata(&client->dev)); return 0; }
static int tlv320aic23_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); return 0; }
static __devinit int wm8350_codec_probe(struct platform_device *pdev) { struct wm8350 *wm8350 = platform_get_drvdata(pdev); struct wm8350_data *priv; struct snd_soc_codec *codec; int ret, i; if (wm8350->codec.platform_data == NULL) { dev_err(&pdev->dev, "No audio platform data supplied\n"); return -EINVAL; } priv = kzalloc(sizeof(struct wm8350_data), GFP_KERNEL); if (priv == NULL) return -ENOMEM; for (i = 0; i < ARRAY_SIZE(supply_names); i++) priv->supplies[i].supply = supply_names[i]; ret = regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies), priv->supplies); if (ret != 0) goto err_priv; codec = &priv->codec; wm8350->codec.codec = codec; wm8350_dai.dev = &pdev->dev; mutex_init(&codec->mutex); INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths); codec->dev = &pdev->dev; codec->name = "WM8350"; codec->owner = THIS_MODULE; codec->read = wm8350_codec_read; codec->write = wm8350_codec_write; codec->bias_level = SND_SOC_BIAS_OFF; codec->set_bias_level = wm8350_set_bias_level; codec->dai = &wm8350_dai; codec->num_dai = 1; codec->reg_cache_size = WM8350_MAX_REGISTER; codec->private_data = priv; codec->control_data = wm8350; /* Put the codec into reset if it wasn't already */ wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); INIT_DELAYED_WORK(&codec->delayed_work, wm8350_pga_work); ret = snd_soc_register_codec(codec); if (ret != 0) goto err_supply; wm8350_codec = codec; ret = snd_soc_register_dai(&wm8350_dai); if (ret != 0) goto err_codec; return 0; err_codec: snd_soc_unregister_codec(codec); err_supply: regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies); err_priv: kfree(priv); wm8350_codec = NULL; return ret; }
static int wm8741_register(struct wm8741_priv *wm8741, enum snd_soc_control_type control) { int ret; struct snd_soc_codec *codec = &wm8741->codec; int i; if (wm8741_codec) { dev_err(codec->dev, "Another WM8741 is registered\n"); return -EINVAL; } mutex_init(&codec->mutex); INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths); snd_soc_codec_set_drvdata(codec, wm8741); codec->name = "WM8741"; codec->owner = THIS_MODULE; codec->bias_level = SND_SOC_BIAS_OFF; codec->set_bias_level = NULL; codec->dai = &wm8741_dai; codec->num_dai = 1; codec->reg_cache_size = WM8741_REGISTER_COUNT; codec->reg_cache = &wm8741->reg_cache; wm8741->rate_constraint.list = &wm8741->rate_constraint_list[0]; wm8741->rate_constraint.count = ARRAY_SIZE(wm8741->rate_constraint_list); memcpy(codec->reg_cache, wm8741_reg_defaults, sizeof(wm8741->reg_cache)); ret = snd_soc_codec_set_cache_io(codec, 7, 9, control); if (ret != 0) { dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); goto err; } for (i = 0; i < ARRAY_SIZE(wm8741->supplies); i++) wm8741->supplies[i].supply = wm8741_supply_names[i]; ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8741->supplies), wm8741->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to request supplies: %d\n", ret); goto err; } ret = regulator_bulk_enable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); goto err_get; } ret = wm8741_reset(codec); if (ret < 0) { dev_err(codec->dev, "Failed to issue reset\n"); goto err_enable; } wm8741_dai.dev = codec->dev; /* Change some default settings - latch VU */ wm8741->reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL; wm8741->reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM; wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL; wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM; wm8741_codec = codec; ret = snd_soc_register_codec(codec); if (ret != 0) { dev_err(codec->dev, "Failed to register codec: %d\n", ret); return ret; } ret = snd_soc_register_dai(&wm8741_dai); if (ret != 0) { dev_err(codec->dev, "Failed to register DAI: %d\n", ret); snd_soc_unregister_codec(codec); return ret; } dev_dbg(codec->dev, "Successful registration\n"); return 0; err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8741->supplies), wm8741->supplies); err_get: regulator_bulk_free(ARRAY_SIZE(wm8741->supplies), wm8741->supplies); err: kfree(wm8741); return ret; }
static int __devexit sn95031_device_remove(struct platform_device *pdev) { pr_debug("codec device remove called\n"); snd_soc_unregister_codec(&pdev->dev); return 0; }
void sii9022_hdmi_codec_unregister(struct device *dev) { snd_soc_unregister_codec(dev); }
static int __devexit wm8741_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); kfree(spi_get_drvdata(spi)); return 0; }
static __devexit int ak4671_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); kfree(i2c_get_clientdata(client)); return 0; }
static int wm8731_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); return 0; }
static int __devexit aic32x4_spi_remove(struct spi_device *spi) { snd_soc_unregister_codec(&spi->dev); return 0; }
static int wm9090_i2c_remove(struct i2c_client *i2c) { snd_soc_unregister_codec(&i2c->dev); return 0; }
static int __exit dummy_codec_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); kfree(platform_get_drvdata(pdev)); return 0; }
static int __exit cx20442_platform_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; }
static int aml_pmu4_audio_codec_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; }
static int __devexit hdmi_codec_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; }
static __devexit int STA381xx_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); devm_kfree(&client->dev, i2c_get_clientdata(client)); return 0; }
/** * cs4270_i2c_remove - remove an I2C device * @i2c_client: the I2C client object * * This function is the counterpart to cs4270_i2c_probe(). */ static int cs4270_i2c_remove(struct i2c_client *i2c_client) { snd_soc_unregister_codec(&i2c_client->dev); return 0; }
static int ad1836_register(struct ad1836_priv *ad1836) { int ret; struct snd_soc_codec *codec = &ad1836->codec; if (ad1836_codec) { dev_err(codec->dev, "Another ad1836 is registered\n"); return -EINVAL; } mutex_init(&codec->mutex); INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths); codec->private_data = ad1836; codec->reg_cache = ad1836->reg_cache; codec->reg_cache_size = AD1836_NUM_REGS; codec->name = "AD1836"; codec->owner = THIS_MODULE; codec->dai = &ad1836_dai; codec->num_dai = 1; codec->write = ad1836_write_reg; codec->read = ad1836_read_reg_cache; INIT_LIST_HEAD(&codec->dapm_widgets); INIT_LIST_HEAD(&codec->dapm_paths); ad1836_dai.dev = codec->dev; ad1836_codec = codec; /* default setting for ad1836 */ /* de-emphasis: 48kHz, power-on dac */ codec->write(codec, AD1836_DAC_CTRL1, 0x300); /* unmute dac channels */ codec->write(codec, AD1836_DAC_CTRL2, 0x0); /* high-pass filter enable, power-on adc */ codec->write(codec, AD1836_ADC_CTRL1, 0x100); /* unmute adc channles, adc aux mode */ codec->write(codec, AD1836_ADC_CTRL2, 0x180); /* left/right diff:PGA/MUX */ codec->write(codec, AD1836_ADC_CTRL3, 0x3A); /* volume */ codec->write(codec, AD1836_DAC_L1_VOL, 0x3FF); codec->write(codec, AD1836_DAC_R1_VOL, 0x3FF); codec->write(codec, AD1836_DAC_L2_VOL, 0x3FF); codec->write(codec, AD1836_DAC_R2_VOL, 0x3FF); codec->write(codec, AD1836_DAC_L3_VOL, 0x3FF); codec->write(codec, AD1836_DAC_R3_VOL, 0x3FF); ret = snd_soc_register_codec(codec); if (ret != 0) { dev_err(codec->dev, "Failed to register codec: %d\n", ret); kfree(ad1836); return ret; } ret = snd_soc_register_dai(&ad1836_dai); if (ret != 0) { dev_err(codec->dev, "Failed to register DAI: %d\n", ret); snd_soc_unregister_codec(codec); kfree(ad1836); return ret; } return 0; }