Beispiel #1
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
}
Beispiel #2
0
/* FIXME: adapt clock divisors for uwire to current ARM xor clock rate */
static int omap_tsc2101_configure(void)
{
	unsigned long uwire_flags = 0;

#ifdef CONFIG_MACH_OMAP_H3
	int err = 0;
	u8 ioExpanderVal = 0;

	if ((err = read_gpio_expa(&ioExpanderVal, 0x24))) {
		printk(" Error reading from I/O EXPANDER \n");
		return err;
	}
	ioExpanderVal |= 0x8;

	if ((err = write_gpio_expa(ioExpanderVal, 0x24))) {
		printk(KERN_ERR ": Error writing to I/O EXPANDER \n");
		return err;
	}
#endif

	if (machine_is_omap_h2()) {
		uwire_flags = UWIRE_READ_RISING_EDGE | UWIRE_WRITE_RISING_EDGE;
		omap_cfg_reg(N15_1610_UWIRE_CS1);
		omap_uwire_configure_mode(1, uwire_flags);
	}
	if (machine_is_omap_h3()) {
		uwire_flags = UWIRE_READ_RISING_EDGE | UWIRE_WRITE_RISING_EDGE;
		omap_cfg_reg(N14_1610_UWIRE_CS0);
		omap_uwire_configure_mode(0, uwire_flags);
	}

	/* Configure MCLK enable */
	omap_writel(omap_readl(PU_PD_SEL_2) | (1 << 22), PU_PD_SEL_2);	

	return 0;
}