Re: [PATCH] Input: atkbd - fix keyboard LG Electronics

2014-04-25 Thread Dmitry Torokhov
On Thu, Apr 24, 2014 at 07:57:12AM -0700, Sheng-Liang Song wrote:
> After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.  The
> workaround is to remove ATKBD_CMD_RESET_DIS for LG Keyboards.
> 
> In order to keep the minimum changes to the current atkbd driver, I add
> logic to apply the patch if and only if the device is LG LW25-B7HV or
> P1-J273B.
> 
> Signed-off-by: Sheng-Liang Song 

Applied, thank you.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Input: atkbd - fix keyboard LG Electronics

2014-04-25 Thread Dmitry Torokhov
On Thu, Apr 24, 2014 at 07:57:12AM -0700, Sheng-Liang Song wrote:
 After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.  The
 workaround is to remove ATKBD_CMD_RESET_DIS for LG Keyboards.
 
 In order to keep the minimum changes to the current atkbd driver, I add
 logic to apply the patch if and only if the device is LG LW25-B7HV or
 P1-J273B.
 
 Signed-off-by: Sheng-Liang Song s...@chromium.org

Applied, thank you.

-- 
Dmitry
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Input: atkbd - fix keyboard LG Electronics

2014-04-23 Thread Dmitry Torokhov
On Tue, Apr 22, 2014 at 06:51:22PM -0700, Sheng-Liang Song wrote:
> After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.
> The workaround is to remove ATKBD_CMD_RESET_DIS for LG Keyboards.
> 
> In order to keep the minimum changes to the current atkbd driver,
> I add logic to apply the patch if and only if the device is LG LW25-B7HV or 
> P1-J273B.

How about if we rework this just a little bit... Does the version of the
patch below work for you?

Also, I do need your "signed-off-by".

Thanks!

-- 
Dmitry

Input: atkbd - fix keyboard LG Electronics

From: Sheng-Liang Song 

After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.  The
workaround is to remove ATKBD_CMD_RESET_DIS for LG Keyboards.

In order to keep the minimum changes to the current atkbd driver, I add
logic to apply the patch if and only if the device is LG LW25-B7HV or
P1-J273B.

Signed-off-by: Dmitry Torokhov 
---
 drivers/input/keyboard/atkbd.c |   30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 2626773..06a4b0d 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -243,6 +243,12 @@ static void (*atkbd_platform_fixup)(struct atkbd *, const 
void *data);
 static void *atkbd_platform_fixup_data;
 static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned 
int);
 
+/*
+ * Certain keyboards to not like ATKBD_CMD_RESET_DIS and stop responding
+ * to many commands until full reset (ATKBD_CMD_RESET_BAT) is performed.
+ */
+static bool atkbd_skip_deactivate;
+
 static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
ssize_t (*handler)(struct atkbd *, char *));
 static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, 
size_t count,
@@ -698,7 +704,6 @@ static int atkbd_activate(struct atkbd *atkbd)
  * atkbd_deactivate() resets and disables the keyboard from sending
  * keystrokes.
  */
-
 static void atkbd_deactivate(struct atkbd *atkbd)
 {
struct ps2dev *ps2dev = >ps2dev;
@@ -768,7 +773,8 @@ static int atkbd_probe(struct atkbd *atkbd)
  * Make sure nothing is coming from the keyboard and disturbs our
  * internal state.
  */
-   atkbd_deactivate(atkbd);
+   if (!atkbd_skip_deactivate)
+   atkbd_deactivate(atkbd);
 
return 0;
 }
@@ -1638,6 +1644,12 @@ static int __init atkbd_setup_scancode_fixup(const 
struct dmi_system_id *id)
return 1;
 }
 
+static int __init atkbd_deactivate_fixup(const struct dmi_system_id *id)
+{
+   atkbd_skip_deactivate = true;
+   return 1;
+}
+
 static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = {
{
.matches = {
@@ -1775,6 +1787,20 @@ static const struct dmi_system_id 
atkbd_dmi_quirk_table[] __initconst = {
.callback = atkbd_setup_scancode_fixup,
.driver_data = atkbd_oqo_01plus_scancode_fixup,
},
+   {
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"),
+   },
+   .callback = atkbd_deactivate_fixup,
+   },
+   {
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"),
+   },
+   .callback = atkbd_deactivate_fixup,
+   },
{ }
 };
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Input: atkbd - fix keyboard LG Electronics

2014-04-23 Thread Dmitry Torokhov
On Tue, Apr 22, 2014 at 06:51:22PM -0700, Sheng-Liang Song wrote:
 After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.
 The workaround is to remove ATKBD_CMD_RESET_DIS for LG Keyboards.
 
 In order to keep the minimum changes to the current atkbd driver,
 I add logic to apply the patch if and only if the device is LG LW25-B7HV or 
 P1-J273B.

