From patchwork Sun May 6 14:19:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10382817 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 2923A6037F for ; Sun, 6 May 2018 14:20:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14A152892B for ; Sun, 6 May 2018 14:20:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07DE428970; Sun, 6 May 2018 14:20:03 +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 939782892B for ; Sun, 6 May 2018 14:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbeEFOUB (ORCPT ); Sun, 6 May 2018 10:20:01 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:37943 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751777AbeEFOUA (ORCPT ); Sun, 6 May 2018 10:20:00 -0400 Received: by mail-pg0-f65.google.com with SMTP id n9-v6so18459390pgq.5; Sun, 06 May 2018 07:20:00 -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=ZJuXVhNmL/l21fFokh6bTAnwYnyuudCPKV/UTekl1eg=; b=HO652ou6K6JbRvfqNfnv9jaYWVTiYXhm2ZmIFjDEXjBeAUZ4oAYAYudfjmqm1xUK0s ar1EwB23oAi7VSPpTpO+sKZSQ3ugHx576uV17s9Hln7kdGjIEh6JPryc1M3XT+hkq6SL SARhBs4DWca7yORybshgmz5FenyNTayQJ/XaK7QgJS96YK0wt4TC5V8I/DtHaN5YgLHO +HGnu89NiUBX1TnEcW0wca3Vejjgbv++qMxsNuqHN3bwAO072h7XwHPVjMzT7mex0KRN Jcua49tCm1uo9re/mkJCRv80tvx4tvVNiOa2/lXeU1avSmVh8ZFkV3TwHUjYCvyFur/b xQIA== 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=ZJuXVhNmL/l21fFokh6bTAnwYnyuudCPKV/UTekl1eg=; b=Qjcl5rmqfwlzZgGCSprY2bhjs0L2IPs6OUPdlX3MFb8aQqt9Hr0zAiL7nioEu4OhNE WAZU0mouDYlmA1DoQyA9wDZm8XmAXviuZxSZQAgDXzzstP4ct3RRNRJpnhcbwMHH0b0G iv4lVqJo9CDFl33d3OBvQNU7IVMHOjMFtCpyOAQwPzr+tLTga7YtPntuxuTbU1Cej56u B7UykBTJ7cqKAMBglWiiQbSdDnnLa010/FJHKYiyMqlH7eGhLBsPtEXsySIyYg+ClIII pvoJJh9T/a4fwO7PyAxxcmGmozpktxyV6eUzsJDN3eTZqued2xNrKvxLFBV0KQJJaogI +5mA== X-Gm-Message-State: ALQs6tDYplvvrV73z3xZuJVht8rT+W/fiMuGwvgHlajZ92xmHXvstKks nVXt3oP0pMPEuyt6eJOCdQbnZQ== X-Google-Smtp-Source: AB8JxZr9mv4hWr6K/frtq/T2g2eTR0pqTUhT8F4clipv8WfNAJIuwRJIJi2lAQhQB8QBgf5MlWyARg== X-Received: by 2002:a17:902:7146:: with SMTP id u6-v6mr34200231plm.289.1525616399836; Sun, 06 May 2018 07:19:59 -0700 (PDT) Received: from localhost.localdomain ([240f:4:c2bc:1:141a:15e1:5268:11ce]) by smtp.gmail.com with ESMTPSA id s88sm58766771pfe.43.2018.05.06.07.19.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 06 May 2018 07:19:59 -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 v5 05/14] media: ov772x: add media controller support Date: Sun, 6 May 2018 23:19:20 +0900 Message-Id: <1525616369-8843-6-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525616369-8843-1-git-send-email-akinobu.mita@gmail.com> References: <1525616369-8843-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 --- * v5 - 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);