From patchwork Sun Dec 9 05:20:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10719829 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 09F6714E2 for ; Sun, 9 Dec 2018 05:20:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF8092863E for ; Sun, 9 Dec 2018 05:20:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E33532AB09; Sun, 9 Dec 2018 05:20:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FDB22AB07 for ; Sun, 9 Dec 2018 05:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726090AbeLIFUs (ORCPT ); Sun, 9 Dec 2018 00:20:48 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40794 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbeLIFUs (ORCPT ); Sun, 9 Dec 2018 00:20:48 -0500 Received: by mail-pg1-f195.google.com with SMTP id z10so3474300pgp.7 for ; Sat, 08 Dec 2018 21:20:47 -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=WBQlmUFigG6XjRPhVyNz9kgraxu7zwYVtMWk1l0gYuk=; b=kU59vhinSQqPf0hyKHR7b0XMnickmmURWrRJzOrGShynxnUnZeHnmewgSrxLWlSnSr 8YtmSjXjHN89lUWZQ/ZX+M03YNVp2c248t/2xi/NItcz0tVakF106w4xGL+GeSQYVKUI +7GM01n8lcXZkLcN5jfR9HZdGhL04Vr6pU4JMtnJF9r9AMJ7K+Tk5mFZhLb+vL54ZSLJ 3OQ+rkC1wjcjSWIV2doZ4hGa6yvro+YvzKOMRNVT9lzvhvrrzAf2ix7wunK+ugGfMMb4 WRlccWVo1yH5zU/2oBK4xXoe3XbmAoL6fNBmw+QPX1qA7JdY9EyjiQLQOavNa1K0QFmz pTxw== 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=WBQlmUFigG6XjRPhVyNz9kgraxu7zwYVtMWk1l0gYuk=; b=SxU9AADyNw0bXLnK7bwN7h+zTH+idHbFTATXvItfkD+Boz1B7qAmAg/NHmJrc9Mde2 4V3uo4q13jZllCWlUINWNr64cTGPA8TlMmtnA+EMZEov8L6w/hvhMflHVpUn8FxneCkx wejkbAOfR6LNHg8Pd6VC8B85EtX9djdxyFTzI+cVXx9RAr2zV9PN22NlhuPLNxSCU0qx cZhjd0IMPh5XXn0vmSZGfZDD/+Pm4ZBlvBtyVcUheSOX7HQFtCQfUENfzhIXwKvJhDJv VvQYscHa3w5MwGItF0Rpw1TW8bz9ZyEIRx82+MygfMtStNMMvuOSIhHkSHcDdPfurOIp AySQ== X-Gm-Message-State: AA+aEWYm7UyMVkzSeouPrXcI5VB4HXKE0qa2QWgC8DwGl2uAo1/ZXOzJ 44/g793+wvbc7zJxVJRsFWYmjKmWhgE= X-Google-Smtp-Source: AFSGD/VKVlMPRceVe5eGGaO5I7QN1GxcWhH0Iu3/mZ1NgRPoxQNyKAciBcXZbBjZyN0+o3UHzqkFiw== X-Received: by 2002:a63:a84a:: with SMTP id i10mr7045181pgp.263.1544332847211; Sat, 08 Dec 2018 21:20:47 -0800 (PST) Received: from localhost.localdomain ([240f:34:212d:1:a17f:ba11:defa:e2d1]) by smtp.gmail.com with ESMTPSA id v14sm14973270pgf.3.2018.12.08.21.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Dec 2018 21:20:46 -0800 (PST) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH v2 1/3] media: ov2640: set default window and format code at probe time Date: Sun, 9 Dec 2018 14:20:31 +0900 Message-Id: <1544332833-10369-2-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544332833-10369-1-git-send-email-akinobu.mita@gmail.com> References: <1544332833-10369-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Set default window and format code at probe time instead of always checking if they have not been set yet when VIDIOC_SUBDEV_G_FMT ioctl is called. This change simplifies the next patch (make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY). Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/ov2640.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c index d8e91bc..a07e6f2 100644 --- a/drivers/media/i2c/ov2640.c +++ b/drivers/media/i2c/ov2640.c @@ -842,9 +842,6 @@ static int ov2640_set_params(struct i2c_client *client, u8 val; int ret; - if (!win) - return -EINVAL; - switch (code) { case MEDIA_BUS_FMT_RGB565_2X8_BE: dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__); @@ -929,10 +926,6 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; - if (!priv->win) { - priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT); - priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8; - } mf->width = priv->win->width; mf->height = priv->win->height; @@ -1193,6 +1186,9 @@ static int ov2640_probe(struct i2c_client *client, if (ret) goto err_clk; + priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT); + priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8; + v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;