static void __exit h5000_exit (void) { platform_device_unregister (h5000_snd_device); samcop_set_gpio_b (&h5400_samcop.dev, SAMCOP_GPIO_GPB_CODEC_POWER_ON | SAMCOP_GPIO_GPB_AUDIO_POWER_ON, 0); };
static int __init h5000_init (void) { int ret; if (!machine_is_h5400 ()) return -ENODEV; request_module ("i2c-pxa"); h5000_snd_device = platform_device_alloc ("soc-audio", -1); if (!h5000_snd_device) return -ENOMEM; /* enable audio codec */ samcop_set_gpio_b (&h5400_samcop.dev, SAMCOP_GPIO_GPB_CODEC_POWER_ON, SAMCOP_GPIO_GPB_CODEC_POWER_ON); platform_set_drvdata (h5000_snd_device, &h5000_snd_devdata); h5000_snd_devdata.dev = &h5000_snd_device->dev; ret = platform_device_add (h5000_snd_device); if (ret) { platform_device_put (h5000_snd_device); }; return ret; };
static int h5400_ohci_probe (struct device *dev) { struct platform_device *sdev; int irq; void *mem_base; unsigned long flags = 0; int result = 0; sdev = to_platform_device (dev); mem_base = (void *)sdev->resource[1].start; irq = sdev->resource[2].start; /* make sure the clocks are enabled */ samcop_clock_enable (dev->parent, SAMCOP_CPM_CLKCON_USBHOST_CLKEN, 1); samcop_clock_enable (dev->parent, SAMCOP_CPM_CLKCON_UCLK_EN, 0); /* both needed? */ samcop_set_gpio_b (dev->parent, SAMCOP_GPIO_GPB_RF_POWER_ON | SAMCOP_GPIO_GPB_WLAN_POWER_ON, SAMCOP_GPIO_GPB_RF_POWER_ON | SAMCOP_GPIO_GPB_WLAN_POWER_ON); led_trigger_event_shared(h5400_radio_trig, LED_FULL); #if 0 #warning port to kernel 2.6 msleep (100); result = hc_add_ohci (pcidev, irq, mem_base, flags, (ohci_t **)&dev->driver_data, "h5400-ohci", "asic"); if (result) h5400_ohci_remove (dev); #endif return result; }
static void h5400_bl_set_intensity(int intensity) { samcop_set_gpio_b(&h5400_samcop.dev, SAMCOP_GPIO_GPB_BACKLIGHT_POWER_ON, intensity ? SAMCOP_GPIO_GPB_BACKLIGHT_POWER_ON : 0); mq1100_set_pwm(mq_base, 0, (0x3ff - intensity) >> 2); return; }
static int h5000_audio_power (struct snd_soc_dapm_widget *widget, int event) { static int power_use_count = 0; if (SND_SOC_DAPM_EVENT_ON (event)) { power_use_count ++; } else { power_use_count --; }; samcop_set_gpio_b (&h5400_samcop.dev, SAMCOP_GPIO_GPB_AUDIO_POWER_ON, (power_use_count > 0) ? (SAMCOP_GPIO_GPB_AUDIO_POWER_ON) : (0) ); return 0; };
static void h5400_ohci_remove (struct device *dev) { #if 0 #warning port to kernel 2.6 if (dev->driver_data) { hc_remove_ohci (dev->driver_data); dev->driver_data = NULL; } #endif samcop_set_gpio_b (dev->parent, SAMCOP_GPIO_GPB_RF_POWER_ON | SAMCOP_GPIO_GPB_WLAN_POWER_ON, 0); led_trigger_event_shared(h5400_radio_trig, LED_OFF); }