linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
@ 2025-11-20 10:59 Charles Keepax
  2025-11-20 11:21 ` Philipp Zabel
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Charles Keepax @ 2025-11-20 10:59 UTC (permalink / raw)
  To: broonie, brgl, linus.walleij
  Cc: andy, p.zabel, linux-gpio, linux-spi, bartosz.golaszewski,
	linux-kernel, patches

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.

Link: https://lore.kernel.org/linux-gpio/20251106-reset-gpios-swnodes-v6-0-69aa852de9e4@linaro.org/ [1]
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")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

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(-)

diff --git a/drivers/spi/spi-cs42l43.c b/drivers/spi/spi-cs42l43.c
index 14307dd800b74..43079f292d6f7 100644
--- a/drivers/spi/spi-cs42l43.c
+++ b/drivers/spi/spi-cs42l43.c
@@ -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 {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 10:59 [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects Charles Keepax
@ 2025-11-20 11:21 ` Philipp Zabel
  2025-11-20 12:27   ` Bartosz Golaszewski
  2025-11-20 11:50 ` Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Philipp Zabel @ 2025-11-20 11:21 UTC (permalink / raw)
  To: Charles Keepax, broonie, brgl, linus.walleij
  Cc: andy, linux-gpio, linux-spi, bartosz.golaszewski, linux-kernel,
	patches

On Do, 2025-11-20 at 10:59 +0000, Charles Keepax wrote:
> 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.
> 
> Link: https://lore.kernel.org/linux-gpio/20251106-reset-gpios-swnodes-v6-0-69aa852de9e4@linaro.org/ [1]
> 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")
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
> 
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 10:59 [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects Charles Keepax
  2025-11-20 11:21 ` Philipp Zabel
@ 2025-11-20 11:50 ` Andy Shevchenko
  2025-11-20 12:42   ` Charles Keepax
  2025-11-21  6:53 ` kernel test robot
  2025-11-21 19:36 ` kernel test robot
  3 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2025-11-20 11:50 UTC (permalink / raw)
  To: Charles Keepax
  Cc: broonie, brgl, linus.walleij, andy, p.zabel, linux-gpio,
	linux-spi, bartosz.golaszewski, linux-kernel, patches

On Thu, Nov 20, 2025 at 10:59:07AM +0000, Charles Keepax wrote:
> 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.

...

> +		struct property_entry props[] = {
> +			PROPERTY_ENTRY_REF_ARRAY_LEN("cs-gpios", args, ARRAY_SIZE(args)),

No need to open code PROPERTY_ENTRY_REF_ARRAY().

> +			{ }
> +		};

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 11:21 ` Philipp Zabel
@ 2025-11-20 12:27   ` Bartosz Golaszewski
  2025-11-20 13:43     ` Bartosz Golaszewski
  0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-11-20 12:27 UTC (permalink / raw)
  To: Philipp Zabel, broonie
  Cc: Charles Keepax, linus.walleij, andy, linux-gpio, linux-spi,
	bartosz.golaszewski, linux-kernel, patches

On Thu, Nov 20, 2025 at 12:21 PM Philipp Zabel <p.zabel@pengutronix.de> wrote:
>
> On Do, 2025-11-20 at 10:59 +0000, Charles Keepax wrote:
> > 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.
> >
> > Link: https://lore.kernel.org/linux-gpio/20251106-reset-gpios-swnodes-v6-0-69aa852de9e4@linaro.org/ [1]
> > 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")
> > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> > ---
> >
> > 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:

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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/20251106-reset-gpios-swnodes-v6-0-69aa852de9e4@linaro.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 11:50 ` Andy Shevchenko
@ 2025-11-20 12:42   ` Charles Keepax
  2025-11-20 12:48     ` Bartosz Golaszewski
  0 siblings, 1 reply; 9+ messages in thread
From: Charles Keepax @ 2025-11-20 12:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: broonie, brgl, linus.walleij, andy, p.zabel, linux-gpio,
	linux-spi, bartosz.golaszewski, linux-kernel, patches

On Thu, Nov 20, 2025 at 01:50:50PM +0200, Andy Shevchenko wrote:
> On Thu, Nov 20, 2025 at 10:59:07AM +0000, Charles Keepax wrote:
> > +		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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 12:42   ` Charles Keepax
@ 2025-11-20 12:48     ` Bartosz Golaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-11-20 12:48 UTC (permalink / raw)
  To: Charles Keepax
  Cc: Andy Shevchenko, broonie, linus.walleij, andy, p.zabel,
	linux-gpio, linux-spi, bartosz.golaszewski, linux-kernel, patches

On Thu, Nov 20, 2025 at 1:42 PM Charles Keepax
<ckeepax@opensource.cirrus.com> wrote:
>
> On Thu, Nov 20, 2025 at 01:50:50PM +0200, Andy Shevchenko wrote:
> > On Thu, Nov 20, 2025 at 10:59:07AM +0000, Charles Keepax wrote:
> > > +           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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 12:27   ` Bartosz Golaszewski
@ 2025-11-20 13:43     ` Bartosz Golaszewski
  0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2025-11-20 13:43 UTC (permalink / raw)
  To: Philipp Zabel, broonie
  Cc: Charles Keepax, linus.walleij, andy, linux-gpio, linux-spi,
	bartosz.golaszewski, linux-kernel, patches

On Thu, Nov 20, 2025 at 1:27 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> Mark: can you Ack it and Philipp will include it in the immutable
> branch with the swnode series[1] I will resend?
>

I've included it as part of v7 [1] of my reset series, please Ack this
one instead.

Bartosz

[1] https://lore.kernel.org/all/20251120-reset-gpios-swnodes-v7-4-a100493a0f4b@linaro.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 10:59 [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects Charles Keepax
  2025-11-20 11:21 ` Philipp Zabel
  2025-11-20 11:50 ` Andy Shevchenko
@ 2025-11-21  6:53 ` kernel test robot
  2025-11-21 19:36 ` kernel test robot
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2025-11-21  6:53 UTC (permalink / raw)
  To: Charles Keepax, broonie, brgl, linus.walleij
  Cc: oe-kbuild-all, andy, p.zabel, linux-gpio, linux-spi,
	bartosz.golaszewski, linux-kernel, patches

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/202511211445.OQ2X71Jh-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251121/202511211445.OQ2X71Jh-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511211445.OQ2X71Jh-lkp@intel.com/

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	

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects
  2025-11-20 10:59 [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects Charles Keepax
                   ` (2 preceding siblings ...)
  2025-11-21  6:53 ` kernel test robot
@ 2025-11-21 19:36 ` kernel test robot
  3 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2025-11-21 19:36 UTC (permalink / raw)
  To: Charles Keepax, broonie, brgl, linus.walleij
  Cc: llvm, oe-kbuild-all, andy, p.zabel, linux-gpio, linux-spi,
	bartosz.golaszewski, linux-kernel, patches

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/202511220309.nzj2045b-lkp@intel.com/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/202511220309.nzj2045b-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511220309.nzj2045b-lkp@intel.com/

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	

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-11-21 19:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-20 10:59 [PATCH v2] spi: cs42l43: Use actual ACPI firmware node for chip selects Charles Keepax
2025-11-20 11:21 ` Philipp Zabel
2025-11-20 12:27   ` Bartosz Golaszewski
2025-11-20 13:43     ` Bartosz Golaszewski
2025-11-20 11:50 ` Andy Shevchenko
2025-11-20 12:42   ` Charles Keepax
2025-11-20 12:48     ` Bartosz Golaszewski
2025-11-21  6:53 ` kernel test robot
2025-11-21 19:36 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).