Lines Matching +full:powered +full:- +full:on
1 // SPDX-License-Identifier: GPL-2.0
31 bool powered_off; /* ODD is powered off
85 if (be16_to_cpu(desc->feature_code) != 3) { in zpodd_get_mech_type()
90 if (desc->mech_type == 0 && desc->load == 0 && desc->eject == 1) { in zpodd_get_mech_type()
93 } else if (desc->mech_type == 1 && desc->load == 0 && in zpodd_get_mech_type()
94 desc->eject == 1) { in zpodd_get_mech_type()
108 struct zpodd *zpodd = dev->zpodd; in zpready()
115 sense_buf = dev->sector_buf; in zpready()
132 if (zpodd->mech_type == ODD_MECH_TYPE_SLOT) in zpready()
141 * Update the zpodd->zp_ready field. This field will only be set
144 * is set, it will be cleared during resume from powered off state.
148 struct zpodd *zpodd = dev->zpodd; in zpodd_on_suspend()
152 zpodd->zp_sampled = false; in zpodd_on_suspend()
153 zpodd->zp_ready = false; in zpodd_on_suspend()
157 if (!zpodd->zp_sampled) { in zpodd_on_suspend()
158 zpodd->zp_sampled = true; in zpodd_on_suspend()
159 zpodd->last_ready = jiffies; in zpodd_on_suspend()
163 expires = zpodd->last_ready + in zpodd_on_suspend()
168 zpodd->zp_ready = true; in zpodd_on_suspend()
173 struct zpodd *zpodd = dev->zpodd; in zpodd_zpready()
174 return zpodd->zp_ready; in zpodd_zpready()
187 struct zpodd *zpodd = dev->zpodd; in zpodd_enable_run_wake()
189 sdev_disable_disk_events(dev->sdev); in zpodd_enable_run_wake()
191 zpodd->powered_off = true; in zpodd_enable_run_wake()
192 acpi_pm_set_device_wakeup(&dev->tdev, true); in zpodd_enable_run_wake()
198 struct zpodd *zpodd = dev->zpodd; in zpodd_disable_run_wake()
200 if (zpodd->powered_off) in zpodd_disable_run_wake()
201 acpi_pm_set_device_wakeup(&dev->tdev, false); in zpodd_disable_run_wake()
205 * Post power on processing after the ODD has been recovered. If the
206 * ODD wasn't powered off during suspend, it doesn't do anything.
208 * For drawer type ODD, if it is powered on due to user pressed the
215 * zpodd_wake_dev represents if power on is due to user's action.
221 struct zpodd *zpodd = dev->zpodd; in zpodd_post_poweron()
223 if (!zpodd->powered_off) in zpodd_post_poweron()
226 zpodd->powered_off = false; in zpodd_post_poweron()
228 if (zpodd->from_notify) { in zpodd_post_poweron()
229 zpodd->from_notify = false; in zpodd_post_poweron()
230 if (zpodd->mech_type == ODD_MECH_TYPE_DRAWER) in zpodd_post_poweron()
234 zpodd->zp_sampled = false; in zpodd_post_poweron()
235 zpodd->zp_ready = false; in zpodd_post_poweron()
237 sdev_enable_disk_events(dev->sdev); in zpodd_post_poweron()
243 struct zpodd *zpodd = ata_dev->zpodd; in zpodd_wake_dev()
244 struct device *dev = &ata_dev->sdev->sdev_gendev; in zpodd_wake_dev()
247 zpodd->from_notify = true; in zpodd_wake_dev()
267 struct acpi_device *adev = ACPI_COMPANION(&dev->tdev); in zpodd_init()
271 if (dev->zpodd || !adev || !acpi_device_can_poweroff(adev)) in zpodd_init()
282 zpodd->mech_type = mech_type; in zpodd_init()
285 zpodd->dev = dev; in zpodd_init()
286 dev->zpodd = zpodd; in zpodd_init()
287 dev_pm_qos_expose_flags(&dev->tdev, 0); in zpodd_init()
293 kfree(dev->zpodd); in zpodd_exit()
294 dev->zpodd = NULL; in zpodd_exit()