* [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc
@ 2012-11-01 23:41 Allen Martin
2012-11-02 0:54 ` Marek Vasut
2012-11-07 21:31 ` Simon Glass
0 siblings, 2 replies; 3+ messages in thread
From: Allen Martin @ 2012-11-01 23:41 UTC (permalink / raw)
To: u-boot
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>
---
drivers/input/tegra-kbc.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c
index ab7a9e3..88471d3 100644
--- a/drivers/input/tegra-kbc.c
+++ b/drivers/input/tegra-kbc.c
@@ -63,6 +63,7 @@ static struct keyb {
struct kbc_tegra *kbc; /* tegra keyboard controller */
unsigned char inited; /* 1 if keyboard has been inited */
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.
@@ -306,6 +307,10 @@ static void tegra_kbc_open(void)
*/
static int init_tegra_keyboard(void)
{
+ /* check if already created */
+ if (config.created)
+ return 0;
+
#ifdef CONFIG_OF_CONTROL
int node;
@@ -349,6 +354,7 @@ static int init_tegra_keyboard(void)
config_kbc_gpio(config.kbc);
tegra_kbc_open();
+ config.created = 1;
debug("%s: Tegra keyboard ready\n", __func__);
return 0;
@@ -357,6 +363,8 @@ static int init_tegra_keyboard(void)
int drv_keyboard_init(void)
{
struct stdio_dev dev;
+ char *stdinname = getenv("stdin");
+ int error;
if (input_init(&config.input, 0)) {
debug("%s: Cannot set up input\n", __func__);
@@ -372,5 +380,13 @@ int drv_keyboard_init(void)
dev.start = init_tegra_keyboard;
/* 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;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc
2012-11-01 23:41 [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc Allen Martin
@ 2012-11-02 0:54 ` Marek Vasut
2012-11-07 21:31 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2012-11-02 0:54 UTC (permalink / raw)
To: u-boot
Dear Allen Martin,
> 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.
Thanks ;-)
I'll soon be tearing iomux apart btw., it looks like a bucket of crap :-(
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc
2012-11-01 23:41 [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc Allen Martin
2012-11-02 0:54 ` Marek Vasut
@ 2012-11-07 21:31 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2012-11-07 21:31 UTC (permalink / raw)
To: u-boot
Hi Allen,
On Thu, Nov 1, 2012 at 4:41 PM, Allen Martin <amartin@nvidia.com> wrote:
> 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>
> ---
> drivers/input/tegra-kbc.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c
> index ab7a9e3..88471d3 100644
> --- a/drivers/input/tegra-kbc.c
> +++ b/drivers/input/tegra-kbc.c
> @@ -63,6 +63,7 @@ static struct keyb {
> struct kbc_tegra *kbc; /* tegra keyboard controller */
> unsigned char inited; /* 1 if keyboard has been inited */
> 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.
> @@ -306,6 +307,10 @@ static void tegra_kbc_open(void)
> */
> static int init_tegra_keyboard(void)
> {
> + /* check if already created */
> + if (config.created)
> + return 0;
> +
I think this code should go after the 'int node' declaration, shouldn't it?
> #ifdef CONFIG_OF_CONTROL
> int node;
>
> @@ -349,6 +354,7 @@ static int init_tegra_keyboard(void)
> config_kbc_gpio(config.kbc);
>
> tegra_kbc_open();
> + config.created = 1;
> debug("%s: Tegra keyboard ready\n", __func__);
>
> return 0;
> @@ -357,6 +363,8 @@ static int init_tegra_keyboard(void)
> int drv_keyboard_init(void)
> {
> struct stdio_dev dev;
> + char *stdinname = getenv("stdin");
> + int error;
>
> if (input_init(&config.input, 0)) {
> debug("%s: Cannot set up input\n", __func__);
> @@ -372,5 +380,13 @@ int drv_keyboard_init(void)
> dev.start = init_tegra_keyboard;
>
> /* 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;
> }
> --
> 1.7.10.4
>
Regards,
Simon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-07 21:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 23:41 [U-Boot] [PATCH] tegra: add CONSOLE_MUX support to tegra-kbc Allen Martin
2012-11-02 0:54 ` Marek Vasut
2012-11-07 21:31 ` Simon Glass
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox