From: Stephen Boyd <sboyd@codeaurora.org> To: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org Subject: [PATCH v2 05/10] Input: pmic8xxx-pwrkey - Migrate to DT Date: Thu, 2 Jan 2014 16:37:35 -0800 [thread overview] Message-ID: <1388709460-19222-6-git-send-email-sboyd@codeaurora.org> (raw) In-Reply-To: <1388709460-19222-1-git-send-email-sboyd@codeaurora.org> The driver is only supported on DT enabled platforms. Convert the driver to DT so that it can probe properly. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/input/misc/pmic8xxx-pwrkey.c | 33 ++++++++++++++++++++------------- include/linux/input/pmic8xxx-pwrkey.h | 31 ------------------------------- 2 files changed, 20 insertions(+), 44 deletions(-) delete mode 100644 include/linux/input/pmic8xxx-pwrkey.h diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index aaf332510623..72f629f37211 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c @@ -20,8 +20,7 @@ #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/log2.h> - -#include <linux/input/pmic8xxx-pwrkey.h> +#include <linux/of.h> #define PON_CNTL_1 0x1C #define PON_CNTL_PULL_UP BIT(7) @@ -80,6 +79,13 @@ static int pmic8xxx_pwrkey_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops, pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume); +static const struct of_device_id pm8xxx_pwr_key_id_table[] = { + { .compatible = "qcom,pm8058-pwrkey" }, + { .compatible = "qcom,pm8921-pwrkey" }, + { } +}; +MODULE_DEVICE_TABLE(of, pm8xxx_pwr_key_id_table); + static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) { struct input_dev *pwr; @@ -90,15 +96,15 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) unsigned int pon_cntl; struct regmap *regmap; struct pmic8xxx_pwrkey *pwrkey; - const struct pm8xxx_pwrkey_platform_data *pdata = - dev_get_platdata(&pdev->dev); + u32 kpd_delay; + bool pull_up; - if (!pdata) { - dev_err(&pdev->dev, "power key platform data not supplied\n"); - return -EINVAL; - } + if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) + kpd_delay = 0; + + pull_up = of_property_read_bool(pdev->dev.of_node, "pull-up"); - if (pdata->kpd_trigger_delay_us > 62500) { + if (kpd_delay > 62500) { dev_err(&pdev->dev, "invalid power key trigger delay\n"); return -EINVAL; } @@ -126,7 +132,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) pwr->name = "pmic8xxx_pwrkey"; pwr->phys = "pmic8xxx_pwrkey/input0"; - delay = (pdata->kpd_trigger_delay_us << 10) / USEC_PER_SEC; + delay = (kpd_delay << 10) / USEC_PER_SEC; delay = 1 + ilog2(delay); err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); @@ -137,7 +143,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK; pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK); - if (pdata->pull_up) + if (pull_up) pon_cntl |= PON_CNTL_PULL_UP; else pon_cntl &= ~PON_CNTL_PULL_UP; @@ -173,7 +179,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, pwrkey); - device_init_wakeup(&pdev->dev, pdata->wakeup); + device_init_wakeup(&pdev->dev, 1); return 0; } @@ -189,9 +195,10 @@ static struct platform_driver pmic8xxx_pwrkey_driver = { .probe = pmic8xxx_pwrkey_probe, .remove = pmic8xxx_pwrkey_remove, .driver = { - .name = PM8XXX_PWRKEY_DEV_NAME, + .name = "pm8xxx-pwrkey", .owner = THIS_MODULE, .pm = &pm8xxx_pwr_key_pm_ops, + .of_match_table = pm8xxx_pwr_key_id_table, }, }; module_platform_driver(pmic8xxx_pwrkey_driver); diff --git a/include/linux/input/pmic8xxx-pwrkey.h b/include/linux/input/pmic8xxx-pwrkey.h deleted file mode 100644 index 6d2974e57109..000000000000 --- a/include/linux/input/pmic8xxx-pwrkey.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __PMIC8XXX_PWRKEY_H__ -#define __PMIC8XXX_PWRKEY_H__ - -#define PM8XXX_PWRKEY_DEV_NAME "pm8xxx-pwrkey" - -/** - * struct pm8xxx_pwrkey_platform_data - platform data for pwrkey driver - * @pull up: power on register control for pull up/down configuration - * @kpd_trigger_delay_us: time delay for power key state change interrupt - * trigger. - * @wakeup: configure power key as wakeup source - */ -struct pm8xxx_pwrkey_platform_data { - bool pull_up; - u32 kpd_trigger_delay_us; - u32 wakeup; -}; - -#endif /* __PMIC8XXX_PWRKEY_H__ */ -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 05/10] Input: pmic8xxx-pwrkey - Migrate to DT Date: Thu, 2 Jan 2014 16:37:35 -0800 [thread overview] Message-ID: <1388709460-19222-6-git-send-email-sboyd@codeaurora.org> (raw) In-Reply-To: <1388709460-19222-1-git-send-email-sboyd@codeaurora.org> The driver is only supported on DT enabled platforms. Convert the driver to DT so that it can probe properly. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/input/misc/pmic8xxx-pwrkey.c | 33 ++++++++++++++++++++------------- include/linux/input/pmic8xxx-pwrkey.h | 31 ------------------------------- 2 files changed, 20 insertions(+), 44 deletions(-) delete mode 100644 include/linux/input/pmic8xxx-pwrkey.h diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index aaf332510623..72f629f37211 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c @@ -20,8 +20,7 @@ #include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/log2.h> - -#include <linux/input/pmic8xxx-pwrkey.h> +#include <linux/of.h> #define PON_CNTL_1 0x1C #define PON_CNTL_PULL_UP BIT(7) @@ -80,6 +79,13 @@ static int pmic8xxx_pwrkey_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops, pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume); +static const struct of_device_id pm8xxx_pwr_key_id_table[] = { + { .compatible = "qcom,pm8058-pwrkey" }, + { .compatible = "qcom,pm8921-pwrkey" }, + { } +}; +MODULE_DEVICE_TABLE(of, pm8xxx_pwr_key_id_table); + static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) { struct input_dev *pwr; @@ -90,15 +96,15 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) unsigned int pon_cntl; struct regmap *regmap; struct pmic8xxx_pwrkey *pwrkey; - const struct pm8xxx_pwrkey_platform_data *pdata = - dev_get_platdata(&pdev->dev); + u32 kpd_delay; + bool pull_up; - if (!pdata) { - dev_err(&pdev->dev, "power key platform data not supplied\n"); - return -EINVAL; - } + if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) + kpd_delay = 0; + + pull_up = of_property_read_bool(pdev->dev.of_node, "pull-up"); - if (pdata->kpd_trigger_delay_us > 62500) { + if (kpd_delay > 62500) { dev_err(&pdev->dev, "invalid power key trigger delay\n"); return -EINVAL; } @@ -126,7 +132,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) pwr->name = "pmic8xxx_pwrkey"; pwr->phys = "pmic8xxx_pwrkey/input0"; - delay = (pdata->kpd_trigger_delay_us << 10) / USEC_PER_SEC; + delay = (kpd_delay << 10) / USEC_PER_SEC; delay = 1 + ilog2(delay); err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); @@ -137,7 +143,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK; pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK); - if (pdata->pull_up) + if (pull_up) pon_cntl |= PON_CNTL_PULL_UP; else pon_cntl &= ~PON_CNTL_PULL_UP; @@ -173,7 +179,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, pwrkey); - device_init_wakeup(&pdev->dev, pdata->wakeup); + device_init_wakeup(&pdev->dev, 1); return 0; } @@ -189,9 +195,10 @@ static struct platform_driver pmic8xxx_pwrkey_driver = { .probe = pmic8xxx_pwrkey_probe, .remove = pmic8xxx_pwrkey_remove, .driver = { - .name = PM8XXX_PWRKEY_DEV_NAME, + .name = "pm8xxx-pwrkey", .owner = THIS_MODULE, .pm = &pm8xxx_pwr_key_pm_ops, + .of_match_table = pm8xxx_pwr_key_id_table, }, }; module_platform_driver(pmic8xxx_pwrkey_driver); diff --git a/include/linux/input/pmic8xxx-pwrkey.h b/include/linux/input/pmic8xxx-pwrkey.h deleted file mode 100644 index 6d2974e57109..000000000000 --- a/include/linux/input/pmic8xxx-pwrkey.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef __PMIC8XXX_PWRKEY_H__ -#define __PMIC8XXX_PWRKEY_H__ - -#define PM8XXX_PWRKEY_DEV_NAME "pm8xxx-pwrkey" - -/** - * struct pm8xxx_pwrkey_platform_data - platform data for pwrkey driver - * @pull up: power on register control for pull up/down configuration - * @kpd_trigger_delay_us: time delay for power key state change interrupt - * trigger. - * @wakeup: configure power key as wakeup source - */ -struct pm8xxx_pwrkey_platform_data { - bool pull_up; - u32 kpd_trigger_delay_us; - u32 wakeup; -}; - -#endif /* __PMIC8XXX_PWRKEY_H__ */ -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2014-01-03 0:37 UTC|newest] Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-01-03 0:37 [PATCH v2 00/10] Use regmap+devm+DT in pm8xxx input drivers Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 01/10] Input: pmic8xxx-pwrkey - switch to using managed resources Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 02/10] genirq: Add devm_request_any_context_irq() Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-06 22:24 ` Stephen Boyd 2014-01-06 22:24 ` Stephen Boyd 2014-01-14 20:47 ` Stephen Boyd 2014-01-14 20:47 ` Stephen Boyd 2014-02-07 21:08 ` Stephen Boyd 2014-02-07 21:08 ` Stephen Boyd 2014-02-09 14:30 ` [tip:irq/core] " tip-bot for Stephen Boyd 2014-02-11 6:46 ` Stephen Boyd 2014-02-11 7:19 ` Ingo Molnar 2014-02-11 14:32 ` Thomas Gleixner 2014-02-11 16:39 ` Dmitry Torokhov 2014-02-18 22:11 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 03/10] Input: pmic8xxx-keypad - Switch to using managed resources Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 04/10] Input: pmic8xxx-keypad - Migrate to regmap APIs Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd [this message] 2014-01-03 0:37 ` [PATCH v2 05/10] Input: pmic8xxx-pwrkey - Migrate to DT Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 06/10] Input: pm8xxx-vibrator - Add DT match table Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 1:17 ` Dmitry Torokhov 2014-01-03 1:17 ` Dmitry Torokhov 2014-01-03 1:17 ` Dmitry Torokhov 2014-01-03 1:27 ` Stephen Boyd 2014-01-03 1:27 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 07/10] Input: pmic8xxx-keypad - Migrate to DT Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 08/10] devicetree: bindings: Document PM8921/8058 keypads Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 09/10] devicetree: bindings: Document PM8921/8058 power keys Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` [PATCH v2 10/10] devicetree: bindings: Document PM8921/8058 vibrators Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd 2014-01-03 0:37 ` Stephen Boyd
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1388709460-19222-6-git-send-email-sboyd@codeaurora.org \ --to=sboyd@codeaurora.org \ --cc=dmitry.torokhov@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.