static void __exit syf_pwm_cleanup(void) { cdev_del(&syf_pwm_devp->cdevs); unregister_chrdev_region(syf_pwm_dev_num, 1); kfree(syf_pwm_devp); /* Cleanup of Syf CPUFreq governor */ cpufreq_unregister_governor(&__syf_cpufreq_gov); /* Release PMU */ pmu_release(id); printk("Syf-PWM Driver Unregistered.\n"); return; }
/* both demods are on the same I2C-bus by default accessible through address 18 */ int main (void) { // default I2C implementation is based on parallel port but user can connect its // own I2C driver using host_i2c_interface_attach(); // implementation is done in sample/interface/host.c //struct dibDataBusHost *i2c = host_i2c_interface_attach(NULL), *b; struct dibDataBusHost *i2c = open_spp_i2c(), *b; struct dibFrontend frontend[2]; struct dibChannel ch; struct dibDemodMonitor mon[2]; struct dibPMU *pmu; if (i2c == NULL) return 1; DibZeroMemory(&mon, sizeof(mon)); frontend_init(&frontend[0]); /* initializing the frontend-structure */ frontend_init(&frontend[1]); /* initializing the frontend-structure */ frontend_set_id(&frontend[0], 0); /* assign an absolute ID to the frontend */ frontend_set_id(&frontend[1], 1); /* assign an absolute ID to the frontend */ if (dib9090_firmware_sip_register(&frontend[0], 0x80, i2c, &nim9090md_config[0]) == NULL) { /* using a frontend on I2C address 0x80 */ dbgp(" DiB9090: attaching demod and tuners failed.\n"); return DIB_RETURN_ERROR; } i2c = dib7000m_get_i2c_master(&frontend[0], DIBX000_I2C_INTERFACE_GPIO_3_4, 0); if (dib9090_firmware_sip_register(&frontend[1], 0x82, i2c, &nim9090md_config[1]) == NULL) { /* using a frontend on I2C address 0x82 */ dbgp(" DiB9090: attaching demod and tuners failed.\n"); return DIB_RETURN_ERROR; } /* do the i2c-enumeration for 2 demod and use 0x80 as the I2C address for first device */ i2c = data_bus_client_get_data_bus(demod_get_data_bus_client(&frontend[0])); dib7000m_i2c_enumeration(i2c, 1, 0x20, 0x80); /* non-standard i2c-enumeration, because of INT_SELECT-fixation */ i2c = data_bus_client_get_data_bus(demod_get_data_bus_client(&frontend[1])); dib7000m_i2c_enumeration(i2c, 1, DEFAULT_DIB9000_I2C_ADDRESS, 0x82); b = dib7000m_get_i2c_master(&frontend[0], DIBX000_I2C_INTERFACE_GPIO_1_2, 0); if ((pmu = osiris_create(b, &nim9090md_osiris_config)) == NULL) return DIB_RETURN_ERROR; dib9090_set_pmu(&frontend[0], pmu); /* workaround because we cannot access the PMU from the host after downloading the firmware - for now */ frontend_reset(&frontend[0]); frontend_reset(&frontend[1]); INIT_CHANNEL(&ch, STANDARD_DVBT); ch.RF_kHz = 474000; ch.bandwidth_kHz = 8000; /* just to set them in a known state - not important */ tune_diversity(frontend, 2, &ch); DibDbgPrint("-I- Tuning done <enter>\n"); getchar(); while (1) { /* after enumerating on the same i2c-bus, the i2c-addresses of the bus will be 0x80 for the diversity master and 0x82 for the slave */ demod_get_monitoring(&frontend[0], &mon[0]); demod_get_monitoring(&frontend[1], &mon[1]); dib7000_print_monitor(mon, NULL, 0 ,2); usleep(100000); } DibDbgPrint("-I- Cleaning up\n"); frontend_unregister_components(&frontend[1]); frontend_unregister_components(&frontend[0]); pmu_release(pmu); //host_i2c_release(i2c); close_spp_i2c(); return 0; }