return 0;
}
-static void tc9563_pwrctrl_power_off(struct tc9563_pwrctrl *tc9563)
+static int tc9563_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl)
{
+ struct tc9563_pwrctrl *tc9563 = container_of(pwrctrl,
+ struct tc9563_pwrctrl, pwrctrl);
+
gpiod_set_value(tc9563->reset_gpio, 1);
regulator_bulk_disable(ARRAY_SIZE(tc9563->supplies), tc9563->supplies);
+
+ return 0;
}
-static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctrl *tc9563)
+static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
{
+ struct tc9563_pwrctrl *tc9563 = container_of(pwrctrl,
+ struct tc9563_pwrctrl, pwrctrl);
struct device *dev = tc9563->pwrctrl.dev;
struct tc9563_pwrctrl_cfg *cfg;
int ret, i;
return 0;
power_off:
- tc9563_pwrctrl_power_off(tc9563);
+ tc9563_pwrctrl_power_off(&tc9563->pwrctrl);
return ret;
}
goto remove_i2c;
}
- ret = tc9563_pwrctrl_bring_up(tc9563);
+ ret = tc9563_pwrctrl_power_on(&tc9563->pwrctrl);
if (ret)
goto remove_i2c;
goto power_off;
}
+ tc9563->pwrctrl.power_on = tc9563_pwrctrl_power_on;
+ tc9563->pwrctrl.power_off = tc9563_pwrctrl_power_off;
+
ret = devm_pci_pwrctrl_device_set_ready(dev, &tc9563->pwrctrl);
if (ret)
goto power_off;
return 0;
power_off:
- tc9563_pwrctrl_power_off(tc9563);
+ tc9563_pwrctrl_power_off(&tc9563->pwrctrl);
remove_i2c:
i2c_unregister_device(tc9563->client);
put_device(&tc9563->adapter->dev);
{
struct tc9563_pwrctrl *tc9563 = platform_get_drvdata(pdev);
- tc9563_pwrctrl_power_off(tc9563);
+ tc9563_pwrctrl_power_off(&tc9563->pwrctrl);
i2c_unregister_device(tc9563->client);
put_device(&tc9563->adapter->dev);
}
slot_pwrctrl_power_on(&slot->pwrctrl);
+ slot->pwrctrl.power_on = slot_pwrctrl_power_on;
+ slot->pwrctrl.power_off = slot_pwrctrl_power_off;
+
pci_pwrctrl_init(&slot->pwrctrl, dev);
ret = devm_pci_pwrctrl_device_set_ready(dev, &slot->pwrctrl);
/**
* struct pci_pwrctrl - PCI device power control context.
* @dev: Address of the power controlling device.
+ * @power_on: Callback to power on the power controlling device.
+ * @power_off: Callback to power off the power controlling device.
*
* An object of this type must be allocated by the PCI power control device and
* passed to the pwrctrl subsystem to trigger a bus rescan and setup a device
*/
struct pci_pwrctrl {
struct device *dev;
+ int (*power_on)(struct pci_pwrctrl *pwrctrl);
+ int (*power_off)(struct pci_pwrctrl *pwrctrl);
/* private: internal use only */
struct notifier_block nb;