From patchwork Mon Apr 16 02:51:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10342065 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 6166C601D3 for ; Mon, 16 Apr 2018 02:52:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52AA6223B2 for ; Mon, 16 Apr 2018 02:52:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4775124B48; Mon, 16 Apr 2018 02:52:29 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D93D8223B2 for ; Mon, 16 Apr 2018 02:52:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbeDPCw0 (ORCPT ); Sun, 15 Apr 2018 22:52:26 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:42487 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbeDPCwY (ORCPT ); Sun, 15 Apr 2018 22:52:24 -0400 Received: by mail-pl0-f65.google.com with SMTP id t20-v6so9194226ply.9; Sun, 15 Apr 2018 19:52:24 -0700 (PDT) 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=t3Y2KOyDYW1s/X6KNPtFApyZM4Sr2QR2x7YYOBI3vbo=; b=iNFEjiUF+d2ATAOsHCul8igSCawP1RV4GwdyCnTcKT6rw4FTRyiLUpILcLkkyg/fWm fvDGyUZdrj5uiJ7+SR799pkftb0gpAFPzfhF0zOO/i4mxxiZFhk9LEsZsdOF0kEg0rpG ie3o1PKxYbb7V9RQt9CMaY0aRfTH3+siK538K55wHa/PPuoXppqKva/E7PEaY1pWTjMA fJYt1FsvIVRzmZ5KC7bH8CuBkEuLBKnhG+Af027P7O4ylnzNbvuSwuT8nV64vGHRGkNV U/l7HSmap2KmepdUSRo5DGoqzMxI64O6jEufPb2gKva0ipjOScI+kSSqp3f2dMEhXoVf v5+A== 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=t3Y2KOyDYW1s/X6KNPtFApyZM4Sr2QR2x7YYOBI3vbo=; b=bRd5jSeDsvM3HLD9egpiHK3PXngRUp8nhJAiADzCQ35REcVoExVTiNRo7BVHVY4uof bUzKSCZgsfYekqpZYP7AGFdnlAJYjAuxU14t8NM9GO062Nmk+Cxnh58uAbiQpkMjtmud wvo9qvtrOZXJ49BXzBpH6M1dvZR/UwxtZvQT68TCheXz9drIK0peVMfkLhXH6zGmZejR Lb40RN0PZWXuSxD68msqmYTSi8XT8r76le4kuhqKj4BSvEQtulR2hli62WSRDhzHGeGh qOpUiUb6+qEdZwPNjfY18M1jeBZXX94sqUqrUufcH+HDHPwdpTiCXTW5p1l4EWoOv2G6 NosQ== X-Gm-Message-State: ALQs6tBCnHvbHGg417Wk0eWR6ZF4nZDnJvWI4TpsCO6J9pECWDnrUsGz DC/q2JFgaPjM+N1U+C2WtKXtDA== X-Google-Smtp-Source: AIpwx4+VDmXK3T678SHcs/G2lxdPYcjcPhMsYV33vnhjfFfjXT2ZI+BI9m6M2lKDnqBJh3lmXaYDbg== X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr13503500plp.162.1523847144213; Sun, 15 Apr 2018 19:52:24 -0700 (PDT) Received: from localhost.localdomain ([240f:4:c2bc:1:3df1:9c88:51ad:c027]) by smtp.gmail.com with ESMTPSA id e1sm3694274pgt.49.2018.04.15.19.52.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Apr 2018 19:52:23 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org, devicetree@vger.kernel.org Cc: Akinobu Mita , Jacopo Mondi , Laurent Pinchart , Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH v2 04/10] media: ov772x: add media controller support Date: Mon, 16 Apr 2018 11:51:45 +0900 Message-Id: <1523847111-12986-5-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523847111-12986-1-git-send-email-akinobu.mita@gmail.com> References: <1523847111-12986-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 Create a source pad and set the media controller type to the sensor. Cc: Jacopo Mondi Cc: Laurent Pinchart Cc: Hans Verkuil Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Reviewed-by: Jacopo Mondi --- * v2 - Move video_probe() before the entity initialization and remove the #ifdef around the media_entity_cleanup() drivers/media/i2c/ov772x.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c index 188f2f1..0ae2a4f 100644 --- a/drivers/media/i2c/ov772x.c +++ b/drivers/media/i2c/ov772x.c @@ -424,6 +424,9 @@ struct ov772x_priv { /* band_filter = COM8[5] ? 256 - BDBASE : 0 */ unsigned short band_filter; unsigned int fps; +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_pad pad; +#endif }; /* @@ -1318,16 +1321,26 @@ static int ov772x_probe(struct i2c_client *client, if (ret < 0) goto error_gpio_put; +#ifdef CONFIG_MEDIA_CONTROLLER + priv->pad.flags = MEDIA_PAD_FL_SOURCE; + priv->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; + ret = media_entity_pads_init(&priv->subdev.entity, 1, &priv->pad); + if (ret < 0) + goto error_gpio_put; +#endif + priv->cfmt = &ov772x_cfmts[0]; priv->win = &ov772x_win_sizes[0]; priv->fps = 15; ret = v4l2_async_register_subdev(&priv->subdev); if (ret) - goto error_gpio_put; + goto error_entity_cleanup; return 0; +error_entity_cleanup: + media_entity_cleanup(&priv->subdev.entity); error_gpio_put: if (priv->pwdn_gpio) gpiod_put(priv->pwdn_gpio); @@ -1343,6 +1356,7 @@ static int ov772x_remove(struct i2c_client *client) { struct ov772x_priv *priv = to_ov772x(i2c_get_clientdata(client)); + media_entity_cleanup(&priv->subdev.entity); clk_put(priv->clk); if (priv->pwdn_gpio) gpiod_put(priv->pwdn_gpio);