1c973b8a7SAxel Lin /* 2c973b8a7SAxel Lin * CS4271 SPI audio driver 3c973b8a7SAxel Lin * 4c973b8a7SAxel Lin * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru> 5c973b8a7SAxel Lin * 6c973b8a7SAxel Lin * This program is free software; you can redistribute it and/or 7c973b8a7SAxel Lin * modify it under the terms of the GNU General Public License 8c973b8a7SAxel Lin * as published by the Free Software Foundation; either version 2 9c973b8a7SAxel Lin * of the License, or (at your option) any later version. 10c973b8a7SAxel Lin * 11c973b8a7SAxel Lin * This program is distributed in the hope that it will be useful, 12c973b8a7SAxel Lin * but WITHOUT ANY WARRANTY; without even the implied warranty of 13c973b8a7SAxel Lin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14c973b8a7SAxel Lin * GNU General Public License for more details. 15c973b8a7SAxel Lin */ 16c973b8a7SAxel Lin 17c973b8a7SAxel Lin #include <linux/module.h> 18c973b8a7SAxel Lin #include <linux/spi/spi.h> 19c973b8a7SAxel Lin #include <linux/regmap.h> 20c973b8a7SAxel Lin #include <sound/soc.h> 21c973b8a7SAxel Lin #include "cs4271.h" 22c973b8a7SAxel Lin 23c973b8a7SAxel Lin static int cs4271_spi_probe(struct spi_device *spi) 24c973b8a7SAxel Lin { 25c973b8a7SAxel Lin struct regmap_config config; 26c973b8a7SAxel Lin 27c973b8a7SAxel Lin config = cs4271_regmap_config; 28c973b8a7SAxel Lin config.reg_bits = 16; 29c973b8a7SAxel Lin config.val_bits = 8; 30c973b8a7SAxel Lin config.read_flag_mask = 0x21; 31c973b8a7SAxel Lin config.write_flag_mask = 0x20; 32c973b8a7SAxel Lin 33c973b8a7SAxel Lin return cs4271_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); 34c973b8a7SAxel Lin } 35c973b8a7SAxel Lin 36c973b8a7SAxel Lin static int cs4271_spi_remove(struct spi_device *spi) 37c973b8a7SAxel Lin { 38c973b8a7SAxel Lin snd_soc_unregister_codec(&spi->dev); 39c973b8a7SAxel Lin return 0; 40c973b8a7SAxel Lin } 41c973b8a7SAxel Lin 42c973b8a7SAxel Lin static struct spi_driver cs4271_spi_driver = { 43c973b8a7SAxel Lin .driver = { 44c973b8a7SAxel Lin .name = "cs4271", 45c973b8a7SAxel Lin .owner = THIS_MODULE, 46c973b8a7SAxel Lin .of_match_table = of_match_ptr(cs4271_dt_ids), 47c973b8a7SAxel Lin }, 48c973b8a7SAxel Lin .probe = cs4271_spi_probe, 49c973b8a7SAxel Lin .remove = cs4271_spi_remove, 50c973b8a7SAxel Lin }; 51c973b8a7SAxel Lin module_spi_driver(cs4271_spi_driver); 52c973b8a7SAxel Lin 53c973b8a7SAxel Lin MODULE_DESCRIPTION("ASoC CS4271 SPI Driver"); 54c973b8a7SAxel Lin MODULE_AUTHOR("Alexander Sverdlin <subaparts@yandex.ru>"); 55c973b8a7SAxel Lin MODULE_LICENSE("GPL"); 56