~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/codecs/adau7118-i2c.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 //
  3 // Analog Devices ADAU7118 8 channel PDM-to-I2S/TDM Converter driver over I2C
  4 //
  5 // Copyright 2019 Analog Devices Inc.
  6 
  7 #include <linux/i2c.h>
  8 #include <linux/module.h>
  9 #include <linux/regmap.h>
 10 
 11 #include "adau7118.h"
 12 
 13 static const struct reg_default adau7118_reg_defaults[] = {
 14         { ADAU7118_REG_VENDOR_ID, 0x41 },
 15         { ADAU7118_REG_DEVICE_ID1, 0x71 },
 16         { ADAU7118_REG_DEVICE_ID2, 0x18 },
 17         { ADAU7118_REG_REVISION_ID, 0x00 },
 18         { ADAU7118_REG_ENABLES, 0x3F },
 19         { ADAU7118_REG_DEC_RATIO_CLK_MAP, 0xC0 },
 20         { ADAU7118_REG_HPF_CONTROL, 0xD0 },
 21         { ADAU7118_REG_SPT_CTRL1, 0x41 },
 22         { ADAU7118_REG_SPT_CTRL2, 0x00 },
 23         { ADAU7118_REG_SPT_CX(0), 0x01 },
 24         { ADAU7118_REG_SPT_CX(1), 0x11 },
 25         { ADAU7118_REG_SPT_CX(2), 0x21 },
 26         { ADAU7118_REG_SPT_CX(3), 0x31 },
 27         { ADAU7118_REG_SPT_CX(4), 0x41 },
 28         { ADAU7118_REG_SPT_CX(5), 0x51 },
 29         { ADAU7118_REG_SPT_CX(6), 0x61 },
 30         { ADAU7118_REG_SPT_CX(7), 0x71 },
 31         { ADAU7118_REG_DRIVE_STRENGTH, 0x2a },
 32         { ADAU7118_REG_RESET, 0x00 },
 33 };
 34 
 35 static bool adau7118_volatile(struct device *dev, unsigned int reg)
 36 {
 37         return (reg == ADAU7118_REG_RESET);
 38 }
 39 
 40 
 41 static const struct regmap_config adau7118_regmap_config = {
 42         .reg_bits = 8,
 43         .val_bits = 8,
 44         .reg_defaults = adau7118_reg_defaults,
 45         .num_reg_defaults = ARRAY_SIZE(adau7118_reg_defaults),
 46         .cache_type = REGCACHE_MAPLE,
 47         .max_register = ADAU7118_REG_RESET,
 48         .volatile_reg = adau7118_volatile,
 49 };
 50 
 51 static int adau7118_probe_i2c(struct i2c_client *i2c)
 52 {
 53         struct regmap *map;
 54 
 55         map = devm_regmap_init_i2c(i2c, &adau7118_regmap_config);
 56         if (IS_ERR(map)) {
 57                 dev_err(&i2c->dev, "Failed to init regmap %ld\n", PTR_ERR(map));
 58                 return PTR_ERR(map);
 59         }
 60 
 61         return adau7118_probe(&i2c->dev, map, false);
 62 }
 63 
 64 static const struct of_device_id adau7118_of_match[] = {
 65         { .compatible = "adi,adau7118" },
 66         {}
 67 };
 68 MODULE_DEVICE_TABLE(of, adau7118_of_match);
 69 
 70 static const struct i2c_device_id adau7118_id[] = {
 71         {"adau7118"},
 72         {}
 73 };
 74 MODULE_DEVICE_TABLE(i2c, adau7118_id);
 75 
 76 static struct i2c_driver adau7118_driver = {
 77         .driver = {
 78                 .name = "adau7118",
 79                 .of_match_table = adau7118_of_match,
 80         },
 81         .probe = adau7118_probe_i2c,
 82         .id_table = adau7118_id,
 83 };
 84 module_i2c_driver(adau7118_driver);
 85 
 86 MODULE_AUTHOR("Nuno Sa <nuno.sa@analog.com>");
 87 MODULE_DESCRIPTION("ADAU7118 8 channel PDM-to-I2S/TDM Converter driver over I2C");
 88 MODULE_LICENSE("GPL");
 89 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php