Commit cf26c714 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 3d55978f 9bd77a9c
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -1259,18 +1259,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
	if (!chip)
		return 0;

	/*
	 * Retrieve the corresponding GPIO line used for CS.
	 * The inversion semantics will be handled by the GPIO core
	 * code, so we pass GPIOD_OUT_LOW for "unasserted" and
	 * the correct flag for inversion semantics. The SPI_CS_HIGH
	 * on spi->mode cannot be checked for polarity in this case
	 * as the flag use_gpio_descriptors enforces SPI_CS_HIGH.
	 */
	if (of_property_read_bool(spi->dev.of_node, "spi-cs-high"))
		lflags = GPIO_ACTIVE_HIGH;
	else
		lflags = GPIO_ACTIVE_LOW;
	spi->cs_gpiod = gpiochip_request_own_desc(chip, 8 - spi->chip_select,
						  DRV_NAME,
						  lflags,
+4 −6
Original line number Diff line number Diff line
@@ -1080,12 +1080,11 @@ MODULE_DEVICE_TABLE(of, fsl_dspi_dt_ids);
#ifdef CONFIG_PM_SLEEP
static int dspi_suspend(struct device *dev)
{
	struct spi_controller *ctlr = dev_get_drvdata(dev);
	struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
	struct fsl_dspi *dspi = dev_get_drvdata(dev);

	if (dspi->irq)
		disable_irq(dspi->irq);
	spi_controller_suspend(ctlr);
	spi_controller_suspend(dspi->ctlr);
	clk_disable_unprepare(dspi->clk);

	pinctrl_pm_select_sleep_state(dev);
@@ -1095,8 +1094,7 @@ static int dspi_suspend(struct device *dev)

static int dspi_resume(struct device *dev)
{
	struct spi_controller *ctlr = dev_get_drvdata(dev);
	struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
	struct fsl_dspi *dspi = dev_get_drvdata(dev);
	int ret;

	pinctrl_pm_select_default_state(dev);
@@ -1104,7 +1102,7 @@ static int dspi_resume(struct device *dev)
	ret = clk_prepare_enable(dspi->clk);
	if (ret)
		return ret;
	spi_controller_resume(ctlr);
	spi_controller_resume(dspi->ctlr);
	if (dspi->irq)
		enable_irq(dspi->irq);

+15 −8
Original line number Diff line number Diff line
@@ -1676,15 +1676,18 @@ static int spi_imx_probe(struct platform_device *pdev)
		goto out_master_put;
	}

	pm_runtime_enable(spi_imx->dev);
	ret = clk_prepare_enable(spi_imx->clk_per);
	if (ret)
		goto out_master_put;

	ret = clk_prepare_enable(spi_imx->clk_ipg);
	if (ret)
		goto out_put_per;

	pm_runtime_set_autosuspend_delay(spi_imx->dev, MXC_RPM_TIMEOUT);
	pm_runtime_use_autosuspend(spi_imx->dev);

	ret = pm_runtime_get_sync(spi_imx->dev);
	if (ret < 0) {
		dev_err(spi_imx->dev, "failed to enable clock\n");
		goto out_runtime_pm_put;
	}
	pm_runtime_set_active(spi_imx->dev);
	pm_runtime_enable(spi_imx->dev);

	spi_imx->spi_clk = clk_get_rate(spi_imx->clk_per);
	/*
@@ -1722,8 +1725,12 @@ out_bitbang_start:
		spi_imx_sdma_exit(spi_imx);
out_runtime_pm_put:
	pm_runtime_dont_use_autosuspend(spi_imx->dev);
	pm_runtime_put_sync(spi_imx->dev);
	pm_runtime_set_suspended(&pdev->dev);
	pm_runtime_disable(spi_imx->dev);

	clk_disable_unprepare(spi_imx->clk_ipg);
out_put_per:
	clk_disable_unprepare(spi_imx->clk_per);
out_master_put:
	spi_master_put(master);