本文整理汇总了C++中otg_get_transceiver函数的典型用法代码示例。如果您正苦于以下问题:C++ otg_get_transceiver函数的具体用法?C++ otg_get_transceiver怎么用?C++ otg_get_transceiver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了otg_get_transceiver函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: musb_platform_init
int __init musb_platform_init(struct musb *musb)
{
struct otg_transceiver *x = otg_get_transceiver();
u32 l;
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
#endif
/* Reset controller */
if (musb->set_clock)
musb->set_clock(musb->clock, 1);
else
clk_enable(musb->clock);
l = omap_readl(OTG_SYSCONFIG);
l |= SOFTRST;
omap_writel(l, OTG_SYSCONFIG);
while (!(RESETDONE & omap_readl(OTG_SYSSTATUS)))
cpu_relax();
musb->xceiv = *x;
musb_platform_resume(musb);
l = omap_readl(OTG_SYSCONFIG);
l &= ~ENABLEWAKEUP; /* disable wakeup */
l &= ~NOSTDBY; /* remove possible nostdby */
l |= SMARTSTDBY; /* enable smart standby */
l &= ~AUTOIDLE; /* disable auto idle */
l &= ~NOIDLE; /* remove possible noidle */
l |= SMARTIDLE; /* enable smart idle */
/*
* MUSB AUTOIDLE don't work in 3430.
* Workaround by Richard Woodruff/TI
*/
if (!cpu_is_omap3430())
l |= AUTOIDLE; /* enable auto idle */
omap_writel(l, OTG_SYSCONFIG);
l = omap_readl(OTG_INTERFSEL);
l |= ULPI_12PIN;
omap_writel(l, OTG_INTERFSEL);
pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
"sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
omap_readl(OTG_REVISION), omap_readl(OTG_SYSCONFIG),
omap_readl(OTG_SYSSTATUS), omap_readl(OTG_INTERFSEL),
omap_readl(OTG_SIMENABLE));
omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
if (!musb->xceiv.set_power && is_peripheral_enabled(musb))
musb->xceiv.set_power = omap_set_power;
musb->a_wait_bcon = MUSB_TIMEOUT_A_WAIT_BCON;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
return 0;
}
开发者ID:macroliu,项目名称:I8320Kernel,代码行数:60,代码来源:omap2430.c
示例2: otg_wakelock_init
static int __init otg_wakelock_init(void)
{
int ret;
otgwl_xceiv = otg_get_transceiver();
if (!otgwl_xceiv) {
pr_err("%s: No OTG transceiver found\n", __func__);
return -ENODEV;
}
snprintf(vbus_lock.name, sizeof(vbus_lock.name), "vbus-%s",
dev_name(otgwl_xceiv->dev));
wake_lock_init(&vbus_lock.wakelock, WAKE_LOCK_SUSPEND,
vbus_lock.name);
otgwl_nb.notifier_call = otgwl_otg_notifications;
ret = otg_register_notifier(otgwl_xceiv, &otgwl_nb);
if (ret) {
pr_err("%s: otg_register_notifier on transceiver %s"
" failed\n", __func__,
dev_name(otgwl_xceiv->dev));
otgwl_xceiv = NULL;
wake_lock_destroy(&vbus_lock.wakelock);
return ret;
}
otgwl_handle_event(otgwl_xceiv->last_event);
return ret;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:31,代码来源:otg-wakelock.c
示例3: omap4430_phy_init_for_eyediagram
static void omap4430_phy_init_for_eyediagram(u32 swcap_trim_offset)
{
u32 read_val = 0;
u32 swcap_trim = 0;
transceiver = otg_get_transceiver();
/* If clock is disabled, enable clock */
if (!otg_is_active(transceiver))
otg_set_suspend(transceiver, 0);
ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1M);
if (__raw_readl(ctrl_base + OCP2SCP_TIMING_OFFSET) != 0x0000000F)
__raw_writel(0x00000000F, ctrl_base + OCP2SCP_TIMING_OFFSET);
read_val = __raw_readl(ctrl_base + USB2PHYCM_TRIM_OFFSET);
swcap_trim = (read_val & 0x00007F00) >> 8;
/* 0x4E(default) + 0x22(SWCAP_TRIM_OFFSET) = 0xF0*/
if (swcap_trim != (0x4E + swcap_trim_offset)) {
swcap_trim = 0x4E + swcap_trim_offset;
read_val &= ~0x00007F00;
read_val |= swcap_trim << 8;
read_val |= 0x00008000; /* USE_SW_TRIM = 1 */
__raw_writel(read_val, ctrl_base + USB2PHYCM_TRIM_OFFSET);
}
#ifndef CONFIG_USB_SWITCH_FSA9480
iounmap(ctrl_base);
#endif /* CONFIG_USB_SWITCH_FSA9480 */
}
开发者ID:demonking,项目名称:Dhollmen_Kernel,代码行数:32,代码来源:omap_phy_tune.c
示例4: musb_platform_init
int __init musb_platform_init(struct musb *musb, void *board_data)
{
u32 l;
struct omap_musb_board_data *data = board_data;
/* We require some kind of external transceiver, hooked
* up through ULPI. TWL4030-family PMICs include one,
* which needs a driver, drivers aren't always needed.
*/
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
}
musb_platform_resume(musb);
l = musb_readl(musb->mregs, OTG_SYSCONFIG);
l &= ~ENABLEWAKEUP; /* disable wakeup */
l &= ~NOSTDBY; /* remove possible nostdby */
l |= SMARTSTDBY; /* enable smart standby */
l &= ~AUTOIDLE; /* disable auto idle */
l &= ~NOIDLE; /* remove possible noidle */
l |= SMARTIDLE; /* enable smart idle */
/*
* MUSB AUTOIDLE don't work in 3430.
* Workaround by Richard Woodruff/TI
*/
if (!cpu_is_omap3430())
l |= AUTOIDLE; /* enable auto idle */
musb_writel(musb->mregs, OTG_SYSCONFIG, l);
l = musb_readl(musb->mregs, OTG_INTERFSEL);
if (data->interface_type == MUSB_INTERFACE_UTMI) {
/* OMAP4 uses Internal PHY GS70 which uses UTMI interface */
l &= ~ULPI_12PIN; /* Disable ULPI */
l |= UTMI_8BIT; /* Enable UTMI */
} else {
l |= ULPI_12PIN;
}
musb_writel(musb->mregs, OTG_INTERFSEL, l);
pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
"sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
musb_readl(musb->mregs, OTG_REVISION),
musb_readl(musb->mregs, OTG_SYSCONFIG),
musb_readl(musb->mregs, OTG_SYSSTATUS),
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
return 0;
}
开发者ID:radekp,项目名称:android-n900-nitdroid_kernel,代码行数:59,代码来源:omap2430.c
示例5: omap2430_musb_init
static int omap2430_musb_init(struct musb *musb)
{
u32 l;
int status = 0;
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *plat = dev->platform_data;
struct omap_musb_board_data *data = plat->board_data;
/* We require some kind of external transceiver, hooked
* up through ULPI. TWL4030-family PMICs include one,
* which needs a driver, drivers aren't always needed.
*/
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
}
INIT_WORK(&musb->otg_notifier_work, musb_otg_notifier_work);
status = pm_runtime_get_sync(dev);
if (status < 0) {
dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
goto err1;
}
l = musb_readl(musb->mregs, OTG_INTERFSEL);
if (data->interface_type == MUSB_INTERFACE_UTMI) {
/* OMAP4 uses Internal PHY GS70 which uses UTMI interface */
l &= ~ULPI_12PIN; /* Disable ULPI */
l |= UTMI_8BIT; /* Enable UTMI */
} else {
l |= ULPI_12PIN;
}
musb_writel(musb->mregs, OTG_INTERFSEL, l);
pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
"sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
musb_readl(musb->mregs, OTG_REVISION),
musb_readl(musb->mregs, OTG_SYSCONFIG),
musb_readl(musb->mregs, OTG_SYSSTATUS),
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
musb->nb.notifier_call = musb_otg_notifications;
status = otg_register_notifier(musb->xceiv, &musb->nb);
if (status)
dev_dbg(musb->controller, "notification register failed\n");
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
return 0;
err1:
return status;
}
开发者ID:OneOfMany07,项目名称:fjord-kernel,代码行数:59,代码来源:omap2430.c
示例6: musb_platform_init
int __init musb_platform_init(struct musb *musb)
{
struct otg_transceiver *x = otg_get_transceiver();
u32 l;
u8 val;
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
#endif
if (!x) {
pr_err("omap: musb: null transceiver found\n");
return -ENODEV;
}
musb->xceiv = *x;
musb_platform_resume(musb);
l = omap_readl(OTG_SYSCONFIG);
l &= ~ENABLEWAKEUP; /* disable wakeup */
l &= ~NOSTDBY; /* remove possible nostdby */
l |= SMARTSTDBY; /* enable smart standby */
l &= ~AUTOIDLE; /* disable auto idle */
l &= ~NOIDLE; /* remove possible noidle */
l |= SMARTIDLE; /* enable smart idle */
l |= AUTOIDLE; /* enable auto idle */
omap_writel(l, OTG_SYSCONFIG);
l = omap_readl(OTG_INTERFSEL);
l |= ULPI_12PIN;
omap_writel(l, OTG_INTERFSEL);
#ifdef CONFIG_MACH_OMAP3EVM
/* Program PHY to use external Vbus supply on new OMAP3EVM */
if (get_omap3evm_board_rev() >= OMAP3EVM_BOARD_GEN_2) {
val = musb_readb(musb->mregs, MUSB_ULPI_BUSCONTROL);
val |= ULPI_USE_EXTVBUS;
musb_writeb(musb->mregs, MUSB_ULPI_BUSCONTROL, val);
}
#endif
pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
"sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
omap_readl(OTG_REVISION), omap_readl(OTG_SYSCONFIG),
omap_readl(OTG_SYSSTATUS), omap_readl(OTG_INTERFSEL),
omap_readl(OTG_SIMENABLE));
omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
if (is_peripheral_enabled(musb))
musb->xceiv.set_power = omap_set_power;
musb->a_wait_bcon = MUSB_TIMEOUT_A_WAIT_BCON;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
return 0;
}
开发者ID:percy-g2,项目名称:rowboat-kernel,代码行数:58,代码来源:omap2430.c
示例7: musb_platform_init
int __init musb_platform_init(struct musb *musb)
{
u32 l;
#if defined(CONFIG_ARCH_OMAP2430)
omap_cfg_reg(AE5_2430_USB0HS_STP);
#endif
/* We require some kind of external transceiver, hooked
* up through ULPI. TWL4030-family PMICs include one,
* which needs a driver, drivers aren't always needed.
*/
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
}
musb_platform_resume(musb);
l = musb_readl(musb->mregs, OTG_SYSCONFIG);
l &= ~ENABLEWAKEUP; /* disable wakeup */
l &= ~NOSTDBY; /* remove possible nostdby */
l |= SMARTSTDBY; /* enable smart standby */
l &= ~AUTOIDLE; /* disable auto idle */
l &= ~NOIDLE; /* remove possible noidle */
l |= SMARTIDLE; /* enable smart idle */
/*
* MUSB AUTOIDLE don't work in 3430.
* Workaround by Richard Woodruff/TI
*/
if (!cpu_is_omap3430())
l |= AUTOIDLE; /* enable auto idle */
musb_writel(musb->mregs, OTG_SYSCONFIG, l);
l = musb_readl(musb->mregs, OTG_INTERFSEL);
l |= ULPI_12PIN;
musb_writel(musb->mregs, OTG_INTERFSEL, l);
pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
"sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
musb_readl(musb->mregs, OTG_REVISION),
musb_readl(musb->mregs, OTG_SYSCONFIG),
musb_readl(musb->mregs, OTG_SYSSTATUS),
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
if (is_host_enabled(musb))
musb->board_set_vbus = omap_set_vbus;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
return 0;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:56,代码来源:omap2430.c
示例8: isp1704_charger_probe
static int __devinit isp1704_charger_probe(struct platform_device *pdev)
{
struct isp1704_charger *isp;
int ret = -ENODEV;
isp = kzalloc(sizeof *isp, GFP_KERNEL);
if (!isp)
return -ENOMEM;
isp->otg = otg_get_transceiver();
if (!isp->otg)
goto fail0;
ret = isp1704_test_ulpi(isp);
if (ret < 0)
goto fail1;
isp->dev = &pdev->dev;
platform_set_drvdata(pdev, isp);
isp->psy.name = "isp1704";
isp->psy.type = POWER_SUPPLY_TYPE_USB;
isp->psy.properties = power_props;
isp->psy.num_properties = ARRAY_SIZE(power_props);
isp->psy.get_property = isp1704_charger_get_property;
ret = power_supply_register(isp->dev, &isp->psy);
if (ret)
goto fail1;
/*
* REVISIT: using work in order to allow the otg notifications to be
* made atomically in the future.
*/
INIT_WORK(&isp->work, isp1704_charger_work);
isp->nb.notifier_call = isp1704_notifier_call;
ret = otg_register_notifier(isp->otg, &isp->nb);
if (ret)
goto fail2;
dev_info(isp->dev, "registered with product id %s\n", isp->model);
return 0;
fail2:
power_supply_unregister(&isp->psy);
fail1:
otg_put_transceiver(isp->otg);
fail0:
kfree(isp);
dev_err(&pdev->dev, "failed to register isp1704 with error %d\n", ret);
return ret;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:56,代码来源:isp1704_charger.c
示例9: ux500_musb_init
static int ux500_musb_init(struct musb *musb)
{
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
}
return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:10,代码来源:ux500.c
示例10: otg_send_event
int otg_send_event(enum usb_otg_event event)
{
struct otg_transceiver *otg = otg_get_transceiver();
int ret = -ENOTSUPP;
if (otg && otg->send_event)
ret = otg->send_event(otg, event);
if (otg)
otg_put_transceiver(otg);
return ret;
}
开发者ID:AmeriCanAndroid,项目名称:aca-evo3d-gsm-omega-3.0-mdj,代码行数:13,代码来源:otg.c
示例11: am35x_musb_init
static int am35x_musb_init(struct musb *musb)
{
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *plat = dev->platform_data;
struct omap_musb_board_data *data = plat->board_data;
void __iomem *reg_base = musb->ctrl_base;
u32 rev;
musb->mregs += USB_MENTOR_CORE_OFFSET;
/* Returns zero if e.g. not clocked */
rev = musb_readl(reg_base, USB_REVISION_REG);
if (!rev)
return -ENODEV;
usb_nop_xceiv_register();
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv)
return -ENODEV;
if (is_host_enabled(musb))
setup_timer(&otg_workaround, otg_timer, (unsigned long) musb);
/* Reset the musb */
if (data->reset)
data->reset();
/* Reset the controller */
musb_writel(reg_base, USB_CTRL_REG, AM35X_SOFT_RESET_MASK);
/* Start the on-chip PHY and its PLL. */
if (data->set_phy_power)
data->set_phy_power(1);
msleep(5);
musb->isr = am35x_musb_interrupt;
/* clear level interrupt */
if (data->clear_irq)
data->clear_irq();
return 0;
}
开发者ID:pradeep2481,项目名称:pia-linux-kernel,代码行数:44,代码来源:am35x.c
示例12: musb_platform_init
int __init musb_platform_init(struct musb *musb)
{
struct otg_transceiver *xceiv;
xceiv = kzalloc(sizeof(struct otg_transceiver), GFP_KERNEL);
if (!xceiv)
return -ENOMEM;
xceiv->set_peripheral = sep0611_set_peripheral;
otg_set_transceiver(xceiv);
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
return -ENODEV;
}
musb_platform_resume(musb);
if (is_host_enabled(musb))
musb->xceiv->set_host = sep0611_set_host;
musb->board_set_vbus = sep0611_set_vbus;
if (is_peripheral_enabled(musb))
musb->xceiv->set_power = sep0611_set_power;
musb->a_wait_bcon = MUSB_TIMEOUT_A_WAIT_BCON;
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
musb_writew(musb->mregs, RX_DPKTBUFDIS, 0xffff); /* disable RX double packet buffer */
musb_writew(musb->mregs, TX_DPKTBUFDIS, 0xffff); /* disable TX double packet buffer */
#ifdef SEP0611_ULPI_RST
/*spdw_board has two usb ports,one is otg(port_index=0), the other is host(port_index=1),default is otg port*/
musb->port_index = 0;
#endif
#ifdef SEP0611_PHY_RST
/*demo_board has two usb ports*/
musb->port_index = 0;
#endif
return 0;
}
开发者ID:sunjiangbo,项目名称:hiveboard_linux_with_sonix291_uvcdriver,代码行数:42,代码来源:sep0611_usb_phy3315.c
示例13: musb_platform_init
int __init musb_platform_init(struct musb *musb)
{
usb_nop_xceiv_register();
/* We require some kind of external transceiver, hooked
* up through ULPI. TWL4030-family PMICs include one,
* which needs a driver, drivers aren't always needed.
*/
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
}
m2s_usb_platform_resume(musb);
m2s_usb_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
if (is_host_enabled(musb))
musb->board_set_vbus = m2s_usb_vbus_set;
return 0;
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:23,代码来源:m2s.c
示例14: bq2416x_charger_probe
//.........这里部分代码省略.........
#if 0
bq2415x_config_safety_reg(di, pdata->max_charger_currentmA,
pdata->max_charger_voltagemV);
di->cin_limit = 900;
di->term_currentmA = pdata->termination_currentmA;
bq2415x_config_control_reg(di);
bq2415x_config_voltage_reg(di);
bq2415x_config_current_reg(di);
#endif
/*set gpio_174 to control CD pin to disable/enable bq24161 IC*/
gpio_request(BQ2416X_GPIO_174, "gpio_174_cd");
/* set charger CD pin to low level and enable it to supply power normally*/
gpio_direction_output(BQ2416X_GPIO_174, 0);
ret = bq2416x_get_max_charge_voltage(di);
if(!ret){
di->max_voltagemV = pdata->max_charger_voltagemV;
}
di->voltagemV = di->max_voltagemV;
ret = bq2416x_get_max_charge_current(di);
if(!ret){
di->max_currentmA = pdata->max_charger_currentmA;
}
di->currentmA = CURRENT_USB_CHARGE_IN ;
di->term_currentmA = CURRENT_TERM_CHARGE_IN;
di->dppm_voltagemV = VOLT_DPPM_ADJUST;
di->cin_limit = CURRENT_USB_LIMIT_IN;
di->enable_hotcold_temp_charge = set_one;
di->enable_low_chg = DISABLE_LOW_CHG;/*set normally charge mode*/
di->enable_iterm = ENABLE_ITERM; /*enable charge current termination*/
di->factory_flag = 0;
di->enable_ce = ENABLE_CE;
di->hz_mode = 0;
di->cd_active = 0;
INIT_DELAYED_WORK_DEFERRABLE(&di->bq2416x_charger_work,
bq2416x_charger_work);
#if BQ2416X_USE_WAKE_LOCK
wake_lock_init(&di->charger_wake_lock, WAKE_LOCK_SUSPEND, "charger_wake_lock");
#endif
//BLOCKING_INIT_NOTIFIER_HEAD(¬ifier_list);
di->active = 0;
di->params.enable = 1;
di->cfg_params = 1;
bq2416x_config_control_reg(di);
bq2416x_config_voltage_reg(di);
bq2416x_config_current_reg(di);
bq2416x_config_dppm_voltage_reg(di,di->dppm_voltagemV);
bq2416x_config_safety_reg(di);
#if 0
ret = bq2416x_read_byte(di, &read_reg, REG_SPECIAL_CHARGER_VOLTAGE);
if (!(read_reg & 0x08)) {
di->active = 1;
schedule_delayed_work(&di->bq2415x_charger_work, 0);
}
#endif
ret = sysfs_create_group(&client->dev.kobj, &bq2416x_attr_group);
if (ret)
dev_dbg(&client->dev, "could not create sysfs files\n");
//twl6030_register_notifier(&di->nb, 1);
INIT_WORK(&di->usb_work, bq2416x_usb_charger_work);
//r00186667, 2011/08/02, otg register for receive USB/AC plugin event.begin
di->nb_otg.notifier_call = bq2416x_usb_notifier_call;
di->otg = otg_get_transceiver();
ret = otg_register_notifier(di->otg, &di->nb_otg);
if (ret)
dev_err(&client->dev, "otg register notifier failed %d\n", ret);
//r00186667, 2011/08/02, otg register for receive USB/AC plugin event.end
//r00186667, 2011/08/02, get the boot event type.begin
plugin_stat = get_plugin_device_status();
if( PLUGIN_USB_CHARGER == plugin_stat){
di->event = USB_EVENT_VBUS;
}else if (PLUGIN_AC_CHARGER == plugin_stat){
di->event = USB_EVENT_CHARGER;
}else{
di->event = USB_EVENT_NONE;
}
schedule_work(&di->usb_work);
//r00186667, 2011/08/02, get the boot event type.end
return 0;
err_kfree:
kfree(di);
return ret;
}
开发者ID:manusreload,项目名称:android_kernel_huawei_omap4,代码行数:101,代码来源:bq2416x_charger.c
示例15: pda_power_probe
static int pda_power_probe(struct platform_device *pdev)
{
int ret = 0;
dev = &pdev->dev;
if (pdev->id != -1) {
dev_err(dev, "it's meaningless to register several "
"pda_powers; use id = -1\n");
ret = -EINVAL;
goto wrongid;
}
pdata = pdev->dev.platform_data;
if (pdata->init) {
ret = pdata->init(dev);
if (ret < 0)
goto init_failed;
}
update_status();
if (!pdata->wait_for_status)
pdata->wait_for_status = 500;
if (!pdata->wait_for_charger)
pdata->wait_for_charger = 500;
if (!pdata->polling_interval)
pdata->polling_interval = 2000;
if (!pdata->ac_max_uA)
pdata->ac_max_uA = 500000;
setup_timer(&charger_timer, charger_timer_func, 0);
ac_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ac");
usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb");
if (pdata->supplied_to) {
pda_psy_ac.supplied_to = pdata->supplied_to;
pda_psy_ac.num_supplicants = pdata->num_supplicants;
pda_psy_usb.supplied_to = pdata->supplied_to;
pda_psy_usb.num_supplicants = pdata->num_supplicants;
}
ac_draw = regulator_get(dev, "ac_draw");
if (IS_ERR(ac_draw)) {
dev_dbg(dev, "couldn't get ac_draw regulator\n");
ac_draw = NULL;
ret = PTR_ERR(ac_draw);
}
transceiver = otg_get_transceiver();
if (transceiver && !pdata->is_usb_online) {
pdata->is_usb_online = otg_is_usb_online;
}
if (transceiver && !pdata->is_ac_online) {
pdata->is_ac_online = otg_is_ac_online;
}
if (pdata->is_ac_online) {
ret = power_supply_register(&pdev->dev, &pda_psy_ac);
if (ret) {
dev_err(dev, "failed to register %s power supply\n",
pda_psy_ac.name);
goto ac_supply_failed;
}
if (ac_irq) {
ret = request_irq(ac_irq->start, power_changed_isr,
get_irq_flags(ac_irq), ac_irq->name,
&pda_psy_ac);
if (ret) {
dev_err(dev, "request ac irq failed\n");
goto ac_irq_failed;
}
} else {
polling = 1;
}
}
if (pdata->is_usb_online) {
ret = power_supply_register(&pdev->dev, &pda_psy_usb);
if (ret) {
dev_err(dev, "failed to register %s power supply\n",
pda_psy_usb.name);
goto usb_supply_failed;
}
if (usb_irq) {
ret = request_irq(usb_irq->start, power_changed_isr,
get_irq_flags(usb_irq),
usb_irq->name, &pda_psy_usb);
if (ret) {
dev_err(dev, "request usb irq failed\n");
goto usb_irq_failed;
}
} else {
//.........这里部分代码省略.........
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:101,代码来源:pda_power.c
示例16: ohci_omap_init
static int ohci_omap_init(struct usb_hcd *hcd)
{
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
struct omap_usb_config *config = hcd->self.controller->platform_data;
int need_transceiver = (config->otg != 0);
int ret;
dev_dbg(hcd->self.controller, "starting USB Controller\n");
if (config->otg) {
ohci_to_hcd(ohci)->self.otg_port = config->otg;
/* default/minimum OTG power budget: 8 mA */
ohci_to_hcd(ohci)->power_budget = 8;
}
/* boards can use OTG transceivers in non-OTG modes */
need_transceiver = need_transceiver
|| machine_is_omap_h2() || machine_is_omap_h3();
if (cpu_is_omap16xx())
ocpi_enable();
#ifdef CONFIG_ARCH_OMAP_OTG
if (need_transceiver) {
ohci->transceiver = otg_get_transceiver();
if (ohci->transceiver) {
int status = otg_set_host(ohci->transceiver,
&ohci_to_hcd(ohci)->self);
dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n",
ohci->transceiver->label, status);
if (status) {
if (ohci->transceiver)
put_device(ohci->transceiver->dev);
return status;
}
} else {
dev_err(hcd->self.controller, "can't find transceiver\n");
return -ENODEV;
}
}
#endif
omap_ohci_clock_power(1);
if (cpu_is_omap1510()) {
omap_1510_local_bus_power(1);
omap_1510_local_bus_init();
}
if ((ret = ohci_init(ohci)) < 0)
return ret;
/* board-specific power switching and overcurrent support */
if (machine_is_omap_osk() || machine_is_omap_innovator()) {
u32 rh = roothub_a (ohci);
/* power switching (ganged by default) */
rh &= ~RH_A_NPS;
/* TPS2045 switch for internal transceiver (port 1) */
if (machine_is_omap_osk()) {
ohci_to_hcd(ohci)->power_budget = 250;
rh &= ~RH_A_NOCP;
/* gpio9 for overcurrent detction */
omap_cfg_reg(W8_1610_GPIO9);
omap_request_gpio(9);
omap_set_gpio_direction(9, 1 /* IN */);
/* for paranoia's sake: disable USB.PUEN */
omap_cfg_reg(W4_USB_HIGHZ);
}
ohci_writel(ohci, rh, &ohci->regs->roothub.a);
distrust_firmware = 0;
} else if (machine_is_nokia770()) {
/* We require a self-powered hub, which should have
* plenty of power. */
ohci_to_hcd(ohci)->power_budget = 0;
}
/* FIXME khubd hub requests should manage power switching */
omap_ohci_transceiver_power(1);
/* board init will have already handled HMC and mux setup.
* any external transceiver should already be initialized
* too, so all configured ports use the right signaling now.
*/
return 0;
}
开发者ID:maraz,项目名称:linux-2.6,代码行数:91,代码来源:ohci-omap.c
示例17: omap2430_musb_init
static int omap2430_musb_init(struct musb *musb)
{
u32 l, status = 0;
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *plat = dev->platform_data;
struct omap_musb_board_data *data = plat->board_data;
/* We require some kind of external transceiver, hooked
* up through ULPI. TWL4030-family PMICs include one,
* which needs a driver, drivers aren't always needed.
*/
musb->xceiv = otg_get_transceiver();
if (!musb->xceiv) {
pr_err("HS USB OTG: no transceiver configured\n");
return -ENODEV;
}
omap2430_low_level_init(musb);
l = musb_readl(musb->mregs, OTG_SYSCONFIG);
l &= ~ENABLEWAKEUP; /* disable wakeup */
l &= ~NOSTDBY; /* remove possible nostdby */
l |= SMARTSTDBY; /* enable smart standby */
l &= ~AUTOIDLE; /* disable auto idle */
l &= ~NOIDLE; /* remove possible noidle */
l |= SMARTIDLE; /* enable smart idle */
/*
* MUSB AUTOIDLE don't work in 3430.
* Workaround by Richard Woodruff/TI
*/
if (!cpu_is_omap3430())
l |= AUTOIDLE; /* enable auto idle */
musb_writel(musb->mregs, OTG_SYSCONFIG, l);
l = musb_readl(musb->mregs, OTG_INTERFSEL);
if (data->interface_type == MUSB_INTERFACE_UTMI) {
/* OMAP4 uses Internal PHY GS70 which uses UTMI interface */
l &= ~ULPI_12PIN; /* Disable ULPI */
l |= UTMI_8BIT; /* Enable UTMI */
} else {
l |= ULPI_12PIN;
}
musb_writel(musb->mregs, OTG_INTERFSEL, l);
pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
"sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
musb_readl(musb->mregs, OTG_REVISION),
musb_readl(musb->mregs, OTG_SYSCONFIG),
musb_readl(musb->mregs, OTG_SYSSTATUS),
musb_readl(musb->mregs, OTG_INTERFSEL),
musb_readl(musb->mregs, OTG_SIMENABLE));
musb->nb.notifier_call = musb_otg_notifications;
status = otg_register_notifier(musb->xceiv, &musb->nb);
if (status)
DBG(1, "notification register failed\n");
/* check whether cable is already connected */
if (musb->xceiv->state ==OTG_STATE_B_IDLE)
musb_otg_notifications(&musb->nb, 1,
musb->xceiv->gadget);
setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
return 0;
}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:69,代码来源:omap2430.c
示例18: usb_hcd_fsl_probe
//.........这里部分代码省略.........
if (!res) {
dev_err(&pdev->dev,
"Found HC with no IRQ. Check %s setup!\n",
pdev->dev.bus_id);
return -ENODEV;
}
irq = res->start;
if (pdata->set_vbus_power)
pdata->set_vbus_power(1);
hcd = usb_create_hcd(driver, &pdev->dev, pdev->dev.bus_id);
if (!hcd) {
retval = -ENOMEM;
goto err1;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev,
"Found HC with no register addr. Check %s setup!\n",
pdev->dev.bus_id);
retval = -ENODEV;
goto err2;
}
hcd->rsrc_start = res->start;
hcd->rsrc_len = res->end - res->start + 1;
vdbg("start=0x%x end=0x%x rsrc_start=0x%llx rsrc_len=0x%llx\n",
res->start, res->end, hcd->rsrc_start, hcd->rsrc_len);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len,
driver->description)) {
dev_dbg(&pdev->dev, "request_mem_region failed\n");
retval = -EBUSY;
goto err2;
}
hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
if (hcd->regs == NULL) {
dev_dbg(&pdev->dev, "error mapping memory\n");
retval = -EFAULT;
goto err3;
}
hcd->power_budget = pdata->power_budget;
/* DDD
* the following must be done by this point, otherwise the OTG
* host port doesn't make it thru initializtion.
* ehci_halt(), called by ehci_fsl_setup() returns -ETIMEDOUT
*/
fsl_platform_set_host_mode(hcd);
retval = usb_add_hcd(hcd, irq, SA_SHIRQ);
if (retval != 0)
goto err4;
#if defined(CONFIG_USB_OTG)
if (pdata->does_otg) {
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
dbg("pdev=0x%p hcd=0x%p ehci=0x%p\n", pdev, hcd, ehci);
ehci->transceiver = otg_get_transceiver();
dbg("ehci->transceiver=0x%p\n", ehci->transceiver);
if (ehci->transceiver) {
retval = otg_set_host(ehci->transceiver,
&ehci_to_hcd(ehci)->self);
dev_dbg(ehci->transceiver->dev,
"init %s transceiver, retval %d\n",
ehci->transceiver->label, retval);
if (retval) {
if (ehci->transceiver)
put_device(ehci->transceiver->dev);
goto err3;
}
} else {
printk(KERN_ERR "can't find transceiver\n");
retval = -ENODEV;
goto err3;
}
}
#endif
return retval;
err4:
iounmap(hcd->regs);
err3:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err2:
usb_put_hcd(hcd);
err1:
dev_err(&pdev->dev, "init %s fail, %d\n", pdev->dev.bus_id, retval);
if (pdata->platform_uninit)
pdata->platform_uninit();
return retval;
}
开发者ID:jhlxz2003,项目名称:mx27_drv,代码行数:101,代码来源:ehci-arc.c
示例19: max8903_charger_probe
//.........这里部分代码省略.........
gpio_direction_output(mc->max8903_gpio_chg_iusb, CHG_IUSB_SELECT_500mA);
/*USUS control*/
if (gpio_request(mc->max8903_gpio_chg_usus, MAX8903_TOKEN_GPIO_CHG_USUS) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_usus\n");
goto exit6;
}
gpio_direction_output(mc->max8903_gpio_chg_usus, DISABLED); // leave USUS disabled until we connect
/*~CEN control */
if (gpio_request(mc->max8903_gpio_chg_en, MAX8903_TOKEN_GPIO_CHG_EN) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_en\n");
goto exit7;
}
gpio_direction_output(mc->max8903_gpio_chg_en, DISABLED);
if (gpio_request(mc->max8903_gpio_chg_ilm, MAX8903_TOKEN_GPIO_CHG_ILM) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_ilm\n");
goto exit8;
}
gpio_direction_output(mc->max8903_gpio_chg_ilm, CHG_ILM_SELECT_USB); /* set to USB current limit by default */
if (gpio_request(mc->max8903_gpio_chg_flt, MAX8903_TOKEN_GPIO_CHG_FLT) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_flt\n");
goto exit9;
}
gpio_direction_input(mc->max8903_gpio_chg_flt);
/*~FLT status*/
mc->flt_irq= gpio_to_irq(mc->max8903_gpio_chg_flt) ;
ret = request_irq( mc->flt_irq,
max8903_fault_interrupt,
IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING|IRQF_DISABLED,
"max8903-fault-irq",
mc);
printk("MAX8903: Request CHARGER FLT IRQ successfully!\n");
if (ret < 0) {
printk(KERN_ERR "MAX8903: Can't Request IRQ for max8903 flt_irq\n");
goto exita;
}
/*
create sysfs for manufacture testing coverage on charging
the operator should be able to write 1 to turn on the charging and 0 to
turn off the charging to verify the charging circuit is functioning
*/
ret = sysfs_create_group(&pdev->dev.kobj, &max8903_attr_group);
if (ret){
printk(KERN_ERR "MAX8903: Can't Create Sysfs Entry for FTM\n");
goto exitd;
}
// Register charger work and notification callback.
INIT_DELAYED_WORK_DEFERRABLE(&mc->usb_work, max8903_usb_charger_work);
mc->nb.notifier_call = twl6030_usb_notifier_call;
mc->otg = otg_get_transceiver();
if (!mc->otg) {
dev_err(&pdev->dev, "otg_get_transceiver() failed\n");
goto exitn;
}
ret = otg_register_notifier(mc->otg, &mc->nb);
if (ret) {
dev_err(&pdev->dev, "otg register notifier failed %d\n", ret);
goto exitn;
}
max8903_usb_charger_atboot(mc);
return 0;
exitn:
cancel_delayed_work_sync(&mc->usb_work);
sysfs_remove_group(&pdev->dev.kobj, &max8903_attr_group);
exitd:
free_irq(mc->flt_irq,mc);
exita:
gpio_free(mc->max8903_gpio_chg_flt);
exit9:
gpio_free(mc->max8903_gpio_chg_ilm);
exit8:
gpio_free(mc->max8903_gpio_chg_en);
exit7:
gpio_free(mc->max8903_gpio_chg_usus);
exit6:
gpio_free(mc->max8903_gpio_chg_iusb);
exit5:
gpio_free(mc->max8903_gpio_chg_uok);
exit3:
gpio_free(mc->max8903_gpio_chg_dok);
exit2:
power_supply_unregister(&mc->usb);
exit1:
power_supply_unregister(&mc->adapter);
exit0:
kfree(mc);
return ret;
}
开发者ID:LeaderRider,项目名称:kernel3NookTablet,代码行数:101,代码来源:max8903_charger.c
注:本文中的otg_get_transceiver函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论