mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
spi: gpio: Support a single always-selected device
The generic SPI code, the SPI GPIO driver functions support a single always-connected device cases. The only impediment is that board instantiation prevents that from happening. Update spi_gpio_probe_pdata() checks to support the mentioned hardware setup. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20250205132127.742750-3-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c108905a74
commit
25fac20edd
@ -313,15 +313,14 @@ static int spi_gpio_probe_pdata(struct platform_device *pdev,
|
||||
struct spi_gpio *spi_gpio = spi_controller_get_devdata(host);
|
||||
int i;
|
||||
|
||||
if (!pdata || !pdata->num_chipselect)
|
||||
if (!pdata)
|
||||
return -ENODEV;
|
||||
|
||||
/*
|
||||
* The host needs to think there is a chipselect even if not
|
||||
* connected
|
||||
*/
|
||||
host->num_chipselect = pdata->num_chipselect ?: 1;
|
||||
/* It's just one always-selected device, fine to continue */
|
||||
if (!pdata->num_chipselect)
|
||||
return 0;
|
||||
|
||||
host->num_chipselect = pdata->num_chipselect;
|
||||
spi_gpio->cs_gpios = devm_kcalloc(dev, host->num_chipselect,
|
||||
sizeof(*spi_gpio->cs_gpios),
|
||||
GFP_KERNEL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user