Пример #1
0
static void enterprise_nfc_init(void)
{
	tegra_gpio_enable(TEGRA_GPIO_PS4);
	tegra_gpio_enable(TEGRA_GPIO_PM6);
}
static void n1_max17043_gpio_init(void)
{
	tegra_gpio_enable(GPIO_FUEL_ALERT);
	gpio_request(GPIO_FUEL_ALERT, "fuel_alert");
	gpio_direction_input(GPIO_FUEL_ALERT);
}
int __init n1_gpio_i2c_init(int lpm_mode)
{
	/* image converter */
	platform_device_register(&tegra_gpio_i2c10_device);
	i2c_register_board_info(10, sec_gpio_i2c10_info,
			ARRAY_SIZE(sec_gpio_i2c10_info));

	platform_device_register(&tegra_gpio_i2c8_device);
	i2c_register_board_info(8, sec_gpio_i2c8_info,
			ARRAY_SIZE(sec_gpio_i2c8_info));

	platform_device_register(&tegra_gpio_i2c11_device);
	i2c_register_board_info(11, sec_gpio_i2c11_info,
			ARRAY_SIZE(sec_gpio_i2c11_info));



	tegra_gpio_enable(tegra_gpio_i2c8_pdata.sda_pin);
	tegra_gpio_enable(tegra_gpio_i2c8_pdata.scl_pin);


	tegra_gpio_enable(tegra_gpio_i2c11_pdata.sda_pin);
	tegra_gpio_enable(tegra_gpio_i2c11_pdata.scl_pin);


	/* nct1008 Thermal monitor */
	n1_nct1008_init();
	platform_device_register(&tegra_gpio_i2c15_device);
	i2c_register_board_info(15, sec_gpio_i2c15_info, ARRAY_SIZE(sec_gpio_i2c15_info));
	tegra_gpio_enable(tegra_gpio_i2c15_pdata.sda_pin);
	tegra_gpio_enable(tegra_gpio_i2c15_pdata.scl_pin);

	/* max17043 Fuel Gauge */
	n1_max17043_gpio_init();
	platform_device_register(&fuelgauge_gpio_i2c_device);
	i2c_register_board_info(5, n1_fuelgauge, ARRAY_SIZE(n1_fuelgauge));
	tegra_gpio_enable(fuelgauge_gpio_i2c_pdata.sda_pin);
	tegra_gpio_enable(fuelgauge_gpio_i2c_pdata.scl_pin);

	platform_device_register(&tegra_gpio_i2c9_device);
	i2c_register_board_info(9, sec_gpio_i2c9_info,
			ARRAY_SIZE(sec_gpio_i2c9_info));
	tegra_gpio_enable(tegra_gpio_i2c9_pdata.sda_pin);
	tegra_gpio_enable(tegra_gpio_i2c9_pdata.scl_pin);
	tegra_gpio_enable(sec_gpio_i2c9_info[0].irq);

	/* compass */
	tegra_gpio_enable(gpio_i2c7_platdata.sda_pin);
	tegra_gpio_enable(gpio_i2c7_platdata.scl_pin);
	platform_device_register(&n1_device_gpio_i2c7);

	/* fmradio : si4709 */
	if (system_rev >= 4) {
		n1_fmradio_init(lpm_mode);
		platform_device_register(&n1_device_gpio_i2c6);
		i2c_register_board_info(6, sec_gpio_i2c6_info,
			ARRAY_SIZE(sec_gpio_i2c6_info));
		tegra_gpio_enable(gpio_i2c6_platdata.sda_pin);
		tegra_gpio_enable(gpio_i2c6_platdata.scl_pin);
	}

	if (system_rev >= 4) {
		platform_device_register(&tegra_gpio_i2c16_device);
		tegra_gpio_enable(tegra_gpio_i2c16_pdata.sda_pin);
		tegra_gpio_enable(tegra_gpio_i2c16_pdata.scl_pin);
	}

	if(system_rev >= 5) {
		platform_device_register(&tegra_gpio_i2c17_device);
		tegra_gpio_enable(tegra_gpio_i2c17_pdata.sda_pin);
		tegra_gpio_enable(tegra_gpio_i2c17_pdata.scl_pin);
	}


	return 0;
}
Пример #4
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();
	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
}
int __init grouper_panel_init(void)
{
	int err;
	struct resource __maybe_unused *res;
	struct board_info board_info;

	tegra_get_board_info(&board_info);

#if defined(CONFIG_TEGRA_NVMAP)
	grouper_carveouts[1].base = tegra_carveout_start;
	grouper_carveouts[1].size = tegra_carveout_size;
#endif
/*
	gpio_request(grouper_lvds_avdd_en, "lvds_avdd_en");
	gpio_direction_output(grouper_lvds_avdd_en, 1);
	tegra_gpio_enable(grouper_lvds_avdd_en);

	//gpio_request(grouper_lvds_stdby, "lvds_stdby");
	//gpio_direction_output(grouper_lvds_stdby, 1);
	//tegra_gpio_enable(grouper_lvds_stdby);

	gpio_request(grouper_lvds_rst, "lvds_rst");
	gpio_direction_output(grouper_lvds_rst, 1);
	tegra_gpio_enable(grouper_lvds_rst);

	if (board_info.fab == BOARD_FAB_A00) {
		gpio_request(grouper_lvds_rs_a00, "lvds_rs");
		gpio_direction_output(grouper_lvds_rs_a00, 0);
		tegra_gpio_enable(grouper_lvds_rs_a00);
	} else {
		gpio_request(grouper_lvds_rs, "lvds_rs");
		gpio_direction_output(grouper_lvds_rs, 0);
		tegra_gpio_enable(grouper_lvds_rs);
	}

	gpio_request(grouper_lvds_lr, "lvds_lr");
	gpio_direction_output(grouper_lvds_lr, 1);
	tegra_gpio_enable(grouper_lvds_lr);
*/
/*
	gpio_request(grouper_lvds_shutdown, "lvds_shutdown");
	gpio_direction_output(grouper_lvds_shutdown, 1);
	tegra_gpio_enable(grouper_lvds_shutdown);
*/

	if( grouper_get_project_id() == GROUPER_PROJECT_BACH)
	{
		grouper_disp1_out.parent_clk = "pll_d_out0";
		grouper_disp1_out.modes->pclk = 81750000;
		grouper_disp1_out.modes->h_sync_width= 64;
		grouper_disp1_out.modes->h_back_porch= 128;
		grouper_disp1_out.modes->h_front_porch = 64;
		printk("Bach: Set LCD pclk as %d Hz\n", grouper_disp1_out.modes->pclk);

		gpio_request(TEGRA_GPIO_PV6, "gpio_v6");
		tegra_gpio_enable(TEGRA_GPIO_PV6);
	}

	tegra_gpio_enable(grouper_hdmi_hpd);
	gpio_request(grouper_hdmi_hpd, "hdmi_hpd");
	gpio_direction_input(grouper_hdmi_hpd);

#ifdef CONFIG_HAS_EARLYSUSPEND
	grouper_panel_early_suspender.suspend = grouper_panel_early_suspend;
	grouper_panel_early_suspender.resume = grouper_panel_late_resume;
	grouper_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
	register_early_suspend(&grouper_panel_early_suspender);
#endif

#ifdef CONFIG_TEGRA_GRHOST
	err = nvhost_device_register(&tegra_grhost_device);
	if (err)
		return err;
#endif

	err = platform_add_devices(grouper_gfx_devices,
				ARRAY_SIZE(grouper_gfx_devices));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = nvhost_get_resource_byname(&grouper_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;
#endif

	/* Copy the bootloader fb to the fb. */
//	tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
//				min(tegra_fb_size, tegra_bootloader_fb_size));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if (!err)
		err = nvhost_device_register(&grouper_disp1_device);

	res = nvhost_get_resource_byname(&grouper_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err)
		err = nvhost_device_register(&grouper_disp2_device);
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err)
		err = nvhost_device_register(&nvavp_device);
#endif
	return err;
}
static void ventana_nct1008_init(void)
{
	tegra_gpio_enable(NCT1008_THERM2_GPIO);
	gpio_request(NCT1008_THERM2_GPIO, "temp_alert");
	gpio_direction_input(NCT1008_THERM2_GPIO);
}
int __init enterprise_panel_init(void)
{
	int err;
	struct resource __maybe_unused *res;

	bl_output = enterprise_bl_output_measured;

	if (WARN_ON(ARRAY_SIZE(enterprise_bl_output_measured) != 256))
		pr_err("bl_output array does not have 256 elements\n");

	enterprise_dsi.chip_id = tegra_get_chipid();
	enterprise_dsi.chip_rev = tegra_get_revision();

	enterprise_carveouts[1].base = tegra_carveout_start;
	enterprise_carveouts[1].size = tegra_carveout_size;

	tegra_gpio_enable(enterprise_hdmi_hpd);
	gpio_request(enterprise_hdmi_hpd, "hdmi_hpd");
	gpio_direction_input(enterprise_hdmi_hpd);

	tegra_gpio_enable(enterprise_lcd_2d_3d);
	gpio_request(enterprise_lcd_2d_3d, "lcd_2d_3d");
	gpio_direction_output(enterprise_lcd_2d_3d, 0);
	enterprise_stereo_set_mode(enterprise_stereo.mode_2d_3d);

	tegra_gpio_enable(enterprise_lcd_swp_pl);
	gpio_request(enterprise_lcd_swp_pl, "lcd_swp_pl");
	gpio_direction_output(enterprise_lcd_swp_pl, 0);
	enterprise_stereo_set_orientation(enterprise_stereo.orientation);

#if !(DC_CTRL_MODE & TEGRA_DC_OUT_ONE_SHOT_MODE)
	tegra_gpio_enable(enterprise_lcd_te);
	gpio_request(enterprise_lcd_swp_pl, "lcd_te");
	gpio_direction_input(enterprise_lcd_te);
#endif

#ifdef CONFIG_HAS_EARLYSUSPEND
	enterprise_panel_early_suspender.suspend = enterprise_panel_early_suspend;
	enterprise_panel_early_suspender.resume = enterprise_panel_late_resume;
	enterprise_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
	register_early_suspend(&enterprise_panel_early_suspender);
#endif

	err = platform_add_devices(enterprise_gfx_devices,
				ARRAY_SIZE(enterprise_gfx_devices));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = nvhost_get_resource_byname(&enterprise_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;
#endif

	/* Copy the bootloader fb to the fb. */
	tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
		min(tegra_fb_size, tegra_bootloader_fb_size));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if (!err)
		err = nvhost_device_register(&enterprise_disp1_device);

	res = nvhost_get_resource_byname(&enterprise_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err)
		err = nvhost_device_register(&enterprise_disp2_device);
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err)
		err = nvhost_device_register(&nvavp_device);
#endif

	if (!err)
		err = platform_add_devices(enterprise_bl_devices,
				ARRAY_SIZE(enterprise_bl_devices));
	return err;
}
Пример #8
0
static int __devinit sdhci_tegra_probe(struct platform_device *pdev)
{
	struct sdhci_pltfm_host *pltfm_host;
	struct tegra_sdhci_platform_data *plat;
	struct sdhci_host *host;
	struct clk *clk;
	int rc;

	host = sdhci_pltfm_init(pdev, &sdhci_tegra_pdata);
	if (IS_ERR(host))
		return PTR_ERR(host);

	pltfm_host = sdhci_priv(host);

	plat = pdev->dev.platform_data;

	if (plat == NULL) {
		dev_err(mmc_dev(host->mmc), "missing platform data\n");
		rc = -ENXIO;
		goto err_no_plat;
	}

	if (gpio_is_valid(plat->power_gpio)) {
		rc = gpio_request(plat->power_gpio, "sdhci_power");
		if (rc) {
			dev_err(mmc_dev(host->mmc),
				"failed to allocate power gpio\n");
			goto err_power_req;
		}
		tegra_gpio_enable(plat->power_gpio);
		gpio_direction_output(plat->power_gpio, 1);
	}

	if (gpio_is_valid(plat->cd_gpio)) {
		rc = gpio_request(plat->cd_gpio, "sdhci_cd");
		if (rc) {
			dev_err(mmc_dev(host->mmc),
				"failed to allocate cd gpio\n");
			goto err_cd_req;
		}
		tegra_gpio_enable(plat->cd_gpio);
		gpio_direction_input(plat->cd_gpio);

		rc = request_irq(gpio_to_irq(plat->cd_gpio), carddetect_irq,
				 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
				 mmc_hostname(host->mmc), host);

		if (rc)	{
			dev_err(mmc_dev(host->mmc), "request irq error\n");
			goto err_cd_irq_req;
		}

	}

	if (gpio_is_valid(plat->wp_gpio)) {
		rc = gpio_request(plat->wp_gpio, "sdhci_wp");
		if (rc) {
			dev_err(mmc_dev(host->mmc),
				"failed to allocate wp gpio\n");
			goto err_wp_req;
		}
		tegra_gpio_enable(plat->wp_gpio);
		gpio_direction_input(plat->wp_gpio);
	}

	clk = clk_get(mmc_dev(host->mmc), NULL);
	if (IS_ERR(clk)) {
		dev_err(mmc_dev(host->mmc), "clk err\n");
		rc = PTR_ERR(clk);
		goto err_clk_get;
	}
	clk_enable(clk);
	pltfm_host->clk = clk;

	host->mmc->pm_caps = plat->pm_flags;

	if (plat->is_8bit)
		host->mmc->caps |= MMC_CAP_8_BIT_DATA;

	rc = sdhci_add_host(host);
	if (rc)
		goto err_add_host;

	return 0;

err_add_host:
	clk_disable(pltfm_host->clk);
	clk_put(pltfm_host->clk);
err_clk_get:
	if (gpio_is_valid(plat->wp_gpio)) {
		tegra_gpio_disable(plat->wp_gpio);
		gpio_free(plat->wp_gpio);
	}
err_wp_req:
	if (gpio_is_valid(plat->cd_gpio))
		free_irq(gpio_to_irq(plat->cd_gpio), host);
err_cd_irq_req:
	if (gpio_is_valid(plat->cd_gpio)) {
		tegra_gpio_disable(plat->cd_gpio);
		gpio_free(plat->cd_gpio);
	}
err_cd_req:
	if (gpio_is_valid(plat->power_gpio)) {
		tegra_gpio_disable(plat->power_gpio);
		gpio_free(plat->power_gpio);
	}
err_power_req:
err_no_plat:
	sdhci_pltfm_free(pdev);
	return rc;
}
static void enterprise_gps_init(void)
{
	tegra_gpio_enable(TEGRA_GPIO_PE4);
	tegra_gpio_enable(TEGRA_GPIO_PE5);
}
int __init cardhu_panel_init(void)
{
	int err;
	struct resource __maybe_unused *res;

	tegra_get_board_info(&board_info);
	tegra_get_display_board_info(&display_board_info);

	cardhu_carveouts[1].base = tegra_carveout_start;
	cardhu_carveouts[1].size = tegra_carveout_size;

	if (board_info.board_id == BOARD_E1291 &&
		((board_info.sku & SKU_TOUCHSCREEN_MECH_FIX) == 0)) {
		/* use 55Hz panel timings to reduce noise on sensitive touch */
		printk("Using cardhu_panel_modes_55hz\n");
		cardhu_disp1_out.modes = cardhu_panel_modes_55hz;
		cardhu_disp1_out.n_modes = ARRAY_SIZE(cardhu_panel_modes_55hz);
	}

#if defined(CONFIG_TEGRA_DC) && !defined(CONFIG_TEGRA_CARDHU_DSI)
	if (display_board_info.board_id == BOARD_DISPLAY_PM313) {
		/* initialize the values */
#if defined(PM313_LVDS_PANEL_19X12)
		cardhu_disp1_out.modes = panel_19X12_modes;
		cardhu_disp1_out.n_modes = ARRAY_SIZE(panel_19X12_modes);
		cardhu_disp1_out.parent_clk = "pll_d_out0";
#if (PM313_LVDS_PANEL_BPP == 1)
		cardhu_disp1_out.depth = 18;
#else
		cardhu_disp1_out.depth = 24;
#endif
		cardhu_fb_data.xres = 1920;
		cardhu_fb_data.yres = 1200;

		cardhu_disp2_out.parent_clk = "pll_d2_out0";
		cardhu_hdmi_fb_data.xres = 1920;
		cardhu_hdmi_fb_data.yres = 1200;
#endif

		/* lvds configuration */
		err = gpio_request(pm313_R_FDE, "R_FDE");
		err |= gpio_direction_output(pm313_R_FDE, 1);
		tegra_gpio_enable(pm313_R_FDE);

		err |= gpio_request(pm313_R_FB, "R_FB");
		err |= gpio_direction_output(pm313_R_FB, 1);
		tegra_gpio_enable(pm313_R_FB);

		err |= gpio_request(pm313_MODE0, "MODE0");
		err |= gpio_direction_output(pm313_MODE0, 1);
		tegra_gpio_enable(pm313_MODE0);

		err |= gpio_request(pm313_MODE1, "MODE1");
		err |= gpio_direction_output(pm313_MODE1, 0);
		tegra_gpio_enable(pm313_MODE1);

		err |= gpio_request(pm313_BPP, "BPP");
		err |= gpio_direction_output(pm313_BPP, PM313_LVDS_PANEL_BPP);
		tegra_gpio_enable(pm313_BPP);

		err = gpio_request(pm313_lvds_shutdown, "lvds_shutdown");
		/* free ride provided by bootloader */
		err |= gpio_direction_output(pm313_lvds_shutdown, 1);
		tegra_gpio_enable(pm313_lvds_shutdown);

		if (err)
			printk(KERN_ERR "ERROR(s) in LVDS configuration\n");
	}
/*	else if ((display_board_info.board_id == BOARD_DISPLAY_E1247 &&
				board_info.board_id == BOARD_PM269) ||
				(board_info.board_id == BOARD_E1257) ||
				(board_info.board_id == BOARD_PM305) ||
				(board_info.board_id == BOARD_PM311)) {
		gpio_request(e1247_pm269_lvds_shutdown, "lvds_shutdown");
		gpio_direction_output(e1247_pm269_lvds_shutdown, 1);
		tegra_gpio_enable(e1247_pm269_lvds_shutdown);
	} else {
		gpio_request(cardhu_lvds_shutdown, "lvds_shutdown");
		gpio_direction_output(cardhu_lvds_shutdown, 1);
		tegra_gpio_enable(cardhu_lvds_shutdown);
	}
*/
#endif
	tegra_gpio_enable(cardhu_hdmi_enb);
	gpio_request(cardhu_hdmi_enb, "hdmi_5v_en");
	gpio_direction_output(cardhu_hdmi_enb, 1);

	tegra_gpio_enable(cardhu_hdmi_hpd);
	gpio_request(cardhu_hdmi_hpd, "hdmi_hpd");
	gpio_direction_input(cardhu_hdmi_hpd);

#ifdef CONFIG_HAS_EARLYSUSPEND
	cardhu_panel_early_suspender.suspend = cardhu_panel_early_suspend;
	cardhu_panel_early_suspender.resume = cardhu_panel_late_resume;
	cardhu_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
	register_early_suspend(&cardhu_panel_early_suspender);
#endif

	err = platform_add_devices(cardhu_gfx_devices,
				ARRAY_SIZE(cardhu_gfx_devices));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = nvhost_get_resource_byname(&cardhu_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;
#endif

	/* Copy the bootloader fb to the fb. */
	tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
				min(tegra_fb_size, tegra_bootloader_fb_size));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if (!err)
		err = nvhost_device_register(&cardhu_disp1_device);

	res = nvhost_get_resource_byname(&cardhu_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err)
		err = nvhost_device_register(&cardhu_disp2_device);
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err)
		err = nvhost_device_register(&nvavp_device);
