diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-11-20 23:52:32 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-12-05 06:06:44 -0700 |
commit | ac7f5db9dc690901d99fe0afbcb3d4241c3cab8e (patch) | |
tree | ac1c22f82a9aa1b481142490623ad1aed5feb555 /drivers/serial/sandbox.c | |
parent | 4f86a724e82c0b74d9ffb7b65f8ae4b011dd0b03 (diff) | |
download | u-boot-ac7f5db9dc690901d99fe0afbcb3d4241c3cab8e.tar.gz |
dm: serial: Add ->getconfig() callback
In some cases it would be good to know the settings, such as parity,
of current serial console. One example might be an ACPI SPCR table
to generate using these parameters.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/serial/sandbox.c')
-rw-r--r-- | drivers/serial/sandbox.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index 4a05ea44ce..76d26d3c59 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -163,6 +163,18 @@ DEBUG_UART_FUNCS #endif /* CONFIG_DEBUG_UART_SANDBOX */ +static int sandbox_serial_getconfig(struct udevice *dev, uint *serial_config) +{ + uint config = SERIAL_DEFAULT_CONFIG; + + if (!serial_config) + return -EINVAL; + + *serial_config = config; + + return 0; +} + static int sandbox_serial_setconfig(struct udevice *dev, uint serial_config) { u8 parity = SERIAL_GET_PARITY(serial_config); @@ -207,6 +219,7 @@ static const struct dm_serial_ops sandbox_serial_ops = { .putc = sandbox_serial_putc, .pending = sandbox_serial_pending, .getc = sandbox_serial_getc, + .getconfig = sandbox_serial_getconfig, .setconfig = sandbox_serial_setconfig, }; |