当前位置: 首页>>代码示例>>C++>>正文


C++ otg_get_transceiver函数代码示例

本文整理汇总了C++中otg_get_transceiver函数的典型用法代码示例。如果您正苦于以下问题:C++ otg_get_transceiver函数的具体用法?C++ otg_get_transceiver怎么用?C++ otg_get_transceiver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了otg_get_transceiver函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(&notifier_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


注:本文中的otg_get_transceiver函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。