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

TOMOYO Linux Cross Reference
Linux/sound/soc/codecs/cs35l56-spi.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-only
  2 //
  3 // CS35L56 ALSA SoC audio driver SPI binding
  4 //
  5 // Copyright (C) 2023 Cirrus Logic, Inc. and
  6 //                    Cirrus Logic International Semiconductor Ltd.
  7 
  8 #include <linux/acpi.h>
  9 #include <linux/module.h>
 10 #include <linux/moduleparam.h>
 11 #include <linux/regmap.h>
 12 #include <linux/spi/spi.h>
 13 #include <linux/types.h>
 14 
 15 #include "cs35l56.h"
 16 
 17 static int cs35l56_spi_probe(struct spi_device *spi)
 18 {
 19         const struct regmap_config *regmap_config = &cs35l56_regmap_spi;
 20         struct cs35l56_private *cs35l56;
 21         int ret;
 22 
 23         cs35l56 = devm_kzalloc(&spi->dev, sizeof(struct cs35l56_private), GFP_KERNEL);
 24         if (!cs35l56)
 25                 return -ENOMEM;
 26 
 27         spi_set_drvdata(spi, cs35l56);
 28         cs35l56->base.regmap = devm_regmap_init_spi(spi, regmap_config);
 29         if (IS_ERR(cs35l56->base.regmap)) {
 30                 ret = PTR_ERR(cs35l56->base.regmap);
 31                 return dev_err_probe(&spi->dev, ret, "Failed to allocate register map\n");
 32         }
 33 
 34         cs35l56->base.dev = &spi->dev;
 35         cs35l56->base.can_hibernate = true;
 36 
 37         ret = cs35l56_common_probe(cs35l56);
 38         if (ret != 0)
 39                 return ret;
 40 
 41         ret = cs35l56_init(cs35l56);
 42         if (ret == 0)
 43                 ret = cs35l56_irq_request(&cs35l56->base, spi->irq);
 44         if (ret < 0)
 45                 cs35l56_remove(cs35l56);
 46 
 47         return ret;
 48 }
 49 
 50 static void cs35l56_spi_remove(struct spi_device *spi)
 51 {
 52         struct cs35l56_private *cs35l56 = spi_get_drvdata(spi);
 53 
 54         cs35l56_remove(cs35l56);
 55 }
 56 
 57 static const struct spi_device_id cs35l56_id_spi[] = {
 58         { "cs35l56", 0 },
 59         {}
 60 };
 61 MODULE_DEVICE_TABLE(spi, cs35l56_id_spi);
 62 
 63 #ifdef CONFIG_ACPI
 64 static const struct acpi_device_id cs35l56_asoc_acpi_match[] = {
 65         { "CSC355C", 0 },
 66         {},
 67 };
 68 MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
 69 #endif
 70 
 71 static struct spi_driver cs35l56_spi_driver = {
 72         .driver = {
 73                 .name           = "cs35l56",
 74                 .pm = pm_ptr(&cs35l56_pm_ops_i2c_spi),
 75                 .acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
 76         },
 77         .id_table       = cs35l56_id_spi,
 78         .probe          = cs35l56_spi_probe,
 79         .remove         = cs35l56_spi_remove,
 80 };
 81 
 82 module_spi_driver(cs35l56_spi_driver);
 83 
 84 MODULE_DESCRIPTION("ASoC CS35L56 SPI driver");
 85 MODULE_IMPORT_NS(SND_SOC_CS35L56_CORE);
 86 MODULE_IMPORT_NS(SND_SOC_CS35L56_SHARED);
 87 MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
 88 MODULE_AUTHOR("Simon Trimmer <simont@opensource.cirrus.com>");
 89 MODULE_LICENSE("GPL");
 90 

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