Skip to contentSkip to conversation

spi: cs42l43: Use actual ACPI firmware node for chip selects

PATCH In review Charles Keepax 5 participants 9 messages Nov 20, 2025 – Nov 21, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spi: cs42l43: Use actual ACPI firmware node for chip selects

On some systems the cs42l43 has amplifiers attached to its SPI controller that are not properly defined in ACPI. Currently software nodes are added to support this case, however, the chip selects for these devices are specified using a hack. A software node is added with the same name as the pinctrl driver, as the look up was name based, this allowed the GPIO look up to return the pinctrl driver even though the swnode was not owned by it. This was necessary as the swnodes did not support directly linking to real firmware nodes.

Since commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") changed the lookup to be fwnode based this hack will no longer find the pinctrl driver, resulting in the driver not probing. There is no pinctrl driver attached to the swnode itself. But other patches did add support for linking a swnode to a real fwnode node [1]. As such the hack is no longer needed, so switch over to just passing the real fwnode for the pinctrl property to avoid any issues.

Fixes 439fbc97502a ("spi: cs42l43: Add bridged cs35l56 amplifiers")
Fixes e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup")

---

IMPORTANT NOTE: This depends both functionally and build wise on the linked series from Bart, it probably makes sense for him to pull the patch into his series.

Changes since v1:
- Add missing tags
- Move swnode config onto the stack, since the core copies it

 drivers/spi/spi-cs42l43.c | 40 ++++++++++-----------------------------
 1 file changed, 10 insertions(+), 30 deletions(-)
drivers/spi/spi-cs42l43.c +10 -30
index 14307dd800b74..43079f292d6f7 100644
@@ -52,20 +52,6 @@ static struct spi_board_info amp_info_template = {
 	.mode			= SPI_MODE_0,
 };
 
-static const struct software_node cs42l43_gpiochip_swnode = {
-	.name			= "cs42l43-pinctrl",
-};
-
-static const struct software_node_ref_args cs42l43_cs_refs[] = {
-	SOFTWARE_NODE_REFERENCE(&cs42l43_gpiochip_swnode, 0, GPIO_ACTIVE_LOW),
-	SOFTWARE_NODE_REFERENCE(&swnode_gpio_undefined),
-};
-
-static const struct property_entry cs42l43_cs_props[] = {
-	PROPERTY_ENTRY_REF_ARRAY("cs-gpios", cs42l43_cs_refs),
-	{}
-};
-
 static int cs42l43_spi_tx(struct regmap *regmap, const u8 *buf, unsigned int len)
 {
 	const u8 *end = buf + len;
@@ -324,11 +310,6 @@ static void cs42l43_release_of_node(void *data)
 	fwnode_handle_put(data);
 }
 
-static void cs42l43_release_sw_node(void *data)
-{
-	software_node_unregister(&cs42l43_gpiochip_swnode);
-}
-
 static int cs42l43_spi_probe(struct platform_device *pdev)
 {
 	struct cs42l43 *cs42l43 = dev_get_drvdata(pdev->dev.parent);
@@ -391,6 +372,15 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
 	fwnode_property_read_u32(xu_fwnode, "01fa-sidecar-instances", &nsidecars);
 
 	if (nsidecars) {
+		struct software_node_ref_args args[] = {
+			SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),
+			SOFTWARE_NODE_REFERENCE(&swnode_gpio_undefined),
+		};
+		struct property_entry props[] = {
+			PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),
+			{ }
+		};
+
 		ret = fwnode_property_read_u32(xu_fwnode, "01fa-spk-id-val", &spkid);
 		if (!ret) {
 			dev_dbg(priv->dev, "01fa-spk-id-val = %d\n", spkid);
@@ -403,17 +393,7 @@ static int cs42l43_spi_probe(struct platform_device *pdev)
 						     "Failed to get spk-id-gpios\n");
 		}
 
