static unsigned int etraxfs_uart_get_mctrl(struct uart_port *port) { struct uart_cris_port *up = (struct uart_cris_port *)port; unsigned int ret; ret = 0; if (crisv32_serial_get_rts(up)) ret |= TIOCM_RTS; /* DTR is active low */ if (up->dtr_pin && !gpiod_get_raw_value(up->dtr_pin)) ret |= TIOCM_DTR; /* CD is active low */ if (up->cd_pin && !gpiod_get_raw_value(up->cd_pin)) ret |= TIOCM_CD; /* RI is active low */ if (up->ri_pin && !gpiod_get_raw_value(up->ri_pin)) ret |= TIOCM_RI; /* DSR is active low */ if (up->dsr_pin && !gpiod_get_raw_value(up->dsr_pin)) ret |= TIOCM_DSR; if (crisv32_serial_get_cts(up)) ret |= TIOCM_CTS; return ret; }
int mmc_gpio_get_cd(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; int cansleep; if (!ctx || !ctx->cd_gpio) return -ENOSYS; cansleep = gpiod_cansleep(ctx->cd_gpio); if (ctx->override_cd_active_level) { int value = cansleep ? gpiod_get_raw_value_cansleep(ctx->cd_gpio) : gpiod_get_raw_value(ctx->cd_gpio); return !value ^ !!(host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH); } return cansleep ? gpiod_get_value_cansleep(ctx->cd_gpio) : gpiod_get_value(ctx->cd_gpio); }