tegra: add CONSOLE_MUX support to tegra-kbc

Add support for CONSOLE_MUX to tegra-kbc driver.  This requires
adding a flag to struct keyb to know the driver has already been
initialized so if we try to initialize it again we can just return
success.  Also call into iomux_doenv() from drv_keyboard_init to
re-evaluate the stdin string.

Signed-off-by: Allen Martin <amartin@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
This commit is contained in:
Allen Martin 2012-11-01 13:41:16 +00:00 committed by Tom Warren
parent 7155dc97f6
commit 1ed0b51b7d
1 changed files with 17 additions and 1 deletions

View File

@ -63,6 +63,7 @@ static struct keyb {
struct kbc_tegra *kbc; /* tegra keyboard controller */ struct kbc_tegra *kbc; /* tegra keyboard controller */
unsigned char inited; /* 1 if keyboard has been inited */ unsigned char inited; /* 1 if keyboard has been inited */
unsigned char first_scan; /* 1 if this is our first key scan */ unsigned char first_scan; /* 1 if this is our first key scan */
unsigned char created; /* 1 if driver has been created */
/* /*
* After init we must wait a short time before polling the keyboard. * After init we must wait a short time before polling the keyboard.
@ -306,6 +307,10 @@ static void tegra_kbc_open(void)
*/ */
static int init_tegra_keyboard(void) static int init_tegra_keyboard(void)
{ {
/* check if already created */
if (config.created)
return 0;
#ifdef CONFIG_OF_CONTROL #ifdef CONFIG_OF_CONTROL
int node; int node;
@ -349,6 +354,7 @@ static int init_tegra_keyboard(void)
config_kbc_gpio(config.kbc); config_kbc_gpio(config.kbc);
tegra_kbc_open(); tegra_kbc_open();
config.created = 1;
debug("%s: Tegra keyboard ready\n", __func__); debug("%s: Tegra keyboard ready\n", __func__);
return 0; return 0;
@ -357,6 +363,8 @@ static int init_tegra_keyboard(void)
int drv_keyboard_init(void) int drv_keyboard_init(void)
{ {
struct stdio_dev dev; struct stdio_dev dev;
char *stdinname = getenv("stdin");
int error;
if (input_init(&config.input, 0)) { if (input_init(&config.input, 0)) {
debug("%s: Cannot set up input\n", __func__); debug("%s: Cannot set up input\n", __func__);
@ -372,5 +380,13 @@ int drv_keyboard_init(void)
dev.start = init_tegra_keyboard; dev.start = init_tegra_keyboard;
/* Register the device. init_tegra_keyboard() will be called soon */ /* Register the device. init_tegra_keyboard() will be called soon */
return input_stdio_register(&dev); error = input_stdio_register(&dev);
if (error)
return error;
#ifdef CONFIG_CONSOLE_MUX
error = iomux_doenv(stdin, stdinname);
if (error)
return error;
#endif
return 0;
} }