Exemple #1
0
static void usb_api_set_usb_switch(USB_SWITCH_MODE usb_switch)
{
	if(usb_switch == USB_SW_CP)
	{
#if defined(CONFIG_USB_ANDROID)
		android_usb_set_connected(0);
#endif
		//USB_SEL GPIO Set High => CP USB enable
		gpio_set_value(OMAP_GPIO_USB_SEL, GPIO_LEVEL_HIGH);
#ifdef CONFIG_FSA9480_MICROUSB
		mcirousb_usbpath_change(1);
#endif
		usb_path = SWITCH_MODEM;
	}
	else
	{
		//USB_SEL GPIO Set Low => AP USB enable
		gpio_set_value(OMAP_GPIO_USB_SEL, GPIO_LEVEL_LOW);
#ifdef CONFIG_FSA9480_MICROUSB
		mcirousb_usbpath_change(0);
#endif
#if defined(CONFIG_USB_ANDROID)
		android_usb_set_connected(1);
#endif
		usb_path = SWITCH_PDA;
	}
}
static int cpcap_usb_connected_remove(struct platform_device *pdev)
{
	/* Enable low power state for MUSB */
	musb_disable_idle(0);
	android_usb_set_connected(0);
	return 0;
}
static int cpcap_usb_connected_probe(struct platform_device *pdev)
{
	/* Wake up MUSB from lowpower state */
	musb_disable_idle(1);
	android_usb_set_connected(1);
	return 0;
}
Exemple #4
0
static void zeus_poweroff(void)
{
	/* int n_usbic_state; */

	printk("\nZEUS BOARD GOING TO SHUTDOWN!!!\n");

#if defined(CONFIG_USB_ANDROID)
	android_usb_set_connected(0);
#endif
        tl2796_lcd_poweroff();
	/* get_real_usbic_state(); */
	//gpio_direction_output(GPIO_MSM_RST,0);
	//gpio_direction_output(GPIO_FONE_ACTIVE, 0);
	// if (GPIO_TA_CONNECTED_N is LOW)
//#if (CONFIG_ARCHER_REV < ARCHER_REV13)
//	if ( get_real_usbic_state() )
         if ( sec_switch_get_cable_status() != CABLE_TYPE_NONE ) //me add
//#else
//	if ( !gpio_get_value( OMAP_GPIO_TA_NCONNECTED ) || gpio_get_value( OMAP_GPIO_IF_CON_SENSE ) )
//#endif
	{
		printk("Warmreset by TA or USB or Jtag\n\n");

		preempt_disable();
		local_irq_disable();
		local_fiq_disable();

#ifdef CONFIG_ARCHER_KOR_DEBUG
		omap_writel(0x54455352, OMAP343X_CTRL_BASE + 0x9C4); // set to normal reset
#endif
#if 1

		/* using watchdog reset */
		omap_watchdog_reset();
		/* machine_restart("ta_inserted"); */
#else
		/* using core_dpll_warmreset with global reset */
		//omap3_configure_core_dpll_warmreset();
		machine_restart("ta_inserted");
#endif

		while(1);
	}
	else
	{
		printk("Power Off !\n\n");
		while(1)
		{
			gpio_direction_output(GPIO_PS_HOLD, 0);

			if (0 /*is_powerbutton_pressed*/)
				printk("Power button is pressed\n\n");
			else
				twl4030_poweroff();
		}
	}

	return;
}
Exemple #5
0
static ssize_t enable_store
(
	struct device *dev,
	struct device_attribute *attr,
	const char *buf,
	size_t size
)
{
	int value;
	int switch_sel;

	if (sscanf(buf, "%d", &value) != 1) {
		printk(KERN_ERR "enable_store: Invalid value\n");
		return -EINVAL;
	}

	if((value < 0) || (value > 1)) {
		printk(KERN_ERR "enable_store: Invalid value\n");
		return -EINVAL;
	}

	if(value != usb_access_lock) {
		if (sec_get_param_value) {
			sec_get_param_value(__SWITCH_SEL, &switch_sel);
			switch_sel &= ~USB_LOCK_MASK;
			if(value == 1) {
				switch_sel |= USB_LOCK_MASK;
				android_usb_set_connected(0);
			} else {
				android_usb_set_connected(0);
				android_usb_set_connected(1);
			}
		}

		usb_access_lock = value;

		if (sec_set_param_value) {
			sec_set_param_value(__SWITCH_SEL, &switch_sel);
		}
	}

	return size;
}
Exemple #6
0
static void sio_switch_init_worker(struct work_struct *ignored)
{
	int switch_sel;

	if (sec_get_param_value) {
		sec_get_param_value(__SWITCH_SEL, &switch_sel);
		cancel_delayed_work(&sio_switch_init_work);
	} else {
		schedule_delayed_work(&sio_switch_init_work, msecs_to_jiffies(100));		
		return;
	}

	if (switch_sel & USB_SEL_MASK)
		usb_path = SWITCH_PDA;
	else
		usb_path = SWITCH_MODEM;

	if (switch_sel & UART_SEL_MASK)
		uart_current_owner = SWITCH_PDA;
	else
		uart_current_owner = SWITCH_MODEM;

#ifdef _FMC_DM_
	if (switch_sel & USB_LOCK_MASK) {
		usb_access_lock = 1;
		android_usb_set_connected(0);
	}
#endif

	if (uart_current_owner == SWITCH_PDA)
	{
		sio_switch_config(AP_UART_MODE);
	}
	else if (uart_current_owner == SWITCH_MODEM)
	{
		printk("----------------- Cutting off PDA UART ---------------------\n");
		sio_switch_config(CP_UART_MODE);
	}

	if (usb_path == SWITCH_MODEM)
	{
		sio_switch_config(CP_USB_MODE);
	}

	microusb_init();
}
static int cpcap_usb_connected_remove(struct platform_device *pdev)
{
	struct cpcap_usb_connected_data *data = platform_get_drvdata(pdev);

	mdm_ctrl_set_usb_ipc(false);

	/* Configure CPCAP-AP20 USB Mux to CPCAP */
	NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x0);
	NvOdmGpioReleasePinHandle(data->h_gpio, data->h_pin);
	NvOdmGpioClose(data->h_gpio);

	if((data->accy == CPCAP_ACCY_USB) || (data->accy == CPCAP_ACCY_FACTORY))
		android_usb_set_connected(0, data->accy);

