271
274
.resource = h3_kp_resources,
275
/* Select between the IrDA and aGPS module
277
static int h3_select_irda(struct device *dev, int state)
282
if ((err = read_gpio_expa(&expa, 0x26))) {
283
printk(KERN_ERR "Error reading from I/O EXPANDER \n");
287
/* 'P6' enable/disable IRDA_TX and IRDA_RX */
288
if (state & IR_SEL) { /* IrDA */
289
if ((err = write_gpio_expa(expa | 0x40, 0x26))) {
290
printk(KERN_ERR "Error writing to I/O EXPANDER \n");
294
if ((err = write_gpio_expa(expa & ~0x40, 0x26))) {
295
printk(KERN_ERR "Error writing to I/O EXPANDER \n");
302
static void set_trans_mode(struct work_struct *work)
304
struct omap_irda_config *irda_config =
305
container_of(work, struct omap_irda_config, gpio_expa.work);
306
int mode = irda_config->mode;
310
if ((err = read_gpio_expa(&expa, 0x27)) != 0) {
311
printk(KERN_ERR "Error reading from I/O expander\n");
316
if (mode & IR_SIRMODE) {
318
} else { /* MIR/FIR */
322
if ((err = write_gpio_expa(expa, 0x27)) != 0) {
323
printk(KERN_ERR "Error writing to I/O expander\n");
327
static int h3_transceiver_mode(struct device *dev, int mode)
329
struct omap_irda_config *irda_config = dev->platform_data;
331
irda_config->mode = mode;
332
cancel_delayed_work(&irda_config->gpio_expa);
333
PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
334
schedule_delayed_work(&irda_config->gpio_expa, 0);
339
static struct omap_irda_config h3_irda_data = {
340
.transceiver_cap = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
341
.transceiver_mode = h3_transceiver_mode,
342
.select_irda = h3_select_irda,
343
.rx_channel = OMAP_DMA_UART3_RX,
344
.tx_channel = OMAP_DMA_UART3_TX,
345
.dest_start = UART3_THR,
346
.src_start = UART3_RHR,
351
static struct resource h3_irda_resources[] = {
355
.flags = IORESOURCE_IRQ,
359
static u64 irda_dmamask = 0xffffffff;
361
static struct platform_device h3_irda_device = {
365
.platform_data = &h3_irda_data,
366
.dma_mask = &irda_dmamask,
368
.num_resources = ARRAY_SIZE(h3_irda_resources),
369
.resource = h3_irda_resources,
372
277
static struct platform_device h3_lcd_device = {
373
278
.name = "lcd_h3",
420
324
static struct omap_board_config_kernel h3_config[] __initdata = {
421
{ OMAP_TAG_USB, &h3_usb_config },
422
325
{ OMAP_TAG_UART, &h3_uart_config },
423
326
{ OMAP_TAG_LCD, &h3_lcd_config },