#endif
	return err;
}
static int cardhu_dsi_panel_enable(void)
{
	int ret;

	if (cardhu_dsi_reg == NULL) {
		cardhu_dsi_reg = regulator_get(NULL, "avdd_dsi_csi");
		if (IS_ERR_OR_NULL(cardhu_dsi_reg)) {
		pr_err("dsi: Could not get regulator avdd_dsi_csi\n");
			cardhu_dsi_reg = NULL;
			return PTR_ERR(cardhu_dsi_reg);
		}
	}
	regulator_enable(cardhu_dsi_reg);

	ret = gpio_request(TEGRA_GPIO_PJ1, "DSI TE");
	if (ret < 0)
		return ret;

	ret = gpio_direction_input(TEGRA_GPIO_PJ1);
	if (ret < 0) {
		gpio_free(TEGRA_GPIO_PJ1);
		return ret;
	}
	tegra_gpio_enable(TEGRA_GPIO_PJ1);

#if DSI_PANEL_219

	ret = gpio_request(TEGRA_GPIO_PH0, "ph0");
	if (ret < 0)
		return ret;
	ret = gpio_direction_output(TEGRA_GPIO_PH0, 0);
	if (ret < 0) {
		gpio_free(TEGRA_GPIO_PH0);
		return ret;
	}
	else
		tegra_gpio_enable(TEGRA_GPIO_PH0);

	ret = gpio_request(TEGRA_GPIO_PH2, "ph2");
	if (ret < 0)
		return ret;
	ret = gpio_direction_output(TEGRA_GPIO_PH2, 0);
	if (ret < 0) {
		gpio_free(TEGRA_GPIO_PH2);
		return ret;
	}
	else
		tegra_gpio_enable(TEGRA_GPIO_PH2);

	ret = gpio_request(TEGRA_GPIO_PU2, "pu2");
	if (ret < 0)
		return ret;
	ret = gpio_direction_output(TEGRA_GPIO_PU2, 0);
	if (ret < 0) {
		gpio_free(TEGRA_GPIO_PU2);
		return ret;
	}
	else
		tegra_gpio_enable(TEGRA_GPIO_PU2);

	gpio_set_value(cardhu_lvds_shutdown, 1);
	mdelay(20);
	gpio_set_value(TEGRA_GPIO_PH0, 1);
	mdelay(10);
	gpio_set_value(TEGRA_GPIO_PH2, 1);
	mdelay(15);
	gpio_set_value(TEGRA_GPIO_PU2, 0);
	gpio_set_value(TEGRA_GPIO_PU2, 1);
	mdelay(10);
	gpio_set_value(TEGRA_GPIO_PU2, 0);
	mdelay(10);
	gpio_set_value(TEGRA_GPIO_PU2, 1);
	mdelay(15);
#endif

#if DSI_PANEL_218
	printk("DSI_PANEL_218 is enabled\n");
	ret = gpio_request(AVDD_LCD, "avdd_lcd");
	if(ret < 0)
		gpio_free(AVDD_LCD);
	ret = gpio_direction_output(AVDD_LCD, 1);
	if(ret < 0)
		gpio_free(AVDD_LCD);
	else
		tegra_gpio_enable(AVDD_LCD);

#if DSI_PANEL_RESET
	ret = gpio_request(TEGRA_GPIO_PD2, "pd2");
	if (ret < 0){
		return ret;
	}
	ret = gpio_direction_output(TEGRA_GPIO_PD2, 0);
	if (ret < 0) {
		gpio_free(TEGRA_GPIO_PD2);
		return ret;
	}
	else
		tegra_gpio_enable(TEGRA_GPIO_PD2);

	gpio_set_value(TEGRA_GPIO_PD2, 1);
	gpio_set_value(TEGRA_GPIO_PD2, 0);
	mdelay(2);
	gpio_set_value(TEGRA_GPIO_PD2, 1);
	mdelay(2);
#endif
#endif

	return 0;
}
Пример #12
0
static int panel_n1_spi_probe(struct spi_device *spi)
{
	int ret;

	spi->bits_per_word = 9;
	spi->mode = SPI_MODE_3;
	spi->max_speed_hz = 1000000;

	ret = spi_setup(spi);
	if (ret < 0) {
		dev_err(&spi->dev, "spi_setup failed: %d\n", ret);
		return ret;
	}

	printk(KERN_INFO "%s: probe\n", __func__);

	ret = gpio_request(n1_lvds_reset, "lvds_reset");
	if (ret < 0)
		printk(KERN_INFO "%s: gpio_request failed with %d \n", __func__, ret);
	tegra_gpio_enable(n1_lvds_reset);

//LCD_ONOFF_TEST, LCD_TYPE
	tune_lcd_dev = device_create(sec_class, NULL, 0, NULL, "sec_tune_lcd");

	if (IS_ERR(tune_lcd_dev)) 
    	{
		printk("Failed to create device!");
		ret = -1;
	}
//LCD_ONOFF_TEST, LCD_TYPE

#if LCD_ONOFF_TEST
	if (device_create_file(tune_lcd_dev, &dev_attr_lcd_onoff) < 0) {
		printk("Failed to create device file!(%s)!\n", dev_attr_lcd_onoff.attr.name);
		ret = -1;
	}
#endif

#if LCD_TYPE
	if (device_create_file(tune_lcd_dev, &dev_attr_lcdtype) < 0) {
		printk("Failed to create device file!(%s)!\n", dev_attr_lcdtype.attr.name);
		ret = -1;
	}
#endif //LCD_TYPE
	printk(KERN_INFO "%s: device_create_file(tune_lcd_dev, &dev_attr_lcdtype) \n", __func__);

	reg_lcd_1v8 = regulator_get(NULL, "VLCD_1V8");
	if (IS_ERR(reg_lcd_1v8)) {
		printk(KERN_INFO "%s: VLCD_1V8 regulator not found\n", __func__);
		reg_lcd_1v8 = NULL;
	} else {
		regulator_set_voltage(reg_lcd_1v8, 1800*1000,1800*1000);
//		regulator_enable(reg_lcd_1v8);
	}

	reg_lcd_3v0 = regulator_get(NULL, "VLCD_3V0");
	if (IS_ERR(reg_lcd_3v0)) {
		printk(KERN_INFO "%s: VLCD_3V0 regulator not found\n", __func__);
		reg_lcd_3v0 = NULL;
	} else {
		regulator_set_voltage(reg_lcd_3v0, 3000*1000,3000*1000);
//		regulator_enable(reg_lcd_3v0);
	}

	n1_disp1_spi = spi;

	n1_panel_early_suspend.level =  EARLY_SUSPEND_LEVEL_STOP_DRAWING - 1;
//	n1_panel_early_suspend.level =  EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;/* EARLY_SUSPEND_LEVEL_DISABLE_FB; */
//	n1_panel_early_suspend.level =  EARLY_SUSPEND_LEVEL_DISABLE_FB-1;
	n1_panel_early_suspend.suspend = panel_n1_spi_suspend;
	n1_panel_early_suspend.resume = panel_n1_spi_resume;
	register_early_suspend(&n1_panel_early_suspend);
	
	n1_panel_enable();
	muxtex_temp = 2 ;

	return 0;
}
Пример #13
0
static int baseband_init(void)
{
//zte_modify nv patch begin
#if 0
	int irq;
#endif
//zte_modify nv patch end
	int ret;

	ret = gpio_request_array(modem_gpios, ARRAY_SIZE(modem_gpios));
	if (ret)
		return ret;
	//[ECID:000000]ZTEBSP DangXiao 20120206 start, for ACM0 missing patch
	/* enable pull-down for BB_RST_OUT */
	tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_UAC,
				    TEGRA_PUPD_PULL_DOWN);
	//[ECID:000000]ZTEBSP DangXiao 20120206 start, for ACM0 missing patch
	tegra_gpio_enable(MODEM_PWR_ON);
	tegra_gpio_enable(MODEM_RESET);
	tegra_gpio_enable(AP2MDM_ACK2);
