Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * AD1938/AD1939 audio driver
0004  *
0005  * Copyright 2014 Analog Devices Inc.
0006  */
0007 
0008 #include <linux/module.h>
0009 #include <linux/spi/spi.h>
0010 #include <linux/regmap.h>
0011 
0012 #include <sound/soc.h>
0013 
0014 #include "ad193x.h"
0015 
0016 static int ad193x_spi_probe(struct spi_device *spi)
0017 {
0018     const struct spi_device_id *id = spi_get_device_id(spi);
0019     struct regmap_config config;
0020 
0021     config = ad193x_regmap_config;
0022     config.val_bits = 8;
0023     config.reg_bits = 16;
0024     config.read_flag_mask = 0x09;
0025     config.write_flag_mask = 0x08;
0026 
0027     return ad193x_probe(&spi->dev, devm_regmap_init_spi(spi, &config),
0028                 (enum ad193x_type)id->driver_data);
0029 }
0030 
0031 static const struct spi_device_id ad193x_spi_id[] = {
0032     { "ad193x", AD193X },
0033     { "ad1933", AD1933 },
0034     { "ad1934", AD1934 },
0035     { "ad1938", AD193X },
0036     { "ad1939", AD193X },
0037     { "adau1328", AD193X },
0038     { }
0039 };
0040 MODULE_DEVICE_TABLE(spi, ad193x_spi_id);
0041 
0042 static struct spi_driver ad193x_spi_driver = {
0043     .driver = {
0044         .name   = "ad193x",
0045     },
0046     .probe      = ad193x_spi_probe,
0047     .id_table   = ad193x_spi_id,
0048 };
0049 module_spi_driver(ad193x_spi_driver);
0050 
0051 MODULE_DESCRIPTION("ASoC AD1938/AD1939 audio CODEC driver");
0052 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
0053 MODULE_LICENSE("GPL");