From patchwork Thu Feb 16 02:19:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9576392 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F40F260209 for ; Thu, 16 Feb 2017 02:32:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E181C28516 for ; Thu, 16 Feb 2017 02:32:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D472B28548; Thu, 16 Feb 2017 02:32:59 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 5C27328516 for ; Thu, 16 Feb 2017 02:32:59 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=+ttd6ctzq3usIWMlzm87DAWqQwnhWFHXodpZxKrrb3s=; b=Dw12vkZI5o3BnzdAz+ke/ekUN8 VD3x8TSJo812KRJLCg3qC24VhRfhxxbxhYdtBCtEq7FiJyy36ShsTbQJYkV6+tGcnrazDy+xQGl3T HnI8pJRC2V9n5O5NU91JHeltAxXTlkbZT3BAx3RCIfwQ6rsR+v1A/wpziXkbc0U1fKFxZFBc1ZR39 JlHSwXLT8hIk/A5hmrvf5d/kjuNJv1Q5WP2N6XD9wKlryUKUGYxxTWSbWrswwHO9FZbRN3F47geRX dnaDEatsQfDz2Dzi8QeYlZw8Y92EyDQU4QvlPJHLbqV1uswqz7sG7dOzBMkHYKC3sBiaLW8Ozmdex fIp+5rOQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ceBsK-0005II-CD; Thu, 16 Feb 2017 02:32:52 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ceBob-00017v-5Q for linux-arm-kernel@bombadil.infradead.org; Thu, 16 Feb 2017 02:29:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: 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=Y1rmpAut7gJe0Q+RfKAxOJWfYSyHVmK2I6tWMu1PJKw=; b=QxvPsJOWJtvOlnKx8WRm6eE+a Uqjc0WOG1E/P/90wb9o8uVcRmUTun7GLlZXakg63OZn+YouiBAxjXr9xkmF6HYL2s4Yog8lLNmsP8 diRmdXbbl2AitKQbbUCcgApZ0oDIsCtrnHet0lYuXFyawrRU6tlinJKa5vU0hYUqYlpjVU0SiQJva NBhvE4eg2EXKtoxpaAmTO7066FxTsfeGr4uPrvnPSvlC46R+7FDcj5qzV9K4pZH06avflEj5zh39R W2IcHd4htFgcYNTasBdIUotU2AfiPb0Cib/7k1jYjhbXC3JdoQRRLFhgFWRKFvE6EfN92TeHayviN PJEGj+d3g==; Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ceBhK-0000js-2O for linux-arm-kernel@lists.infradead.org; Thu, 16 Feb 2017 02:21:32 +0000 Received: by mail-pg0-x241.google.com with SMTP id 5so488006pgj.0 for ; Wed, 15 Feb 2017 18:21:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y1rmpAut7gJe0Q+RfKAxOJWfYSyHVmK2I6tWMu1PJKw=; b=miO3AhjyBa6nEYsHjYsoIZgvwNcRJocBhKDehr69E/KeRewHW3MXtTl2/wLZFC0gnF bK2Xkpycn91ISHarnIAQoI2ynrQ9xae+R2779UR5TB4xx/b+H/aCqM6kyGdXNh/etto7 chZRSi2hT1+xqEbAuZUQ3kuxbJQYNHJ29hEGw7+sc/vpLtaumE7g0dyc0LQSYWh+VYgL g8+qIlWIyaO2khGhZUjyTrS3V38UOowNu6bZMvEMub0njVw0lyONv14LtiT5eg2nf/Gf aJHq6tX+tqAh46Z8vZYGV6D1YY41AbuggLixgkkTsl3dgbMGhjH8uXan5HDNfkM/QGN5 3Wvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y1rmpAut7gJe0Q+RfKAxOJWfYSyHVmK2I6tWMu1PJKw=; b=TqFAlDz1dtKSIC5mJtdBoAvwYVxha5MizXcY+NjSKjtyY0reRKSHm3sMxDfXTQzfUj GVoHjsxM5PqRDNGUhbIgR1o8y8zwlMQ8tfHy8W7/ELKtFPRsa2a9d/fDFgQGMla54LNT 4TaoLPXvwvSZtvXEpYZTKbqt/l5WwVJuJUyjP3izU0IT63f/Fudm7M1uBrTONbsICM3s SRaml/NRezhpkMdK2wJcGCF5LAZBPillk8ixxq2/22u4NRxblOHeVekuMo3CCNt7Hd+E V9d300S9lfX+jSEoHEbzGYSbRsLE1D/arFIq60l3mzVSnFG6Xl0ss/u1uw3IYFmVnchB e7Vw== X-Gm-Message-State: AMke39n+ET3zVTEAS7WWFf838lcav2FaG/TxkKE2zVjgS9yC2kxJSMS2fSUMAwr2n1/VTw== X-Received: by 10.84.254.1 with SMTP id b1mr44682411plm.76.1487211670206; Wed, 15 Feb 2017 18:21:10 -0800 (PST) Received: from majic.sklembedded.com (c-98-210-181-167.hsd1.ca.comcast.net. [98.210.181.167]) by smtp.googlemail.com with ESMTPSA id t6sm9869352pgt.8.2017.02.15.18.21.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Feb 2017 18:21:08 -0800 (PST) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: robh+dt@kernel.org, mark.rutland@arm.com, shawnguo@kernel.org, kernel@pengutronix.de, fabio.estevam@nxp.com, linux@armlinux.org.uk, mchehab@kernel.org, hverkuil@xs4all.nl, nick@shmanahar.org, markus.heiser@darmarIT.de, p.zabel@pengutronix.de, laurent.pinchart+renesas@ideasonboard.com, bparrot@ti.com, geert@linux-m68k.org, arnd@arndb.de, sudipm.mukherjee@gmail.com, minghsiu.tsai@mediatek.com, tiffany.lin@mediatek.com, jean-christophe.trotin@st.com, horms+renesas@verge.net.au, niklas.soderlund+renesas@ragnatech.se, robert.jarzmik@free.fr, songjun.wu@microchip.com, andrew-ct.chen@mediatek.com, gregkh@linuxfoundation.org, shuah@kernel.org, sakari.ailus@linux.intel.com, pavel@ucw.cz Subject: [PATCH v4 29/36] media: imx: mipi-csi2: enable setting and getting of frame rates Date: Wed, 15 Feb 2017 18:19:31 -0800 Message-Id: <1487211578-11360-30-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487211578-11360-1-git-send-email-steve_longerbeam@mentor.com> References: <1487211578-11360-1-git-send-email-steve_longerbeam@mentor.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170216_022130_274390_D1AC9B26 X-CRM114-Status: GOOD ( 14.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, devicetree@vger.kernel.org, Steve Longerbeam , linux-kernel@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King Setting and getting frame rates is part of the negotiation mechanism between subdevs. The lack of support means that a frame rate at the sensor can't be negotiated through the subdev path. Add support at MIPI CSI2 level for handling this part of the negotiation. Signed-off-by: Russell King Signed-off-by: Steve Longerbeam --- drivers/staging/media/imx/imx6-mipi-csi2.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index 23dca80..c62f14e 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -34,6 +34,7 @@ struct csi2_dev { struct v4l2_subdev sd; struct media_pad pad[CSI2_NUM_PADS]; struct v4l2_mbus_framefmt format_mbus; + struct v4l2_fract frame_interval; struct clk *dphy_clk; struct clk *cfg_clk; struct clk *pix_clk; /* what is this? */ @@ -397,6 +398,30 @@ static int csi2_set_fmt(struct v4l2_subdev *sd, return 0; } +static int csi2_g_frame_interval(struct v4l2_subdev *sd, + struct v4l2_subdev_frame_interval *fi) +{ + struct csi2_dev *csi2 = sd_to_dev(sd); + + fi->interval = csi2->frame_interval; + + return 0; +} + +static int csi2_s_frame_interval(struct v4l2_subdev *sd, + struct v4l2_subdev_frame_interval *fi) +{ + struct csi2_dev *csi2 = sd_to_dev(sd); + + /* Output pads mirror active input pad, no limits on input pads */ + if (fi->pad != CSI2_SINK_PAD) + fi->interval = csi2->frame_interval; + + csi2->frame_interval = fi->interval; + + return 0; +} + /* * retrieve our pads parsed from the OF graph by the media device */ @@ -430,6 +455,8 @@ static struct v4l2_subdev_core_ops csi2_core_ops = { static struct v4l2_subdev_video_ops csi2_video_ops = { .s_stream = csi2_s_stream, + .g_frame_interval = csi2_g_frame_interval, + .s_frame_interval = csi2_s_frame_interval, }; static struct v4l2_subdev_pad_ops csi2_pad_ops = {