From patchwork Tue Apr 16 09:30:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stu Hsieh X-Patchwork-Id: 10902511 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 445CC1823 for ; Tue, 16 Apr 2019 09:44:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CEDE28591 for ; Tue, 16 Apr 2019 09:44:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 207DA28614; Tue, 16 Apr 2019 09:44:52 +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=unavailable 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 CDEF928591 for ; Tue, 16 Apr 2019 09:44:51 +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=DQTiyXvjXL7Ko+ fYdqHpOMmAbcnMhFhG1Twkm7Ewo5DBS2hWbi64xzbTOP8Lcl5Fp1d6RhQCjKfHygeY7KtHI2U2pf7 KZ2DMrw4OF1xE9I5+2eLMWL+sirT2M3Uo0l130DvKwQa0vrLylfOTGhwu8nBPWW4zUtXGq1F8tzld PZnGYc+NnorCnjhisdYpHlJSFmLSr18BpHwbIcU+oFvYLQrXhorOlzYHVEOr9Ob0kkF+sQXlSN3a1 rgQS7eJ22PT+zInGlBwUTP4M106IN6xc5xtt9IEaL8+cLsvt7aSp0DC+q/Xl3/yeKAlllxRYL58jG pXpCtOlLTT+osoDJBMCw==; 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 1hGKe1-0005Hm-Pq; Tue, 16 Apr 2019 09:44:49 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKQL-0005JX-Ox; Tue, 16 Apr 2019 09:30:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MWQT/OPTNvox4W4vuGPV7pFxm2FXKlLbh9dY4HND3vo=; b=w8Nv14owZDaKCLBfo+EPrYO// wQIVwX4HDJx9yoFmuF54JgnccM5WS1KDh1aCHXDRcAczzcEEBXaF6BFb3JuWz7hsb9BjWUJ2d9bMi Am1XMq00RTd7+X0LhYkPT1oUNpXS1uimosd3dcROC1aX2WPasPNT7OAM/DP2exksE7TVVKQTVZjB4 9z1yZi1F+3VCpKxJWOUCL7DXDhJRorU9tZRdRBTecC+XdU3myinrfjl/koi9Sap+jEKfygLqIDijh avTJZPFj0dsnNTyllgG7PIL2h4/CANTFkQiBVjdNEeTb8s12b4Dm2MK6FuwYnwhT2OpYe36snB6gO 9bC1Y4YRg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGKQI-0001GE-G5; Tue, 16 Apr 2019 09:30:39 +0000 X-UUID: 29fc0c275c7f426ca2c7b29bcdf6962f-20190416 X-UUID: 29fc0c275c7f426ca2c7b29bcdf6962f-20190416 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1722002158; Tue, 16 Apr 2019 01:30:21 -0800 Received: from MTKMBS01N2.mediatek.inc (172.21.101.79) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Apr 2019 02:30:20 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Apr 2019 17:30:19 +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:30:19 +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:30:13 +0800 Message-ID: <1555407015-18130-14-git-send-email-stu.hsieh@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1555407015-18130-1-git-send-email-stu.hsieh@mediatek.com> References: <1555407015-18130-1-git-send-email-stu.hsieh@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: D3D17C0B5B6345A5E3A2FDB6C7E409950C893A37DD617AB509BB866F30FD6C992000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190416_053038_710586_070485DD X-CRM114-Status: GOOD ( 13.52 ) 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, srv_heupstream@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)