Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5648464rwd; Wed, 24 May 2023 05:05:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LeWW5PxvNd5JVj8SHBcQrzG5IBTLh1ov5e9fRjUQvP7xe7HXXbVTnXZvlcjYSsFMb+1r1 X-Received: by 2002:a17:903:230f:b0:1a6:f93a:a136 with SMTP id d15-20020a170903230f00b001a6f93aa136mr25519171plh.22.1684929936584; Wed, 24 May 2023 05:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684929936; cv=none; d=google.com; s=arc-20160816; b=vc1s/GyP6C5eV44WxjK+Hy/s4HoRHayhiCvDYtzauAd7erloFyfJ9aKBqH5vgLLnvv PP7qADObndFT7ydbZ0VEkh2z5KPaLsaEPQ3P4NoQFrKaeg0IgFJIABNvp/432PJS4APM RIf9/MVtEyj4amEtolWClUG118hq6Pl7E7ZUR+sK85IC7ri6Xfio06NWwxwqNFnxuRC1 c8nadkubUe2kONFyNfqNHDPgcvCkKQqPbyG+NhZDUItY19C38RNEdE/5M/L98bZG87mc sqf0hLkWXcENCzmzwqT2o6vteSOQdCvfBVO3yfEqIol8ROyr6C+mf1Z2vQR/4fCNz4k9 ANRQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u14-20020a170902e80e00b001a67a19331dsi1039378plg.202.2023.05.24.05.05.21; Wed, 24 May 2023 05:05:36 -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 S231260AbjEXLse (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 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: 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 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 };