-		ret = software_node_register(&cs42l43_gpiochip_swnode);
-		if (ret)
-			return dev_err_probe(priv->dev, ret,
-					     "Failed to register gpio swnode\n");
-
-		ret = devm_add_action_or_reset(priv->dev, cs42l43_release_sw_node, NULL);
-		if (ret)
-			return ret;
-
-		ret = device_create_managed_software_node(&priv->ctlr->dev,
-							  cs42l43_cs_props, NULL);
+		ret = device_create_managed_software_node(&priv->ctlr->dev, props, NULL);
 		if (ret)
 			return dev_err_probe(priv->dev, ret, "Failed to add swnode\n");
 	} else {
Signature · 1 line
2.47.3
#1 lore raw
Quoted 23 lines · Charles Keepax

On some systems the cs42l43 has amplifiers attached to its SPI controller that are not properly defined in ACPI. Currently software nodes are added to support this case, however, the chip selects for these devices are specified using a hack. A software node is added with the same name as the pinctrl driver, as the look up was name based, this allowed the GPIO look up to return the pinctrl driver even though the swnode was not owned by it. This was necessary as the swnodes did not support directly linking to real firmware nodes.

Since commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") changed the lookup to be fwnode based this hack will no longer find the pinctrl driver, resulting in the driver not probing. There is no pinctrl driver attached to the swnode itself. But other patches did add support for linking a swnode to a real fwnode node [1]. As such the hack is no longer needed, so switch over to just passing the real fwnode for the pinctrl property to avoid any issues.

Fixes 439fbc97502a ("spi: cs42l43: Add bridged cs35l56 amplifiers")
Fixes e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup")
Quoted 5 lines

---

IMPORTANT NOTE: This depends both functionally and build wise on the linked series from Bart, it probably makes sense for him to pull the patch into his series.

When included in the reset-gpios-swnodes series, will this need either a noautosel or prerequisite marker to avoid it being picked up into stable without the reset of the series?

regards
Philipp

#2 lore raw
Quoted 27 lines · Philipp Zabel
Quoted 25 lines · Charles Keepax

On some systems the cs42l43 has amplifiers attached to its SPI controller that are not properly defined in ACPI. Currently software nodes are added to support this case, however, the chip selects for these devices are specified using a hack. A software node is added with the same name as the pinctrl driver, as the look up was name based, this allowed the GPIO look up to return the pinctrl driver even though the swnode was not owned by it. This was necessary as the swnodes did not support directly linking to real firmware nodes.

Since commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") changed the lookup to be fwnode based this hack will no longer find the pinctrl driver, resulting in the driver not probing. There is no pinctrl driver attached to the swnode itself. But other patches did add support for linking a swnode to a real fwnode node [1]. As such the hack is no longer needed, so switch over to just passing the real fwnode for the pinctrl property to avoid any issues.

Fixes 439fbc97502a ("spi: cs42l43: Add bridged cs35l56 amplifiers")
Fixes e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup")

---

Quoted 8 lines
Quoted 3 lines

IMPORTANT NOTE: This depends both functionally and build wise on the linked series from Bart, it probably makes sense for him to pull the patch into his series.

When included in the reset-gpios-swnodes series, will this need either a noautosel or prerequisite marker to avoid it being picked up into stable without the reset of the series?

Good point. Also: the Fixes: e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") tag needs to be removed as this will go before this patch.

In any case, looks good to me now:

Mark: can you Ack it and Philipp will include it in the immutable branch with the swnode series[1] I will resend?

Bart

[1] https://lore.kernel.org/all/[email protected]/

#4 lore raw
In reply to Charles Keepax
Quoted 18 lines · Charles Keepax

On some systems the cs42l43 has amplifiers attached to its SPI controller that are not properly defined in ACPI. Currently software nodes are added to support this case, however, the chip selects for these devices are specified using a hack. A software node is added with the same name as the pinctrl driver, as the look up was name based, this allowed the GPIO look up to return the pinctrl driver even though the swnode was not owned by it. This was necessary as the swnodes did not support directly linking to real firmware nodes.

Since commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the key for GPIO lookup") changed the lookup to be fwnode based this hack will no longer find the pinctrl driver, resulting in the driver not probing. There is no pinctrl driver attached to the swnode itself. But other patches did add support for linking a swnode to a real fwnode node [1]. As such the hack is no longer needed, so switch over to just passing the real fwnode for the pinctrl property to avoid any issues.

...

drivers/spi/spi-cs42l43.c static int cs42l43_spi_probe(struct platform_device *pdev) · line 380

Quoted 2 lines
drivers/spi/spi-cs42l43.c +2 -0
+		struct property_entry props[] = {
+			PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),

No need to open code PROPERTY_ENTRY_REF_ARRAY().

Quoted 2 lines
drivers/spi/spi-cs42l43.c +2 -0
+			{ }
+		};
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 5 lines · Andy Shevchenko

