From patchwork Fri Oct 20 14:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 156165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1110512vqb; Fri, 20 Oct 2023 07:52:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFi7IZ8SPVhNHG2v6xGF2P65+FgEjVQS3zbiQQ0X9GiGfIoEpYAec703g3VFfNi+RyGBDZR X-Received: by 2002:a05:6a00:1248:b0:6bd:8c4a:ab9c with SMTP id u8-20020a056a00124800b006bd8c4aab9cmr2286621pfi.4.1697813551863; 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=JcsdC1IzksCBm+7vw0a2D6+JdTTcQFTv4JaxyAjFsH3oqgFnCuKY1wU5NNA7qnfJzj LVYutO1gdBn7N8hRlfaoi7pa7DurFBx4kMkHqNJuHWZ20xtO7KgqH+5M4GpCG6PLYUZ2 +8WKAXZC6gLc+AGAOnXR0igNiErzLjy26c0WFq6cvI5CzIXV/AaPGxpVdtMsKwNSGgRx qB4GHOBVBCUDXgVhlg0N+xz5+mD2fGr+tF3QBkggvN4+8Ph0JORCr3++hXZG1TzZdmQI GclxthMbqA6hpMnVVv6KUPu/27ABsSfvP919/nHulOUmexu824Wtfsi9uJCnhYqrMMp/ Woqg== 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 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id bq3-20020a056a02044300b005acb88d8c15si2404831pgb.386.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 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 2F4D483A0C23; Fri, 20 Oct 2023 07:50:12 -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 S1377597AbjJTOtz (ORCPT + 26 others); Fri, 20 Oct 2023 10:49:55 -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 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:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780286542831065426 X-GMAIL-MSGID: 1780286542831065426 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 };