diff options
Diffstat (limited to 'drivers/spi/spi-pl022.c')
-rw-r--r-- | drivers/spi/spi-pl022.c | 70 |
1 files changed, 8 insertions, 62 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 3b246543282f..abef061fb84a 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -368,11 +368,6 @@ struct pl022 { resource_size_t phybase; void __iomem *virtbase; struct clk *clk; - /* Two optional pin states - default & sleep */ - struct pinctrl *pinctrl; - struct pinctrl_state *pins_default; - struct pinctrl_state *pins_idle; - struct pinctrl_state *pins_sleep; struct spi_master *master; struct pl022_ssp_controller *master_info; /* Message per-transfer pump */ @@ -2134,32 +2129,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int), GFP_KERNEL); - pl022->pinctrl = devm_pinctrl_get(dev); - if (IS_ERR(pl022->pinctrl)) { - status = PTR_ERR(pl022->pinctrl); - goto err_no_pinctrl; - } - - pl022->pins_default = pinctrl_lookup_state(pl022->pinctrl, - PINCTRL_STATE_DEFAULT); - /* enable pins to be muxed in and configured */ - if (!IS_ERR(pl022->pins_default)) { - status = pinctrl_select_state(pl022->pinctrl, - pl022->pins_default); - if (status) - dev_err(dev, "could not set default pins\n"); - } else - dev_err(dev, "could not get default pinstate\n"); - - pl022->pins_idle = pinctrl_lookup_state(pl022->pinctrl, - PINCTRL_STATE_IDLE); - if (IS_ERR(pl022->pins_idle)) - dev_dbg(dev, "could not get idle pinstate\n"); - - pl022->pins_sleep = pinctrl_lookup_state(pl022->pinctrl, - PINCTRL_STATE_SLEEP); - if (IS_ERR(pl022->pins_sleep)) - dev_dbg(dev, "could not get sleep pinstate\n"); + pinctrl_pm_select_default_state(dev); /* * Bus Number Which has been Assigned to this SSP controller @@ -2309,7 +2279,6 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) amba_release_regions(adev); err_no_ioregion: err_no_gpio: - err_no_pinctrl: spi_master_put(master); return status; } @@ -2349,44 +2318,21 @@ pl022_remove(struct amba_device *adev) */ static void pl022_suspend_resources(struct pl022 *pl022, bool runtime) { - int ret; - struct pinctrl_state *pins_state; - clk_disable(pl022->clk); - pins_state = runtime ? pl022->pins_idle : pl022->pins_sleep; - /* Optionally let pins go into sleep states */ - if (!IS_ERR(pins_state)) { - ret = pinctrl_select_state(pl022->pinctrl, pins_state); - if (ret) - dev_err(&pl022->adev->dev, "could not set %s pins\n", - runtime ? "idle" : "sleep"); - } + if (runtime) + pinctrl_pm_select_idle_state(&pl022->adev->dev); + else + pinctrl_pm_select_sleep_state(&pl022->adev->dev); } static void pl022_resume_resources(struct pl022 *pl022, bool runtime) { - int ret; - - /* Optionaly enable pins to be muxed in and configured */ /* First go to the default state */ - if (!IS_ERR(pl022->pins_default)) { - ret = pinctrl_select_state(pl022->pinctrl, pl022->pins_default); - if (ret) - dev_err(&pl022->adev->dev, - "could not set default pins\n"); - } - - if (!runtime) { + pinctrl_pm_select_default_state(&pl022->adev->dev); + if (!runtime) /* Then let's idle the pins until the next transfer happens */ - if (!IS_ERR(pl022->pins_idle)) { - ret = pinctrl_select_state(pl022->pinctrl, - pl022->pins_idle); - if (ret) - dev_err(&pl022->adev->dev, - "could not set idle pins\n"); - } - } + pinctrl_pm_select_idle_state(&pl022->adev->dev); clk_enable(pl022->clk); } |