[alsa-devel] [PATCH v3] ASoC CS4270 codec device driver

Timur Tabi timur at freescale.com
Tue Jul 31 20:53:16 CEST 2007


Trent Piepho wrote:

> If config FOO is compiled in (i.e.  it's "y"), CONFIG_FOO will be defined.
> If it's a module, CONFIG_FOO_MODULE will be defined.  It's one or the
> other, not both.

Learn something new every day.  I should have known that already, though.

> If you want your code to comple differently if it has i2c available, you should
> do this:
> 
> #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
> /* code that needs i2c goes here, i2c_transfer(), etc. */
> #endif
> 
> Note that just checking defined(CONFIG_I2C_MODULE) isn't correct.  If your
> code is compiled in and i2c is a module, you can't call i2c functions or
> the kernel won't link.

Which is a problem because ASoC currently requires all modules to be linked together.  The 
machine driver has hard-coded references to structures in the other drivers.

I think Liam was trying to fix that with the PowerPC branch, but it doesn't look like he's 
finished.

> Of course, if you need i2c to work in any reasonble way, you should just
> have your driver depend on i2c in Kconfig.

Well, that's the odd thing about the CS4270 - it's not required.  The CS4270 can work with 
or without I2C.  I tried writing the driver to be intelligent about that - if I2C is 
enabled, but the device can't be found on the I2C bus, it falls back to "stand-alone" mode.

It looks like I'm not really going to be able to support stand-alone mode yet, anyway.  So 
I'll just try to make it compile when I2C is disabled.

-- 
Timur Tabi
Linux Kernel Developer @ Freescale


More information about the Alsa-devel mailing list