2 * AD1938/AD1939 audio driver
4 * Copyright 2014 Analog Devices Inc.
6 * Licensed under the GPL-2.
9 #include <linux/module.h>
10 #include <linux/spi/spi.h>
11 #include <linux/regmap.h>
13 #include <sound/soc.h>
17 static int ad193x_spi_probe(struct spi_device *spi)
19 const struct spi_device_id *id = spi_get_device_id(spi);
20 struct regmap_config config;
22 config = ad193x_regmap_config;
25 config.read_flag_mask = 0x09;
26 config.write_flag_mask = 0x08;
28 return ad193x_probe(&spi->dev, devm_regmap_init_spi(spi, &config),
29 (enum ad193x_type)id->driver_data);
32 static int ad193x_spi_remove(struct spi_device *spi)
34 snd_soc_unregister_codec(&spi->dev);
38 static const struct spi_device_id ad193x_spi_id[] = {
44 { "adau1328", AD193X },
47 MODULE_DEVICE_TABLE(spi, ad193x_spi_id);
49 static struct spi_driver ad193x_spi_driver = {
53 .probe = ad193x_spi_probe,
54 .remove = ad193x_spi_remove,
55 .id_table = ad193x_spi_id,
57 module_spi_driver(ad193x_spi_driver);
59 MODULE_DESCRIPTION("ASoC AD1938/AD1939 audio CODEC driver");
60 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
61 MODULE_LICENSE("GPL");