How about if we rework this just a little bit... Does the version of the
patch below work for you?

Also, I do need your signed-off-by.

Thanks!

-- 
Dmitry

Input: atkbd - fix keyboard LG Electronics

From: Sheng-Liang Song s...@chromium.org

After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.  The
workaround is to remove ATKBD_CMD_RESET_DIS for LG Keyboards.

In order to keep the minimum changes to the current atkbd driver, I add
logic to apply the patch if and only if the device is LG LW25-B7HV or
P1-J273B.

Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com
---
 drivers/input/keyboard/atkbd.c |   30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 2626773..06a4b0d 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -243,6 +243,12 @@ static void (*atkbd_platform_fixup)(struct atkbd *, const 
void *data);
 static void *atkbd_platform_fixup_data;
 static unsigned int (*atkbd_platform_scancode_fixup)(struct atkbd *, unsigned 
int);
 
+/*
+ * Certain keyboards to not like ATKBD_CMD_RESET_DIS and stop responding
+ * to many commands until full reset (ATKBD_CMD_RESET_BAT) is performed.
+ */
+static bool atkbd_skip_deactivate;
+
 static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
ssize_t (*handler)(struct atkbd *, char *));
 static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, 
size_t count,
@@ -698,7 +704,6 @@ static int atkbd_activate(struct atkbd *atkbd)
  * atkbd_deactivate() resets and disables the keyboard from sending
  * keystrokes.
  */
-
 static void atkbd_deactivate(struct atkbd *atkbd)
 {
struct ps2dev *ps2dev = atkbd-ps2dev;
@@ -768,7 +773,8 @@ static int atkbd_probe(struct atkbd *atkbd)
  * Make sure nothing is coming from the keyboard and disturbs our
  * internal state.
  */
-   atkbd_deactivate(atkbd);
+   if (!atkbd_skip_deactivate)
+   atkbd_deactivate(atkbd);
 
return 0;
 }
@@ -1638,6 +1644,12 @@ static int __init atkbd_setup_scancode_fixup(const 
struct dmi_system_id *id)
return 1;
 }
 
+static int __init atkbd_deactivate_fixup(const struct dmi_system_id *id)
+{
+   atkbd_skip_deactivate = true;
+   return 1;
+}
+
 static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = {
{
.matches = {
@@ -1775,6 +1787,20 @@ static const struct dmi_system_id 
atkbd_dmi_quirk_table[] __initconst = {
.callback = atkbd_setup_scancode_fixup,
.driver_data = atkbd_oqo_01plus_scancode_fixup,
},
+   {
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, LG Electronics),
+   DMI_MATCH(DMI_PRODUCT_NAME, LW25-B7HV),
+   },
+   .callback = atkbd_deactivate_fixup,
+   },
+   {
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, LG Electronics),
+   DMI_MATCH(DMI_PRODUCT_NAME, P1-J273B),
+   },
+   .callback = atkbd_deactivate_fixup,
+   },
{ }
 };
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Input: atkbd - fix keyboard LG Electronics

2014-04-22 Thread Dmitry Torokhov
Hi Sheng-Liang,

On Tue, Apr 22, 2014 at 09:59:30AM -0700, Sheng-Liang Song wrote:
> After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.
> The workaround is to issue ATKBD_CMD_RESET_DEF after ATKBD_CMD_RESET_DIS.

Hmm, if ATKBD_CMD_RESET_DIS causes keyboard not working should we
simply not call it on LG devices?

The idea for using ATKBD_CMD_RESET_DIS was for keyboard to stop
generating scan codes so they do not interfere with detection/resume and
issuing ATKBD_CMD_RESET_DEF right after ATKBD_CMD_RESET_DIS keeps
keyboard in exactly the same state as it was before (i.e. generating
scancodes).

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Input: atkbd - fix keyboard LG Electronics

2014-04-22 Thread Dmitry Torokhov
Hi Sheng-Liang,

On Tue, Apr 22, 2014 at 09:59:30AM -0700, Sheng-Liang Song wrote:
 After issuing ATKBD_CMD_RESET_DIS, LG Keyboard stop working.
 The workaround is to issue ATKBD_CMD_RESET_DEF after ATKBD_CMD_RESET_DIS.

Hmm, if ATKBD_CMD_RESET_DIS causes keyboard not working should we
simply not call it on LG devices?

The idea for using ATKBD_CMD_RESET_DIS was for keyboard to stop
generating scan codes so they do not interfere with detection/resume and
issuing ATKBD_CMD_RESET_DEF right after ATKBD_CMD_RESET_DIS keeps
keyboard in exactly the same state as it was before (i.e. generating
scancodes).

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/