drivers/spi/spi-cs42l43.c static int cs42l43_spi_probe(struct platform_device *pdev) · line 380

Quoted 2 lines · Charles Keepax
drivers/spi/spi-cs42l43.c +2 -0
+		struct property_entry props[] = {
+			PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),

No need to open code PROPERTY_ENTRY_REF_ARRAY().

Sorry yes forgot to put that back when I switched back from the dynamic allocated ones. Bart let me know if you want a v3, or happy to let you fix this up when you pull it into your chain?

Thanks,
Charles

#6 lore raw
Quoted 12 lines · Charles Keepax
Quoted 5 lines · Andy Shevchenko

drivers/spi/spi-cs42l43.c static int cs42l43_spi_probe(struct platform_device *pdev) · line 380

Quoted 2 lines · Charles Keepax
drivers/spi/spi-cs42l43.c +2 -0
+           struct property_entry props[] = {
+                   PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),

No need to open code PROPERTY_ENTRY_REF_ARRAY().

Sorry yes forgot to put that back when I switched back from the dynamic allocated ones. Bart let me know if you want a v3, or happy to let you fix this up when you pull it into your chain?

I'll fix it myself.

Bart

#7 lore raw
In reply to Charles Keepax
kernel test robot noticed the following build errors:

Hi Charles,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-spi/for-next]
[also build test ERROR on linus/master v6.18-rc6 next-20251120] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Charles-Keepax/spi-cs42l43-Use-actual-ACPI-firmware-node-for-chip-selects/20251120-190613
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link:    https://lore.kernel.org/r/20251120105907.1373797-1-ckeepax%40opensource.cirrus.com
patch subject: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20251121/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251121/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/linux/acpi.h:16,

                    from drivers/spi/spi-cs42l43.c:8:
   drivers/spi/spi-cs42l43.c: In function 'cs42l43_spi_probe':
>> drivers/spi/spi-cs42l43.c:376:49: error: initialization of 'const struct software_node *' from incompatible pointer type 'struct fwnode_handle *' [-Werror=incompatible-pointer-types]
     376 |                         SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),
         |                                                 ^~~~~~
   include/linux/property.h:370:17: note: in definition of macro 'SOFTWARE_NODE_REFERENCE'
     370 |         .node = _ref_,                                          \
         |                 ^~~~~
   drivers/spi/spi-cs42l43.c:376:49: note: (near initialization for '(anonymous).node')
     376 |                         SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),
         |                                                 ^~~~~~
   include/linux/property.h:370:17: note: in definition of macro 'SOFTWARE_NODE_REFERENCE'
     370 |         .node = _ref_,                                          \
         |                 ^~~~~

cc1: some warnings being treated as errors

vim +376 drivers/spi/spi-cs42l43.c

