From patchwork Sun Apr 29 17:13:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10370611 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 BA5CB60384 for ; Sun, 29 Apr 2018 17:13:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8D4E28A18 for ; Sun, 29 Apr 2018 17:13:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DC0F28A21; Sun, 29 Apr 2018 17:13:55 +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 1B8DD28A18 for ; Sun, 29 Apr 2018 17:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753996AbeD2RNu (ORCPT ); Sun, 29 Apr 2018 13:13:50 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:40733 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753963AbeD2RNr (ORCPT ); Sun, 29 Apr 2018 13:13:47 -0400 Received: by mail-pf0-f194.google.com with SMTP id f189so4998919pfa.7; Sun, 29 Apr 2018 10:13:47 -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=0Xtotq3OeRp5zB/i9Yh9H6rmNAvZgMVwvRplgdKd6IU=; b=UPFQj/pxWiTaJLJNb3a1qX9gQRWXb3/mmDc2mr/JTdlfWMYUoJwFfvSzsG18RGTLyI +b2YINwr7JUqfkaILIdPQxfDa+vA/lBZZBmI2k0i5ViUt38s8Manc1z8REBoIgGaV0XV rgVierup2GiUK4WylsDcr+rp+//zLamCFTIFyKTTWU8+y9wa97seZgfOLlpdxme5NBsS Q9YeFozHuUZyjg6o5I62rw5skoWdqn8YO1PxTDOvLE+WJ2i8I8niwOhwvHCRiZbJkTyA ufs0S63RCFCfPD4ZKdULmnORyGiXdRgZcZTCeYlzMBHxUEs+Dk1ZRp4bq/BjuF50OhM9 T1GA== 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=0Xtotq3OeRp5zB/i9Yh9H6rmNAvZgMVwvRplgdKd6IU=; b=WrUFczl7gKXC0JlasNjyWddeXWNi0kHHsPWTI87NXx/ouFMujJO9Onikr7IZwXcvj8 sf1kH1cH2uSMQe5nZQ04sTomQhFbu3PavFJ+Gggjvy43+RTOTQCNEvaWh31JTPLAU9XE gZqEC8erKzmnRi8XUpxct5+9ER8sB1diuBkzoadkYKYeXm+nDqPXUSLV1R/tYDcB1aHB /mmhh79pGbu0CoW0HAh2XOm+l8xTaeFkq3HVQ41TbRaQp6Yvyv7EbR+RR7UAP3MEUTMU p+ulERXyL2EAQfYhk5fnT9vprXr836xwbJ6Or2CjHB2GMrOX0yZE7Bp8LekL12c2Ux6O TYJg== X-Gm-Message-State: ALQs6tBMB81fG5inBVwMDXVKSkiH0UFpFpIlH5jeWSHM4EwCB3CuQ0kf YtWonYFbfhtIOPv8MGAgO1k40A== X-Google-Smtp-Source: AB8JxZoKS+BbhC8bB6mjT36PeNRUh4YH0iYmYZ+MProdvSEqBvlkKV2CyiDKvc8toFLIqGurj13hCg== X-Received: by 2002:a17:902:bf0a:: with SMTP id bi10-v6mr9525011plb.235.1525022027169; Sun, 29 Apr 2018 10:13:47 -0700 (PDT) Received: from localhost.localdomain ([240f:4:c2bc:1:754e:5a21:c35f:52a1]) by smtp.gmail.com with ESMTPSA id e10sm10168022pfn.67.2018.04.29.10.13.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Apr 2018 10:13:46 -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 v4 05/14] media: ov772x: add media controller support Date: Mon, 30 Apr 2018 02:13:04 +0900 Message-Id: <1525021993-17789-6-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525021993-17789-1-git-send-email-akinobu.mita@gmail.com> References: <1525021993-17789-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 --- * v4 - No changes 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 3fdbe64..bb5327f 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);