コード例 #1
0
static void rmmod_device_driver(struct usb_msg_center_info *center_info)
{
	DMSG_INFO("\n\nrmmod_device_driver\n\n");

	set_usb_role(center_info, USB_ROLE_NULL);

	sunxi_usb_device_disable();

#if defined(CONFIG_AW_AXP)
	axp_usbcur(CHARGE_AC);
	axp_usbvol(CHARGE_AC);
#endif
	return;
}
コード例 #2
0
ファイル: usb_msg_center.c プロジェクト: lucatib/a33_linux
static void rmmod_device_driver(struct usb_msg_center_info *center_info)
{
	DMSG_INFO("\n\nrmmod_device_driver\n\n");

	set_usb_role(center_info, USB_ROLE_NULL);
#ifndef CONFIG_USB_SUNXI_USB0_HOST_ONLY
	sunxi_usb_device_disable();
#endif

#if defined(CONFIG_AW_AXP)

#if 0	//No ac is available in tablet Majestic.....
	axp_usbcur(CHARGE_AC);
	axp_usbvol(CHARGE_AC);
#endif

#endif
	return;
}
コード例 #3
0
ファイル: core.c プロジェクト: phi-psi/linux-3.4-sunxi
static int __devinit sunxi_probe(struct platform_device *pdev)
{
	struct device_node	*node = pdev->dev.of_node;
	struct resource		*res;
	struct sunxi_otgc		*otgc;
	struct device		*dev = &pdev->dev;

	int			ret = -ENOMEM;
	int			irq;

	void __iomem		*regs;
	void			*mem;

	mem = devm_kzalloc(dev, sizeof(*otgc) + SUNXI_ALIGN_MASK, GFP_KERNEL);
	if (!mem) {
		dev_err(dev, "not enough memory\n");
		return -ENOMEM;
	}
	otgc = PTR_ALIGN(mem, SUNXI_ALIGN_MASK + 1);
	otgc->mem = mem;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		dev_err(dev, "missing resource\n");
		return -ENODEV;
	}

	otgc->res = res;

	res = devm_request_mem_region(dev, res->start, resource_size(res),
			dev_name(dev));
	if (!res) {
		dev_err(dev, "can't request mem region\n");
		return -ENOMEM;
	}

	regs = devm_ioremap(dev, res->start, resource_size(res));

	if (!regs) {
		dev_err(dev, "ioremap failed\n");
		return -ENOMEM;
	}


	irq = platform_get_irq(pdev, 0);
	if (irq < 0) {
		dev_err(dev, "missing IRQ\n");
		return -ENODEV;
	}

	spin_lock_init(&otgc ->lock);

	otgc->regs	= regs;
	otgc->regs_size	= resource_size(res);
	otgc->dev	= dev;
	otgc->irq	= irq;

	if (!strncmp("super", maximum_speed, 5))
		otgc->maximum_speed = SUNXI_DCFG_SUPERSPEED;
	else if (!strncmp("high", maximum_speed, 4))
		otgc->maximum_speed = SUNXI_DCFG_HIGHSPEED;
	else if (!strncmp("full", maximum_speed, 4))
		otgc->maximum_speed = SUNXI_DCFG_FULLSPEED1;
	else if (!strncmp("low", maximum_speed, 3))
		otgc->maximum_speed = SUNXI_DCFG_LOWSPEED;
	else
		otgc->maximum_speed = SUNXI_DCFG_SUPERSPEED;

	if (of_get_property(node, "tx-fifo-resize", NULL))
		otgc->needs_fifo_resize = true;

	pm_runtime_enable(dev);
	pm_runtime_get_sync(dev);
	pm_runtime_forbid(dev);

	sunxi_open_usb_clock(otgc);

#ifndef  SUNXI_USB_FPGA
	sunxi_pin_init(otgc);
	request_usb_regulator_io(otgc);
#endif
	ret = sunxi_core_init(otgc);
	if (ret) {
		dev_err(dev, "failed to initialize core\n");
		 return ret;
	}

	sunxi_set_mode(otgc , SUNXI_GCTL_PRTCAP_DEVICE);
	sunxi_gadget_init(otgc );

	ret = sunxi_debugfs_init(otgc);
	if (ret) {
		dev_err(dev, "failed to initialize debugfs\n");
		goto err1;
	}

	pm_runtime_allow(dev);

	platform_set_drvdata(pdev, otgc);
	sunxi_otg_pdev = pdev;
	sunxi_usb_device_disable();
	return 0;

err1:
	sunxi_core_exit(otgc);

	return ret;
}