From patchwork Sun Apr 22 15:56:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10355631 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 D4F0060231 for ; Sun, 22 Apr 2018 15:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4A922893D for ; Sun, 22 Apr 2018 15:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B93C62897A; Sun, 22 Apr 2018 15:57:06 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, URIBL_RHS_DOB 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 55B512893D for ; Sun, 22 Apr 2018 15:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754482AbeDVP46 (ORCPT ); Sun, 22 Apr 2018 11:56:58 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:45990 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754201AbeDVP4t (ORCPT ); Sun, 22 Apr 2018 11:56:49 -0400 Received: by mail-pf0-f193.google.com with SMTP id l27so7214869pfk.12; Sun, 22 Apr 2018 08:56:49 -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=fqEaAazNJU0dpaywOuxUplhvv7vTk4V2kJxLdc8ESns=; b=WrxUuKgWI9V0PeI9q995Ld1iBlUjWMVdAKOPThqLm1fMqTx53nzfF/ZoZBIF9LCm/5 9u8bmBa2INp0kWJLetfJunhFjkL/e7fB4SD91TtDVksMMkgf9uP2Ta4H/SWdWZFWkcTV MiZsj6PuvM7K7WnRGwDh836zp5uAP8Ys+sI4mQbp39no7IVFh2KBLYt0fLe5/Rdv0Gdo r6Q6EeIAoPErOJDGJzIDnUsozIO3NlcEHZvgCZeUAFH9IGvcMv5wM4XpYdfWQ0Xp0Ywp 61k+k5u4+xdpnpGrWqzWm/k5yGqb2AZVSnUErk2cbwjF/7QT8r1bHGo3yVopFfTw2y+I yBNw== 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=fqEaAazNJU0dpaywOuxUplhvv7vTk4V2kJxLdc8ESns=; b=UlOgFUWlfxbMAvjUJy952LKhTXcyXIrosgQM0tQ7VYJri/JPRhM8hpiADQRDZ9dsG2 i23gun6xAiX8L10R/Lmfj0HLm9nvkqYOZOCXzjN4fQnlh8KgjftJYJZLr1mXBgIjBk0V FNdpLHQLmWLqBDZzbqOGCLI38ZNUQyLiw2weQKiTXPjj2fIv2sg5XU1ZsxszcdTMeW1s 5APQjqM7ehuRBDtzClFiA4Xhqotnh3YR1YmomjubRpQoC8RAflQnP4aDPjS1sZVpa0Ra F0cWXbOSJ5C2F8i+xRga2Lv89AwCFXzXCfYb37R2hNu+fabq9Woe41FECClCO480g1po hCbw== X-Gm-Message-State: ALQs6tAV0zuKA4+2zEv4+J1YNLAksTM9XX3MksBOuRrfYIWdPDspuSUp ootYI93mpc5/0ViU64q/mpSXfg== X-Google-Smtp-Source: AIpwx494uSyOpuDYm3l8VGsORvVVGs8bL4mU3V3uD/9w/bpTHhuGaYxHM5DuKtiwLOByF6Bvr6mHPA== X-Received: by 10.101.99.132 with SMTP id h4mr14607854pgv.153.1524412608884; Sun, 22 Apr 2018 08:56:48 -0700 (PDT) Received: from localhost.localdomain ([240f:4:c2bc:1:a9a1:96f3:29de:6e47]) by smtp.gmail.com with ESMTPSA id y29sm255461pff.42.2018.04.22.08.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Apr 2018 08:56:48 -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 v3 04/11] media: ov772x: add media controller support Date: Mon, 23 Apr 2018 00:56:10 +0900 Message-Id: <1524412577-14419-5-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524412577-14419-1-git-send-email-akinobu.mita@gmail.com> References: <1524412577-14419-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 Reviewed-by: Jacopo Mondi Signed-off-by: Akinobu Mita --- * v3 - Add a Reviewed-by: line 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 f25150d..18a5ed6 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 }; /* @@ -1316,16 +1319,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); @@ -1341,6 +1354,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);