sound/soc/codecs/cs530x-i2c.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs530x-i2c.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs530x-i2c.c- Extension
.c- Size
- 2254 bytes
- Lines
- 89
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/module.hlinux/i2c.hlinux/regmap.hcs530x.h
Detected Declarations
function cs530x_i2c_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
//
// CS530x CODEC driver
//
// Copyright (C) 2024-2025 Cirrus Logic, Inc. and
// Cirrus Logic International Semiconductor Ltd.
#include <linux/device.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include "cs530x.h"
static const struct of_device_id cs530x_of_match[] = {
{
.compatible = "cirrus,cs4282",
.data = (void *)CS4282,
}, {
.compatible = "cirrus,cs4302",
.data = (void *)CS4302,
}, {
.compatible = "cirrus,cs4304",
.data = (void *)CS4304,
}, {
.compatible = "cirrus,cs4308",
.data = (void *)CS4308,
}, {
.compatible = "cirrus,cs5302",
.data = (void *)CS5302,
}, {
.compatible = "cirrus,cs5304",
.data = (void *)CS5304,
}, {
.compatible = "cirrus,cs5308",
.data = (void *)CS5308,
},
{}
};
MODULE_DEVICE_TABLE(of, cs530x_of_match);
static const struct i2c_device_id cs530x_i2c_id[] = {
{ .name = "cs4282", .driver_data = CS4282 },
{ .name = "cs4302", .driver_data = CS4302 },
{ .name = "cs4304", .driver_data = CS4304 },
{ .name = "cs4308", .driver_data = CS4308 },
{ .name = "cs5302", .driver_data = CS5302 },
{ .name = "cs5304", .driver_data = CS5304 },
{ .name = "cs5308", .driver_data = CS5308 },
{ }
};
MODULE_DEVICE_TABLE(i2c, cs530x_i2c_id);
static int cs530x_i2c_probe(struct i2c_client *client)
{
struct cs530x_priv *cs530x;
cs530x = devm_kzalloc(&client->dev, sizeof(*cs530x), GFP_KERNEL);
if (!cs530x)
return -ENOMEM;
i2c_set_clientdata(client, cs530x);
cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap_i2c);
if (IS_ERR(cs530x->regmap))
return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap),
"Failed to allocate register map\n");
cs530x->devtype = (uintptr_t)i2c_get_match_data(client);
cs530x->dev = &client->dev;
return cs530x_probe(cs530x);
}
static struct i2c_driver cs530x_i2c_driver = {
.driver = {
.name = "cs530x",
.of_match_table = cs530x_of_match,
},
.probe = cs530x_i2c_probe,
.id_table = cs530x_i2c_id,
};
module_i2c_driver(cs530x_i2c_driver);
MODULE_DESCRIPTION("I2C CS530X driver");
MODULE_IMPORT_NS("SND_SOC_CS530X");
MODULE_AUTHOR("Paul Handrigan, Cirrus Logic Inc, <paulha@opensource.cirrus.com>");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/device.h`, `linux/module.h`, `linux/i2c.h`, `linux/regmap.h`, `cs530x.h`.
- Detected declarations: `function cs530x_i2c_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.