This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Disabling Sound and the regmap

I’m trying to clean up the defconfig a little bit, take out things that I don’t need and so forth, and I’ve hit a snag. In my defconfig right now I have the Sound driver support enabled, but I don't need it:

Device Drivers ---> 
    <M> Sound card support --->
            --- Sound card support                                  
            [*]   Preclaim OSS device numbers                
            <M>   Advanced Linux Sound Architecture  --->  
            < >   Open Sound System (DEPRECATED)  ----

and so I was trying to remove this support. Now what happened when I disabled the top level Sound card support was that in the .config file I lost a CONFIG_REGMAP_SPI which I was not expecting.

I didn’t know what a CONFIG_REGMAP_XXX does so I went and did a little research and I don’t think it’s tied to sound at all, it looks like it’s just an abstraction layer for registers so they don’t always have to go back to the CPU in order to get register values and save time on the bus. So I tried to figure out why the REGMAP_SPI was disabled and looking at the menuconfig entry for CONFIG_REGMAP_SPI I see the following logic required to enable it:

BMP085_SPI      [=n] && SPI_MASTER [=y] && SYSFS      [=y] ||
SERIAL_MAX310X  [=n] && TTY        [=y] && HAS_IOMEM  [=y] && SPI_MASTER [=y] ||
MFD_DA9052_SPI  [=n] && HAS_IOMEM  [=y] && SPI_MASTER [=y] ||
MFD_MC13XXX_SPI [=n] && HAS_IOMEM  [=y] && SPI_MASTER [=y] ||
MFD_ARIZONA_SPI [=n] && HAS_IOMEM  [=y] && SPI_MASTER [=y] ||
MFD_WM831X_SPI  [=n] && HAS_IOMEM  [=y] && SPI_MASTER [=y] ||
SND_SOC         [=n] && SOUND      [=n] && !M68K && !UML && SND [=n] && SPI_MASTER [=y] ||
AD5380          [=n] && IIO        [=m] && (SPI_MASTER [=y] && I2C [=y]!=m || I2C [=y]) && SPI_MASTER [=y]

My defconfig has most of these non device specific options set to 1 (SPI_MASTER, SYSFS, TTY, HAS_IOMEN, IIO, I2C) and most of the device specific options not set (BMP085_SPI, SERIAL_MAX310X, MFD_DA9052_SPI, MFD_MC13XXX_SPI, MFD_ARIZONA_SPI, MFD_WM831X_SPI, AD5380). This leads me to believe that “is not set” is not the same as “=n”, and also that the SND_SOC line is the only one that was keeping CONFIG_REGMAP_SPI enabled. 

Greping in the kernel code base for CONFIG_REGMAP_SPI I see it only used for sound/soc/soc-io.c, so I took a look around for places the "regmap" + "spi" was used and I found a number of drivers that referenced these functions: 

MFD’s:
mc13xxx – power/audio
wm5102 – Codecs/Voice DSP
wm831x - PMIC
da9052 - PMIC
arizona - audio
wm5110 – audio chip

Misc:
bmp085 – temperature/pressure/altitude sensor

iio:
ad5380 – DtoA converter

tty:
serial – max310x - UART

and various sound SOC codecs. 

I don't use any of these devices, so I think that it's OK for me to disable Sound (and therefore REGMAP_SPI) but I would like confirmation of two things:

1) Given that I don't use any of those drivers and Audio/sound in my design. Should I be safe removing sound (and therefore REGMAP_SPI) from my kernel?

2) Am I correct about REGMAP_SPI being used as a register abstraction layer? 

  • Mike Worster said:
    2) Am I correct about REGMAP_SPI being used as a register abstraction layer? 

    A device like an audio codec has its own register address map.  Often times those registers are accessible via SPI or I2C.  The "regmap" provides a common way of abstracting that register map.  In other words, regardless of whether a given board chooses the SPI interface or the I2C interface the "regmap" will be the same.  ALSA is one of the main users of regmap.  All the ALSA codecs are supposed to use these regmap APIs to help isolate the underlying interface since it is often interchangeable.

    Mike Worster said:
    1) Given that I don't use any of those drivers and Audio/sound in my design. Should I be safe removing sound (and therefore REGMAP_SPI) from my kernel?

    If you're not using any SPI-based devices whose drivers utilize REGMAP_SPI, then yes, you can remove this.

  • Hi,

    I am using am335x in Linux 3.12 SDK7 version., How to enable bmp085 sensor in my kernel tree.

    Regards,

    Anil