Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13934915pxu; Mon, 4 Jan 2021 08:20:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJycpVDcV7aNV7bzINsx0NV+5ZdFTNxHG/0vXmMkmLiYT6N12jh99YzXl5iKm6865l0UTTz+ X-Received: by 2002:a50:fc83:: with SMTP id f3mr72583904edq.219.1609777250918; Mon, 04 Jan 2021 08:20:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609777250; cv=none; d=google.com; s=arc-20160816; b=WRqc6f0cNbohQKi1Sj/phDFsFTNUkuKjazk8EW4iLKubLgTW0AbJhv2Rz56ztIp/5e b2pRy84t37NCYLywB0awO90XNWq0mBU5zvKekSp8cAbe8fzNl7EeT6AQVnFD5GbO7epV lQsoVcX+JJeNyLQv6Z3ifUvwLnJtCMjLFLDuZ5/nUeemNQIBVzjN3zM6AZdTwRLEOs7y dPE7VPo7oZrj0ZctqUywnjCyF/n0ijrFfhMDSnKj89do0dwqmsQnmtaO0cHyp8oflzut Bhkna8CdeWj+yV5lK4uCYSDDLudo1aX8NJkqamE1+Ij8DdYfSkYNY7SxoqGSvbYvGlBD ODUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :autocrypt:from:references:cc:to:subject:reply-to:dkim-signature; bh=57VUTtOAoZYdT4uy5iIn4tCOhR/APHfVsYV6DA3bxQM=; b=ICIEkBP+0spkY7+lDcJURV0uF/pYgYNnG8uj5ht0BFa8Bfr3hC6YTp9BrgaWJHJN4T 3a3uTuwJCrprqVxKElj1duzpvGOTyYVXkp0LLdczsF4K8qzoxUdcIKeKohR0S+/X1AIB N2nwSYXPNdkjkrqg7IAgE0QUSJ/r6h2fOidO2d/828rHV/EjtmNbaio4AiH6E7+9mmcz gRfzrIoC8iJMtgLGWRw2VT6I66exxr3RSWIvCKKHqO8C3VwxhwJFPRVzpX6GztxDx53g M01MausbG/ZuDvGae+ORDUeavOSBiSagvaVe6Vtnrwto/7N4w7uzwUr3qfaD3RlMwlvZ 3pig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=CezDxqU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd1si31295608edb.168.2021.01.04.08.20.26; Mon, 04 Jan 2021 08:20:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=CezDxqU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730004AbhADQOX (ORCPT + 99 others); Mon, 4 Jan 2021 11:14:23 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:57864 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbhADQOV (ORCPT ); Mon, 4 Jan 2021 11:14:21 -0500 Received: from [192.168.0.20] (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2C0A32E0; Mon, 4 Jan 2021 17:13:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1609776817; bh=tBO6/vy63OMHcgEJzQHG0zb8EpUFO8rmJl7CgaObhFs=; h=Reply-To:Subject:To:Cc:References:From:Date:In-Reply-To:From; b=CezDxqU1xjoKhg3UnPmUebPyFnZcWUVfF081DSthSQGNXZHa1zlfytFjkqChOgBn/ 01TjyPEdgDyP7FhNvMKbTSNh2xqbxAsheVM5B2WZu3yd8NhTLrAVf5XXlp7effFFrS 2RZgEDgsjn+W+Ly0PJjTSNiW5/zpHwHccTfgO/HA= Reply-To: kieran.bingham@ideasonboard.com Subject: Re: [PATCH v4 15/15] ipu3-cio2: Add cio2-bridge to ipu3-cio2 driver To: Daniel Scally , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-media@vger.kernel.org, devel@acpica.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net, sergey.senozhatsky@gmail.com, mchehab@kernel.org Cc: lenb@kernel.org, yong.zhi@intel.com, sakari.ailus@linux.intel.com, bingbu.cao@intel.com, tian.shu.qiu@intel.com, robert.moore@intel.com, erik.kaneda@intel.com, pmladek@suse.com, rostedt@goodmis.org, andriy.shevchenko@linux.intel.com, linux@rasmusvillemoes.dk, laurent.pinchart+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, hverkuil-cisco@xs4all.nl, m.felsch@pengutronix.de, niklas.soderlund+renesas@ragnatech.se, slongerbeam@gmail.com, heikki.krogerus@linux.intel.com, linus.walleij@linaro.org, Jordan Hand , Laurent Pinchart , Andy Shevchenko References: <20210103231235.792999-1-djrscally@gmail.com> <20210103231235.792999-16-djrscally@gmail.com> <3d881e2b-747f-dcd7-a0cf-e7309419914b@ideasonboard.com> <9026519f-1f33-9df0-de18-0881069f7aaa@gmail.com> <249b8ad1-5616-596d-4ee6-efcfdda2ca64@ideasonboard.com> From: Kieran Bingham Autocrypt: addr=kieran.bingham@ideasonboard.com; keydata= mQINBFYE/WYBEACs1PwjMD9rgCu1hlIiUA1AXR4rv2v+BCLUq//vrX5S5bjzxKAryRf0uHat V/zwz6hiDrZuHUACDB7X8OaQcwhLaVlq6byfoBr25+hbZG7G3+5EUl9cQ7dQEdvNj6V6y/SC rRanWfelwQThCHckbobWiQJfK9n7rYNcPMq9B8e9F020LFH7Kj6YmO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iAAoJEKEeRnIQpGH9eYgQAJpjaWNgqNOnMTmD MJggbwjIotypzIXfhHNCeTkG7+qCDlSaBPclcPGYrTwCt0YWPU2TgGgJrVhYT20ierN8LUvj 6qOPTd+Uk7NFzL65qkh80ZKNBFddx1AabQpSVQKbdcLb8OFs85kuSvFdgqZwgxA1vl4TFhNz PZ79NAmXLackAx3sOVFhk4WQaKRshCB7cSl+RIng5S/ThOBlwNlcKG7j7W2MC06BlTbdEkUp ECzuuRBv8wX4OQl+hbWbB/VKIx5HKlLu1eypen/5lNVzSqMMIYkkZcjV2SWQyUGxSwq0O/sx S0A8/atCHUXOboUsn54qdxrVDaK+6jIAuo8JiRWctP16KjzUM7MO0/+4zllM8EY57rXrj48j sbEYX0YQnzaj+jO6kJtoZsIaYR7rMMq9aUAjyiaEZpmP1qF/2sYenDx0Fg2BSlLvLvXM0vU8 pQk3kgDu7kb/7PRYrZvBsr21EIQoIjXbZxDz/o7z95frkP71EaICttZ6k9q5oxxA5WC6sTXc MW8zs8avFNuA9VpXt0YupJd2ijtZy2mpZNG02fFVXhIn4G807G7+9mhuC4XG5rKlBBUXTvPU AfYnB4JBDLmLzBFavQfvonSfbitgXwCG3vS+9HEwAjU30Bar1PEOmIbiAoMzuKeRm2LVpmq4 WZw01QYHU/GUV/zHJSFk Organization: Ideas on Board Message-ID: Date: Mon, 4 Jan 2021 16:13:32 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dan, On 04/01/2021 15:31, Daniel Scally wrote: > Hi Kieran > > On 04/01/2021 15:13, Kieran Bingham wrote: >> Hi Dan, >> >> On 04/01/2021 13:55, Daniel Scally wrote: >>> Hi Kieran >>> >>> On 04/01/2021 13:35, Kieran Bingham wrote: >>>>> +/* >>>>> + * Extend this array with ACPI Hardware IDs of devices known to be working >>>>> + * plus the number of link-frequencies expected by their drivers, along with >>>>> + * the frequency values in hertz. This is somewhat opportunistic way of adding >>>>> + * support for this for now in the hopes of a better source for the information >>>>> + * (possibly some encoded value in the SSDB buffer that we're unaware of) >>>>> + * becoming apparent in the future. >>>>> + * >>>>> + * Do not add an entry for a sensor that is not actually supported. >>>>> + */ >>>>> +static const struct cio2_sensor_config cio2_supported_sensors[] = { >>>>> + CIO2_SENSOR_CONFIG("INT33BE", 0), >>>>> + CIO2_SENSOR_CONFIG("OVTI2680", 0), >>>> I don't know if these are expressed anywhere else but would it be >>>> helpful to add a comment, or indicator as to what the actual sensor is >>>> that is represented by this HID? >>>> >>>> I can make an assumption about what an OVTI2680 might be, but the >>>> INT33BE is quite opaque. It's not clear what support that adds. >>>> >>>> Unless no one cares what the sensor is that is, but I would anticipate >>>> anyone looking here to add a new sensor might want to investigate what >>>> was already in the table? >>> Yeah good point. I'll probably alternate comment and entry then, like: >>> >>> >>> +static const struct cio2_sensor_config cio2_supported_sensors[] = { >>> + /* Sensor OVTI5693 */ >>> + CIO2_SENSOR_CONFIG("INT33BE", 0), >>> + /* Sensor OVTI2680 */ >>> + CIO2_SENSOR_CONFIG("OVTI2680", 0), >>> >>> As an inline comment won't fit for the sensors that we know link-frequencies for. That sound ok? >> I might put the whole vendor name in, and no need to prefix 'Sensor' IMO. >> >> + /* Omnivision OV5693 */ >> + CIO2_SENSOR_CONFIG("INT33BE", 0), >> + /* Omnivision OV2680 */ >> + CIO2_SENSOR_CONFIG("OVTI2680", 0), >> >> but otherwise, yes a comment the line before works for me, as you are >> right - at the end would not be practical. > Works for me >>>>> +static void cio2_bridge_create_fwnode_properties( >>>>> + struct cio2_sensor *sensor, >>>>> + const struct cio2_sensor_config *cfg) >>>>> +{ >>>>> + unsigned int i; >>>>> + >>>>> + sensor->prop_names = prop_names; >>>>> + >>>>> + for (i = 0; i < CIO2_MAX_LANES; i++) >>>>> + sensor->data_lanes[i] = i + 1; >>>> Does something support lane swapping somewhere? >>>> I assume this is just mapping each lane directly through. >>> I think Sakari said remapping isn't supported in the CIO2 - so yeah this >>> is just mapping them directly >> So is this needed? Or is it some future compatibility thing? >> >> I haven't seen where it's used yet, but I'm not too worried about it >> though, just not sure what value an array of [1, 2, 3, 4] gives if it's >> constant... > > The endpoints need to have the data-lanes property which passes an array > of data lanes, but there may well be a better way of doing this. I'm > just using the lanes member of the ssdb data structure to tell the > property how many members of the array to look at: > > > +    sensor->cio2_properties[0] = PROPERTY_ENTRY_U32_ARRAY_LEN( > +                    sensor->prop_names.data_lanes, > +                    sensor->data_lanes, > +                    sensor->ssdb.lanes); > > > So if sensor->ssdb.lanes is 2, even though it's passed a pointer to the > first member of an array of 4 members, the size calculation of that > macro limits it to just those in use. I.E. if sensor->ssdb.lanes is 2 > then the property will be given the size 2 * sizeof(u32), and so when > its parsed only [1, 2] will be read. Aha, I see, ok - so we are populating an array of [1, 2, 3, 4] for each sensor that we add. What about creating the data_lanes once as a const static array and mapping to that? /* * Map the lane arrangement, which is fixed for the IPU3. */ static const int data_lanes[CIO2_MAX_LANES] = { 1, 2, 3, 4 }; ... sensor->cio2_properties[0] = PROPERTY_ENTRY_U32_ARRAY_LEN( sensor->prop_names.data_lanes, data_lanes, sensor->ssdb.lanes); ... Then we don't need the loop to populate the array for each sensor anymore, or the data_lanes in the sensor struct? -- Regards -- Kieran