#ifdef CONFIG_USB_TEGRA_OTG
	tegra_otg_set_mode(2);
#endif

	kfree(data);

        return 0;
}
Exemple #8
0
static int cpcap_usb_connected_remove(struct platform_device *pdev)
{
/*	struct cpcap_usb_connected_data *data = platform_get_drvdata(pdev);*/
	struct cpcap_accy_platform_data *pdata = pdev->dev.platform_data;

	int nr_gpio;
#ifdef CONFIG_MDM_CTRL
	mdm_ctrl_set_usb_ipc(false);
#endif
#if 0
	/* Configure CPCAP-AP20 USB Mux to CPCAP */
	NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x0);
	printk(KERN_INFO "pICS_%s: NvOdmGpioSetState (data->h_gpio, data->h_pin, 0x0)\n",__func__);
	NvOdmGpioReleasePinHandle(data->h_gpio, data->h_pin);
	printk(KERN_INFO "pICS_%s: NvOdmGpioReleasePinHandle(data->h_gpio, data->h_pin)\n",__func__);
	NvOdmGpioClose(data->h_gpio);
	printk(KERN_INFO "pICS_%s: NvOdmGpioClose(data->h_gpio)\n",__func__);
#endif
	
	nr_gpio = 174;
	gpio_set_value(nr_gpio, 0);

	gpio_free(nr_gpio);
/*	gpio_data[nr_gpio].val = false;
	gpio_data[nr_gpio].alloc = false;*/
	
	tegra_gpio_disable(nr_gpio);
#ifdef CONFIG_USB_MOT_ANDROID
	if((pdata->accy == CPCAP_ACCY_USB) || (pdata->accy == CPCAP_ACCY_FACTORY))
		android_usb_set_connected(0, pdata->accy);
#endif

	tegra_otg_set_mode(2);

