SysinfoResetPowerOps *new_sysinfo_reset_power_ops(PowerOps *power_off_ops, new_gpio_from_coreboot_t new_gpio_from_coreboot) { SysinfoResetPowerOps *p = xzalloc(sizeof(*p)); p->ops.power_off = &pass_through_power_off; p->ops.cold_reboot = &gpio_reboot; p->power_off_ops = power_off_ops; p->reset_gpio = sysinfo_lookup_gpio("reset", 1, new_gpio_from_coreboot); die_if(!p->reset_gpio, "could not find 'reset' GPIO in coreboot table"); return p; }
static void install_phys_presence_flag(void) { GpioOps *phys_presence = sysinfo_lookup_gpio ("developer", 1, new_gpio_input_from_coreboot); if (!phys_presence) { printf("%s failed retrieving phys presence GPIO\n", __func__); return; } flag_install(FLAG_PHYS_PRESENCE, phys_presence); }
void mainboard_keyboard_init(struct pk_sm_desc *desc) { pwr_btn_gpio = sysinfo_lookup_gpio("power", 1, new_tegra_gpio_input_from_coreboot); die_if(!pwr_btn_gpio, "No GPIO for power!!\n"); /* Inputs volup and voldown are active low. */ vol_down_gpio = new_gpio_not(&new_tegra_gpio_input(GPIO(X, 7))->ops); vol_up_gpio = new_gpio_not(&new_tegra_gpio_input(GPIO(X, 6))->ops); foster_sm_init(desc); }
static int sysinfo_gpio_get(struct GpioOps *me) { assert(me); SysinfoGpio *sgpio = container_of(me, SysinfoGpio, ops); if (!sgpio->cb_gpio_ptr) { struct cb_gpio *cb_gpio_ptr = sysinfo_lookup_gpio(sgpio->label); if (!cb_gpio_ptr) return -1; sgpio->cb_gpio_ptr = cb_gpio_ptr; int p = (cb_gpio_ptr->polarity == CB_GPIO_ACTIVE_HIGH) ? 0 : 1; sgpio->val = p ^ cb_gpio_ptr->value; } return sgpio->val; }