//zte_modify nv patch begin
#if 0
	tegra_gpio_enable(BB_RST_OUT);
#endif
//zte_modify nv patch end
	tegra_gpio_enable(AP2MDM_ACK);
	tegra_gpio_enable(MDM2AP_ACK);
	tegra_gpio_enable(TEGRA_GPIO_PY3);
	tegra_gpio_enable(TEGRA_GPIO_PY1);
	tegra_gpio_enable(TEGRA_GPIO_PO1);
	tegra_gpio_enable(TEGRA_GPIO_PO2);

	/* export GPIO for user space access through sysfs */
	gpio_export(MODEM_PWR_ON, false);
//zte_modify nv patch begin
	gpio_export(AP2MDM_ACK2, false);
//zte_modify nv patch end

	/* phy init */
	tegra_start_usb_host();

//zte_modify nv patch begin
#if 0
	wake_lock_init(&mdm_wake_lock, WAKE_LOCK_SUSPEND, "mdm_lock");

	/* enable IRQ for BB_RST_OUT */
	irq = gpio_to_irq(BB_RST_OUT);

	ret = request_threaded_irq(irq, NULL, mdm_start_thread,
				   IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
				   "mdm_start", NULL);
	if (ret < 0) {
		pr_err("%s: request_threaded_irq error\n", __func__);
		return ret;
	}

	ret = enable_irq_wake(irq);
	if (ret) {
		pr_err("%s: enable_irq_wake error\n", __func__);
		free_irq(irq, NULL);
		return ret;
	}
