Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1076482rdb; Fri, 20 Oct 2023 07:52:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHmQ9e8P/+LVxMuz7DXovV68NuTlzmhnB0sJyJktOFFifveO6TUMlwWr9ocflHgNIrmAFR6 X-Received: by 2002:a05:6358:7247:b0:166:d11b:f94c with SMTP id i7-20020a056358724700b00166d11bf94cmr2835318rwa.15.1697813551656; Fri, 20 Oct 2023 07:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697813551; cv=none; d=google.com; s=arc-20160816; b=uisYmF2S49CoU+pV632o0KgVeblxQuiqC2mv9GabQv2XXHEVNGtZ+vRNE5OM5zb9Ei Psf4bRnmB13OyOq/hBzKipyQ//mZivwZe/yULK3VHAkO6+UrWLeknLO+STywR2+eOt4w BILXMtb7H0496CDfkun6Pt6LLK5P8WahcG+KZjik7CUCljm3DqtG/cJgaiPTtrOHQhhx +RoTcbm+jaXCubHk2OS15SIMPhNgbnG5OkS0cq28T+sKCHhUqpAQ6+TiJsEFk87b8v5F N99WQp/ahDi/qvmK0yMECvVhirzV9XPm4RhaIirLc4Bb2SuVOPHfK3yoKc8eD9CwmEOi bErQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2WpW1LdpuvFZTqu1S+pjA8Txh9C45/h/TeptJ6k7ncs=; fh=WaqwKbNI6ggyvaUQ85iAclRCevgklJhqArlb3px6pNU=; b=uPk77kYiEceu9HyNYIuE3HsA7uUedG7LueMs4+8IMvOmsuB3GZnQX7RjggKKNDBGte pnyrOhwtGXp+8o1PdKlZRStC+wTkreLEOkZuSWEodX0bpt1CZu+j5qzosNlGtyM3vgjn OzpPJWkfcG35H9uMF6xKUKlHVB3ceTlV4wDyOAGhrxPVK3JWw/V4jErgn1NotkH+F66i +XODa9yOdiYMrEStOfon8028aFYZGJn9cRRHo4MrJGJPIpAHlNHcytaqs4gIB3rJuPVJ A24ssDNdCSvqTl+c6E2F/DOTZzaVTpz4WNaTpgt1LFXELuv+hIZAt2sKNfkea4TqWEE0 +GYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id n5-20020a632705000000b00578b63123desi2157088pgn.789.2023.10.20.07.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 07:52:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 2598083A0C2F; Fri, 20 Oct 2023 07:50:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377595AbjJTOty (ORCPT + 99 others); Fri, 20 Oct 2023 10:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377239AbjJTOtx (ORCPT ); Fri, 20 Oct 2023 10:49:53 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5811FD46; Fri, 20 Oct 2023 07:49:50 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.2.0) id 07b7436e091f0dc3; Fri, 20 Oct 2023 16:49:48 +0200 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 1931B667008; Fri, 20 Oct 2023 16:49:48 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI , Sakari Ailus Cc: LKML Subject: [PATCH v2 6/6] ACPI: property: Dig "rotation" property for devices with CSI2 _CRS Date: Fri, 20 Oct 2023 16:40:08 +0200 Message-ID: <3552598.iIbC2pHGDl@kreacher> In-Reply-To: <2187487.irdbgypaU6@kreacher> References: <2187487.irdbgypaU6@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrjeekgdektdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeefpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 20 Oct 2023 07:50:09 -0700 (PDT) From: Sakari Ailus Find the "rotation" property value for devices with _CRS CSI-2 resource descriptors and use it to add the "rotation" property to the software nodes representing the CSI-2 connection graph. That value typically comes from the _PLD (Physical Location of Device) object if it is present for the given device. This way, camera sensor drivers that know the "rotation" property do not need to care about _PLD on systems using ACPI. Signed-off-by: Sakari Ailus [ rjw: Changelog edits, file rename ] Signed-off-by: Rafael J. Wysocki --- drivers/acpi/mipi-di.c | 17 +++++++++++++++++ include/acpi/acpi_bus.h | 1 + 2 files changed, 18 insertions(+) Index: linux-pm/drivers/acpi/mipi-di.c =================================================================== --- linux-pm.orig/drivers/acpi/mipi-di.c +++ linux-pm/drivers/acpi/mipi-di.c @@ -586,6 +586,7 @@ static void init_crs_csi2_swnodes(struct struct acpi_buffer buffer = { .length = ACPI_ALLOCATE_BUFFER }; struct acpi_device_software_nodes *swnodes = csi2->swnodes; acpi_handle handle = csi2->handle; + unsigned int prop_index = 0; struct fwnode_handle *adev_fwnode; struct acpi_device *adev; acpi_status status; @@ -605,6 +606,22 @@ static void init_crs_csi2_swnodes(struct adev_fwnode = acpi_fwnode_handle(adev); + /* + * If the "rotation" property is not present, but _PLD is there, + * evaluate it to get the "rotation" value. + */ + if (!fwnode_property_present(adev_fwnode, "rotation")) { + struct acpi_pld_info *pld; + + status = acpi_get_physical_device_location(handle, &pld); + if (ACPI_SUCCESS(status)) { + swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] = + PROPERTY_ENTRY_U32("rotation", + pld->rotation * 45U); + kfree(pld); + } + } + status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); if (ACPI_FAILURE(status)) { acpi_handle_info(handle, "Unable to get the path name\n"); Index: linux-pm/include/acpi/acpi_bus.h =================================================================== --- linux-pm.orig/include/acpi/acpi_bus.h +++ linux-pm/include/acpi/acpi_bus.h @@ -373,6 +373,7 @@ struct acpi_gpio_mapping; #define ACPI_DEVICE_SWNODE_PORT_NAME_LENGTH 8 enum acpi_device_swnode_dev_props { + ACPI_DEVICE_SWNODE_DEV_ROTATION, ACPI_DEVICE_SWNODE_DEV_NUM_OF, ACPI_DEVICE_SWNODE_DEV_NUM_ENTRIES };