Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2793015lqp; Mon, 25 Mar 2024 09:19:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlBs81+jqT7I1v2dS3DjBvpUnT+L92/gIuec5HUNv8zIkW2zlruoPx0jgVRRs1RMQGdq23zz/m+hXwinXs0o+L0Gka51J2ebk3uxCeSg== X-Google-Smtp-Source: AGHT+IHgDPtaaksV+0ycQGIu956GIQfjFwzThWiasWQ1mg4pMRF8HaS9OkooCxxuhtbPmgqCNIPi X-Received: by 2002:a05:6902:389:b0:dc7:4854:1b1e with SMTP id f9-20020a056902038900b00dc748541b1emr5788831ybs.54.1711383576021; Mon, 25 Mar 2024 09:19:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711383576; cv=pass; d=google.com; s=arc-20160816; b=P3HSX//j6LSpI2P2tpltJV9/PeQSI8VNFCvLOcon1KBHGdS6xrr/ZijKGirleUrOOj FE7YB5LuB0ZtF9rFghOvz8y6xWmLraCSZeVI6bvt4GvekevueUF8Kujszh9WiaUR4qCF Z5GCh7Oj+4mjqg55jDc5XVPqX/Yj5Ke0jJMXInUlClMi99C+4VGjFJEnT3BRekdQP4uo umFcJy9beA6guWSNyRuR2E5fo/Jiyl/qD5PSehNUvY5cHuu5YxI49zKRS/bvhiaMhBZ3 fNg1utbqTCYLh/CC4uAuTdxiNs+Bs0tnF/ZpgObicYd+4O68GGln7ld9Sb8EP7IXq65b E7kQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=8KxDzW61R1iN4U6U9jceWOvTd+iU1q8suPPvkJkWkeI=; fh=ggt4NDDC1IIy5anG0PzvNkYOxrn5PKKly64kWR95Kew=; b=SiOweJAgeM7hkt4yOCpy2oxP89EVOyOHtj8pkIcU2ohicCvrzuyd/l1qhKwUb2b/pn DhPLfhPNaWinnSKJpiIySW/GXJg0KAsbIxnrgGSscemQxU4APBFjuaaa3HNmh9M0chiR Qj+xJ5TuHA+N7Bq+xQdQYxM09S7jwUPHEXukSuAQID/Vc2edMmfJszJbx2yWuKtDPI8j S/uZSiKLK7BKkWbVojhg3ERXYxMFnP/Zc4AnQo37fJkOPWTw/oNhVm+KnniXvInc1H1U DWCSCAF0vY6yJHGJH1k4P9JZZKFWmM2oPt4Dx9YycKav2gI5OWqKGjClp9YVgNBxbdo3 hGGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="X2KzY/lK"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-117197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id yf21-20020a05620a3bd500b00789f0c6a927si5620761qkn.632.2024.03.25.09.19.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="X2KzY/lK"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-117197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A72431C6245D for ; Mon, 25 Mar 2024 16:12:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 528A614388D; Mon, 25 Mar 2024 14:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="X2KzY/lK" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0618A5C89; Mon, 25 Mar 2024 14:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711375338; cv=none; b=lMUjdnZBPA3xhLfgsITWuuDq4CUI1+YJ6SBnG8u4lh+oARXLYIvvNtajIMURFPtC9n1erDanoE0ewIPhBczEz6LKyT7Ylw218gBlEYRmGMFBv8xNW7kNVFvuTKdhi1LblAdOZOWF1YzbMyupFhYUdD9ZL+OGr/XJ9+qlUq0dXms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711375338; c=relaxed/simple; bh=eQs9r6QvBAImQCbz5fYZNfYhpIYk7o66WMO+5pFvG5A=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=mDOYT+3DUtz8SW4ERYEHGsmk2Z8ncJ4MUlIZuy8ra3iJpolLWSGjxHEngLOuMn7gxc3YKIvYsu3/11kRAZiBDCk6JS/QikEt+Z4jX0DP+op6B7XzlDWudCwG8lZLvbhZRf11AG6tjC1S0k+L70Vvb0MtTQuG74AiMsm5iOdo214= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=X2KzY/lK; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711375337; x=1742911337; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=eQs9r6QvBAImQCbz5fYZNfYhpIYk7o66WMO+5pFvG5A=; b=X2KzY/lKizxfrJgBC5a7NoiLadt0YFdywPInnn7xk/s7ajDMuIWkmaeI SJMd647YlW6simFOZrUZWugmXmMgAg/A3pNhKlrBljxDG3cccyjGmTvFf 2+wRVS29lryy0LN2OdhRVIi9n9cYfdEzYLqfHkgevwqPLGaE2GEauUq6o dzLBifEDOFZkO7N7I7r6lwI1ckUP+WM+EQKDcGqd2m0cWCbxPKjvDiqQn qkW5FllqWGRg9XUIM6Inwl9UNk5xgzBK1o+glbQcOXoT1eViGuTBRvYjk YuNuYwv4/x5BKTviuNCPK+NoYNo0Ldyyph+2HAwE775ubNCGZFK+E8dRz w==; X-IronPort-AV: E=McAfee;i="6600,9927,11023"; a="17808961" X-IronPort-AV: E=Sophos;i="6.07,153,1708416000"; d="scan'208";a="17808961" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2024 07:02:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,153,1708416000"; d="scan'208";a="15708691" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.19]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2024 07:02:11 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Mon, 25 Mar 2024 16:02:04 +0200 (EET) To: "Luke D. Jones" cc: Hans de Goede , corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org, LKML Subject: Re: [PATCH 4/9] platform/x86: asus-wmi: support toggling POST sound In-Reply-To: <20240325054938.489732-5-luke@ljones.dev> Message-ID: <88b7d5b0-23af-37e0-6122-fc790ae57053@linux.intel.com> References: <20240325054938.489732-1-luke@ljones.dev> <20240325054938.489732-5-luke@ljones.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Mon, 25 Mar 2024, Luke D. Jones wrote: > Add support for toggling the BIOS POST sound on some ASUS laptops. > > Signed-off-by: Luke D. Jones > --- > .../ABI/testing/sysfs-platform-asus-wmi | 9 ++++ > drivers/platform/x86/asus-wmi.c | 51 +++++++++++++++++++ > include/linux/platform_data/x86/asus-wmi.h | 3 ++ > 3 files changed, 63 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi > index 61a745d2476f..5645dbac4ce8 100644 > --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi > +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi > @@ -194,3 +194,12 @@ Contact: "Luke Jones" > Description: > Set the target temperature limit of the Nvidia dGPU: > * min=75, max=87 > + > +What: /sys/devices/platform//boot_sound > +Date: Jun 2023 > +KernelVersion: 6.10 > +Contact: "Luke Jones" > +Description: > + Set if the BIOS POST sound is played on boot. > + * 0 - False, > + * 1 - True > \ No newline at end of file > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c > index 094a93f24667..6cac9c3eb8b2 100644 > --- a/drivers/platform/x86/asus-wmi.c > +++ b/drivers/platform/x86/asus-wmi.c > @@ -2106,6 +2106,54 @@ static ssize_t panel_od_store(struct device *dev, > } > static DEVICE_ATTR_RW(panel_od); > > +/* Bootup sound ***************************************************************/ > + > +static ssize_t boot_sound_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct asus_wmi *asus = dev_get_drvdata(dev); > + int result; > + > + result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_BOOT_SOUND); > + if (result < 0) > + return result; > + > + return sysfs_emit(buf, "%d\n", result); > +} > + > +static ssize_t boot_sound_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + int result, err; > + u32 snd; > + > + struct asus_wmi *asus = dev_get_drvdata(dev); > + > + result = kstrtou32(buf, 10, &snd); > + if (result) > + return result; > + > + if (snd > 1) > + return -EINVAL; > + > + err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BOOT_SOUND, snd, &result); > + if (err) { > + pr_warn("Failed to set boot sound: %d\n", err); > + return err; > + } > + > + if (result > 1) { > + pr_warn("Failed to set panel boot sound (result): 0x%x\n", result); > + return -EIO; > + } > + > + sysfs_notify(&asus->platform_device->dev.kobj, NULL, "boot_sound"); > + > + return count; > +} > +static DEVICE_ATTR_RW(boot_sound); I started to think that perhaps these would be a way to create helper for these sysfs functions to call as they are quite similar, only the wmi id, strings and the range check change (the GPU functions do a few extra checks and could remain standalone functions but the rest look very similar to each other). -- i.