From patchwork Sun Aug 4 16:50:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2838442 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 456859F3B9 for ; Sun, 4 Aug 2013 16:50:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65AB920171 for ; Sun, 4 Aug 2013 16:50:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84E4920164 for ; Sun, 4 Aug 2013 16:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753687Ab3HDQum (ORCPT ); Sun, 4 Aug 2013 12:50:42 -0400 Received: from mail-ee0-f51.google.com ([74.125.83.51]:37412 "EHLO mail-ee0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753663Ab3HDQum (ORCPT ); Sun, 4 Aug 2013 12:50:42 -0400 Received: by mail-ee0-f51.google.com with SMTP id c1so1176686eek.38 for ; Sun, 04 Aug 2013 09:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=7z0IxDk8nKxQf2wuLcoQ6uORBHTD5VZpk7Zpsq6MlDg=; b=M6qt7YPkTCkcJebGR++NZBxREZBY1FbF9Jo0J+LBXnmqXkPjDoZeK2UMgQXkZQ46wV 7bnACNs4Qopybc0eL1BP5nohGhjwYN8juN8A7ddyDjE7RVb24TC5E+ZoPSH/kqx6b1XF OX0UBHDpgw0mq+UD65ZJF0KeFj64haB66fn9Kfg1NAgWRp94LbVt5LfcECpgj7evUw0s IOBz49N2OJY9AbIDfjkNze8JD7evKgpg1MK8zlorUYCGDtCSGPzXvg8p3/M9oER1CvUG A4E9g7imEWHcHJh42rtWyh7RqqvfHJ2ds+kDkiYGmzYVCBwajSfeYD7Qii4B8QR5yzqI S6cA== X-Received: by 10.14.225.72 with SMTP id y48mr13623275eep.131.1375635040847; Sun, 04 Aug 2013 09:50:40 -0700 (PDT) Received: from localhost.localdomain (stgt-5f71a0c4.pool.mediaWays.net. [95.113.160.196]) by mx.google.com with ESMTPSA id v41sm27207608eep.10.2013.08.04.09.50.38 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 04 Aug 2013 09:50:39 -0700 (PDT) From: David Herrmann To: linux-input@vger.kernel.org Cc: Nicolas Adenis-Lamarre , Jiri Kosina , David Herrmann Subject: [PATCH] HID: wiimote: work around broken DRM_KAI on GEN10 Date: Sun, 4 Aug 2013 18:50:10 +0200 Message-Id: <1375635010-2468-1-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.3.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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//drm Signed-off-by: David Herrmann Reported-by: Nicolas Adenis-Lamarre --- 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; }