#endif
//zte_modify nv patch end

	return 0;
}
Пример #14
0
static int ifx_spi_probe(struct spi_device *spi)
{
     int status;
     struct ifx_spi_data *spi_data;
     

    spi_data = (struct ifx_spi_data*)kmalloc(sizeof(struct ifx_spi_data), GFP_KERNEL);
    if (!spi_data)
    {    
	IFX_SPI_PRINTK("Failed to allocate memory for spi_data");    
	return -ENOMEM;
    }

     IFX_SPI_PRINTK("start !!");

    //initialize all member variables of ifx_spi_data
    memset((void*)spi_data, 0, sizeof(struct ifx_spi_data));

	spi_data->ifx_tty = NULL;
#ifdef WAKE_LOCK_RESUME
	spi_data->wake_lock_flag = 0;
#endif

    status = ifx_spi_allocate_frame_memory(spi_data, (IFX_SPI_MAX_BUF_SIZE + IFX_SPI_HEADER_SIZE));
    if(status != 0)
    {
	IFX_SPI_PRINTK("Failed to allocate memory for buffers");
 	
	return -ENOMEM;
    }

    dev_set_drvdata(&spi->dev,spi_data);
    spin_lock_init(&spi_data->spi_lock);
    INIT_WORK(&spi_data->ifx_work,ifx_spi_handle_work);   
	
    spi_data->ifx_wq = create_singlethread_workqueue("ifxn721");
    if(!spi_data->ifx_wq)
    {
	IFX_SPI_PRINTK("Failed to setup workqueue - ifx_wq");          
    }
	
	init_completion(&spi_data->ifx_read_write_completion);
	
      //config srdy,mrdy gpio value according to hw revision
       IFX_MRDY = TEGRA_GPIO_PO0;  //ULPI_DATA7
       IFX_SRDY =  TEGRA_GPIO_PO5;  //ULPI_DATA4

        /* Configure SPI */
	spi_data->spi = spi;

	spi->mode = SPI_MODE_1 ;
	spi->bits_per_word = 8; //32 is mdm only
	spi->chip_select = 0 ;
	spi->max_speed_hz = 24000000; //48000000; //to 24Mhz	

	status = spi_setup(spi);
        if(status < 0)
	{
		IFX_SPI_PRINTK("Failed to setup SPI \n");
        }             

#ifdef WAKE_LOCK_RESUME
	wake_lock_init(&spi_data->wake_lock, WAKE_LOCK_SUSPEND, "mspi_wake");
#endif

	gpio_request(IFX_MRDY, "ifx_mrdy");	
 	tegra_gpio_enable(IFX_MRDY);
		
	gpio_request(IFX_SRDY, "ifx_srdy");	
 	tegra_gpio_enable(IFX_SRDY);	
	
	gpio_direction_input(IFX_SRDY);

/* changed to level trigger */

	status = request_irq(gpio_to_irq(IFX_SRDY), 
					    ifx_spi_handle_srdy_irq,
					    IRQF_TRIGGER_RISING, 
					    spi->dev.driver->name, 
					    spi_data);

	if (status != 0)
	{
		IFX_SPI_PRINTK("Failed to request IRQ for SRDY");
		IFX_SPI_PRINTK("IFX SPI Probe Failed");
		ifx_spi_free_frame_memory(spi_data);
		if(spi_data)
		{
			kfree(spi_data);
		}          
	}
 	else
	{
		ifx_gspi_data = spi_data;
	}

	enable_irq_wake(gpio_to_irq(IFX_SRDY)); //wake irq...	
	
	IFX_SPI_PRINTK(" end !!!  ");
	return status;
}
static void ventana_akm8975_init(void)
{
	tegra_gpio_enable(AKM8975_IRQ_GPIO);
	gpio_request(AKM8975_IRQ_GPIO, "akm8975");
	gpio_direction_input(AKM8975_IRQ_GPIO);
}
static int pcbid_init(void)
{
	int ret;

	ret = gpio_request(TEGRA_GPIO_PR4, "PCB_ID0");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PR5, "PCB_ID1");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PQ4, "PCB_ID2");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PQ7, "PCB_ID3");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		gpio_free(TEGRA_GPIO_PQ7);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PR2, "PCB_ID4");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		gpio_free(TEGRA_GPIO_PQ7);
		gpio_free(TEGRA_GPIO_PR2);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PQ5, "PCB_ID5");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		gpio_free(TEGRA_GPIO_PQ7);
		gpio_free(TEGRA_GPIO_PR2);
		gpio_free(TEGRA_GPIO_PQ5);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PJ0, "PCB_ID6");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		gpio_free(TEGRA_GPIO_PQ7);
		gpio_free(TEGRA_GPIO_PR2);
		gpio_free(TEGRA_GPIO_PQ5);
		gpio_free(TEGRA_GPIO_PJ0);
		return ret;
	}

	ret = gpio_request(TEGRA_GPIO_PJ2, "PCB_ID7");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		gpio_free(TEGRA_GPIO_PQ7);
		gpio_free(TEGRA_GPIO_PR2);
		gpio_free(TEGRA_GPIO_PQ5);
		gpio_free(TEGRA_GPIO_PJ0);
		gpio_free(TEGRA_GPIO_PJ2);
		return ret;
        }

	ret = gpio_request(TEGRA_GPIO_PK3, "PCB_ID8");
	if (ret) {
		gpio_free(TEGRA_GPIO_PR4);
		gpio_free(TEGRA_GPIO_PR5);
		gpio_free(TEGRA_GPIO_PQ4);
		gpio_free(TEGRA_GPIO_PQ7);
		gpio_free(TEGRA_GPIO_PR2);
		gpio_free(TEGRA_GPIO_PQ5);
		gpio_free(TEGRA_GPIO_PJ0);
		gpio_free(TEGRA_GPIO_PJ2);
		gpio_free(TEGRA_GPIO_PK3);
		return ret;
        }

	tegra_gpio_enable(TEGRA_GPIO_PR4);
	tegra_gpio_enable(TEGRA_GPIO_PR5);
	tegra_gpio_enable(TEGRA_GPIO_PQ4);
	tegra_gpio_enable(TEGRA_GPIO_PQ7);
	tegra_gpio_enable(TEGRA_GPIO_PR2);
	tegra_gpio_enable(TEGRA_GPIO_PQ5);
	tegra_gpio_enable(TEGRA_GPIO_PJ0);
	tegra_gpio_enable(TEGRA_GPIO_PJ2);
	tegra_gpio_enable(TEGRA_GPIO_PK3);

	gpio_direction_input(TEGRA_GPIO_PR4);
	gpio_direction_input(TEGRA_GPIO_PR5);
	gpio_direction_input(TEGRA_GPIO_PQ4);
	gpio_direction_input(TEGRA_GPIO_PQ7);
	gpio_direction_input(TEGRA_GPIO_PR2);
	gpio_direction_input(TEGRA_GPIO_PQ5);
	gpio_direction_input(TEGRA_GPIO_PJ0);
	gpio_direction_input(TEGRA_GPIO_PJ2);
	gpio_direction_input(TEGRA_GPIO_PK3);

	cardhu_pcbid = (gpio_get_value(TEGRA_GPIO_PK3) << 8) |
			(gpio_get_value(TEGRA_GPIO_PJ2) << 7) |
			(gpio_get_value(TEGRA_GPIO_PJ0) << 6) |
			(gpio_get_value(TEGRA_GPIO_PQ5) << 5) |
			(gpio_get_value(TEGRA_GPIO_PR2) << 4) |
			(gpio_get_value(TEGRA_GPIO_PQ7) << 3) |
			(gpio_get_value(TEGRA_GPIO_PQ4) << 2) |
			(gpio_get_value(TEGRA_GPIO_PR5) << 1) |
			gpio_get_value(TEGRA_GPIO_PR4);
	return 0;
}
static void ventana_bq20z75_init(void)
{
	tegra_gpio_enable(AC_PRESENT_GPIO);
	gpio_request(AC_PRESENT_GPIO, "ac_present");
	gpio_direction_input(AC_PRESENT_GPIO);
}
Пример #18
0
static void __init ast_pinmux_audio_init(void)
{
	tegra_gpio_enable(TEGRA_GPIO_HP_DET);
    tegra_gpio_enable(TEGRA_GPIO_AMIC_DET);
    tegra_gpio_enable(TEGRA_GPIO_LINEOUT_DET);
}
static int
ifx_spi_probe(struct spi_device *spi)
{
	int status;
	struct ifx_spi_data *spi_data;
	/* Allocate SPI driver data */
	spi_data = (struct ifx_spi_data*)kmalloc(sizeof(struct ifx_spi_data), GFP_KERNEL);
	memset(spi_data, 0, sizeof(struct ifx_spi_data)) ;

	if (!spi_data){
		return -ENOMEM;
    }

    status = ifx_spi_allocate_frame_memory(IFX_SPI_MAX_BUF_SIZE + IFX_SPI_HEADER_SIZE);
    if(status != 0){
	printk("File: ifx_n721_spi.c\tFunction: int ifx_spi_probe\tFailed to allocate memory for buffers\n");
	return -ENOMEM;
    }

    dev_set_drvdata(&spi->dev,spi_data);
    spin_lock_init(&spi_data->spi_lock);

    spi_data->ifx_wq = create_singlethread_workqueue("ifxn721");
    if(!spi_data->ifx_wq){
		printk("Failed to setup workqueue - ifx_wq \n");
    }
	INIT_WORK(&spi_data->ifx_work,ifx_spi_handle_work);

	init_completion(&spi_data->ifx_read_write_completion);

        /* Configure SPI */

	spi_data->spi = spi;
#if 1
	// spi->mode = SPI_MODE_1 | SPI_CS_HIGH | SPI_NO_CS;
	spi->mode = SPI_MODE_1 | SPI_CS_HIGH | SPI_NO_CS;
	// spi->mode = SPI_MODE_0 | SPI_CS_HIGH ;
    // spi->bits_per_word = 8;
    spi->bits_per_word = 8;
	spi->max_speed_hz = SPI_CLOCK;
	spi->chip_select = 0 ;
	//spi->irq = gpio_to_irq(TEGRA_GPIO_PO5);//0;
	memcpy(spi->modalias, "ifxn721", sizeof("ifxn721")) ;
//
#endif
	status = spi_setup(spi);
    if(status < 0){
		printk("Failed to setup SPI \n");
    }

// hgahn
//	spi_data->ifx_spi_lock =1;

	/* Enable SRDY Interrupt request - If the SRDY signal is high then ifx_spi_handle_srdy_irq() is called */
	//status = request_irq(spi->irq, ifx_spi_handle_srdy_irq,  IRQF_TRIGGER_RISING, spi->dev.driver->name, spi_data);

	gpio_request(TEGRA_GPIO_PO0, "ifx_mrdy");
 	tegra_gpio_enable(TEGRA_GPIO_PO0);

	gpio_request(TEGRA_GPIO_PO5, "ifx_srdy");
 	tegra_gpio_enable(TEGRA_GPIO_PO5);

	// gpio_set_value(TEGRA_GPIO_PO0, 0);
	gpio_direction_output(TEGRA_GPIO_PO0, 0);

	gpio_direction_input(TEGRA_GPIO_PO5);
	spi->irq = gpio_to_irq(TEGRA_GPIO_PO5) ;

    // enable gpios for modem shutdown
    //tegra_gpio_enable(GPIO_IFX_RESET_1V8_N);
    //tegra_gpio_enable(GPIO_IFX_PWRON_1V8);

    //gpio_request_one(GPIO_IFX_RESET_1V8_N, GPIOF_IN, "modem_reset_n");
    //gpio_request_one(GPIO_IFX_PWRON_1V8, GPIOF_OUT_INIT_HIGH, "modem_pwron");

	spi_data->is_suspend = 0 ;
	spi_data->packet_count = 0 ;
	status = request_irq(spi->irq, ifx_spi_handle_srdy_irq,IRQF_TRIGGER_RISING ,spi->dev.driver->name, spi_data);
	if(is_modem_connected()){
		set_irq_wake(spi->irq, 1);
	}
	else {
		disable_irq(spi->irq);
	}

//20100927-1, [email protected], Hold wake-lock for cp interrupt [START]
#ifdef WAKE_LOCK_RESUME
	wake_lock_init(&spi_data->wake_lock, WAKE_LOCK_SUSPEND, "mspi_wake");
	spi_data->wake_lock_flag = 0;
#endif
//20100927-1, [email protected], Hold wake-lock for cp interrupt [END]

	if (status != 0){
		printk(KERN_ERR "Failed to request IRQ for SRDY\n");
		printk(KERN_ERR "IFX SPI Probe Failed\n");
		if(ifx_tx_buffer){
			kfree(ifx_tx_buffer);
		}
		if(ifx_rx_buffer){
			kfree(ifx_rx_buffer);
		}
		if(spi_data){
			kfree(spi_data);
		}
	}
	else{
		gspi_data = spi_data;
	}
/////////////////////////////////////////////////////////////////////////////////////////////
// jeehp
//        enable_irq_wake(spi->irq);
////////////////////////////////////////////////////////////////////////////////////////////
	printk("**** %s \n",__FUNCTION__);
	return status;
}
Пример #20
0
static int cpcap_usb_connected_probe(struct platform_device *pdev)
{
/*	struct cpcap_usb_connected_data *data;*/
	struct cpcap_accy_platform_data *pdata = pdev->dev.platform_data;

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

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

	data->accy = pdata->accy;



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

try_f7:

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

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

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

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

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

	platform_set_drvdata(pdev, pdata);

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

	return 0;
}
Пример #21
0
static int vibrator_probe(struct platform_device *pdev)
{
	struct vibrator_platform_data *pdata = pdev->dev.platform_data;
	struct vibrator *vib;
	int rc=0;

	D("vibrator_probe +++\n");
	if (!pdata)
		return -EINVAL;
	vib=kzalloc(sizeof(struct vibrator), GFP_KERNEL);
	if (!vib)
		return -ENOMEM;
	vib->pdata=kzalloc(sizeof(struct vibrator_platform_data), GFP_KERNEL);
	if(!(vib->pdata)){
		rc = -ENOMEM;
		pr_err("[VIB] %s: failed on allocate pm8xxx_pwm_data memory\n", __func__);
		goto err_platform_data_allocate;
	}
	vib_state = 0;
	vib->pdata->pwm_gpio = pdata->pwm_gpio;
	vib->pdata->ena_gpio = pdata->ena_gpio;
	vib->pdata->pwm_data.name = pdata->pwm_data.name;
	vib->pdata->pwm_data.bank = pdata->pwm_data.bank;
	vib->pwm_duty = PLAYBACK_DUTY_US;
	INIT_WORK(&vib->work, vib_work_func);
	INIT_WORK(&vib->work_feedback, vib_work_feedback_func);
	hrtimer_init(&vib->vib_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	vib->vib_timer.function = vib_timer_func;
	hrtimer_init(&vib->vib_timer_stop, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	vib->vib_timer_stop.function = vib_timer_stop_func;
	hrtimer_init(&vib->vib_timer_feedback, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	vib->vib_timer_feedback.function = vib_timer_feedback_func;

	vib->pdata->pwm_data.pwm_dev = pwm_request(vib->pdata->pwm_data.bank, "vibrator");

	if(vib->pdata->ena_gpio >= 0) {
		rc = gpio_request(vib->pdata->ena_gpio, "vibrator_ena");
		if (rc) {
			rc = -ENOMEM;
			pr_err("[VIB] request ena gpio fail\n");
		}
		rc = gpio_direction_output(vib->pdata->ena_gpio,0);
		if(rc<0){
			pr_err("[VIB] set gpio output direction fail\n");
			goto err_ena_output;
		}
		tegra_gpio_enable(vib->pdata->ena_gpio);
	}

	if(vib->pdata->pwm_gpio >= 0) {
		rc = gpio_request(vib->pdata->pwm_gpio, "vibrator_pwm");
		if (rc) {
			rc = -ENOMEM;
			pr_err("[VIB] request pwm gpio fail\n");
		}
		regulator = regulator_get(NULL, "v_vib_3v");
		if( (regulator==NULL) || (IS_ERR(regulator)) )
			pr_err("[VIB] Fail to get regulator: v_vib_3v");
	} else {
		regulator = regulator_get(NULL, "v_vib_1v6");
		if( (regulator==NULL) || (IS_ERR(regulator)) )
			pr_err("[VIB] Fail to get regulator: v_vib_1v6");
	}

	vib->timed_dev.name = "vibrator";
	vib->timed_dev.get_time = vibrator_get_time;
	vib->timed_dev.enable = vibrator_enable;

	rc = timed_output_dev_register(&vib->timed_dev);
	if (rc){
			pr_err("[VIB] timed_output_dev_register failed.\n");
	}
	if(vib->pdata->pwm_gpio >= 0) {
		rc = device_create_file(vib->timed_dev.dev, &dev_attr_dutycycle);
		if (rc){
			pr_err("[VIB] fail to add dutycycle attribute.\n");
			goto err_create_file;
		}
	}
	vib_work_queue = create_workqueue("vib");
	if (!vib_work_queue)
		goto err_create_file;

	vib_work_feedback_queue = create_workqueue("vib_feedback");
	if (!vib_work_feedback_queue)
		goto err_create_file;

	g_vib = vib;
	g_vib->pwm_duty = PLAYBACK_DUTY_US;
	platform_set_drvdata(pdev, vib);

	D("vibrator_probe ---\n");
	return 0;

err_create_file:
	timed_output_dev_unregister(&vib->timed_dev);
err_ena_output:
	gpio_free(vib->pdata->ena_gpio);
	gpio_free(vib->pdata->pwm_gpio);
err_platform_data_allocate:
	kfree(vib);
	D("%s error\n",__func__);
	return rc;
}
Пример #22
0
/* should call only one time */
static int __htc_get_pcbid_info(void)
{
#if defined(CONFIG_MACH_ENDEAVORU) || defined(CONFIG_MACH_ENDEAVORTD)
	switch (pcbid)
	{
		case 0:
			return PROJECT_PHASE_XA;
		case 1:
			return PROJECT_PHASE_XB;
		case 2:
			return PROJECT_PHASE_XC;
		case 3:
			return PROJECT_PHASE_XD;
		case 4:
			return PROJECT_PHASE_XE;
		case 5:
			return PROJECT_PHASE_XF;
		case 6:
			return PROJECT_PHASE_XG;
		case 7:
			return PROJECT_PHASE_XH;
		default:
			return pcbid;
	}

#elif defined(CONFIG_MACH_QUATTRO_U) || defined(CONFIG_MACH_VERTEXF)
	int err;
	int pinSixValue   = 0;
	int pinSevenValue = 0;

	switch (pcbid)
	{
		case 0:
		case 1:
			break;
		case 2:
			return PROJECT_PHASE_XC;
		case 3:
			return PROJECT_PHASE_XD;
		case 4:
			return PROJECT_PHASE_XE;
		case 5:
			return PROJECT_PHASE_XF;
		case 6:
			return PROJECT_PHASE_XG;
		case 7:
			return PROJECT_PHASE_XH;
		default:
			return pcbid;
	}

	static const struct gpio pcbid_info_gpios[] = {
		{ TEGRA_GPIO_PG6, GPIOF_IN, "TEGRA_GPIO_PG6" },
		{ TEGRA_GPIO_PG7, GPIOF_IN, "TEGRA_GPIO_PG7" },
	};
	err = gpio_request_array(pcbid_info_gpios,
		ARRAY_SIZE(pcbid_info_gpios));
	if (err < 0) {
		pr_err("%s - gpio_request_array failed\n", __func__);
		return PROJECT_PHASE_INVALID;
	}
	tegra_gpio_enable(TEGRA_GPIO_PG6);
	tegra_gpio_enable(TEGRA_GPIO_PG7);

	pinSixValue   = gpio_get_value(TEGRA_GPIO_PG6);
	pinSevenValue = gpio_get_value(TEGRA_GPIO_PG7);

#ifdef DEBUG_GET_PROJ_PHASE
	pr_info("pinSixValue: %d\n", pinSixValue);
	pr_info("pinSevenValue: %d\n", pinSevenValue);
	pr_info("engineer_id: %d\n", engineer_id);
#endif

	switch (engineer_id) {
		case 0x0:
			if (pinSixValue & pinSevenValue)
				return PROJECT_PHASE_XA;
			else
				return PROJECT_PHASE_EVM;
		case ENGID_XB:
			return PROJECT_PHASE_XB;
		default:
			return PROJECT_PHASE_INVALID;
	}
#endif
}
int __init acer_panel_init(void)
{
	int err;
	struct resource *res;

	tegra_get_board_info(&board_info);

	acer_carveouts[1].base = tegra_carveout_start;
	acer_carveouts[1].size = tegra_carveout_size;

	tegra_gpio_enable(LVDS_SHUTDOWN);
	tegra_gpio_enable(LCD_VDD);
	tegra_gpio_enable(LCD_CABC);
	tegra_gpio_enable(BL_ENABLE);
#if defined(CONFIG_TEGRA_HDMI)
	tegra_gpio_enable(HDMI_HPD);
#endif
	gpio_request(LVDS_SHUTDOWN, "lvds_shutdown");
	gpio_request(LCD_VDD, "lcd_vdd");
	gpio_request(LCD_CABC, "lcd_cabc");
	gpio_request(BL_ENABLE, "bl_enable");
#if defined(CONFIG_TEGRA_HDMI)
	gpio_request(HDMI_HPD, "hdmi_hpd");
#endif

	gpio_direction_output(LVDS_SHUTDOWN,1);
	gpio_direction_output(LCD_VDD, 1);
	gpio_direction_output(LCD_CABC,0);
	gpio_direction_output(BL_ENABLE,1);

#if defined(CONFIG_TEGRA_HDMI)
	tegra_gpio_enable(HDMI_5V);
	err = gpio_request(HDMI_5V, "hdmi_5V_enable");
	if (err) {
		pr_err("[HDMI] request 5V_enable failed\n");
	}
#if HDMI_5V_ALWAYS_ON
	err = gpio_direction_output(HDMI_5V, 1);
#else
	err = gpio_direction_output(HDMI_5V, 0);
#endif
	if (err) {
		pr_err("[HDMI] failed to set direction of hdmi_5V_enable\n");
	}
#endif

#ifdef CONFIG_HAS_EARLYSUSPEND
	acer_panel_early_suspender.suspend = acer_panel_early_suspend;
	acer_panel_early_suspender.resume = acer_panel_late_resume;
	acer_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB;
	register_early_suspend(&acer_panel_early_suspender);
#endif

	err = platform_add_devices(acer_gfx_devices,
			ARRAY_SIZE(acer_gfx_devices));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if (acer_board_type == BOARD_PICASSO_M){
		res = nvhost_get_resource_byname(&acer_pm_disp1_device,
				IORESOURCE_MEM, "fbmem");
	}else{
		res = nvhost_get_resource_byname(&acer_p2_disp1_device,
				IORESOURCE_MEM, "fbmem");
	}
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;
#endif

	/* Copy the bootloader fb to the fb. */
	tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start,
				min(tegra_fb_size, tegra_bootloader_fb_size));

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	if(!err){
		if (acer_board_type == BOARD_PICASSO_M) {
			err = nvhost_device_register(&acer_pm_disp1_device);
		}else{
			err = nvhost_device_register(&acer_p2_disp1_device);
		}
	}
#if defined(CONFIG_TEGRA_HDMI)
	res = nvhost_get_resource_byname(&acer_disp2_device,
				IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err)
		err = nvhost_device_register(&acer_disp2_device);
#endif
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err)
		err = nvhost_device_register(&nvavp_device);
#endif
	return err;
}
static int enterprise_dsi_panel_enable(void)
{
	int ret;
	struct board_info board_info;

	tegra_get_board_info(&board_info);

	if (enterprise_dsi_reg == NULL) {
		enterprise_dsi_reg = regulator_get(NULL, "avdd_dsi_csi");
		if (IS_ERR_OR_NULL(enterprise_dsi_reg)) {
			pr_err("dsi: Could not get regulator avdd_dsi_csi\n");
				enterprise_dsi_reg = NULL;
				return PTR_ERR(enterprise_dsi_reg);
		}
	}
	ret = regulator_enable(enterprise_dsi_reg);
	if (ret < 0) {
		printk(KERN_ERR
			"DSI regulator avdd_dsi_csi could not be enabled\n");
		return ret;
	}

#if DSI_PANEL_RESET

	if (board_info.fab >= BOARD_FAB_A03) {
		if (enterprise_lcd_reg == NULL) {
			enterprise_lcd_reg = regulator_get(NULL, "lcd_vddio_en");
			if (IS_ERR_OR_NULL(enterprise_lcd_reg)) {
				pr_err("Could not get regulator lcd_vddio_en\n");
				ret = PTR_ERR(enterprise_lcd_reg);
				enterprise_lcd_reg = NULL;
				return ret;
			}
		}
		if (enterprise_lcd_reg != NULL) {
			ret = regulator_enable(enterprise_lcd_reg);
			if (ret < 0) {
				pr_err("Could not enable lcd_vddio_en\n");
				return ret;
			}
		}
	}

	if (kernel_1st_panel_init != true) {
		ret = gpio_request(enterprise_dsi_panel_reset, "panel reset");
		if (ret < 0)
			return ret;

		ret = gpio_direction_output(enterprise_dsi_panel_reset, 0);
		if (ret < 0) {
			gpio_free(enterprise_dsi_panel_reset);
			return ret;
		}
		tegra_gpio_enable(enterprise_dsi_panel_reset);

		gpio_set_value(enterprise_dsi_panel_reset, 0);
		udelay(2000);
		gpio_set_value(enterprise_dsi_panel_reset, 1);
		mdelay(20);
	}
#endif

	return ret;
}
Пример #25
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();
}
static void p3_ak8975_init(void)
{
	tegra_gpio_enable(GPIO_AK8975_INT);
	gpio_request(GPIO_AK8975_INT, "ak8975c_int");
	gpio_direction_input(GPIO_AK8975_INT);
}
static void n1_nct1008_init(void)
{
	tegra_gpio_enable(GPIO_nTHRM_IRQ);
	gpio_request(GPIO_nTHRM_IRQ, "temp_alert");
	gpio_direction_input(GPIO_nTHRM_IRQ);
}
static void p3_mpu3050_init(void)
{
	tegra_gpio_enable(GPIO_MPU_INT);
	gpio_request(GPIO_MPU_INT, "mpu3050_int");
	gpio_direction_input(GPIO_MPU_INT);
}
static int headsetdet_probe(struct platform_device *pdev)
{
	struct gpio_switch_platform_data *pdata = pdev->dev.platform_data;
	struct headset_switch_data *switch_data;
	int ret = 0;
	int error;
	int temp_value;

	printk( "[%s] \n", __FUNCTION__);

	if (!pdata)
		return -EBUSY;
	switch_data = kzalloc(sizeof(struct headset_switch_data), GFP_KERNEL);
	if (!switch_data)
		return -ENOMEM;

	switch_data->sdev.name = "h2w";//&pdata->name;
	switch_data->sdev.print_name = startablet_print_name;
	switch_data->gpio = &pdata->gpio;
	switch_data->name_on = &pdata->name_on;
	switch_data->name_off = &pdata->name_off;
	switch_data->state_on = &pdata->state_on;
	switch_data->state_off = &pdata->state_off;
//	switch_data->sdev.print_state = switch_gpio_print_state;


	printk(KERN_ERR "##(Headset_det.c)## headsetdet_probe() => headset detection register_dev started..!!\n");	//20100421 [email protected] [LGE]

    ret = switch_dev_register(&switch_data->sdev);	//20100421 [email protected] Headset Detection by Headset Observer [LGE]
	if (ret < 0)
		goto err_switch_dev_register;

	printk(KERN_ERR "##(Headset_det.c)## headset detection - switch device registered..!!\n");	//20100421 [email protected] [LGE]




	gpio_request(TEGRA_GPIO_PX6, "hc_mic_bias");
	tegra_gpio_enable(TEGRA_GPIO_PX6);
	gpio_direction_output(TEGRA_GPIO_PX6,0);
	temp_value = gpio_get_value(TEGRA_GPIO_PX6);
	printk("hc_mic_bias output temp_value %d\n",temp_value);


	switch_data->irq = gpio_to_irq(TEGRA_GPIO_PW3);

	gpio_request(TEGRA_GPIO_PW3, "headset_det");
	tegra_gpio_enable(TEGRA_GPIO_PW3);
	gpio_direction_input(TEGRA_GPIO_PW3);

/*====================== nVidia GPIO Control(S) =======================*/

	INIT_WORK(&switch_data->work, headset_det_work);

	INIT_DELAYED_WORK(&switch_data->delayed_work, type_det_work);
	printk(KERN_ERR "##(Headset_det.c)## headset detection - INIT_WORK() & INIT_DELAYED_WORK() success..!!\n");	//20100421 [email protected] [LGE]

	error = request_irq(switch_data->irq, headset_int_handler, (IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING), "headset_det",switch_data);

	printk(KERN_ERR "##(Headset_det.c)## headset detection - NvOdmGpioInterruptRegister() success..!!\n");	//20100421 [email protected] [LGE]

/*====================== nVidia GPIO Control(E) =======================*/

	/* Perform initial detection */
	headset_sw_data = switch_data;
	type_det_work(&switch_data->work);
	printk(KERN_ERR "##(Headset_det.c)## headset detection - headset_det_work() first detection - success..!!\n"); //20100421 [email protected] [LGE]

	return 0;

err_open_gpio_fail:
    switch_dev_unregister(&switch_data->sdev);
err_switch_dev_register:
	kfree(switch_data);
err_open_gpio_pin_acquire_fail:

err_get_interrupt_handler:

	return ret;
}
static void antares_isl29018_init(void)
{
	tegra_gpio_enable(ISL29018_IRQ_GPIO);
	gpio_request(ISL29018_IRQ_GPIO, "isl29018");
	gpio_direction_input(ISL29018_IRQ_GPIO);
}