static void awin_tve_attach(device_t parent, device_t self, void *aux) { struct awin_tve_softc *sc = device_private(self); struct awinio_attach_args * const aio = aux; const struct awin_locators * const loc = &aio->aio_loc; prop_dictionary_t cfg = device_properties(self); int8_t tcon_unit = -1; sc->sc_dev = self; sc->sc_bst = aio->aio_core_bst; bus_space_subregion(sc->sc_bst, aio->aio_core_bsh, loc->loc_offset, loc->loc_size, &sc->sc_bsh); if (prop_dictionary_get_int8(cfg, "tcon_unit", &tcon_unit)) { sc->sc_tcon_unit = tcon_unit; } else { sc->sc_tcon_unit = 0; /* default value */ } sc->sc_tcon_pll = awin_tcon_get_clk_pll(sc->sc_tcon_unit); switch (sc->sc_tcon_pll) { case 3: awin_pll3_enable(); break; case 7: awin_pll7_enable(); break; default: panic("awin_tve pll"); } /* for now assume we're always at 0 */ awin_reg_set_clear(aio->aio_core_bst, aio->aio_ccm_bsh, AWIN_AHB_GATING1_REG, AWIN_AHB_GATING1_TVE0, 0); aprint_naive("\n"); aprint_normal(": TV Encoder / VGA output\n"); if (tcon_unit >= 0) { aprint_verbose_dev(self, ": using TCON%d, pll%d\n", sc->sc_tcon_unit, sc->sc_tcon_pll); } sc->sc_i2c_blklen = 16; #if 0 sc->sc_ih = intr_establish(loc->loc_intr, IPL_SCHED, IST_LEVEL, awin_tve_intr, sc); if (sc->sc_ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt %d\n", loc->loc_intr); return; } aprint_normal_dev(self, "interrupting on irq %d\n", loc->loc_intr); #endif awin_tve_i2c_init(sc); awin_tve_enable(sc); awin_tve_read_edid(sc); }
gboolean drvctl_find_device(const gchar *devnode, prop_dictionary_t *properties) { prop_dictionary_t command_dict; prop_dictionary_t args_dict; prop_dictionary_t results_dict; int err; command_dict = prop_dictionary_create (); args_dict = prop_dictionary_create (); prop_dictionary_set_cstring_nocopy (command_dict, "drvctl-command", "get-properties"); prop_dictionary_set_cstring_nocopy (args_dict, "device-name", devnode); prop_dictionary_set (command_dict, "drvctl-arguments", args_dict); prop_object_release (args_dict); err = prop_dictionary_sendrecv_ioctl (command_dict, drvctl_fd, DRVCTLCOMMAND, &results_dict); prop_object_release (command_dict); if (err) return FALSE; if (prop_dictionary_get_int8 (results_dict, "drvctl-error", &err) == false || err != 0) { prop_object_release (results_dict); return FALSE; } if (properties) { prop_dictionary_t result_data; result_data = prop_dictionary_get (results_dict, "drvctl-result-data"); if (result_data) *properties = prop_dictionary_copy (result_data); } prop_object_release (results_dict); return TRUE; }