static int h3600_pcmcia_socket_suspend(int sock) { switch (sock) { case 0: set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD0, GPIO_NO_EDGES); break; case 1: set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD1, GPIO_NO_EDGES); break; } /* * FIXME: This doesn't fit well. We don't have the mechanism in * the generic PCMCIA layer to deal with the idea of two sockets * on one bus. We rely on the cs.c behaviour shutting down * socket 0 then socket 1. */ if (sock == 1) { clr_h3600_egpio(IPAQ_EGPIO_OPT_ON); clr_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON); /* hmm, does this suck power? */ set_h3600_egpio(IPAQ_EGPIO_OPT_RESET); } return 0; }
static void h3600_audio_init(void *dummy) { unsigned long flags; /* Setup the uarts */ local_irq_save(flags); GAFR |= (GPIO_SSP_CLK); GPDR &= ~(GPIO_SSP_CLK); Ser4SSCR0 = 0; Ser4SSCR0 = SSCR0_DataSize(16) + SSCR0_TI + SSCR0_SerClkDiv(8); Ser4SSCR1 = SSCR1_SClkIactL + SSCR1_SClk1P + SSCR1_ExtClk; Ser4SSCR0 |= SSCR0_SSE; /* Enable the audio power */ clr_h3600_egpio(IPAQ_EGPIO_CODEC_NRESET); set_h3600_egpio(IPAQ_EGPIO_AUDIO_ON); set_h3600_egpio(IPAQ_EGPIO_QMUTE); local_irq_restore(flags); /* external clock configuration */ h3600_set_samplerate(audio_samplerate); /* Wait for the UDA1341 to wake up */ set_h3600_egpio(IPAQ_EGPIO_CODEC_NRESET); mdelay(1); /* make the left and right channels unswapped (flip the WS latch ) */ Ser4SSDR = 0; /* Initialize the UDA1341 internal state */ l3_open(&uda1341); clr_h3600_egpio(IPAQ_EGPIO_QMUTE); }
static void h3600_audio_shutdown(void *dummy) { /* disable the audio power and all signals leading to the audio chip */ l3_close(&uda1341); Ser4SSCR0 = 0; clr_h3600_egpio(IPAQ_EGPIO_CODEC_NRESET); clr_h3600_egpio(IPAQ_EGPIO_AUDIO_ON); clr_h3600_egpio(IPAQ_EGPIO_QMUTE); }
static void h3600_set_vpp(struct map_info *map, int vpp) { if (vpp) set_h3600_egpio(EGPIO_H3600_VPP_ON); else clr_h3600_egpio(EGPIO_H3600_VPP_ON); }
static void h3600_irda_set_speed(struct device *dev, unsigned int speed) { if (speed < 4000000) { clr_h3600_egpio(IPAQ_EGPIO_IR_FSEL); } else { set_h3600_egpio(IPAQ_EGPIO_IR_FSEL); } }
static int h3600_pcmcia_shutdown(void) { int i; /* * disable IRQs */ for (i = 0; i < ARRAY_SIZE(irqs); i++) free_irq(irqs[i].irq, NULL); /* Disable CF bus: */ clr_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON); clr_h3600_egpio(IPAQ_EGPIO_OPT_ON); set_h3600_egpio(IPAQ_EGPIO_OPT_RESET); return 0; }
/* * This turns the IRDA power on or off on the Compaq H3600 */ static inline int sa1100_irda_set_power_h3600(struct sa1100_irda *si, unsigned int state) { if (state) set_h3600_egpio(EGPIO_H3600_IR_ON); else clr_h3600_egpio(EGPIO_H3600_IR_ON); return 0; }
int h3600_micro_audio_power( long samplerate ) { int retval = 0; if ( samplerate ) { clr_h3600_egpio(IPAQ_EGPIO_CODEC_NRESET); set_h3600_egpio(IPAQ_EGPIO_AUDIO_ON); set_h3600_egpio(IPAQ_EGPIO_QMUTE); retval = h3600_micro_audio_clock( samplerate ); set_h3600_egpio(IPAQ_EGPIO_CODEC_NRESET); } else { /* Power down */ clr_h3600_egpio(IPAQ_EGPIO_CODEC_NRESET); clr_h3600_egpio(IPAQ_EGPIO_AUDIO_ON); clr_h3600_egpio(IPAQ_EGPIO_QMUTE); } return retval; }
static int h3600_stowaway_release(struct inode * inode, struct file * filp) { struct skbd_state *skbd = (struct skbd_state *) filp->private_data; if (1) SFDEBUG(1,"\n"); if ( --skbd->usage_count == 0 ) { SFDEBUG(1,"Closing down keyboard\n"); h3600_stowaway_release_all_keys(skbd); h3600_stowaway_shutdown(skbd); kbd_ledfunc = skbd->old_ledfunc; clr_h3600_egpio(IPAQ_EGPIO_RS232_ON); } MOD_DEC_USE_COUNT; return 0; }
static int h3600_pcmcia_socket_init(int sock) { /* Enable CF bus: */ set_h3600_egpio(IPAQ_EGPIO_OPT_NVRAM_ON); set_h3600_egpio(IPAQ_EGPIO_OPT_ON); clr_h3600_egpio(IPAQ_EGPIO_OPT_RESET); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(10*HZ / 1000); switch (sock) { case 0: set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD0, GPIO_BOTH_EDGES); break; case 1: set_GPIO_IRQ_edge(GPIO_H3600_PCMCIA_CD1, GPIO_BOTH_EDGES); break; } return 0; }
static int h3600_pcmcia_configure_socket(const struct pcmcia_configure *conf) { if (conf->sock > 1) return -1; if (conf->vcc != 0 && conf->vcc != 33 && conf->vcc != 50) { printk(KERN_ERR "h3600_pcmcia: unrecognized Vcc %u.%uV\n", conf->vcc / 10, conf->vcc % 10); return -1; } if (conf->reset) set_h3600_egpio(IPAQ_EGPIO_CARD_RESET); else clr_h3600_egpio(IPAQ_EGPIO_CARD_RESET); /* Silently ignore Vpp, output enable, speaker enable. */ return 0; }
/* * Set the IrDA communications speed. */ static int sa1100_irda_set_speed(struct sa1100_irda *si, int speed) { unsigned long flags; int brd, ret = -EINVAL; switch (speed) { case 9600: case 19200: case 38400: case 57600: case 115200: brd = 3686400 / (16 * speed) - 1; /* * Stop the receive DMA. */ if (IS_FIR(si)) sa1100_stop_dma(si->rxdma); local_irq_save(flags); Ser2UTCR3 = 0; Ser2HSCR0 = HSCR0_UART; Ser2UTCR1 = brd >> 8; Ser2UTCR2 = brd; /* * Clear status register */ Ser2UTSR0 = UTSR0_REB | UTSR0_RBB | UTSR0_RID; Ser2UTCR3 = UTCR3_RIE | UTCR3_RXE | UTCR3_TXE; if (machine_is_assabet()) ASSABET_BCR_clear(ASSABET_BCR_IRDA_FSEL); if (machine_is_h3xxx()) clr_h3600_egpio(IPAQ_EGPIO_IR_FSEL); if (machine_is_yopy()) PPSR &= ~GPIO_IRDA_FIR; si->speed = speed; local_irq_restore(flags); ret = 0; break; case 4000000: local_irq_save(flags); si->hscr0 = 0; Ser2HSSR0 = 0xff; Ser2HSCR0 = si->hscr0 | HSCR0_HSSP; Ser2UTCR3 = 0; si->speed = speed; if (machine_is_assabet()) ASSABET_BCR_set(ASSABET_BCR_IRDA_FSEL); if (machine_is_h3xxx()) set_h3600_egpio(IPAQ_EGPIO_IR_FSEL); if (machine_is_yopy()) PPSR |= GPIO_IRDA_FIR; sa1100_irda_rx_alloc(si); sa1100_irda_rx_dma_start(si); local_irq_restore(flags); break; default: break; } return ret; }