[PATCH] ideapad_laptop: Add Lenovo G50-30 to devices without radio switch

2015-05-29 Thread Philippe Coval
From: Dmitry Tunin 

Lenovo G50-30 rfkill always reports wireless blocked fix.

BugLink: https://bugs.launchpad.net/bugs/1397021
Cc: platform-driver-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Dmitry Tunin 
Signed-off-by: Philippe Coval 
---
 drivers/platform/x86/ideapad-laptop.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/x86/ideapad-laptop.c 
b/drivers/platform/x86/ideapad-laptop.c
index b496db8..6e82520 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -837,6 +837,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = {
},
},
{
+   .ident = "Lenovo G50-30",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+   DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo G50-30"),
+   },
+   },
+   {
.ident = "Lenovo Yoga 2 11 / 13 / Pro",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-- 
1.9.1

--
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/


[PATCH] usbtouchscreen: adds support for inverting X or Y axis (or both)

2015-06-07 Thread Philippe Coval
Invert Y is needed (together with swap XY) for some touchscreens :
- LeadingTouch screens (at least for some of them)
- cartft 8in4 (USB ID=0eef:0001)

Signed-off-by: Ondrej Zary 
Bug-Link: https://bugs.tizen.org/jira/browse/TC-2522
Cc: linux-in...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Philippe Coval 
---
 drivers/input/touchscreen/usbtouchscreen.c | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
b/drivers/input/touchscreen/usbtouchscreen.c
index f2c6c35..af7e6f3 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -63,6 +63,12 @@
 static bool swap_xy;
 module_param(swap_xy, bool, 0644);
 MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
+static int invert_x;
+module_param(invert_x, bool, 0644);
+MODULE_PARM_DESC(invert_x, "Invert X axis.");
+static int invert_y;
+module_param(invert_y, bool, 0644);
+MODULE_PARM_DESC(invert_y, "Invert Y axis.");
 
 static bool hwcalib_xy;
 module_param(hwcalib_xy, bool, 0644);
@@ -1303,6 +1309,7 @@ static void usbtouch_process_pkt(struct usbtouch_usb 
*usbtouch,
  unsigned char *pkt, int len)
 {
struct usbtouch_device_info *type = usbtouch->type;
+   int x, y;
 
if (!type->read_data(usbtouch, pkt))
return;
@@ -1310,12 +1317,20 @@ static void usbtouch_process_pkt(struct usbtouch_usb 
*usbtouch,
input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
 
if (swap_xy) {
-   input_report_abs(usbtouch->input, ABS_X, usbtouch->y);
-   input_report_abs(usbtouch->input, ABS_Y, usbtouch->x);
+   x = usbtouch->y;
+   y = usbtouch->x;
} else {
-   input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
-   input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
+   x = usbtouch->x;
+   y = usbtouch->y;
}
+   if (invert_x)
+   x = type->max_xc - x + type->min_xc;
+   if (invert_y)
+   y = type->max_yc - y + type->min_yc;
+
+   input_report_abs(usbtouch->input, ABS_X, x);
+   input_report_abs(usbtouch->input, ABS_Y, y);
+
if (type->max_press)
input_report_abs(usbtouch->input, ABS_PRESSURE, 
usbtouch->press);
input_sync(usbtouch->input);
-- 
2.1.4

--
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/


[PATCH v3] usbtouchscreen: add option for inverting X or Y axis

2015-07-27 Thread Philippe Coval
Invert Y is needed (together with swap XY) for some touchscreens,
at least for some of them :

- CarTft 8in4 (type=eGalax, USB=0eef:0001)
- LeadingTouch

Since there is not guarantee that
those above devices will all behave the same,
it's safer to configure them userland using udev rules.

This way is safer than hardcoding options per "recognized" model,
and possible regressions will be avoided in a first place.

Credits-to: Ondrej Zary 
Link:  https://lkml.org/lkml/2015/6/7/191
Bug-Link: https://bugs.tizen.org/jira/browse/TC-2522
Cc: linux-in...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Philippe Coval 
---

ChangeLog:

* v1: Initial version from me :
  Rebased on v4.1.0-rc6
  https://lkml.org/lkml/2015/6/7/191
  Note it is based on Ondrej Zary's patch (2007):
  https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg136266.html
  Test demo on tizen cartft 8inch4 :
  https://www.youtube.com/watch?v=4L9Bjfy8oDM
* v2: Use bool not int for options variables
  Rebased on v4.2-rc2
  Latest unmerged version can be picked from :
  https://github.com/rzr/linux/tree/for-upstream
* v3: Use bool static vars (for real), update commit message
  Rebased on v4.2-rc4
  https://github.com/dtor/input/pull/2

 drivers/input/touchscreen/usbtouchscreen.c | 25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
b/drivers/input/touchscreen/usbtouchscreen.c
index 2c41107..cfdfb9f 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -64,6 +64,14 @@ static bool swap_xy;
 module_param(swap_xy, bool, 0644);
 MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
 
+static bool invert_x;
+module_param(invert_x, bool, 0644);
+MODULE_PARM_DESC(invert_x, "Invert X axis.");
+
+static bool invert_y;
+module_param(invert_y, bool, 0644);
+MODULE_PARM_DESC(invert_y, "Invert Y axis.");
+
 static bool hwcalib_xy;
 module_param(hwcalib_xy, bool, 0644);
 MODULE_PARM_DESC(hwcalib_xy, "If set hw-calibrated X/Y are used if available");
@@ -1306,6 +1314,7 @@ static void usbtouch_process_pkt(struct usbtouch_usb 
*usbtouch,
  unsigned char *pkt, int len)
 {
struct usbtouch_device_info *type = usbtouch->type;
+   int x, y;
 
if (!type->read_data(usbtouch, pkt))
return;
@@ -1313,12 +1322,20 @@ static void usbtouch_process_pkt(struct usbtouch_usb 
*usbtouch,
input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
 
if (swap_xy) {
-   input_report_abs(usbtouch->input, ABS_X, usbtouch->y);
-   input_report_abs(usbtouch->input, ABS_Y, usbtouch->x);
+   x = usbtouch->y;
+   y = usbtouch->x;
} else {
-   input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
-   input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
+   x = usbtouch->x;
+   y = usbtouch->y;
}
+   if (invert_x)
+   x = type->max_xc - x + type->min_xc;
+   if (invert_y)
+   y = type->max_yc - y + type->min_yc;
+
+   input_report_abs(usbtouch->input, ABS_X, x);
+   input_report_abs(usbtouch->input, ABS_Y, y);
+
if (type->max_press)
input_report_abs(usbtouch->input, ABS_PRESSURE, 
usbtouch->press);
input_sync(usbtouch->input);
-- 
2.1.4

--
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/


[PATCH] ideapad_laptop: Add Lenovo G40-30 to devices without radio switch

2015-05-02 Thread Philippe Coval
Lenovo G40-30 does not provide any physical radio switch to user.
Therefore disable the rfkill switch identically to the Yoga 2 approach.
(Note for later, models ids are sorted alphabetically).

Benefit is to make wireless available again without unloading module.

It was tested successfully on 4.1.0-rc1 base with this model:
(LENOVO_MT_80FY_BU_idea_FM_Lenovo G40-30).

BugLink: https://bugs.launchpad.net/ideapad-laptop/+bug/1450946
Cc: platform-driver-...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Philippe Coval 
---
 drivers/platform/x86/ideapad-laptop.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/platform/x86/ideapad-laptop.c 
b/drivers/platform/x86/ideapad-laptop.c
index b3d419a..b496db8 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -830,6 +830,13 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 
event, void *data)
  */
 static const struct dmi_system_id no_hw_rfkill_list[] = {
{
+   .ident = "Lenovo G40-30",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+   DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo G40-30"),
+   },
+   },
+   {
.ident = "Lenovo Yoga 2 11 / 13 / Pro",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-- 
2.1.4

--
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 v3] usbtouchscreen: add option for inverting X or Y axis

2015-10-09 Thread Philippe Coval
On 7/28/15, Dmitry Torokhov  wrote:
> On Tue, Jul 28, 2015 at 12:16:01AM +0200, Philippe Coval wrote:
>> Invert Y is needed (together with swap XY) for some touchscreens,
>> at least for some of them :
>>
>> - CarTft 8in4 (type=eGalax, USB=0eef:0001)
>> - LeadingTouch
>>
>> Since there is not guarantee that
>> those above devices will all behave the same,
>> it's safer to configure them userland using udev rules.
>>
>> This way is safer than hardcoding options per "recognized" model,
>> and possible regressions will be avoided in a first place.
>
> Does the following still work?

Hi,

First apologies for delay.

Actually, I wished someone else will give you feedback earlier
since I don't have this screen anymore.

Anyway I know it worked well once applied to some 4.2 rc version.
(and also merged downstream in tizen on 3.14)

Doesn't the change look trivial ?
Do we assume it will work on later versions too ?

For the record here is the reference of the mentioned touchscreen :

MM500
http://www.cartft.com/catalog/il/477

I've contacted vendor, and It's not for sale anymore
(under this brand at least).

Regards

--
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/


[PATCH v2] usbtouchscreen: adds support for inverting X or Y axis (or both)

2015-07-13 Thread Philippe Coval
Invert Y is needed (together with swap XY) for some touchscreens :
- LeadingTouch screens (at least for some of them)
- CarTft 8in4 (USB ID=0eef:0001)

Signed-off-by: Ondrej Zary 
Bug-Link: https://bugs.tizen.org/jira/browse/TC-2522
Cc: linux-in...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Philippe Coval 
---

ChangeLog:

* v1: Initial version from me :
  Rebased on v4.1.0-rc6
  https://lkml.org/lkml/2015/6/7/191
  Note it is based on Ondrej Zary's patch (2007):
  https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg136266.html
  Test demo on tizen cartft 8inch4 :
  https://www.youtube.com/watch?v=4L9Bjfy8oDM
* v2: Use bool not int for options variables
  Rebased on v4.2-rc2
  Latest unmerged version can be picked from :
  https://github.com/rzr/linux/tree/for-upstream

 drivers/input/touchscreen/usbtouchscreen.c | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
b/drivers/input/touchscreen/usbtouchscreen.c
index f2c6c35..af7e6f3 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -63,6 +63,12 @@
 static bool swap_xy;
 module_param(swap_xy, bool, 0644);
 MODULE_PARM_DESC(swap_xy, "If set X and Y axes are swapped.");
+static int invert_x;
+module_param(invert_x, bool, 0644);
+MODULE_PARM_DESC(invert_x, "Invert X axis.");
+static int invert_y;
+module_param(invert_y, bool, 0644);
+MODULE_PARM_DESC(invert_y, "Invert Y axis.");
 
 static bool hwcalib_xy;
 module_param(hwcalib_xy, bool, 0644);
@@ -1303,6 +1309,7 @@ static void usbtouch_process_pkt(struct usbtouch_usb 
*usbtouch,
  unsigned char *pkt, int len)
 {
struct usbtouch_device_info *type = usbtouch->type;
+   int x, y;
 
if (!type->read_data(usbtouch, pkt))
return;
@@ -1310,12 +1317,20 @@ static void usbtouch_process_pkt(struct usbtouch_usb 
*usbtouch,
input_report_key(usbtouch->input, BTN_TOUCH, usbtouch->touch);
 
if (swap_xy) {
-   input_report_abs(usbtouch->input, ABS_X, usbtouch->y);
-   input_report_abs(usbtouch->input, ABS_Y, usbtouch->x);
+   x = usbtouch->y;
+   y = usbtouch->x;
} else {
-   input_report_abs(usbtouch->input, ABS_X, usbtouch->x);
-   input_report_abs(usbtouch->input, ABS_Y, usbtouch->y);
+   x = usbtouch->x;
+   y = usbtouch->y;
}
+   if (invert_x)
+   x = type->max_xc - x + type->min_xc;
+   if (invert_y)
+   y = type->max_yc - y + type->min_yc;
+
+   input_report_abs(usbtouch->input, ABS_X, x);
+   input_report_abs(usbtouch->input, ABS_Y, y);
+
if (type->max_press)
input_report_abs(usbtouch->input, ABS_PRESSURE, 
usbtouch->press);
input_sync(usbtouch->input);
-- 
2.1.4

--
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 v2] usbtouchscreen: adds support for inverting X or Y axis (or both)

2015-07-13 Thread Philippe Coval
On 07/13/2015 12:28 PM, Bastien Nocera wrote:
> On Mon, 2015-07-13 at 12:15 +0200, Philippe Coval wrote:
>> Invert Y is needed (together with swap XY) for some touchscreens :
>> - LeadingTouch screens (at least for some of them)
>> - CarTft 8in4 (USB ID=0eef:0001)
> 
> Wouldn't it be useful to force those settings for touchscreen devices
> which you can detect? That would make it work out-of-the-box on those
> devices.
> 
Hi,

That's what I am doing, but userland (using udev rules),
since I am really unsure we can rely on USB id...

For now, I don't think it's a good idea to force any behaviour,
that can cause regressions on other ones.

In a longer term, it would be good to keep a list of all those screens
and see what should be the prefered behaviour per identification.

Note, I don't have any screen anymore.

Thanks for feedback


-- 
 mailto:philippe.co...@eurogiciel.fr  --  gpg:0x467094BC
 xmpp:philippe.coval@gmail.com
 https://dockr.eurogiciel.fr/blogs/embedded/author/pcl/
  .




signature.asc
Description: OpenPGP digital signature