wm8731.c (00b87e18f3c0a98e2e22a95eb205c2ae03862a23) wm8731.c (3f4fb905510911f6149593a7321ae1825259b242)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * wm8731.c -- WM8731 ALSA SoC Audio driver
4 *
5 * Copyright 2005 Openedhand Ltd.
6 * Copyright 2006-12 Wolfson Microelectronics, plc
7 *
8 * Author: Richard Purdie <richard@openedhand.com>

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

589 if (ret != 0) {
590 dev_err(dev, "Failed to enable supplies: %d\n", ret);
591 return ret;
592 }
593
594 return 0;
595}
596
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * wm8731.c -- WM8731 ALSA SoC Audio driver
4 *
5 * Copyright 2005 Openedhand Ltd.
6 * Copyright 2006-12 Wolfson Microelectronics, plc
7 *
8 * Author: Richard Purdie <richard@openedhand.com>

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

589 if (ret != 0) {
590 dev_err(dev, "Failed to enable supplies: %d\n", ret);
591 return ret;
592 }
593
594 return 0;
595}
596
597static int wm8731_hw_init(struct device *dev, struct wm8731_priv *wm8731)
597static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
598 .set_bias_level = wm8731_set_bias_level,
599 .controls = wm8731_snd_controls,
600 .num_controls = ARRAY_SIZE(wm8731_snd_controls),
601 .dapm_widgets = wm8731_dapm_widgets,
602 .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
603 .dapm_routes = wm8731_intercon,
604 .num_dapm_routes = ARRAY_SIZE(wm8731_intercon),
605 .suspend_bias_off = 1,
606 .idle_bias_on = 1,
607 .use_pmdown_time = 1,
608 .endianness = 1,
609 .non_legacy_dai_naming = 1,
610};
611
612static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
598{
599 int ret = 0;
600
601 ret = wm8731_reset(wm8731->regmap);
602 if (ret < 0) {
603 dev_err(dev, "Failed to issue reset: %d\n", ret);
604 goto err_regulator_enable;
605 }

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

613 regmap_update_bits(wm8731->regmap, WM8731_LINVOL, 0x100, 0);
614 regmap_update_bits(wm8731->regmap, WM8731_RINVOL, 0x100, 0);
615
616 /* Disable bypass path by default */
617 regmap_update_bits(wm8731->regmap, WM8731_APANA, 0x8, 0);
618
619 regcache_mark_dirty(wm8731->regmap);
620
613{
614 int ret = 0;
615
616 ret = wm8731_reset(wm8731->regmap);
617 if (ret < 0) {
618 dev_err(dev, "Failed to issue reset: %d\n", ret);
619 goto err_regulator_enable;
620 }

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

628 regmap_update_bits(wm8731->regmap, WM8731_LINVOL, 0x100, 0);
629 regmap_update_bits(wm8731->regmap, WM8731_RINVOL, 0x100, 0);
630
631 /* Disable bypass path by default */
632 regmap_update_bits(wm8731->regmap, WM8731_APANA, 0x8, 0);
633
634 regcache_mark_dirty(wm8731->regmap);
635
636 ret = devm_snd_soc_register_component(dev,
637 &soc_component_dev_wm8731, &wm8731_dai, 1);
638 if (ret != 0) {
639 dev_err(dev, "Failed to register CODEC: %d\n", ret);
640 goto err_regulator_enable;
641 }
642
643 return 0;
644
621err_regulator_enable:
622 /* Regulators will be enabled by bias management */
623 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
624
625 return ret;
626}
627
645err_regulator_enable:
646 /* Regulators will be enabled by bias management */
647 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
648
649 return ret;
650}
651
628static const struct snd_soc_component_driver soc_component_dev_wm8731 = {
629 .set_bias_level = wm8731_set_bias_level,
630 .controls = wm8731_snd_controls,
631 .num_controls = ARRAY_SIZE(wm8731_snd_controls),
632 .dapm_widgets = wm8731_dapm_widgets,
633 .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
634 .dapm_routes = wm8731_intercon,
635 .num_dapm_routes = ARRAY_SIZE(wm8731_intercon),
636 .suspend_bias_off = 1,
637 .idle_bias_on = 1,
638 .use_pmdown_time = 1,
639 .endianness = 1,
640 .non_legacy_dai_naming = 1,
641};
642
643static const struct of_device_id wm8731_of_match[] = {
644 { .compatible = "wlf,wm8731", },
645 { }
646};
647
648MODULE_DEVICE_TABLE(of, wm8731_of_match);
649
650static const struct regmap_config wm8731_regmap = {

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

693 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
694 if (IS_ERR(wm8731->regmap)) {
695 ret = PTR_ERR(wm8731->regmap);
696 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
697 ret);
698 return ret;
699 }
700
652static const struct of_device_id wm8731_of_match[] = {
653 { .compatible = "wlf,wm8731", },
654 { }
655};
656
657MODULE_DEVICE_TABLE(of, wm8731_of_match);
658
659static const struct regmap_config wm8731_regmap = {

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

702 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
703 if (IS_ERR(wm8731->regmap)) {
704 ret = PTR_ERR(wm8731->regmap);
705 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
706 ret);
707 return ret;
708 }
709
701 ret = wm8731_hw_init(&spi->dev, wm8731);
702 if (ret != 0)
703 return ret;
704
705 ret = devm_snd_soc_register_component(&spi->dev,
706 &soc_component_dev_wm8731, &wm8731_dai, 1);
707 if (ret != 0) {
708 dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret);
709 return ret;
710 }
711
712 return 0;
710 return wm8731_init(&spi->dev, wm8731);
713}
714
715static struct spi_driver wm8731_spi_driver = {
716 .driver = {
717 .name = "wm8731",
718 .of_match_table = wm8731_of_match,
719 },
720 .probe = wm8731_spi_probe,

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

757 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
758 if (IS_ERR(wm8731->regmap)) {
759 ret = PTR_ERR(wm8731->regmap);
760 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
761 ret);
762 return ret;
763 }
764
711}
712
713static struct spi_driver wm8731_spi_driver = {
714 .driver = {
715 .name = "wm8731",
716 .of_match_table = wm8731_of_match,
717 },
718 .probe = wm8731_spi_probe,

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

755 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
756 if (IS_ERR(wm8731->regmap)) {
757 ret = PTR_ERR(wm8731->regmap);
758 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
759 ret);
760 return ret;
761 }
762
765 ret = wm8731_hw_init(&i2c->dev, wm8731);
766 if (ret != 0)
767 return ret;
768
769 ret = devm_snd_soc_register_component(&i2c->dev,
770 &soc_component_dev_wm8731, &wm8731_dai, 1);
771 if (ret != 0) {
772 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
773 return ret;
774 }
775
776 return 0;
763 return wm8731_init(&i2c->dev, wm8731);
777}
778
779static const struct i2c_device_id wm8731_i2c_id[] = {
780 { "wm8731", 0 },
781 { }
782};
783MODULE_DEVICE_TABLE(i2c, wm8731_i2c_id);
784

--- 45 unchanged lines hidden ---
764}
765
766static const struct i2c_device_id wm8731_i2c_id[] = {
767 { "wm8731", 0 },
768 { }
769};
770MODULE_DEVICE_TABLE(i2c, wm8731_i2c_id);
771

--- 45 unchanged lines hidden ---