Exemple #1
0
void mot_system_power_off(void)
{
	/* If there's external power, let's restart instead ...
	   except for the case when phone was powered on with factory cable
	   and thus has to stay powered off after Turn-Off TCMD INKVSSW-994 */
#ifdef CONFIG_REGULATOR_CPCAP
#ifdef CONFIG_BOOTINFO
	if (cpcap_misc_is_ext_power() &&
	   !((bi_powerup_reason() & PWRUP_FACTORY_CABLE) &&
	     (bi_powerup_reason() != PWRUP_INVALID)) )
#else
	if (cpcap_misc_is_ext_power())
#endif
	{
		printk("External power detected- rebooting\r\n");
		cpcap_misc_clear_power_handoff_info();
		tegra_machine_restart(0,"");
		while(1);
	}
#endif
	printk(KERN_ERR "%s(): Powering down system\n", __func__);

	/* Disable RTC alarms to prevent unwanted powerups */
	class_for_each_device(rtc_class, NULL, NULL, disable_rtc_alarms);
#ifdef CONFIG_REGULATOR_CPCAP
	/* Disable powercut detection before power off */
	cpcap_disable_powercut();
#endif
	/* We need to set the WDI bit low to power down normally */
	if (HWREV_TYPE_IS_PORTABLE(system_rev) &&
	    HWREV_REV(system_rev) >= HWREV_REV_1 &&
	    HWREV_REV(system_rev) <= HWREV_REV_1C )
	{
		/* Olympus P1 */
		gpio_request(TEGRA_GPIO_PT4, "P1 WDI");
		gpio_direction_output(TEGRA_GPIO_PT4, 1);
		gpio_set_value(TEGRA_GPIO_PT4, 0);
	}
	else
	{
		/* Olympus Mortable, P0, P2 and later */
		gpio_request(TEGRA_GPIO_PV7, "P2 WDI");
		gpio_direction_output(TEGRA_GPIO_PV7, 1);
		gpio_set_value(TEGRA_GPIO_PV7, 0);
	}

	mdelay(500);
	printk("Power-off failed (Factory cable inserted?), rebooting\r\n");
	tegra_machine_restart(0,"");
}
Exemple #2
0
static int __is_sys_exception(void)
{
#if 0
	int ret = 0;

	if ((bi_powerup_reason() == PU_REASON_WDOG_AP_RESET) ||
		(bi_powerup_reason() == PU_REASON_POWER_CUT) ||
		(bi_powerup_reason() == PU_REASON_AP_KERNEL_PANIC))
		ret = 1;

	return ret;
#endif
	return 1;
}
void __init mot_sensors_init(void)
{
	kxtf9_init();
	tegra_akm8975_init();
	if (machine_is_tegra_daytona() ||
		machine_is_sunfire())
		tegra_hall_effect_init();

	tegra_vibrator_init();
	if(!(bi_powerup_reason() & PWRUP_BAREBOARD)) {
		isl29030_init();
	}
	if (machine_is_etna() ||
		machine_is_tegra_daytona() ||
		machine_is_sunfire()) {
			tegra_l3g4200d_init();
	}

	platform_add_devices(tegra_sensors, ARRAY_SIZE(tegra_sensors));

    if (machine_is_olympus()) {
        aes1750_spi_device.irq = gpio_to_irq(aes1750_interrupt);
        spi_register_board_info(&aes1750_spi_device,sizeof(aes1750_spi_device));
    }
}
/* 	touch_int_fix: prevent spurious touch interrupt in charging mode
	by turning on pullup resistor on CAM_D10
 */
void touch_int_fix(void)
{
	int i;

	if (bi_powerup_reason() == PU_REASON_CHARGER)
		for (i = 0; i < ARRAY_SIZE(padconf_settings); i++)
			if (padconf_settings[i].offset == 0x012A)
				padconf_settings[i].setting |= OMAP343X_PADCONF_PULL_UP |
					OMAP343X_PADCONF_PUD_ENABLED;
}
void __init mot_sensors_init(void)
{
	kxtf9_init();
	tegra_akm8975_init();
	tegra_vibrator_init();

	if(!(bi_powerup_reason() & PWRUP_BAREBOARD)) {
		isl29030_init();
	}

	platform_add_devices(tegra_sensors, ARRAY_SIZE(tegra_sensors));

        aes1750_spi_device.irq = gpio_to_irq(aes1750_interrupt);
        spi_register_board_info(&aes1750_spi_device,sizeof(aes1750_spi_device));

	
	printk("bus 3: %d devices\n", ARRAY_SIZE(olympus_i2c_bus4_board_info));
	i2c_register_board_info(3, olympus_i2c_bus4_board_info, 
				ARRAY_SIZE(olympus_i2c_bus4_board_info));
}
void mot_system_power_off(void)
{
	/* If there's external power, let's restart instead ...
	   except for the case when phone was powered on with factory cable
	   and thus has to stay powered off after Turn-Off TCMD INKVSSW-994 */
	if (cpcap_misc_is_ext_power() &&
	   !((bi_powerup_reason() & PWRUP_FACTORY_CABLE) &&
	     (bi_powerup_reason() != PWRUP_INVALID)) )
	{
		printk("External power detected- rebooting\r\n");
		cpcap_misc_clear_power_handoff_info();
		tegra_machine_restart(0,"");
		while(1);
	}

	printk(KERN_ERR "%s(): Powering down system\n", __func__);

	/* Disable RTC alarms to prevent unwanted powerups */
	class_for_each_device(rtc_class, NULL, NULL, disable_rtc_alarms);

	/* Disable powercut detection before power off */
	cpcap_disable_powercut();

	/* We need to set the WDI bit low to power down normally */
	if (machine_is_olympus())
	{
		if (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		    HWREV_REV(system_rev) >= HWREV_REV_1 &&
		    HWREV_REV(system_rev) <= HWREV_REV_1C )
		{
			/* Olympus P1 */
			gpio_request(TEGRA_GPIO_PT4, "P1 WDI");
			gpio_direction_output(TEGRA_GPIO_PT4, 1);
			gpio_set_value(TEGRA_GPIO_PT4, 0);
		}
		else
		{
			/* Olympus Mortable, P0, P2 and later */
			gpio_request(TEGRA_GPIO_PV7, "P2 WDI");
			gpio_direction_output(TEGRA_GPIO_PV7, 1);
			gpio_set_value(TEGRA_GPIO_PV7, 0);
		}
	}
	else if (machine_is_etna())
	{
		if ( HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
		     HWREV_REV(system_rev) == HWREV_REV_1 )
		{
			// Etna S1
			gpio_request(TEGRA_GPIO_PK4, "S1 WDI");
			gpio_direction_output(TEGRA_GPIO_PK4, 1);
			gpio_set_value(TEGRA_GPIO_PK4, 0);
		}
		else
		{
			// Etna S2, P1 and later
			gpio_request(TEGRA_GPIO_PT4, "S2 WDI");
			gpio_direction_output(TEGRA_GPIO_PT4, 1);
			gpio_set_value(TEGRA_GPIO_PT4, 0);

			/* Etna P1B-P3C has a gate on WDI */
			if ( machine_is_etna() &&
			     ( HWREV_TYPE_IS_PORTABLE(system_rev) &&
			       ( HWREV_REV(system_rev) >= HWREV_REV_1B &&
				 HWREV_REV(system_rev) <  HWREV_REV_4 )))
				cpcap_set_wdigate(0);
		}
	}
	else if (machine_is_tegra_daytona())
	{
                        gpio_request(TEGRA_GPIO_PV7, "P2 WDI");
                        gpio_direction_output(TEGRA_GPIO_PV7, 1);
                        gpio_set_value(TEGRA_GPIO_PV7, 0);
	}
	else if (machine_is_sunfire())
	{
			gpio_request(TEGRA_GPIO_PT4, "S2 WDI");
			gpio_direction_output(TEGRA_GPIO_PT4, 1);
			gpio_set_value(TEGRA_GPIO_PT4, 0);
			cpcap_set_wdigate(0);
	}
	else
	{
		printk(KERN_ERR "Could not poweroff.  Unkown hardware revision: 0x%x\n", system_rev);
	}

	mdelay(500);
	printk("Power-off failed (Factory cable inserted?), rebooting\r\n");
	tegra_machine_restart(0,"");
}
Exemple #7
0
static void __init tegra_mot_init(void)
{
	tegra_common_init();
	tegra_setup_nvodm(true, true);
	tegra_register_socdev();

#ifdef CONFIG_APANIC_RAM
	apanic_ram_init();
#endif
#ifdef CONFIG_APANIC_MMC
	apanic_mmc_init();
#endif

	mot_setup_power();
	mot_setup_lights(&tegra_i2c_bus0_board_info[BACKLIGHT_DEV]);
	mot_setup_touch(&tegra_i2c_bus0_board_info[TOUCHSCREEN_DEV]);

	mot_sec_init();
	mot_tcmd_init();

	mot_setup_gadget();

	if(machine_is_olympus()) {
		tegra_uart_platform[UART_IPC_OLYMPUS].uart_ipc = 1;
		tegra_uart_platform[UART_IPC_OLYMPUS].uart_wake_host = TEGRA_GPIO_PA0;
		tegra_uart_platform[UART_IPC_OLYMPUS].uart_wake_request = TEGRA_GPIO_PF1;
		tegra_uart_platform[UART_IPC_OLYMPUS].peer_register = mot_mdm_ctrl_peer_register;
	}
	else if(machine_is_etna()) {
		if (HWREV_TYPE_IS_BRASSBOARD(system_rev)) {
			/* The modem is dead on S2, which makes the UART angry. */
			tegra_uart_platform[UART_IPC_ETNA].uart_ipc = 0;
			tegra_uart_platform[UART_IPC_ETNA].p.irq = ~0;
		} else {
			tegra_uart_platform[UART_IPC_ETNA].uart_ipc = 1;
			tegra_uart_platform[UART_IPC_ETNA].uart_wake_host = TEGRA_GPIO_PA0;
			tegra_uart_platform[UART_IPC_ETNA].uart_wake_request = TEGRA_GPIO_PF1;
			tegra_uart_platform[UART_IPC_ETNA].peer_register = mot_mdm_ctrl_peer_register;
		}
	}
	else if(machine_is_tegra_daytona()) {
		tegra_uart_platform[UART_IPC_DAYTONA].uart_ipc = 1;
		tegra_uart_platform[UART_IPC_DAYTONA].uart_wake_host = TEGRA_GPIO_PA0;
		tegra_uart_platform[UART_IPC_DAYTONA].uart_wake_request = TEGRA_GPIO_PF1;
		tegra_uart_platform[UART_IPC_DAYTONA].peer_register = mot_mdm_ctrl_peer_register;
	}
	else if(machine_is_sunfire()) {
		tegra_uart_platform[UART_IPC_SUNFIRE].uart_ipc = 1;
		tegra_uart_platform[UART_IPC_SUNFIRE].uart_wake_host = TEGRA_GPIO_PA0;
		tegra_uart_platform[UART_IPC_SUNFIRE].uart_wake_request = TEGRA_GPIO_PF1;
		tegra_uart_platform[UART_IPC_SUNFIRE].peer_register = mot_mdm_ctrl_peer_register;
	}

	if( (bi_powerup_reason() & PWRUP_FACTORY_CABLE) &&
	    (bi_powerup_reason() != PWRUP_INVALID) ){
#ifdef NEED_FACT_BUSY_HINT
		FactoryBusyHint(); //factory workaround no longer needed
#endif
	}

	mot_modem_init();

	(void) platform_driver_register(&cpcap_usb_connected_driver);

#ifdef CONFIG_MOT_WIMAX
	mot_wimax_gpio_init();
#endif
	mot_wlan_init();
	mot_sensors_init();

	mot_nvodmcam_init();

	printk("%s: registering i2c devices...\n", __func__);

	if(!(bi_powerup_reason() & PWRUP_BAREBOARD)) {
		printk("bus 0: %d devices\n", ARRAY_SIZE(tegra_i2c_bus0_board_info));
		i2c_register_board_info(0, tegra_i2c_bus0_board_info, 
								ARRAY_SIZE(tegra_i2c_bus0_board_info));
	}
	if (machine_is_etna() || machine_is_tegra_daytona() || machine_is_sunfire()) {
		printk("bus 2: %d devices\n", ARRAY_SIZE(tegra_i2c_bus2_board_info));
		i2c_register_board_info(2, tegra_i2c_bus2_board_info,
								ARRAY_SIZE(tegra_i2c_bus2_board_info));
	}
	printk("bus 3: %d devices\n", ARRAY_SIZE(tegra_i2c_bus3_board_info));
	i2c_register_board_info(3, tegra_i2c_bus3_board_info, 
							ARRAY_SIZE(tegra_i2c_bus3_board_info));

	if (machine_is_olympus()){
		/* console UART can be routed to 'headset jack by setting HSJ mux to 0*/
		short hsj_mux_gpio=1;

		if ( HWREV_TYPE_IS_DEBUG(system_rev) ){
			printk("%s: Enabling console on headset jack\n", __FUNCTION__);
			hsj_mux_gpio=0;
		}
		mot_set_hsj_mux( hsj_mux_gpio );
	}

	pm_power_off = mot_system_power_off;
	tegra_setup_bluesleep();

	/* Configure SPDIF_OUT as GPIO by default, it can be later controlled
	   as needed. When SPDIF_OUT is enabled and if HDMI is connected, it
	   can interefere with CPCAP ID pin, as SPDIF_OUT and ID are coupled.
	*/
	tegra_gpio_enable(TEGRA_GPIO_PD4);
	gpio_request(TEGRA_GPIO_PD4, "spdif_enable");
	gpio_direction_output(TEGRA_GPIO_PD4, 0);
	gpio_export(TEGRA_GPIO_PD4, false);

	if (machine_is_olympus() && (HWREV_TYPE_IS_PORTABLE(system_rev) || HWREV_TYPE_IS_FINAL(system_rev)))
	{
		if (HWREV_REV(system_rev) >= HWREV_REV_1 && HWREV_REV(system_rev) < HWREV_REV_2)
		{
			// Olympus P1
			config_unused_pins(oly_unused_pins_p1, ARRAY_SIZE(oly_unused_pins_p1));
		}
		else if (HWREV_REV(system_rev) >= HWREV_REV_2 && HWREV_REV(system_rev) < HWREV_REV_3)
		{
			// Olympus P2
			config_unused_pins(oly_unused_pins_p2, ARRAY_SIZE(oly_unused_pins_p2));
		}
		else if (HWREV_REV(system_rev) >= HWREV_REV_3 || HWREV_TYPE_IS_FINAL(system_rev))
		{
			// Olympus P3 and newer
			config_unused_pins(oly_unused_pins_p3, ARRAY_SIZE(oly_unused_pins_p3));
		}
	}

	if (machine_is_etna())
	{
		if (HWREV_TYPE_IS_PORTABLE(system_rev) && (HWREV_REV(system_rev) >= HWREV_REV_2) && (HWREV_REV(system_rev) < HWREV_REV_2C))
		{
			config_unused_pins(etna_unused_pins_p2a, ARRAY_SIZE(etna_unused_pins_p2a));
		}
		else if ((HWREV_TYPE_IS_PORTABLE(system_rev) && HWREV_REV(system_rev) >= HWREV_REV_2C) ||
			(HWREV_TYPE_IS_MORTABLE(system_rev) && HWREV_REV(system_rev) >= HWREV_REV_3) ||
 			HWREV_TYPE_IS_FINAL(system_rev))
		{
			config_unused_pins(etna_unused_pins_p2c, ARRAY_SIZE(etna_unused_pins_p2c));
		}
	}

        if (machine_is_tegra_daytona())
                config_unused_pins(daytona_unused_pins_p1, ARRAY_SIZE(daytona_unused_pins_p1));


	if (machine_is_etna() || machine_is_tegra_daytona() || machine_is_sunfire())
		// UTS tool support
		mot_keymap_update_init();
}
Exemple #8
0
static void __init tegra_mot_init(void)
{
	get_gpio_settings();
	tegra_common_init();
	get_gpio_settings();
	tegra_setup_nvodm(true, true);
	get_gpio_settings();
	tegra_register_socdev();
	get_gpio_settings();
#if 0
#ifdef CONFIG_APANIC_RAM
	apanic_ram_init();
#endif
#endif

#ifdef CONFIG_APANIC_MMC
	apanic_mmc_init();
#endif
	get_gpio_settings();
	mot_setup_power();
/*	mot_setup_lights(&tegra_i2c_bus0_board_info[BACKLIGHT_DEV]);
	mot_setup_touch(&tegra_i2c_bus0_board_info[TOUCHSCREEN_DEV]);*/
/*	mot_sec_init();
	mot_tcmd_init();*/
	get_gpio_settings();
	mot_setup_gadget();

	tegra_uart_platform[UART_IPC_OLYMPUS].uart_ipc = 1;
	tegra_uart_platform[UART_IPC_OLYMPUS].uart_wake_host = TEGRA_GPIO_PA0;
	tegra_uart_platform[UART_IPC_OLYMPUS].uart_wake_request = TEGRA_GPIO_PF1;
#ifdef CONFIG_MDM_CTRL
	tegra_uart_platform[UART_IPC_OLYMPUS].peer_register = mot_mdm_ctrl_peer_register;
#endif
#ifdef CONFIG_BOOTINFO
	if( (bi_powerup_reason() & PWRUP_FACTORY_CABLE) &&
	    (bi_powerup_reason() != PWRUP_INVALID) ){
#ifdef NEED_FACT_BUSY_HINT
		FactoryBusyHint(); //factory workaround no longer needed
#endif
	}
#endif
/*	mot_modem_init();*/

	(void) platform_driver_register(&cpcap_usb_connected_driver);

/*	mot_wlan_init();
	mot_sensors_init();

	mot_nvodmcam_init();*/

	printk("%s: registering i2c devices...\n", __func__);
#ifdef CONFIG_BOOTINFO
	if(!(bi_powerup_reason() & PWRUP_BAREBOARD)) {
		printk("bus 0: %d devices\n", ARRAY_SIZE(tegra_i2c_bus0_board_info));
		i2c_register_board_info(0, tegra_i2c_bus0_board_info, 
								ARRAY_SIZE(tegra_i2c_bus0_board_info));
	}
#else 
	printk("bus 0: %d devices\n", ARRAY_SIZE(tegra_i2c_bus0_board_info));
		i2c_register_board_info(0, tegra_i2c_bus0_board_info, 
								ARRAY_SIZE(tegra_i2c_bus0_board_info));
#endif
	printk("bus 3: %d devices\n", ARRAY_SIZE(tegra_i2c_bus3_board_info));
	i2c_register_board_info(3, tegra_i2c_bus3_board_info, 
							ARRAY_SIZE(tegra_i2c_bus3_board_info));

	/* console UART can be routed to 'headset jack by setting HSJ mux to 0*/
	short hsj_mux_gpio=1;

	if ( HWREV_TYPE_IS_DEBUG(system_rev) || ENABLE_JACK_UART ){
		printk("%s: Enabling console on headset jack\n", __FUNCTION__);
		hsj_mux_gpio=0;
	}
	mot_set_hsj_mux( hsj_mux_gpio );

	pm_power_off = mot_system_power_off;
	tegra_setup_bluesleep();

	/* Configure SPDIF_OUT as GPIO by default, it can be later controlled
	   as needed. When SPDIF_OUT is enabled and if HDMI is connected, it
	   can interefere with CPCAP ID pin, as SPDIF_OUT and ID are coupled.
	*/

	tegra_gpio_enable(TEGRA_GPIO_PD4);
	gpio_request(TEGRA_GPIO_PD4, "spdif_enable");
	gpio_direction_output(TEGRA_GPIO_PD4, 0);
	gpio_export(TEGRA_GPIO_PD4, false);

	if ((HWREV_TYPE_IS_PORTABLE(system_rev) || HWREV_TYPE_IS_FINAL(system_rev)))
	{
		if (HWREV_REV(system_rev) >= HWREV_REV_1 && HWREV_REV(system_rev) < HWREV_REV_2)
		{
			// Olympus P1
			config_unused_pins(oly_unused_pins_p1, ARRAY_SIZE(oly_unused_pins_p1));
		}
		else if (HWREV_REV(system_rev) >= HWREV_REV_2 && HWREV_REV(system_rev) < HWREV_REV_3)
		{
			// Olympus P2
			config_unused_pins(oly_unused_pins_p2, ARRAY_SIZE(oly_unused_pins_p2));
		}
		else if (HWREV_REV(system_rev) >= HWREV_REV_3 || HWREV_TYPE_IS_FINAL(system_rev))
		{
			// Olympus P3 and newer
			config_unused_pins(oly_unused_pins_p3, ARRAY_SIZE(oly_unused_pins_p3));
		}
	}
	get_gpio_settings();
}