From patchwork Wed Jan 3 18:22:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10142777 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 B68FE6035E for ; Wed, 3 Jan 2018 18:23:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B018529188 for ; Wed, 3 Jan 2018 18:23:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4F81291AC; Wed, 3 Jan 2018 18:23:28 +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 47FEF29188 for ; Wed, 3 Jan 2018 18:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750907AbeACSX1 (ORCPT ); Wed, 3 Jan 2018 13:23:27 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:45800 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750861AbeACSX0 (ORCPT ); Wed, 3 Jan 2018 13:23:26 -0500 Received: by mail-pf0-f195.google.com with SMTP id u19so1059736pfa.12 for ; Wed, 03 Jan 2018 10:23:26 -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=XtQ2eNQwr73Gec87fCuRGNxgENaT1EvHAryZugfIa60=; b=b+tMnlZXtTqL9xZjIBqvAtcmSM9Re65ip5CbCAg6t9THViQe2y2oMPag3R9SNX1TR4 UAzFJ7FZJvVW1ENhClyPoqlX93ZbMmHoNLtGryT6Hnx9l7oX7xr2qy4y9GG/Ucsk+tHG PtDo8cXXV+pbK3XrG3tB6nZOW3Aq4b1Ou+VFXUv2hpQbLnbzUX1CFJuYsD9goXAMtYQ9 3Mt+CIuAixVFBnhaA2GY426nfqofnpSfhqbERPpzqcAiIK2hPqaSM/LOUmpfxZk4RB6/ aSRPu/C1OlsKyvrzrh1iv26pktFGlB8+bvy55pwvT0x1Jkpat4D/snY2jFQNCotBVVo1 fN7A== 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=XtQ2eNQwr73Gec87fCuRGNxgENaT1EvHAryZugfIa60=; b=ms8v1UHvgfWezWHWZzmiX2I7XdRjeo5wmlEJHI7SmVpj5gHPirCfmZybXfZ7COVz7B ym9zZFswgpHHhTUO8aqoZQo3ooeMrv2LYulW4UwR+0yZI0UdB/5PxUsU1C5Soa/OLgmP oDD5JTkH7fy03g+IFFsZrLCpAdvTZiXNfRCqt5QX1Bjjxu8znneLYr2Uw0oxtpyWKaFh 7pOKnWVo9i5nCh5sw1Zr+NEhA1Hxk3stYNqxvYUcKLTsOSMCh3pkHoPwIUCwuKnrCt0r zlysO+8Z0IgQWxHoVTaXkuQr0GTWScxNkmCFaT4MiKJJcMkqpayCjHMJ9AK7GrbTjgOx /McQ== X-Gm-Message-State: AKGB3mIvdGTl6Z4R7NSyv+JaL8GRXnwz648SfIPsL8vIQcVGq9qR/1vU iTPwH/e9n9+HDjj7xw0o1BnUCw== X-Google-Smtp-Source: ACJfBotv1035D7b0iYrSHOxBHtfm2KbJbSpMlbSkVpMLhGqqax13Y7292ckY8+5kh2Qn48YNpoa4wQ== X-Received: by 10.101.80.133 with SMTP id r5mr1956008pgp.314.1515003805815; Wed, 03 Jan 2018 10:23:25 -0800 (PST) Received: from localhost.localdomain ([240f:4:c2bc:1:609a:ff0a:6b9e:a233]) by smtp.gmail.com with ESMTPSA id s81sm4276325pfg.60.2018.01.03.10.23.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jan 2018 10:23:25 -0800 (PST) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH v2 2/4] media: mt9m111: add media controller support Date: Thu, 4 Jan 2018 03:22:45 +0900 Message-Id: <1515003767-12006-3-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515003767-12006-1-git-send-email-akinobu.mita@gmail.com> References: <1515003767-12006-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 --- * Changelog v2 - Fix typo s/meida/media/ in the patch title, noticed by Sakari Ailus 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);