Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp646905pxb; Tue, 1 Feb 2022 07:37:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMERHzqhLuW5xctfp1az72RKmrdEh7uhWNU8CmYrzp5Ggf9eV/04CnYboj32r5vxCAgNHJ X-Received: by 2002:a17:902:ea06:: with SMTP id s6mr25619309plg.161.1643729836760; Tue, 01 Feb 2022 07:37:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643729836; cv=none; d=google.com; s=arc-20160816; b=ldEKTtdBZynusHX+GMLUZnypSm5crixNk2VPJCF1bFSgmoRFGI4Y0BtsJHz0oLPuJz 1ux2eXZB9BBsF4BQFdtLoFeiFdHA2ZCXWGvhqNgRCqtKTCROs1sVxciOjI/Vjlr0tZGG f3oUkIajQK9sJsGLrpHSpYc6B9fIyXUAP7S1U0eGtvH/x6FRnHl8yx7iG0ah7Xs2w0CM ABFSdeKnq2liWe3ARUghsYcsb6gzpQDBRIUqENGU4c+JjXBNY9tk27uOmZXbTimB3+C5 tdeaqBXETGtNj1xpfHEFzSoxaBBluA3bi5rPtWe2RIV+zkzBNN2hGB36cHCFq8VSLxrN UHoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YR0uNHoRHMyqwBv1NHhlYQKT/xnm9lJIzc6gngctVTA=; b=RxPqDNo6P75Mzk4T0iJnHARxsuSX1iXdpMSeLREwBoTrmFR11W2EhfFgPs+moKndeJ AfQK68FxkFWyRfS7NgeKaRf85/76PganpvkxWRfhV2e35ecprV0+n2m0DvNGcbGfG1c+ 7R1NryN4TMtX90EEzkCPATCQPfPOXNh4b7t/QEDXZP8s8swVL7+ct9xbzoiRGmdoxTpK NurImz17xQr56raqJuZiaX01mXsuNpb9sjnlD+XNofOQTGwKFbeeq3QnWH8QkgES8rqN FxGdblueg+s0neoFx2NRmL4gs6SETAYKODg+W+G15mP9P7eLFA48DytQAM/ABD/kfRZH 3ONg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hWZIwvDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h184si3984692pge.254.2022.02.01.07.37.05; Tue, 01 Feb 2022 07:37:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hWZIwvDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348130AbiAaHdm (ORCPT + 99 others); Mon, 31 Jan 2022 02:33:42 -0500 Received: from mga01.intel.com ([192.55.52.88]:14643 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347972AbiAaHdd (ORCPT ); Mon, 31 Jan 2022 02:33:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643614413; x=1675150413; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=rWUUeMylw7j7eadB8PUS30HUTqec98BR59N33yGXgSM=; b=hWZIwvDkVgjy/4FHaDWlj1ybIZoikOuTf+vhib0kviuBw67QrwULNZoD SFn3c2FTAIgkjbZhxk1ZHdX6p5zNQGUwaV3FLEMRp4CF/buogOxHzUQ7W nAuK8vDUYVpOneBE0xImosUv3kIgJInDNT1n/H8W5LudztYg1k8SpSIor C2TzuqmIqWeD5G0TyE1yrE6OSYSMDHOxgL+BX3vqSdf4ysNHAiIoaknuO lYl1Du080CBzQyIhA5r8Xuh8fjvH36VkJ9O2aUB+3WEQGOijSI8ETMmNp XNjOs4AB1h/wjEKReuawntqu1CSEw2I2O6ezD572EPiY4k5djX27zbPjY w==; X-IronPort-AV: E=McAfee;i="6200,9189,10243"; a="271881420" X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="271881420" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2022 23:33:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,330,1635231600"; d="scan'208";a="675654496" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 30 Jan 2022 23:33:26 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 31 Jan 2022 09:33:25 +0200 Date: Mon, 31 Jan 2022 09:33:25 +0200 From: Heikki Krogerus To: Won Chung Cc: "Rafael J . Wysocki" , Len Brown , Benson Leung , Prashant Malani , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] ACPI: device_sysfs: Add sysfs support for _PLD Message-ID: References: <20220128180832.2329149-1-wonchung@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220128180832.2329149-1-wonchung@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 06:08:32PM +0000, Won Chung wrote: > When ACPI table includes _PLD fields for a device, create a new file > (pld) in sysfs to share _PLD fields. > > Signed-off-by: Won Chung > --- > Documentation/ABI/testing/sysfs-bus-acpi | 53 ++++++++++++++++++++++++ > drivers/acpi/device_sysfs.c | 42 +++++++++++++++++++ > 2 files changed, 95 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-bus-acpi b/Documentation/ABI/testing/sysfs-bus-acpi > index 58abacf59b2a..3a9c6a4f4603 100644 > --- a/Documentation/ABI/testing/sysfs-bus-acpi > +++ b/Documentation/ABI/testing/sysfs-bus-acpi > @@ -96,3 +96,56 @@ Description: > hardware, if the _HRV control method is present. It is mostly > useful for non-PCI devices because lspci can list the hardware > version for PCI devices. > + > +What: /sys/bus/acpi/devices/.../pld > +Date: Jan, 2022 > +Contact: Won Chung > +Description: > + This attribute contains the output of the device object's > + _PLD control method, if present. This information provides > + details on physical location of a port. > + > + Description on each _PLD field from ACPI specification: > + > + =============== ============================================ > + GROUP_TOKEN Unique numerical value identifying a group. > + GROUP_POSITION Identifies this device connection point’s > + position in the group. > + USER_VISIBLE Set if the device connection point can be > + seen by the user without disassembly. > + DOCK Set if the device connection point resides > + in a docking station or port replicator. > + BAY Set if describing a device in a bay or if > + device connection point is a bay. > + LID Set if this device connection point resides > + on the lid of laptop system. > + PANEL Describes which panel surface of the system’s > + housing the device connection point resides on: > + 0 - Top > + 1 - Bottom > + 2 - Left > + 3 - Right > + 4 - Front > + 5 - Back > + 6 - Unknown (Vertical Position and Horizontal > + Position will be ignored) > + HORIZONTAL_ 0 - Left > + POSITION 1 - Center > + 2 - Right > + VERTICAL_ 0 - Upper > + POSITION 1 - Center > + 2 - Lower > + SHAPE Describes the shape of the device connection > + point. > + 0 - Round > + 1 - Oval > + 2 - Square > + 3 - Vertical Rectangle > + 4 - Horizontal Rectangle > + 5 - Vertical Trapezoid > + 6 - Horizontal Trapezoid > + 7 - Unknown - Shape rendered as a Rectangle > + with dotted lines > + 8 - Chamfered > + 15:9 - Reserved > + =============== =============================================== > diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c > index d5d6403ba07b..8d4df5fb1c45 100644 > --- a/drivers/acpi/device_sysfs.c > +++ b/drivers/acpi/device_sysfs.c > @@ -509,6 +509,40 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr, > } > static DEVICE_ATTR_RO(status); > > +static ssize_t pld_show(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + struct acpi_device *acpi_dev = to_acpi_device(dev); > + acpi_status status; > + struct acpi_pld_info *pld; > + > + status = acpi_get_physical_device_location(acpi_dev->handle, &pld); > + if (ACPI_FAILURE(status)) > + return -ENODEV; > + > + return sprintf(buf, "GROUP_TOKEN=%u\n" > + "GROUP_POSITION=%u\n" > + "USER_VISIBLE=%u\n" > + "DOCK=%u\n" > + "BAY=%u\n" > + "LID=%u\n" > + "PANEL=%u\n" > + "HORIZONTAL_POSITION=%u\n" > + "VERTICAL_POSITION=%u\n" > + "SHAPE=%u\n", > + pld->group_token, > + pld->group_position, > + pld->user_visible, > + pld->dock, > + pld->bay, > + pld->lid, > + pld->panel, > + pld->horizontal_position, > + pld->vertical_position, > + pld->shape); > +} > +static DEVICE_ATTR_RO(pld); Why not have a pld group (directory) and a separate attribute file for each field? thanks, -- heikki