Пример #1
0
void mot_setup_power(void)
{
	unsigned int i;
	int error;

	unsigned long pmc_cntrl_0;
	pmc_cntrl_0 = readl(IO_ADDRESS(TEGRA_PMC_BASE));
	printk(KERN_INFO "pICS_%s: pmc_cntrl_0 = 0x%X\n",__func__, pmc_cntrl_0);

	/* CPCAP standby lines connected to CPCAP GPIOs on Etna P1B & Olympus P2 */
	if ( HWREV_TYPE_IS_FINAL(system_rev) ||
	     (machine_is_etna() &&
	      HWREV_TYPE_IS_PORTABLE(system_rev) &&
	       (HWREV_REV(system_rev)  >= HWREV_REV_1B))  ||
	     (machine_is_olympus() &&
	       HWREV_TYPE_IS_PORTABLE(system_rev) &&
	       (HWREV_REV(system_rev)  >= HWREV_REV_2)) ||
		  machine_is_tegra_daytona() || machine_is_sunfire()) {
		tegra_cpcap_data.hwcfg[1] |= CPCAP_HWCFG1_STBY_GPIO;
	}

	/* For Olympus P3 the following is done:
	 * 1. VWLAN2 is  shutdown in standby by the CPCAP uC.
	 * 2. VWLAN1 is shutdown all of the time.
	 */
	if (HWREV_TYPE_IS_FINAL(system_rev) ||
		(HWREV_TYPE_IS_PORTABLE(system_rev) &&
		 (HWREV_REV(system_rev) >= HWREV_REV_3))) {
		pr_info("Detected P3 Olympus hardware.\n");
		tegra_cpcap_data.hwcfg[1] |= CPCAP_HWCFG1_SEC_STBY_VWLAN2;
		tegra_cpcap_data.hwcfg[1] &= ~CPCAP_HWCFG1_SEC_STBY_VWLAN1;
		cpcap_regulator[CPCAP_VWLAN2].constraints.always_on = 0;
	} else {
		/* Currently only Olympus P3 or greater can handle turning off the
		   external SD card. */
		fixed_sdio_config.enabled_at_boot = 1;
	}
	/* Indicate the macro controls SW5. */
	tegra_cpcap_leds.rgb_led.regulator_macro_controlled = true;

	/* For all machine types, disable watchdog when HWREV is debug, brassboard or mortable */
	if (HWREV_TYPE_IS_DEBUG(system_rev) || HWREV_TYPE_IS_BRASSBOARD(system_rev) ||
	    HWREV_TYPE_IS_MORTABLE(system_rev) ){
		tegra_cpcap_data.wdt_disable = 1;
	}

	spi_register_board_info(tegra_spi_devices, ARRAY_SIZE(tegra_spi_devices));

	for (i = 0; i < sizeof(fixed_regulator_devices)/sizeof(fixed_regulator_devices[0]); i++) {
		error = platform_device_register(&fixed_regulator_devices[i]);
		pr_info("Registered reg-fixed-voltage: %d result: %d\n", i, error);
	}

#ifdef CONFIG_REGULATOR_VIRTUAL_CONSUMER
	(void) platform_device_register(&cpcap_reg_virt_vcam);
	(void) platform_device_register(&cpcap_reg_virt_vcsi);
	(void) platform_device_register(&cpcap_reg_virt_vcsi_2);
	(void) platform_device_register(&cpcap_reg_virt_sw5);
#endif
}
Пример #2
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,"");
}
static ssize_t olympus_virtual_keys_show(struct kobject *kobj,
					struct kobj_attribute *attr, char *buf)
{
	/* keys are specified by setting the x,y of the center, the width,
	 * and the height, as such keycode:center_x:center_y:width:height */
	if (HWREV_TYPE_IS_PORTABLE(system_rev)  ||
	    HWREV_TYPE_IS_FINAL(system_rev) )
	{
		/* Olympus, P1C+ product */
		if (HWREV_REV(system_rev) >= HWREV_REV_1C )
		{
			return sprintf(buf, __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":%d:%d:%d:%d:" 
                           __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":%d:%d:%d:%d:"
	            __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":%d:%d:%d:%d:"
                           __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":%d:%d:%d:%d\n",
                           vkey_size_olympus_p_1_43[0][0],vkey_size_olympus_p_1_43[0][1],vkey_size_olympus_p_1_43[0][2],vkey_size_olympus_p_1_43[0][3],
                           vkey_size_olympus_p_1_43[1][0],vkey_size_olympus_p_1_43[1][1],vkey_size_olympus_p_1_43[1][2],vkey_size_olympus_p_1_43[1][3],
                           vkey_size_olympus_p_1_43[2][0],vkey_size_olympus_p_1_43[2][1],vkey_size_olympus_p_1_43[2][2],vkey_size_olympus_p_1_43[2][3],
                           vkey_size_olympus_p_1_43[3][0],vkey_size_olympus_p_1_43[3][1], vkey_size_olympus_p_1_43[3][2], vkey_size_olympus_p_1_43[3][3]);
		}
		else
		{
			return sprintf(buf, __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":%d:%d:%d:%d:" 
                           __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":%d:%d:%d:%d:"
	            __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":%d:%d:%d:%d:"
                           __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":%d:%d:%d:%d\n",
                           vkey_size_olympus_p_1_42[0][0],vkey_size_olympus_p_1_42[0][1],vkey_size_olympus_p_1_42[0][2],vkey_size_olympus_p_1_42[0][3],
                           vkey_size_olympus_p_1_42[1][0],vkey_size_olympus_p_1_42[1][1],vkey_size_olympus_p_1_42[1][2],vkey_size_olympus_p_1_42[1][3],
                           vkey_size_olympus_p_1_42[2][0],vkey_size_olympus_p_1_42[2][1],vkey_size_olympus_p_1_42[2][2],vkey_size_olympus_p_1_42[2][3],
                           vkey_size_olympus_p_1_42[3][0],vkey_size_olympus_p_1_42[3][1], vkey_size_olympus_p_1_42[3][2], vkey_size_olympus_p_1_42[3][3]);
		}
	}
	else
		return 0;
};
static void __init olympus_sdhci_init(void)
{
	int i;

	printk(KERN_INFO "pICS_%s: Starting...",__func__);
	
	tegra_sdhci_device1.dev.platform_data = &olympus_sdhci_platform[0];
	tegra_sdhci_device3.dev.platform_data = &olympus_sdhci_platform[2];
	tegra_sdhci_device4.dev.platform_data = &olympus_sdhci_platform[3];

	/* Olympus P3+, Etna P2+, Etna S3+, Daytona and Sunfire
	   can handle shutting down the external SD card. */
	if ( (HWREV_TYPE_IS_FINAL(system_rev) || (HWREV_TYPE_IS_PORTABLE(system_rev) && (HWREV_REV(system_rev) >= HWREV_REV_3)))) 			{
	/*	olympus_sdhci_platform[2].regulator_str = (char *)tegra_sdio_ext_reg_str;*/
		}

		/* check if an "MBR" partition was parsed from the tegra partition
		 * command line, and store it in sdhci.3's offset field */

	for (i=0; i<tegra_nand_plat.nr_parts; i++) {
		if (strcmp("mbr", tegra_nand_plat.parts[i].name))
			continue;
	//	olympus_sdhci_platform[3].startoffset = tegra_nand_plat.parts[i].offset;
		printk(KERN_INFO "pICS_%s: tegra_sdhci_boot_device plat->offset = 0x%llx ",__func__, tegra_nand_plat.parts[i].offset);		
		}

	platform_device_register(&tegra_sdhci_device4); 
	platform_device_register(&tegra_sdhci_device1);
	platform_device_register(&tegra_sdhci_device3);

	printk(KERN_INFO "pICS_%s: Ending...",__func__);
}
int __init olympus_modem_init(void)
{
	char bp_ctrl_bus[40] = "UART";
	char bp_data_bus[20] = "only";

	printk("%s: machine_is_olympus: %s\n", __func__, machine_is_olympus()?"TRUE":"FALSE"); 
	printk("%s: system_rev: 0x%x", __func__, HWREV_REV(system_rev));
	if ((machine_is_olympus() /*&&
	      HWREV_REV(system_rev) <= HWREV_REV_1))*/))
	    {
		strcat(bp_ctrl_bus, " (with mdm_ctrl)");
		olympus_mdm_ctrl_init();
		olympus_mdm6600_agent_init();
	} else
		strcat(bp_ctrl_bus, " (NO mdm_ctrl)");

	olympus_setup_mdm6600_uart_ipc();

	strcpy(bp_data_bus, "and SPI");
	olympus_setup_mdm6600_spi_ipc();
	olympus_setup_mdm6600_usb_ipc(0);
	
	/* All hardware at least has MDM6x00 at the moment. */
	pr_info("%s: MDM6x00 on %s %s\n", __func__, bp_ctrl_bus, bp_data_bus);

	return 0;
}
Пример #6
0
static int is_olympus_ge_p3(struct cpcap_device *cpcap)
{
	if (HWREV_TYPE_IS_FINAL(system_rev) ||
		(HWREV_TYPE_IS_PORTABLE(system_rev) &&
		 (HWREV_REV(system_rev) >= HWREV_REV_3))) {
		return 1;
	}
	return 0;
}
Пример #7
0
int __init mot_modem_init(void)
{
	char bp_ctrl_bus[40] = "UART";
	char bp_data_bus[20] = "only";

	if ((machine_is_olympus() &&
	     !(HWREV_TYPE_IS_MORTABLE(system_rev) &&
	       HWREV_REV(system_rev) <= HWREV_REV_1)) ||
	    (machine_is_etna() &&
	     ((HWREV_TYPE_IS_PORTABLE(system_rev) &&
	       HWREV_REV(system_rev) >= HWREV_REV_2C) ||
	      (HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
	       HWREV_REV(system_rev) >= HWREV_REV_3))) ||
	    machine_is_tegra_daytona() ||
	    machine_is_sunfire()) {
		strcat(bp_ctrl_bus, " (with mdm_ctrl)");
		mot_mdm_ctrl_init();
		mot_mdm6600_agent_init();
	} else
		strcat(bp_ctrl_bus, " (NO mdm_ctrl)");

	if (machine_is_olympus() || machine_is_tegra_daytona() ||
		machine_is_sunfire()) {
		strcpy(bp_data_bus, "and SPI");
		mot_setup_mdm6600_spi_ipc();
		mot_setup_mdm6600_usb_ipc(0);
	} else if (machine_is_etna()) {
		strcpy(bp_data_bus, "and USB");
		mot_setup_mdm6600_usb_ipc(MDM6600_HOST_WAKE_GPIO);
	}

	/* All hardware at least has MDM6x00 at the moment. */
	printk(KERN_INFO "%s: MDM6x00 on %s %s\n", __func__,
				bp_ctrl_bus, bp_data_bus);

	if (machine_is_etna() &&
	    ((HWREV_TYPE_IS_PORTABLE(system_rev) &&
	      HWREV_REV(system_rev) >= HWREV_REV_2C) ||
	     (HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
	      HWREV_REV(system_rev) >= HWREV_REV_3)))
		mot_setup_wrigley_host_wake();

	return 0;
}
Пример #8
0
static int is_etna_ge_4fb(struct cpcap_device *cpcap)
{
	if (machine_is_etna()) {
		if (HWREV_TYPE_IS_FINAL(system_rev) ||
		    (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		     (HWREV_REV(system_rev) >= HWREV_REV_4FB)))
			return 1;
	}
	return 0;

}
NvU32 
NvOdmKbcKeyMappingGetVirtualKeyMappingList(
    const struct NvOdmKeyVirtTableDetail ***pVirtKeyTableList)
{

   if (HWREV_REV(system_rev) <= HWREV_REV_1C)
	s_ScvkKeyMap.pVirtualKeyTable = KbcLayOutVirtualKey_P1C;


   *pVirtKeyTableList = s_pVirtualKeyTables;
   return NV_ARRAY_SIZE(s_pVirtualKeyTables);
}
Пример #10
0
static void olympus_touch_init(void)
{
	int ret = 0;
	struct kobject *properties_kobj = NULL;

	tegra_gpio_enable(OLYMPUS_TOUCH_IRQ_GPIO);
	gpio_request(OLYMPUS_TOUCH_IRQ_GPIO, "touch_irq");
	gpio_direction_input(OLYMPUS_TOUCH_IRQ_GPIO);

	tegra_gpio_enable(OLYMPUS_TOUCH_RESET_GPIO);
	gpio_request(OLYMPUS_TOUCH_RESET_GPIO, "touch_reset");
	gpio_direction_output(OLYMPUS_TOUCH_RESET_GPIO, 1);
	

	printk("\n%s: Updating i2c_bus_board_info with correct setup info for TS\n", __func__);
	/*
  	 * This is the information for the driver! Update platform_data field with
 	 * the pointer to the correct data based on the machine type and screen 
 	 * size
	 */
	properties_kobj = kobject_create_and_add("board_properties", NULL);
	if (properties_kobj)
		ret = sysfs_create_group(properties_kobj,
				 &mot_properties_attr_group);
	if (!properties_kobj || ret)
		pr_err("failed to create board_properties\n");

	printk("TOUCH: determining size of the screen\n");
#if 0
	/* Setup Olympus Mortable as a default */ 
	olympus_i2c_bus1_board_info->platform_data = 
		&ts_platform_olympus_m_1;
	if (HWREV_TYPE_IS_PORTABLE(system_rev)  ||
	    HWREV_TYPE_IS_FINAL(system_rev) )
	{
		/* Olympus product */
		if (HWREV_REV(system_rev) >= HWREV_REV_1C )
		{
			info->platform_data = 
				&ts_platform_olympus_p_1_43;
		}
		else
		{
			info->platform_data = 
				&ts_platform_olympus_p_1_37;
		}
	}
#endif	
}
int __init mot_modem_init(void)
{
	char bp_ctrl_bus[40] = "UART";
	char bp_data_bus[20] = "only";

	if ( !(HWREV_TYPE_IS_MORTABLE(system_rev) && HWREV_REV(system_rev) <= HWREV_REV_1) ) {
		strcat(bp_ctrl_bus, " (with mdm_ctrl)");
		mot_mdm_ctrl_init();
		mot_mdm6600_agent_init();
	} else
		strcat(bp_ctrl_bus, " (NO mdm_ctrl)");

	strcpy(bp_data_bus, "and SPI");
	mot_setup_mdm6600_spi_ipc();
	mot_setup_mdm6600_usb_ipc(0);

	/* All hardware at least has MDM6x00 at the moment. */
	printk(KERN_INFO "%s: MDM6x00 on %s %s\n", __func__,
				bp_ctrl_bus, bp_data_bus);

	return 0;
}
Пример #12
0
int __init mot_nvodmcam_init(void)
{
	int i;

	memset((unsigned char *)&pdata, 0, sizeof(pdata));

	for(i = 0; i < NVODMCAM_MAX_CAMERAS; i++) {
		UNASSIGN(pdata.camera[i].cam_pd);
		UNASSIGN(pdata.camera[i].cam_rs);
		UNASSIGN(pdata.camera[i].flash_rs);
	}

	/* ===== ETNA ===== */
	if (machine_is_etna()) {
		pdata.num_cameras = 2;
		/* camera 0 - back camera */
		if (HWREV_TYPE_IS_FINAL(system_rev) ||
			(HWREV_TYPE_IS_PORTABLE(system_rev) &&
			 HWREV_REV(system_rev) >= HWREV_REV_3B) ||
			(HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
			 HWREV_REV(system_rev) >= HWREV_REV_3)) {
			/* Etna P3B+,S3+ -> AP8140 pd=D2,no rs */
			SENSOR(pdata.camera[0], AP8140);
			ASSIGN(pdata.camera[0].cam_pd, D2, 1);
		}
		else if (system_rev == HWREV_UNDEFINED ||
			(HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
			 HWREV_REV(system_rev) == HWREV_REV_1)) {
			/* Etna UND,S1 -> OV5650 pd=N5,rs=D2 */
			SENSOR(pdata.camera[0], OV5650);
			ASSIGN(pdata.camera[0].cam_pd, N5, 0);
			ASSIGN(pdata.camera[0].cam_rs, D2, 1);
		}
		else {
			/* Etna other -> OV5650 pd=BB1,rs=D2 */
			SENSOR(pdata.camera[0], OV5650);
			ASSIGN(pdata.camera[0].cam_pd, BB1, 0);
			ASSIGN(pdata.camera[0].cam_rs, D2,  1);
		}

		/* camera 0 - flash */
		if (system_rev == HWREV_UNDEFINED ||
			(HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
			 (HWREV_REV(system_rev) == HWREV_REV_1 ||
			  HWREV_REV(system_rev) == HWREV_REV_2))) {
			/* Etna UND,S1,S2 -> LM3554 rs=BB4 */
			ASSIGN(pdata.camera[0].flash_rs, BB4, 1);
		}
		else {
			/* Etna other -> LM3554 rs=T3 */
			ASSIGN(pdata.camera[0].flash_rs, T3, 1);
		}

		/* camera 1 - front camera */
		if (HWREV_TYPE_IS_FINAL(system_rev) ||
			(HWREV_TYPE_IS_PORTABLE(system_rev) &&
			 HWREV_REV(system_rev) >= HWREV_REV_3) ||
			(HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
			 HWREV_REV(system_rev) >= HWREV_REV_3)) {
			/* Etna P3+,S3+ -> OV7739 pd=BB5,rs=L4 */
			SENSOR(pdata.camera[1], OV7739);
			ASSIGN(pdata.camera[1].cam_pd, BB5, 0);
			ASSIGN(pdata.camera[1].cam_rs, L4,  1);
		}
		else {
			/* Etna other -> OV7692 pd=BB5,no rs */
			SENSOR(pdata.camera[1], OV7692);
			ASSIGN(pdata.camera[1].cam_pd, BB5, 0);
		}
	}

	/* ===== DAYTONA ===== */
	else if (machine_is_tegra_daytona()) {
		pdata.num_cameras = 1;

		/* camera 0 - back camera */
		/* Daytona All HW -> AP8140 pd=D2,no rs */
		SENSOR(pdata.camera[0], AP8140);
		ASSIGN(pdata.camera[0].cam_pd, D2, 1);

		/* camera 0 - flash */
		/* Daytona All HW -> LM3559 rs=T3 */
		ASSIGN(pdata.camera[0].flash_rs, T3, 1);
	}

	/* ===== SUNFIRE ===== */
	else if (machine_is_sunfire()) {
		pdata.num_cameras = 2;

		/* camera 0 - back camera */
		/* Sunfire All HW -> AP8140 pd=D2,no rs */
		SENSOR(pdata.camera[0], AP8140);
		ASSIGN(pdata.camera[0].cam_pd, D2, 1);

		/* camera 0 - flash */
		/* Daytona All HW -> LM3554 rs=T3 */
		ASSIGN(pdata.camera[0].flash_rs, T3, 1);

		/* camera 1 - front camera */
		/* Sunfire All HW -> OV7739 pd=BB5,rs=L4 */
		SENSOR(pdata.camera[1], OV7739);
		ASSIGN(pdata.camera[1].cam_pd, BB5, 0);
		ASSIGN(pdata.camera[1].cam_rs, L4, 1);
	}

	/* ===== OLYMPUS ===== */
	else if (machine_is_olympus()) {
		pdata.num_cameras = 2;

		/* camera 0 - back camera */
		if (system_rev == HWREV_UNDEFINED ||
			(HWREV_TYPE_IS_MORTABLE(system_rev) &&
			 (HWREV_REV(system_rev) == HWREV_REV_1 ||
			  HWREV_REV(system_rev) == HWREV_REV_1B))) {
			/* Olympus UND,M1,M1B -> OV5650 pd=N5,rs=D2 */
			SENSOR(pdata.camera[0], OV5650);
			ASSIGN(pdata.camera[0].cam_pd, N5, 0);
			ASSIGN(pdata.camera[0].cam_rs, D2, 1);
		}
		else {
			/* Olympus other -> OV5650 pd=BB1,rs=D2 */
			SENSOR(pdata.camera[0], OV5650);
			ASSIGN(pdata.camera[0].cam_pd, BB1, 0);
			ASSIGN(pdata.camera[0].cam_rs, D2,  1);
		}

		/* camera 0 - flash */
		if (system_rev == HWREV_UNDEFINED ||
			(HWREV_TYPE_IS_MORTABLE(system_rev) &&
			 (HWREV_REV(system_rev) == HWREV_REV_1 ||
			  HWREV_REV(system_rev) == HWREV_REV_1B)) ||
			(HWREV_TYPE_IS_PORTABLE(system_rev) &&
			 (HWREV_REV(system_rev) == HWREV_REV_0))) {
			/* Olympus UND,M1,M1B,P0 -> LM3554 rs=BB4 */
			ASSIGN(pdata.camera[0].flash_rs, BB4, 1);
		}
		else {
			/* Olympus other -> LM3554 rs=T3 */
			ASSIGN(pdata.camera[0].flash_rs, T3, 1);
		}

		/* camera 1 - front camera */
		if (HWREV_TYPE_IS_FINAL(system_rev) ||
			(HWREV_TYPE_IS_PORTABLE(system_rev) &&
			 HWREV_REV(system_rev) >= HWREV_REV_2C)) {
			/* Olympus P2C+ -> SOC380 pd=BB5,rs=L4 */
			SENSOR(pdata.camera[1], SOC380);
			ASSIGN(pdata.camera[1].cam_pd, BB5, 0);
			ASSIGN(pdata.camera[1].cam_rs, L4,  1);
		}
		else {
			/* Olympus other -> OV7692 pd=BB5,no rs */
			SENSOR(pdata.camera[1], OV7692);
			ASSIGN(pdata.camera[1].cam_pd, BB5, 0);
		}
	}

	else {
		printk(KERN_ERR "%s: your hw not supported\n", __func__);
		return -ENODEV;
	}

	return platform_device_register(&nvodmcam_platform_device);
}
Пример #13
0
static int __init mot_mdm_ctrl_init(void)
{
	int value;

	spin_lock_init(&mdm_ctrl_peer_lock);

	mdm_ctrl_platform_data.on_bp_startup = mot_on_bp_startup;
	mdm_ctrl_platform_data.on_bp_shutdown = mot_on_bp_shutdown;
	mdm_ctrl_platform_data.on_bp_change = mot_on_bp_change;

	if (machine_is_olympus()) {
		if ((HWREV_TYPE_IS_FINAL(system_rev) ||
				(HWREV_TYPE_IS_PORTABLE(system_rev) &&
				(HWREV_REV(system_rev) >= HWREV_REV_3))))
			mdm_ctrl_platform_data.usb_regulator =
						mdm_ctrl_usb_regulator;
		else
			/* BP_RESOUT floats on P2 and older Olympus hardware */
			mdm_ctrl_platform_data.bp_resout_quirk = true;
	}

	mdm_ctrl_platform_data.ap_status0_gpio = AP_STATUS0_GPIO;
	mdm_ctrl_platform_data.ap_status1_gpio = AP_STATUS1_GPIO;
	mdm_ctrl_platform_data.ap_status2_gpio = AP_STATUS2_GPIO;
	mdm_ctrl_platform_data.bp_status0_gpio = BP_STATUS0_GPIO;
	mdm_ctrl_platform_data.bp_status1_gpio = BP_STATUS1_GPIO;
	mdm_ctrl_platform_data.bp_status2_gpio = BP_STATUS2_GPIO;
	mdm_ctrl_platform_data.bp_pshold_gpio = MDM_GPIO_INVALID;
	mdm_ctrl_platform_data.bp_resin_gpio = BP_RESIN_GPIO;
	mdm_ctrl_platform_data.bp_resout_gpio = BP_RESOUT_GPIO;
	mdm_ctrl_platform_data.bp_bypass_gpio = BP_BYPASSS_GPIO;
	mdm_ctrl_platform_data.bp_pwron_gpio = BP_PWRON_GPIO;
	mdm_ctrl_platform_data.bp_flash_en1_gpio = BP_FLASH1_GPIO;
	mdm_ctrl_platform_data.bp_flash_en2_gpio = BP_FLASH2_GPIO;

	mdm_ctrl_platform_data.bp_status0_gpio_irq_type =
					IRQ_TYPE_EDGE_BOTH;
	mdm_ctrl_platform_data.bp_status1_gpio_irq_type =
					IRQ_TYPE_EDGE_BOTH;
	mdm_ctrl_platform_data.bp_status2_gpio_irq_type =
					IRQ_TYPE_EDGE_BOTH;

	/*
	 * Tegra doesn't support edge triggering on GPIOs that can wake
	 * the system from deep sleep.  If the BP goes down while AP is
	 * sleeping, the AP won't notice.  So we must level trigger and
	 * toggle it in the driver.  Setting it to "high" will cause
	 * the interrupt to fire immediately so that the driver's state
	 * is accurate.
	 */
	mdm_ctrl_platform_data.bp_resout_gpio_irq_type =
					IRQ_TYPE_LEVEL_HIGH;

	gpio_request(AP_STATUS0_GPIO, "AP Status 0");
	value = gpio_get_value(AP_STATUS0_GPIO);
	gpio_direction_output(AP_STATUS0_GPIO, value);

	gpio_request(AP_STATUS1_GPIO, "AP Status 1");
	value = gpio_get_value(AP_STATUS1_GPIO);
	gpio_direction_output(AP_STATUS1_GPIO, value);

	gpio_request(AP_STATUS2_GPIO, "AP Status 2");
	value = gpio_get_value(AP_STATUS2_GPIO);
	gpio_direction_output(AP_STATUS2_GPIO, value);

	gpio_request(BP_STATUS0_GPIO, "BP Status 0");
	gpio_direction_input(BP_STATUS0_GPIO);

	gpio_request(BP_STATUS1_GPIO, "BP Status 1");
	gpio_direction_input(BP_STATUS1_GPIO);

	gpio_request(BP_STATUS2_GPIO, "BP Status 2");
	gpio_direction_input(BP_STATUS2_GPIO);

	gpio_request(BP_RESIN_GPIO, "BP Reset");
	value = gpio_get_value(BP_RESIN_GPIO);
	gpio_direction_output(BP_RESIN_GPIO, value);

	gpio_request(BP_RESOUT_GPIO, "BP Reset Output");
	gpio_direction_input(BP_RESOUT_GPIO);

	gpio_request(BP_PWRON_GPIO, "BP Power On");
	value = gpio_get_value(BP_PWRON_GPIO);
	gpio_direction_output(BP_PWRON_GPIO, value);

	return platform_device_register(&mdm_ctrl_platform_device);
}
void __init olympus_touch_init(void)
{
	int ret = 0;
	struct kobject *properties_kobj = NULL;
	struct 	qtouch_ts_platform_data *pdata;
	struct i2c_board_info *info = &olympus_i2c1_touchscreen_info[0];	

	printk("\n%s: Updating i2c_bus_board_info with correct setup info for TS\n", __func__);
	/*
  	 * This is the information for the driver! Update platform_data field with
 	 * the pointer to the correct data based on the machine type and screen 
 	 * size
	 */
	properties_kobj = kobject_create_and_add("board_properties", NULL);
	if (properties_kobj)
		ret = sysfs_create_group(properties_kobj,
				 &olympus_properties_attr_group);
	if (!properties_kobj || ret)
		pr_err("failed to create board_properties\n");

	printk("TOUCH: determining size of the screen\n");

	/* Setup Olympus Mortable as a default */ 

	info->platform_data = 
		&ts_platform_olympus_m_1;
	if (HWREV_TYPE_IS_PORTABLE(system_rev)  ||
	    HWREV_TYPE_IS_FINAL(system_rev) )
	{
		/* Olympus product */
		if (HWREV_REV(system_rev) >= HWREV_REV_1C )
		{
			info->platform_data = 
				&ts_platform_olympus_p_1_43;
		}
		else
		{
			info->platform_data = 
				&ts_platform_olympus_p_1_37;
		}
	}

	/* Initialize GPIOs (reset and interrupt) */
	pr_info("%s: gpio_request(reset)\n", __func__);
	pdata = (struct qtouch_ts_platform_data *) info->platform_data;
	tegra_gpio_enable(pdata->gpio_reset);
	ret = gpio_request(pdata->gpio_reset, QTOUCH_RST_NAME);
	if ( ret ) {
		pr_err("%s: gpio_request(reset) failed\n", __func__);
		goto err_request_irq;
	}
	pr_info("%s: gpio_direction_input(reset)\n", __func__);
	ret = gpio_direction_output(pdata->gpio_reset, 1);
	if ( ret ) {
		pr_err("%s: gpio_direction_input(reset) failed\n", __func__);
		goto err_request_irq;
	}
	pr_info("%s: gpio_request(interrupt)\n", __func__);
	tegra_gpio_enable(pdata->gpio_intr);
	ret = gpio_request(pdata->gpio_intr, QTOUCH_INT_NAME);
	if ( ret ) {
		pr_err("%s: gpio_request(interrupt) failed\n", __func__);
		goto err_request_irq;
	}
	pr_info("%s: gpio_direction_input(interrupt)\n", __func__);
	ret = gpio_direction_input(pdata->gpio_intr);
	if ( ret ) {
		pr_err("%s: gpio_direction_input(interrupt) failed\n",__func__);
		goto err_request_irq;
	}

	printk("%s: registering i2c device... touchscreen\n", __func__);
	printk("bus 0: %d device\n", 0);
	i2c_register_board_info(0, olympus_i2c1_touchscreen_info, 1);

err_request_irq:
	pr_info("%s: finished\n", __func__ );
}
Пример #15
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();
}
Пример #16
0
static void __init kxtf9_init(void)
{
#ifdef CONFIG_ARM_OF
	struct device_node *node;
	const void *prop;
	int len = 0;

	node = of_find_node_by_path(DT_PATH_ACCELEROMETER);
	if (node) {
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_AXIS_MAP_X, &len);
		if (prop && len)
			kxtf9_data.axis_map_x = *(u8 *)prop;
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_AXIS_MAP_Y, &len);
		if (prop && len)
			kxtf9_data.axis_map_y = *(u8 *)prop;
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_AXIS_MAP_Z, &len);
		if (prop && len)
			kxtf9_data.axis_map_z = *(u8 *)prop;
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_NEGATE_X, &len);
		if (prop && len)
			kxtf9_data.negate_x = *(u8 *)prop;
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_NEGATE_Y, &len);
		if (prop && len)
			kxtf9_data.negate_y = *(u8 *)prop;
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_NEGATE_Z, &len);
		if (prop && len)
			kxtf9_data.negate_z = *(u8 *)prop;
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_SENS_LOW, &len);
		if (prop && len)
				memcpy(kxtf9_data.sensitivity_low,
						(u8 *)prop, len);
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_SENS_MEDIUM, &len);
		if (prop && len)
				memcpy(kxtf9_data.sensitivity_medium,
						(u8 *)prop, len);
		prop = of_get_property(node,
				DT_PROP_ACCELEROMETER_SENS_HIGH, &len);
		if (prop && len)
				memcpy(kxtf9_data.sensitivity_high,
						(u8 *)prop, len);
		of_node_put(node);
	}
