Beispiel #1
0
static void tegra_ehci_power_up(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	clk_enable(tegra->emc_clk);
	clk_enable(tegra->sclk_clk);

	if(tegra->phy->instance == 2 && ASUSGetProjectID()==101)
		usb3_emc_sclk_enable = 1;

	tegra_usb_phy_power_on(tegra->phy, is_dpd);
	tegra->host_resumed = 1;
}
static void ventana_mpuirq_init(void)
{
	pr_info("*** MPU START *** ventana_mpuirq_init...\n");
	tegra_gpio_enable(TEGRA_GPIO_PZ4);
	gpio_request(TEGRA_GPIO_PZ4, SENSOR_MPU_NAME);
	gpio_direction_input(TEGRA_GPIO_PZ4);
        signed char orientationGyroEP102 [9] = { 0, 1, 0, -1, 0, 0, 0, 0, 1 };
        signed char orientationAccelEP102 [9] = { -1, 0, 0, 0, 1, 0, 0, 0, -1 };
        signed char orientationMagEP102 [9] = { 1, 0, 0, 0, -1, 0, 0, 0, -1 };
        signed char orientationGyroEP103 [9] = { -1, 0, 0, 0, -1, 0, 0, 0, 1 };
        signed char orientationAccelEP103 [9] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
        signed char orientationMagEP103 [9] = { 0, -1, 0, 1, 0, 0, 0, 0, 1 };
        if( ASUSGetProjectID() == 102 ){
           memcpy( mpu3050_data.orientation, orientationGyroEP102, sizeof(mpu3050_data.orientation));
           memcpy( mpu3050_data.accel.orientation, orientationAccelEP102, sizeof(mpu3050_data.accel.orientation));
           memcpy( mpu3050_data.compass.orientation, orientationMagEP102, sizeof(mpu3050_data.compass.orientation));
        }else if( ASUSGetProjectID() == 103 ){
           memcpy( mpu3050_data.orientation, orientationGyroEP103, sizeof(mpu3050_data.orientation));
           memcpy( mpu3050_data.accel.orientation, orientationAccelEP103, sizeof(mpu3050_data.accel.orientation));
           memcpy( mpu3050_data.compass.orientation, orientationMagEP103, sizeof(mpu3050_data.compass.orientation));
        }
	pr_info("*** MPU END *** ventana_mpuirq_init...\n");
}
static void gpio_keys_report_event(struct gpio_button_data *bdata)
{
	struct gpio_keys_button *button = bdata->button;
	struct input_dev *input = bdata->input;
	unsigned int type = button->type ?: EV_KEY;
	int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low;

	GPIOKEYS_INFO("type = %d, code = %d, state = %d\n", type, button->code, state);
	input_event(input, type, button->code, !!state);
	input_sync(input);
	if ((type == EV_SW) && (ASUSGetProjectID() == 102)){
		if (state == 0)
			asusec_close_keyboard();
		else
			asusec_open_keyboard();
	}
	else if ((type == EV_SW) && (ASUSGetProjectID() == 101)){
		if (state == 1){
			GPIOKEYS_INFO("call asusec_dock_resume\n");
				asusec_dock_resume();
		}
	}
}
Beispiel #4
0
/**********************************************************
**  Function: Headset driver exit function
**  Parameter: none
**  Return value: none
**
************************************************************/
static void __exit headset_exit(void)
{
	printk("HEADSET: Headset exit\n");
	if (switch_get_state(&hs_data->sdev))
		remove_headset();
	gpio_free(JACK_GPIO);
	gpio_free(HOOK_GPIO);

	if (ASUSGetProjectID() == 101){
		gpio_free(LINEOUT_GPIO);
	}

	free_irq(hs_data->irq, 0);
	destroy_workqueue(g_detection_work_queue);
	switch_dev_unregister(&hs_data->sdev);
}
Beispiel #5
0
/**********************************************************
**  Function: Headset driver init function
**  Parameter: none  
**  Return value: none
**                     
************************************************************/
static int __init headset_init(void)
{
	int ret;

	printk("HEADSET: Headset detection init\n");

	hs_data = kzalloc(sizeof(struct headset_data), GFP_KERNEL);
	if (!hs_data)
		return -ENOMEM;

	hs_data->debouncing_time = ktime_set(0, 100000000);  /* 100 ms */
	hs_data->sdev.name = "h2w";
	hs_data->sdev.print_name = headset_name_show;
	hs_data->sdev.print_state = headset_state_show;

	ret = switch_dev_register(&hs_data->sdev);
	if (ret < 0)
		goto err_switch_dev_register;

	g_detection_work_queue = create_workqueue("detection");

	hrtimer_init(&hs_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	hs_data->timer.function = detect_event_timer_func;

	printk("HEADSET: Headset detection mode\n");
	jack_config_gpio();/*Config jack detection GPIO*/
	btn_config_gpio();/*Config hook detection GPIO*/

	if (ASUSGetProjectID() == 101){
		INIT_WORK(&lineout_work, lineout_work_queue);
		lineout_config_gpio();
	}

	return 0;

err_switch_dev_register:
	printk(KERN_ERR "Headset: Failed to register driver\n");

	return ret;
}
Beispiel #6
0
static int __init ventana_gps_init(void)
{
	struct clk *clk32 = clk_get_sys(NULL, "blink");
	if (!IS_ERR(clk32)) {
		clk_set_rate(clk32,clk32->parent->rate);
		clk_enable(clk32);
	}

	if (ASUSGetProjectID() == 103) {
		tegra_gpio_enable(TEGRA_GPIO_PS6);
		gpio_request(TEGRA_GPIO_PS6, "GPS_ENB");
		if (console_none_on_cmdline) {
			gpio_direction_output(TEGRA_GPIO_PS6, 0);
			platform_device_register(&tegra_uartd_device);
		}
		else
			platform_device_register(&debug_uart);
	}

	tegra_gpio_enable(TEGRA_GPIO_PZ3);
	return 0;
}
Beispiel #7
0
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	tegra->host_resumed = 0;
        tegra_usb_phy_power_off(tegra->phy, is_dpd);

	if(ASUSGetProjectID()==101){
		if(tegra->phy->instance == 2 && usb3_emc_sclk_enable == 1){
			clk_disable(tegra->emc_clk);
			clk_disable(tegra->sclk_clk);
			usb3_emc_sclk_enable = 0;
		}else if(tegra->phy->instance != 2){
			clk_disable(tegra->emc_clk);
			clk_disable(tegra->sclk_clk);
		}
	}else{
		clk_disable(tegra->emc_clk);
		clk_disable(tegra->sclk_clk);
	}

}
int __init ventana_sdhci_init(void)
{
	switch (ASUSGetProjectID()) {
	case 102:
		tegra_sdhci_platform_data0.max_clk_limit = 36000000;
		break;
	default:
		tegra_sdhci_platform_data0.max_clk_limit = 40000000;
	}

	tegra_gpio_enable(tegra_sdhci_platform_data2.power_gpio);
	tegra_gpio_enable(tegra_sdhci_platform_data2.cd_gpio);
	tegra_gpio_enable(tegra_sdhci_platform_data2.wp_gpio);
	tegra_gpio_enable(tegra_sdhci_platform_data3.power_gpio);

	platform_device_register(&tegra_sdhci_device3);
	platform_device_register(&tegra_sdhci_device2);
	platform_device_register(&tegra_sdhci_device0);

	ventana_wifi_init();
	return 0;
}
Beispiel #9
0
static void __init tegra_ventana_init(void)
{
#if defined(CONFIG_TOUCHSCREEN_PANJIT_I2C) || \
	defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) || defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9_EP102)
	struct board_info BoardInfo;
