From patchwork Tue Apr 16 09:27:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stu Hsieh X-Patchwork-Id: 10902301 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 B1DBD1515 for ; Tue, 16 Apr 2019 09:28:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 893D2284C0 for ; Tue, 16 Apr 2019 09:28:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 782FE28913; Tue, 16 Apr 2019 09:28:42 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C32028867 for ; Tue, 16 Apr 2019 09:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Z0ySz4MNkWbHOZONvprNKEL+pvBa6A7/QPCjWM9vys4=; b=IXbguLb1rhf6/m NjddWUInWjzuZpU1fhkdbdMxY9twEL9zK3jZqkgN424g7Tzu8uS9k8Q24iuXO/A13qTW0ap1mlQt/ aMEQXo3EZcCpZx3MKTy506tqnibkpuigDEXTdfx5hL7XtIXPuCGlRNvoExkVf52Dd6JsdlgJZM7Ss 4XqlUzfKs1AS8vkeQhjf07YolPOqOMyI3pawUJtK+SmwwPRrlSk4ULikpf0FbhwR+ajD5dIx4hTxl nYbiwhL6RX3j7gBLOSqlda7pafspEluP9Vie1tuKCuoBXWWrJiLzkHaXRy7ycF7j11wGt7lKxY0l+ L8ZL+jFHucWzyM8QBAow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKOO-0001uc-F5; Tue, 16 Apr 2019 09:28:40 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKNg-000105-Sy; Tue, 16 Apr 2019 09:27:59 +0000 X-UUID: 5fd19e8b65e749fb9d3f0d9f7568b801-20190416 X-UUID: 5fd19e8b65e749fb9d3f0d9f7568b801-20190416 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1281346289; Tue, 16 Apr 2019 01:27:56 -0800 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Apr 2019 02:27:54 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Apr 2019 17:27:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 16 Apr 2019 17:27:48 +0800 From: Stu Hsieh To: Mauro Carvalho Chehab , Rob Herring , CK Hu Subject: [PATCH v2 13/15] [media] mtk-mipicsi: add the function for Get/Set PARM for application Date: Tue, 16 Apr 2019 17:27:41 +0800 Message-ID: <1555406863-18069-14-git-send-email-stu.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555406863-18069-1-git-send-email-stu.hsieh@mediatek.com> References: <1555406863-18069-1-git-send-email-stu.hsieh@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190416_022756_942817_72CE7DB7 X-CRM114-Status: GOOD ( 11.70 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, wsd_upstream@mediatek.com, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Stu Hsieh , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch add the function for Get/Set PARM for application. Application can get the information about number of link. Signed-off-by: Stu Hsieh --- .../media/platform/mtk-mipicsi/mtk_mipicsi.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c b/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c index 5e4028d0d5e1..5db9c68b0da9 100644 --- a/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c +++ b/drivers/media/platform/mtk-mipicsi/mtk_mipicsi.c @@ -346,6 +346,38 @@ static int get_subdev_link(const struct soc_camera_device *icd, return 0; } +static int mtk_mipicsi_get_parm(struct soc_camera_device *icd, + struct v4l2_streamparm *a) +{ + unsigned int link = 0U; + u8 link_reg_val = 0x0U; + int ret = 0; + + /*get camera link number*/ + ret = get_subdev_link(icd, &link, &link_reg_val); + if (ret < 0) + return ret; + + a->parm.capture.timeperframe.numerator = 1; + a->parm.capture.timeperframe.denominator = 30; + a->parm.capture.reserved[0] = link_reg_val; + a->parm.capture.reserved[1] = (u32)(icd->use_count); + dev_info(icd->parent, "use count %d\n", icd->use_count); + + return 0; +} + +static int mtk_mipicsi_set_param(struct soc_camera_device *icd, + struct v4l2_streamparm *a) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->parent); + + if (ici->ops->get_parm == NULL) + return ici->ops->get_parm(icd, a); + + return 0; +} + static u32 get_bytesperline(const u32 fmt, const u32 width) { u32 bytesperline = 0; @@ -884,6 +916,8 @@ static struct soc_camera_host_ops mtk_soc_camera_host_ops = { .poll = vb2_fop_poll, .querycap = mtk_mipicsi_querycap, .set_bus_param = mtk_mipicsi_set_bus_param, + .get_parm = mtk_mipicsi_get_parm, + .set_parm = mtk_mipicsi_set_param, }; static void mtk_mipicsi_ana_init(void __iomem *base)