From patchwork Thu Oct 12 16:21:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10002307 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 C8EB260216 for ; Thu, 12 Oct 2017 16:21:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA66B28DE9 for ; Thu, 12 Oct 2017 16:21:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AD13728E12; Thu, 12 Oct 2017 16:21: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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 324B328DE9 for ; Thu, 12 Oct 2017 16:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897AbdJLQVy (ORCPT ); Thu, 12 Oct 2017 12:21:54 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:52633 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752430AbdJLQVx (ORCPT ); Thu, 12 Oct 2017 12:21:53 -0400 Received: by mail-pf0-f195.google.com with SMTP id e64so5539490pfk.9 for ; Thu, 12 Oct 2017 09:21:53 -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=SzIQ44Pq6xkevFStbnMzfeTcesjOTQl9glaoPeb6F2M=; b=SRlKDoKfXRP33l/Osi3dFgmawO7OIuow0/erYGZaTlf5IOo0ba0y0IslCckvOXCkbS OZ0EYP1Vx+2fARQc0UeL2ziwN8gdTWvXXzGDl6QuZANOd2eRSeadreuWw9HXtgmRA3yn VSzHLn09z0HSUfpVIOq+SNu2KPIRqxeXVi8GqSWoP6Q5mJTE/KeQcBpRA3uxKcvCgqKa QpmTgzl1aYe7WBSWEFlR899LMYkvUmOn8Y4yTm/0pE3bYHahNgGEE7SOcUmY2fSh4Xz+ MUCTlnlopifSCcf2kRPi+REjQmEKn6yJB/bmp8IPd7qqcPQmJSSMpPd3sLEzg+AjCp4R uTNA== 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=SzIQ44Pq6xkevFStbnMzfeTcesjOTQl9glaoPeb6F2M=; b=qd5gtb4wq7PWWhaakdHShFD1mn/wTJOZ8FvOUzXlPprOKvKgbxqI35Iy5c+9/ZQrci xibQgoRA4ptKEiX9ZgtTUzlkicMVGCbAmb+b6lXjqBU1XQdxsFmio5izhGRWinyNluDP YHtsEkQfctER+8eeb6qHexqV3/XVlQ+LqC4fKndjgM92evwbxifAhDXy4tbszpoZd2Rr iwqMkNMuI6odrstL/aeu1a1kHjVygU76NO4Nj2jH84YH4r6ScwKHgFuj+mZZ4FuZEN83 lE32haVoWrUqgYU0Fd6LnK5Jx22r5cX/5wu5UKiGErK/Fplq2aqZqKX1znpJGgB37qS7 5tOw== X-Gm-Message-State: AMCzsaU1RZjYoGas+LtgdwnLAT1P0kgvrwMmlBerKI6jejt4mdc4WTGH LWTuUvNcrpON8AXlTW1dkxidug== X-Google-Smtp-Source: AOwi7QAo8qn/pdag7+DMQbbR55H84hf3Zu2EAvmbyVnYPI/gnU/hnYsncESNs82Q/fG0hOBpV/zASQ== X-Received: by 10.159.249.68 with SMTP id h4mr642886pls.165.1507825313037; Thu, 12 Oct 2017 09:21:53 -0700 (PDT) Received: from mita-ThinkPad-T540p.lan ([240f:4:c2bc:1:ec18:f5a1:1d8f:bb9f]) by smtp.gmail.com with ESMTPSA id x11sm27404438pgq.29.2017.10.12.09.21.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Oct 2017 09:21:52 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Jonathan Corbet , Mauro Carvalho Chehab Subject: [PATCH 3/4] media: ov7670: add media controller support Date: Fri, 13 Oct 2017 01:21:16 +0900 Message-Id: <1507825277-18364-4-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507825277-18364-1-git-send-email-akinobu.mita@gmail.com> References: <1507825277-18364-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: Jonathan Corbet Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/ov7670.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c index 4f89a51..38e1876 100644 --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -214,6 +214,9 @@ struct ov7670_devtype { struct ov7670_format_struct; /* coming later */ struct ov7670_info { struct v4l2_subdev sd; +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_pad pad; +#endif struct v4l2_ctrl_handler hdl; struct { /* gain cluster */ @@ -1654,6 +1657,14 @@ static int ov7670_probe(struct i2c_client *client, if (info->pclk_hb_disable) ov7670_write(sd, REG_COM10, COM10_PCLK_HB); +#ifdef CONFIG_MEDIA_CONTROLLER + info->pad.flags = MEDIA_PAD_FL_SOURCE; + sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; + ret = media_entity_pads_init(&sd->entity, 1, &info->pad); + if (ret) + goto clk_disable; +#endif + v4l2_ctrl_handler_init(&info->hdl, 10); v4l2_ctrl_new_std(&info->hdl, &ov7670_ctrl_ops, V4L2_CID_BRIGHTNESS, 0, 255, 1, 128); @@ -1700,6 +1711,9 @@ static int ov7670_probe(struct i2c_client *client, hdl_free: v4l2_ctrl_handler_free(&info->hdl); +#ifdef CONFIG_MEDIA_CONTROLLER + media_entity_cleanup(&sd->entity); +#endif clk_disable: clk_disable_unprepare(info->clk); return ret; @@ -1713,6 +1727,9 @@ static int ov7670_remove(struct i2c_client *client) v4l2_async_unregister_subdev(sd); v4l2_ctrl_handler_free(&info->hdl); +#ifdef CONFIG_MEDIA_CONTROLLER + media_entity_cleanup(&sd->entity); +#endif clk_disable_unprepare(info->clk); return 0; }