Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2244682rdf; Mon, 6 Nov 2023 08:31:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLO80Ikb+L+90XNUk90lX23ZFpcCc9jFDgYe11GB2+GPwH/ptNsAFR2ApqdV/mlpBSuair X-Received: by 2002:a05:6870:ef87:b0:1d6:2476:be2e with SMTP id qr7-20020a056870ef8700b001d62476be2emr206377oab.35.1699288306359; Mon, 06 Nov 2023 08:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699288306; cv=none; d=google.com; s=arc-20160816; b=yHSS90c5+EMa6K9amDpNjr7sBN8s16B1OTq9bB7y0XYeDiIjSro4orK6rpPXsLit0h nrYobXLOEO63wxlIz1rK5fh6Q5vf28SAn1EG/jli1iQVL+HTrIyeaQuRIt216JCzPSGR yEfq2PaNWNKnFegA8Qlrg6gWK0T3F31DCiO2YLth8YxSN80fdml7GoasvN1FYswMed8K zznTW5Xi0xWPW4zY2+Le0TzyE5e4P0bcLy+CeMcucGhrQEG/nRym+oPd40Kn4mtip/gc N5qR19+D1mvRzBEpZke9OKgktQ7xvv6SJiXtdeCsmhfCXk4siBeBxgZRyVu/sWilDqBK cNpA== 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=hnfLgIcdds4g74L9UkMLpSkf7PIOLzK8mp8yejZbI24=; fh=WaqwKbNI6ggyvaUQ85iAclRCevgklJhqArlb3px6pNU=; b=dPbOEXUcrd87z+NqjpH2qx9uGv48LpmsjT4B/vIRoviZ3xfLdRmMDLu1B4q/Ild/07 +KeD8g5L/6QGxCWLXNp83Bs61GBjWQvuP3w6yMSKnw5KWY8nrP9I1WVIodLuY2vajM79 I1j76J0vq5gjkf0taT0b2PipWjV9l8Anzr8O4NKQ88Bl1IU2hJe7qrOcGV33K8hUuC/n P+e/cHrHKRK7zSqpPXwfpSBYYH9N8k/IHaWa1MFLpcuOttMHHEEb7xSY5fzPsjwPzZVc 1XJhtu2YMMr+HynsuZSkDU4UZcJL77HcHdjABfTkPN+718G3dSC6lVnHeHPbGLdtTiPJ fMUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bo11-20020a056a02038b00b005aa0e024d63si7945pgb.791.2023.11.06.08.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 08:31:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id CF8938025817; Mon, 6 Nov 2023 08:31:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232694AbjKFQbk (ORCPT + 99 others); Mon, 6 Nov 2023 11:31:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231767AbjKFQbi (ORCPT ); Mon, 6 Nov 2023 11:31:38 -0500 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37E54D45; Mon, 6 Nov 2023 08:31:35 -0800 (PST) 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 3fc6a541e7f5ba27; Mon, 6 Nov 2023 17:31:33 +0100 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 3C248667790; Mon, 6 Nov 2023 17:31:33 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Sakari Ailus Cc: LKML Subject: [PATCH v3 6/7] ACPI: property: Dig "rotation" property for devices with CSI2 _CRS Date: Mon, 06 Nov 2023 17:28:40 +0100 Message-ID: <1892619.CQOukoFCf9@kreacher> In-Reply-To: <4542595.LvFx2qVVIh@kreacher> References: <4542595.LvFx2qVVIh@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: gggruggvucftvghtrhhoucdtuddrgedvkedruddugedgkeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepfedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsrghkrghrihdrrghilhhusheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 08:31:45 -0800 (PST) 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 --- v2 -> v3: * Change the name of the new file to mipi-disco-img.c --- drivers/acpi/mipi-disco-img.c | 17 +++++++++++++++++ include/acpi/acpi_bus.h | 1 + 2 files changed, 18 insertions(+) Index: linux-pm/drivers/acpi/mipi-disco-img.c =================================================================== --- linux-pm.orig/drivers/acpi/mipi-disco-img.c +++ linux-pm/drivers/acpi/mipi-disco-img.c @@ -592,6 +592,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; @@ -611,6 +612,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 @@ -380,6 +380,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 };