From patchwork Wed May 24 11:48:22 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: 98456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2787310vqo; Wed, 24 May 2023 04:59:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ478/oSX2XtFmI0PwvgZrn65L+LCrcYoP+s9ROfsj3xFeKOsIOHafz2UO1AOul9bZw17wVH X-Received: by 2002:a17:90a:c082:b0:255:d427:5f02 with SMTP id o2-20020a17090ac08200b00255d4275f02mr2220559pjs.8.1684929564771; Wed, 24 May 2023 04:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684929564; cv=none; d=google.com; s=arc-20160816; b=VpcGcgfazeqEbpuRNar7VoqO+yxJLdw+j/5AiJhAg9nE5R94lyCyRM4P2R6JtColG5 s5uz4r/44/lMl5BEZ+pHe+EHbgPESZQVcPiYMSrA1lJIAyZNMCT+G4MrJwdZWbXdQZy5 0bY7THYRglFnf3oCirc84M3RTK6M8z6nLeDwWPCFoFyq9H9Ia2jqNlNSJr9zivT+h5oS eANp0WCdfM6r5l5LeVdpYndsVVZdqVCvlTUJK8FZb/elZfR6EZRw9s9amFvhCSvm5/m+ 4XKstNXsreuNuUkSoj12XXHNNz2Cs037DPT06gtefTSdSm8VWG9cC2vkJUXgMwZLQ/kM AAFQ== 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=LNFeJgSJatGv5Le45IwTKo+WCW8SMIUsdwJOy7QcImg=; b=BjSR2sdCP1H/A1L6tEyZi8jJC8gYzeJBLHJAPpltaDjqakMcb66RTUApBblrPIInMg qLRVrnDi6Mkw5pgXqrg0kx+lTKm4uV+Fkru684LSpZwQ+iuGACgBNqGlN6vK0yfU6iOb W2fYIJNf/DOcEFUo4Bk+fTj0dFuqPb/pENVdGwFxG9WOu2QToVjpE5KWBHZnrky16fmN OtcRpXrQy2hlA6uww49be6S6j9mBJ5sg18ZKtFtB+sUeS/JN4WFGnhCAfXwPMHvVRxOi NWXiJUnXZzxC4n7sPqTAGfZ1exiqYN6KWARjcjrFZ7ifRw8um1j1MLMbLBXO6FUYeE+Y JrQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bo24-20020a17090b091800b002476173727fsi1205201pjb.26.2023.05.24.04.59.10; Wed, 24 May 2023 04:59:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230214AbjEXLse (ORCPT + 99 others); Wed, 24 May 2023 07:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjEXLsd (ORCPT ); Wed, 24 May 2023 07:48:33 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC3D135; Wed, 24 May 2023 04:48:31 -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 d2ade69f61d9e4a3; Wed, 24 May 2023 13:48:30 +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 v370.home.net.pl (Postfix) with ESMTPSA id C4D4169D7E2; Wed, 24 May 2023 13:48:29 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI , Sakari Ailus Cc: LKML , Hans de Goede , Andy Shevchenko Subject: [PATCH v1 6/6] ACPI: property: Dig "rotation" property for devices with CSI2 _CRS Date: Wed, 24 May 2023 13:48:22 +0200 Message-ID: <1957117.usQuhbGJ8B@kreacher> In-Reply-To: <13276375.uLZWGnKmhe@kreacher> References: <13276375.uLZWGnKmhe@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: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejhedggeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepfeduudeutdeugfelffduieegiedtueefledvjeegffdttefhhffhtefhleejgfetnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeehpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshgrkhgrrhhirdgrihhluhhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohephhguvghgohgv uggvsehrvgguhhgrthdrtghomhdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766776703268449830?= X-GMAIL-MSGID: =?utf-8?q?1766776703268449830?= 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 ] Signed-off-by: Rafael J. Wysocki --- Code changes same as in https://patchwork.kernel.org/project/linux-acpi/patch/20230329100951.1522322-8-sakari.ailus@linux.intel.com changelog edited. --- drivers/acpi/mipi-disco-imaging.c | 17 +++++++++++++++++ include/acpi/acpi_bus.h | 1 + 2 files changed, 18 insertions(+) Index: linux-pm/drivers/acpi/mipi-disco-imaging.c =================================================================== --- linux-pm.orig/drivers/acpi/mipi-disco-imaging.c +++ linux-pm/drivers/acpi/mipi-disco-imaging.c @@ -529,6 +529,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; @@ -541,6 +542,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 @@ -369,6 +369,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 };