xref: /openbmc/linux/sound/soc/codecs/cs4271-spi.c (revision 2e9688c8)
1c942fddfSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2c973b8a7SAxel Lin /*
3c973b8a7SAxel Lin  * CS4271 SPI audio driver
4c973b8a7SAxel Lin  *
5c973b8a7SAxel Lin  * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru>
6c973b8a7SAxel Lin  */
7c973b8a7SAxel Lin 
8c973b8a7SAxel Lin #include <linux/module.h>
9c973b8a7SAxel Lin #include <linux/spi/spi.h>
10c973b8a7SAxel Lin #include <linux/regmap.h>
11c973b8a7SAxel Lin #include <sound/soc.h>
12c973b8a7SAxel Lin #include "cs4271.h"
13c973b8a7SAxel Lin 
cs4271_spi_probe(struct spi_device * spi)14c973b8a7SAxel Lin static int cs4271_spi_probe(struct spi_device *spi)
15c973b8a7SAxel Lin {
16c973b8a7SAxel Lin 	struct regmap_config config;
17c973b8a7SAxel Lin 
18c973b8a7SAxel Lin 	config = cs4271_regmap_config;
19c973b8a7SAxel Lin 	config.reg_bits = 16;
20c973b8a7SAxel Lin 	config.read_flag_mask = 0x21;
21c973b8a7SAxel Lin 	config.write_flag_mask = 0x20;
22c973b8a7SAxel Lin 
23c973b8a7SAxel Lin 	return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config));
24c973b8a7SAxel Lin }
25c973b8a7SAxel Lin 
26c973b8a7SAxel Lin static struct spi_driver cs4271_spi_driver = {
27c973b8a7SAxel Lin 	.driver = {
28c973b8a7SAxel Lin 		.name	= "cs4271",
29c973b8a7SAxel Lin 		.of_match_table = of_match_ptr(cs4271_dt_ids),
30c973b8a7SAxel Lin 	},
31c973b8a7SAxel Lin 	.probe		= cs4271_spi_probe,
32c973b8a7SAxel Lin };
33c973b8a7SAxel Lin module_spi_driver(cs4271_spi_driver);
34c973b8a7SAxel Lin 
35c973b8a7SAxel Lin MODULE_DESCRIPTION("ASoC CS4271 SPI Driver");
36c973b8a7SAxel Lin MODULE_AUTHOR("Alexander Sverdlin <subaparts@yandex.ru>");
37c973b8a7SAxel Lin MODULE_LICENSE("GPL");
38