Esempio n. 1
0
static void __init
palmz71_gpio_setup(int early)
{
	if (early) {
		/* Only set GPIO1 so we have a working serial */
		omap_set_gpio_dataout(1, 1);
		omap_set_gpio_direction(1, 0);
	} else {
		/* Set MMC/SD host WP pin as input */
		if (omap_request_gpio(PALMZ71_MMC_WP_GPIO)) {
			printk(KERN_ERR "Could not reserve WP GPIO!\n");
			return;
		}
		omap_set_gpio_direction(PALMZ71_MMC_WP_GPIO, 1);

		/* Monitor the Power-cable-connected signal */
		if (omap_request_gpio(PALMZ71_USBDETECT_GPIO)) {
			printk(KERN_ERR
				"Could not reserve cable signal GPIO!\n");
			return;
		}
		omap_set_gpio_direction(PALMZ71_USBDETECT_GPIO, 1);
		if (request_irq(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO),
				palmz71_powercable, IRQF_SAMPLE_RANDOM,
				"palmz71-cable", 0))
			printk(KERN_ERR
					"IRQ request for power cable failed!\n");
		palmz71_powercable(OMAP_GPIO_IRQ(PALMZ71_USBDETECT_GPIO), 0);
	}
}
Esempio n. 2
0
void dp3t_switch_ctrl(DP3T_MODE_TYPE mode)
{
	omap_set_gpio_direction(UART_SW1_GPIO, 0);
	omap_set_gpio_direction(UART_SW2_GPIO, 0);

	if (mode == DP3T_S1_AP_UART) {
		ifx_vbus_ctrl(0);
		omap_set_gpio_dataout(UART_SW1_GPIO, 1);
		omap_set_gpio_dataout(UART_SW2_GPIO, 0);
	} else if (mode == DP3T_S2_CP_UART) {
		ifx_vbus_ctrl(0);
		omap_set_gpio_dataout(UART_SW1_GPIO, 0);
		omap_set_gpio_dataout(UART_SW2_GPIO, 1);
	} else if (mode == DP3T_S3_CP_USB) {
		ifx_vbus_ctrl(1);
		omap_set_gpio_dataout(UART_SW1_GPIO, 1);
		omap_set_gpio_dataout(UART_SW2_GPIO, 1);
	} else {
		ifx_vbus_ctrl(0);
		omap_set_gpio_dataout(UART_SW1_GPIO, 0);
		omap_set_gpio_dataout(UART_SW2_GPIO, 0);
	}
	
	dp3t_mode = mode;
}
Esempio n. 3
0
static int omap3evm_panel_init(struct lcd_panel *panel,
				struct omapfb_device *fbdev)
{
	omap_request_gpio(LCD_PANEL_LR);
	omap_request_gpio(LCD_PANEL_UD);
	omap_request_gpio(LCD_PANEL_INI);
	omap_request_gpio(LCD_PANEL_RESB);
	omap_request_gpio(LCD_PANEL_QVGA);

	omap_set_gpio_direction(LCD_PANEL_LR, 0);
	omap_set_gpio_direction(LCD_PANEL_UD, 0);
	omap_set_gpio_direction(LCD_PANEL_INI, 0);
	omap_set_gpio_direction(LCD_PANEL_RESB, 0);
	omap_set_gpio_direction(LCD_PANEL_QVGA, 0);

	twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
	twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
	twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
	bklight_level = 100;

	omap_set_gpio_dataout(LCD_PANEL_RESB, 1);
	omap_set_gpio_dataout(LCD_PANEL_INI, 1);
	omap_set_gpio_dataout(LCD_PANEL_QVGA, 0);
	omap_set_gpio_dataout(LCD_PANEL_LR, 1);
	omap_set_gpio_dataout(LCD_PANEL_UD, 1);

	return 0;
}
Esempio n. 4
0
/*
 * Routine: get_board_revision
 * Description: Returns the board revision
 */
