0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/mod_devicetable.h>
0010 #include <linux/module.h>
0011 #include <linux/regmap.h>
0012 #include <linux/spi/spi.h>
0013 #include <sound/soc.h>
0014
0015 #include "adau1372.h"
0016
0017 static void adau1372_spi_switch_mode(struct device *dev)
0018 {
0019 struct spi_device *spi = to_spi_device(dev);
0020
0021
0022
0023
0024
0025 spi_w8r8(spi, 0x00);
0026 spi_w8r8(spi, 0x00);
0027 spi_w8r8(spi, 0x00);
0028 }
0029
0030 static int adau1372_spi_probe(struct spi_device *spi)
0031 {
0032 struct regmap_config config;
0033
0034 config = adau1372_regmap_config;
0035 config.read_flag_mask = 0x1;
0036
0037 return adau1372_probe(&spi->dev,
0038 devm_regmap_init_spi(spi, &config), adau1372_spi_switch_mode);
0039 }
0040
0041 static const struct spi_device_id adau1372_spi_id[] = {
0042 { "adau1372", 0 },
0043 { }
0044 };
0045 MODULE_DEVICE_TABLE(spi, adau1372_spi_id);
0046
0047 static struct spi_driver adau1372_spi_driver = {
0048 .driver = {
0049 .name = "adau1372",
0050 },
0051 .probe = adau1372_spi_probe,
0052 .id_table = adau1372_spi_id,
0053 };
0054 module_spi_driver(adau1372_spi_driver);
0055
0056 MODULE_DESCRIPTION("ASoC ADAU1372 CODEC SPI driver");
0057 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
0058 MODULE_LICENSE("GPL v2");