From patchwork Mon May 20 20:12:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10952321 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 669B916C1 for ; Mon, 20 May 2019 20:12:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56A8328950 for ; Mon, 20 May 2019 20:12:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B02428956; Mon, 20 May 2019 20:12:27 +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 8AA5728968 for ; Mon, 20 May 2019 20:12:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726673AbfETUMY (ORCPT ); Mon, 20 May 2019 16:12:24 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:46510 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfETUMY (ORCPT ); Mon, 20 May 2019 16:12:24 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 45796Y6kYTz1rXtr; Mon, 20 May 2019 22:12:21 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 45796Y64p7z1qqkK; Mon, 20 May 2019 22:12:21 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id mk2St3hC6xf3; Mon, 20 May 2019 22:12:20 +0200 (CEST) X-Auth-Info: kmNXI0TxIlaaqExCaWRMDlb5icVi0TM7Pep8lDDUuSk= Received: from kurokawa.lan (ip-86-49-110-70.net.upcbroadband.cz [86.49.110.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 20 May 2019 22:12:20 +0200 (CEST) From: Marek Vasut To: linux-media@vger.kernel.org Cc: Marek Vasut , Fabio Estevam , Hans Verkuil , Mauro Carvalho Chehab , Philipp Zabel , Steve Longerbeam Subject: [PATCH] media: imx: Handle VIDIOC_ENUMINPUT Date: Mon, 20 May 2019 22:12:13 +0200 Message-Id: <20190520201213.7536-1-marex@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add basic handling for VIDIOC_ENUMINPUT, where the imx capture devices report they are cameras to userspace. Code like e.g. Qt5 qcamera uses this information when enumerating camera devices and this fixes it's operation on iMX6, where it previously didn't detect any cameras. Signed-off-by: Marek Vasut Cc: Fabio Estevam Cc: Hans Verkuil Cc: Mauro Carvalho Chehab Cc: Philipp Zabel Cc: Steve Longerbeam To: linux-media@vger.kernel.org --- drivers/staging/media/imx/imx-media-capture.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 9430c835c434..1e3790479fd6 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -148,6 +148,18 @@ static int capture_enum_frameintervals(struct file *file, void *fh, return 0; } +static int capture_enum_input(struct file *file, void *priv, + struct v4l2_input *inp) +{ + if (inp->index > 0) + return -EINVAL; + + inp->type = V4L2_INPUT_TYPE_CAMERA; + strlcpy(inp->name, "Camera", sizeof(inp->name)); + + return 0; +} + static int capture_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *f) { @@ -414,6 +426,7 @@ static const struct v4l2_ioctl_ops capture_ioctl_ops = { .vidioc_enum_framesizes = capture_enum_framesizes, .vidioc_enum_frameintervals = capture_enum_frameintervals, + .vidioc_enum_input = capture_enum_input, .vidioc_enum_fmt_vid_cap = capture_enum_fmt_vid_cap, .vidioc_g_fmt_vid_cap = capture_g_fmt_vid_cap,