int get_board_revision(void) {
    int revision;

    if (!omap_request_gpio(126) && !omap_request_gpio(127) &&
            !omap_request_gpio(128) && !omap_request_gpio(129)) {

        omap_set_gpio_direction(126, 1);
        omap_set_gpio_direction(127, 1);
        omap_set_gpio_direction(128, 1);
        omap_set_gpio_direction(129, 1);

        revision = 0;
        if (omap_get_gpio_datain(126) == 0)
            revision += 1;
        if (omap_get_gpio_datain(127) == 0)
            revision += 2;
        if (omap_get_gpio_datain(128) == 0)
            revision += 4;
        if (omap_get_gpio_datain(129) == 0)
            revision += 8;

        omap_free_gpio(126);
        omap_free_gpio(127);
        omap_free_gpio(128);
        omap_free_gpio(129);
    } else {
        printf("Error: unable to acquire board revision GPIOs\n");
        revision=-1;
    }

    return revision;
}
Esempio n. 5
0
File: beagle.c Progetto: NVSL/MingII
/*
 * Routine: get_board_revision
 * Description: Detect if we are running on a Beagle revision Ax/Bx,
 *		C1/2/3, C4 or xM. This can be done by reading
 *		the level of GPIO173, GPIO172 and GPIO171. This should
 *		result in
 *		GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
 *		GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
 *		GPIO173, GPIO172, GPIO171: 1 0 1 => C4
 *		GPIO173, GPIO172, GPIO171: 0 0 0 => xM
 */
int get_board_revision(void)
{
	int revision;

	if (!omap_request_gpio(171) &&
	    !omap_request_gpio(172) &&
	    !omap_request_gpio(173)) {

		omap_set_gpio_direction(171, 1);
		omap_set_gpio_direction(172, 1);
		omap_set_gpio_direction(173, 1);

		revision = omap_get_gpio_datain(173) << 2 |
			   omap_get_gpio_datain(172) << 1 |
			   omap_get_gpio_datain(171);

		omap_free_gpio(171);
		omap_free_gpio(172);
		omap_free_gpio(173);
	} else {
		printf("Error: unable to acquire board revision GPIOs\n");
		revision = -1;
	}

	return revision;
}
Esempio n. 6
0
/*
 * Routine: get_sdio2_config
 * Description: Return information about the wifi module connection
 *              Returns 0 if the module connects though a level translator
 *              Returns 1 if the module connects directly
 */
int get_sdio2_config(void) {
    int sdio_direct;

    if (!omap_request_gpio(130) && !omap_request_gpio(139)) {

        omap_set_gpio_direction(130, 0);
        omap_set_gpio_direction(139, 1);

        sdio_direct = 1;
        omap_set_gpio_dataout(130, 0);
        if (omap_get_gpio_datain(139) == 0) {
            omap_set_gpio_dataout(130, 1);
            if (omap_get_gpio_datain(139) == 1)
                sdio_direct = 0;
        }

        omap_free_gpio(130);
        omap_free_gpio(139);
    } else {
        printf("Error: unable to acquire sdio2 clk GPIOs\n");
        sdio_direct=-1;
    }

    return sdio_direct;
}
Esempio n. 7
0
static void __init apollon_sw_init(void)
{
	/* Enter SW - Y11 */
	omap_cfg_reg(Y11_242X_GPIO16);
	omap_request_gpio(SW_ENTER_GPIO16);
	omap_set_gpio_direction(SW_ENTER_GPIO16, 1);
	/* Up SW - AA12 */
	omap_cfg_reg(AA12_242X_GPIO17);
	omap_request_gpio(SW_UP_GPIO17);
	omap_set_gpio_direction(SW_UP_GPIO17, 1);
	/* Down SW - AA8 */
	omap_cfg_reg(AA8_242X_GPIO58);
	omap_request_gpio(SW_DOWN_GPIO58);
	omap_set_gpio_direction(SW_DOWN_GPIO58, 1);

	set_irq_type(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), IRQT_RISING);
	if (request_irq(OMAP_GPIO_IRQ(SW_ENTER_GPIO16), &apollon_sw_interrupt,
				IRQF_SHARED, "enter sw",
				&apollon_sw_interrupt))
		return;
	set_irq_type(OMAP_GPIO_IRQ(SW_UP_GPIO17), IRQT_RISING);
	if (request_irq(OMAP_GPIO_IRQ(SW_UP_GPIO17), &apollon_sw_interrupt,
				IRQF_SHARED, "up sw",
				&apollon_sw_interrupt))
		return;
	set_irq_type(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), IRQT_RISING);
	if (request_irq(OMAP_GPIO_IRQ(SW_DOWN_GPIO58), &apollon_sw_interrupt,
				IRQF_SHARED, "down sw",
				&apollon_sw_interrupt))
		return;
}
Esempio n. 8
0
// LCD configuration
//
static void lcd_config(void)
{
	u32 ident_lcd 	= 0;

	ident_lcd |= 1;
	printf("LCD panel %x: %s\n", ident_lcd,
								 (ident_lcd == 0)?"WINTEK 4.3 controlled via 3-wire":
								 (ident_lcd == 1)?"S070WV95 7\"":
								 (ident_lcd == 2)?"Dastek 4.3":"unknown");

	ident_lcd	+= 'A';
	set_lcd_env(ident_lcd);

	omap_request_gpio(164); // power on display buffer
	omap_request_gpio(104); // enable display buffer

	omap_set_gpio_dataout(164, 1);
	omap_set_gpio_direction(164, 0);
	omap_set_gpio_dataout(104, 0);
	omap_set_gpio_direction(104, 0);

	omap_free_gpio(104);
	omap_free_gpio(164);

	drv_lcd_init(); // initialize LCD interface
	printf("%s: done\n", __func__);
}
Esempio n. 9
0
void init_board_gpios()
{
	/* Leave tvp5150 enable and reset pins in a consistent state */
	omap_request_gpio(163);
	omap_request_gpio(164);
	omap_set_gpio_direction(163,0);
	omap_set_gpio_direction(164,0);
	omap_set_gpio_dataout(163,1);
	omap_set_gpio_dataout(164,0);
	return;
}
Esempio n. 10
0
void blue_LED_off (void)
{
	/* blue */
	if (!omap_request_gpio(ZOOM2_LED_BLUE)) {
		omap_set_gpio_direction(ZOOM2_LED_BLUE, 0);
		omap_set_gpio_dataout(ZOOM2_LED_BLUE, 0);
	}

	/* blue 2 */
	if (!omap_request_gpio(ZOOM2_LED_BLUE2)) {
		omap_set_gpio_direction(ZOOM2_LED_BLUE2, 0);
		omap_set_gpio_dataout(ZOOM2_LED_BLUE2, 0);
	}
	saved_state[STATUS_LED_BLUE] = STATUS_LED_OFF;
}
Esempio n. 11
0
File: leds.c Progetto: 274914765/C
static int __init
omap_leds_init(void)
{
    if (machine_is_omap_innovator())
        leds_event = innovator_leds_event;

    else if (machine_is_omap_h2()
            || machine_is_omap_h3()
            || machine_is_omap_perseus2())
        leds_event = h2p2_dbg_leds_event;

    else if (machine_is_omap_osk())
        leds_event = osk_leds_event;

    else
        return -1;

    if (machine_is_omap_h2()
            || machine_is_omap_h3()
#ifdef    CONFIG_OMAP_OSK_MISTRAL
            || machine_is_omap_osk()
#endif
            ) {

        /* LED1/LED2 pins can be used as GPIO (as done here), or by
         * the LPG (works even in deep sleep!), to drive a bicolor
         * LED on the H2 sample board, and another on the H2/P2
         * "surfer" expansion board.
         *
         * The same pins drive a LED on the OSK Mistral board, but
         * that's a different kind of LED (just one color at a time).
         */
        omap_cfg_reg(P18_1610_GPIO3);
        if (omap_request_gpio(3) == 0)
            omap_set_gpio_direction(3, 0);
        else
            printk(KERN_WARNING "LED: can't get GPIO3/red?\n");

        omap_cfg_reg(MPUIO4);
        if (omap_request_gpio(OMAP_MPUIO(4)) == 0)
            omap_set_gpio_direction(OMAP_MPUIO(4), 0);
        else
            printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
    }

    leds_event(led_start);
    return 0;
}
Esempio n. 12
0
/*
 * Routine: setup_net_chip
 * Description: Setting up the configuration GPMC registers specific to the
 *	      Ethernet hardware.
 */
static void setup_net_chip(void)
{
	struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;

	/* Configure GPMC registers */
	writel(NET_LAN9221_GPMC_CONFIG1, &gpmc_cfg->cs[5].config1);
	writel(NET_LAN9221_GPMC_CONFIG2, &gpmc_cfg->cs[5].config2);
	writel(NET_LAN9221_GPMC_CONFIG3, &gpmc_cfg->cs[5].config3);
	writel(NET_LAN9221_GPMC_CONFIG4, &gpmc_cfg->cs[5].config4);
	writel(NET_LAN9221_GPMC_CONFIG5, &gpmc_cfg->cs[5].config5);
	writel(NET_LAN9221_GPMC_CONFIG6, &gpmc_cfg->cs[5].config6);
	writel(NET_LAN9221_GPMC_CONFIG7, &gpmc_cfg->cs[5].config7);

	/* Enable off mode for NWE in PADCONF_GPMC_NWE register */
	writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
	/* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
	writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
	/* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
	writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
		&ctrl_base->gpmc_nadv_ale);

	/* Make GPIO 64 as output pin and send a magic pulse through it */
	if (!omap_request_gpio(64)) {
		omap_set_gpio_direction(64, 0);
		omap_set_gpio_dataout(64, 1);
		udelay(1);
		omap_set_gpio_dataout(64, 0);
		udelay(1);
		omap_set_gpio_dataout(64, 1);
	}
}
Esempio n. 13
0
void __init n800_usb_init(void)
{
	int ret = 0;
	static char	announce[] __initdata = KERN_INFO "TUSB 6010\n";

	/* PM companion chip power control pin */
	ret = omap_request_gpio(GPIO_TUSB_ENABLE);
	if (ret != 0) {
		printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
		       GPIO_TUSB_ENABLE);
		return;
	}
	omap_set_gpio_direction(GPIO_TUSB_ENABLE, 0);

	tusb_set_power(0);

	ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
					TUSB_ASYNC_CS, TUSB_SYNC_CS,
					GPIO_TUSB_INT, 0x3f);
	if (ret != 0)
		goto err;

	printk(announce);

	return;

err:
	omap_free_gpio(GPIO_TUSB_ENABLE);
}
Esempio n. 14
0
static void setup_net_chip(void)
{
	struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;

	enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
			GPMC_SIZE_16M);

	/* Enable off mode for NWE in PADCONF_GPMC_NWE register */
	writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
	/* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
	writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
	/* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
	writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
		&ctrl_base->gpmc_nadv_ale);

	/* Make GPIO 64 as output pin and send a magic pulse through it */
	if (!omap_request_gpio(64)) {
		omap_set_gpio_direction(64, 0);
		omap_set_gpio_dataout(64, 1);
		udelay(1);
		omap_set_gpio_dataout(64, 0);
		udelay(1);
		omap_set_gpio_dataout(64, 1);
	}
}
Esempio n. 15
0
static inline void __init sdp3430_init_smc91x(void)
{
	int eth_cs;
	unsigned long cs_mem_base;
	int eth_gpio = 0;

	eth_cs = SDP3430_SMC91X_CS;

	if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) {
		printk(KERN_ERR "Failed to request GPMC mem for smc91x\n");
		return;
	}

	sdp3430_smc91x_resources[0].start = cs_mem_base + 0x0;
	sdp3430_smc91x_resources[0].end   = cs_mem_base + 0xf;
	udelay(100);

	if (is_sil_rev_greater_than(OMAP3430_REV_ES1_0))
		eth_gpio = OMAP34XX_ETHR_GPIO_IRQ_SDPV2;
	else
		eth_gpio = OMAP34XX_ETHR_GPIO_IRQ_SDPV1;

	sdp3430_smc91x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);

	if (omap_request_gpio(eth_gpio) < 0) {
		printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
			eth_gpio);
		return;
	}
	omap_set_gpio_direction(eth_gpio, 1);
}
Esempio n. 16
0
static int  __init osk_ts_probe(struct omap_ts_t *ts)
{
#ifdef	CONFIG_OMAP_OSK_MISTRAL
	if (!machine_is_omap_osk())
		return -ENODEV;

        /* Configure GPIO4 (pin M17 ZDY) as /PENIRQ interrupt input */
        omap_cfg_reg(P20_1610_GPIO4);
	omap_request_gpio(4);
	omap_set_gpio_direction(4, 1);
	set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING);

	ts->irq = PEN_IRQ;

	/* Configure uWire interface. ADS7846 is on CS0 */
	omap_uwire_configure_mode(ADS7846_UWIRE_CS, UWIRE_READ_RISING_EDGE |
		                                    UWIRE_WRITE_RISING_EDGE |
		                                    UWIRE_CS_ACTIVE_LOW |
				                    UWIRE_FREQ_DIV_2);

	/* FIXME verify there's really a Mistral board:
	 * see if the AD7846 chip responds.
	 */

	/* NOTE:  no VREF; must ignore the temp, VBAT, and AUX sensors */
	return 0;
