// deconfigure IOX and GPIO void deconfigure_module(struct bmi_li3m02cm *cam) { int slot = cam->bdev->slot->slotnum; bmi_slot_gpio_direction_in(slot, 3); bmi_slot_gpio_direction_in(slot, 2); bmi_slot_gpio_direction_in(slot, 1); }
/* * Function is called when the video module hardwrae is physically removed */ void bmi_video_remove(struct bmi_device *bdev) { int irq; int i; int slot; struct bmi_video *video; struct class *bmi_class; static struct omap_dss_device *dssdev; printk(KERN_DEBUG "bmi_video: Module Removed...\n"); //Would turn LED red, but we can't trust the HW is connected still slot = bdev->slot->slotnum; video = &g_bmi_video; //removals have known unwind errors iff rmmod bmi_video_core while //device is plugged in device_remove_file(&bdev->dev, &dev_attr_vmode); device_remove_file(&bdev->dev, &dev_attr_vga_edid); device_remove_file(&bdev->dev, &dev_attr_dvi_edid); bmi_class = bmi_get_class (); device_destroy (bmi_class, MKDEV(major, slot)); // -- disable displays monitors_off_safe(video);//safe for missing HW // -- disable all displays for_each_dss_dev(dssdev) { omap_dss_get_device(dssdev); if (dssdev->state) dssdev->driver->disable(dssdev); } if(video->swap_eeprom){ //we are just 'borrowing' this pointer, //do not unregister! see bmi_video_probe. video->swap_eeprom = NULL; video->swap_eeprom_state = OFF; } if(video->eeprom_switch) { i2c_unregister_device(video->eeprom_switch); video->eeprom_switch = NULL; } if(video->gpio_controller) { //dbg_unexport_gpios_to_sysfs(); gpio_free_array(vid_gpios, ARRAY_SIZE(vid_gpios)); i2c_unregister_device(video->gpio_controller); video->gpio_controller= NULL; } if(video->dvi_controller) { i2c_unregister_device(video->dvi_controller); video->dvi_controller = NULL; } printk(KERN_INFO "bmi_video: 9\n"); if(video->vga_controller) { i2c_unregister_device(video->vga_controller); video->vga_controller = NULL; } irq = bdev->slot->status_irq; // -- legacy vodoo code. Left in for safety for (i = 0; i < 4; i++) bmi_slot_gpio_direction_in(slot, i); if (video->vga_monitor_edid) { kfree(video->vga_monitor_edid); //created by a library. we must free video->vga_monitor_edid = NULL; } if (video->dvi_monitor_edid) { kfree(video->dvi_monitor_edid); //created by a library. we must free video->dvi_monitor_edid = NULL; } //just in case, clear the global g_dvi_disp = NULL; g_vga_disp = NULL; video->class_dev = 0; // de-attach driver-specific struct from bmi_device structure bmi_device_set_drvdata (bdev, 0); video->bdev = 0; printk(KERN_INFO "bmi_video_remove done "); return; //Clean, squeaky clean }