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)); } }
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 }
/*is headset mic driver present on GPIO4?*/ static inline int cpcap_audio_hw_has_hs_driver(void) { if (machine_is_etna()) return 0; if (cpcap_audio_is_cdma_shadow()) return 0; return 1; }
static inline int cpcap_audio_hw_has_mic3_switch(void) { if (machine_is_etna()) return 0; if (cpcap_audio_is_cdma_shadow()) return 1; return 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; }
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; }
static void tegra_vibrator_init(void) { if (machine_is_etna()) { if (system_rev == 0x1100) { printk("VIB: Etna S1 gpio override.\n"); tegra_vib_gpio_data.gpio = TEGRA_VIBRATOR_GPIO_ETNA_S1; } } if( gpio_request(tegra_vib_gpio_data.gpio, "vib_en") < 0) return; gpio_direction_output(tegra_vib_gpio_data.gpio, 0); // omap_cfg_reg(Y4_34XX_GPIO181); }
void mot_setup_gadget(void) { unsigned int chip_id[2]; char serial[17]; NvRmQueryChipUniqueId(s_hRmGlobal, sizeof(chip_id), (void *)chip_id); snprintf(serial, sizeof(serial), "%08x%08x", chip_id[1], chip_id[0]); tegra_get_serial_number(); if (usb_serial_num) andusb_plat.serial_number = kstrdup(usb_serial_num, GFP_KERNEL); else andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL); if (machine_is_olympus()) { andusb_plat.product_name = olympus_dev; andusb_plat_bp.product_name = olympus_dev; tegra_usb_fsg_platform.product = olympus_dev; } else if (machine_is_etna()) { andusb_plat.product_name = etna_dev; andusb_plat_bp.product_name = etna_dev; tegra_usb_fsg_platform.product = etna_dev; } else if (machine_is_tegra_daytona()) { andusb_plat.product_name = daytona_dev; andusb_plat_bp.product_name = daytona_dev; tegra_usb_fsg_platform.product = daytona_dev; } else if (machine_is_sunfire()) { andusb_plat.product_name = sunfire_dev; andusb_plat_bp.product_name = sunfire_dev; tegra_usb_fsg_platform.product = sunfire_dev; } else { andusb_plat.product_name = default_dev; andusb_plat_bp.product_name = default_dev; tegra_usb_fsg_platform.product = default_dev; } if (!strncmp(boot_mode, "bp-tools", BOOT_MODE_MAX_LEN)) { tegra_android_device.dev.platform_data = &andusb_plat_bp; acm_pdata.num_inst = 4; acm_pdata.use_iads = 1; } platform_device_register(&acm_device); platform_device_register(&tegra_usb_fsg_device); #ifdef CONFIG_USB_ANDROID_RNDIS platform_device_register(&rndis_device); #endif platform_device_register(&tegra_android_device); }
void mot_tcmd_init(void) { mot_tcmd_platform_data.gpio_list[TCMD_GPIO_ISL29030_INT] = TEGRA_GPIO_PE1; mot_tcmd_platform_data.gpio_list[TCMD_GPIO_KXTF9_INT] = TEGRA_GPIO_PV3; mot_tcmd_platform_data.gpio_list[TCMD_GPIO_MMC_DETECT] = TEGRA_GPIO_PI5; mot_tcmd_platform_data.gpio_list[TCMD_GPIO_INT_MAX_NUM] = -1; mot_tcmd_platform_data.size = TCMD_GPIO_INT_MAX_NUM; if (machine_is_etna()) { if (system_rev == 0x1100) { mot_tcmd_platform_data.gpio_list[TCMD_GPIO_KXTF9_INT] = TEGRA_GPIO_PN4; } } platform_device_register(&mot_tcmd_platform_device); }
static void __init isl29030_init(void) { if (machine_is_olympus()) { isl29030_als_ir_data_Olympus.irq = gpio_to_irq(PROX_INT_GPIO); isl29030_als_ir.dev.platform_data = &(isl29030_als_ir_data_Olympus); } if (machine_is_etna()) { isl29030_als_ir_data_Etna.irq = gpio_to_irq(PROX_INT_GPIO); isl29030_als_ir.dev.platform_data = &(isl29030_als_ir_data_Etna); } if (machine_is_sunfire()) { isl29030_als_ir_data_Sunfire.irq = gpio_to_irq(PROX_INT_GPIO); isl29030_als_ir.dev.platform_data = &(isl29030_als_ir_data_Sunfire); } if (machine_is_tegra_daytona()) { isl29030_als_ir_data_Daytona.irq = gpio_to_irq(PROX_INT_GPIO); isl29030_als_ir.dev.platform_data = &(isl29030_als_ir_data_Daytona); } gpio_request(PROX_INT_GPIO, "isl29030_proximity_int"); gpio_direction_input(PROX_INT_GPIO); }
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); }
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,""); }
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 }
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(); }
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); }
static ssize_t mot_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 ( machine_is_olympus() ) { 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; } else if ( machine_is_etna()) { if (HWREV_TYPE_IS_PORTABLE(system_rev) || HWREV_TYPE_IS_FINAL(system_rev) ) { /* Etna product */ if (HWREV_REV(system_rev) >= HWREV_REV_1B ) { 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_etna_p_1_42[0][0],vkey_size_etna_p_1_42[0][1],vkey_size_etna_p_1_42[0][2],vkey_size_etna_p_1_42[0][3], vkey_size_etna_p_1_42[1][0],vkey_size_etna_p_1_42[1][1],vkey_size_etna_p_1_42[1][2],vkey_size_etna_p_1_42[1][3], vkey_size_etna_p_1_42[2][0],vkey_size_etna_p_1_42[2][1],vkey_size_etna_p_1_42[2][2],vkey_size_etna_p_1_42[2][3], vkey_size_etna_p_1_42[3][0],vkey_size_etna_p_1_42[3][1], vkey_size_etna_p_1_42[3][2], vkey_size_etna_p_1_42[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_etna_p_1_41[0][0],vkey_size_etna_p_1_41[0][1],vkey_size_etna_p_1_41[0][2],vkey_size_etna_p_1_41[0][3], vkey_size_etna_p_1_41[1][0],vkey_size_etna_p_1_41[1][1],vkey_size_etna_p_1_41[1][2],vkey_size_etna_p_1_41[1][3], vkey_size_etna_p_1_41[2][0],vkey_size_etna_p_1_41[2][1],vkey_size_etna_p_1_41[2][2],vkey_size_etna_p_1_41[2][3], vkey_size_etna_p_1_41[3][0],vkey_size_etna_p_1_41[3][1], vkey_size_etna_p_1_41[3][2], vkey_size_etna_p_1_41[3][3]); } } else if (HWREV_TYPE_IS_BRASSBOARD(system_rev) && HWREV_REV(system_rev) >= HWREV_REV_3) { /* Etna product */ 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_etna_p_1_42[0][0], vkey_size_etna_p_1_42[0][1], vkey_size_etna_p_1_42[0][2], vkey_size_etna_p_1_42[0][3], vkey_size_etna_p_1_42[1][0], vkey_size_etna_p_1_42[1][1], vkey_size_etna_p_1_42[1][2], vkey_size_etna_p_1_42[1][3], vkey_size_etna_p_1_42[2][0], vkey_size_etna_p_1_42[2][1], vkey_size_etna_p_1_42[2][2], vkey_size_etna_p_1_42[2][3], vkey_size_etna_p_1_42[3][0], vkey_size_etna_p_1_42[3][1], vkey_size_etna_p_1_42[3][2], vkey_size_etna_p_1_42[3][3]); } else return 0; } else if ( machine_is_sunfire()) { 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_etna_p_1_42[0][0], vkey_size_etna_p_1_42[0][1], vkey_size_etna_p_1_42[0][2], vkey_size_etna_p_1_42[0][3], vkey_size_etna_p_1_42[1][0], vkey_size_etna_p_1_42[1][1], vkey_size_etna_p_1_42[1][2], vkey_size_etna_p_1_42[1][3], vkey_size_etna_p_1_42[2][0], vkey_size_etna_p_1_42[2][1], vkey_size_etna_p_1_42[2][2], vkey_size_etna_p_1_42[2][3], vkey_size_etna_p_1_42[3][0], vkey_size_etna_p_1_42[3][1], vkey_size_etna_p_1_42[3][2], vkey_size_etna_p_1_42[3][3]); } else return 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; } }
static int is_etna_ge_p0(struct cpcap_device *cpcap) { if (machine_is_etna()) return 1; return 0; }