You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.4 KiB

  1. **Driver for the Adafruit I2S MEMS Microphone**
  2. [Product learn page on Adafruit](https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/overview).
  3. Known problems with this driver: Low vol level. While you can use the alsa magic socery to make an alsa softvol input, that approach won't work out of the box with anything that uses Pulseaudio. If you have any idea how to make this work with Pulse, please drop me a line.
  4. Installing the I2S microphone driver the easy way
  5. ====================================
  6. If you use Raspbian or any Debian-derived distribution, [go to the releases tab](https://github.com/htruong/snd-i2s_rpi/releases) and download the newest deb version.
  7. Then do the following
  8. ```bash
  9. # Installing raspberrypi-kernel-headers works only if you haven't messed with
  10. # the rpi-update thing.
  11. # If you did, then you would have to do the rpi-source method
  12. # to get the kernel headers. See:
  13. # https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-and-test#kernel-compiling
  14. $ sudo apt install dkms raspberrypi-kernel-headers
  15. $ sudo dpkg -i snd-i2s-rpi-dkms_0.0.2_all.deb
  16. # For this to work, remember to modify these first:
  17. # /boot/config.txt -> dtparam=i2s=on
  18. # and
  19. # /etc/modules -> snd-bcm2835
  20. # remember to reboot
  21. $ sudo modprobe snd-i2s_rpi rpi_platform_generation=0
  22. # rpi_platform_generation=0 for Raspberry Pi 1 B/A/A+, 0
  23. # do not add anything for everything else (2/3).
  24. # see if it works
  25. $ dmesg | grep i2s
  26. # it should say blah.i2s mapping OK
  27. # [ 3.519017] snd_i2s_rpi: loading out-of-tree module taints kernel.
  28. # [ 3.519881] snd-i2s_rpi: Version 0.0.2
  29. # [ 3.519889] snd-i2s_rpi: Setting platform to 20203000.i2s
  30. # [ 7.624559] asoc-simple-card asoc-simple-card.0: ASoC: CPU DAI 20203000.i2s not registered - will retry
  31. # ... snip ...
  32. # [ 9.507142] asoc-simple-card asoc-simple-card.0: snd-soc-dummy-dai <-> 20203000.i2s mapping ok
  33. $ arecord -l
  34. # it should list your mic
  35. # note that the default vol level is very low, you need
  36. # to follow the ladyada's guide to make it hearable
  37. # If you want it to load automatically at startup
  38. # 1. Add to /etc/modules
  39. # snd-i2s_rpi
  40. # 2. If you have a Pi old-gen, you need to do this:
  41. # create file called /etc/modprobe.d/snd-i2s_rpi.conf
  42. # add this line
  43. # options snd-i2s_rpi rpi_platform_generation=0
  44. ```
  45. Installing as a stand-alone module
  46. ====================================
  47. make
  48. sudo make install
  49. To load the driver manually, run this as root:
  50. modprobe snd-i2s_rpi
  51. You may also specify custom toolchains by using the `CROSS_COMPILE` flag:
  52. CROSS_COMPILE=/usr/local/bin/arm-eabi-
  53. Installing as a part of the kernel
  54. ======================================
  55. Instructions to come later. Who would ever want to do that?
  56. Installing as a DKMS module
  57. =================================
  58. You can have even more fun with snd-i2s\_rpi by installing it as a DKMS module has the main advantage of being auto-compiled (and thus, possibly surviving) between kernel upgrades.
  59. First, get dkms. On Raspbian this should be:
  60. sudo apt install dkms
  61. Then copy the root of this repository to `/usr/share`:
  62. sudo cp -R . /usr/src/snd-i2s_rpi-0.0.2 (or whatever version number declared on dkms.conf is)
  63. sudo dkms add -m snd-i2s_rpi -v 0.0.2
  64. Build and load the module:
  65. sudo dkms build -m snd-i2s_rpi -v 0.0.2
  66. sudo dkms install -m snd-i2s_rpi -v 0.0.2
  67. Now you have a proper dkms module that will work for a long time... hopefully.