From: Jacopo Mondi <jacopo+renesas@jmondi.org>
To: linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "Jacopo Mondi" <jacopo+renesas@jmondi.org>,
"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
sakari.ailus@iki.fi, hverkuil@xs4all.nl, hyunk@xilinx.com,
manivannan.sadhasivam@linaro.org
Subject: [PATCH 1/4] media: i2c: max9286: Initialize try formats
Date: Mon, 17 Aug 2020 16:35:37 +0200 [thread overview]
Message-ID: <20200817143540.247340-2-jacopo+renesas@jmondi.org> (raw)
In-Reply-To: <20200817143540.247340-1-jacopo+renesas@jmondi.org>
Initialize try formats at device node open time by querying the
format from the remote subdevices instead of hard-coding it.
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
drivers/media/i2c/max9286.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/max9286.c b/drivers/media/i2c/max9286.c
index 47f280518fdb..7c292f2e2704 100644
--- a/drivers/media/i2c/max9286.c
+++ b/drivers/media/i2c/max9286.c
@@ -794,12 +794,29 @@ static void max9286_init_format(struct v4l2_mbus_framefmt *fmt)
static int max9286_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
{
+ struct max9286_priv *priv = sd_to_max9286(subdev);
+ struct device *dev = &priv->client->dev;
struct v4l2_mbus_framefmt *format;
- unsigned int i;
+ struct max9286_source *source;
+
+ for_each_source(priv, source) {
+ struct v4l2_subdev_pad_config remote_config = {};
+ unsigned int i = to_index(priv, source);
+ struct v4l2_subdev_format remote_fmt = {
+ .which = V4L2_SUBDEV_FORMAT_TRY,
+ .pad = 0,
+ };
+ int ret;
- for (i = 0; i < MAX9286_N_SINKS; i++) {
format = v4l2_subdev_get_try_format(subdev, fh->pad, i);
- max9286_init_format(format);
+ ret = v4l2_subdev_call(source->sd, pad, get_fmt, &remote_config,
+ &remote_fmt);
+ if (ret) {
+ dev_err(dev, "Unable get format on source %u\n", i);
+ return ret;
+ }
+
+ *format = remote_fmt.format;
}
return 0;
--
2.27.0
next prev parent reply other threads:[~2020-08-17 14:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 14:35 [PATCH 0/4] media: i2c: max9286: Use remote endpoint image format Jacopo Mondi
2020-08-17 14:35 ` Jacopo Mondi [this message]
2020-08-18 7:09 ` [PATCH 1/4] media: i2c: max9286: Initialize try formats Sakari Ailus
2020-08-18 12:03 ` Jacopo Mondi
2020-08-17 14:35 ` [PATCH 2/4] media: i2c: max9286: Get format from remote ends Jacopo Mondi
2020-08-19 12:46 ` Laurent Pinchart
2020-08-24 7:48 ` Jacopo Mondi
2020-08-17 14:35 ` [PATCH 3/4] media: i2c: max9286: Do not allow changing format Jacopo Mondi
2020-08-17 14:35 ` [PATCH 4/4] media: i2c: max9286: Remove cached formats Jacopo Mondi
2020-08-17 22:15 ` Hyun Kwon
2020-08-18 12:05 ` Jacopo Mondi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200817143540.247340-2-jacopo+renesas@jmondi.org \
--to=jacopo+renesas@jmondi.org \
--cc=hverkuil@xs4all.nl \
--cc=hyunk@xilinx.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=sakari.ailus@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).