#endif
    if (machine_is_tegra_daytona()) {
        kxtf9_data.gpio = TEGRA_KXTF9_INT_GPIO;
		kxtf9_data.negate_z = 0;
		/* Swap x and y */
		kxtf9_data.axis_map_x = 0;
		kxtf9_data.axis_map_y = 1;
		kxtf9_data.negate_y = 0;
		kxtf9_data.negate_x = 0;
    }
	else if (machine_is_etna()) {
        if (system_rev == 0x1100)
            kxtf9_data.gpio = TEGRA_KXTF9_INT_GPIO_ETNA_S1;
		kxtf9_data.negate_z = 1;
		/* Swap x and y */
		kxtf9_data.axis_map_x = 1;
		kxtf9_data.axis_map_y = 0;
		/* For P2A and above */
		if (HWREV_TYPE_IS_FINAL(system_rev) ||
			(HWREV_TYPE_IS_PORTABLE(system_rev) &&
			HWREV_REV(system_rev) >= HWREV_REV_2)) {
			kxtf9_data.negate_y = 0;
			kxtf9_data.negate_x = 0;
		}
	}
	else if (machine_is_sunfire()) {
		kxtf9_data.negate_z = 1;
		/* Swap x and y */
		kxtf9_data.axis_map_x = 1;
		kxtf9_data.axis_map_y = 0;

		kxtf9_data.negate_y = 0;
		kxtf9_data.negate_x = 0;
	}	
	gpio_request(kxtf9_data.gpio, "kxtf9 accelerometer int");
	gpio_direction_input(kxtf9_data.gpio);
