wm8731.c (62b1653e29d8f359c4c7e045b965dc963459473d) wm8731.c (fe5422fc4ac221910083e603eb2a873280a9bd37)
1/*
2 * wm8731.c -- WM8731 ALSA SoC Audio driver
3 *
4 * Copyright 2005 Openedhand Ltd.
5 *
6 * Author: Richard Purdie <richard@openedhand.com>
7 *
8 * Based on wm8753.c by Liam Girdwood

--- 546 unchanged lines hidden (view full) ---

555static int wm8731_register(struct wm8731_priv *wm8731)
556{
557 int ret;
558 struct snd_soc_codec *codec = &wm8731->codec;
559 u16 reg;
560
561 if (wm8731_codec) {
562 dev_err(codec->dev, "Another WM8731 is registered\n");
1/*
2 * wm8731.c -- WM8731 ALSA SoC Audio driver
3 *
4 * Copyright 2005 Openedhand Ltd.
5 *
6 * Author: Richard Purdie <richard@openedhand.com>
7 *
8 * Based on wm8753.c by Liam Girdwood

--- 546 unchanged lines hidden (view full) ---

555static int wm8731_register(struct wm8731_priv *wm8731)
556{
557 int ret;
558 struct snd_soc_codec *codec = &wm8731->codec;
559 u16 reg;
560
561 if (wm8731_codec) {
562 dev_err(codec->dev, "Another WM8731 is registered\n");
563 return -EINVAL;
563 ret = -EINVAL;
564 goto err;
564 }
565
566 mutex_init(&codec->mutex);
567 INIT_LIST_HEAD(&codec->dapm_widgets);
568 INIT_LIST_HEAD(&codec->dapm_paths);
569
570 codec->private_data = wm8731;
571 codec->name = "WM8731";

--- 6 unchanged lines hidden (view full) ---

578 codec->num_dai = 1;
579 codec->reg_cache_size = WM8731_CACHEREGNUM;
580 codec->reg_cache = &wm8731->reg_cache;
581
582 memcpy(codec->reg_cache, wm8731_reg, sizeof(wm8731_reg));
583
584 ret = wm8731_reset(codec);
585 if (ret < 0) {
565 }
566
567 mutex_init(&codec->mutex);
568 INIT_LIST_HEAD(&codec->dapm_widgets);
569 INIT_LIST_HEAD(&codec->dapm_paths);
570
571 codec->private_data = wm8731;
572 codec->name = "WM8731";

--- 6 unchanged lines hidden (view full) ---

579 codec->num_dai = 1;
580 codec->reg_cache_size = WM8731_CACHEREGNUM;
581 codec->reg_cache = &wm8731->reg_cache;
582
583 memcpy(codec->reg_cache, wm8731_reg, sizeof(wm8731_reg));
584
585 ret = wm8731_reset(codec);
586 if (ret < 0) {
586 dev_err(codec->dev, "Failed to issue reset\n");
587 return ret;
587 dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
588 goto err;
588 }
589
590 wm8731_dai.dev = codec->dev;
591
592 wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
593
594 /* Latch the update bits */
595 reg = wm8731_read_reg_cache(codec, WM8731_LOUT1V);

--- 9 unchanged lines hidden (view full) ---

605 reg = wm8731_read_reg_cache(codec, WM8731_APANA);
606 wm8731_write(codec, WM8731_APANA, reg & ~0x4);
607
608 wm8731_codec = codec;
609
610 ret = snd_soc_register_codec(codec);
611 if (ret != 0) {
612 dev_err(codec->dev, "Failed to register codec: %d\n", ret);
589 }
590
591 wm8731_dai.dev = codec->dev;
592
593 wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
594
595 /* Latch the update bits */
596 reg = wm8731_read_reg_cache(codec, WM8731_LOUT1V);

--- 9 unchanged lines hidden (view full) ---

606 reg = wm8731_read_reg_cache(codec, WM8731_APANA);
607 wm8731_write(codec, WM8731_APANA, reg & ~0x4);
608
609 wm8731_codec = codec;
610
611 ret = snd_soc_register_codec(codec);
612 if (ret != 0) {
613 dev_err(codec->dev, "Failed to register codec: %d\n", ret);
613 return ret;
614 goto err;
614 }
615
616 ret = snd_soc_register_dai(&wm8731_dai);
617 if (ret != 0) {
618 dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
619 snd_soc_unregister_codec(codec);
615 }
616
617 ret = snd_soc_register_dai(&wm8731_dai);
618 if (ret != 0) {
619 dev_err(codec->dev, "Failed to register DAI: %d\n", ret);
620 snd_soc_unregister_codec(codec);
620 return ret;
621 goto err_codec;
621 }
622
623 return 0;
622 }
623
624 return 0;
625
626err_codec:
627 snd_soc_unregister_codec(codec);
628err:
629 kfree(wm8731);
630 return ret;
624}
625
626static void wm8731_unregister(struct wm8731_priv *wm8731)
627{
628 wm8731_set_bias_level(&wm8731->codec, SND_SOC_BIAS_OFF);
629 snd_soc_unregister_dai(&wm8731_dai);
630 snd_soc_unregister_codec(&wm8731->codec);
631 kfree(wm8731);

--- 182 unchanged lines hidden ---
631}
632
633static void wm8731_unregister(struct wm8731_priv *wm8731)
634{
635 wm8731_set_bias_level(&wm8731->codec, SND_SOC_BIAS_OFF);
636 snd_soc_unregister_dai(&wm8731_dai);
637 snd_soc_unregister_codec(&wm8731->codec);
638 kfree(wm8731);

--- 182 unchanged lines hidden ---