From patchwork Wed Dec 20 16:33:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10125921 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 77EA360388 for ; Wed, 20 Dec 2017 16:33:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B85228A0F for ; Wed, 20 Dec 2017 16:33:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 605F52917C; Wed, 20 Dec 2017 16:33:56 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 0FE9928A0F for ; Wed, 20 Dec 2017 16:33:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754876AbdLTQdy (ORCPT ); Wed, 20 Dec 2017 11:33:54 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:38871 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753433AbdLTQdx (ORCPT ); Wed, 20 Dec 2017 11:33:53 -0500 Received: by mail-pf0-f193.google.com with SMTP id u25so12768960pfg.5 for ; Wed, 20 Dec 2017 08:33:53 -0800 (PST) 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=vbH+Bz8FyQYAAjMnwiIslRHPd/UTVWklkylaJDW6iIA=; b=Ur7eJU/gsuAmKTDVGgu8eKAl3yseGhWjB5W/vSwkzcckqlrMiqUckdOUdPEJFLMYJ7 OMopUbWQ1gpd94NZmI7IQ/jbiikQhFX/r+5yUS3zziWKMb05Waz+dtbJQAboYt9gLJJn L+h5B+I9eq/S1MvuAjJphv6fKkkhGRx8pVTI4p8YcNyDXmi0gIdHUbnaxR66wCD7R8B1 wMNozq7EiU0gvaZ4aramzT9ZSPBhFbFENReAsrHq17NthFpAJogrMsGvbOgB+zKEPjcB s0RrTR2AOzKtAVw0r7nNzTB83fcYF3EdHfYHHnIRfxHp00ZP2/eZ0yHJU4gExuDfeCPm 6Cqg== 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=vbH+Bz8FyQYAAjMnwiIslRHPd/UTVWklkylaJDW6iIA=; b=uNrXX8+T7hRoT0vMJG7skWVV2vbMPlKZbZ5EMAzQj8BWGPbydIfk/8H4QRlX7WbOv8 ZoRT8Tg96TxDhxxIiUcgyqeJQETmX8tGWGj/SvXzevKsEihpeI6WKYbS5lrIXWr4j2YS z4GOL8opVgJ6KaXR13PCudhbD5IIgWny2Y8EyM3lvk8rKSe139jIGRWtwm8CDDyVYe3x 5v3r8tqj0DyEtQfySATBFmXj3uyV8LmapMmQJoxYUGFU6gAAiwIeI/A6gVQ1uqoR7CzM v7pewhsKXuAtouaTBp+S5hdBpv673Hd890oTJY+Agcw2zQAG2N6ngzAHuxqPTMEBIq3U ueVg== X-Gm-Message-State: AKGB3mK3KvzI3DYS1BtIOdjbc3cTHEYFCl3jU7iecztsoocj0CiTiQhl BkUdQX15XzydgmGT9+FovXNVjA== X-Google-Smtp-Source: ACJfBosJLwK+ivHoEoQrFliaif/1LooFq1T2RUECSTWl+fSajQHZe/ruXIddpu7qjSAkoT8aBXLC2w== X-Received: by 10.98.61.220 with SMTP id x89mr7524187pfj.73.1513787633244; Wed, 20 Dec 2017 08:33:53 -0800 (PST) Received: from localhost.localdomain ([240f:4:c2bc:1:6c87:ff94:43ae:eac3]) by smtp.gmail.com with ESMTPSA id m26sm30261286pgv.62.2017.12.20.08.33.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Dec 2017 08:33:52 -0800 (PST) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 2/4] meida: mt9m111: add media controller support Date: Thu, 21 Dec 2017 01:33:32 +0900 Message-Id: <1513787614-12008-3-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513787614-12008-1-git-send-email-akinobu.mita@gmail.com> References: <1513787614-12008-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: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita --- drivers/media/i2c/mt9m111.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c index 4fa10df..e1d5032 100644 --- a/drivers/media/i2c/mt9m111.c +++ b/drivers/media/i2c/mt9m111.c @@ -215,6 +215,9 @@ struct mt9m111 { int power_count; const struct mt9m111_datafmt *fmt; int lastpage; /* PageMap cache value */ +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_pad pad; +#endif }; /* Find a data format by a pixel code */ @@ -971,6 +974,14 @@ static int mt9m111_probe(struct i2c_client *client, goto out_clkput; } +#ifdef CONFIG_MEDIA_CONTROLLER + mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE; + mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; + ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad); + if (ret < 0) + goto out_hdlfree; +#endif + /* Second stage probe - when a capture adapter is there */ mt9m111->rect.left = MT9M111_MIN_DARK_COLS; mt9m111->rect.top = MT9M111_MIN_DARK_ROWS; @@ -982,16 +993,20 @@ static int mt9m111_probe(struct i2c_client *client, ret = mt9m111_video_probe(client); if (ret < 0) - goto out_hdlfree; + goto out_entityclean; mt9m111->subdev.dev = &client->dev; ret = v4l2_async_register_subdev(&mt9m111->subdev); if (ret < 0) - goto out_hdlfree; + goto out_entityclean; return 0; +out_entityclean: +#ifdef CONFIG_MEDIA_CONTROLLER + media_entity_cleanup(&mt9m111->subdev.entity); out_hdlfree: +#endif v4l2_ctrl_handler_free(&mt9m111->hdl); out_clkput: v4l2_clk_put(mt9m111->clk); @@ -1004,6 +1019,9 @@ static int mt9m111_remove(struct i2c_client *client) struct mt9m111 *mt9m111 = to_mt9m111(client); v4l2_async_unregister_subdev(&mt9m111->subdev); +#ifdef CONFIG_MEDIA_CONTROLLER + media_entity_cleanup(&mt9m111->subdev.entity); +#endif v4l2_clk_put(mt9m111->clk); v4l2_ctrl_handler_free(&mt9m111->hdl);