Re: [PATCH] ASoC: Convert wm8731 to a new-style i2c driver (testers wanted)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jean,

On Tue, Aug 26, 2008 at 06:24:37PM +0200, Jean Delvare wrote:
> Convert the wm8731 codec driver to the new (standard) device driver
> binding model.
> 
> Signed-off-by: Jean Delvare <khali@xxxxxxxxxxxx>
> Cc: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> ---
> Warning: this assumes that the corgi, poodle and eti_b1 have their
> codec chips on I2C bus 0, which may or may not be the case. Someone
> with these machines please test and report.
> 
> Note that you can safely ignore patch failures in i2c-id.h.
> 
>  include/linux/i2c-id.h         |    1 
>  sound/soc/at91/eti_b1_wm8731.c |    1 
>  sound/soc/codecs/wm8731.c      |  111 +++++++++++++++++++---------------------
>  sound/soc/codecs/wm8731.h      |    1 
>  sound/soc/pxa/corgi.c          |    1 
>  sound/soc/pxa/poodle.c         |    1 
>  6 files changed, 59 insertions(+), 57 deletions(-)

>  static struct wm8731_setup_data eti_b1_wm8731_setup = {
> +	.i2c_bus = 0,
>  	.i2c_address = 0x1a,
>  };
[...]  
> --- linux-2.6.27-rc4.orig/sound/soc/codecs/wm8731.c	2008-08-26 16:40:44.000000000 +0200
> +++ linux-2.6.27-rc4/sound/soc/codecs/wm8731.c	2008-08-26 17:11:50.000000000 +0200
[...]
> +static int wm8731_add_i2c_device(struct platform_device *pdev,
> +				 const struct wm8731_setup_data *setup)
> +{
> +	struct snd_soc_device *socdev = platform_get_drvdata(pdev);
> +	struct i2c_board_info info;
> +	struct i2c_adapter *adapter;
> +	struct i2c_client *client;
> +	int ret;
> +
> +	ret = i2c_add_driver(&wm8731_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, "wm8731", I2C_NAME_SIZE);

I don't know about other wm8731 users, but I'd prefer to let the board
code register the codec i2c device.  Then you could also get rid
of "struct wm8731_setup_data" altogether.

The patch works on a MIPS testboard.

Thanks!
	Manuel Lauss
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux