Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: omap_hsmmc: switch default/idle pinctrl states in runtime hooks

These are predefined states of the driver model. When not present,
as if not set in the device tree, they become no-ops.
Explicitly selecting the default state is not needed since the
device core layer sets pin mux to "default" state before probe.
This is not the simplest implementation, on AM335x at least, we could
switch to idle at any point in the suspend hook, only the default state
needs to be set before writing to the irq registers or an IRQ might get
lost.

Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Andreas Fenkart and committed by
Ulf Hansson
97978a44 f945901f

+10 -6
+10 -6
drivers/mmc/host/omap_hsmmc.c
··· 1998 1998 const struct of_device_id *match; 1999 1999 dma_cap_mask_t mask; 2000 2000 unsigned tx_req, rx_req; 2001 - struct pinctrl *pinctrl; 2002 2001 const struct omap_mmc_of_data *data; 2003 2002 void __iomem *base; 2004 2003 ··· 2211 2212 2212 2213 omap_hsmmc_disable_irq(host); 2213 2214 2214 - pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 2215 - if (IS_ERR(pinctrl)) 2216 - dev_warn(&pdev->dev, 2217 - "pins are not configured from the driver\n"); 2218 - 2219 2215 /* 2220 2216 * For now, only support SDIO interrupt if we have a separate 2221 2217 * wake-up interrupt configured from device tree. This is because ··· 2412 2418 goto abort; 2413 2419 } 2414 2420 2421 + pinctrl_pm_select_idle_state(dev); 2422 + 2415 2423 WARN_ON(host->flags & HSMMC_WAKE_IRQ_ENABLED); 2416 2424 enable_irq(host->wake_irq); 2417 2425 host->flags |= HSMMC_WAKE_IRQ_ENABLED; 2426 + } else { 2427 + pinctrl_pm_select_idle_state(dev); 2418 2428 } 2429 + 2419 2430 abort: 2420 2431 spin_unlock_irqrestore(&host->irq_lock, flags); 2421 2432 return ret; ··· 2444 2445 host->flags &= ~HSMMC_WAKE_IRQ_ENABLED; 2445 2446 } 2446 2447 2448 + pinctrl_pm_select_default_state(host->dev); 2449 + 2450 + /* irq lost, if pinmux incorrect */ 2447 2451 OMAP_HSMMC_WRITE(host->base, STAT, STAT_CLEAR); 2448 2452 OMAP_HSMMC_WRITE(host->base, ISE, CIRQ_EN); 2449 2453 OMAP_HSMMC_WRITE(host->base, IE, CIRQ_EN); 2454 + } else { 2455 + pinctrl_pm_select_default_state(host->dev); 2450 2456 } 2451 2457 spin_unlock_irqrestore(&host->irq_lock, flags); 2452 2458 return 0;