312
313 static int cs42l43_spi_probe(struct platform_device *pdev)
314 {
315 struct cs42l43 *cs42l43 = dev_get_drvdata(pdev->dev.parent);
316 struct cs42l43_spi *priv;
317 struct fwnode_handle *fwnode = dev_fwnode(cs42l43->dev);
318 struct fwnode_handle *xu_fwnode __free(fwnode_handle) = cs42l43_find_xu_node(fwnode);
319 int nsidecars = 0;
320 int spkid = -EINVAL;
321 int ret;
322
323 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
324 if (!priv)
325 return -ENOMEM;
326
327 priv->ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*priv->ctlr));
328 if (!priv->ctlr)
329 return -ENOMEM;
330
331 spi_controller_set_devdata(priv->ctlr, priv);
332
333 priv->dev = &pdev->dev;
334 priv->regmap = cs42l43->regmap;
335
336 priv->ctlr->prepare_message = cs42l43_prepare_message;
337 priv->ctlr->prepare_transfer_hardware = cs42l43_prepare_transfer_hardware;
338 priv->ctlr->unprepare_transfer_hardware = cs42l43_unprepare_transfer_hardware;
339 priv->ctlr->transfer_one = cs42l43_transfer_one;
340 priv->ctlr->set_cs = cs42l43_set_cs;
341 priv->ctlr->max_transfer_size = cs42l43_spi_max_length;
342 priv->ctlr->mode_bits = SPI_3WIRE | SPI_MODE_X_MASK;
343 priv->ctlr->flags = SPI_CONTROLLER_HALF_DUPLEX;
344 priv->ctlr->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) |
345 SPI_BPW_MASK(32);
346 priv->ctlr->min_speed_hz = CS42L43_SPI_ROOT_HZ /
347 cs42l43_clock_divs[ARRAY_SIZE(cs42l43_clock_divs) - 1];
348 priv->ctlr->max_speed_hz = CS42L43_SPI_ROOT_HZ / cs42l43_clock_divs[0];
349 priv->ctlr->use_gpio_descriptors = true;
350 priv->ctlr->auto_runtime_pm = true;
351
352 ret = devm_pm_runtime_enable(priv->dev);
353 if (ret)
354 return ret;
355
356 pm_runtime_idle(priv->dev);
357
358 regmap_write(priv->regmap, CS42L43_TRAN_CONFIG6, CS42L43_FIFO_SIZE - 1);
359 regmap_write(priv->regmap, CS42L43_TRAN_CONFIG7, CS42L43_FIFO_SIZE - 1);
360
361 // Disable Watchdog timer and enable stall
362 regmap_write(priv->regmap, CS42L43_SPI_CONFIG3, 0);
363 regmap_write(priv->regmap, CS42L43_SPI_CONFIG4, CS42L43_SPI_STALL_ENA_MASK);
364
365 if (is_of_node(fwnode)) {
366 fwnode = fwnode_get_named_child_node(fwnode, "spi");
367 ret = devm_add_action_or_reset(priv->dev, cs42l43_release_of_node, fwnode);
368 if (ret)
369 return ret;
370 }
371
372 fwnode_property_read_u32(xu_fwnode, "01fa-sidecar-instances", &nsidecars);
373
374 if (nsidecars) {
375 struct software_node_ref_args args[] = {

 > 376				SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),

377 SOFTWARE_NODE_REFERENCE(&swnode_gpio_undefined),
378 };
379 struct property_entry props[] = {
380 PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),
381 { }
382 };
383
384 ret = fwnode_property_read_u32(xu_fwnode, "01fa-spk-id-val", &spkid);
385 if (!ret) {
386 dev_dbg(priv->dev, "01fa-spk-id-val = %d\n", spkid);
387 } else if (ret != -EINVAL) {
388 return dev_err_probe(priv->dev, ret, "Failed to get spk-id-val\n");
389 } else {
390 ret = cs42l43_get_speaker_id_gpios(priv, &spkid);
391 if (ret < 0)
392 return dev_err_probe(priv->dev, ret,
393 "Failed to get spk-id-gpios\n");
394 }
395
396 ret = device_create_managed_software_node(&priv->ctlr->dev, props, NULL);
397 if (ret)
398 return dev_err_probe(priv->dev, ret, "Failed to add swnode\n");
399 } else {
400 device_set_node(&priv->ctlr->dev, fwnode);
401 }
402
403 ret = devm_spi_register_controller(priv->dev, priv->ctlr);
404 if (ret)
405 return dev_err_probe(priv->dev, ret,
406 "Failed to register SPI controller\n");
407
408 if (nsidecars) {
409 struct spi_board_info *ampl_info;
410 struct spi_board_info *ampr_info;
411
412 ampl_info = cs42l43_create_bridge_amp(priv, "cs35l56-left", 0, spkid);
413 if (!ampl_info)
414 return -ENOMEM;
415
416 ampr_info = cs42l43_create_bridge_amp(priv, "cs35l56-right", 1, spkid);
417 if (!ampr_info)
418 return -ENOMEM;
419
420 if (!spi_new_device(priv->ctlr, ampl_info))
421 return dev_err_probe(priv->dev, -ENODEV,
422 "Failed to create left amp slave\n");
423
424 if (!spi_new_device(priv->ctlr, ampr_info))
425 return dev_err_probe(priv->dev, -ENODEV,
426 "Failed to create right amp slave\n");
427 }
428
429 return 0;
430 }
431

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#8 lore raw
In reply to Charles Keepax
kernel test robot noticed the following build errors:

