Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branch 'asoc/topic/adav80x' into asoc-adau1977

+135 -124
+2 -1
sound/soc/blackfin/Kconfig
··· 47 47 tristate "Support for the EVAL-ADAV80X boards on Blackfin eval boards" 48 48 depends on SND_BF5XX_I2S && (SPI_MASTER || I2C) 49 49 select SND_BF5XX_SOC_I2S 50 - select SND_SOC_ADAV80X 50 + select SND_SOC_ADAV801 if SPI_MASTER 51 + select SND_SOC_ADAV803 if I2C 51 52 help 52 53 Say Y if you want to add support for the Analog Devices EVAL-ADAV801 or 53 54 EVAL-ADAV803 board connected to one of the Blackfin evaluation boards
+10 -1
sound/soc/codecs/Kconfig
··· 22 22 select SND_SOC_AD1980 if SND_SOC_AC97_BUS 23 23 select SND_SOC_AD73311 24 24 select SND_SOC_ADAU1373 if I2C 25 - select SND_SOC_ADAV80X if SND_SOC_I2C_AND_SPI 25 + select SND_SOC_ADAV801 if SPI_MASTER 26 + select SND_SOC_ADAV803 if I2C 26 27 select SND_SOC_ADAU1701 if I2C 27 28 select SND_SOC_ADS117X 28 29 select SND_SOC_AK4104 if SPI_MASTER ··· 202 201 203 202 config SND_SOC_ADAV80X 204 203 tristate 204 + 205 + config SND_SOC_ADAV801 206 + tristate 207 + select SND_SOC_ADAV80X 208 + 209 + config SND_SOC_ADAV803 210 + tristate 211 + select SND_SOC_ADAV80X 205 212 206 213 config SND_SOC_ADS117X 207 214 tristate
+4
sound/soc/codecs/Makefile
··· 8 8 snd-soc-adau1701-objs := adau1701.o 9 9 snd-soc-adau1373-objs := adau1373.o 10 10 snd-soc-adav80x-objs := adav80x.o 11 + snd-soc-adav801-objs := adav801.o 12 + snd-soc-adav803-objs := adav803.o 11 13 snd-soc-ads117x-objs := ads117x.o 12 14 snd-soc-ak4104-objs := ak4104.o 13 15 snd-soc-ak4535-objs := ak4535.o ··· 141 139 obj-$(CONFIG_SND_SOC_ADAU1373) += snd-soc-adau1373.o 142 140 obj-$(CONFIG_SND_SOC_ADAU1701) += snd-soc-adau1701.o 143 141 obj-$(CONFIG_SND_SOC_ADAV80X) += snd-soc-adav80x.o 142 + obj-$(CONFIG_SND_SOC_ADAV801) += snd-soc-adav801.o 143 + obj-$(CONFIG_SND_SOC_ADAV803) += snd-soc-adav803.o 144 144 obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o 145 145 obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o 146 146 obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o
+53
sound/soc/codecs/adav801.c
··· 1 + /* 2 + * ADAV801 audio driver 3 + * 4 + * Copyright 2014 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2. 7 + */ 8 + 9 + #include <linux/module.h> 10 + #include <linux/spi/spi.h> 11 + #include <linux/regmap.h> 12 + 13 + #include <sound/soc.h> 14 + 15 + #include "adav80x.h" 16 + 17 + static const struct spi_device_id adav80x_spi_id[] = { 18 + { "adav801", 0 }, 19 + { } 20 + }; 21 + MODULE_DEVICE_TABLE(spi, adav80x_spi_id); 22 + 23 + static int adav80x_spi_probe(struct spi_device *spi) 24 + { 25 + struct regmap_config config; 26 + 27 + config = adav80x_regmap_config; 28 + config.read_flag_mask = 0x01; 29 + 30 + return adav80x_bus_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); 31 + } 32 + 33 + static int adav80x_spi_remove(struct spi_device *spi) 34 + { 35 + snd_soc_unregister_codec(&spi->dev); 36 + return 0; 37 + } 38 + 39 + static struct spi_driver adav80x_spi_driver = { 40 + .driver = { 41 + .name = "adav801", 42 + .owner = THIS_MODULE, 43 + }, 44 + .probe = adav80x_spi_probe, 45 + .remove = adav80x_spi_remove, 46 + .id_table = adav80x_spi_id, 47 + }; 48 + module_spi_driver(adav80x_spi_driver); 49 + 50 + MODULE_DESCRIPTION("ASoC ADAV801 driver"); 51 + MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 52 + MODULE_AUTHOR("Yi Li <yi.li@analog.com>>"); 53 + MODULE_LICENSE("GPL");
+50
sound/soc/codecs/adav803.c
··· 1 + /* 2 + * ADAV803 audio driver 3 + * 4 + * Copyright 2014 Analog Devices Inc. 5 + * 6 + * Licensed under the GPL-2. 7 + */ 8 + 9 + #include <linux/module.h> 10 + #include <linux/i2c.h> 11 + #include <linux/regmap.h> 12 + 13 + #include <sound/soc.h> 14 + 15 + #include "adav80x.h" 16 + 17 + static const struct i2c_device_id adav803_id[] = { 18 + { "adav803", 0 }, 19 + { } 20 + }; 21 + MODULE_DEVICE_TABLE(i2c, adav803_id); 22 + 23 + static int adav803_probe(struct i2c_client *client, 24 + const struct i2c_device_id *id) 25 + { 26 + return adav80x_bus_probe(&client->dev, 27 + devm_regmap_init_i2c(client, &adav80x_regmap_config)); 28 + } 29 + 30 + static int adav803_remove(struct i2c_client *client) 31 + { 32 + snd_soc_unregister_codec(&client->dev); 33 + return 0; 34 + } 35 + 36 + static struct i2c_driver adav803_driver = { 37 + .driver = { 38 + .name = "adav803", 39 + .owner = THIS_MODULE, 40 + }, 41 + .probe = adav803_probe, 42 + .remove = adav803_remove, 43 + .id_table = adav803_id, 44 + }; 45 + module_i2c_driver(adav803_driver); 46 + 47 + MODULE_DESCRIPTION("ASoC ADAV803 driver"); 48 + MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 49 + MODULE_AUTHOR("Yi Li <yi.li@analog.com>>"); 50 + MODULE_LICENSE("GPL");
+9 -122
sound/soc/codecs/adav80x.c
··· 8 8 * Licensed under the GPL-2 or later. 9 9 */ 10 10 11 - #include <linux/init.h> 12 11 #include <linux/module.h> 13 12 #include <linux/kernel.h> 14 - #include <linux/i2c.h> 15 - #include <linux/spi/spi.h> 13 + #include <linux/regmap.h> 16 14 #include <linux/slab.h> 17 - #include <sound/core.h> 15 + 18 16 #include <sound/pcm.h> 19 17 #include <sound/pcm_params.h> 20 - #include <sound/tlv.h> 21 18 #include <sound/soc.h> 19 + #include <sound/tlv.h> 22 20 23 21 #include "adav80x.h" 24 22 ··· 862 864 .num_dapm_routes = ARRAY_SIZE(adav80x_dapm_routes), 863 865 }; 864 866 865 - static int adav80x_bus_probe(struct device *dev, struct regmap *regmap) 867 + int adav80x_bus_probe(struct device *dev, struct regmap *regmap) 866 868 { 867 869 struct adav80x *adav80x; 868 - int ret; 869 870 870 871 if (IS_ERR(regmap)) 871 872 return PTR_ERR(regmap); 872 873 873 - adav80x = kzalloc(sizeof(*adav80x), GFP_KERNEL); 874 + adav80x = devm_kzalloc(dev, sizeof(*adav80x), GFP_KERNEL); 874 875 if (!adav80x) 875 876 return -ENOMEM; 876 - 877 877 878 878 dev_set_drvdata(dev, adav80x); 879 879 adav80x->regmap = regmap; 880 880 881 - ret = snd_soc_register_codec(dev, &adav80x_codec_driver, 881 + return snd_soc_register_codec(dev, &adav80x_codec_driver, 882 882 adav80x_dais, ARRAY_SIZE(adav80x_dais)); 883 - if (ret) 884 - kfree(adav80x); 885 - 886 - return ret; 887 883 } 884 + EXPORT_SYMBOL_GPL(adav80x_bus_probe); 888 885 889 - static int adav80x_bus_remove(struct device *dev) 890 - { 891 - snd_soc_unregister_codec(dev); 892 - kfree(dev_get_drvdata(dev)); 893 - return 0; 894 - } 895 - 896 - #if defined(CONFIG_SPI_MASTER) 897 - static const struct regmap_config adav80x_spi_regmap_config = { 886 + const struct regmap_config adav80x_regmap_config = { 898 887 .val_bits = 8, 899 888 .pad_bits = 1, 900 889 .reg_bits = 7, ··· 893 908 .reg_defaults = adav80x_reg_defaults, 894 909 .num_reg_defaults = ARRAY_SIZE(adav80x_reg_defaults), 895 910 }; 896 - 897 - static const struct spi_device_id adav80x_spi_id[] = { 898 - { "adav801", 0 }, 899 - { } 900 - }; 901 - MODULE_DEVICE_TABLE(spi, adav80x_spi_id); 902 - 903 - static int adav80x_spi_probe(struct spi_device *spi) 904 - { 905 - return adav80x_bus_probe(&spi->dev, 906 - devm_regmap_init_spi(spi, &adav80x_spi_regmap_config)); 907 - } 908 - 909 - static int adav80x_spi_remove(struct spi_device *spi) 910 - { 911 - return adav80x_bus_remove(&spi->dev); 912 - } 913 - 914 - static struct spi_driver adav80x_spi_driver = { 915 - .driver = { 916 - .name = "adav801", 917 - .owner = THIS_MODULE, 918 - }, 919 - .probe = adav80x_spi_probe, 920 - .remove = adav80x_spi_remove, 921 - .id_table = adav80x_spi_id, 922 - }; 923 - #endif 924 - 925 - #if IS_ENABLED(CONFIG_I2C) 926 - static const struct regmap_config adav80x_i2c_regmap_config = { 927 - .val_bits = 8, 928 - .pad_bits = 1, 929 - .reg_bits = 7, 930 - 931 - .max_register = ADAV80X_PLL_OUTE, 932 - 933 - .cache_type = REGCACHE_RBTREE, 934 - .reg_defaults = adav80x_reg_defaults, 935 - .num_reg_defaults = ARRAY_SIZE(adav80x_reg_defaults), 936 - }; 937 - 938 - static const struct i2c_device_id adav80x_i2c_id[] = { 939 - { "adav803", 0 }, 940 - { } 941 - }; 942 - MODULE_DEVICE_TABLE(i2c, adav80x_i2c_id); 943 - 944 - static int adav80x_i2c_probe(struct i2c_client *client, 945 - const struct i2c_device_id *id) 946 - { 947 - return adav80x_bus_probe(&client->dev, 948 - devm_regmap_init_i2c(client, &adav80x_i2c_regmap_config)); 949 - } 950 - 951 - static int adav80x_i2c_remove(struct i2c_client *client) 952 - { 953 - return adav80x_bus_remove(&client->dev); 954 - } 955 - 956 - static struct i2c_driver adav80x_i2c_driver = { 957 - .driver = { 958 - .name = "adav803", 959 - .owner = THIS_MODULE, 960 - }, 961 - .probe = adav80x_i2c_probe, 962 - .remove = adav80x_i2c_remove, 963 - .id_table = adav80x_i2c_id, 964 - }; 965 - #endif 966 - 967 - static int __init adav80x_init(void) 968 - { 969 - int ret = 0; 970 - 971 - #if IS_ENABLED(CONFIG_I2C) 972 - ret = i2c_add_driver(&adav80x_i2c_driver); 973 - if (ret) 974 - return ret; 975 - #endif 976 - 977 - #if defined(CONFIG_SPI_MASTER) 978 - ret = spi_register_driver(&adav80x_spi_driver); 979 - #endif 980 - 981 - return ret; 982 - } 983 - module_init(adav80x_init); 984 - 985 - static void __exit adav80x_exit(void) 986 - { 987 - #if IS_ENABLED(CONFIG_I2C) 988 - i2c_del_driver(&adav80x_i2c_driver); 989 - #endif 990 - #if defined(CONFIG_SPI_MASTER) 991 - spi_unregister_driver(&adav80x_spi_driver); 992 - #endif 993 - } 994 - module_exit(adav80x_exit); 911 + EXPORT_SYMBOL_GPL(adav80x_regmap_config); 995 912 996 913 MODULE_DESCRIPTION("ASoC ADAV80x driver"); 997 914 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
+7
sound/soc/codecs/adav80x.h
··· 9 9 #ifndef _ADAV80X_H 10 10 #define _ADAV80X_H 11 11 12 + #include <linux/regmap.h> 13 + 14 + struct device; 15 + 16 + extern const struct regmap_config adav80x_regmap_config; 17 + int adav80x_bus_probe(struct device *dev, struct regmap *regmap); 18 + 12 19 enum adav80x_pll_src { 13 20 ADAV80X_PLL_SRC_XIN, 14 21 ADAV80X_PLL_SRC_XTAL,