Lines Matching +full:pwr +full:- +full:reg

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
71 * struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
84 struct input_dev *pwr = _pwr; in pwrkey_press_irq() local
86 input_report_key(pwr, KEY_POWER, 1); in pwrkey_press_irq()
87 input_sync(pwr); in pwrkey_press_irq()
94 struct input_dev *pwr = _pwr; in pwrkey_release_irq() local
96 input_report_key(pwr, KEY_POWER, 0); in pwrkey_release_irq()
97 input_sync(pwr); in pwrkey_release_irq()
107 enable_irq_wake(pwrkey->key_press_irq); in pmic8xxx_pwrkey_suspend()
117 disable_irq_wake(pwrkey->key_press_irq); in pmic8xxx_pwrkey_resume()
132 if (pwrkey->shutdown_fn) { in pmic8xxx_pwrkey_shutdown()
133 error = pwrkey->shutdown_fn(pwrkey, reset); in pmic8xxx_pwrkey_shutdown()
149 regmap_update_bits(pwrkey->regmap, PON_CNTL_1, mask, val); in pmic8xxx_pwrkey_shutdown()
164 unsigned int reg; in pm8058_disable_smps_locally_set_pull_down() local
171 error = regmap_read(regmap, test2_addr, &reg); in pm8058_disable_smps_locally_set_pull_down()
175 reg &= PM8058_SMPS_ADVANCED_MODE_MASK; in pm8058_disable_smps_locally_set_pull_down()
177 if (reg == PM8058_SMPS_ADVANCED_MODE) { in pm8058_disable_smps_locally_set_pull_down()
179 error = regmap_read(regmap, ctrl_addr, &reg); in pm8058_disable_smps_locally_set_pull_down()
183 band = reg & PM8058_SMPS_ADVANCED_BAND_MASK; in pm8058_disable_smps_locally_set_pull_down()
200 return -EPERM; in pm8058_disable_smps_locally_set_pull_down()
202 vprog = reg & PM8058_SMPS_ADVANCED_VPROG_MASK; in pm8058_disable_smps_locally_set_pull_down()
282 struct regmap *regmap = pwrkey->regmap; in pm8058_pwrkey_shutdown()
304 * Fix-up: Set regulator LDO22 to 1.225 V in high power mode. Leave its in pm8058_pwrkey_shutdown()
305 * pull-down state intact. This ensures a safe shutdown. in pm8058_pwrkey_shutdown()
321 struct regmap *regmap = pwrkey->regmap; in pm8921_pwrkey_shutdown()
333 struct input_dev *pwr; in pmic8xxx_pwrkey_probe() local
344 if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) in pmic8xxx_pwrkey_probe()
347 /* Valid range of pwr key trigger delay is 1/64 sec to 2 seconds. */ in pmic8xxx_pwrkey_probe()
349 dev_err(&pdev->dev, "invalid power key trigger delay\n"); in pmic8xxx_pwrkey_probe()
350 return -EINVAL; in pmic8xxx_pwrkey_probe()
353 pull_up = of_property_read_bool(pdev->dev.of_node, "pull-up"); in pmic8xxx_pwrkey_probe()
355 regmap = dev_get_regmap(pdev->dev.parent, NULL); in pmic8xxx_pwrkey_probe()
357 dev_err(&pdev->dev, "failed to locate regmap for the device\n"); in pmic8xxx_pwrkey_probe()
358 return -ENODEV; in pmic8xxx_pwrkey_probe()
361 pwrkey = devm_kzalloc(&pdev->dev, sizeof(*pwrkey), GFP_KERNEL); in pmic8xxx_pwrkey_probe()
363 return -ENOMEM; in pmic8xxx_pwrkey_probe()
365 pwrkey->shutdown_fn = of_device_get_match_data(&pdev->dev); in pmic8xxx_pwrkey_probe()
366 pwrkey->regmap = regmap; in pmic8xxx_pwrkey_probe()
367 pwrkey->key_press_irq = key_press_irq; in pmic8xxx_pwrkey_probe()
369 pwr = devm_input_allocate_device(&pdev->dev); in pmic8xxx_pwrkey_probe()
370 if (!pwr) { in pmic8xxx_pwrkey_probe()
371 dev_dbg(&pdev->dev, "Can't allocate power button\n"); in pmic8xxx_pwrkey_probe()
372 return -ENOMEM; in pmic8xxx_pwrkey_probe()
375 input_set_capability(pwr, EV_KEY, KEY_POWER); in pmic8xxx_pwrkey_probe()
377 pwr->name = "pmic8xxx_pwrkey"; in pmic8xxx_pwrkey_probe()
378 pwr->phys = "pmic8xxx_pwrkey/input0"; in pmic8xxx_pwrkey_probe()
385 dev_err(&pdev->dev, "failed reading PON_CNTL_1 err=%d\n", err); in pmic8xxx_pwrkey_probe()
398 dev_err(&pdev->dev, "failed writing PON_CNTL_1 err=%d\n", err); in pmic8xxx_pwrkey_probe()
402 err = devm_request_irq(&pdev->dev, key_press_irq, pwrkey_press_irq, in pmic8xxx_pwrkey_probe()
404 "pmic8xxx_pwrkey_press", pwr); in pmic8xxx_pwrkey_probe()
406 dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n", in pmic8xxx_pwrkey_probe()
411 err = devm_request_irq(&pdev->dev, key_release_irq, pwrkey_release_irq, in pmic8xxx_pwrkey_probe()
413 "pmic8xxx_pwrkey_release", pwr); in pmic8xxx_pwrkey_probe()
415 dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n", in pmic8xxx_pwrkey_probe()
420 err = input_register_device(pwr); in pmic8xxx_pwrkey_probe()
422 dev_err(&pdev->dev, "Can't register power key: %d\n", err); in pmic8xxx_pwrkey_probe()
427 device_init_wakeup(&pdev->dev, 1); in pmic8xxx_pwrkey_probe()
433 { .compatible = "qcom,pm8058-pwrkey", .data = &pm8058_pwrkey_shutdown },
434 { .compatible = "qcom,pm8921-pwrkey", .data = &pm8921_pwrkey_shutdown },
443 .name = "pm8xxx-pwrkey",