]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: cs35l56: KUnit tests for reading speaker ID from host GPIOs
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Wed, 4 Mar 2026 16:24:01 +0000 (16:24 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 5 Mar 2026 15:22:48 +0000 (15:22 +0000)
commitef0b4783afc211a4b120e72b5a57f3d0340a9981
tree30cef5ef7d8563cd197d692dc0412be38f2dbbf4
parent72e1c4704844766c46725d6b043ba04559054d02
ASoC: cs35l56: KUnit tests for reading speaker ID from host GPIOs

Add test cases for the spk-id-gpios property used to read an integer
speaker ID value from a set of GPIO inputs.

There is a single parameterized test function,
cs35l56_shared_test_get_speaker_id_from_host_gpio() that does
the following:

- Create a mock GPIO driver to simulate real GPIO inputs.

- Create an array of struct software_node_ref_args to provide the
  content of the spk-id-gpios property. Each entry is a reference to
  a GPIO on the mock GPIO driver. The GPIO indexes are taken from test
  case parameterization.

- Create a software node containing the spk-id-gpios property and set
  this as the node of the pseudo codec driver device.

- Call cs35l56_get_speaker_id() and assert that the returned value
  matches the expected value defined in the test case parameterization.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20260304162402.1714759-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l56-shared-test.c