From patchwork Tue Nov 19 10:51:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11251731 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68234109A for ; Tue, 19 Nov 2019 10:51:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4789A2230D for ; Tue, 19 Nov 2019 10:51:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="GXa4/IdM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725798AbfKSKvW (ORCPT ); Tue, 19 Nov 2019 05:51:22 -0500 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:58609 "EHLO lb3-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbfKSKvV (ORCPT ); Tue, 19 Nov 2019 05:51:21 -0500 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:9879:d2e2:f0e2:9c7]) by smtp-cloud7.xs4all.net with ESMTPA id X16MiClSQcs92X16NiynXo; Tue, 19 Nov 2019 11:51:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1574160680; bh=MlggBG+CD7fPcgJTp67HpQHeT5mQfD9yxA6YaGd7pwY=; h=From:To:Subject:Date:Message-Id:MIME-Version:From:Subject; b=GXa4/IdM8oC+1fYL6DBlqHKmv4l/OieqaZAJ6jtxXZ+U7MjN5h1a+tIOpddvuNMja GkhEjw8SPnyCcGtFct5tVrmBFaxg75TsDYtDyPzgst616H8Zqrn5Ag27sES3Wn/6ax jUSaPBEgrAmOl0gVPaGF8Bxxza2ys2vPhJdnHl1mviKCaSBly600zSd6goiQ/8ZEEG oCH/NEJeJua7CQ+37hBuFRXqJfZFdobCFtg9tZnP5TbV+xvIYzW4QrmZMfd2HPoIiT YYEhwhv7L1f2UVBcUzFztwrWCTWYwwkEncdpspHChGJvgbFk/VT7UXgubBUcmZGhTs v2CRIEBMLm96Q== From: Hans Verkuil To: linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Philipp Zabel , Nick Dyer , Lucas Stach , Christopher Heiny , Vandana BN , Hans Verkuil Subject: [PATCH 1/5] input/mouse/synaptics: add LEN0091 support Date: Tue, 19 Nov 2019 11:51:14 +0100 Message-Id: <20191119105118.54285-2-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> References: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfITl6e8i82InOTHwXM3kdwYO2AxR8EsKQ3NIN50rAHb0nE7+NpDfx3mE0aarPKfcSasr0Ef93osdW5It+tibHUdNgekdaia7RnK1JLNhQe9ASaSRaj5Y 01ScKcty+LNeFJk7S1KoU3uHCHNR/+GdaMmzWBexrnJQPZUBleqd1VFwyAiHcrwbjijryb0SIzJh+/W2xGnIofAyh8nccKoptJ2IxRw+4eHaVoINciU5/fmh uQYCUsTe1oqd//1y1LMgbJZpGVxy/vx86+7G1kdQdSKiTkDO09acp4XttZL7PEBZSHHh/y2lgAWQWtk1xlr2rXqF1UXKshBJgGpyjlzb0etJDqBE0XPFq7y+ tUhSg0KxnAq6nkJf2uQFDKq+b2McMvnzVWvHUFmD+tVqsN7xzqyGGlKKlH+6JsKJXhVQ9hpSAkrXbw+FAUBtInmWE7pekAYhRS/+AbkWgAIru+kBPUm5qThf olwcCYk9h6xgzTBzYbBaB+ImNTreFf8npd3UDT5T+dh67J53wJ2Cu5wS9q4= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Some Lenovo X1 Carbon Gen 6 laptops report LEN0091. Add this to the smbus_pnp_ids list. Signed-off-by: Hans Verkuil --- drivers/input/mouse/synaptics.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 56fae3472114..1ae6f8bba9ae 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c @@ -172,6 +172,7 @@ static const char * const smbus_pnp_ids[] = { "LEN0071", /* T480 */ "LEN0072", /* X1 Carbon Gen 5 (2017) - Elan/ALPS trackpoint */ "LEN0073", /* X1 Carbon G5 (Elantech) */ + "LEN0091", /* X1 Carbon 6 */ "LEN0092", /* X1 Carbon 6 */ "LEN0093", /* T480 */ "LEN0096", /* X280 */ From patchwork Tue Nov 19 10:51:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11251719 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 631231390 for ; Tue, 19 Nov 2019 10:51:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43B31222F2 for ; Tue, 19 Nov 2019 10:51:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="tJ7nEy3z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727640AbfKSKvX (ORCPT ); Tue, 19 Nov 2019 05:51:23 -0500 Received: from lb1-smtp-cloud7.xs4all.net ([194.109.24.24]:59563 "EHLO lb1-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727352AbfKSKvW (ORCPT ); Tue, 19 Nov 2019 05:51:22 -0500 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:9879:d2e2:f0e2:9c7]) by smtp-cloud7.xs4all.net with ESMTPA id X16MiClSQcs92X16OiynY0; Tue, 19 Nov 2019 11:51:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1574160680; bh=pA7d9ibcyBpo76n2ZOdiJPdSt0mQ/nhmdI3YFOC70Xg=; h=From:To:Subject:Date:Message-Id:MIME-Version:From:Subject; b=tJ7nEy3zE76pr6Rt+V9Ed0FxGOltJwrr01u5MbWEOD796wPZwDYoch272LFpPhxQE lSBFeC9a70qKU2NDWtTGebPC04rfeWcgv3fY+7iNyuoPgAphcfak+0dxdVqtNYpAsw pe1atAk4ztzygxel4gTB4rVp3rbvPG7lTGUA1M6ms7s7BXHTFMDNjqlWDUYD+yMFDg SWKfj++XUMfTnFpYKyS6lbgwv3l6Uj2939i8men0VsG61O/DWbGqD5vBPDQBJxGdlS AnxtTl3wZDWXpNrgm1eVO4R8n6VJuaeSKRZWPheTZi0EaQ9VHoMtUYmY8DZyY5tEb9 eNhzDfaX0hPNA== From: Hans Verkuil To: linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Philipp Zabel , Nick Dyer , Lucas Stach , Christopher Heiny , Vandana BN , Hans Verkuil Subject: [PATCH 2/5] input/rmi4/rmi_f54: fix various V4L2 compliance problems Date: Tue, 19 Nov 2019 11:51:15 +0100 Message-Id: <20191119105118.54285-3-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> References: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfITl6e8i82InOTHwXM3kdwYO2AxR8EsKQ3NIN50rAHb0nE7+NpDfx3mE0aarPKfcSasr0Ef93osdW5It+tibHUdNgekdaia7RnK1JLNhQe9ASaSRaj5Y 01ScKcty+LNeFJk7S1KoU3uHCHNR/+GdaMmzWBexrnJQPZUBleqd1VFwyAiHcrwbjijryb0SIzJh+/W2xGnIofAyh8nccKoptJ2IxRw+4eHaVoINciU5/fmh uQYCUsTe1oqd//1y1LMgbJZpGVxy/vx86+7G1kdQdSKiTkDO09acp4XttZL7PEBZSHHh/y2lgAWQWtk1xlr2rXqF1UXKshBJgGpyjlzb0etJDqBE0XPFq7y+ tUhSg0KxnAq6nkJf2uQFDKq+b2McMvnzVWvHUFmD+tVqsN7xzqyGGlKKlH+6JsKJXhVQ9hpSAkrXbw+FAUBtInmWE7pekAYhRS/+AbkWgAIru+kBPUm5qThf olwcCYk9h6xgzTBzYbBaB+ImNTreFf8npd3UDT5T+dh67J53wJ2Cu5wS9q4= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The v4l2-compliance utility reported several V4L2 API compliance issues: - the sequence counter wasn't filled in - the sequence counter wasn't reset to 0 at the start of streaming - the returned field value wasn't set to V4L2_FIELD_NONE - the timestamp wasn't set - the payload size was undefined if an error was returned - min_buffers_needed doesn't need to be initialized Fix these issues. Signed-off-by: Hans Verkuil Reviewed-by: Lucas Stach vb2_queue); u16 *ptr; enum vb2_buffer_state state; @@ -298,6 +300,7 @@ static void rmi_f54_buffer_queue(struct vb2_buffer *vb) mutex_lock(&f54->status_mutex); + vb2_set_plane_payload(vb, 0, 0); reptype = rmi_f54_get_reptype(f54, f54->input); if (reptype == F54_REPORT_NONE) { state = VB2_BUF_STATE_ERROR; @@ -344,14 +347,25 @@ static void rmi_f54_buffer_queue(struct vb2_buffer *vb) data_done: mutex_unlock(&f54->data_mutex); done: + vb->timestamp = ktime_get_ns(); + vbuf->field = V4L2_FIELD_NONE; + vbuf->sequence = f54->sequence++; vb2_buffer_done(vb, state); mutex_unlock(&f54->status_mutex); } +static void rmi_f54_stop_streaming(struct vb2_queue *q) +{ + struct f54_data *f54 = vb2_get_drv_priv(q); + + f54->sequence = 0; +} + /* V4L2 structures */ static const struct vb2_ops rmi_f54_queue_ops = { .queue_setup = rmi_f54_queue_setup, .buf_queue = rmi_f54_buffer_queue, + .stop_streaming = rmi_f54_stop_streaming, .wait_prepare = vb2_ops_wait_prepare, .wait_finish = vb2_ops_wait_finish, }; @@ -363,7 +377,6 @@ static const struct vb2_queue rmi_f54_queue = { .ops = &rmi_f54_queue_ops, .mem_ops = &vb2_vmalloc_memops, .timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC, - .min_buffers_needed = 1, }; static int rmi_f54_vidioc_querycap(struct file *file, void *priv, From patchwork Tue Nov 19 10:51:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11251721 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82431109A for ; Tue, 19 Nov 2019 10:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61DC42230F for ; Tue, 19 Nov 2019 10:51:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="N4VhK+l1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727684AbfKSKvY (ORCPT ); Tue, 19 Nov 2019 05:51:24 -0500 Received: from lb1-smtp-cloud7.xs4all.net ([194.109.24.24]:56431 "EHLO lb1-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727638AbfKSKvW (ORCPT ); Tue, 19 Nov 2019 05:51:22 -0500 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:9879:d2e2:f0e2:9c7]) by smtp-cloud7.xs4all.net with ESMTPA id X16MiClSQcs92X16OiynYB; Tue, 19 Nov 2019 11:51:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1574160680; bh=QJNKgbqqLCwOtr7xCFAGFzv4hgqLTxUBrVvrdQHGMME=; h=From:To:Subject:Date:Message-Id:MIME-Version:From:Subject; b=N4VhK+l1V+TvOGKicGsIS/OBvgf6NQqbuE5MqzJLeAUYSlPo8s7Ou62PA174UH+RQ 9ixD+zkEOPLyn8yien5tDCEio2qb0AKuATJ3GHhTivI21ZHR0h/60U+sFRwXGkIii9 wHHKEsunvj5mEMxgAGCYsGfsCDAphPn+2Xw2+iRwy2pc8oyZ9VDMhPrEf+75MNisDS iwf75u894wZI6dwi6CRf//XQxMMVqKdk/aTaGWVEjdudNRLJWx1E4tux974ihC5AVS DFdtl9BiTsmWK2Ic4KXMxAHa/VadN8jdH9qcoBmel28LNGU8xoGrd5F4lK90FUC/Qo RaYpS6objA6Ag== From: Hans Verkuil To: linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Philipp Zabel , Nick Dyer , Lucas Stach , Christopher Heiny , Vandana BN , Hans Verkuil Subject: [PATCH 3/5] pixfmt-tch-td16/tu16.rst: document that this is little endian Date: Tue, 19 Nov 2019 11:51:16 +0100 Message-Id: <20191119105118.54285-4-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> References: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfITl6e8i82InOTHwXM3kdwYO2AxR8EsKQ3NIN50rAHb0nE7+NpDfx3mE0aarPKfcSasr0Ef93osdW5It+tibHUdNgekdaia7RnK1JLNhQe9ASaSRaj5Y 01ScKcty+LNeFJk7S1KoU3uHCHNR/+GdaMmzWBexrnJQPZUBleqd1VFwyAiHcrwbjijryb0SIzJh+/W2xGnIofAyh8nccKoptJ2IxRw+4eHaVoINciU5/fmh uQYCUsTe1oqd//1y1LMgbJZpGVxy/vx86+7G1kdQdSKiTkDO09acp4XttZL7PEBZSHHh/y2lgAWQWtk1xlr2rXqF1UXKshBJgGpyjlzb0etJDqBE0XPFq7y+ tUhSg0KxnAq6nkJf2uQFDKq+b2McMvnzVWvHUFmD+tVqsN7xzqyGGlKKlH+6JsKJXhVQ9hpSAkrXbw+FAUBtInmWE7pekAYhRS/+AbkWgAIru+kBPUm5qThf olwcCYk9h6xgzTBzYbBaB+ImNTreFf8npd3UDT5T+dh67J53wJ2Cu5wS9q4= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Testing with the rmi_f54 driver on the Lenovo X1 Carbon 6th gen laptop showed that the data is in little endian format. Update the documentation accordingly. Signed-off-by: Hans Verkuil --- .../media/uapi/v4l/pixfmt-tch-td16.rst | 34 +++++++++---------- .../media/uapi/v4l/pixfmt-tch-tu16.rst | 34 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst b/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst index 4031b175257c..6f1be873bec1 100644 --- a/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-tch-td16.rst @@ -15,7 +15,7 @@ V4L2_TCH_FMT_DELTA_TD16 ('TD16') *man V4L2_TCH_FMT_DELTA_TD16(2)* -16-bit signed Touch Delta +16-bit signed little endian Touch Delta Description @@ -37,38 +37,38 @@ Each cell is one byte. :widths: 2 1 1 1 1 1 1 1 1 * - start + 0: - - D'\ :sub:`00high` - D'\ :sub:`00low` - - D'\ :sub:`01high` + - D'\ :sub:`00high` - D'\ :sub:`01low` - - D'\ :sub:`02high` + - D'\ :sub:`01high` - D'\ :sub:`02low` - - D'\ :sub:`03high` + - D'\ :sub:`02high` - D'\ :sub:`03low` + - D'\ :sub:`03high` * - start + 8: - - D'\ :sub:`10high` - D'\ :sub:`10low` - - D'\ :sub:`11high` + - D'\ :sub:`10high` - D'\ :sub:`11low` - - D'\ :sub:`12high` + - D'\ :sub:`11high` - D'\ :sub:`12low` - - D'\ :sub:`13high` + - D'\ :sub:`12high` - D'\ :sub:`13low` + - D'\ :sub:`13high` * - start + 16: - - D'\ :sub:`20high` - D'\ :sub:`20low` - - D'\ :sub:`21high` + - D'\ :sub:`20high` - D'\ :sub:`21low` - - D'\ :sub:`22high` + - D'\ :sub:`21high` - D'\ :sub:`22low` - - D'\ :sub:`23high` + - D'\ :sub:`22high` - D'\ :sub:`23low` + - D'\ :sub:`23high` * - start + 24: - - D'\ :sub:`30high` - D'\ :sub:`30low` - - D'\ :sub:`31high` + - D'\ :sub:`30high` - D'\ :sub:`31low` - - D'\ :sub:`32high` + - D'\ :sub:`31high` - D'\ :sub:`32low` - - D'\ :sub:`33high` + - D'\ :sub:`32high` - D'\ :sub:`33low` + - D'\ :sub:`33high` diff --git a/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst b/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst index 8278543be99a..cb3da6687a58 100644 --- a/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst +++ b/Documentation/media/uapi/v4l/pixfmt-tch-tu16.rst @@ -15,7 +15,7 @@ V4L2_TCH_FMT_TU16 ('TU16') *man V4L2_TCH_FMT_TU16(2)* -16-bit unsigned raw touch data +16-bit unsigned little endian raw touch data Description @@ -36,38 +36,38 @@ Each cell is one byte. :widths: 2 1 1 1 1 1 1 1 1 * - start + 0: - - R'\ :sub:`00high` - R'\ :sub:`00low` - - R'\ :sub:`01high` + - R'\ :sub:`00high` - R'\ :sub:`01low` - - R'\ :sub:`02high` + - R'\ :sub:`01high` - R'\ :sub:`02low` - - R'\ :sub:`03high` + - R'\ :sub:`02high` - R'\ :sub:`03low` + - R'\ :sub:`03high` * - start + 8: - - R'\ :sub:`10high` - R'\ :sub:`10low` - - R'\ :sub:`11high` + - R'\ :sub:`10high` - R'\ :sub:`11low` - - R'\ :sub:`12high` + - R'\ :sub:`11high` - R'\ :sub:`12low` - - R'\ :sub:`13high` + - R'\ :sub:`12high` - R'\ :sub:`13low` + - R'\ :sub:`13high` * - start + 16: - - R'\ :sub:`20high` - R'\ :sub:`20low` - - R'\ :sub:`21high` + - R'\ :sub:`20high` - R'\ :sub:`21low` - - R'\ :sub:`22high` + - R'\ :sub:`21high` - R'\ :sub:`22low` - - R'\ :sub:`23high` + - R'\ :sub:`22high` - R'\ :sub:`23low` + - R'\ :sub:`23high` * - start + 24: - - R'\ :sub:`30high` - R'\ :sub:`30low` - - R'\ :sub:`31high` + - R'\ :sub:`30high` - R'\ :sub:`31low` - - R'\ :sub:`32high` + - R'\ :sub:`31high` - R'\ :sub:`32low` - - R'\ :sub:`33high` + - R'\ :sub:`32high` - R'\ :sub:`33low` + - R'\ :sub:`33high` From patchwork Tue Nov 19 10:51:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11251715 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E45B188B for ; Tue, 19 Nov 2019 10:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B46D2230F for ; Tue, 19 Nov 2019 10:51:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="HCcV+aS3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727673AbfKSKvW (ORCPT ); Tue, 19 Nov 2019 05:51:22 -0500 Received: from lb2-smtp-cloud7.xs4all.net ([194.109.24.28]:43677 "EHLO lb2-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727640AbfKSKvW (ORCPT ); Tue, 19 Nov 2019 05:51:22 -0500 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:9879:d2e2:f0e2:9c7]) by smtp-cloud7.xs4all.net with ESMTPA id X16MiClSQcs92X16OiynYK; Tue, 19 Nov 2019 11:51:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1574160680; bh=9U+inmzg5NrDx5i6uhSFqhpwKs50Qq/7assBwITEC2U=; h=From:To:Subject:Date:Message-Id:MIME-Version:From:Subject; b=HCcV+aS3b95/a481mRSNssdcmECUPmfJyV3vR3H5r3Fei8d7TIEH14tCou+6c+1aC TEbw5khaiRzswxJ2ViEJtvnCEoDD9wiuoqeW5z92lk57uLlxCJ/ZvOk4F3ZehZ2caD brxSWw4nMlR5oVQJo+jS5SpsZc6FnTMnWbkZBuAfpzSS+3CtWGg4cb05C8dhfbn+6K FJhcSP7SiDFTRzEhqeTbPKD6AfkNG435xiE7tmoCbdaGXRVrvcAqvptSRW1N68kP/9 eBXNFmF9COSBFK9uGVKItc+8Lmc7nlJTjokt9eSMavCvWVY95NfScpVrYghihrAgfS y+15JMo0t6ZaQ== From: Hans Verkuil To: linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Philipp Zabel , Nick Dyer , Lucas Stach , Christopher Heiny , Vandana BN , Hans Verkuil Subject: [PATCH 4/5] input/rmi4/rmi_driver: check if irq_find_mapping returns 0 Date: Tue, 19 Nov 2019 11:51:17 +0100 Message-Id: <20191119105118.54285-5-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> References: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfITl6e8i82InOTHwXM3kdwYO2AxR8EsKQ3NIN50rAHb0nE7+NpDfx3mE0aarPKfcSasr0Ef93osdW5It+tibHUdNgekdaia7RnK1JLNhQe9ASaSRaj5Y 01ScKcty+LNeFJk7S1KoU3uHCHNR/+GdaMmzWBexrnJQPZUBleqd1VFwyAiHcrwbjijryb0SIzJh+/W2xGnIofAyh8nccKoptJ2IxRw+4eHaVoINciU5/fmh uQYCUsTe1oqd//1y1LMgbJZpGVxy/vx86+7G1kdQdSKiTkDO09acp4XttZL7PEBZSHHh/y2lgAWQWtk1xlr2rXqF1UXKshBJgGpyjlzb0etJDqBE0XPFq7y+ tUhSg0KxnAq6nkJf2uQFDKq+b2McMvnzVWvHUFmD+tVqsN7xzqyGGlKKlH+6JsKJXhVQ9hpSAkrXbw+FAUBtInmWE7pekAYhRS/+AbkWgAIru+kBPUm5qThf olwcCYk9h6xgzTBzYbBaB+ImNTreFf8npd3UDT5T+dh67J53wJ2Cu5wS9q4= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The irq_find_mapping() function can return 0 when called in the rmi_process_interrupt_requests() function. This causes a kernel crash. Check for a 0 value and skip calling handle_nested_irq() in that case. This was tested with the F54 function enabled on a Lenovo X1 Carbon. Signed-off-by: Hans Verkuil Fixes: 24d28e4f1271 ("Input: synaptics-rmi4 - convert irq distribution to irq_domain") --- drivers/input/rmi4/rmi_driver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 772493b1f665..6085ec424a84 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -154,8 +154,12 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) */ mutex_unlock(&data->irq_mutex); - for_each_set_bit(i, data->irq_status, data->irq_count) - handle_nested_irq(irq_find_mapping(data->irqdomain, i)); + for_each_set_bit(i, data->irq_status, data->irq_count) { + unsigned int irq = irq_find_mapping(data->irqdomain, i); + + if (irq) + handle_nested_irq(irq); + } if (data->input) input_sync(data->input); From patchwork Tue Nov 19 10:51:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 11251723 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDA2714C0 for ; Tue, 19 Nov 2019 10:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B2506222F2 for ; Tue, 19 Nov 2019 10:51:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=xs4all.nl header.i=@xs4all.nl header.b="NUt1JnFA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727682AbfKSKvY (ORCPT ); Tue, 19 Nov 2019 05:51:24 -0500 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:49605 "EHLO lb3-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727646AbfKSKvW (ORCPT ); Tue, 19 Nov 2019 05:51:22 -0500 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:9879:d2e2:f0e2:9c7]) by smtp-cloud7.xs4all.net with ESMTPA id X16MiClSQcs92X16OiynYV; Tue, 19 Nov 2019 11:51:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1574160680; bh=K6hYpltp/ZoW+ANAksmPQOMy+7HBkZ0IaQfGtBZ5Za0=; h=From:To:Subject:Date:Message-Id:MIME-Version:From:Subject; b=NUt1JnFA/XPdbnxDDH4N7+74icOwoBnc1hXVAppiZyaGuFzvg3qZUnzwx7Scepe2Z F245OjL9zxvWfGaXOMNLLSugiHlGV0ZeUWLPjpT5dD4AVw6yQtHESZcGu3TvPtZGgm xBv0Jkddr2ge/nCJJuwSR46E+E6PmhDNIOGjBpz+RMzVOLK1kdAyv9Bt2+LbI3dOyz 3AQcYm7nwX0I5bVV4PXXuAB3UCIMjtdqoA7rDwx5zIT+MbWUDUfxIH7svBlvLTHqzh mQGsbSEfiMop3qXtXBWV2AZfGkOkWRTcVcu04xgcz2tGQ/ZZWhU13Qmmbl9AG4fkO0 4wSDfO4xVTQog== From: Hans Verkuil To: linux-media@vger.kernel.org Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Philipp Zabel , Nick Dyer , Lucas Stach , Christopher Heiny , Vandana BN , Hans Verkuil Subject: [PATCH 5/5] input/rmi4/rmi_smbus.c: don't increment rmiaddr in rmi_smb_read_block() Date: Tue, 19 Nov 2019 11:51:18 +0100 Message-Id: <20191119105118.54285-6-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> References: <20191119105118.54285-1-hverkuil-cisco@xs4all.nl> MIME-Version: 1.0 X-CMAE-Envelope: MS4wfITl6e8i82InOTHwXM3kdwYO2AxR8EsKQ3NIN50rAHb0nE7+NpDfx3mE0aarPKfcSasr0Ef93osdW5It+tibHUdNgekdaia7RnK1JLNhQe9ASaSRaj5Y 01ScKcty+LNeFJk7S1KoU3uHCHNR/+GdaMmzWBexrnJQPZUBleqd1VFwyAiHcrwbjijryb0SIzJh+/W2xGnIofAyh8nccKoptJ2IxRw+4eHaVoINciU5/fmh uQYCUsTe1oqd//1y1LMgbJZpGVxy/vx86+7G1kdQdSKiTkDO09acp4XttZL7PEBZSHHh/y2lgAWQWtk1xlr2rXqF1UXKshBJgGpyjlzb0etJDqBE0XPFq7y+ tUhSg0KxnAq6nkJf2uQFDKq+b2McMvnzVWvHUFmD+tVqsN7xzqyGGlKKlH+6JsKJXhVQ9hpSAkrXbw+FAUBtInmWE7pekAYhRS/+AbkWgAIru+kBPUm5qThf olwcCYk9h6xgzTBzYbBaB+ImNTreFf8npd3UDT5T+dh67J53wJ2Cu5wS9q4= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org This increment of rmi_smbus causes garbage to be returned. The first read of SMB_MAX_COUNT bytes is fine, but after that it is nonsense. Trial-and-error showed that by dropping the increment of rmiaddr everything is fine and the F54 function properly works. Even going back to the original code when F54 was added, I could not make it work without this patch. So I do not understand how this ever worked. My guess is that the same change is needed in rmi_smb_write_block, but I wouldn't know how to test this. Signed-off-by: Hans Verkuil --- drivers/input/rmi4/rmi_smbus.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 2407ea43de59..79ecea5edacc 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -215,7 +215,6 @@ static int rmi_smb_read_block(struct rmi_transport_dev *xport, u16 rmiaddr, /* prepare to read next block of bytes */ cur_len -= SMB_MAX_COUNT; databuff += SMB_MAX_COUNT; - rmiaddr += SMB_MAX_COUNT; } retval = 0;