Hi Charles,

kernel test robot noticed the following build errors:

[auto build test ERROR on broonie-spi/for-next]
[also build test ERROR on linus/master v6.18-rc6 next-20251121] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Charles-Keepax/spi-cs42l43-Use-actual-ACPI-firmware-node-for-chip-selects/20251120-190613
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
patch link:    https://lore.kernel.org/r/20251120105907.1373797-1-ckeepax%40opensource.cirrus.com
patch subject: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
config: i386-randconfig-004-20251121 (https://download.01.org/0day-ci/archive/20251122/[email protected]/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251122/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/spi/spi-cs42l43.c:376:28: error: incompatible pointer types initializing 'const struct software_node *' with an expression of type 'struct fwnode_handle *' [-Werror,-Wincompatible-pointer-types]
     376 |                         SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),
         |                                                 ^~~~~~
   include/linux/property.h:370:10: note: expanded from macro 'SOFTWARE_NODE_REFERENCE'
     370 |         .node = _ref_,                                          \
         |                 ^~~~~

1 error generated.

vim +376 drivers/spi/spi-cs42l43.c

312
313 static int cs42l43_spi_probe(struct platform_device *pdev)
314 {
315 struct cs42l43 *cs42l43 = dev_get_drvdata(pdev->dev.parent);
316 struct cs42l43_spi *priv;
317 struct fwnode_handle *fwnode = dev_fwnode(cs42l43->dev);
318 struct fwnode_handle *xu_fwnode __free(fwnode_handle) = cs42l43_find_xu_node(fwnode);
319 int nsidecars = 0;
320 int spkid = -EINVAL;
321 int ret;
322
323 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
324 if (!priv)
325 return -ENOMEM;
326
327 priv->ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*priv->ctlr));
328 if (!priv->ctlr)
329 return -ENOMEM;
330
331 spi_controller_set_devdata(priv->ctlr, priv);
332
333 priv->dev = &pdev->dev;
334 priv->regmap = cs42l43->regmap;
335
336 priv->ctlr->prepare_message = cs42l43_prepare_message;
337 priv->ctlr->prepare_transfer_hardware = cs42l43_prepare_transfer_hardware;
338 priv->ctlr->unprepare_transfer_hardware = cs42l43_unprepare_transfer_hardware;
339 priv->ctlr->transfer_one = cs42l43_transfer_one;
340 priv->ctlr->set_cs = cs42l43_set_cs;
341 priv->ctlr->max_transfer_size = cs42l43_spi_max_length;
342 priv->ctlr->mode_bits = SPI_3WIRE | SPI_MODE_X_MASK;
343 priv->ctlr->flags = SPI_CONTROLLER_HALF_DUPLEX;
344 priv->ctlr->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16) |
345 SPI_BPW_MASK(32);
346 priv->ctlr->min_speed_hz = CS42L43_SPI_ROOT_HZ /
347 cs42l43_clock_divs[ARRAY_SIZE(cs42l43_clock_divs) - 1];
348 priv->ctlr->max_speed_hz = CS42L43_SPI_ROOT_HZ / cs42l43_clock_divs[0];
349 priv->ctlr->use_gpio_descriptors = true;
350 priv->ctlr->auto_runtime_pm = true;
351
352 ret = devm_pm_runtime_enable(priv->dev);
353 if (ret)
354 return ret;
355
356 pm_runtime_idle(priv->dev);
357
358 regmap_write(priv->regmap, CS42L43_TRAN_CONFIG6, CS42L43_FIFO_SIZE - 1);
359 regmap_write(priv->regmap, CS42L43_TRAN_CONFIG7, CS42L43_FIFO_SIZE - 1);
360
361 // Disable Watchdog timer and enable stall
362 regmap_write(priv->regmap, CS42L43_SPI_CONFIG3, 0);
363 regmap_write(priv->regmap, CS42L43_SPI_CONFIG4, CS42L43_SPI_STALL_ENA_MASK);
364
365 if (is_of_node(fwnode)) {
366 fwnode = fwnode_get_named_child_node(fwnode, "spi");
367 ret = devm_add_action_or_reset(priv->dev, cs42l43_release_of_node, fwnode);
368 if (ret)
369 return ret;
370 }
371
372 fwnode_property_read_u32(xu_fwnode, "01fa-sidecar-instances", &nsidecars);
373
374 if (nsidecars) {
375 struct software_node_ref_args args[] = {

 > 376				SOFTWARE_NODE_REFERENCE(fwnode, 0, GPIO_ACTIVE_LOW),

377 SOFTWARE_NODE_REFERENCE(&swnode_gpio_undefined),
378 };
379 struct property_entry props[] = {
380 PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),
381 { }
382 };
383
384 ret = fwnode_property_read_u32(xu_fwnode, "01fa-spk-id-val", &spkid);
385 if (!ret) {
386 dev_dbg(priv->dev, "01fa-spk-id-val = %d\n", spkid);
387 } else if (ret != -EINVAL) {
388 return dev_err_probe(priv->dev, ret, "Failed to get spk-id-val\n");
389 } else {
390 ret = cs42l43_get_speaker_id_gpios(priv, &spkid);
391 if (ret < 0)
392 return dev_err_probe(priv->dev, ret,
393 "Failed to get spk-id-gpios\n");
394 }
395
396 ret = device_create_managed_software_node(&priv->ctlr->dev, props, NULL);
397 if (ret)
398 return dev_err_probe(priv->dev, ret, "Failed to add swnode\n");
399 } else {
400 device_set_node(&priv->ctlr->dev, fwnode);
401 }
402
403 ret = devm_spi_register_controller(priv->dev, priv->ctlr);
404 if (ret)
405 return dev_err_probe(priv->dev, ret,
406 "Failed to register SPI controller\n");
407
408 if (nsidecars) {
409 struct spi_board_info *ampl_info;
410 struct spi_board_info *ampr_info;
411
412 ampl_info = cs42l43_create_bridge_amp(priv, "cs35l56-left", 0, spkid);
413 if (!ampl_info)
414 return -ENOMEM;
415
416 ampr_info = cs42l43_create_bridge_amp(priv, "cs35l56-right", 1, spkid);
417 if (!ampr_info)
418 return -ENOMEM;
419
420 if (!spi_new_device(priv->ctlr, ampl_info))
421 return dev_err_probe(priv->dev, -ENODEV,
422 "Failed to create left amp slave\n");
423
424 if (!spi_new_device(priv->ctlr, ampr_info))
425 return dev_err_probe(priv->dev, -ENODEV,
426 "Failed to create right amp slave\n");
427 }
428
429 return 0;
430 }
431

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki