static int __exit twl4030_usb_remove(struct platform_device *pdev) { struct twl4030_usb *twl = platform_get_drvdata(pdev); int val; free_irq(twl->irq, twl); device_remove_file(twl->dev, &dev_attr_vbus); /* set transceiver mode to power on defaults */ twl4030_usb_set_mode(twl, -1); /* autogate 60MHz ULPI clock, * clear dpll clock request for i2c access, * disable 32KHz */ val = twl4030_usb_read(twl, PHY_CLK_CTRL); if (val >= 0) { val |= PHY_CLK_CTRL_CLOCKGATING_EN; val &= ~(PHY_CLK_CTRL_CLK32K_EN | REQ_PHY_DPLL_CLK); twl4030_usb_write(twl, PHY_CLK_CTRL, (u8)val); } /* disable complete OTG block */ twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); twl4030_phy_power(twl, 0); regulator_put(twl->usb1v5); regulator_put(twl->usb1v8); regulator_put(twl->usb3v1); kfree(twl); return 0; }
static void __twl4030_phy_power_on(struct twl4030_usb *twl) { twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); }
static void twl4030_phy_resume(struct twl4030_usb *twl) { if (!twl->asleep) return; twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); twl->asleep = 0; }
static int twl4030_phy_power_on(struct phy *phy) { struct twl4030_usb *twl = phy_get_drvdata(phy); dev_dbg(twl->dev, "%s\n", __func__); pm_runtime_get_sync(twl->dev); twl4030_i2c_access(twl, 1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); schedule_delayed_work(&twl->id_workaround_work, 0); return 0; }
static int __init twl4030_usb_init(void) { struct twl4030_usb *twl; int status; if (the_transceiver) return 0; twl = kzalloc(sizeof *twl, GFP_KERNEL); if (!twl) return 0; the_transceiver = twl; twl->irq = TWL4030_PWRIRQ_USB_PRES; twl->otg.set_host = twl4030_set_host; twl->otg.set_peripheral = twl4030_set_peripheral; twl->otg.set_suspend = twl4030_set_suspend; usb_irq_disable(); status = request_irq(twl->irq, twl4030_usb_irq, 0, "twl4030_usb", twl); if (status < 0) { printk(KERN_DEBUG "can't get IRQ %d, err %d\n", twl->irq, status); kfree(twl); return -ENODEV; } #if defined(CONFIG_TWL4030_USB_HS_ULPI) hs_usb_init(twl); #endif twl4030_usb_ldo_init(twl); twl4030_phy_power(twl, 1); twl4030_i2c_access(1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(0); twl->asleep = 0; if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_phy_suspend(1); otg_set_transceiver(&twl->otg); printk(KERN_INFO "Initialized TWL4030 USB module\n"); return 0; }
static void twl4030_phy_resume(struct twl4030_usb *twl) { if (!twl->asleep) return; /* Check the link status before enabling */ if (twl4030_usb_linkstat(twl) == USB_EVENT_NONE) return; twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); twl->asleep = 0; }
static void twl4030_phy_resume(void) { struct twl4030_usb *twl = the_transceiver; if (!twl->asleep) return; /* enable falling edge interrupt to detect cable detach */ usb_irq_enable(0, 1); twl4030_phy_power(twl, 1); twl4030_i2c_access(1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(0); twl->asleep = 0; return; }
static int __exit twl4030_usb_remove(struct platform_device *pdev) { struct twl4030_usb *twl = platform_get_drvdata(pdev); int val; free_irq(twl->irq, twl); device_remove_file(twl->dev, &dev_attr_vbus); /* set transceiver mode to power on defaults */ twl4030_usb_set_mode(twl, -1); /* autogate 60MHz ULPI clock, * clear dpll clock request for i2c access, * disable 32KHz */ val = twl4030_usb_read(twl, PHY_CLK_CTRL); if (val >= 0) { val |= PHY_CLK_CTRL_CLOCKGATING_EN; val &= ~(PHY_CLK_CTRL_CLK32K_EN | REQ_PHY_DPLL_CLK); twl4030_usb_write(twl, PHY_CLK_CTRL, (u8)val); } /* disable complete OTG block */ twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); twl4030_phy_power(twl, 0); regulator_put(twl->usb1v5); regulator_put(twl->usb1v8); #if 0 /* LGE_CHANGE [HEAVEN: [email protected]] on 2009-10-14, for <25.12 USB interrupt fix> */ regulator_put(twl->usb3v1); #endif kfree(twl); #if 1 /* mbk_wake mbk_temp */ // LGE_CHANGE wake lock for usb connection wake_lock_destroy(&the_wlock.wake_lock); // LGE_CHANGE wake lock for usb connection #endif return 0; }
static int twl4030_phy_power_on(struct phy *phy) { struct twl4030_usb *twl = phy_get_drvdata(phy); dev_dbg(twl->dev, "%s\n", __func__); pm_runtime_get_sync(twl->dev); twl4030_i2c_access(twl, 1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); /* * XXX When VBUS gets driven after musb goes to A mode, * ID_PRES related interrupts no longer arrive, why? * Register itself is updated fine though, so we must poll. */ if (twl->linkstat == OMAP_MUSB_ID_GROUND) { cancel_delayed_work(&twl->id_workaround_work); schedule_delayed_work(&twl->id_workaround_work, HZ); } return 0; }
static int twl4030_usb_remove(struct platform_device *pdev) { struct twl4030_usb *twl = platform_get_drvdata(pdev); int val; usb_remove_phy(&twl->phy); pm_runtime_get_sync(twl->dev); cancel_delayed_work(&twl->id_workaround_work); device_remove_file(twl->dev, &dev_attr_vbus); /* set transceiver mode to power on defaults */ twl4030_usb_set_mode(twl, -1); /* idle ulpi before powering off */ if (cable_present(twl->linkstat)) pm_runtime_put_noidle(twl->dev); pm_runtime_mark_last_busy(twl->dev); pm_runtime_put_sync_suspend(twl->dev); pm_runtime_disable(twl->dev); /* autogate 60MHz ULPI clock, * clear dpll clock request for i2c access, * disable 32KHz */ val = twl4030_usb_read(twl, PHY_CLK_CTRL); if (val >= 0) { val |= PHY_CLK_CTRL_CLOCKGATING_EN; val &= ~(PHY_CLK_CTRL_CLK32K_EN | REQ_PHY_DPLL_CLK); twl4030_usb_write(twl, PHY_CLK_CTRL, (u8)val); } /* disable complete OTG block */ twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); return 0; }
static void twl4030_phy_resume(struct twl4030_usb *twl) { int status; // LGE CHANGE jjun.lee, Current Optimization by Prakash TI if (!twl->asleep) { return; } // LGE CHANGE jjun.lee, Current Optimization by Prakash TI /* To check the LINK status before resume.. * check to avoid enabling a LDO's * */ status = twl4030_usb_linkstat(twl); if (status == USB_EVENT_NONE) return; // LGE CHANGE jjun.lee, Current Optimization by Prakash TI twl4030_phy_power(twl, 1); twl4030_i2c_access(twl, 1); twl4030_usb_set_mode(twl, twl->usb_mode); if (twl->usb_mode == T2_USB_MODE_ULPI) twl4030_i2c_access(twl, 0); twl->asleep = 0; }