drivers/base/regmap/regmap-i3c.c
Source file repositories/reference/linux-study-clean/drivers/base/regmap/regmap-i3c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/base/regmap/regmap-i3c.c- Extension
.c- Size
- 1869 bytes
- Lines
- 72
- Domain
- Driver Families
- Bucket
- drivers/base
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/array_size.hlinux/regmap.hlinux/i3c/device.hlinux/i3c/master.hlinux/module.h
Detected Declarations
function regmap_i3c_writefunction regmap_i3c_readexport __regmap_init_i3cexport __devm_regmap_init_i3c
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018 Synopsys, Inc. and/or its affiliates.
#include <linux/array_size.h>
#include <linux/regmap.h>
#include <linux/i3c/device.h>
#include <linux/i3c/master.h>
#include <linux/module.h>
static int regmap_i3c_write(void *context, const void *data, size_t count)
{
struct device *dev = context;
struct i3c_device *i3c = dev_to_i3cdev(dev);
struct i3c_xfer xfers[] = {
{
.rnw = false,
.len = count,
.data.out = data,
},
};
return i3c_device_do_xfers(i3c, xfers, ARRAY_SIZE(xfers), I3C_SDR);
}
static int regmap_i3c_read(void *context,
const void *reg, size_t reg_size,
void *val, size_t val_size)
{
struct device *dev = context;
struct i3c_device *i3c = dev_to_i3cdev(dev);
struct i3c_xfer xfers[2];
xfers[0].rnw = false;
xfers[0].len = reg_size;
xfers[0].data.out = reg;
xfers[1].rnw = true;
xfers[1].len = val_size;
xfers[1].data.in = val;
return i3c_device_do_xfers(i3c, xfers, ARRAY_SIZE(xfers), I3C_SDR);
}
static const struct regmap_bus regmap_i3c = {
.write = regmap_i3c_write,
.read = regmap_i3c_read,
};
struct regmap *__regmap_init_i3c(struct i3c_device *i3c,
const struct regmap_config *config,
struct lock_class_key *lock_key,
const char *lock_name)
{
return __regmap_init(&i3c->dev, ®map_i3c, &i3c->dev, config,
lock_key, lock_name);
}
EXPORT_SYMBOL_GPL(__regmap_init_i3c);
struct regmap *__devm_regmap_init_i3c(struct i3c_device *i3c,
const struct regmap_config *config,
struct lock_class_key *lock_key,
const char *lock_name)
{
return __devm_regmap_init(&i3c->dev, ®map_i3c, &i3c->dev, config,
lock_key, lock_name);
}
EXPORT_SYMBOL_GPL(__devm_regmap_init_i3c);
MODULE_AUTHOR("Vitor Soares <vitor.soares@synopsys.com>");
MODULE_DESCRIPTION("regmap I3C Module");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/regmap.h`, `linux/i3c/device.h`, `linux/i3c/master.h`, `linux/module.h`.
- Detected declarations: `function regmap_i3c_write`, `function regmap_i3c_read`, `export __regmap_init_i3c`, `export __devm_regmap_init_i3c`.
- Atlas domain: Driver Families / drivers/base.
- Implementation status: integration 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.