From patchwork Thu Sep 20 13:31:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 10607769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE02D913 for ; Thu, 20 Sep 2018 13:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D9B52D6EA for ; Thu, 20 Sep 2018 13:31:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 983AE2D74D; Thu, 20 Sep 2018 13:31:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3832D735 for ; Thu, 20 Sep 2018 13:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732496AbeITTPI (ORCPT ); Thu, 20 Sep 2018 15:15:08 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:47185 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbeITTPI (ORCPT ); Thu, 20 Sep 2018 15:15:08 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1g2z3L-0007cs-1q; Thu, 20 Sep 2018 15:31:31 +0200 From: Philipp Zabel To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Nick Dyer , Guenter Roeck , kernel@pengutronix.de Subject: [PATCH 1/2] Input: synaptics-rmi4 - fill initial format Date: Thu, 20 Sep 2018 15:31:23 +0200 Message-Id: <20180920133124.29099-1-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.19.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-input@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver doesn't set an initial video format until s_input is called: $ v4l2-ctl -d /dev/v4l-touch0 --get-input Video input : 0 (Normalized 16-Bit Image: ok) $ v4l2-ctl -d /dev/v4l-touch0 --get-fmt-video Width/Height : 0/0 Pixel Format : '' [...] $ v4l2-ctl -d /dev/v4l-touch0 --set-input 0 Video input set to 0 (Normalized 16-Bit Image: Touch, ok) $ v4l2-ctl -d /dev/v4l-touch0 --get-fmt-video Width/Height : 71/40 Pixel Format : 'TD16' [...] To fix this, initialize the video format to input 0 during probe. Signed-off-by: Philipp Zabel --- drivers/input/rmi4/rmi_f54.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c index a6f515bcab22..9ccf7ee0fc67 100644 --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -692,6 +692,7 @@ static int rmi_f54_probe(struct rmi_function *fn) return -ENOMEM; rmi_f54_create_input_map(f54); + rmi_f54_set_input(f54, 0); /* register video device */ strlcpy(f54->v4l2.name, F54_NAME, sizeof(f54->v4l2.name)); From patchwork Thu Sep 20 13:31:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Zabel X-Patchwork-Id: 10607767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0636814DA for ; Thu, 20 Sep 2018 13:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB6A52D785 for ; Thu, 20 Sep 2018 13:31:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCDF82D7BE; Thu, 20 Sep 2018 13:31:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 030352D781 for ; Thu, 20 Sep 2018 13:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732441AbeITTPG (ORCPT ); Thu, 20 Sep 2018 15:15:06 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:34569 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726177AbeITTPG (ORCPT ); Thu, 20 Sep 2018 15:15:06 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1g2z3O-0007cs-0H; Thu, 20 Sep 2018 15:31:34 +0200 From: Philipp Zabel To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Nick Dyer , Guenter Roeck , kernel@pengutronix.de Subject: [PATCH 2/2] Input: synaptics-rmi4 - fix enum_fmt Date: Thu, 20 Sep 2018 15:31:24 +0200 Message-Id: <20180920133124.29099-2-p.zabel@pengutronix.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180920133124.29099-1-p.zabel@pengutronix.de> References: <20180920133124.29099-1-p.zabel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-input@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Do not enumerate all formats, some of which the device may not even support. Instead, only report the one fixed format of the currently selected input that will survive try_fmt/s_fmt. Signed-off-by: Philipp Zabel --- drivers/input/rmi4/rmi_f54.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c index 9ccf7ee0fc67..516fea06ed59 100644 --- a/drivers/input/rmi4/rmi_f54.c +++ b/drivers/input/rmi4/rmi_f54.c @@ -456,25 +456,15 @@ static int rmi_f54_vidioc_fmt(struct file *file, void *priv, static int rmi_f54_vidioc_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *fmt) { + struct f54_data *f54 = video_drvdata(file); + if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - switch (fmt->index) { - case 0: - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD16; - break; - - case 1: - fmt->pixelformat = V4L2_TCH_FMT_DELTA_TD08; - break; - - case 2: - fmt->pixelformat = V4L2_TCH_FMT_TU16; - break; - - default: + if (fmt->index) return -EINVAL; - } + + fmt->pixelformat = f54->format.pixelformat; return 0; }