aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJonas Bonn <jonas.bonn@gmail.com>2008-11-19 17:10:56 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:10:56 +0000
commitacbac4825627e18b1ee979a1d2fda7a0a51dec33 (patch)
tree8fa485e459449bade7df481bf8172d757954f8ac /sound
parentde1aca9d30c29b60094295919e36382fb0596358 (diff)
ALSA: Cleanup WM8753 driver after switch to i2c driver model
Mainly this concerns device registration. Registration should be handled at the machine level and not in the driver itself. This patch drops registration at the driver level. As registration allows for specifying an i2c device address, the setup data is not needed to be passed to the driver. Signed-off-by: Jonas Bonn <jonas.bonn@gmail.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8753.c53
-rw-r--r--sound/soc/s3c24xx/neo1973_wm8753.c6
2 files changed, 8 insertions, 51 deletions
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 166f9eba8d2..85d10ff43dc 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1647,17 +1647,20 @@ static int wm8753_i2c_probe(struct i2c_client *i2c,
struct snd_soc_codec *codec = socdev->codec;
int ret;
+ /* codec->control_data must be set before call to wm8753_init */
i2c_set_clientdata(i2c, codec);
codec->control_data = i2c;
ret = wm8753_init(socdev);
- if (ret < 0)
+ if (ret < 0) {
pr_err("failed to initialise WM8753\n");
+ codec->control_data = NULL;
+ }
return ret;
}
-static int wm8753_i2c_remove(struct i2c_client *client)
+static int __devexit wm8753_i2c_remove(struct i2c_client *client)
{
struct snd_soc_codec *codec = i2c_get_clientdata(client);
kfree(codec->reg_cache);
@@ -1678,47 +1681,9 @@ static struct i2c_driver wm8753_i2c_driver = {
.probe = wm8753_i2c_probe,
.remove = wm8753_i2c_remove,
.id_table = wm8753_i2c_id,
+ .class = I2C_CLASS_SOUND
};
-static int wm8753_add_i2c_device(struct platform_device *pdev,
- const struct wm8753_setup_data *setup)
-{
- struct i2c_board_info info;
- struct i2c_adapter *adapter;
- struct i2c_client *client;
- int ret;
-
- ret = i2c_add_driver(&wm8753_i2c_driver);
- if (ret != 0) {
- dev_err(&pdev->dev, "can't add i2c driver\n");
- return ret;
- }
-
- memset(&info, 0, sizeof(struct i2c_board_info));
- info.addr = setup->i2c_address;
- strlcpy(info.type, "wm8753", I2C_NAME_SIZE);
-
- adapter = i2c_get_adapter(setup->i2c_bus);
- if (!adapter) {
- dev_err(&pdev->dev, "can't get i2c adapter %d\n",
- setup->i2c_bus);
- goto err_driver;
- }
-
- client = i2c_new_device(adapter, &info);
- i2c_put_adapter(adapter);
- if (!client) {
- dev_err(&pdev->dev, "can't add i2c device at 0x%x\n",
- (unsigned int)info.addr);
- goto err_driver;
- }
-
- return 0;
-
-err_driver:
- i2c_del_driver(&wm8753_i2c_driver);
- return -ENODEV;
-}
#endif
#if defined(CONFIG_SPI_MASTER)
@@ -1781,14 +1746,12 @@ static int wm8753_spi_write(struct spi_device *spi, const char *data, int len)
static int wm8753_probe(struct platform_device *pdev)
{
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
- struct wm8753_setup_data *setup;
struct snd_soc_codec *codec;
struct wm8753_priv *wm8753;
int ret = 0;
- pr_info("WM8753 Audio Codec %s", WM8753_VERSION);
+ pr_info("WM8753 Audio Codec %s\n", WM8753_VERSION);
- setup = socdev->codec_data;
codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
if (codec == NULL)
return -ENOMEM;
@@ -1823,6 +1786,7 @@ static int wm8753_probe(struct platform_device *pdev)
#endif
if (ret != 0) {
+ printk(KERN_ERR "can't add coded bus driver");
kfree(codec->private_data);
kfree(codec);
}
@@ -1860,7 +1824,6 @@ static int wm8753_remove(struct platform_device *pdev)
snd_soc_free_pcms(socdev);
snd_soc_dapm_free(socdev);
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
- i2c_unregister_device(codec->control_data);
i2c_del_driver(&wm8753_i2c_driver);
#endif
#if defined(CONFIG_SPI_MASTER)
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index 5cbbe988e1f..135006bd355 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -585,16 +585,10 @@ static struct snd_soc_machine neo1973 = {
.num_links = ARRAY_SIZE(neo1973_dai),
};
-static struct wm8753_setup_data neo1973_wm8753_setup = {
- .i2c_bus = 0,
- .i2c_address = 0x1a,
-};
-
static struct snd_soc_device neo1973_snd_devdata = {
.machine = &neo1973,
.platform = &s3c24xx_soc_platform,
.codec_dev = &soc_codec_dev_wm8753,
- .codec_data = &neo1973_wm8753_setup,
};
static int lm4857_i2c_probe(struct i2c_client *client,