sound/soc/codecs/cs35l56-shared-test.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs35l56-shared-test.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs35l56-shared-test.c- Extension
.c- Size
- 32716 bytes
- Lines
- 927
- 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
kunit/resource.hkunit/test.hkunit/static_stub.hlinux/bitfield.hlinux/bitops.hlinux/device/faux.hlinux/gpio/driver.hlinux/module.hlinux/random.hlinux/regmap.hlinux/seq_buf.hsound/cs35l56.h
Detected Declarations
struct cs35l56_shared_test_mock_gpiostruct cs35l56_shared_test_privstruct cs35l56_shared_test_paramfunction cs35l56_shared_test_mock_gpio_get_directionfunction cs35l56_shared_test_mock_gpio_direction_infunction cs35l56_shared_test_mock_gpio_getfunction cs35l56_shared_test_mock_gpio_probefunction _cs35l56_shared_test_create_dummy_gpiofunction cs35l56_shared_test_read_gpio_statusfunction cs35l56_shared_test_updt_gpio_presfunction cs35l56_shared_test_reg_readfunction cs35l56_shared_test_reg_writefunction cs35l56_shared_test_mock_gpio_status_selftestfunction cs35l56_shared_test_get_onchip_speaker_idfunction cs35l56_shared_test_onchip_speaker_id_pad_configfunction cs35l56_shared_test_stash_onchip_spkid_pinsfunction cs35l56_shared_test_stash_onchip_spkid_pins_reject_invalidfunction cs35l56_shared_test_onchip_speaker_id_not_definedfunction cs35l56_shared_test_get_vendor_spkid_1function cs35l56_shared_test_get_speaker_id_vendorfunction cs35l56_shared_test_get_speaker_id_propertyfunction Devicefunction cs35l56_shared_test_get_speaker_id_from_host_gpiofunction cs35l56_shared_test_case_regmap_initfunction cs35l56_shared_test_case_base_initfunction cs35l56_shared_test_case_regmap_init_L56_B0_sdwfunction cs35l56_shared_test_case_regmap_init_L56_B0_spifunction cs35l56_shared_test_case_regmap_init_L56_B0_i2cfunction cs35l56_shared_test_case_regmap_init_L56_B2_sdwfunction cs35l56_shared_test_case_regmap_init_L56_B2_spifunction cs35l56_shared_test_case_regmap_init_L56_B2_i2cfunction cs35l56_shared_test_case_regmap_init_L63_A1_sdwfunction cs35l56_shared_test_gpio_param_desc
Annotated Snippet
struct cs35l56_shared_test_mock_gpio {
unsigned int pin_state;
struct gpio_chip chip;
};
struct cs35l56_shared_test_priv {
struct kunit *test;
struct faux_device *amp_dev;
struct faux_device *gpio_dev;
struct cs35l56_shared_test_mock_gpio *gpio_priv;
struct regmap *registers;
unsigned int reg_offset;
struct cs35l56_base *cs35l56_base;
u8 applied_pad_pull_state[CS35L56_MAX_GPIO];
};
struct cs35l56_shared_test_param {
int spkid_gpios[4];
int spkid_pulls[4];
unsigned long gpio_status;
int spkid;
};
KUNIT_DEFINE_ACTION_WRAPPER(faux_device_destroy_wrapper, faux_device_destroy,
struct faux_device *)
KUNIT_DEFINE_ACTION_WRAPPER(regmap_exit_wrapper, regmap_exit, struct regmap *)
KUNIT_DEFINE_ACTION_WRAPPER(device_remove_software_node_wrapper,
device_remove_software_node,
struct device *)
static int cs35l56_shared_test_mock_gpio_get_direction(struct gpio_chip *chip,
unsigned int offset)
{
return GPIO_LINE_DIRECTION_IN;
}
static int cs35l56_shared_test_mock_gpio_direction_in(struct gpio_chip *chip,
unsigned int offset)
{
return 0;
}
static int cs35l56_shared_test_mock_gpio_get(struct gpio_chip *chip, unsigned int offset)
{
struct cs35l56_shared_test_mock_gpio *gpio_priv = gpiochip_get_data(chip);
return !!(gpio_priv->pin_state & BIT(offset));
}
static const struct gpio_chip cs35l56_shared_test_mock_gpio_chip = {
.label = "cs35l56_shared_test_mock_gpio",
.owner = THIS_MODULE,
.get_direction = cs35l56_shared_test_mock_gpio_get_direction,
.direction_input = cs35l56_shared_test_mock_gpio_direction_in,
.get = cs35l56_shared_test_mock_gpio_get,
.base = -1,
.ngpio = 32,
};
/* software_node referencing the gpio driver */
static const struct software_node cs35l56_shared_test_mock_gpio_swnode = {
.name = "cs35l56_shared_test_mock_gpio",
};
static int cs35l56_shared_test_mock_gpio_probe(struct faux_device *fdev)
{
struct cs35l56_shared_test_mock_gpio *gpio_priv;
struct device *dev = &fdev->dev;
int ret;
gpio_priv = devm_kzalloc(dev, sizeof(*gpio_priv), GFP_KERNEL);
if (!gpio_priv)
return -ENOMEM;
ret = device_add_software_node(dev, &cs35l56_shared_test_mock_gpio_swnode);
if (ret)
return ret;
ret = devm_add_action_or_reset(dev, device_remove_software_node_wrapper, dev);
if (ret)
return ret;
/* GPIO core modifies our struct gpio_chip so use a copy */
gpio_priv->chip = cs35l56_shared_test_mock_gpio_chip;
gpio_priv->chip.parent = dev;
ret = devm_gpiochip_add_data(dev, &gpio_priv->chip, gpio_priv);
if (ret)
return dev_err_probe(dev, ret, "Failed to add gpiochip\n");
Annotation
- Immediate include surface: `kunit/resource.h`, `kunit/test.h`, `kunit/static_stub.h`, `linux/bitfield.h`, `linux/bitops.h`, `linux/device/faux.h`, `linux/gpio/driver.h`, `linux/module.h`.
- Detected declarations: `struct cs35l56_shared_test_mock_gpio`, `struct cs35l56_shared_test_priv`, `struct cs35l56_shared_test_param`, `function cs35l56_shared_test_mock_gpio_get_direction`, `function cs35l56_shared_test_mock_gpio_direction_in`, `function cs35l56_shared_test_mock_gpio_get`, `function cs35l56_shared_test_mock_gpio_probe`, `function _cs35l56_shared_test_create_dummy_gpio`, `function cs35l56_shared_test_read_gpio_status`, `function cs35l56_shared_test_updt_gpio_pres`.
- 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.