2023-03-20 11:22:45 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
//
|
|
|
|
// CS35L56 ALSA SoC audio driver SPI binding
|
|
|
|
//
|
|
|
|
// Copyright (C) 2023 Cirrus Logic, Inc. and
|
|
|
|
// Cirrus Logic International Semiconductor Ltd.
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/moduleparam.h>
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include "cs35l56.h"
|
|
|
|
|
|
|
|
static int cs35l56_spi_probe(struct spi_device *spi)
|
|
|
|
{
|
|
|
|
const struct regmap_config *regmap_config = &cs35l56_regmap_spi;
|
|
|
|
struct cs35l56_private *cs35l56;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
cs35l56 = devm_kzalloc(&spi->dev, sizeof(struct cs35l56_private), GFP_KERNEL);
|
|
|
|
if (!cs35l56)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
spi_set_drvdata(spi, cs35l56);
|
2025-04-07 16:16:41 +01:00
|
|
|
|
|
|
|
cs35l56->base.fw_reg = &cs35l56_fw_reg;
|
|
|
|
|
2023-07-21 14:21:10 +01:00
|
|
|
cs35l56->base.regmap = devm_regmap_init_spi(spi, regmap_config);
|
|
|
|
if (IS_ERR(cs35l56->base.regmap)) {
|
|
|
|
ret = PTR_ERR(cs35l56->base.regmap);
|
2023-03-20 11:22:45 +00:00
|
|
|
return dev_err_probe(&spi->dev, ret, "Failed to allocate register map\n");
|
|
|
|
}
|
|
|
|
|
2023-07-21 14:21:10 +01:00
|
|
|
cs35l56->base.dev = &spi->dev;
|
2023-10-06 12:10:39 +01:00
|
|
|
cs35l56->base.can_hibernate = true;
|
2025-02-25 13:18:43 +00:00
|
|
|
ret = cs35l56_init_config_for_spi(&cs35l56->base, spi);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
2023-03-20 11:22:45 +00:00
|
|
|
|
|
|
|
ret = cs35l56_common_probe(cs35l56);
|
|
|
|
if (ret != 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = cs35l56_init(cs35l56);
|
|
|
|
if (ret == 0)
|
2023-07-21 14:21:10 +01:00
|
|
|
ret = cs35l56_irq_request(&cs35l56->base, spi->irq);
|
2023-03-20 11:22:45 +00:00
|
|
|
if (ret < 0)
|
|
|
|
cs35l56_remove(cs35l56);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void cs35l56_spi_remove(struct spi_device *spi)
|
|
|
|
{
|
|
|
|
struct cs35l56_private *cs35l56 = spi_get_drvdata(spi);
|
|
|
|
|
|
|
|
cs35l56_remove(cs35l56);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct spi_device_id cs35l56_id_spi[] = {
|
|
|
|
{ "cs35l56", 0 },
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(spi, cs35l56_id_spi);
|
|
|
|
|
2023-08-17 12:27:12 +01:00
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
static const struct acpi_device_id cs35l56_asoc_acpi_match[] = {
|
|
|
|
{ "CSC355C", 0 },
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(acpi, cs35l56_asoc_acpi_match);
|
|
|
|
#endif
|
|
|
|
|
2023-03-20 11:22:45 +00:00
|
|
|
static struct spi_driver cs35l56_spi_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "cs35l56",
|
2023-09-14 16:09:16 +01:00
|
|
|
.pm = pm_ptr(&cs35l56_pm_ops_i2c_spi),
|
2023-08-17 12:27:12 +01:00
|
|
|
.acpi_match_table = ACPI_PTR(cs35l56_asoc_acpi_match),
|
2023-03-20 11:22:45 +00:00
|
|
|
},
|
|
|
|
.id_table = cs35l56_id_spi,
|
|
|
|
.probe = cs35l56_spi_probe,
|
|
|
|
.remove = cs35l56_spi_remove,
|
|
|
|
};
|
|
|
|
|
|
|
|
module_spi_driver(cs35l56_spi_driver);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("ASoC CS35L56 SPI driver");
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 15:59:47 +01:00
|
|
|
MODULE_IMPORT_NS("SND_SOC_CS35L56_CORE");
|
|
|
|
MODULE_IMPORT_NS("SND_SOC_CS35L56_SHARED");
|
2023-03-20 11:22:45 +00:00
|
|
|
MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.cirrus.com>");
|
|
|
|
MODULE_AUTHOR("Simon Trimmer <simont@opensource.cirrus.com>");
|
|
|
|
MODULE_LICENSE("GPL");
|