static int sef_cb_init(int type, sef_init_info_t * UNUSED(info)) { int r; if (type == SEF_INIT_LU) { /* Restore the state. */ lu_state_restore(); } /* look-up the endpoint for the bus driver */ bus_endpoint = i2cdriver_bus_endpoint(bus); if (bus_endpoint == 0) { log_warn(&log, "Couldn't find bus driver.\n"); return EXIT_FAILURE; } /* claim the device */ r = i2cdriver_reserve_device(bus_endpoint, address); if (r != OK) { log_warn(&log, "Couldn't reserve device 0x%x (r=%d)\n", address, r); return EXIT_FAILURE; } /* check that the chip / rev is reasonable */ r = check_revision(); if (r != OK) { /* prevent user from using the driver with a different chip */ log_warn(&log, "Bad CHIPID\n"); return EXIT_FAILURE; } /* enable interrupts */ r = intr_enable(); if (r != OK) { log_warn(&log, "Failed to enable interrupts.\n"); return EXIT_FAILURE; } /* enable power-off pin so the kernel can cut power to the SoC */ enable_pwr_off(); if (type != SEF_INIT_LU) { /* sign up for updates about the i2c bus going down/up */ r = i2cdriver_subscribe_bus_updates(bus); if (r != OK) { log_warn(&log, "Couldn't subscribe to bus updates\n"); return EXIT_FAILURE; } i2cdriver_announce(bus); log_debug(&log, "announced\n"); } return OK; }
static int sef_cb_init(int type, sef_init_info_t * UNUSED(info)) { int r, i; if (type == SEF_INIT_LU) { /* Restore the state. */ lu_state_restore(); } /* look-up the endpoint for the bus driver */ bus_endpoint = i2cdriver_bus_endpoint(bus); if (bus_endpoint == 0) { log_warn(&log, "Couldn't find bus driver.\n"); return EXIT_FAILURE; } for (i = 0; i < NADDRESSES; i++) { /* claim the device */ r = i2cdriver_reserve_device(bus_endpoint, addresses[i]); if (r != OK) { log_warn(&log, "Couldn't reserve device 0x%x (r=%d)\n", addresses[i], r); return EXIT_FAILURE; } } /* check that the chip / rev is reasonable */ r = check_revision(); if (r != OK) { /* prevent user from using the driver with a different chip */ log_warn(&log, "Bad IDCODE\n"); return EXIT_FAILURE; } r = rtc_init(); if (r != OK) { log_warn(&log, "RTC Start-up Failed\n"); return EXIT_FAILURE; } if (type != SEF_INIT_LU) { /* sign up for updates about the i2c bus going down/up */ r = i2cdriver_subscribe_bus_updates(bus); if (r != OK) { log_warn(&log, "Couldn't subscribe to bus updates\n"); return EXIT_FAILURE; } i2cdriver_announce(bus); log_debug(&log, "announced\n"); } return OK; }
static int sef_cb_init(int type, sef_init_info_t * UNUSED(info)) { int r; if (type == SEF_INIT_LU) { /* Restore the state. */ lu_state_restore(); } geom[TDA19988_DEV].dv_base = ((u64_t) (0)); geom[TDA19988_DEV].dv_size = ((u64_t) (128)); /* * CEC Module */ /* look-up the endpoint for the bus driver */ cec_bus_endpoint = i2cdriver_bus_endpoint(cec_bus); if (cec_bus_endpoint == 0) { log_warn(&log, "Couldn't find bus driver.\n"); return EXIT_FAILURE; } /* claim the device */ r = i2cdriver_reserve_device(cec_bus_endpoint, cec_address); if (r != OK) { log_warn(&log, "Couldn't reserve device 0x%x (r=%d)\n", cec_address, r); return EXIT_FAILURE; } /* * HDMI Module */ /* look-up the endpoint for the bus driver */ hdmi_bus_endpoint = i2cdriver_bus_endpoint(hdmi_bus); if (hdmi_bus_endpoint == 0) { log_warn(&log, "Couldn't find bus driver.\n"); return EXIT_FAILURE; } /* claim the device */ r = i2cdriver_reserve_device(hdmi_bus_endpoint, hdmi_address); if (r != OK) { log_warn(&log, "Couldn't reserve device 0x%x (r=%d)\n", hdmi_address, r); return EXIT_FAILURE; } if (type != SEF_INIT_LU) { /* sign up for updates about the i2c bus going down/up */ r = i2cdriver_subscribe_bus_updates(cec_bus); if (r != OK) { log_warn(&log, "Couldn't subscribe to bus updates\n"); return EXIT_FAILURE; } /* sign up for updates about the i2c bus going down/up */ r = i2cdriver_subscribe_bus_updates(hdmi_bus); if (r != OK) { log_warn(&log, "Couldn't subscribe to bus updates\n"); return EXIT_FAILURE; } i2cdriver_announce(cec_bus); if (cec_bus != hdmi_bus) { i2cdriver_announce(hdmi_bus); } blockdriver_announce(type); log_trace(&log, "announced\n"); } return OK; }