#endif
	tegra_booting_info();
	tegra_common_init();
	ventana_setup_misc();
	tegra_clk_init_from_table(ventana_clk_init_table);
	ventana_pinmux_init();
	ventana_i2c_init();
        ventana_uart_init();
	snprintf(ventana_chipid, sizeof(ventana_chipid), "%016llx",
	    tegra_chip_uid());
	snprintf(usb_serial_num, sizeof(usb_serial_num), "%llx", tegra_chip_uid());
	andusb_plat.serial_number = kstrdup(usb_serial_num, GFP_KERNEL);
	if (ASUSGetProjectID() == 102) {
		andusb_plat.products[0].product_id = USB_SL101_PRODUCT_ID_MTP;
		andusb_plat.products[1].product_id = USB_SL101_PRODUCT_ID_MTP_ADB;
		andusb_plat.products[2].product_id = USB_SL101_PRODUCT_ID_RNDIS;
		andusb_plat.products[3].product_id = USB_SL101_PRODUCT_ID_RNDIS_ADB;
	}

	tegra_i2s_device1.dev.platform_data = &tegra_audio_pdata[0];
	tegra_i2s_device2.dev.platform_data = &tegra_audio_pdata[1];
	tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata;
	tegra_das_device.dev.platform_data = &tegra_das_pdata;

	//disable for wifi sku
	if (ASUS3GAvailable()) {
               tegra_ehci2_device.dev.platform_data
                       = &ventana_ehci2_ulpi_platform_data;
	}

	platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices));

	if ((ASUSGetProjectID() != 103) && (!console_none_on_cmdline)) {
		//register debug uart resource only if
		//"console=ttyXX" is specified and running target platform
		//is not JN101(EP103)
		platform_device_register(&debug_uart);
		tegra_gpio_enable(TEGRA_GPIO_PB0);
		gpio_request(TEGRA_GPIO_PB0, "UART4_RXD");
		//limit RXD of UART debug console.
		gpio_direction_output(TEGRA_GPIO_PB0, 1);
	}

	ventana_sdhci_init();
	//ventana_charge_init();
	ventana_regulator_init();

#if defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9) || defined(CONFIG_TOUCHSCREEN_ATMEL_MT_T9_EP102)
       pr_info("Initializing Atmel touch driver\n");
       ventana_touch_init_atmel();
#elif defined(CONFIG_TOUCHSCREEN_PANJIT_I2C)
       pr_info("Initializing Panjit touch driver\n");
       ventana_touch_init_panjit();
#endif

#ifdef CONFIG_TOUCHSCREEN_CYTTSP_I2C
ventana_touch_init();
#endif
#ifdef CONFIG_KEYBOARD_GPIO
	ventana_keys_init();
#endif
#ifdef CONFIG_KEYBOARD_TEGRA
	ventana_kbc_init();
#endif
#ifdef CONFIG_DSP_FM34
	ventana_dsp_init();
#endif

	ventana_wired_jack_init();
	ventana_usb_init();
	ventana_gps_init();
	ventana_panel_init();
	ventana_sensors_init();
	ventana_bt_rfkill();
	ventana_power_off_init();
	ventana_emc_init();
#ifdef CONFIG_BT_BLUESLEEP
	tegra_setup_bluesleep();
#endif
}