wm8731.c (5f1b9d1e424b91a8ae04211cbe4d354463c83583) wm8731.c (8875d104af6c237bfedb47309afd938984a3c05b)
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>

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

583 .endianness = 1,
584 .non_legacy_dai_naming = 1,
585};
586
587static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
588{
589 int ret = 0, i;
590
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>

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

583 .endianness = 1,
584 .non_legacy_dai_naming = 1,
585};
586
587static int wm8731_init(struct device *dev, struct wm8731_priv *wm8731)
588{
589 int ret = 0, i;
590
591 wm8731->mclk = devm_clk_get(dev, "mclk");
592 if (IS_ERR(wm8731->mclk)) {
593 ret = PTR_ERR(wm8731->mclk);
594 if (ret == -ENOENT) {
595 wm8731->mclk = NULL;
596 dev_warn(dev, "Assuming static MCLK\n");
597 } else {
598 dev_err(dev, "Failed to get MCLK: %d\n", ret);
599 return ret;
600 }
601 }
602
603 mutex_init(&wm8731->lock);
604
591 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
592 wm8731->supplies[i].supply = wm8731_supply_names[i];
593
594 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(wm8731->supplies),
595 wm8731->supplies);
596 if (ret != 0) {
597 dev_err(dev, "Failed to request supplies: %d\n", ret);
598 return ret;

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

665{
666 struct wm8731_priv *wm8731;
667 int ret;
668
669 wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL);
670 if (wm8731 == NULL)
671 return -ENOMEM;
672
605 for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
606 wm8731->supplies[i].supply = wm8731_supply_names[i];
607
608 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(wm8731->supplies),
609 wm8731->supplies);
610 if (ret != 0) {
611 dev_err(dev, "Failed to request supplies: %d\n", ret);
612 return ret;

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

679{
680 struct wm8731_priv *wm8731;
681 int ret;
682
683 wm8731 = devm_kzalloc(&spi->dev, sizeof(*wm8731), GFP_KERNEL);
684 if (wm8731 == NULL)
685 return -ENOMEM;
686
673 wm8731->mclk = devm_clk_get(&spi->dev, "mclk");
674 if (IS_ERR(wm8731->mclk)) {
675 ret = PTR_ERR(wm8731->mclk);
676 if (ret == -ENOENT) {
677 wm8731->mclk = NULL;
678 dev_warn(&spi->dev, "Assuming static MCLK\n");
679 } else {
680 dev_err(&spi->dev, "Failed to get MCLK: %d\n",
681 ret);
682 return ret;
683 }
684 }
685
686 mutex_init(&wm8731->lock);
687
688 spi_set_drvdata(spi, wm8731);
689
690 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
691 if (IS_ERR(wm8731->regmap)) {
692 ret = PTR_ERR(wm8731->regmap);
693 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
694 ret);
695 return ret;

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

714 struct wm8731_priv *wm8731;
715 int ret;
716
717 wm8731 = devm_kzalloc(&i2c->dev, sizeof(struct wm8731_priv),
718 GFP_KERNEL);
719 if (wm8731 == NULL)
720 return -ENOMEM;
721
687 spi_set_drvdata(spi, wm8731);
688
689 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
690 if (IS_ERR(wm8731->regmap)) {
691 ret = PTR_ERR(wm8731->regmap);
692 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
693 ret);
694 return ret;

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

713 struct wm8731_priv *wm8731;
714 int ret;
715
716 wm8731 = devm_kzalloc(&i2c->dev, sizeof(struct wm8731_priv),
717 GFP_KERNEL);
718 if (wm8731 == NULL)
719 return -ENOMEM;
720
722 wm8731->mclk = devm_clk_get(&i2c->dev, "mclk");
723 if (IS_ERR(wm8731->mclk)) {
724 ret = PTR_ERR(wm8731->mclk);
725 if (ret == -ENOENT) {
726 wm8731->mclk = NULL;
727 dev_warn(&i2c->dev, "Assuming static MCLK\n");
728 } else {
729 dev_err(&i2c->dev, "Failed to get MCLK: %d\n",
730 ret);
731 return ret;
732 }
733 }
734
735 mutex_init(&wm8731->lock);
736
737 i2c_set_clientdata(i2c, wm8731);
738
739 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
740 if (IS_ERR(wm8731->regmap)) {
741 ret = PTR_ERR(wm8731->regmap);
742 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
743 ret);
744 return ret;

--- 56 unchanged lines hidden ---
721 i2c_set_clientdata(i2c, wm8731);
722
723 wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
724 if (IS_ERR(wm8731->regmap)) {
725 ret = PTR_ERR(wm8731->regmap);
726 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
727 ret);
728 return ret;

--- 56 unchanged lines hidden ---