/* Power control is shared with between one of the CF slots and SD */ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) { unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); if (new_cpr & 0x0007) { set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); if (!(cpr & 0x0002) && !(cpr & 0x0004)) mdelay(5); if (device == SPITZ_PWR_CF) cpr |= 0x0002; if (device == SPITZ_PWR_SD) cpr |= 0x0004; write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); } else { if (device == SPITZ_PWR_CF) cpr &= ~0x0002; if (device == SPITZ_PWR_SD) cpr &= ~0x0004; if (!(cpr & 0x0002) && !(cpr & 0x0004)) { write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); mdelay(1); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); } else { write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); } } }
static void corgiled_green_set(struct led_classdev *led_cdev, enum led_brightness value) { if (value) set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); else reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); }
static void spitzled_green_set(struct led_classdev *led_cdev, enum led_brightness value) { if (value) set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN); else reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN); }
static void corgi_poweroff(void) { RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; if (!machine_is_corgi()) /* Green LED off tells the bootloader to halt */ reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); arm_machine_restart('h'); }
static void tosa_mci_setpower(struct device *dev, unsigned int vdd) { struct pxamci_platform_data* p_d = dev->platform_data; if (( 1 << vdd) & p_d->ocr_mask) { set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); } else { reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_PWR_ON); } }
static void spitz_ext_control(struct snd_soc_codec *codec) { if (spitz_spk_func == SPITZ_SPK_ON) snd_soc_dapm_set_endpoint(codec, "Ext Spk", 1); else snd_soc_dapm_set_endpoint(codec, "Ext Spk", 0); /* set up jack connection */ switch (spitz_jack_func) { case SPITZ_HP: /* enable and unmute hp jack, disable mic bias */ snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); snd_soc_dapm_set_endpoint(codec, "Mic Jack", 0); snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 1); set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); break; case SPITZ_MIC: /* enable mic jack and bias, mute hp */ snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); snd_soc_dapm_set_endpoint(codec, "Mic Jack", 1); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); break; case SPITZ_LINE: /* enable line jack, disable mic bias and mute hp */ snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); snd_soc_dapm_set_endpoint(codec, "Mic Jack", 0); snd_soc_dapm_set_endpoint(codec, "Line Jack", 1); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); break; case SPITZ_HEADSET: /* enable and unmute headset jack enable mic bias, mute L hp */ snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); snd_soc_dapm_set_endpoint(codec, "Mic Jack", 1); snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); snd_soc_dapm_set_endpoint(codec, "Headset Jack", 1); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); break; case SPITZ_HP_OFF: /* jack removed, everything off */ snd_soc_dapm_set_endpoint(codec, "Headphone Jack", 0); snd_soc_dapm_set_endpoint(codec, "Headset Jack", 0); snd_soc_dapm_set_endpoint(codec, "Mic Jack", 0); snd_soc_dapm_set_endpoint(codec, "Line Jack", 0); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); break; } snd_soc_dapm_sync_endpoints(codec); }
static void tosaled_green_set(struct led_classdev *led_cdev, enum led_brightness value) { if (value) set_scoop_gpio(&tosascoop_jc_device.dev, TOSA_SCOOP_JC_NOTE_LED); else reset_scoop_gpio(&tosascoop_jc_device.dev, TOSA_SCOOP_JC_NOTE_LED); }
/* * Irda */ static void tosa_irda_transceiver_mode(struct device *dev, int mode) { if (mode & IR_OFF) { reset_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); pxa_gpio_mode(GPIO47_STTXD|GPIO_DFLT_LOW); pxa_gpio_mode(GPIO47_STTXD|GPIO_OUT); } else { pxa_gpio_mode(GPIO47_STTXD_MD); set_scoop_gpio(&tosascoop_device.dev,TOSA_SCOOP_IR_POWERDWN); } }
/* * USB Device Controller */ static void tosa_udc_command(int cmd) { switch(cmd) { case PXA2XX_UDC_CMD_CONNECT: set_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); break; case PXA2XX_UDC_CMD_DISCONNECT: reset_scoop_gpio(&tosascoop_jc_device.dev,TOSA_SCOOP_JC_USB_PULLUP); break; } }
static int tcc_amp_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { #if 0 if (SND_SOC_DAPM_EVENT_ON(event)) set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); else reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_APM_ON); #endif return 0; }
static void collie_charge(int on) { extern struct platform_device colliescoop_device; /* Zaurus seems to contain LTC1731; it should know when to * stop charging itself, so setting charge on should be * relatively harmless (as long as it is not done too often). */ if (on) { set_scoop_gpio(&colliescoop_device.dev, COLLIE_SCP_CHARGE_ON); } else { reset_scoop_gpio(&colliescoop_device.dev, COLLIE_SCP_CHARGE_ON); } }
static int spitz_mic_bias(struct snd_soc_dapm_widget *w, struct snd_kcontrol *k, int event) { if (machine_is_borzoi() || machine_is_spitz()) { if (SND_SOC_DAPM_EVENT_ON(event)) set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS); else reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_MIC_BIAS); } if (machine_is_akita()) { if (SND_SOC_DAPM_EVENT_ON(event)) akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_MIC_BIAS); else akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_MIC_BIAS); } return 0; }