diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2014-03-29 15:39:38 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-03-30 16:25:19 -0400 |
commit | 57918dfadf717acf7d0488d5970c56a282d0aad1 (patch) | |
tree | e082d6da7df26c27f252ca3e6984e1322302c8c4 /drivers/input/misc | |
parent | 86ea5e6b793d45fa7d2aa504ac3aefc813f0fd55 (diff) |
Input: pmic8xxx-pwrkey - migrate to DT
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>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/pmic8xxx-pwrkey.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index 0e1a05f95858..1cb8fda7a166 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c | |||
@@ -19,8 +19,7 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/regmap.h> | 20 | #include <linux/regmap.h> |
21 | #include <linux/log2.h> | 21 | #include <linux/log2.h> |
22 | 22 | #include <linux/of.h> | |
23 | #include <linux/input/pmic8xxx-pwrkey.h> | ||
24 | 23 | ||
25 | #define PON_CNTL_1 0x1C | 24 | #define PON_CNTL_1 0x1C |
26 | #define PON_CNTL_PULL_UP BIT(7) | 25 | #define PON_CNTL_PULL_UP BIT(7) |
@@ -89,15 +88,15 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) | |||
89 | unsigned int pon_cntl; | 88 | unsigned int pon_cntl; |
90 | struct regmap *regmap; | 89 | struct regmap *regmap; |
91 | struct pmic8xxx_pwrkey *pwrkey; | 90 | struct pmic8xxx_pwrkey *pwrkey; |
92 | const struct pm8xxx_pwrkey_platform_data *pdata = | 91 | u32 kpd_delay; |
93 | dev_get_platdata(&pdev->dev); | 92 | bool pull_up; |
94 | 93 | ||
95 | if (!pdata) { | 94 | if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) |
96 | dev_err(&pdev->dev, "power key platform data not supplied\n"); | 95 | kpd_delay = 0; |
97 | return -EINVAL; | ||
98 | } | ||
99 | 96 | ||
100 | if (pdata->kpd_trigger_delay_us > 62500) { | 97 | pull_up = of_property_read_bool(pdev->dev.of_node, "pull-up"); |
98 | |||
99 | if (kpd_delay > 62500) { | ||
101 | dev_err(&pdev->dev, "invalid power key trigger delay\n"); | 100 | dev_err(&pdev->dev, "invalid power key trigger delay\n"); |
102 | return -EINVAL; | 101 | return -EINVAL; |
103 | } | 102 | } |
@@ -125,7 +124,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) | |||
125 | pwr->name = "pmic8xxx_pwrkey"; | 124 | pwr->name = "pmic8xxx_pwrkey"; |
126 | pwr->phys = "pmic8xxx_pwrkey/input0"; | 125 | pwr->phys = "pmic8xxx_pwrkey/input0"; |
127 | 126 | ||
128 | delay = (pdata->kpd_trigger_delay_us << 10) / USEC_PER_SEC; | 127 | delay = (kpd_delay << 10) / USEC_PER_SEC; |
129 | delay = 1 + ilog2(delay); | 128 | delay = 1 + ilog2(delay); |
130 | 129 | ||
131 | err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); | 130 | err = regmap_read(regmap, PON_CNTL_1, &pon_cntl); |
@@ -136,7 +135,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) | |||
136 | 135 | ||
137 | pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK; | 136 | pon_cntl &= ~PON_CNTL_TRIG_DELAY_MASK; |
138 | pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK); | 137 | pon_cntl |= (delay & PON_CNTL_TRIG_DELAY_MASK); |
139 | if (pdata->pull_up) | 138 | if (pull_up) |
140 | pon_cntl |= PON_CNTL_PULL_UP; | 139 | pon_cntl |= PON_CNTL_PULL_UP; |
141 | else | 140 | else |
142 | pon_cntl &= ~PON_CNTL_PULL_UP; | 141 | pon_cntl &= ~PON_CNTL_PULL_UP; |
@@ -172,7 +171,7 @@ static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) | |||
172 | } | 171 | } |
173 | 172 | ||
174 | platform_set_drvdata(pdev, pwrkey); | 173 | platform_set_drvdata(pdev, pwrkey); |
175 | device_init_wakeup(&pdev->dev, pdata->wakeup); | 174 | device_init_wakeup(&pdev->dev, 1); |
176 | 175 | ||
177 | return 0; | 176 | return 0; |
178 | } | 177 | } |
@@ -184,13 +183,21 @@ static int pmic8xxx_pwrkey_remove(struct platform_device *pdev) | |||
184 | return 0; | 183 | return 0; |
185 | } | 184 | } |
186 | 185 | ||
186 | static const struct of_device_id pm8xxx_pwr_key_id_table[] = { | ||
187 | { .compatible = "qcom,pm8058-pwrkey" }, | ||
188 | { .compatible = "qcom,pm8921-pwrkey" }, | ||
189 | { } | ||
190 | }; | ||
191 | MODULE_DEVICE_TABLE(of, pm8xxx_pwr_key_id_table); | ||
192 | |||
187 | static struct platform_driver pmic8xxx_pwrkey_driver = { | 193 | static struct platform_driver pmic8xxx_pwrkey_driver = { |
188 | .probe = pmic8xxx_pwrkey_probe, | 194 | .probe = pmic8xxx_pwrkey_probe, |
189 | .remove = pmic8xxx_pwrkey_remove, | 195 | .remove = pmic8xxx_pwrkey_remove, |
190 | .driver = { | 196 | .driver = { |
191 | .name = PM8XXX_PWRKEY_DEV_NAME, | 197 | .name = "pm8xxx-pwrkey", |
192 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
193 | .pm = &pm8xxx_pwr_key_pm_ops, | 199 | .pm = &pm8xxx_pwr_key_pm_ops, |
200 | .of_match_table = pm8xxx_pwr_key_id_table, | ||
194 | }, | 201 | }, |
195 | }; | 202 | }; |
196 | module_platform_driver(pmic8xxx_pwrkey_driver); | 203 | module_platform_driver(pmic8xxx_pwrkey_driver); |