Skip to content

Commit cf26c71

Browse files
committed
Merge tag 'spi-fix-v5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A small collection of driver specific fixes that have come in since the merge window, nothing too major here but all good to have" * tag 'spi-fix-v5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: fsl-dspi: fix wrong pointer in suspend/resume spi: bcm2835: fix gpio cs level inversion spi: imx: fix runtime pm support for !CONFIG_PM
2 parents 3d55978 + 9bd77a9 commit cf26c71

3 files changed

Lines changed: 19 additions & 26 deletions

File tree

drivers/spi/spi-bcm2835.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,18 +1259,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
12591259
if (!chip)
12601260
return 0;
12611261

1262-
/*
1263-
* Retrieve the corresponding GPIO line used for CS.
1264-
* The inversion semantics will be handled by the GPIO core
1265-
* code, so we pass GPIOD_OUT_LOW for "unasserted" and
1266-
* the correct flag for inversion semantics. The SPI_CS_HIGH
1267-
* on spi->mode cannot be checked for polarity in this case
1268-
* as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
1269-
*/
1270-
if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
1271-
lflags = GPIO_ACTIVE_HIGH;
1272-
else
1273-
lflags = GPIO_ACTIVE_LOW;
12741262
spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
12751263
DRV_NAME,
12761264
lflags,

drivers/spi/spi-fsl-dspi.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
10801080
#ifdef CONFIG_PM_SLEEP
10811081
static int dspi_suspend(struct device *dev)
10821082
{
1083-
struct spi_controller *ctlr = dev_get_drvdata(dev);
1084-
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
1083+
struct fsl_dspi *dspi = dev_get_drvdata(dev);
10851084

10861085
if (dspi->irq)
10871086
disable_irq(dspi->irq);
1088-
spi_controller_suspend(ctlr);
1087+
spi_controller_suspend(dspi->ctlr);
10891088
clk_disable_unprepare(dspi->clk);
10901089

10911090
pinctrl_pm_select_sleep_state(dev);
@@ -1095,16 +1094,15 @@ static int dspi_suspend(struct device *dev)
10951094

10961095
static int dspi_resume(struct device *dev)
10971096
{
1098-
struct spi_controller *ctlr = dev_get_drvdata(dev);
1099-
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
1097+
struct fsl_dspi *dspi = dev_get_drvdata(dev);
11001098
int ret;
11011099

11021100
pinctrl_pm_select_default_state(dev);
11031101

11041102
ret = clk_prepare_enable(dspi->clk);
11051103
if (ret)
11061104
return ret;
1107-
spi_controller_resume(ctlr);
1105+
spi_controller_resume(dspi->ctlr);
11081106
if (dspi->irq)
11091107
enable_irq(dspi->irq);
11101108

drivers/spi/spi-imx.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev)
16761676
goto out_master_put;
16771677
}
16781678

1679-
pm_runtime_enable(spi_imx->dev);
1679+
ret = clk_prepare_enable(spi_imx->clk_per);
1680+
if (ret)
1681+
goto out_master_put;
1682+
1683+
ret = clk_prepare_enable(spi_imx->clk_ipg);
1684+
if (ret)
1685+
goto out_put_per;
1686+
16801687
pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
16811688
pm_runtime_use_autosuspend(spi_imx->dev);
1682-
1683-
ret = pm_runtime_get_sync(spi_imx->dev);
1684-
if (ret < 0) {
1685-
dev_err(spi_imx->dev, "failed to enable clock\n");
1686-
goto out_runtime_pm_put;
1687-
}
1689+
pm_runtime_set_active(spi_imx->dev);
1690+
pm_runtime_enable(spi_imx->dev);
16881691

16891692
spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
16901693
/*
@@ -1722,8 +1725,12 @@ static int spi_imx_probe(struct platform_device *pdev)
17221725
spi_imx_sdma_exit(spi_imx);
17231726
out_runtime_pm_put:
17241727
pm_runtime_dont_use_autosuspend(spi_imx->dev);
1725-
pm_runtime_put_sync(spi_imx->dev);
1728+
pm_runtime_set_suspended(&pdev->dev);
17261729
pm_runtime_disable(spi_imx->dev);
1730+
1731+
clk_disable_unprepare(spi_imx->clk_ipg);
1732+
out_put_per:
1733+
clk_disable_unprepare(spi_imx->clk_per);
17271734
out_master_put:
17281735
spi_master_put(master);
17291736

0 commit comments

Comments
 (0)