#else
	return -ENODEV;
#endif
}
Esempio n. 17
0
/**
 * Reset the ethernet chip.
 */
static void reset_net_chip(void)
{
	int ret;
	int rst_gpio;

	if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) {
		rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN1;
	} else {
		rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN2;
	}

	ret = omap_request_gpio(rst_gpio);
	if (ret < 0) {
		printf("Unable to get GPIO %d\n", rst_gpio);
		return ;
	}

	/* Configure as output */
	omap_set_gpio_direction(rst_gpio, 0);

	/* Send a pulse on the GPIO pin */
	omap_set_gpio_dataout(rst_gpio, 1);
	udelay(1);
	omap_set_gpio_dataout(rst_gpio, 0);
	udelay(1);
	omap_set_gpio_dataout(rst_gpio, 1);
}
Esempio n. 18
0
static void __init h2_init(void)
{
	/* Here we assume the NOR boot config:  NOR on CS3 (possibly swapped
	 * to address 0 by a dip switch), NAND on CS2B.  The NAND driver will
	 * notice whether a NAND chip is enabled at probe time.
	 *
	 * FIXME revC boards (and H3) support NAND-boot, with a dip switch to
	 * put NOR on CS2B and NAND (which on H2 may be 16bit) on CS3.  Try
	 * detecting that in code here, to avoid probing every possible flash
	 * configuration...
	 */
	h2_nor_resource.end = h2_nor_resource.start = omap_cs3_phys();
	h2_nor_resource.end += SZ_32M - 1;

	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);

	/* MMC:  card detect and WP */
	// omap_cfg_reg(U19_ARMIO1);		/* CD */
	omap_cfg_reg(BALLOUT_V8_ARMIO3);	/* WP */

	/* Irda */
#if defined(CONFIG_OMAP_IR) || defined(CONFIG_OMAP_IR_MODULE)
	omap_writel(omap_readl(FUNC_MUX_CTRL_A) | 7, FUNC_MUX_CTRL_A);
	if (!(omap_request_gpio(H2_IRDA_FIRSEL_GPIO_PIN))) {
		omap_set_gpio_direction(H2_IRDA_FIRSEL_GPIO_PIN, 0);
		h2_irda_data.transceiver_mode = h2_transceiver_mode;
	}
