static int bcmpmu_otg_xceiv_a_invalid_notif_handler(
	struct notifier_block *nb, unsigned long value, void *data)
{
	struct bcmpmu_otg_xceiv_data *xceiv_data =
	    container_of(nb, struct bcmpmu_otg_xceiv_data,
			 bcm_otg_vbus_a_invalid_notifier);
	bool suspend_allowed = false;

	if (!xceiv_data)
		return -EINVAL;

	/* Check if system suspend is allowed */
	bcm_hsotgctrl_is_suspend_allowed(&suspend_allowed);

	if (suspend_allowed) {
		/* Clock must be off. Enable OTG AHB clock */
		bcm_hsotgctrl_en_clock(true);
	}

	/* Inform the core of session invalid level  */
	bcm_hsotgctrl_phy_set_vbus_stat(false);

	/* This triggers shutdown that will turn off the clock */
	atomic_notifier_call_chain(&xceiv_data->otg_xceiver.
				   xceiver.notifier,
				   USB_EVENT_NONE, NULL);

	return 0;
}
static int bcmpmu_otg_xceiv_pm_suspend(struct platform_device *pdev,
                                       pm_message_t state)
{
    int status = 0;
    struct bcmpmu_otg_xceiv_data *xceiv_data = platform_get_drvdata(pdev);
    bool suspend_allowed = false;

    if (bcm_hsotgctrl_is_suspend_allowed(&suspend_allowed)) {
        dev_warn(&pdev->dev,
                 "Failed to check if USB allows sys suspend\n");
    } else {
        if ((suspend_allowed == false) || xceiv_data->otg_enabled) {
            /* Don't allow runtime suspend if USB is active
             * or in OTG mode */
            status = -EBUSY;
        } else {
            /* Allow runtime suspend since USB is not active */
            status = 0;
        }
    }
    return status;
}