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

Jean Delvare khali at linux-fr.org
Tue Aug 26 21:26:25 CEST 2008


On Tue, 26 Aug 2008 21:20:43 +0200, Manuel Lauss wrote:
> 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 at linux-fr.org>
> > Cc: Mark Brown <broonie at opensource.wolfsonmicro.com>
> > ---
> > 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.

Yes, I agree, and I think that Mark has plans for changes in this
direction. But for now my personal goal was to move the drivers away
from i2c_attach_client and friends as this old API is going away soon.
Moving the place where the i2c device is created can happen later as
platforms maintainers and/or ASoC maintainers see fit.

> The patch works on a MIPS testboard.

Great, thanks for testing and reporting!

-- 
Jean Delvare


More information about the Alsa-devel mailing list