Lines Matching +full:enable +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
29 /* Regulator master enable addresses */
72 * struct pmic8xxx_pwrkey - pmic8xxx pwrkey information
108 enable_irq_wake(pwrkey->key_press_irq); in pmic8xxx_pwrkey_suspend()
118 disable_irq_wake(pwrkey->key_press_irq); in pmic8xxx_pwrkey_resume()
130 u8 mask, val; in pmic8xxx_pwrkey_shutdown() local
133 if (pwrkey->shutdown_fn) { in pmic8xxx_pwrkey_shutdown()
134 error = pwrkey->shutdown_fn(pwrkey, reset); in pmic8xxx_pwrkey_shutdown()
144 mask = PON_CNTL_1_PULL_UP_EN | PON_CNTL_1_USB_PWR_EN; in pmic8xxx_pwrkey_shutdown()
145 mask |= PON_CNTL_1_WD_EN_RESET; in pmic8xxx_pwrkey_shutdown()
146 val = mask; in pmic8xxx_pwrkey_shutdown()
150 regmap_update_bits(pwrkey->regmap, PON_CNTL_1, mask, val); in pmic8xxx_pwrkey_shutdown()
155 * in the master enable register. Also set it's pull down enable bit.
201 return -EPERM; in pm8058_disable_smps_locally_set_pull_down()
239 /* Enable locally, enable pull down, keep voltage the same. */ in pm8058_disable_smps_locally_set_pull_down()
251 /* Enable in master control register. */ in pm8058_disable_smps_locally_set_pull_down()
257 /* Disable locally and enable pull down. */ in pm8058_disable_smps_locally_set_pull_down()
268 /* Enable LDO in master control register. */ in pm8058_disable_ldo_locally_set_pull_down()
283 struct regmap *regmap = pwrkey->regmap; in pm8058_pwrkey_shutdown()
284 u8 mask, val; in pm8058_pwrkey_shutdown() local
286 /* When shutting down, enable active pulldowns on important rails. */ in pm8058_pwrkey_shutdown()
288 /* Disable SMPS's 0,1,3 locally and set pulldown enable bits. */ in pm8058_pwrkey_shutdown()
298 /* Disable LDO 21 locally and set pulldown enable bit. */ in pm8058_pwrkey_shutdown()
305 * Fix-up: Set regulator LDO22 to 1.225 V in high power mode. Leave its in pm8058_pwrkey_shutdown()
306 * pull-down state intact. This ensures a safe shutdown. in pm8058_pwrkey_shutdown()
312 /* Enable SMPL if resetting is desired */ in pm8058_pwrkey_shutdown()
313 mask = SLEEP_CTRL_SMPL_EN_RESET; in pm8058_pwrkey_shutdown()
316 val = mask; in pm8058_pwrkey_shutdown()
317 return regmap_update_bits(regmap, PM8058_SLEEP_CTRL, mask, val); in pm8058_pwrkey_shutdown()
322 struct regmap *regmap = pwrkey->regmap; in pm8921_pwrkey_shutdown()
323 u8 mask = SLEEP_CTRL_SMPL_EN_RESET; in pm8921_pwrkey_shutdown() local
326 /* Enable SMPL if resetting is desired */ in pm8921_pwrkey_shutdown()
328 val = mask; in pm8921_pwrkey_shutdown()
329 return regmap_update_bits(regmap, PM8921_SLEEP_CTRL, mask, val); in pm8921_pwrkey_shutdown()
345 if (of_property_read_u32(pdev->dev.of_node, "debounce", &kpd_delay)) in pmic8xxx_pwrkey_probe()
350 dev_err(&pdev->dev, "invalid power key trigger delay\n"); in pmic8xxx_pwrkey_probe()
351 return -EINVAL; in pmic8xxx_pwrkey_probe()
354 pull_up = of_property_read_bool(pdev->dev.of_node, "pull-up"); in pmic8xxx_pwrkey_probe()
356 regmap = dev_get_regmap(pdev->dev.parent, NULL); in pmic8xxx_pwrkey_probe()
358 dev_err(&pdev->dev, "failed to locate regmap for the device\n"); in pmic8xxx_pwrkey_probe()
359 return -ENODEV; in pmic8xxx_pwrkey_probe()
362 pwrkey = devm_kzalloc(&pdev->dev, sizeof(*pwrkey), GFP_KERNEL); in pmic8xxx_pwrkey_probe()
364 return -ENOMEM; in pmic8xxx_pwrkey_probe()
366 pwrkey->shutdown_fn = of_device_get_match_data(&pdev->dev); in pmic8xxx_pwrkey_probe()
367 pwrkey->regmap = regmap; in pmic8xxx_pwrkey_probe()
368 pwrkey->key_press_irq = key_press_irq; in pmic8xxx_pwrkey_probe()
370 pwr = devm_input_allocate_device(&pdev->dev); in pmic8xxx_pwrkey_probe()
372 dev_dbg(&pdev->dev, "Can't allocate power button\n"); in pmic8xxx_pwrkey_probe()
373 return -ENOMEM; in pmic8xxx_pwrkey_probe()
378 pwr->name = "pmic8xxx_pwrkey"; in pmic8xxx_pwrkey_probe()
379 pwr->phys = "pmic8xxx_pwrkey/input0"; in pmic8xxx_pwrkey_probe()
386 dev_err(&pdev->dev, "failed reading PON_CNTL_1 err=%d\n", err); in pmic8xxx_pwrkey_probe()
399 dev_err(&pdev->dev, "failed writing PON_CNTL_1 err=%d\n", err); in pmic8xxx_pwrkey_probe()
403 err = devm_request_irq(&pdev->dev, key_press_irq, pwrkey_press_irq, in pmic8xxx_pwrkey_probe()
407 dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n", in pmic8xxx_pwrkey_probe()
412 err = devm_request_irq(&pdev->dev, key_release_irq, pwrkey_release_irq, in pmic8xxx_pwrkey_probe()
416 dev_err(&pdev->dev, "Can't get %d IRQ for pwrkey: %d\n", in pmic8xxx_pwrkey_probe()
423 dev_err(&pdev->dev, "Can't register power key: %d\n", err); in pmic8xxx_pwrkey_probe()
428 device_init_wakeup(&pdev->dev, 1); in pmic8xxx_pwrkey_probe()
434 { .compatible = "qcom,pm8058-pwrkey", .data = &pm8058_pwrkey_shutdown },
435 { .compatible = "qcom,pm8921-pwrkey", .data = &pm8921_pwrkey_shutdown },
444 .name = "pm8xxx-pwrkey",