0001
0002
0003
0004
0005
0006
0007 #include <linux/clk.h>
0008 #include <linux/err.h>
0009 #include <linux/init.h>
0010 #include <linux/io.h>
0011 #include <linux/module.h>
0012 #include <linux/regmap.h>
0013 #include <linux/slab.h>
0014
0015 #include <sound/ac97_codec.h>
0016
0017 bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg)
0018 {
0019 switch (reg) {
0020 case AC97_RESET:
0021 case AC97_POWERDOWN:
0022 case AC97_INT_PAGING:
0023 case AC97_EXTENDED_ID:
0024 case AC97_EXTENDED_STATUS:
0025 case AC97_EXTENDED_MID:
0026 case AC97_EXTENDED_MSTATUS:
0027 case AC97_GPIO_STATUS:
0028 case AC97_MISC_AFE:
0029 case AC97_VENDOR_ID1:
0030 case AC97_VENDOR_ID2:
0031 case AC97_CODEC_CLASS_REV:
0032 case AC97_PCI_SVID:
0033 case AC97_PCI_SID:
0034 case AC97_FUNC_SELECT:
0035 case AC97_FUNC_INFO:
0036 case AC97_SENSE_INFO:
0037 return true;
0038 default:
0039 return false;
0040 }
0041 }
0042 EXPORT_SYMBOL_GPL(regmap_ac97_default_volatile);
0043
0044 static int regmap_ac97_reg_read(void *context, unsigned int reg,
0045 unsigned int *val)
0046 {
0047 struct snd_ac97 *ac97 = context;
0048
0049 *val = ac97->bus->ops->read(ac97, reg);
0050
0051 return 0;
0052 }
0053
0054 static int regmap_ac97_reg_write(void *context, unsigned int reg,
0055 unsigned int val)
0056 {
0057 struct snd_ac97 *ac97 = context;
0058
0059 ac97->bus->ops->write(ac97, reg, val);
0060
0061 return 0;
0062 }
0063
0064 static const struct regmap_bus ac97_regmap_bus = {
0065 .reg_write = regmap_ac97_reg_write,
0066 .reg_read = regmap_ac97_reg_read,
0067 };
0068
0069 struct regmap *__regmap_init_ac97(struct snd_ac97 *ac97,
0070 const struct regmap_config *config,
0071 struct lock_class_key *lock_key,
0072 const char *lock_name)
0073 {
0074 return __regmap_init(&ac97->dev, &ac97_regmap_bus, ac97, config,
0075 lock_key, lock_name);
0076 }
0077 EXPORT_SYMBOL_GPL(__regmap_init_ac97);
0078
0079 struct regmap *__devm_regmap_init_ac97(struct snd_ac97 *ac97,
0080 const struct regmap_config *config,
0081 struct lock_class_key *lock_key,
0082 const char *lock_name)
0083 {
0084 return __devm_regmap_init(&ac97->dev, &ac97_regmap_bus, ac97, config,
0085 lock_key, lock_name);
0086 }
0087 EXPORT_SYMBOL_GPL(__devm_regmap_init_ac97);
0088
0089 MODULE_LICENSE("GPL v2");