wm8737.c (f9cd49033b349b8be3bb1f01b39eed837853d880) wm8737.c (65fdd9bffa1367b75de0c331a105ce36de618794)
1/*
2 * wm8737.c -- WM8737 ALSA SoC Audio driver
3 *
4 * Copyright 2010 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

642
643#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
644static __devinit int wm8737_i2c_probe(struct i2c_client *i2c,
645 const struct i2c_device_id *id)
646{
647 struct wm8737_priv *wm8737;
648 int ret;
649
1/*
2 * wm8737.c -- WM8737 ALSA SoC Audio driver
3 *
4 * Copyright 2010 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

642
643#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
644static __devinit int wm8737_i2c_probe(struct i2c_client *i2c,
645 const struct i2c_device_id *id)
646{
647 struct wm8737_priv *wm8737;
648 int ret;
649
650 wm8737 = kzalloc(sizeof(struct wm8737_priv), GFP_KERNEL);
650 wm8737 = devm_kzalloc(&i2c->dev, sizeof(struct wm8737_priv),
651 GFP_KERNEL);
651 if (wm8737 == NULL)
652 return -ENOMEM;
653
654 i2c_set_clientdata(i2c, wm8737);
655 wm8737->control_type = SND_SOC_I2C;
656
657 ret = snd_soc_register_codec(&i2c->dev,
658 &soc_codec_dev_wm8737, &wm8737_dai, 1);
652 if (wm8737 == NULL)
653 return -ENOMEM;
654
655 i2c_set_clientdata(i2c, wm8737);
656 wm8737->control_type = SND_SOC_I2C;
657
658 ret = snd_soc_register_codec(&i2c->dev,
659 &soc_codec_dev_wm8737, &wm8737_dai, 1);
659 if (ret < 0)
660 kfree(wm8737);
660
661 return ret;
662
663}
664
665static __devexit int wm8737_i2c_remove(struct i2c_client *client)
666{
667 snd_soc_unregister_codec(&client->dev);
661 return ret;
662
663}
664
665static __devexit int wm8737_i2c_remove(struct i2c_client *client)
666{
667 snd_soc_unregister_codec(&client->dev);
668 kfree(i2c_get_clientdata(client));
668
669 return 0;
670}
671
672static const struct i2c_device_id wm8737_i2c_id[] = {
673 { "wm8737", 0 },
674 { }
675};
676MODULE_DEVICE_TABLE(i2c, wm8737_i2c_id);

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

688#endif
689
690#if defined(CONFIG_SPI_MASTER)
691static int __devinit wm8737_spi_probe(struct spi_device *spi)
692{
693 struct wm8737_priv *wm8737;
694 int ret;
695
669 return 0;
670}
671
672static const struct i2c_device_id wm8737_i2c_id[] = {
673 { "wm8737", 0 },
674 { }
675};
676MODULE_DEVICE_TABLE(i2c, wm8737_i2c_id);

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

688#endif
689
690#if defined(CONFIG_SPI_MASTER)
691static int __devinit wm8737_spi_probe(struct spi_device *spi)
692{
693 struct wm8737_priv *wm8737;
694 int ret;
695
696 wm8737 = kzalloc(sizeof(struct wm8737_priv), GFP_KERNEL);
696 wm8737 = devm_kzalloc(&spi->dev, sizeof(struct wm8737_priv),
697 GFP_KERNEL);
697 if (wm8737 == NULL)
698 return -ENOMEM;
699
700 wm8737->control_type = SND_SOC_SPI;
701 spi_set_drvdata(spi, wm8737);
702
703 ret = snd_soc_register_codec(&spi->dev,
704 &soc_codec_dev_wm8737, &wm8737_dai, 1);
698 if (wm8737 == NULL)
699 return -ENOMEM;
700
701 wm8737->control_type = SND_SOC_SPI;
702 spi_set_drvdata(spi, wm8737);
703
704 ret = snd_soc_register_codec(&spi->dev,
705 &soc_codec_dev_wm8737, &wm8737_dai, 1);
705 if (ret < 0)
706 kfree(wm8737);
706
707 return ret;
708}
709
710static int __devexit wm8737_spi_remove(struct spi_device *spi)
711{
712 snd_soc_unregister_codec(&spi->dev);
707 return ret;
708}
709
710static int __devexit wm8737_spi_remove(struct spi_device *spi)
711{
712 snd_soc_unregister_codec(&spi->dev);
713 kfree(spi_get_drvdata(spi));
713
714 return 0;
715}
716
717static struct spi_driver wm8737_spi_driver = {
718 .driver = {
719 .name = "wm8737",
720 .owner = THIS_MODULE,
721 .of_match_table = wm8737_of_match,

--- 41 unchanged lines hidden ---
714 return 0;
715}
716
717static struct spi_driver wm8737_spi_driver = {
718 .driver = {
719 .name = "wm8737",
720 .owner = THIS_MODULE,
721 .of_match_table = wm8737_of_match,

--- 41 unchanged lines hidden ---