#endif

	platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
	omap_board_config = h2_config;
	omap_board_config_size = ARRAY_SIZE(h2_config);
	omap_serial_init();
}
Esempio n. 19
0
void fuel_set_gpio_dataout(int gpio, int value)
{
	omap_set_gpio_direction(gpio, 0);
	omap_set_gpio_dataout(gpio, value);

	return;
}
Esempio n. 20
0
static inline void __init apollon_init_smc91x(void)
{
	unsigned long base;

	/* Make sure CS1 timings are correct */
	GPMC_CONFIG1_1 = 0x00011203;
	GPMC_CONFIG2_1 = 0x001f1f01;
	GPMC_CONFIG3_1 = 0x00080803;
	GPMC_CONFIG4_1 = 0x1c091c09;
	GPMC_CONFIG5_1 = 0x041f1f1f;
	GPMC_CONFIG6_1 = 0x000004c4;

	if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) {
		printk(KERN_ERR "Failed to request GPMC CS for smc91x\n");
		return;
	}
	apollon_smc91x_resources[0].start = base + 0x300;
	apollon_smc91x_resources[0].end   = base + 0x30f;
	udelay(100);

	omap_cfg_reg(W4__24XX_GPIO74);
	if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) {
		printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
			APOLLON_ETHR_GPIO_IRQ);
		gpmc_cs_free(APOLLON_ETH_CS);
		return;
	}
	omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1);
}
Esempio n. 21
0
/*
 * Routine: beagle_identify
 * Description: Detect if we are running on a Beagle revision Ax/Bx,
 *		C1/2/3, C4 or D. This can be done by reading
 *		the level of GPIO173, GPIO172 and GPIO171. This should
 *		result in
 *		GPIO173, GPIO172, GPIO171: 1 1 1 => Ax/Bx
 *		GPIO173, GPIO172, GPIO171: 1 1 0 => C1/2/3
 *		GPIO173, GPIO172, GPIO171: 1 0 1 => C4
 *		GPIO173, GPIO172, GPIO171: 0 0 0 => XM
 */
void beagle_identify(void)
{
    omap_request_gpio(171);
    omap_request_gpio(172);
    omap_request_gpio(173);
    omap_set_gpio_direction(171, 1);
    omap_set_gpio_direction(172, 1);
    omap_set_gpio_direction(173, 1);

    beagle_revision = omap_get_gpio_datain(173) << 2 |
                      omap_get_gpio_datain(172) << 1 |
                      omap_get_gpio_datain(171);
    omap_free_gpio(171);
    omap_free_gpio(172);
    omap_free_gpio(173);
}
Esempio n. 22
0
static void __init palmte_misc_gpio_setup(void)
{
	/* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
	if (omap_request_gpio(PALMTE_PINTDAV_GPIO)) {
		printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
		return;
	}
	omap_set_gpio_direction(PALMTE_PINTDAV_GPIO, 1);

	/* Set USB-or-DC-IN pin as input (unused) */
	if (omap_request_gpio(PALMTE_USB_OR_DC_GPIO)) {
		printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
		return;
	}
	omap_set_gpio_direction(PALMTE_USB_OR_DC_GPIO, 1);
}
Esempio n. 23
0
static int __init tea5761_dev_init(void)
{
	const struct omap_tea5761_config *info;
	int enable_gpio = 0;

	info = omap_get_config(OMAP_TAG_TEA5761, struct omap_tea5761_config);
	if (info)
		enable_gpio = info->enable_gpio;

	if (enable_gpio) {
		pr_debug("Enabling tea5761 at GPIO %d\n",
			 enable_gpio);

		if (omap_request_gpio(enable_gpio) < 0) {
			printk(KERN_ERR "Can't request GPIO %d\n",
			       enable_gpio);
			return -ENODEV;
		}

		omap_set_gpio_direction(enable_gpio, 0);
		udelay(50);
		omap_set_gpio_dataout(enable_gpio, 1);
	}

	return 0;
}
Esempio n. 24
0
static void __init osk_mistral_init(void)
{
	/* FIXME here's where to feed in framebuffer, touchpad, and
	 * keyboard setup ...  not in the drivers for those devices!
	 *
	 * NOTE:  we could actually tell if there's a Mistral board
	 * attached, e.g. by trying to read something from the ads7846.
	 * But this is too early for that...
	 */

	/* the sideways button (SW1) is for use as a "wakeup" button */
	omap_cfg_reg(N15_1610_MPUIO2);
	if (omap_request_gpio(OMAP_MPUIO(2)) == 0) {
		int ret = 0;
		omap_set_gpio_direction(OMAP_MPUIO(2), 1);
		set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING);
#ifdef	CONFIG_PM
		/* share the IRQ in case someone wants to use the
		 * button for more than wakeup from system sleep.
		 */
		ret = request_irq(OMAP_GPIO_IRQ(OMAP_MPUIO(2)),
				&osk_mistral_wake_interrupt,
				SA_SHIRQ, "mistral_wakeup",
				&osk_mistral_wake_interrupt);
		if (ret != 0) {
			omap_free_gpio(OMAP_MPUIO(2));
			printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n",
				ret);
		} else
			enable_irq_wake(OMAP_GPIO_IRQ(OMAP_MPUIO(2)));
