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 5898CC433EF for ; Tue, 11 Jan 2022 17:02:14 +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=NNjrLsUVgfPI0YMtibO0N0S571lMNWDvMyYq1v722Mk=; b=lWQ0TnFvHQQd4x BXcSyWOyiU0RRmXPHw4ybQ84bAmAaoho5aanMrOQjGZFIK8aXNpk/je8piVXGijLQ1UVMoE6ketmV YK/La54EpS+Road0r+lKAF5LtOcf7vSiPr/csnSBlZUVm2zQunK4Xlx0YyXpZABJRnkgvB++27L+6 Ly3TFv+uigKSQmn7UnuxKFrgR/oYslXRIIzIqMAA0RAmAIEz2X08eOfhCEhIQOb92QmGOB61XNCNE 9OuAFqTW7AgxLV7nL9SdL7nSzjRZwKbPNj+aso2XiaBMQg6512XLAScuQXDprY3T7jnGw4D1yQvO7 j3XosfFPbnsxxJwLWCAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7KVk-00H0BA-0m; Tue, 11 Jan 2022 17:00:40 +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 1n7KVd-00H09D-C5 for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 17:00:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1641920432; x=1673456432; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=wXDIVVzpkLBPw5XtiqdpOqj/P0/DxkED1vlkmf9tyTQ=; b=qWUA7iPOx09xwB0J6gU2W40mqBHqETv4QcIkAFo8ZXK+uGCDAjZAMezo JX9QqVL50tKiy1cuQCn4cPYXgJmEPpvdTvyKUTrBtrBFDAHc6ITHNqfCE M1OqmdYk6rBPdsKP9HwBh2mZG/GNUfBdYnHLGbxYgpoYiQHYvYxZko4Y0 X4t5vOkhi8lNtsK2JNsVCORi0giJ0CA9gEkwHPAF64ib7kc9ZDGKbN18z Da/YTq/jApv+SZf3VaImmX+HOHsPptYKwCrTR4UOXVtBIxrKBjA+jAVmQ txx2mtliDXE2B9vSod5LSmxaaf7XVIDSfqN/9G7GXa8uG3ggpyrieZ7eU w==; IronPort-SDR: P5BvmFUV1BibqARoDRHdifuUqulaU8WlN48Xhhl/uaoXML7Zt7a27184a8OxDIUAtdWH8PoJxE q8PRk8l8eCQ/adKgGV9eZuz/X31ylHGkbebfMB/dr3faQpsr2YIVf/x43uTw1R7Uy9Tr7QYe3N +UJoKSM38L2J/5S1oS3qF/eMaTg+ZRgRPvGWK+h9yhjvJXaM5mqlqpZiClskIs42lQjP/TKjfv ss7Sp0PvMQKedoPXrXIhCARAdCkTjmKg+FIa+FRB2bl55K4hkcbax1E3flVnXrnRR+wmXW72/m ePqhvWsVUpNRN7f2lXpcSXGT X-IronPort-AV: E=Sophos;i="5.88,279,1635231600"; d="scan'208";a="142357690" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Jan 2022 10:00:31 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) 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 10:00:32 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.72) 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 10:00:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=feuB84ZpUQggrdA0MIitA6G5Y+8n0WuXgnTL/6VR1N6ndbIZ7XoY446CCKu3x6Wmjqbxa1IjV1Mrxtk6TWSew9Ti2ZYxd68kX64i5LKyCbZ0osmuWvWzanjut8NLEcVIsuc+gNCzxwHA7nn5zrm7e37jSZ2qHlSyyUmmC6HzSR/Aq54zpUyVuJx2M8Elly8UTfR3f4NiecNGvIfJAbB14WbZtjIUIfH3mijSx9xn2wlbesI51UBBFLYe5XTAL9f9KXQwJ0MCm6xabdANkotH6PzrHn+4tCgkGP/LRNB4hKm/Go1z45dmoC7hYWp4cCuEs8lNBbTabexDQSUswtMQWg== 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=wXDIVVzpkLBPw5XtiqdpOqj/P0/DxkED1vlkmf9tyTQ=; b=FJsPz0Nt2ONnXzAq2NZ12HOsbdgumHgSeeKU/TvjynUBd4ruCJspxnB5V7jlMcRzPnDh9fyJv4PkP4s+3RsvZeV12YP0bHHkwWy6GzE7Xk7XweeY8reQ09M11tb9d/MdisPKVUkHgBI3u3TZLMgkhqk5/XVMcUySEVQCNhuHVmyjOAg95xy/zJbzkY34/rJf5iFS6VZ6o52P/qFTdYquk0qslBv6mUEo/PYxY/dhXueYp7xTUh58kVFh95wxzjFpciF5Z4fAJuU3VQocKwRkHBpl309pgmmS/1BILTKmI7FLJYHszHiMU6fDj5e2acqrY6Ogj8o3tqS/h6b4SthqoQ== 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=wXDIVVzpkLBPw5XtiqdpOqj/P0/DxkED1vlkmf9tyTQ=; b=Jlzk8wPB+53H7M4M1FFtys2RWeRSYWoxRkMc33vrcDJENN2a5XRNI9NXwBmwehwXefjYugUzQFXPeO0f42ezM9zbGiTXbSKlQ+PkX5Z8z0B08YsJ7foe89uTyQdCHrhtX92GAj8fuurebcp4Fm26wlZftc3j4nXPHk210JsbnKU= Received: from PH0PR11MB4920.namprd11.prod.outlook.com (2603:10b6:510:41::22) by DM6PR11MB4012.namprd11.prod.outlook.com (2603:10b6:5:6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Tue, 11 Jan 2022 17:00:28 +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 17:00:28 +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: AQHX8CjLLR1Cbrq9ykurq5T4e7oxC6xeKfGAgAAGtACAAAYCAIAAAn2A Date: Tue, 11 Jan 2022 17:00:28 +0000 Message-ID: <7a05c500-b46d-e7c9-25d6-f787c01352bf@microchip.com> References: <20211213134940.324266-1-eugen.hristev@microchip.com> <20211213134940.324266-13-eugen.hristev@microchip.com> <20220111160603.qi4kbp6rn45hp7po@uno.localdomain> <20220111165132.g62ykrjjk3jh4eyd@uno.localdomain> In-Reply-To: <20220111165132.g62ykrjjk3jh4eyd@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: dc66d0f0-16ec-466e-ae3e-08d9d523deca x-ms-traffictypediagnostic: DM6PR11MB4012: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: GdcJlVqBwVZ5I9/56XBwNfWDZFwJE9zrjrn/58ZS4gEEVywdv3kPZ3X1FhhHShgmDSNoOjTPvO6SkGF6sxjidq5xjMSym7PuistQTUmsh2cIV3YZ9dsYOjqfbotkiFAMwlUtAMhNHx1M36OF5zpa+wMTbOpdfGeHKQh/MJK61jgU1pEhGZ4ln0iEcmcojcQfgpoELm/j+hDMtOEFUBBAeu2Yjxx832kBUTXdRl64y48d2cE5RH2RHBPM20hfunmTVxihkydyu9yhYzbhJybYLzaiU8SPCNoFa14NNXrP/jaE8TcxGMnStDc6CS3vhhIzr5yCBgSeZhKveyoIP8j6MFhXcbaJxKYmwhU2awHdq4oB7rAQCjmsFM9v5EmbmVv4EgZ4T2pDcaTBh3ysqM2GwqoovuoMk+PognU3aOjUOCuymAxxVCWb8uJAktZ9wvfRgm+ARf0FC9QYgLTMPHop92H5WJdxzunk27+RMPc0UVL03tGJqv41VFS5Gg1CeXQtAQHXxehnH1HApo3DgKLOWDqqGbdEJalKjUg+Bg/kmin9Qse72RfRCLHSyO7rqxr7pXzhAx2Z7uhozD4Cjj4ht52OlsR5BBpVNqGZc851cmbkj7GD3rrMfDozBSO70bTzeosb3FiN010UDGczx2+CDQeGZdzoF9zdeNfXeCbmcYeoxEKmGp+FIgLEPXnXK9rYPDUq/TPVsgyj2mpZYPN1Ljzqb7N50DLUfIgBUnWN742HRJRWdioRkQD7+/mYOBANQBPZM4uuoNjSLd6AwW6Y9w== 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)(8676002)(83380400001)(38070700005)(71200400001)(4326008)(8936002)(6916009)(6486002)(54906003)(31686004)(6512007)(26005)(76116006)(31696002)(91956017)(186003)(2906002)(86362001)(107886003)(53546011)(6506007)(5660300002)(30864003)(66556008)(66476007)(122000001)(66446008)(66946007)(2616005)(38100700002)(36756003)(64756008)(316002)(508600001)(45980500001)(43740500002)(579004)(559001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?Q1gxM2o4L00xUDFqQWNyUmM0MlNpWXp2ZzRjSkR5R01yb09NdDhqa1A0ZUlr?= =?utf-8?B?ZFQ5aG5YcGRtUEZTNFN1SlZzby9ScWpORTFDSTlTUG5Pc2pQU1I1ZUF0SmV3?= =?utf-8?B?dEg3VnJXRnkycUdUOER3ZGs3cDNMaDJXVVdNdFlwUXBQWVJzTkordGU3Smdh?= =?utf-8?B?U1NrM2dsMFNOYkVCY3hnckxUZU02QzlJdnAwOWlpUzkzL3kvQTRidXhCTnVa?= =?utf-8?B?ZGdTZzlVMHhGWVI5NDNXV3ZYa0QvU3Jvc3dyOHJHRi9kamx1SkNBRFg0akFw?= =?utf-8?B?VG5mZERJdlRKMEl6WThFb1NGd0ZrTGhUQ1RQQ25VK1hoL0RtNUlMUXo3ZFVR?= =?utf-8?B?R0hNRUtCR2NVY2lOcUZrMndVaXJBcVlJbWNYRnZLTlhyakJHQmtUUGpabG8z?= =?utf-8?B?emZBU1pRRWk4U1NzMlI0amxEWlJsMzNMZDI3K1daQlJQa3VGdWZteGV6RWpQ?= =?utf-8?B?TjFRM0pTY21QZnZpdTdiWDJzeTYwcGY0WUpTSHM4MUxvbjd5Q3RCcUVEbjVQ?= =?utf-8?B?UDJMVS8zeitrYUdjZzVkeWpKVXJwcXpsaCsrT1dMcmxMUzVLTFR2WUFLeHQ0?= =?utf-8?B?TEpaMDdYeDF5aWErK29ua2MxbDF3V1JrWTk2NzI0YkY5a09CUE8rdzloK2d0?= =?utf-8?B?cDdRNmY5NWIycnliS0I0dzlGTUZMS0lxem92U3FWYWI4ZnAvZ0lPSVJCeDhZ?= =?utf-8?B?bVpvajNNVG94YVJrU0V4eHBsU1hKSG5XbEt0Mmh4TFY1U3hRMkZQS2dtQ0tD?= =?utf-8?B?a1d5NGNRdUcyOE9sNG1BVlpVbWVvZWtrb0taTElTbVptalVSRitLWGgrbVBX?= =?utf-8?B?RDJMMjI3cjNUZkRiM2UzVy9qd2FpbCszK3pyUmJYM0pxUTBId3daT0NYVW1l?= =?utf-8?B?Y2srd1FoZzRjQWc2TW9XN2xVejdwMGlrTjZ2clBtM0xaU3I5TUtZMjJVeXZU?= =?utf-8?B?bmk4dGNMMnNNZmhmeHNRUStLMDNvRFhrL2w0anppL2VsY2t3TVhkVGVZQkdp?= =?utf-8?B?UWszQ0RWMklWa1hnT2lHOXZqU1V6S3FnMXQvVWNPSktzeUVmWjQyOVdiaVlI?= =?utf-8?B?VmFpNWh1SUtGMnp5TVBMWk9rVDBUYXFzMWhWOVdBcTJRR0ZoVEk5UVp6UnV0?= =?utf-8?B?R0V6bHVJcVhraDdkMVFIUmVzVTFEcEdDSGJCd3Zad29ZU0hMTHZtbU5Sa0Fn?= =?utf-8?B?a0dpWHpESzVnZk1uQzBKanczd1hVUnErc3c1Kzk3ZFg1bGZZZFc1QVZmcFVB?= =?utf-8?B?MGhOYjBqVEhYV1RBN0s0alhLOERDdkYyZTFmbnN1K2xGVFJGWVpYMjJFK2FP?= =?utf-8?B?UWxhdHpvajBZK2tuUk1NS09Fakwyd0tzYlIzcmQzSFM3Z1E2T1U0NnVhbFQw?= =?utf-8?B?a1JER3E3Tkd0NkoxQ1JYZ0FWTWhPWWJNT2dMWlFNNXlnQUJnYktpM1QxT0dv?= =?utf-8?B?dlFNVys0Y0NEUXdiMVlpbW5FbXRuK005TjlRcDdudngraFBDZlVIZE1IUWhv?= =?utf-8?B?QjNPSnJUVnYwc2RPaFl4a1hld3cyV080KysraGhOTCtwYXc1dGNsU2tsVnhB?= =?utf-8?B?cDAwLzlXTGdjMlp6Z3YxSDVGMVlWaFZOdVFCNUlYV1JsWXFLWllKemNkbUdF?= =?utf-8?B?d1pjNkFIcGpNYXo4TzFoTTVzUkhNUk1TVHpGQ0JtTHBiWWlrUngzQW43dFBz?= =?utf-8?B?ai85NUxwK3RiVVN0S3lzUVRMZUYvMUdxQ1BjSjFROEo1d0xoY2M4NDVjL2tI?= =?utf-8?B?clRQcWlDL2QrOTFIS3E4cHhnNi9kQk9yWTQ4M2dyN2VYZjVFZEQwV1h2S2I0?= =?utf-8?B?Y0dWUWdmaWI3SWtyTFAyVC9ReHFHZmVPbldBcktHdnhGd2piOEZYTDUwanVG?= =?utf-8?B?emxBa24zdnBlckJ6UkN1TENiZ2VndUlLV3Y2MldiT2dMWU56ZjQwUHQ4ZzlI?= =?utf-8?B?Ykh2THNFL0pPU3NEdjgwblppL2gxTUN4OEVKcThmN2hCOXRlSTQySFc5SnFt?= =?utf-8?B?aFNHbFEzWC84VW1RdCt6dkUyVmJzNFh6eFdESUMvWDhONDJ4VUp1aEhyYzBa?= =?utf-8?B?RWNHUkEwRWtKY0xaSnNPSzR4Qm42M0hwMUZhTHZjRE5xZlJkQlRjL3ZIRzJF?= =?utf-8?B?T2pxblRUL2tKVU9WcmE0clhSVHg2U1QxRXJFN3JmeTZaQVB3OFQvbDJEYmJh?= =?utf-8?B?V01lVVFMYkg5RXl6cjUzbFhKbS8vVFJ6VzJIalM0OXhqcC9kV2cyb3JMSThq?= =?utf-8?B?OCs5MmhTR1JpbXErUTB1b0diWTRnPT0=?= Content-ID: <2EAA4C2344038840A37646D55CC783B7@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: dc66d0f0-16ec-466e-ae3e-08d9d523deca X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2022 17:00:28.6186 (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: o/PhODoNsUgg+ef3zSJhK0IS+z8mndU5Qh7BqP5k7V/7pnKYbGreNtWpJOrMdTf5RAyq+9N8Bikie76KFQT4IAFMQfXcJW0uV3uqct72q7o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4012 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_090033_707874_3B6E9094 X-CRM114-Status: GOOD ( 20.13 ) 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:51 PM, Jacopo Mondi wrote: > On Tue, Jan 11, 2022 at 04:30:15PM +0000, Eugen.Hristev@microchip.com wrote: >> 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. >> > > Thank you :) > >>> >>> 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 selects VIDEO_ATMEL_ISC_BASE so it's fine! > > VIDEO_ATMEL_ISI does not. I'm fine if this is intended, I might have > got lost in the several pieces this driver is composed of :) The ISI is a totally different driver with no code shared with the ISC. It's a different hardware, on some older platforms. It does not support media controller and will not in the near future. Initially there was ISI, then ISC appeared and a new driver was created. Then a newer version of the ISC appeared named XISC, but a lot was common with the old ISC, so I created a new driver XISC with shared common base with the old ISC. So now we have ISI, and ISC/XISC who share ATMEL_ISC_BASE > >> >> 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. >> > > Seems like it is safe as the core checks for if (mdev->ops) before > accessing it (except for mc-request for which operations are > mandatory) > >>>> + >>>> +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. >> > > I understand. isc-base is pretty big, you're right. > However breaking mc apart in a file that mixes registering an entity > for the scaler and initializing mc for the whole driver feels weird, > at least to me, as I don't immediately get why the mc part is handled > by the scaler file... > >>> >>> 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. > > You are right. Calling media_device_register() at async_complete time > is the right thing to do. > > Thanks > j > > >> >>> 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