From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E81F3235BFB for ; Tue, 22 Apr 2025 08:44:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745311490; cv=none; b=tE5lXaWHlLdXRZhEcGxpyGkv80OCgAYcGtt28eGCrYhhwTD0VV8r93VqCjAEgj3zhzgWQk/pnvkPZxDnAUeKe2YZ+W9SMgX/KR/KcRq1LB/iMSCCATOApgDqjtnlTTgdfViXVR3IsvKBhl9L+5nJaJDwLZChBecxp7UsWlV0l74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745311490; c=relaxed/simple; bh=P47QWwCm1v9g4MBFhGt7X6yWDzEz0lF1K9o6O8AqT60=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JyB53m2JJthyGBUBAYPe57kL4qDXq6YugMTIy0ocSZLHuLS9l8gi4qlmzgej5QZxEE9d5G236jwy4H+yvOQBd4RQbCJCuSgUj19N3uVDaMdjacvdthovMKnEYtXdJO1Bi6GcOfHcUZ9a5S+K6tYzT5KjBtjdKOcrGkn4ls5Z6ug= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ELsMVzXp; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ELsMVzXp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745311485; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0+RdOtqSYZgJN9V7ZhicuRS1n/wY7Pa3OON81X9wpN0=; b=ELsMVzXpqJq/sVnyNZPhV+3Go8WJSaOOLnnesGjZ9RSO33Rxg56WZiz+sqIHL7U3Gj7gK8 R96dE2PNgpbXPS9cvv59LbqmFd0si0bivJR29mIvZ1JmwWzOohkEXt+NdsmnYTi7ceF+Lr okvSNw+PMxJ2oe6TJ6kd9I3bzb85FwA= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-Aansjbt0Nv-vsQhYqxCHkQ-1; Tue, 22 Apr 2025 04:44:44 -0400 X-MC-Unique: Aansjbt0Nv-vsQhYqxCHkQ-1 X-Mimecast-MFC-AGG-ID: Aansjbt0Nv-vsQhYqxCHkQ_1745311483 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-acbbb00099eso82668466b.2 for ; Tue, 22 Apr 2025 01:44:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745311483; x=1745916283; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0+RdOtqSYZgJN9V7ZhicuRS1n/wY7Pa3OON81X9wpN0=; b=wdfoYwoPEFfldWV8nIm7eng8v4wtpalY36Obqh+CN66L9+YxcTlc7PqcNKROo8MUl2 cIX4ll5zF61cm3pj4sa7dEpxuFowgPcYOXD8ScpUy3sW+nWo6YxNnjVqIi3cxfczX8+P w1tBs10gtnNH71OuY4InwJTrtrip0+TcvDNT7EtW5iapX6BVDP7uNE8G1CAQD+noJH8P Zpt1cGjq/OdFHJg2qFiF/khz/sWMx/XMwI3hley38UsCBHyiMwN0akGo1QKouySyiRf3 J6+yjrlgfMxnadwQWJ03/xlqojejzmyfDRjCvl8qWrkUM7mChlfjMNNk0dTWO3iWR3H+ zWQA== X-Forwarded-Encrypted: i=1; AJvYcCXtQPapgnWFas7vqP3PVpBKRfyXoYR5jSHv17c9ydwp3Kb3w6ahtn8V9D5eTqUNKYzAbluHVFcBk3og@vger.kernel.org X-Gm-Message-State: AOJu0YwYbOJv/UN9Q71E49d8RYWAzkWMOzo71+Ip0zyr49xBNUAwgvd7 wl4p/PWhlezafWT58sIQC78+ucEa0a2iYOPlyvT+bTM+9MQPWCkdKIEu7HbfvcYHywUr32Gi+08 tYd2GeSrZAGuMbqF/bTl8np+NAZmd5CpgBqWYQg8cpLg5P9ibxeJ/ER8Kt/U= X-Gm-Gg: ASbGncvPoA/beJxBBpNoFDt721tGnkSq/pxgCgUoOTQaALNNEPMhclIGXbyZNIA7w5Q kxaYbcGiYBg+dbgrSuJHP+3ajlhwtp+e2qx+zPbJ9LKc4U518Zey/SAwz4S5Rkh3DIeNWlVIcn6 sfkWvtY+fm1dGcx5B/XEKIFMvuWmVlg3117sQy6xDQ5CwsXUQy7OaWJkQBSoA9ZttGhJkoC3yJO /WRhHh2A2vnmuDWmgKi2HnL4njiLPpUrL2y+GUURi3VSKpnDnvn3ErhwRJHeaDgzV/eUJnxmvqD 74IItRScIahFAffwjzEEsPV9SnXhKGkw1ban2czsXdzv3J74OiwK2HcLhtXnnkmVyYAUkdG/hzM /dhIYEuMAsgeshB0IlTnOqZqwoscBqYQ10z2GUxgjat7uffCzXrZQcaCqTIk2hw== X-Received: by 2002:a17:906:5048:b0:acb:8aa6:5455 with SMTP id a640c23a62f3a-acb8aa666bbmr673102166b.19.1745311482861; Tue, 22 Apr 2025 01:44:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpgdWV71E14QWV9s59BE4ul4PG5ma83tK012XEEsIaRAbQGVP1sxKldI3T51XJVDSQc/mtRQ== X-Received: by 2002:a17:906:5048:b0:acb:8aa6:5455 with SMTP id a640c23a62f3a-acb8aa666bbmr673100066b.19.1745311482404; Tue, 22 Apr 2025 01:44:42 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-acb6ec5160csm635268866b.63.2025.04.22.01.44.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Apr 2025 01:44:41 -0700 (PDT) Message-ID: Date: Tue, 22 Apr 2025 10:44:41 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/8] media: v4l: fwnode: Support acpi devices for v4l2_fwnode_device_parse To: Ricardo Ribalda , Sakari Ailus Cc: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , Bartosz Golaszewski , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org References: <20250403-uvc-orientation-v1-0-1a0cc595a62d@chromium.org> <20250403-uvc-orientation-v1-3-1a0cc595a62d@chromium.org> Content-Language: en-US, nl From: Hans de Goede In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Ricardo, On 22-Apr-25 2:23 AM, Ricardo Ribalda wrote: > Hi Sakari > > On Sun, 13 Apr 2025 at 17:50, Sakari Ailus wrote: >> >> Hi Ricardo, >> >> Thanks for the patch. >> >> On Thu, Apr 03, 2025 at 07:16:14PM +0000, Ricardo Ribalda wrote: >>> This patch modifies v4l2_fwnode_device_parse() to support ACPI devices. >>> >>> We initially add support only for orientation via the ACPI _PLD method. >>> >>> Signed-off-by: Ricardo Ribalda >>> --- >>> drivers/media/v4l2-core/v4l2-fwnode.c | 58 +++++++++++++++++++++++++++++++---- >>> 1 file changed, 52 insertions(+), 6 deletions(-) >>> >>> diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c >>> index cb153ce42c45d69600a3ec4e59a5584d7e791a2a..81563c36b6436bb61e1c96f2a5ede3fa9d64dab3 100644 >>> --- a/drivers/media/v4l2-core/v4l2-fwnode.c >>> +++ b/drivers/media/v4l2-core/v4l2-fwnode.c >>> @@ -15,6 +15,7 @@ >>> * Author: Guennadi Liakhovetski >>> */ >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -807,16 +808,47 @@ int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode, >>> } >>> EXPORT_SYMBOL_GPL(v4l2_fwnode_connector_add_link); >>> >>> -int v4l2_fwnode_device_parse(struct device *dev, >>> - struct v4l2_fwnode_device_properties *props) >>> +static int v4l2_fwnode_device_parse_acpi(struct device *dev, >>> + struct v4l2_fwnode_device_properties *props) >>> +{ >>> + struct acpi_pld_info *pld; >>> + int ret = 0; >>> + >>> + if (!acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld)) { >>> + dev_dbg(dev, "acpi _PLD call failed\n"); >>> + return 0; >>> + } >> >> You could have software nodes in an ACPI system as well as DT-aligned >> properties. They're not the primary means to convey this information still. >> >> How about returning e.g. -ENODATA here if _PLD doesn't exist for the device >> and then proceeding to parse properties as in DT? > > Do you mean that there can be devices with ACPI handles that can also > have DT properties? Yes it is possible to embed DT properties in ACPI, but I don't think that is really applicable here. But we also have secondary software-fwnodes which are used extensively on x86 to set device-properties on devices by platform code to deal with ACPI tables sometimes having incomplete information. For example atm _PLD is already being parsed in: drivers/media/pci/intel/ipu-bridge.c and that is then used to add a standard "orientation" device-property on the sensor device. This is actually something which I guess we can drop once your patches are in, since those should then do the same in a more generic manner. > What shall we do if _PLD contradicts the DT property? What takes precedence? As for priorities, at east for rotation it seems that we are going to need some quirks, I already have a few Dell laptops where it seems that the sensor is upside down and parsing the rotation field in the IPU6 specific SSDB ACPI package does not yield a 180° rotation, so we are going to need some quirks. I expect these quirks to live in the bridge code, while your helper will be called from sensor drivers, so in order to allow quirks to override things, I think that first the "orientation" device-property should be checked (which the ACPI glue code we have can set before the sensor driver binds) and only then should _PLD be checked. IOW _PLD should be seen as the fallback, because ACPI tables are often a copy and paste job so it can very well contain wrong info copy-pasted from some example ACPI code or from another hw model. Regards, Hans