sound/soc/codecs/cs35l56-test.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs35l56-test.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs35l56-test.c- Extension
.c- Size
- 23643 bytes
- Lines
- 729
- 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/efi.hlinux/device/faux.hlinux/firmware/cirrus/cs_dsp.hlinux/firmware/cirrus/wmfw.hlinux/module.hlinux/overflow.hlinux/pci_ids.hlinux/property.hlinux/seq_buf.hlinux/soundwire/sdw.hsound/cs35l56.hsound/cs-amp-lib.hcs35l56.h
Detected Declarations
struct cs35l56_test_privstruct cs35l56_test_paramfunction cs35l56_test_system_name_from_ssidfunction cs35l56_test_system_name_from_ssid_and_spkidfunction cs35l56_test_system_name_from_propertyfunction cs35l56_test_system_name_from_property_and_spkidfunction cs35l56_test_l56_b0_suffix_sdwfunction cs35l56_test_suffix_sdwfunction cs35l56_test_suffix_i2cspifunction cs35l56_test_get_efi_ssidexv2function cs35l56_test_ssidexv2_suffix_sdwfunction cs35l56_test_ssidexv2_suffix_i2cspifunction cs35l56_test_l56_b0_ssidexv2_ignored_suffix_sdwfunction cs35l56_process_xu_propertiesfunction cs35l56_test_dummy_read_onchip_spkidfunction cs35l56_test_dummy_configure_onchip_spkid_padsfunction cs35l56_test_set_fw_name_reads_onchip_spkidfunction cs35l56_test_set_fw_name_preserves_spkid_with_onchip_gpiosfunction cs35l56_test_set_fw_name_preserves_spkid_without_onchip_gpiosfunction cs35l56_test_case_init_commonfunction cs35l56_test_case_init_soundwirefunction cs35l56_test_gpio_param_descfunction cs35l56_test_type_rev_param_desc
Annotated Snippet
struct cs35l56_test_priv {
struct faux_device *amp_dev;
struct cs35l56_private *cs35l56_priv;
const char *ssidexv2;
bool read_onchip_spkid_called;
bool configure_onchip_spkid_pads_called;
};
struct cs35l56_test_param {
u8 type;
u8 rev;
s32 spkid_gpios[4];
s32 spkid_pulls[4];
};
static const struct software_node cs35l56_test_dev_sw_node =
SOFTWARE_NODE("SWD1", NULL, NULL);
static const struct software_node cs35l56_test_af01_sw_node =
SOFTWARE_NODE("AF01", NULL, &cs35l56_test_dev_sw_node);
static const struct software_node *cs35l56_test_dev_and_af01_node_group[] = {
&cs35l56_test_dev_sw_node,
&cs35l56_test_af01_sw_node,
NULL
};
static const char *cs35l56_test_devm_get_vendor_specific_variant_id_none(struct device *dev,
int ssid_vendor,
int ssid_device)
{
return ERR_PTR(-ENOENT);
}
static void cs35l56_test_system_name_from_ssid(struct kunit *test)
{
struct cs35l56_test_priv *priv = test->priv;
struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
cs35l56->speaker_id = -1;
snd_soc_card_set_pci_ssid(cs35l56->component->card, 0x12b4, 0xa7c8);
KUNIT_EXPECT_EQ(test, cs35l56_get_firmware_uid(cs35l56), 0);
KUNIT_EXPECT_EQ(test, cs35l56_set_fw_name(cs35l56->component), 0);
KUNIT_EXPECT_STREQ(test, cs35l56->dsp.system_name, "12b4a7c8");
}
static void cs35l56_test_system_name_from_ssid_and_spkid(struct kunit *test)
{
struct cs35l56_test_priv *priv = test->priv;
struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
cs35l56->speaker_id = 1;
snd_soc_card_set_pci_ssid(cs35l56->component->card, 0x12b4, 0xa7c8);
KUNIT_EXPECT_EQ(test, cs35l56_get_firmware_uid(cs35l56), 0);
KUNIT_EXPECT_EQ(test, cs35l56_set_fw_name(cs35l56->component), 0);
KUNIT_EXPECT_STREQ(test, cs35l56->dsp.system_name, "12b4a7c8-spkid1");
}
static void cs35l56_test_system_name_from_property(struct kunit *test)
{
struct cs35l56_test_priv *priv = test->priv;
struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
const struct property_entry dev_props[] = {
PROPERTY_ENTRY_STRING("cirrus,firmware-uid", "acme"),
{ }
};
const struct software_node dev_node = SOFTWARE_NODE("SPK1", dev_props, NULL);
cs35l56->speaker_id = -1;
KUNIT_ASSERT_EQ(test, device_add_software_node(cs35l56->base.dev, &dev_node), 0);
KUNIT_ASSERT_EQ(test, 0,
kunit_add_action_or_reset(test,
device_remove_software_node_wrapper,
cs35l56->base.dev));
KUNIT_EXPECT_EQ(test, cs35l56_get_firmware_uid(cs35l56), 0);
KUNIT_EXPECT_EQ(test, cs35l56_set_fw_name(cs35l56->component), 0);
KUNIT_EXPECT_STREQ(test, cs35l56->dsp.system_name, "acme");
}
static void cs35l56_test_system_name_from_property_and_spkid(struct kunit *test)
{
struct cs35l56_test_priv *priv = test->priv;
struct cs35l56_private *cs35l56 = priv->cs35l56_priv;
Annotation
- Immediate include surface: `kunit/resource.h`, `kunit/test.h`, `kunit/static_stub.h`, `linux/efi.h`, `linux/device/faux.h`, `linux/firmware/cirrus/cs_dsp.h`, `linux/firmware/cirrus/wmfw.h`, `linux/module.h`.
- Detected declarations: `struct cs35l56_test_priv`, `struct cs35l56_test_param`, `function cs35l56_test_system_name_from_ssid`, `function cs35l56_test_system_name_from_ssid_and_spkid`, `function cs35l56_test_system_name_from_property`, `function cs35l56_test_system_name_from_property_and_spkid`, `function cs35l56_test_l56_b0_suffix_sdw`, `function cs35l56_test_suffix_sdw`, `function cs35l56_test_suffix_i2cspi`, `function cs35l56_test_get_efi_ssidexv2`.
- 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.