#endif
	} else
		printk(KERN_ERR "OSK+Mistral: wakeup button is awol\n");
}
Esempio n. 25
0
static void do_scale_tps62361(u32 reg, u32 volt_mv)
{
	u32 temp, step;

	step = volt_mv - TPS62361_BASE_VOLT_MV;
	step /= 10;

	/*
	 * Select SET1 in TPS62361:
	 * VSEL1 is grounded on board. So the following selects
	 * VSEL1 = 0 and VSEL0 = 1
	 */
	omap_set_gpio_direction(TPS62361_VSEL0_GPIO, 0);
	omap_set_gpio_dataout(TPS62361_VSEL0_GPIO, 1);

	temp = TPS62361_I2C_SLAVE_ADDR |
	    (reg << PRM_VC_VAL_BYPASS_REGADDR_SHIFT) |
	    (step << PRM_VC_VAL_BYPASS_DATA_SHIFT) |
	    PRM_VC_VAL_BYPASS_VALID_BIT;
	debug("do_scale_tps62361: volt - %d step - 0x%x\n", volt_mv, step);

	writel(temp, &prcm->prm_vc_val_bypass);
	if (!wait_on_value(PRM_VC_VAL_BYPASS_VALID_BIT, 0,
				&prcm->prm_vc_val_bypass, LDELAY)) {
		puts("Scaling voltage failed for vdd_mpu from TPS\n");
	}
}
Esempio n. 26
0
static void omap_configure_led_gpio(int gpio)
{
	if (omap_request_gpio(gpio) < 0) {
		printk(KERN_ERR "Failed to request GPIO%d for LEDs\n", gpio);
		return;
	}
	omap_set_gpio_direction(gpio, 0);	/* OUT */
}
Esempio n. 27
0
static int sdp2430_panel_init(struct lcd_panel *panel,
				struct omapfb_device *fbdev)
{
	if (machine_is_omap_3430sdp()) {
		enable_gpio    = SDP3430_LCD_PANEL_ENABLE_GPIO;
		backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
	} else {
		enable_gpio    = SDP2430_LCD_PANEL_ENABLE_GPIO;
		backlight_gpio = SDP2430_LCD_PANEL_BACKLIGHT_GPIO;
	}

	omap_request_gpio(enable_gpio);			/* LCD panel */
	omap_request_gpio(backlight_gpio);		/* LCD backlight */
	omap_set_gpio_direction(enable_gpio, 0);	/* output */
	omap_set_gpio_direction(backlight_gpio, 0);	/* output */

	return 0;
}
Esempio n. 28
0
static void __init apollon_usb_init(void)
{
	/* USB device */
	/* DEVICE_SUSPEND */
	omap_cfg_reg(P21_242X_GPIO12);
	omap_request_gpio(12);
	omap_set_gpio_direction(12, 0);		/* OUT */
	omap_set_gpio_dataout(12, 0);
}
Esempio n. 29
0
static void __init apollon_tsc_init(void)
{
	/* TSC2101 */
	omap_cfg_reg(N15_24XX_GPIO85);
	omap_request_gpio(85);
	omap_set_gpio_direction(85, 1);

	omap_cfg_reg(W14_24XX_SYS_CLKOUT);	/* mclk */
}
Esempio n. 30
0
void red_LED_off (void)
{
	/* red */
	if (!omap_request_gpio(ZOOM2_LED_RED)) {
		omap_set_gpio_direction(ZOOM2_LED_RED, 0);
		omap_set_gpio_dataout(ZOOM2_LED_RED, 0);
	}
	saved_state[STATUS_LED_RED] = STATUS_LED_OFF;
}