linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: wiimote: work around broken DRM_KAI on GEN10
@ 2013-08-04 16:50 David Herrmann
  2013-08-05 11:46 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: David Herrmann @ 2013-08-04 16:50 UTC (permalink / raw)
  To: linux-input; +Cc: Nicolas Adenis-Lamarre, Jiri Kosina, David Herrmann

GEN10 and earlier devices seem to not support DRM_KAI if we run in basic
IR mode. Use DRM_KAIE instead. This might increases overhead slightly as
the extension port is read and streamed but we stream accelerometer data
constantly, too, so this is negligible.

Note that our parsers are hardcoded on IR-formats, so we cannot actually
use 96-bit IR DRMs for basic IR data. We would have to adjust the parsers.
But as only GEN20 and newer support this, we simply avoid mixed DRMs.

This fixes a bug where GEN10 devices didn't provide IR data if
accelerometer and IR are enabled simultaneously. As a workaround, you can
enable DRM_KAIE without this patch via (disables device power-management):
  echo "37" >/sys/kernel/debug/hid/<dev>/drm

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reported-by: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>
---
 drivers/hid/hid-wiimote-core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
index 0c06054..6602098 100644
--- a/drivers/hid/hid-wiimote-core.c
+++ b/drivers/hid/hid-wiimote-core.c
@@ -212,10 +212,12 @@ static __u8 select_drm(struct wiimote_data *wdata)
 
 	if (ir == WIIPROTO_FLAG_IR_BASIC) {
 		if (wdata->state.flags & WIIPROTO_FLAG_ACCEL) {
-			if (ext)
-				return WIIPROTO_REQ_DRM_KAIE;
-			else
-				return WIIPROTO_REQ_DRM_KAI;
+			/* GEN10 and ealier devices bind IR formats to DRMs.
+			 * Hence, we cannot use DRM_KAI here as it might be
+			 * bound to IR_EXT. Use DRM_KAIE unconditionally so we
+			 * work with all devices and our parsers can use the
+			 * fixed formats, too. */
+			return WIIPROTO_REQ_DRM_KAIE;
 		} else {
 			return WIIPROTO_REQ_DRM_KIE;
 		}
-- 
1.8.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] HID: wiimote: work around broken DRM_KAI on GEN10
  2013-08-04 16:50 [PATCH] HID: wiimote: work around broken DRM_KAI on GEN10 David Herrmann
@ 2013-08-05 11:46 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2013-08-05 11:46 UTC (permalink / raw)
  To: David Herrmann; +Cc: linux-input, Nicolas Adenis-Lamarre

On Sun, 4 Aug 2013, David Herrmann wrote:

> GEN10 and earlier devices seem to not support DRM_KAI if we run in basic
> IR mode. Use DRM_KAIE instead. This might increases overhead slightly as
> the extension port is read and streamed but we stream accelerometer data
> constantly, too, so this is negligible.
> 
> Note that our parsers are hardcoded on IR-formats, so we cannot actually
> use 96-bit IR DRMs for basic IR data. We would have to adjust the parsers.
> But as only GEN20 and newer support this, we simply avoid mixed DRMs.
> 
> This fixes a bug where GEN10 devices didn't provide IR data if
> accelerometer and IR are enabled simultaneously. As a workaround, you can
> enable DRM_KAIE without this patch via (disables device power-management):
>   echo "37" >/sys/kernel/debug/hid/<dev>/drm
> 
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> Reported-by: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>

Applied, thanks.

> ---
>  drivers/hid/hid-wiimote-core.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/hid-wiimote-core.c b/drivers/hid/hid-wiimote-core.c
> index 0c06054..6602098 100644
> --- a/drivers/hid/hid-wiimote-core.c
> +++ b/drivers/hid/hid-wiimote-core.c
> @@ -212,10 +212,12 @@ static __u8 select_drm(struct wiimote_data *wdata)
>  
>  	if (ir == WIIPROTO_FLAG_IR_BASIC) {
>  		if (wdata->state.flags & WIIPROTO_FLAG_ACCEL) {
> -			if (ext)
> -				return WIIPROTO_REQ_DRM_KAIE;
> -			else
> -				return WIIPROTO_REQ_DRM_KAI;
> +			/* GEN10 and ealier devices bind IR formats to DRMs.
> +			 * Hence, we cannot use DRM_KAI here as it might be
> +			 * bound to IR_EXT. Use DRM_KAIE unconditionally so we
> +			 * work with all devices and our parsers can use the
> +			 * fixed formats, too. */
> +			return WIIPROTO_REQ_DRM_KAIE;
>  		} else {
>  			return WIIPROTO_REQ_DRM_KIE;
>  		}
> -- 
> 1.8.3.4
> 

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-05 11:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-04 16:50 [PATCH] HID: wiimote: work around broken DRM_KAI on GEN10 David Herrmann
2013-08-05 11:46 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).