From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC432C433F5 for ; Tue, 11 Jan 2022 16:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EOodkXUeF+F/Uvu1ylO/11dyNWsLgW8IRXahVKIesXE=; b=rUyOEJdsctaypZ UhHm7rOOqzZ+11+gP4zp8NpcigBhgfSDCs+Wkc2BeddD82xRHZDNNHwg2kU+EEXuWUjC362OX2wJh Xyj31MQRfnQh0oW3xV4HbVvOP0ZssDIWnEZdxZ5X5y5jcqtl0MJEbEJtBMVj8nRnorLUMK9JdIBIK Yk3KpJbvksOPKWswegxBHb513dJYvxY8bmjuauzh7ETu5u3ENaeaUb9lGbIwykilp4U7JFMx4XE4i 5XM+otnbI7l7is2zxIUiO9rKmYvoZkFXNYgTWojDj4YGD9WJ60LEOF+uMfvRYnS+MRlLgG29oavQV /MQeIhlM4Tz2EwgSBm9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7K2T-00GutQ-Kc; Tue, 11 Jan 2022 16:30:25 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7K2N-00GusS-Rx for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 16:30:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1641918620; x=1673454620; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=38UdOAcPvnz+gqHgab2aITzqBqhFbn6kNKwADaz9TXo=; b=iutpnVFNvoo7KQbuquzsZY6ap6c/0jMRGEAe56cbSbHwqOhRZNWkPA8V +I+hdcWHj54olWjH+Ism8yyxuojV10euCVBMPJHPgE8yvCPAvvbqhVQtk wyCusrsPqw9Jt5FFFxjG4dSvZ+R29EAVFOEs0o1SJhE3wvi8Aa6q+bW21 +vxhGdP4BXRLD9THuHZe9ajZfAOBELBtG10Tvnw0UUhF5H8Bp3HUxkwOm HGTaZj935LTFkYp/iIa1MNQWO+bRf2NC1SQ64tPfcOl3pBwNunTsNOHhX ybWJrojsSvHF6LMbNkJxn7uC8fBWssTeWW3VqM35zpfaggGRCmHNEQBYR A==; IronPort-SDR: Fgkdcshhyh/qvGF3mvzsYeemmmY/HVs/44fm9VgPAF7zeB7yJ2an/eXLuqzdsnoYFFI6LXPdZ8 JXXYP24R/S+Xrkk38juknD94ae0EhXu/yUy/PdiECbQZWluetqJz9kjlk1w7Lx+ijNFiSibapI GWQ01rSHoF09U8MRmiqVGjaFaAjv+jzcX/CLxz3eSzsDu9MDhplWwb09YFix1B21w+1Wsi0SKl e4AAbdGkx4GN2I+l4GoR2TkV0XfqAI7IBh9uv07E7yCfegvtjO+xy9oHNij/ji1PPTiH09RB3x YlH1K0102OES3nT08mpjoflE X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="145064255" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Jan 2022 09:30:18 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 11 Jan 2022 09:30:17 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17 via Frontend Transport; Tue, 11 Jan 2022 09:30:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y5B0TID0BunrH2eaXuHnAMgOMurcrsA8gkVIkBisZKaWcE438bSjs1YTv4UMG5K84zxazMHPqF/8wbnhQlrKf1KXLXGEmwvG62ScPFvY5cJv2oLRdbbKkdxW8Y9+eLAVdUJbV8FT4b6S3Z8AZ8adBaJ7DTukepZAUT1vPs/pMSobZ9YVc75djpNyG7EqGQeWsZOfaYNzbqxX2Hv1Qo1OnHJ14D95GWq/tjOr+fFvNUULH6BnIJekJAfed0ynsE6m6BNJvUubcExsivlp+06SL5p7++u1UuY3GD2mWLpVwq9QvOVv57Y7/spiHS7nKmZdCneqe1iwHL9E9ndBIuNtIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=38UdOAcPvnz+gqHgab2aITzqBqhFbn6kNKwADaz9TXo=; b=ecQYnJ7XS4BNjjcLVVkdIEdTz8eHyfzifDpWnEkysCDxAO4xuM5AGfKoA4+LPIaaN3ft/2NbN8PDcFdL1Iqz8s6WR/x9TanvT9QrwVaMSo/8qGa/ZxwKFyqktUV3UISY+sIe4EXD3la27KV5GtBLSjP1bsE6VfOJvRJXwFJwiuMkqO7ICpAIPSn8xDbRko/eKScg/2yq7+NTOToTnVSQ9fgBoFcad1FaDT5s4dvY0iCcTzEOCYVuAJAmSLadshiQplnpgBHk812qjevqaGEN5wlw1WCHvFywxHpWRhkZAABP7z5845qzwk/mt35YwsS/MdKWG+Cm8Ct7oqVDNUgJuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microchip.com; dmarc=pass action=none header.from=microchip.com; dkim=pass header.d=microchip.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microchiptechnology.onmicrosoft.com; s=selector2-microchiptechnology-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=38UdOAcPvnz+gqHgab2aITzqBqhFbn6kNKwADaz9TXo=; b=uuvIf3SGXdar3Vcf4g6NK+orA6AmIJc83vABw11XygTEvORsu6d5ebo2CABg+4xi8kTe08VqPol+G3SAwvuGKdVWdWbL11ITeOlUM5W/IT0IbmhfzviU+pmJccjafb7y0PWOx/3BmN29ie5/Kzc3qEQ/1kOLNLRatf8LTa6k5+8= Received: from PH0PR11MB4920.namprd11.prod.outlook.com (2603:10b6:510:41::22) by SA0PR11MB4672.namprd11.prod.outlook.com (2603:10b6:806:96::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Tue, 11 Jan 2022 16:30:15 +0000 Received: from PH0PR11MB4920.namprd11.prod.outlook.com ([fe80::d7c:834f:4591:3c0c]) by PH0PR11MB4920.namprd11.prod.outlook.com ([fe80::d7c:834f:4591:3c0c%8]) with mapi id 15.20.4888.009; Tue, 11 Jan 2022 16:30:15 +0000 From: To: Subject: Re: [PATCH v3 12/23] media: atmel: atmel-isc: implement media controller Thread-Topic: [PATCH v3 12/23] media: atmel: atmel-isc: implement media controller Thread-Index: AQHX8CjLLR1Cbrq9ykurq5T4e7oxC6xeKfGAgAAGtAA= Date: Tue, 11 Jan 2022 16:30:15 +0000 Message-ID: References: <20211213134940.324266-1-eugen.hristev@microchip.com> <20211213134940.324266-13-eugen.hristev@microchip.com> <20220111160603.qi4kbp6rn45hp7po@uno.localdomain> In-Reply-To: <20220111160603.qi4kbp6rn45hp7po@uno.localdomain> Accept-Language: en-US, ro-RO Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microchip.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e759d6c8-9369-4afe-0dfa-08d9d51fa606 x-ms-traffictypediagnostic: SA0PR11MB4672:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Ax5Yn55e9NzrsatJsNw7CdQaGT0CJ3t+3hg72gMcq5JQwwHJA/Lv8iL0wU5qv2M+m/EzjsqKNTTXcv/ZxpSiBCZzpZgtTnWyzVfgOUJJvzkDnmSF9Oofj+ONMIkqNgMotnBrDx6/t596aEvsGXg/azhlMikDHTHg3b5LDEHo1w5bpDhq2CvUoiNND8OKVJFq9O4ScamOwZcMBNryKtW8CcFBvNOJs2kzXr/T7AtWY5RCTbXSpRl33e86Kfi78SPiGDtSnoaiKyKLaF0BP2S9p84LTvPmqxZfKy26waaDp+tp3SMonVwnGx7pEuydJFaibUVgA/IFI9KxFhCpMVZ+kChUF2uBR5KyNNz38S9clrybx4yibocffw+GQTB1vhcoU58TydLIawnRu7Kfo3TvYdry58SgKhBvOjEj9gs4VLPw0119fd+JJugLAZ1JkEAjnyBIIiGq4a5fLllhE/6GrzanZV5u71swB7FR2Co0zhtT4cJyMEzZeyksdzDSpAS8cx1nnFh/HneLgptQoRcP9CGxz6N6qmutWLHyXgvY/4n/sGtI0Gq20BiGmjzuyTaDepd9bRu9JfwIK2p9GcH+eIW1iRpNzmrdMF3+OgFVDLqChZIYZn8ECvAc4DeRLePLaPa97qCTu9YAvAxAn9TflkY9xiy+jOgdXWmV4wmqij4n5Fi/6dSF5OZbOK+Y1FW0A9NU+cSQ+m69Bhzz0GbN5QGV8rFtgttn0FRtvsEmaxPbZFR7KI0M2boMiO2PBaRqgbTXUVbxVXp5jWSvitf7vw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB4920.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(5660300002)(53546011)(6486002)(36756003)(8676002)(186003)(6512007)(122000001)(4326008)(38100700002)(107886003)(54906003)(26005)(2906002)(2616005)(83380400001)(86362001)(66946007)(31686004)(316002)(508600001)(38070700005)(71200400001)(31696002)(6916009)(64756008)(66556008)(76116006)(30864003)(91956017)(6506007)(8936002)(66446008)(66476007)(43740500002)(45980500001)(559001)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?NWRydFh6M1hEd0VQSEVTc2hhTTZEUnF0cTMvU0FLRVF3SXhJRmhGZ1ROUzVK?= =?utf-8?B?TUdjZjNHVW0rNWhDaHZ6eUV4UlN3QmpOUGZxb09paGRVTlJxM2VuSERuVnRU?= =?utf-8?B?eXQxbUVINklQcnJkTitMbTl6OHF2NDUxWmRzSWd3amIvQlhSMUhTb1hhYzI1?= =?utf-8?B?d1hqRUlRRVBKNTJEL1MrWTNLa0pwVGF5cWNyTTEvY3hZWDB6SXhhNkZUanhD?= =?utf-8?B?RXdpNmplcXZhWkhGcUZGc2F1UytFMmFFSmg5TUwyUFdZMHozOFcraVhUTlNo?= =?utf-8?B?a2dVdU9XbWNTSzlVZFhOcFZ0VkFLMGpMOGFOd3E0T25keTh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k1WGEwY25HUHprTUk3RWdDclh5ODUyYVVTQ1ZBSC9QdUlaZmcx?= =?utf-8?B?NHFBaFh6aGlOR0pmUEJPVXVSbDF3SlFDQnNUcmZMYkhabzFwbWtybFNYa3JS?= =?utf-8?B?ZkJFTkZJWVNFZVZBY0N0NFhDY3pnPT0=?= Content-ID: <808F39557E555B418E77D10FABB4EE4E@namprd11.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4920.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e759d6c8-9369-4afe-0dfa-08d9d51fa606 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2022 16:30:15.4659 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3f4057f3-b418-4d4e-ba84-d55b4e897d88 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LASdK+MvYzWkVzjjENocqd1I1apSdO+gNO/hrHDOsuwmOS/AULfX18YK51k23dKp1z5XFGyM59+aA/10jDsvtL30nk55pQXqLvD/Aa07aq4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR11MB4672 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_083020_245285_87E57D56 X-CRM114-Status: GOOD ( 24.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, sakari.ailus@iki.fi, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 1/11/22 6:06 PM, Jacopo Mondi wrote: > Hi Eugen, > > On Mon, Dec 13, 2021 at 03:49:29PM +0200, Eugen Hristev wrote: >> Implement the support for media-controller. >> This means that the capabilities of the driver have changed and now >> it also advertises the IO_MC . >> The driver will register it's media device, and add the video entity to this >> media device. The subdevices are registered to the same media device. >> The ISC will have a base entity which is auto-detected as atmel_isc_base. >> It will also register a subdevice that allows cropping of the incoming frame >> to the maximum frame size supported by the ISC. >> The ISC will create a link between the subdevice that is asynchronously >> registered and the atmel_isc_scaler entity. >> Then, the atmel_isc_scaler and atmel_isc_base are connected through another >> link. >> >> Signed-off-by: Eugen Hristev >> --- >> Changes in v2: >> - implement try formats >> >> drivers/media/platform/atmel/Makefile | 2 +- >> drivers/media/platform/atmel/atmel-isc-base.c | 27 +- >> drivers/media/platform/atmel/atmel-isc-mc.c | 287 ++++++++++++++++++ >> drivers/media/platform/atmel/atmel-isc.h | 36 +++ >> .../media/platform/atmel/atmel-sama5d2-isc.c | 14 +- >> .../media/platform/atmel/atmel-sama7g5-isc.c | 12 +- >> 6 files changed, 370 insertions(+), 8 deletions(-) >> create mode 100644 drivers/media/platform/atmel/atmel-isc-mc.c >> >> diff --git a/drivers/media/platform/atmel/Makefile b/drivers/media/platform/atmel/Makefile >> index 794e8f739287..aa7a18b428f6 100644 >> --- a/drivers/media/platform/atmel/Makefile >> +++ b/drivers/media/platform/atmel/Makefile >> @@ -1,7 +1,7 @@ >> # SPDX-License-Identifier: GPL-2.0-only >> atmel-isc-objs = atmel-sama5d2-isc.o >> atmel-xisc-objs = atmel-sama7g5-isc.o >> -atmel-isc-common-objs = atmel-isc-base.o atmel-isc-clk.o >> +atmel-isc-common-objs = atmel-isc-base.o atmel-isc-clk.o atmel-isc-mc.o >> >> obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o >> obj-$(CONFIG_VIDEO_ATMEL_ISC_BASE) += atmel-isc-common.o >> diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c >> index d0542b97a391..b0c3ed21f372 100644 >> --- a/drivers/media/platform/atmel/atmel-isc-base.c >> +++ b/drivers/media/platform/atmel/atmel-isc-base.c >> @@ -1726,6 +1726,7 @@ static int isc_async_bound(struct v4l2_async_notifier *notifier, >> struct isc_device, v4l2_dev); >> struct isc_subdev_entity *subdev_entity = >> container_of(notifier, struct isc_subdev_entity, notifier); >> + int pad; >> >> if (video_is_registered(&isc->video_dev)) { >> v4l2_err(&isc->v4l2_dev, "only supports one sub-device.\n"); >> @@ -1734,6 +1735,16 @@ static int isc_async_bound(struct v4l2_async_notifier *notifier, >> >> subdev_entity->sd = subdev; >> >> + pad = media_entity_get_fwnode_pad(&subdev->entity, asd->match.fwnode, >> + MEDIA_PAD_FL_SOURCE); >> + if (pad < 0) { >> + v4l2_err(&isc->v4l2_dev, "failed to find pad for %s\n", >> + subdev->name); >> + return pad; >> + } >> + >> + isc->remote_pad = pad; >> + >> return 0; >> } >> >> @@ -1748,8 +1759,8 @@ static void isc_async_unbind(struct v4l2_async_notifier *notifier, >> v4l2_ctrl_handler_free(&isc->ctrls.handler); >> } >> >> -static struct isc_format *find_format_by_code(struct isc_device *isc, >> - unsigned int code, int *index) >> +struct isc_format *isc_find_format_by_code(struct isc_device *isc, >> + unsigned int code, int *index) >> { >> struct isc_format *fmt = &isc->formats_list[0]; >> unsigned int i; >> @@ -1765,6 +1776,7 @@ static struct isc_format *find_format_by_code(struct isc_device *isc, >> >> return NULL; >> } >> +EXPORT_SYMBOL_GPL(isc_find_format_by_code); >> >> static int isc_formats_init(struct isc_device *isc) >> { >> @@ -1781,7 +1793,7 @@ static int isc_formats_init(struct isc_device *isc) >> NULL, &mbus_code)) { >> mbus_code.index++; >> >> - fmt = find_format_by_code(isc, mbus_code.code, &i); >> + fmt = isc_find_format_by_code(isc, mbus_code.code, &i); >> if (!fmt) { >> v4l2_warn(&isc->v4l2_dev, "Mbus code %x not supported\n", >> mbus_code.code); >> @@ -1909,7 +1921,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) >> vdev->queue = q; >> vdev->lock = &isc->lock; >> vdev->ctrl_handler = &isc->ctrls.handler; >> - vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; >> + vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE | >> + V4L2_CAP_IO_MC; >> video_set_drvdata(vdev, isc); >> >> ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); >> @@ -1919,8 +1932,14 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) >> goto isc_async_complete_err; >> } >> >> + ret = isc_mc_register(isc); >> + if (ret < 0) >> + goto isc_async_complete_unregister_device; >> return 0; >> >> +isc_async_complete_unregister_device: >> + video_unregister_device(vdev); >> + >> isc_async_complete_err: >> mutex_destroy(&isc->lock); >> return ret; >> diff --git a/drivers/media/platform/atmel/atmel-isc-mc.c b/drivers/media/platform/atmel/atmel-isc-mc.c >> new file mode 100644 >> index 000000000000..2aea81d77b2f >> --- /dev/null >> +++ b/drivers/media/platform/atmel/atmel-isc-mc.c >> @@ -0,0 +1,287 @@ >> +// SPDX-License-Identifier: GPL-2.0-only >> +/* >> + * Microchip Image Sensor Controller (ISC) Media Controller support >> + * >> + * Copyright (C) 2021 Microchip Technology, Inc. >> + * >> + * Author: Eugen Hristev >> + * >> + */ >> + >> +#include >> +#include > > Should you include and ? Hi Jacopo, They are probably being included from another header. I will add them. > > Also, should you select MEDIA_CONTROLLER and V4L2_SUBDEV_API for all > the Kconfig symbols ? VIDEO_ATMEL_ISC directly selects: select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API and VIDEO_ATMEL_XISC depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API and VIDEO_V4L2_SUBDEV_API depends on MEDIA_CONTROLLER > >> + >> +#include "atmel-isc-regs.h" >> +#include "atmel-isc.h" >> + >> +static const struct media_device_ops isc_media_ops = { >> +}; > > Do you need this even if it's empty ? > Not sure. I can remove it and pass NULL, but I haven't checked what the subsystem is doing if there is no ops. I will try. >> + >> +static int isc_scaler_get_fmt(struct v4l2_subdev *sd, >> + struct v4l2_subdev_state *sd_state, >> + struct v4l2_subdev_format *format) >> +{ >> + struct isc_device *isc = container_of(sd, struct isc_device, scaler_sd); >> + struct v4l2_mbus_framefmt *v4l2_try_fmt; >> + >> + if (format->which == V4L2_SUBDEV_FORMAT_TRY) { >> + v4l2_try_fmt = v4l2_subdev_get_try_format(sd, sd_state, >> + format->pad); >> + format->format = *v4l2_try_fmt; >> + >> + return 0; >> + } >> + >> + format->format = isc->scaler_format; >> + >> + return 0; >> +} >> + >> +static int isc_scaler_set_fmt(struct v4l2_subdev *sd, >> + struct v4l2_subdev_state *sd_state, >> + struct v4l2_subdev_format *req_fmt) >> +{ >> + struct isc_device *isc = container_of(sd, struct isc_device, scaler_sd); >> + struct v4l2_mbus_framefmt *v4l2_try_fmt; >> + struct isc_format *fmt; >> + unsigned int i; >> + >> + if (req_fmt->pad == ISC_SCALER_PAD_SOURCE) >> + v4l_bound_align_image >> + (&req_fmt->format.width, 16, isc->max_width, 0, >> + &req_fmt->format.height, 16, isc->max_height, 0, 0); >> + else >> + v4l_bound_align_image >> + (&req_fmt->format.width, 16, 10000, 0, >> + &req_fmt->format.height, 16, 10000, 0, 0); >> + >> + req_fmt->format.colorspace = V4L2_COLORSPACE_SRGB; >> + req_fmt->format.field = V4L2_FIELD_NONE; >> + req_fmt->format.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; >> + req_fmt->format.quantization = V4L2_QUANTIZATION_DEFAULT; >> + req_fmt->format.xfer_func = V4L2_XFER_FUNC_DEFAULT; >> + >> + fmt = isc_find_format_by_code(isc, req_fmt->format.code, &i); >> + >> + if (!fmt) >> + fmt = &isc->formats_list[0]; >> + >> + req_fmt->format.code = fmt->mbus_code; >> + >> + if (req_fmt->which == V4L2_SUBDEV_FORMAT_TRY) { >> + v4l2_try_fmt = v4l2_subdev_get_try_format(sd, sd_state, >> + req_fmt->pad); >> + *v4l2_try_fmt = req_fmt->format; >> + /* Trying on the pad sink makes the source sink change too */ >> + if (req_fmt->pad == ISC_SCALER_PAD_SINK) { >> + v4l2_try_fmt = >> + v4l2_subdev_get_try_format(sd, sd_state, >> + ISC_SCALER_PAD_SOURCE); >> + *v4l2_try_fmt = req_fmt->format; >> + >> + v4l_bound_align_image(&v4l2_try_fmt->width, >> + 16, isc->max_width, 0, >> + &v4l2_try_fmt->height, >> + 16, isc->max_height, 0, 0); >> + } >> + /* if we are just trying, we are done */ >> + return 0; >> + } >> + >> + isc->scaler_format = req_fmt->format; >> + >> + return 0; >> +} >> + >> +static int isc_scaler_enum_mbus_code(struct v4l2_subdev *sd, >> + struct v4l2_subdev_state *sd_state, >> + struct v4l2_subdev_mbus_code_enum *code) >> +{ >> + struct isc_device *isc = container_of(sd, struct isc_device, scaler_sd); >> + int supported_index = 0; >> + int i; >> + >> + for (i = 0; i < isc->formats_list_size; i++) { >> + if (!isc->formats_list[i].sd_support) >> + continue; >> + if (supported_index == code->index) { >> + code->code = isc->formats_list[i].mbus_code; >> + return 0; >> + } >> + supported_index++; >> + } >> + >> + return -EINVAL; >> +} >> + >> +static int isc_scaler_g_sel(struct v4l2_subdev *sd, >> + struct v4l2_subdev_state *sd_state, >> + struct v4l2_subdev_selection *sel) >> +{ >> + struct isc_device *isc = container_of(sd, struct isc_device, scaler_sd); >> + >> + if (sel->pad == ISC_SCALER_PAD_SOURCE) >> + return -EINVAL; >> + >> + if (sel->target != V4L2_SEL_TGT_CROP_BOUNDS && >> + sel->target != V4L2_SEL_TGT_CROP) >> + return -EINVAL; >> + >> + sel->r.height = isc->max_height; >> + sel->r.width = isc->max_width; >> + >> + sel->r.left = 0; >> + sel->r.top = 0; >> + >> + return 0; >> +} >> + >> +static int isc_scaler_init_cfg(struct v4l2_subdev *sd, >> + struct v4l2_subdev_state *sd_state) >> +{ >> + struct v4l2_mbus_framefmt *v4l2_try_fmt = >> + v4l2_subdev_get_try_format(sd, sd_state, 0); >> + struct isc_device *isc = container_of(sd, struct isc_device, scaler_sd); >> + >> + *v4l2_try_fmt = isc->scaler_format; >> + >> + return 0; >> +} >> + >> +static const struct v4l2_subdev_pad_ops isc_scaler_pad_ops = { >> + .enum_mbus_code = isc_scaler_enum_mbus_code, >> + .set_fmt = isc_scaler_set_fmt, >> + .get_fmt = isc_scaler_get_fmt, >> + .get_selection = isc_scaler_g_sel, >> + .init_cfg = isc_scaler_init_cfg, >> +}; >> + >> +static const struct v4l2_subdev_ops xisc_scaler_subdev_ops = { >> + .pad = &isc_scaler_pad_ops, >> +}; >> + >> +static int isc_init_own_sd(struct isc_device *isc) >> +{ >> + int ret; >> + >> + v4l2_subdev_init(&isc->scaler_sd, &xisc_scaler_subdev_ops); >> + >> + isc->scaler_sd.owner = THIS_MODULE; >> + isc->scaler_sd.dev = isc->dev; >> + snprintf(isc->scaler_sd.name, sizeof(isc->scaler_sd.name), >> + "atmel_isc_scaler"); >> + >> + isc->scaler_sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; >> + isc->scaler_sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER; >> + isc->scaler_pads[ISC_SCALER_PAD_SINK].flags = MEDIA_PAD_FL_SINK; >> + isc->scaler_pads[ISC_SCALER_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; >> + >> + isc->scaler_format.height = isc->max_height; >> + isc->scaler_format.width = isc->max_width; >> + isc->scaler_format.code = isc->formats_list[0].mbus_code; >> + isc->scaler_format.colorspace = V4L2_COLORSPACE_SRGB; >> + isc->scaler_format.field = V4L2_FIELD_NONE; >> + isc->scaler_format.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; >> + isc->scaler_format.quantization = V4L2_QUANTIZATION_DEFAULT; >> + isc->scaler_format.xfer_func = V4L2_XFER_FUNC_DEFAULT; >> + >> + ret = media_entity_pads_init(&isc->scaler_sd.entity, >> + ISC_SCALER_PADS_NUM, >> + isc->scaler_pads); >> + if (ret < 0) { >> + dev_err(isc->dev, "scaler sd media entity init failed\n"); >> + return ret; >> + } >> + ret = v4l2_device_register_subdev(&isc->v4l2_dev, &isc->scaler_sd); >> + if (ret < 0) { >> + dev_err(isc->dev, "scaler sd failed to register subdev\n"); >> + return ret; >> + } >> + >> + return ret; >> +} >> + >> +int isc_mc_init(struct isc_device *isc, u32 ver) >> +{ >> + const struct of_device_id *match; >> + int ret; >> + >> + isc->video_dev.entity.function = MEDIA_ENT_F_IO_V4L; >> + isc->video_dev.entity.flags = MEDIA_ENT_FL_DEFAULT; >> + isc->pads[ISC_PAD_SINK].flags = MEDIA_PAD_FL_SINK; >> + >> + ret = media_entity_pads_init(&isc->video_dev.entity, ISC_PADS_NUM, >> + isc->pads); >> + if (ret < 0) { >> + dev_err(isc->dev, "media entity init failed\n"); >> + return ret; >> + } >> + >> + isc->mdev.dev = isc->dev; >> + isc->mdev.ops = &isc_media_ops; >> + >> + match = of_match_node(isc->dev->driver->of_match_table, >> + isc->dev->of_node); >> + >> + strscpy(isc->mdev.driver_name, KBUILD_MODNAME, >> + sizeof(isc->mdev.driver_name)); >> + strscpy(isc->mdev.model, match->compatible, sizeof(isc->mdev.model)); >> + snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s", >> + isc->v4l2_dev.name); >> + isc->mdev.hw_revision = ver; >> + >> + media_device_init(&isc->mdev); >> + >> + isc->v4l2_dev.mdev = &isc->mdev; >> + >> + return isc_init_own_sd(isc); >> +} >> +EXPORT_SYMBOL_GPL(isc_mc_init); >> + >> +int isc_mc_register(struct isc_device *isc) >> +{ >> + int ret; >> + >> + ret = media_create_pad_link(&isc->current_subdev->sd->entity, >> + isc->remote_pad, &isc->scaler_sd.entity, >> + ISC_SCALER_PAD_SINK, >> + MEDIA_LNK_FL_ENABLED | >> + MEDIA_LNK_FL_IMMUTABLE); >> + >> + if (ret < 0) { >> + v4l2_err(&isc->v4l2_dev, >> + "Failed to create pad link: %s to %s\n", >> + isc->current_subdev->sd->entity.name, >> + isc->scaler_sd.entity.name); >> + return ret; >> + } >> + >> + dev_dbg(isc->dev, "link with %s pad: %d\n", >> + isc->current_subdev->sd->name, isc->remote_pad); >> + >> + ret = media_create_pad_link(&isc->scaler_sd.entity, >> + ISC_SCALER_PAD_SOURCE, >> + &isc->video_dev.entity, ISC_PAD_SINK, >> + MEDIA_LNK_FL_ENABLED | >> + MEDIA_LNK_FL_IMMUTABLE); >> + >> + if (ret < 0) { >> + v4l2_err(&isc->v4l2_dev, >> + "Failed to create pad link: %s to %s\n", >> + isc->scaler_sd.entity.name, >> + isc->video_dev.entity.name); >> + return ret; >> + } >> + >> + dev_dbg(isc->dev, "link with %s pad: %d\n", isc->scaler_sd.name, >> + ISC_SCALER_PAD_SOURCE); >> + >> + return media_device_register(&isc->mdev); > > I feel like the isc-base driver shold instead register the > media-controller and this file shuld actually be only about > isc-scaler or something. I might be missing why it is not possible > though. It doesn't seem to me that mc support is conditional, so it > can happen in the base driver directly ? This actually is the base driver. Just that the atmel-isc-base.c is pretty crowded. So I moved the MC part in this file. But it's the same base driver. > > Links creation can still happen at async_complete() (I would have > suggested _bound() time, but you have no asyn subdev for the scaler, > so I guess the only async subdev here is the sensor). Yes, the sensor or any kind of subdevice (XISC normally is connected to a bridge, ISC to a sensor directly ) > > All in all: can this function be removed and: > 1) Base driver registers the media controller device in probe Should we register the media device even if it's not operational ? and no video device has been registered ? I thought it would be safer to have it registered with all the links/entities/etc once the video node has been completed. But if you say this is the proper way, I can do that. I wanted to keep things separated and not overcrowd the base file /probe function, but if it's just a media_device_register call, I can do it there. > 2) links are created at async_complete time ? That works too. I think I could move them there. Thanks for reviewing, Eugen > > Thanks > j > > >> +} >> +EXPORT_SYMBOL_GPL(isc_mc_register); >> + >> +void isc_mc_cleanup(struct isc_device *isc) >> +{ >> + media_entity_cleanup(&isc->video_dev.entity); >> +} >> +EXPORT_SYMBOL_GPL(isc_mc_cleanup); >> diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h >> index 07fa6dbf8460..0b6370d7775f 100644 >> --- a/drivers/media/platform/atmel/atmel-isc.h >> +++ b/drivers/media/platform/atmel/atmel-isc.h >> @@ -183,6 +183,17 @@ struct isc_reg_offsets { >> u32 his_entry; >> }; >> >> +enum isc_mc_pads { >> + ISC_PAD_SINK = 0, >> + ISC_PADS_NUM = 1, >> +}; >> + >> +enum isc_scaler_pads { >> + ISC_SCALER_PAD_SINK = 0, >> + ISC_SCALER_PAD_SOURCE = 1, >> + ISC_SCALER_PADS_NUM = 2, >> +}; >> + >> /* >> * struct isc_device - ISC device driver data/config struct >> * @regmap: Register map >> @@ -258,6 +269,12 @@ struct isc_reg_offsets { >> * be used as an input to the controller >> * @controller_formats_size: size of controller_formats array >> * @formats_list_size: size of formats_list array >> + * @pads: media controller pads for isc video entity >> + * @mdev: media device that is registered by the isc >> + * @remote_pad: remote pad on the connected subdevice >> + * @scaler_sd: subdevice for the scaler that isc registers >> + * @scaler_pads: media controller pads for the scaler subdevice >> + * @scaler_format: current format for the scaler subdevice >> */ >> struct isc_device { >> struct regmap *regmap; >> @@ -346,6 +363,19 @@ struct isc_device { >> struct isc_format *formats_list; >> u32 controller_formats_size; >> u32 formats_list_size; >> + >> + struct { >> + struct media_pad pads[ISC_PADS_NUM]; >> + struct media_device mdev; >> + >> + u32 remote_pad; >> + }; >> + >> + struct { >> + struct v4l2_subdev scaler_sd; >> + struct media_pad scaler_pads[ISC_SCALER_PADS_NUM]; >> + struct v4l2_mbus_framefmt scaler_format; >> + }; >> }; >> >> extern const struct regmap_config isc_regmap_config; >> @@ -357,4 +387,10 @@ int isc_clk_init(struct isc_device *isc); >> void isc_subdev_cleanup(struct isc_device *isc); >> void isc_clk_cleanup(struct isc_device *isc); >> >> +int isc_mc_init(struct isc_device *isc, u32 ver); >> +int isc_mc_register(struct isc_device *isc); >> +void isc_mc_cleanup(struct isc_device *isc); >> + >> +struct isc_format *isc_find_format_by_code(struct isc_device *isc, >> + unsigned int code, int *index); >> #endif >> diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c >> index 1b2063cce0f7..a3e4c32a66c4 100644 >> --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c >> +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c >> @@ -529,6 +529,12 @@ static int atmel_isc_probe(struct platform_device *pdev) >> break; >> } >> >> + regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver); >> + >> + ret = isc_mc_init(isc, ver); >> + if (ret < 0) >> + goto isc_probe_mc_init_err; >> + >> pm_runtime_set_active(dev); >> pm_runtime_enable(dev); >> pm_request_idle(dev); >> @@ -538,7 +544,7 @@ static int atmel_isc_probe(struct platform_device *pdev) >> ret = clk_prepare_enable(isc->ispck); >> if (ret) { >> dev_err(dev, "failed to enable ispck: %d\n", ret); >> - goto cleanup_subdev; >> + goto isc_probe_mc_init_err; >> } >> >> /* ispck should be greater or equal to hclock */ >> @@ -548,7 +554,6 @@ static int atmel_isc_probe(struct platform_device *pdev) >> goto unprepare_clk; >> } >> >> - regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver); >> dev_info(dev, "Microchip ISC version %x\n", ver); >> >> return 0; >> @@ -556,6 +561,9 @@ static int atmel_isc_probe(struct platform_device *pdev) >> unprepare_clk: >> clk_disable_unprepare(isc->ispck); >> >> +isc_probe_mc_init_err: >> + isc_mc_cleanup(isc); >> + >> cleanup_subdev: >> isc_subdev_cleanup(isc); >> >> @@ -576,6 +584,8 @@ static int atmel_isc_remove(struct platform_device *pdev) >> >> pm_runtime_disable(&pdev->dev); >> >> + isc_mc_cleanup(isc); >> + >> isc_subdev_cleanup(isc); >> >> v4l2_device_unregister(&isc->v4l2_dev); >> diff --git a/drivers/media/platform/atmel/atmel-sama7g5-isc.c b/drivers/media/platform/atmel/atmel-sama7g5-isc.c >> index 2b1082295c13..d2ac80b1ccc3 100644 >> --- a/drivers/media/platform/atmel/atmel-sama7g5-isc.c >> +++ b/drivers/media/platform/atmel/atmel-sama7g5-isc.c >> @@ -523,15 +523,23 @@ static int microchip_xisc_probe(struct platform_device *pdev) >> break; >> } >> >> + regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver); >> + >> + ret = isc_mc_init(isc, ver); >> + if (ret < 0) >> + goto isc_probe_mc_init_err; >> + >> pm_runtime_set_active(dev); >> pm_runtime_enable(dev); >> pm_request_idle(dev); >> >> - regmap_read(isc->regmap, ISC_VERSION + isc->offsets.version, &ver); >> dev_info(dev, "Microchip XISC version %x\n", ver); >> >> return 0; >> >> +isc_probe_mc_init_err: >> + isc_mc_cleanup(isc); >> + >> cleanup_subdev: >> isc_subdev_cleanup(isc); >> >> @@ -552,6 +560,8 @@ static int microchip_xisc_remove(struct platform_device *pdev) >> >> pm_runtime_disable(&pdev->dev); >> >> + isc_mc_cleanup(isc); >> + >> isc_subdev_cleanup(isc); >> >> v4l2_device_unregister(&isc->v4l2_dev); >> -- >> 2.25.1 >> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel