diff options
author | Denys Drozdov <denys.drozdov@toradex.com> | 2022-01-10 14:19:59 +0200 |
---|---|---|
committer | Denys Drozdov <denys.drozdov@toradex.com> | 2022-01-10 14:19:59 +0200 |
commit | c1d2a6fa7e3635a0ac4e2a7cbe7ccbc2059b6968 (patch) | |
tree | 15a6a12998f4d638a02a6cdcbaf5c418f7fc6ef8 /drivers/input | |
parent | b9b41da981217b17e1e9171a781c65ae8dde1688 (diff) | |
parent | 89b6869b942b8730467f2a0760ea466044aa52d2 (diff) |
Merge tag 'v5.4.156' into HEAD
This is the 5.4.156 stable release
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/snvs_pwrkey.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c index bbebb89f2967..0c2e06a1f0d0 100644 --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -112,6 +112,11 @@ static irqreturn_t imx_snvs_pwrkey_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } +static void imx_snvs_pwrkey_disable_clk(void *data) +{ + clk_disable_unprepare(data); +} + static void imx_snvs_pwrkey_act(void *pdata) { struct pwrkey_drv_data *pd = pdata; @@ -124,6 +129,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) struct pwrkey_drv_data *pdata = NULL; struct input_dev *input = NULL; struct device_node *np; + struct clk *clk; int error; /* Get SNVS register Page */ @@ -146,6 +152,28 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n"); } + clk = devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(clk)) { + dev_err(&pdev->dev, "Failed to get snvs clock (%pe)\n", clk); + return PTR_ERR(clk); + } + + error = clk_prepare_enable(clk); + if (error) { + dev_err(&pdev->dev, "Failed to enable snvs clock (%pe)\n", + ERR_PTR(error)); + return error; + } + + error = devm_add_action_or_reset(&pdev->dev, + imx_snvs_pwrkey_disable_clk, clk); + if (error) { + dev_err(&pdev->dev, + "Failed to register clock cleanup handler (%pe)\n", + ERR_PTR(error)); + return error; + } + pdata->wakeup = of_property_read_bool(np, "wakeup-source"); pdata->irq = platform_get_irq(pdev, 0); |