Lines Matching +full:reset +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
32 /* Regulator control registers for shutdown/reset */
52 /* Buck TEST2 registers for shutdown/reset */
71 * struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
107 enable_irq_wake(pwrkey->key_press_irq); in pmic8xxx_pwrkey_suspend()
117 disable_irq_wake(pwrkey->key_press_irq); in pmic8xxx_pwrkey_resume()
129 u8 mask, val; in pmic8xxx_pwrkey_shutdown() local
130 bool reset = system_state == SYSTEM_RESTART; in pmic8xxx_pwrkey_shutdown() local
132 if (pwrkey->shutdown_fn) { in pmic8xxx_pwrkey_shutdown()
133 error = pwrkey->shutdown_fn(pwrkey, reset); in pmic8xxx_pwrkey_shutdown()
139 * Select action to perform (reset or shutdown) when PS_HOLD goes low. in pmic8xxx_pwrkey_shutdown()
143 mask = PON_CNTL_1_PULL_UP_EN | PON_CNTL_1_USB_PWR_EN; in pmic8xxx_pwrkey_shutdown()
144 mask |= PON_CNTL_1_WD_EN_RESET; in pmic8xxx_pwrkey_shutdown()
145 val = mask; in pmic8xxx_pwrkey_shutdown()
146 if (!reset) in pmic8xxx_pwrkey_shutdown()
149 regmap_update_bits(pwrkey->regmap, PON_CNTL_1, mask, val); in pmic8xxx_pwrkey_shutdown()
200 return -EPERM; in pm8058_disable_smps_locally_set_pull_down()
279 static int pm8058_pwrkey_shutdown(struct pmic8xxx_pwrkey *pwrkey, bool reset) in pm8058_pwrkey_shutdown() argument
282 struct regmap *regmap = pwrkey->regmap; in pm8058_pwrkey_shutdown()
283 u8 mask, val; in pm8058_pwrkey_shutdown() local
286 if (!reset) { 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()
312 mask = SLEEP_CTRL_SMPL_EN_RESET; in pm8058_pwrkey_shutdown()
314 if (reset) in pm8058_pwrkey_shutdown()
315 val = mask; in pm8058_pwrkey_shutdown()
316 return regmap_update_bits(regmap, PM8058_SLEEP_CTRL, mask, val); in pm8058_pwrkey_shutdown()
319 static int pm8921_pwrkey_shutdown(struct pmic8xxx_pwrkey *pwrkey, bool reset) in pm8921_pwrkey_shutdown() argument
321 struct regmap *regmap = pwrkey->regmap; in pm8921_pwrkey_shutdown()
322 u8 mask = SLEEP_CTRL_SMPL_EN_RESET; in pm8921_pwrkey_shutdown() local
326 if (reset) in pm8921_pwrkey_shutdown()
327 val = mask; in pm8921_pwrkey_shutdown()
328 return regmap_update_bits(regmap, PM8921_SLEEP_CTRL, mask, val); in pm8921_pwrkey_shutdown()
344 if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) 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()
371 dev_dbg(&pdev->dev, "Can't allocate power button\n"); in pmic8xxx_pwrkey_probe()
372 return -ENOMEM; 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()
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()
415 dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n", 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",