Re: [PATCH v3] ASoC CS4270 codec device driver

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

 



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
_______________________________________________
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