Lines Matching +full:powered +full:- +full:on
1 // SPDX-License-Identifier: GPL-2.0
7 * state of the sensor, keeping it on only while userspace holds an open file
31 gpiod_set_value_cansleep(hps->enable_gpio, state); in hps_set_power()
36 struct hps_drvdata *hps = container_of(file->private_data, in hps_open()
38 struct device *dev = &hps->client->dev; in hps_open()
45 struct hps_drvdata *hps = container_of(file->private_data, in hps_release()
47 struct device *dev = &hps->client->dev; in hps_release()
63 hps = devm_kzalloc(&client->dev, sizeof(*hps), GFP_KERNEL); in hps_i2c_probe()
65 return -ENOMEM; in hps_i2c_probe()
67 hps->misc_device.parent = &client->dev; in hps_i2c_probe()
68 hps->misc_device.minor = MISC_DYNAMIC_MINOR; in hps_i2c_probe()
69 hps->misc_device.name = "cros-hps"; in hps_i2c_probe()
70 hps->misc_device.fops = &hps_fops; in hps_i2c_probe()
73 hps->client = client; in hps_i2c_probe()
76 * HPS is powered on from firmware before entering the kernel, so we in hps_i2c_probe()
78 * state. The peripheral is powered off after successful probe below. in hps_i2c_probe()
80 hps->enable_gpio = devm_gpiod_get(&client->dev, "enable", GPIOD_OUT_HIGH); in hps_i2c_probe()
81 if (IS_ERR(hps->enable_gpio)) { in hps_i2c_probe()
82 ret = PTR_ERR(hps->enable_gpio); in hps_i2c_probe()
83 dev_err(&client->dev, "failed to get enable gpio: %d\n", ret); in hps_i2c_probe()
87 ret = misc_register(&hps->misc_device); in hps_i2c_probe()
89 dev_err(&client->dev, "failed to initialize misc device: %d\n", ret); in hps_i2c_probe()
94 pm_runtime_enable(&client->dev); in hps_i2c_probe()
102 pm_runtime_disable(&client->dev); in hps_i2c_remove()
103 misc_deregister(&hps->misc_device); in hps_i2c_remove()
106 * Re-enable HPS, in order to return it to its default state in hps_i2c_remove()
107 * (i.e. powered on). in hps_i2c_remove()
132 { "cros-hps", 0 },
150 .name = "cros-hps",