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 427B5C433FE for ; Wed, 9 Mar 2022 16:11:15 +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=1PB2pWUVIcLchKpWcBM5cPjpqGY/ASa45b77ANlMgOA=; b=21tgc1l3JGaWEd Hm5EV4CJmw1Cjmx8sr51cNiqwwkZ82YM7sUw3zkFLgNt0ezjUC0b6CaRTej2OqO8FgPtu4DQIepna eLDaFf577IXfc+XwrrvPz45phNnB1HEZqomNaXwdUZIx23bABgPZpX5Hl8eo0/wXSFJ+TJyIUkg39 wzrDXISSNaPzEfi/Sve9UEyvEjKz1PrgVqIikPhsc/+f/a8p22JQ1BwMx8nv56avuWA3Kwa4UIkDT pJyy5oxhpIPVzTOT2pKsseAZqk1EPXOylCUzdT3gfy45LQfc5xiLYZrBGnzLIMxlwm1DqPh4txJX1 vB92jsCQTaCmK/qqs+kw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRysd-009HOZ-Tk; Wed, 09 Mar 2022 16:09: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 1nRysY-009HM1-4c for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 16:09:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1646842174; x=1678378174; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=XnxYqgWGHh0pqGBZrKjpK0qy2V39iN+rwpQmGQUCGtI=; b=UJAqp3byS01CbURS0/Cdd82MTg7uZNa9rW4aLL7WFK8mha+bCew8Hxxg PhaNelHz2beA3Pk+V3l82Ix7SI0rP8M58BGIs2UrpKeeBgCEYNhgUHWdO UUDc7SYgsunRDHauY43n5QNsVUjevYcn3VmC+DYhIkj0rLn7Jvf9wVAu1 3B8jdI4Rwu3VwxjYVCzeCnSmdsAt4wQZdL8gUZQC2tPcQ4e0zUFyeFOro yd1f7kGvtwcoZHzadm/MN01CD290M/QTEjNJ2Am0CCjE4l926ajwj9XF4 tKOk7tzuzFKu4t5dhYRFbJGrbsN1un4Hg99uPDUNtwI1DuKlE+nG8j6re w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643698800"; d="scan'208";a="88374869" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 09 Mar 2022 09:09:32 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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; Wed, 9 Mar 2022 09:09:31 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (10.10.215.89) by email.microchip.com (10.10.87.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17 via Frontend Transport; Wed, 9 Mar 2022 09:09:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A24Zj3MkyaFp8dpsa0mKZ6Qo+UsSvcVlkjth6IBBk2ocdNEAqdSIFg+cQbbszHrS24YMsS+8vt2tw1FHu3xruF/5ksUwCvmaA72g1P06EudEGxS7RjUV1J7J7A7nE2yZVtgkO+1MGnp4xd+HVQNFRj9ip2Cl2NH3VGHtapAMsd/YKo5CNjL2JXZ2JAkvLuYnoqPbdAO3XrhkXvnSrx4CS9pMzfXv78qv+9Z03jcFMwVBaHwlQoNDi0VdpKJBz17pITEKg9M6si+nEQRnl7pyMSyrxyUknklBgatTIRuzkCGqLPKCm6QC3t/UUrOScTNIIajrqQ40ARmwlElbx0ztuA== 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=XnxYqgWGHh0pqGBZrKjpK0qy2V39iN+rwpQmGQUCGtI=; b=NbxU97aMjrhCa7NIKu0DHaoTMO1NdkaQhc1kt6IbF4v7jEXrUw44D1TGwG4jIjhlvmHVLyyaP/gmEIrN6U497xIMdkJuw8Wkdsf2znY5HjlGUHWw4ZBK9qiu9c9ubARu3xnjRBwI4G38KelnwhOx/TvPHEfk96hvpLkTFKPBObTBX7ajyDQYepzULifY+OZeeXnwj/UL1bZQXcaRlmAksZ/Mfxi85+7qmHZS0KpX+HP1z9Uwhpmm2EovPsqg57sCXPobszYKjtWL0++aJdQSORasnh9qynR3vnsk2xj6C7J6/Dx0EWBFor4JnrFPCwaFqfOHw+shgwCZKuF+ntN9OA== 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=XnxYqgWGHh0pqGBZrKjpK0qy2V39iN+rwpQmGQUCGtI=; b=vg19vxFXZy6h6+mhe8HD911+LwJwxfHOmHY9TDSjXM1UX6bL1KwX35SZBqJcrv7Tbt7SuxTKkg8fc3Z1gIGPTqv8bEZYSRo/uhR/9AefbDvPJVkWVG6LkEIdkXYlwewj+k7/fKOWSkIVRXB9Wl2CU7Xyo+0FiUdiJfTVhQ4zrHM= Received: from DM4PR11MB5392.namprd11.prod.outlook.com (2603:10b6:5:397::10) by BYAPR11MB2758.namprd11.prod.outlook.com (2603:10b6:a02:c9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Wed, 9 Mar 2022 16:09:17 +0000 Received: from DM4PR11MB5392.namprd11.prod.outlook.com ([fe80::81a3:e81b:f23a:c44b]) by DM4PR11MB5392.namprd11.prod.outlook.com ([fe80::81a3:e81b:f23a:c44b%7]) with mapi id 15.20.5038.027; Wed, 9 Mar 2022 16:09:17 +0000 From: To: Subject: Re: [PATCH v7 04/13] media: atmel: atmel-isc: implement media controller Thread-Topic: [PATCH v7 04/13] media: atmel: atmel-isc: implement media controller Thread-Index: AQHYMhuqqNolF4Z9ZUiFHwlZ2kBiUKy3Lt4AgAAEnwCAAAUoAIAAAyyA Date: Wed, 9 Mar 2022 16:09:16 +0000 Message-ID: References: <20220307120423.2427631-1-eugen.hristev@microchip.com> <20220307120423.2427631-5-eugen.hristev@microchip.com> <20220309152252.oz25pldorpred3cy@uno.localdomain> <4be270ed-608b-eac5-da57-3ca61f505140@microchip.com> <20220309155752.p2gjye7gnldw2th4@uno.localdomain> In-Reply-To: <20220309155752.p2gjye7gnldw2th4@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: 6cd70d50-8675-4284-1e32-08da01e7296a x-ms-traffictypediagnostic: BYAPR11MB2758:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5EkOvfcwadVb8lkUHwVCjBZqCO2joNncEpXVYwwr/uNGVR50xdcz0srUwXYWimSyooABRlv4vxpaDUZFeRpFWdwa7ciMfGU3ruGUH0udLqeneANHwUZltIi2zxaoBIZyQeguDtaIubp9dOA+FHV19FDSdhOmuXngFloldOVzseYDXoXjUAMJ0fUGs7y/mNK7gvjT3Sw5/iN740k4ZjEfg9IjU3dFOCbcIHS9hQ/B9UEjBOZjtAoHtcXfKxLkOyki5SWqopyRszdCsdPdVVu9jUlvNZt/EliDfyPWS2NtZJUjwBW0MRLNHRGvtv0ooPtqxdygZEZEi6cv5zD70fCAZt5v6kZEBaBmMyQb0yAfUomEvG61WLnUHo8FPI8GPSprd+J2vj/zPweejRMzHXhwKC+Gdy3NCYuk6fp4DwFwkTYqG+zyUVujXBc2w1drPUIfez2YrYHDeeMZ4EtVaaIYe8dwXTvthMqkLpHIhpoHXBZyI/oXZ/0W95nSaUDKebkLht/KyK228njYv/rwG2O0SBKsn/FGxBvNwz1S+BWw2FMWIwQjqFDrgf12ZHoUke1oD51I+d597aZazCGpcGKrcKoONygPF+Dk7gN9stzu+x3dLOQDKxFxX356mWzPlCEkbrdxf6EQ7odm0MNMuQ23SF2Fvwju720wfNza+enabN/jTU/Q2zNfqjyNb+ZrK/QygzsYQd65Omlwf1flvnshNYRTQoPu1A72kWS0jH9v9SUNDoMoZ6fGBaAOF2hIME89vSuvdco+EqKc0FyIkl4zZQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5392.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(6916009)(54906003)(8676002)(64756008)(66446008)(66476007)(66556008)(66946007)(4326008)(76116006)(91956017)(30864003)(5660300002)(6512007)(6486002)(508600001)(8936002)(186003)(26005)(31686004)(2616005)(83380400001)(107886003)(316002)(38100700002)(2906002)(38070700005)(36756003)(6506007)(53546011)(71200400001)(31696002)(86362001)(122000001)(45980500001)(43740500002)(559001)(579004); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?cG5LSzJCbTNWd1c0NzFrOTFXZXYrbTlrUmszZDhTbFZHYVlVKzNQcy9hL0Iy?= =?utf-8?B?RS9weWpVT3lUQUdGWTFsMjA4amQzc1V5cWlUNC8zeXdMblpGVElHQmpVY1J1?= =?utf-8?B?bCtieG9uV3Rrbnc3UHFqWDcwM3ZHWm5PMmVFOXB4WGt0TUZKY3U1Z09IeGNR?= =?utf-8?B?cUNUakVaSnVpaFk3THhYOEJiUzNPcmY4WDU5enRIMloxdHVrSlRpaVlsV2J1?= =?utf-8?B?ckFvN01HTkpGN0xtU25jTnk2dGEzbmlvM3FkZGZCYkR5Slp4ZVovd2ZUeFFk?= =?utf-8?B?Z2FYMjBCcDZPTlg2dU5hZXVBcDA5ckFvMG9nRGt4L3Axd09DZFZ1RmV3VGJl?= =?utf-8?B?TWF4TjJQVjJvWFlNWFkvV09aTGNnd3IzZzZZL3I3ekxtcWZ5RGFGZkVMNXVT?= =?utf-8?B?ZjBGOS9iZW5EZHZHaGlJUm1wK3BaZmhVb3lpQkl2S0UzL3VrRC9pd0Y3Qlg5?= =?utf-8?B?Q1V3d2h1MzRPc1Y2NGcvQ2xwWFFZSzc1dUJmMjEwQXFUWFQ0K20xUUQvTWt1?= =?utf-8?B?L1JOMVcyN3BHaGV1R2R5YXUzT1Irc1E2SytsWTBTL1Z6cGhwK0VmanhCdm92?= =?utf-8?B?U0dya1VYengzeVM4K0h2b3hrcGpDVVBJN0Ezc05XNjgyaS8rbnBkOFNKcC93?= =?utf-8?B?Z2JsekpZT05aeHFZUUk1T1pRUXhJVmhuYlphUExzSmdEVDEyREtDSkhJVFNI?= =?utf-8?B?ZUNLQTVNN1FxTVF3RGJEbHVpRW9yeHVZUXFXRzI1c1RkaklUVHN0TzBLRG9D?= =?utf-8?B?SnhiRmVBVHFHUlppeUJ3UVkzK0UzR1pqQmN4MWhJaTUvc1VTNXZSa2RLdHh4?= =?utf-8?B?MTh4Mk1iUVc5SGdIR1NXRHdiV09PZXByeTJoZ3BmU0thMHRQZEJ2WjhwbG9S?= =?utf-8?B?Z2FOejBxd0NpNytDQ01Bbk5YOGx4dXB4eE1TZXVxcS9mYVhYVjUwbG9ob2JK?= =?utf-8?B?R1NHdzV4aGdHTCtwY01SVFJPSENBMmhJNC9HZVFmV05XTlZBL2FENFNFV0Z4?= =?utf-8?B?SFFUZjdJNzh2VFhtYllVZUtnbWdlalZjYTNvYkJvQVVqdDJXcGdhUTNYdlU3?= =?utf-8?B?TVFWUGV0OWJxR0k0R2xxWkxDa1ZMa2dPUm1jRDRTT1ZuZ0NCNG8vUnp3UGEw?= =?utf-8?B?NGk0UEJwRXJlbGdKbzdzZndkMENReXVqdWh4R0RNS0wwQVEwNnNlek1SaWwy?= =?utf-8?B?QXBVVTlNQ1JzZEc1d1lTT2QvZkpRN0Z6VE5RMktTSTJVOGprdUJaNHVxNUM3?= =?utf-8?B?TFY1NGk2Zm5CRFhEUTdtbE1vbVltMzNTT2h3UVdYdC9iOFJzMVNKdXBUZWxD?= =?utf-8?B?elJWd29UVTZJK3F5RHY0ZDkvS0FVdEVWRU1tQjh3UTc4Zyt0YzZHRGxvU2E2?= =?utf-8?B?YXZiU3RsSUdWZFd1YW1zbnArbGZRQTgwODZtZzVmbFRpTE0vYkxKYjBYN0My?= =?utf-8?B?RHVoWXlIWGtFQ1RRRW1INVpmNkNId3RLb1JENUlibGVFNmZWc1Z2dVJJcUNL?= =?utf-8?B?b2V2dlhETmg1ZHBaTWhmbFVWQVM0SHFGVWJTSm1XVjE2a3d3NVFCN1F1R241?= =?utf-8?B?RGlzZnV1YU41YUVrQUlTKzBydEdoeHR3N3BBVTRZbzRRaUFNdVBMeGEyMzd0?= =?utf-8?B?T2lRZUJjTXZDaVNNSGx3ZnJpZW5VZUNYUmt0dldBalphd29FQ05qNUtvQ1R5?= =?utf-8?B?a090d3hrVHhvZmpTVFQxei9vVS9Yd29xTGhYK1Z3NXdYMjh1RGdOZXZJbGVU?= =?utf-8?B?SS9ic2dvdkd2a3pYNzJUK3YxL0VMdzBxM2pVZW02cG94NVZFaEtkVkdxNXFG?= =?utf-8?B?eUR0UW9hT1Mvbi92SktOWVV0Q0dWYWpoelFXNUQrblNOL09YVjRVR3Y4RmV1?= =?utf-8?B?S2tPZUxxdDZreVBLNzE5OXFaRlJzQnJSNGcrYm9DVi9uR21uR0F0UUlJOFZD?= =?utf-8?B?TXVLS0tDdFNYSlFDekF3VDNKcUhhaG9aQWx3b0tPTit4Mkg5TUdGWDZwSnla?= =?utf-8?B?bllYOWVwUDNwR2NqaDBEaGdxT09UMDc0alc0ZVZjSm90QS92d3VVbG9WMDN0?= =?utf-8?B?MjVMOUZxVjQyQmlycjJKN3dXMVEvNEx4YUJEandtVFdoVXByL2FlRVBMSC94?= =?utf-8?B?Sy95S1hWWkI5UzN0cVVvYmd6ajJHcFNXckphU21oRHFhREEzQW40b3pMcUhU?= =?utf-8?B?M2E0a3lHT3ZXTVoxOGVjRGxDMGVBbDlLbXZiZGFUUTlYTVQ4bUJ6ZnRHZGdx?= =?utf-8?B?c1h5SWcrK3JJcDVYS2ZsT1o3S2pRPT0=?= Content-ID: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5392.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cd70d50-8675-4284-1e32-08da01e7296a X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2022 16:09:16.9458 (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: Z1QCW60xnvA5lATuMCi1tQ53Tu0tSV1lc/5nbAk1dw35KR7Cau+zbOEFl/wx6cqhxKu6n5f4wy9OPesqBpE2MeuPSCbnV7QXOfCG4uRoDvA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2758 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_080934_360782_F5D23E2D X-CRM114-Status: GOOD ( 20.29 ) 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, hverkuil-cisco@xs4all.nl, Claudiu.Beznea@microchip.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 3/9/22 5:57 PM, Jacopo Mondi wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > Hi Eugen > > On Wed, Mar 09, 2022 at 03:39:26PM +0000, Eugen.Hristev@microchip.com wrote: >> On 3/9/22 5:22 PM, Jacopo Mondi wrote: >>> Hi Eugen, >>> sorry one more comment >>> >>> On Mon, Mar 07, 2022 at 02:04:14PM +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 its 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 v7: >>>> - use maximum isc frame size as bounds always >>>> >>>> Changes in v6: >>>> - reworked a bit as suggested by Jacopo >>>> - add try crops >>>> >>>> Changes in v5: >>>> - reworked s_fmt to pass the same format from sink to source >>>> - simplified enum_mbus_code >>>> - separated tgt and bounds to report correctly in g_sel >>>> >>>> Changes in v4: >>>> As suggested by Jacopo: >>>> - renamed atmel_isc_mc to atmel_isc_scaler.c >>>> - moved init_mc/clean_mc to isc_base file >>>> >>>> Changes in v2: >>>> - implement try formats >>>> >>>> >>>> drivers/media/platform/atmel/Makefile | 2 +- >>>> drivers/media/platform/atmel/atmel-isc-base.c | 75 ++++- >>>> .../media/platform/atmel/atmel-isc-scaler.c | 271 ++++++++++++++++++ >>>> drivers/media/platform/atmel/atmel-isc.h | 37 +++ >>>> .../media/platform/atmel/atmel-sama5d2-isc.c | 14 +- >>>> .../media/platform/atmel/atmel-sama7g5-isc.c | 12 +- >>>> 6 files changed, 403 insertions(+), 8 deletions(-) >>>> create mode 100644 drivers/media/platform/atmel/atmel-isc-scaler.c >>>> >>>> diff --git a/drivers/media/platform/atmel/Makefile b/drivers/media/platform/atmel/Makefile >>>> index 794e8f739287..f02d03df89d6 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-scaler.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 67b4a2323fed..448bf281c61a 100644 >>>> --- a/drivers/media/platform/atmel/atmel-isc-base.c >>>> +++ b/drivers/media/platform/atmel/atmel-isc-base.c >>>> @@ -1712,6 +1712,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"); >>>> @@ -1720,6 +1721,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; >>>> } >>>> >>>> @@ -1734,8 +1745,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; >>>> @@ -1751,6 +1762,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) >>>> { >>>> @@ -1767,7 +1779,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); >>>> @@ -1893,7 +1905,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); >>>> @@ -1903,8 +1916,19 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) >>>> goto isc_async_complete_err; >>>> } >>>> >>>> + ret = isc_scaler_link(isc); >>>> + if (ret < 0) >>>> + goto isc_async_complete_unregister_device; >>>> + >>>> + ret = media_device_register(&isc->mdev); >>>> + 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; >>>> @@ -1971,6 +1995,49 @@ int isc_pipeline_init(struct isc_device *isc) >>>> } >>>> EXPORT_SYMBOL_GPL(isc_pipeline_init); >>>> >>>> +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; >>>> + >>>> + 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_scaler_init(isc); >>>> +} >>>> +EXPORT_SYMBOL_GPL(isc_mc_init); >>>> + >>>> +void isc_mc_cleanup(struct isc_device *isc) >>>> +{ >>>> + media_entity_cleanup(&isc->video_dev.entity); >>>> + media_device_cleanup(&isc->mdev); >>>> +} >>>> +EXPORT_SYMBOL_GPL(isc_mc_cleanup); >>>> + >>>> /* regmap configuration */ >>>> #define ATMEL_ISC_REG_MAX 0xd5c >>>> const struct regmap_config isc_regmap_config = { >>>> diff --git a/drivers/media/platform/atmel/atmel-isc-scaler.c b/drivers/media/platform/atmel/atmel-isc-scaler.c >>>> new file mode 100644 >>>> index 000000000000..d3dd131fdae0 >>>> --- /dev/null >>>> +++ b/drivers/media/platform/atmel/atmel-isc-scaler.c >>>> @@ -0,0 +1,271 @@ >>>> +// SPDX-License-Identifier: GPL-2.0-only >>>> +/* >>>> + * Microchip Image Sensor Controller (ISC) Scaler entity support >>>> + * >>>> + * Copyright (C) 2022 Microchip Technology, Inc. >>>> + * >>>> + * Author: Eugen Hristev >>>> + * >>>> + */ >>>> + >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> + >>>> +#include "atmel-isc-regs.h" >>>> +#include "atmel-isc.h" >>>> + >>>> +static void isc_scaler_prepare_fmt(struct v4l2_mbus_framefmt *framefmt) >>>> +{ >>>> + framefmt->colorspace = V4L2_COLORSPACE_SRGB; >>>> + framefmt->field = V4L2_FIELD_NONE; >>>> + framefmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; >>>> + framefmt->quantization = V4L2_QUANTIZATION_DEFAULT; >>>> + framefmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; >>>> +}; >>>> + >>>> +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[format->pad]; >>>> + >>>> + 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; >>>> + >>>> + /* Source format is fixed, we cannot change it */ >>>> + if (req_fmt->pad == ISC_SCALER_PAD_SOURCE) { >>>> + req_fmt->format = isc->scaler_format[ISC_SCALER_PAD_SOURCE]; >>>> + return 0; >>>> + } >>>> + >>>> + /* There is no limit on the frame size on the sink pad */ >>>> + v4l_bound_align_image(&req_fmt->format.width, 16, UINT_MAX, 0, >>>> + &req_fmt->format.height, 16, UINT_MAX, 0, 0); >>>> + >>>> + isc_scaler_prepare_fmt(&req_fmt->format); >>>> + >>>> + 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 sink pad makes the source pad change too */ >>>> + 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[ISC_SCALER_PAD_SINK] = req_fmt->format; >>>> + >>>> + /* The source pad is the same as the sink, but we have to crop it */ >>>> + isc->scaler_format[ISC_SCALER_PAD_SOURCE] = >>>> + isc->scaler_format[ISC_SCALER_PAD_SINK]; >>>> + v4l_bound_align_image >>>> + (&isc->scaler_format[ISC_SCALER_PAD_SOURCE].width, 16, >>>> + isc->max_width, 0, >>>> + &isc->scaler_format[ISC_SCALER_PAD_SOURCE].height, 16, >>>> + isc->max_height, 0, 0); >>>> + >>>> + 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); >>>> + >>>> + /* >>>> + * All formats supported by the ISC are supported by the scaler. >>>> + * Advertise the formats which the ISC can take as input, as the scaler >>>> + * entity cropping is part of the PFE module (parallel front end) >>>> + */ >>>> + if (code->index < isc->formats_list_size) { >>>> + code->code = isc->formats_list[code->index].mbus_code; >>>> + return 0; >>>> + } >>>> + >>>> + 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) { >>>> + /* bounds are the maximum rectangle which ISC can take */ >>>> + sel->r.height = isc->max_height; >>>> + sel->r.width = isc->max_width; >>>> + sel->r.left = 0; >>>> + sel->r.top = 0; >>> >>> Sorry in my previous reply I suggested to fix _BOUND to the max size, but >>> what happens if the image format on the sink pad is smaller than max >>> size ? As _BOUNDS should contains all valid crop rectangles and you >>> don't have a set_selection which might change the CROP rectangle , I >>> think for your case BOUND==CROP, otherwise you could end up with a >>> BOUND rectangle larger than the input frame. >>> >>> I would do something along the lines of: >>> >>> switch (sel->target) { >>> case V4L2_SEL_TGT_CROP_BOUNDS: >>> /* Fall-through */ >>> case V4L2_SEL_TGT_CROP: >>> /* >>> * crop is done to the output format, >>> * limited by ISC maximum size >>> */ >>> sel->r.height = isc->scaler_format[ISC_SCALER_PAD_SOURCE].height; >>> sel->r.width = isc->scaler_format[ISC_SCALER_PAD_SOURCE].width; >>> sel->r.left = 0; >>> sel->r.top = 0; >>> >>> return 0; >>> default: >>> return -EINVAL; >>> >> >> Hi Jacopo, >> >> Actually this is now much similar with what I initially had , in v4 of >> the patch : >> >> ===== >> >> +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; >> +} >> ===== > > More or less, as in this case you had both rectangles set to max_size. > But you're right you had BOUND == CROP. Sorry about this. > >> >> In there I was setting height and width to maximum isc frame size, but I >> will change it to source pad format size. >> Do you like it like this ? >> >> ===== >> >> if (sel->target != V4L2_SEL_TGT_CROP_BOUNDS && >> sel->target != V4L2_SEL_TGT_CROP) >> return -EINVAL; >> >> sel->r.height = isc->scaler_format[ISC_SCALER_PAD_SOURCE].height; >> sel->r.width = isc->scaler_format[ISC_SCALER_PAD_SOURCE].width; >> >> sel->r.left = 0; >> sel->r.top = 0; >> ===== > > Thanks this match my understanding. > Please add my tag to v8 and sorry again for the back&forth. No problem. I am preparing v8 Thanks ! > > Cheers > j >> >> Eugen >> >>> >>> I'm sorry if this will require you a new version, I missed that in v6. >>> Please let me know if you agree with my proposal. >>> >>> Feel free to add the tag in v8 >>> Reviewed-by: Jacopo Mondi >>> >>> Thanks >>> j >>> >>>> + } else if (sel->target == V4L2_SEL_TGT_CROP) { >>>> + /* >>>> + * crop is done to the output format, >>>> + * limited by ISC maximum size >>>> + */ >>>> + sel->r.height = isc->scaler_format[ISC_SCALER_PAD_SOURCE].height; >>>> + sel->r.width = isc->scaler_format[ISC_SCALER_PAD_SOURCE].width; >>>> + sel->r.left = 0; >>>> + sel->r.top = 0; >>>> + } else { >>>> + return -EINVAL; >>>> + } >>>> + >>>> + 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 v4l2_rect *try_crop; >>>> + struct isc_device *isc = container_of(sd, struct isc_device, scaler_sd); >>>> + >>>> + *v4l2_try_fmt = isc->scaler_format[ISC_SCALER_PAD_SOURCE]; >>>> + >>>> + try_crop = v4l2_subdev_get_try_crop(sd, sd_state, 0); >>>> + >>>> + try_crop->top = 0; >>>> + try_crop->left = 0; >>>> + try_crop->width = v4l2_try_fmt->width; >>>> + try_crop->height = v4l2_try_fmt->height; >>>> + >>>> + 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, >>>> +}; >>>> + >>>> +int isc_scaler_init(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_prepare_fmt(&isc->scaler_format[ISC_SCALER_PAD_SOURCE]); >>>> + isc->scaler_format[ISC_SCALER_PAD_SOURCE].height = isc->max_height; >>>> + isc->scaler_format[ISC_SCALER_PAD_SOURCE].width = isc->max_width; >>>> + isc->scaler_format[ISC_SCALER_PAD_SOURCE].code = >>>> + isc->formats_list[0].mbus_code; >>>> + >>>> + isc->scaler_format[ISC_SCALER_PAD_SINK] = >>>> + isc->scaler_format[ISC_SCALER_PAD_SOURCE]; >>>> + >>>> + 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; >>>> +} >>>> +EXPORT_SYMBOL_GPL(isc_scaler_init); >>>> + >>>> +int isc_scaler_link(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) { >>>> + dev_err(isc->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) { >>>> + dev_err(isc->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 ret; >>>> +} >>>> +EXPORT_SYMBOL_GPL(isc_scaler_link); >>>> + >>>> diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h >>>> index f9ad7ec6bd13..9cc69c3ae26d 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[ISC_SCALER_PADS_NUM]; >>>> + }; >>>> }; >>>> >>>> extern const struct regmap_config isc_regmap_config; >>>> @@ -357,4 +387,11 @@ 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_scaler_link(struct isc_device *isc); >>>> +int isc_scaler_init(struct isc_device *isc); >>>> +int isc_mc_init(struct isc_device *isc, u32 ver); >>>> +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 c5b9563e36cb..c244682ea22f 100644 >>>> --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c >>>> +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c >>>> @@ -553,6 +553,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); >>>> @@ -562,7 +568,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 */ >>>> @@ -572,7 +578,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; >>>> @@ -580,6 +585,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); >>>> >>>> @@ -600,6 +608,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 07a80b08bc54..9dc75eed0098 100644 >>>> --- a/drivers/media/platform/atmel/atmel-sama7g5-isc.c >>>> +++ b/drivers/media/platform/atmel/atmel-sama7g5-isc.c >>>> @@ -547,15 +547,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); >>>> >>>> @@ -576,6 +584,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