//	omap_cfg_reg(AF9_34XX_GPIO22_DOWN);
}
Пример #17
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 */
	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,"");
}
Пример #18
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();
}
Пример #19
0
void mot_setup_touch(struct i2c_board_info *info)
{
	int ret = 0;
	struct kobject *properties_kobj = NULL;
	printk("\n%s: Updating i2c_bus_board_info with correct setup info for TS\n", __func__);
	/*
  	 * This is the information for the driver! Update platform_data field with
 	 * the pointer to the correct data based on the machine type and screen 
 	 * size
	 */
	properties_kobj = kobject_create_and_add("board_properties", NULL);
	if (properties_kobj)
		ret = sysfs_create_group(properties_kobj,
				 &mot_properties_attr_group);
	if (!properties_kobj || ret)
		pr_err("failed to create board_properties\n");

	printk("TOUCH: determining size of the screen\n");
	/* Setup Olympus Mortable as a default */ 
	if ( machine_is_olympus() )
	{
		info->platform_data = 
			&ts_platform_olympus_m_1;
		if (HWREV_TYPE_IS_PORTABLE(system_rev)  ||
		    HWREV_TYPE_IS_FINAL(system_rev) )
		{
			/* Olympus product */
			if (HWREV_REV(system_rev) >= HWREV_REV_1C )
			{
				info->platform_data = 
					&ts_platform_olympus_p_1_43;
			}
			else
			{
				info->platform_data = 
					&ts_platform_olympus_p_1_37;
			}
		}
	}
	else if ( machine_is_etna())
	{
		/* Etna product */
		info->platform_data = 
			&ts_platform_etna_m_1;
		if (HWREV_TYPE_IS_PORTABLE(system_rev) ||
		    HWREV_TYPE_IS_FINAL(system_rev) )
		{
			printk("TOUCH: Detected Portable\n");
			info->platform_data = 
					&ts_platform_etna_p_1_43;
		}
	}
	else if (machine_is_tegra_daytona())
	{
		info->platform_data = 
			&ts_platform_daytona_m_1;
	}
	else if (machine_is_sunfire())
	{
		info->platform_data = 
			&ts_platform_etna_p_1_43;
	}
}
Пример #20
0
void mot_setup_power(void)
{
	unsigned int i;
	int error;

	/* CPCAP standby lines connected to CPCAP GPIOs on Etna P1B & Olympus P2 */
	if ( HWREV_TYPE_IS_FINAL(system_rev) ||
	     (machine_is_etna() &&
	      HWREV_TYPE_IS_PORTABLE(system_rev) &&
	       (HWREV_REV(system_rev)  >= HWREV_REV_1B))  ||
	     (machine_is_olympus() &&
	       HWREV_TYPE_IS_PORTABLE(system_rev) &&
	       (HWREV_REV(system_rev)  >= HWREV_REV_2)) ||
		  machine_is_tegra_daytona() || machine_is_sunfire()) {
		tegra_cpcap_data.hwcfg[1] |= CPCAP_HWCFG1_STBY_GPIO;
	}

	/* For Olympus P3 the following is done:
	 * 1. VWLAN2 is  shutdown in standby by the CPCAP uC.
	 * 2. VWLAN1 is shutdown all of the time.
	 */
	if (machine_is_olympus()) {
		if (HWREV_TYPE_IS_FINAL(system_rev) ||
			(HWREV_TYPE_IS_PORTABLE(system_rev) &&
			 (HWREV_REV(system_rev) >= HWREV_REV_3))) {
			pr_info("Detected P3 Olympus hardware.\n");
			tegra_cpcap_data.hwcfg[1] |= CPCAP_HWCFG1_SEC_STBY_VWLAN2;
			tegra_cpcap_data.hwcfg[1] &= ~CPCAP_HWCFG1_SEC_STBY_VWLAN1;
			cpcap_regulator[CPCAP_VWLAN2].constraints.always_on = 0;
		} else {
			/* Currently only Olympus P3 or greater can handle turning off the
			   external SD card. */
			fixed_sdio_config.enabled_at_boot = 1;
		}
		/* Indicate the macro controls SW5. */
		tegra_cpcap_leds.rgb_led.regulator_macro_controlled = true;
	}

	/* For Etna the following is done:
	 * 1. VWLAN1 is shutdown all the time for P3B+
	 * 2. External SDIO can turn off on P2+ and S3+
	 * 3. SW5 is enabled in the blink macro for <P4FB and brassboard
	 * 4. regulator control for button LED is removed for P2C+ & S3+ (moved to B+)
	 * 5. regulator control for RGB LED is removed for P4FB+ (moved to B+)
	 */
	else if (machine_is_etna()) {
		if ( HWREV_TYPE_IS_FINAL(system_rev) ||
		     (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		       (HWREV_REV(system_rev) >= HWREV_REV_3B))) {
			tegra_cpcap_data.hwcfg[1] &= ~CPCAP_HWCFG1_SEC_STBY_VWLAN1;
		}
		if ( HWREV_TYPE_IS_FINAL(system_rev) ||
		     (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		       (HWREV_REV(system_rev) >= HWREV_REV_2)) ||
		     (HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
		       (HWREV_REV(system_rev) >= HWREV_REV_3)) ){
			fixed_sdio_config.enabled_at_boot = 0;
		} else {
			fixed_sdio_config.enabled_at_boot = 1;
		}
		if ( HWREV_TYPE_IS_FINAL(system_rev) ||
		     (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		       (HWREV_REV(system_rev) >= HWREV_REV_2C)) ||
		     (HWREV_TYPE_IS_BRASSBOARD(system_rev) &&
		       (HWREV_REV(system_rev) >= HWREV_REV_3)) ) {
			tegra_cpcap_leds.button_led.regulator = NULL;
		}

		if ( HWREV_TYPE_IS_FINAL(system_rev) ||
		     (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		       (HWREV_REV(system_rev) >= HWREV_REV_4FB)) ) {
			tegra_cpcap_leds.rgb_led.regulator = NULL;
		} else {
			tegra_cpcap_leds.rgb_led.regulator_macro_controlled = true;
		}
	}
	/* For Daytona the following is done
	 * 1. VWLAN1 is shutdown all the time
	 */
	else if (machine_is_tegra_daytona()) {
		tegra_cpcap_data.hwcfg[1] &= ~CPCAP_HWCFG1_SEC_STBY_VWLAN1;
	}
	/* For Sunfire the following is done
	 * 1. VWLAN1 is shutdown all the time
	 * 2. VWLAN2 is  shutdown in standby by the CPCAP uC.
	 * 3. Regulator control for button LED is removed (on B+)
	 * 4. SW5 is enabled in the blink macro
	 */
	else if (machine_is_sunfire()) {
		tegra_cpcap_data.hwcfg[1] |= CPCAP_HWCFG1_SEC_STBY_VWLAN2;
		tegra_cpcap_data.hwcfg[1] &= ~CPCAP_HWCFG1_SEC_STBY_VWLAN1;
		cpcap_regulator[CPCAP_VWLAN2].constraints.always_on = 0;
		tegra_cpcap_leds.button_led.regulator = NULL;
		tegra_cpcap_leds.rgb_led.regulator_macro_controlled = true;
	}
	else {
		printk(KERN_ERR "Unkown hardware type encountered: 0x%x\n", machine_arch_type);
	}

	if ((machine_is_etna() &&
	     (HWREV_TYPE_IS_FINAL(system_rev) ||
	        (HWREV_TYPE_IS_PORTABLE(system_rev) &&
		(HWREV_REV(system_rev)  >= HWREV_REV_1)))) ||
		machine_is_tegra_daytona() || machine_is_sunfire()) {
		printk(KERN_INFO "%s: updating button backlight for portable\n",
		       __func__);
		tegra_cpcap_leds.button_led.button_reg = CPCAP_REG_ADLC;
		tegra_cpcap_leds.button_led.button_mask = 0x7FF;
		tegra_cpcap_leds.button_led.button_on = 0x67F3;
	}
	if (machine_is_tegra_daytona()) {
		/* IKDAYTONA-123  reduce current through 4 android hard keys */
		tegra_cpcap_leds.button_led.button_mask = 0x7FF;
		tegra_cpcap_leds.button_led.button_on = 0x7F1;
	}
	/* For all machine types, disable watchdog when HWREV is debug, brassboard or mortable */
	if (HWREV_TYPE_IS_DEBUG(system_rev) || HWREV_TYPE_IS_BRASSBOARD(system_rev) ||
	    HWREV_TYPE_IS_MORTABLE(system_rev) ){
		tegra_cpcap_data.wdt_disable = 1;
	}

	spi_register_board_info(tegra_spi_devices, ARRAY_SIZE(tegra_spi_devices));

	for (i = 0; i < sizeof(fixed_regulator_devices)/sizeof(fixed_regulator_devices[0]); i++) {
		error = platform_device_register(&fixed_regulator_devices[i]);
		pr_info("Registered reg-fixed-voltage: %d result: %d\n", i, error);
	}

#ifdef CONFIG_REGULATOR_VIRTUAL_CONSUMER
	(void) platform_device_register(&cpcap_reg_virt_vcam);
	(void) platform_device_register(&cpcap_reg_virt_vcsi);
	(void) platform_device_register(&cpcap_reg_virt_vcsi_2);
	(void) platform_device_register(&cpcap_reg_virt_sw5);
#endif
}