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

TOMOYO Linux Cross Reference
Linux/sound/soc/codecs/cs35l45-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 // cs35l45-i2c.c -- CS35L45 I2C driver
  4 //
  5 // Copyright 2019-2022 Cirrus Logic, Inc.
  6 //
  7 // Author: James Schulman <james.schulman@cirrus.com>
  8 
  9 #include <linux/device.h>
 10 #include <linux/module.h>
 11 #include <linux/i2c.h>
 12 #include <linux/regmap.h>
 13 
 14 #include "cs35l45.h"
 15 
 16 static int cs35l45_i2c_probe(struct i2c_client *client)
 17 {
 18         struct cs35l45_private *cs35l45;
 19         struct device *dev = &client->dev;
 20         int ret;
 21 
 22         cs35l45 = devm_kzalloc(dev, sizeof(struct cs35l45_private), GFP_KERNEL);
 23         if (!cs35l45)
 24                 return -ENOMEM;
 25 
 26         i2c_set_clientdata(client, cs35l45);
 27         cs35l45->regmap = devm_regmap_init_i2c(client, &cs35l45_i2c_regmap);
 28         if (IS_ERR(cs35l45->regmap)) {
 29                 ret = PTR_ERR(cs35l45->regmap);
 30                 dev_err(dev, "Failed to allocate register map: %d\n", ret);
 31                 return ret;
 32         }
 33 
 34         cs35l45->dev = dev;
 35         cs35l45->irq = client->irq;
 36         cs35l45->bus_type = CONTROL_BUS_I2C;
 37         cs35l45->i2c_addr = client->addr;
 38 
 39         return cs35l45_probe(cs35l45);
 40 }
 41 
 42 static void cs35l45_i2c_remove(struct i2c_client *client)
 43 {
 44         struct cs35l45_private *cs35l45 = i2c_get_clientdata(client);
 45 
 46         cs35l45_remove(cs35l45);
 47 }
 48 
 49 static const struct of_device_id cs35l45_of_match[] = {
 50         { .compatible = "cirrus,cs35l45" },
 51         {},
 52 };
 53 MODULE_DEVICE_TABLE(of, cs35l45_of_match);
 54 
 55 static const struct i2c_device_id cs35l45_id_i2c[] = {
 56         { "cs35l45" },
 57         {}
 58 };
 59 MODULE_DEVICE_TABLE(i2c, cs35l45_id_i2c);
 60 
 61 static struct i2c_driver cs35l45_i2c_driver = {
 62         .driver = {
 63                 .name           = "cs35l45",
 64                 .of_match_table = cs35l45_of_match,
 65                 .pm             = pm_ptr(&cs35l45_pm_ops),
 66         },
 67         .id_table       = cs35l45_id_i2c,
 68         .probe          = cs35l45_i2c_probe,
 69         .remove         = cs35l45_i2c_remove,
 70 };
 71 module_i2c_driver(cs35l45_i2c_driver);
 72 
 73 MODULE_DESCRIPTION("I2C CS35L45 driver");
 74 MODULE_AUTHOR("James Schulman, Cirrus Logic Inc, <james.schulman@cirrus.com>");
 75 MODULE_LICENSE("GPL");
 76 MODULE_IMPORT_NS(SND_SOC_CS35L45);
 77 

~ [ 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