From patchwork Thu Dec 19 18:22:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 182150 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp835786iln; Thu, 19 Dec 2019 10:23:08 -0800 (PST) X-Google-Smtp-Source: APXvYqxIR+XAJLGzTpuOv5WaUJjci6DSN5UsBiJdYHIS+jHcHD8gZBAtmvqRLjkFTwJQeEy32N8f X-Received: by 2002:a05:6830:2098:: with SMTP id y24mr10435035otq.312.1576779788611; Thu, 19 Dec 2019 10:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576779788; cv=none; d=google.com; s=arc-20160816; b=nALXIQoTM1LnFHPBNDto/TKbKSc0KL1lpRaLDfya2dnMW0ZqGTeMbtWYFHan94QChg V7gjjwiN+GFNhPQ0ZCbGVjDyndNkY8ZeGtaogO/MryBgZ73Jdaav9bkIcdpZvnIWUh27 P+kL3/8nCTOUtnguON7qfJnH8Fs6H7toZ0xhOTkSEkDR8gfoSX69WnFOI6H+GClSm+0B urq4VPp/zHGrA4vCt3ZmwYdlEx20UOW2B8FDsVPIG1lYqJzDpoXRCMLjC0s+pJAbKmya 5iIyCDHBCFVIg+J4/vspP/CdMV5vw0fmjqnteRs9zsAu4gr+vSKMBgLLykErVixkb5EI 5lPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=2o+AG3RvUH+GxTzi1IbYJSvnHQRcuO5FLTvuUuElWHc=; b=gAZUcT/xGfFbz2Sv7kQHmwEkl20hY5saaj/z7EuE3qIVT4kB5IeEiRIfJEHolShIXp uR/32UqJSyz0ASfKAXMfMzBWiYjc5F1ab1pQlW2Wy1xD/z4Qfkw/z7q4grItILKUrwyY eebio5qW4Qo8WqkrEKhcxb8zsdDge3Uy1dBCtcEYxljZTCrzjVaFTki4z5eXL4/jfm7M lnjau5mv2qRSfPGxzIUGKmF1UEbDuLiBXt4vmJxhcAGHq4ApZmH+XP/EDQDF4caPKE6X Z78ngTk9f6oXA59Gz+H36y407RJfeK3FA4kVnNRvO0a9MsvsJPY0oUmuyM/2QeeQ1FFm B3kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gQ8G1RAe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si638225oie.146.2019.12.19.10.23.08; Thu, 19 Dec 2019 10:23:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gQ8G1RAe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727151AbfLSSXH (ORCPT + 27 others); Thu, 19 Dec 2019 13:23:07 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45025 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727071AbfLSSXG (ORCPT ); Thu, 19 Dec 2019 13:23:06 -0500 Received: by mail-pl1-f195.google.com with SMTP id az3so2915718plb.11 for ; Thu, 19 Dec 2019 10:23:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2o+AG3RvUH+GxTzi1IbYJSvnHQRcuO5FLTvuUuElWHc=; b=gQ8G1RAeBnSBMUz9vxx63vb4M+B8ZgAkiKSSzFgs7w5UGWiXl6ndClyr3rfdt0ukjV pBwFrlIdO6Lk3XgBiB6b3zA6FNde+Nwrkr2b3+Wxe3nyxUFGxFN7vb0qaA65jtXetc5A p7Dpr8fva+rX4v9D9hpA1+FNcW+sgJk2hFWLQI0Q5oblXjF3DkXyJLYTFOu4VTLS1TQi U0W327PywietOTD3gTTtx8SKJLPVpea8lYTjEBHvs1D7poJhOFEHjkUixb4pz/9MVOv0 UVNTPvJNXkh/jXwXv7JuRsiIUh1cREVBP0c4C6GEjefuJqSC2pOQNG6GfhK6OEy4dAAu sjYw== 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=2o+AG3RvUH+GxTzi1IbYJSvnHQRcuO5FLTvuUuElWHc=; b=Bsxga+YSkDk6ZrFdlZ3SkOUaWALim9fFCvN0UyHDE9CKFGNHc42rS6pjpvdQC7BuiB do5kNXyduaoUwbDV9nEfla1HLk4wZCayeyA3F0/zC3DZCmAK9q5Z8KLXF92XHq7ktxqc 5B5SkGjL0z8SmlNPholoGnlJ2ODLlvclVMBhFnGYfRe0H7qJZ5mjykKwvABh98m4L6jb TuRvPtsEpg7N1CPs1jcyKgGqVpkaGZElDV1Tegn/dR6vRSglTbosdDmFD9t5+qMwqV+G s3jm+LIVwzeR0yDAIitQXiNLjp2MZzxAMFY5WDnYmrIQXcFqbrsjUj08qitwDtjzIpVG deWQ== X-Gm-Message-State: APjAAAVAu+j3jbgSJazO/0EHeCyjlzHegH1xbZzVqA9mPYr1XVcu/CuM 9j+Es3bp14LQgW3thQWhqiTt X-Received: by 2002:a17:902:421:: with SMTP id 30mr10707013ple.324.1576779785449; Thu, 19 Dec 2019 10:23:05 -0800 (PST) Received: from localhost.localdomain ([2409:4072:6010:65a5:a416:e9bd:178a:9286]) by smtp.gmail.com with ESMTPSA id i3sm9085735pfg.94.2019.12.19.10.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 10:23:04 -0800 (PST) From: Manivannan Sadhasivam To: mchehab@kernel.org, sakari.ailus@iki.fi Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, c.barrett@framos.com, a.brela@framos.com, peter.griffin@linaro.org, Manivannan Sadhasivam Subject: [PATCH v2 4/6] media: i2c: imx290: Add support to enumerate all frame sizes Date: Thu, 19 Dec 2019 23:52:20 +0530 Message-Id: <20191219182222.18961-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219182222.18961-1-manivannan.sadhasivam@linaro.org> References: <20191219182222.18961-1-manivannan.sadhasivam@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to enumerate all frame sizes supported by IMX290. This is required for using with userspace tools such as libcamera. Signed-off-by: Manivannan Sadhasivam --- drivers/media/i2c/imx290.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.17.1 diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c index b6eeca56d3c9..a1974340e6fa 100644 --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -468,6 +468,25 @@ static int imx290_enum_mbus_code(struct v4l2_subdev *sd, return 0; } +static int imx290_enum_frame_size(struct v4l2_subdev *subdev, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_frame_size_enum *fse) +{ + if ((fse->code != imx290_formats[0].code) && + (fse->code != imx290_formats[1].code)) + return -EINVAL; + + if (fse->index >= ARRAY_SIZE(imx290_modes)) + return -EINVAL; + + fse->min_width = imx290_modes[fse->index].width; + fse->max_width = imx290_modes[fse->index].width; + fse->min_height = imx290_modes[fse->index].height; + fse->max_height = imx290_modes[fse->index].height; + + return 0; +} + static int imx290_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) @@ -823,6 +842,7 @@ static const struct v4l2_subdev_video_ops imx290_video_ops = { static const struct v4l2_subdev_pad_ops imx290_pad_ops = { .init_cfg = imx290_entity_init_cfg, .enum_mbus_code = imx290_enum_mbus_code, + .enum_frame_size = imx290_enum_frame_size, .get_fmt = imx290_get_fmt, .set_fmt = imx290_set_fmt, };