/*	kfree(data);*/

        return 0;
}
static int cpcap_usb_connected_probe(struct platform_device *pdev)
{
	struct cpcap_usb_connected_data *data;
	struct cpcap_accy_platform_data *pdata = pdev->dev.platform_data;

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if(!data)
		return -ENOMEM;

	data->accy = pdata->accy;

	/* Configure CPCAP-AP20 USB Mux to AP20 */
	data->port = NVODM_PORT('v');
	data->pin = 6;
	data->h_gpio = NvOdmGpioOpen();
	data->h_pin = NvOdmGpioAcquirePinHandle(data->h_gpio, data->port, data->pin);
	NvOdmGpioConfig(data->h_gpio, data->h_pin, NvOdmGpioPinMode_Output);
	NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x1);

	platform_set_drvdata(pdev, data);

	/* when the phone is the host do not start the gadget driver */
	if((data->accy == CPCAP_ACCY_USB) || (data->accy == CPCAP_ACCY_FACTORY)) {
#ifdef CONFIG_USB_TEGRA_OTG
		tegra_otg_set_mode(0);
#endif
		android_usb_set_connected(1, data->accy);
	}
	if(data->accy == CPCAP_ACCY_USB_DEVICE) {
#ifdef CONFIG_USB_TEGRA_OTG
		tegra_otg_set_mode(1);
#endif
	}
	mdm_ctrl_set_usb_ipc(true);

	return 0;
}
static int cpcap_usb_connected_remove(struct platform_device *pdev)
{
	android_usb_set_connected(0);
	return 0;
}
Exemple #11
0
static int cpcap_usb_connected_probe(struct platform_device *pdev)
{
/*	struct cpcap_usb_connected_data *data;*/
	struct cpcap_accy_platform_data *pdata = pdev->dev.platform_data;

	int nr_gpio;
	int ret;
	static int count_f7 = 0;

#if 0
	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if(!data)
		return -ENOMEM;

	data->accy = pdata->accy;



	
	/* Configure CPCAP-AP20 USB Mux to AP20 */
	data->port = NVODM_PORT('v'); 
	printk(KERN_INFO "pICS_%s: data->port = NVODM_PORT('v') = %lu\n",__func__, data->port);
	data->pin = 6;
	data->h_gpio = NvOdmGpioOpen(); 
	printk(KERN_INFO "pICS_%s: data->h_gpio = NvOdmGpioOpen()\n",__func__);
	data->h_pin = NvOdmGpioAcquirePinHandle(data->h_gpio, data->port, data->pin);
	printk(KERN_INFO "pICS_%s: data->h_pin = NvOdmGpioAcquirePinHandle(data->h_gpio, data->port, data->pin)\n",__func__);
	NvOdmGpioConfig(data->h_gpio, data->h_pin, NvOdmGpioPinMode_Output);
	printk(KERN_INFO "pICS_%s: NvOdmGpioConfig(data->h_gpio, data->h_pin, NvOdmGpioPinMode_Output)\n",__func__);
	NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x1);
	printk(KERN_INFO "pICS_%s: NvOdmGpioSetState(data->h_gpio, data->h_pin, 0x1)\n",__func__);
#endif
/*	data->port = 21;
	data->pin = 6;
	data->h_gpio = 174;
	data->h_pin = */

try_f7:

	nr_gpio = 174;
    	ret = gpio_request(nr_gpio, "nvrm_gpio");
    	printk(KERN_INFO "pICS_%s: gpio_request(nr_gpio=%i, 'nvrm_gpio') => %i;\n",__func__, nr_gpio, ret);

    	if (ret) {
		if(TEGRA_GPIO_PF7 == nr_gpio && !count_f7)
		{
			pr_err("%s: gpio_request for 47 failed (%d). Special case to free and retry\n",	__func__, ret);
			// F7 is allocated early by lights driver but really should be owned by disp driver
			gpio_free(nr_gpio);
			/*gpio_data[nr_gpio].val = false;
			gpio_data[nr_gpio].alloc = false;*/
			count_f7 = 1;
			goto try_f7;
		}

		/*gpio_to_name(nr_gpio, gpio_name);*/
		pr_err("%s: gpio_request for %d failed (%d)\n",
		       __func__, nr_gpio, ret);
	}

/*	gpio_data[nr_gpio].alloc = true;
	gpio_data[nr_gpio].val = false;*/

	tegra_gpio_enable(nr_gpio);
	gpio_direction_output(nr_gpio, 0);	
	gpio_set_value(nr_gpio, 1);

	platform_set_drvdata(pdev, pdata);

	/* when the phone is the host do not start the gadget driver */
	if((pdata->accy == CPCAP_ACCY_USB) || (pdata->accy == CPCAP_ACCY_FACTORY)) {
		tegra_otg_set_mode(0);
#ifdef CONFIG_USB_MOT_ANDROID
		android_usb_set_connected(1, pdata->accy);
#endif
	}
	if(pdata->accy == CPCAP_ACCY_USB_DEVICE) {
		tegra_otg_set_mode(1);
	}
#ifdef CONFIG_MDM_CTRL
	mdm_ctrl_set_usb_ipc(true);
#endif

	return 0;
}