From nobody Wed Nov 27 10:28:47 2024 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84DBA635; Fri, 11 Oct 2024 06:47:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629222; cv=none; b=iHiEyj4vuVdzdqM0uZ+fPxaZyGpPtZma5T1kKBN8GrUUIvCXlSbAZbd+MfNXx4VfeMU0CpcF/JpgCBSr1VyPHXpUDVvDVqVTf6qauHjfua8/2yL1SUrO+f/eQZ6SDUO612vlHSe4ozLJyl6BasIKMBGJ5Jlp45OqgDL2UFISikQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629222; c=relaxed/simple; bh=f1ATQ+HGDZDASku3rGWI/1l9cxxpRZlUVOM/UD7EeM8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qqYEkpjRaNWAhM3LnF8Yz+tI2Wk5gdToJIBpATcvTuNcu8xSnva53v6cOChyihvUp2AtzQmFj2CGwE+zQxX74JMDUEerTes/K1SCwyMMM0qGSSGTsC52k3OQIMC4Vz1l8gQfkXmefkaO1t5aybGt/tSEbQHzeinndXIsM7H3xYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NgDnpM+e; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NgDnpM+e" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7e9ad969a4fso1227030a12.3; Thu, 10 Oct 2024 23:47:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728629220; x=1729234020; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nblw7qQlg0f5FAarylbk2ETZ2eHsYd5MNbMkdH6DxiY=; b=NgDnpM+evIIrtmzMWGJX6tbcrP7VGqoekk/+AqJg7wTlr/hDdf6I855EIsfC6Nn5Wb onynmqWYm4hJMQN0QauKq63EU9sKJWI0OlYyIxCDChFraOWxnHNiGpSKFWDJFkaho79n V6FYyrcFikDyA/1ciOT+FmWd3D4x4kjJRJN2gVzDK2WxSjaemsh9spgiuLqxnQJKBJoE I5kURtPI9w7aT8MM+GFuw9AC4cIlV7mamVuAh5SjqsglOwtow8861RYgKlf+EMrQQ1et CV9XTb/18dsRbIB+ESk5XAtANhsftw0KfiFCGzPp5IWT/R246N8l1z8txCsyWcBLNgl4 e7dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728629220; x=1729234020; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nblw7qQlg0f5FAarylbk2ETZ2eHsYd5MNbMkdH6DxiY=; b=Om23Csu6rDBBH7k1LAAT5DkVY4Dt1PaOgTOkR6ZCfBUS1ZC9wExHibuZ5BWrf+xZZl 63SneMHGEUsGSD4bgsspT0oUsOxvSpV0o8vMJSgsCtQYtAMVpmCG0JEuSVS27XizpOGz K9GMZNVX4G4aR52vMdG+1h0kl7L7kgc9ZicjiNvZ5erDCsMNBJeHgfwMfUE7cD8b3c31 z2P2Vv6mxDggSexfss3/afyr79zIEcPeLUHh2YVoB3oQGLqhlFwu4PDrnyn5N6m/tK+r BAiFvPm+Gvk8oAm0GWTPdFI2FYQKVSwx07vPHab+9KRzeKL9qOg5lXfP/SeDC8qytxgt ji1g== X-Forwarded-Encrypted: i=1; AJvYcCU3fevQZjJ5BGuq13LIP/kk6bANLVd7quXO1UHB8T9xFrIZts/6s5TD5zgyhTK6/8jnP56vKNcYWxuHHZAw/oiBOJZHaA==@vger.kernel.org, AJvYcCVimfchH51k41jOpCp3m1fCc2FLx/jCwt87jBC45egJUz4Z6qHKKLBZ7lCvC5Z6nSKRa8mx1vvdQQYXafY=@vger.kernel.org X-Gm-Message-State: AOJu0YzhzoP6kpNQWV8y1bUVUFlp4Er4phFYGAxc48Rukf4VpajzyWe6 U5O3mDf7JfT9FSJ73jWoT5SmykbbJ4ogY/jm3Kjkgsae1OaW09H2 X-Google-Smtp-Source: AGHT+IE1r1B8fgcSyJS+893frGWLsPHDaLRm6eqbHWQQGL7nMtkcqfO8FuWod9zuT9o2FPy+FqZ69g== X-Received: by 2002:a05:6a21:2d8c:b0:1d6:e609:790a with SMTP id adf61e73a8af0-1d8bcf00c3emr2289206637.5.1728629219695; Thu, 10 Oct 2024 23:46:59 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e3b856cf7sm525396b3a.151.2024.10.10.23.46.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 23:46:58 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, W_Armin@gmx.de, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v4 1/4] alienware-wmi: fixed indentation and clean up Date: Fri, 11 Oct 2024 03:46:35 -0300 Message-ID: <20241011064634.306236-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011064336.305795-2-kuurtb@gmail.com> References: <20241011064336.305795-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 134 +++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x= 86/dell/alienware-wmi.c index f5ee62ce1..16a3fe9ac 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -116,68 +116,68 @@ static int __init dmi_matched(const struct dmi_system= _id *dmi) =20 static const struct dmi_system_id alienware_quirks[] __initconst =3D { { - .callback =3D dmi_matched, - .ident =3D "Alienware X51 R3", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"), - }, - .driver_data =3D &quirk_x51_r3, - }, + .callback =3D dmi_matched, + .ident =3D "Alienware X51 R3", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"), + }, + .driver_data =3D &quirk_x51_r3, + }, { - .callback =3D dmi_matched, - .ident =3D "Alienware X51 R2", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"), - }, - .driver_data =3D &quirk_x51_r1_r2, - }, + .callback =3D dmi_matched, + .ident =3D "Alienware X51 R2", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"), + }, + .driver_data =3D &quirk_x51_r1_r2, + }, { - .callback =3D dmi_matched, - .ident =3D "Alienware X51 R1", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"), - }, - .driver_data =3D &quirk_x51_r1_r2, - }, + .callback =3D dmi_matched, + .ident =3D "Alienware X51 R1", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"), + }, + .driver_data =3D &quirk_x51_r1_r2, + }, { - .callback =3D dmi_matched, - .ident =3D "Alienware ASM100", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"), - }, - .driver_data =3D &quirk_asm100, - }, + .callback =3D dmi_matched, + .ident =3D "Alienware ASM100", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"), + }, + .driver_data =3D &quirk_asm100, + }, { - .callback =3D dmi_matched, - .ident =3D "Alienware ASM200", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "ASM200"), - }, - .driver_data =3D &quirk_asm200, - }, + .callback =3D dmi_matched, + .ident =3D "Alienware ASM200", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASM200"), + }, + .driver_data =3D &quirk_asm200, + }, { - .callback =3D dmi_matched, - .ident =3D "Alienware ASM201", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "ASM201"), - }, - .driver_data =3D &quirk_asm201, - }, - { - .callback =3D dmi_matched, - .ident =3D "Dell Inc. Inspiron 5675", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5675"), - }, - .driver_data =3D &quirk_inspiron5675, - }, + .callback =3D dmi_matched, + .ident =3D "Alienware ASM201", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASM201"), + }, + .driver_data =3D &quirk_asm201, + }, + { + .callback =3D dmi_matched, + .ident =3D "Dell Inc. Inspiron 5675", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5675"), + }, + .driver_data =3D &quirk_inspiron5675, + }, {} }; =20 @@ -221,8 +221,8 @@ static struct platform_zone *zone_data; =20 static struct platform_driver platform_driver =3D { .driver =3D { - .name =3D "alienware-wmi", - } + .name =3D "alienware-wmi", + } }; =20 static struct attribute_group zone_attribute_group =3D { @@ -292,7 +292,7 @@ static int alienware_update_led(struct platform_zone *z= one) guid =3D WMAX_CONTROL_GUID; method_id =3D WMAX_METHOD_ZONE_CONTROL; =20 - input.length =3D (acpi_size) sizeof(wmax_basic_args); + input.length =3D sizeof(wmax_basic_args); input.pointer =3D &wmax_basic_args; } else { legacy_args.colors =3D zone->colors; @@ -306,7 +306,7 @@ static int alienware_update_led(struct platform_zone *z= one) guid =3D LEGACY_CONTROL_GUID; method_id =3D zone->location + 1; =20 - input.length =3D (acpi_size) sizeof(legacy_args); + input.length =3D sizeof(legacy_args); input.pointer =3D &legacy_args; } pr_debug("alienware-wmi: guid %s method %d\n", guid, method_id); @@ -358,7 +358,7 @@ static int wmax_brightness(int brightness) .led_mask =3D 0xFF, .percentage =3D brightness, }; - input.length =3D (acpi_size) sizeof(args); + input.length =3D sizeof(args); input.pointer =3D &args; status =3D wmi_evaluate_method(WMAX_CONTROL_GUID, 0, WMAX_METHOD_BRIGHTNESS, &input, NULL); @@ -508,7 +508,7 @@ static acpi_status alienware_wmax_command(struct wmax_b= asic_args *in_args, struct acpi_buffer input; struct acpi_buffer output; =20 - input.length =3D (acpi_size) sizeof(*in_args); + input.length =3D sizeof(*in_args); input.pointer =3D in_args; if (out_data) { output.length =3D ACPI_ALLOCATE_BUFFER; @@ -542,7 +542,7 @@ static ssize_t show_hdmi_cable(struct device *dev, }; status =3D alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_CABLE, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -563,7 +563,7 @@ static ssize_t show_hdmi_source(struct device *dev, }; status =3D alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_STATUS, - (u32 *) &out_data); + &out_data); =20 if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 1) @@ -643,7 +643,7 @@ static ssize_t show_amplifier_status(struct device *dev, }; status =3D alienware_wmax_command(&in_args, WMAX_METHOD_AMPLIFIER_CABLE, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -695,7 +695,7 @@ static ssize_t show_deepsleep_status(struct device *dev, .arg =3D 0, }; status =3D alienware_wmax_command(&in_args, WMAX_METHOD_DEEP_SLEEP_STATUS, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 0) return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); --=20 2.47.0 From nobody Wed Nov 27 10:28:47 2024 Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60990635; Fri, 11 Oct 2024 06:47:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629250; cv=none; b=eQYyMpLhE8pd1/FokW2lpT39NRgh42Q4JTbCClZ/cg7dBDKkJQmE3uh3cSU7pEKwitQRcKzA+3snyYa9pxZCatVz2w+vTzK982VIwCfGLE7w21k5tPCT3ebU2ASasH2BHT72TaoUGzIpvzv8mNNQFztkrUhRL3592cWZVErB7jo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629250; c=relaxed/simple; bh=0GZoGZhJO9JhbDKRLHpdltUb4yxs6o3eeKOIN9Qp9V8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ItpcovKeyNDvbwEp2ohQkTOO+J1Ye2sTmBbVxwOnrPfPOjwkjvQcdVUJnbaUyLLgxL5diy25J7Q1A7h+x4lMTIV1LUgSq8AiZtthlhjlXNyCKm6zMTSFATSKBCZ2IaTWISHGp8dFmQDm4+2COAv+vjyzJCBcIZjQGHqUosrMZUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X7/7Cua7; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X7/7Cua7" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2e2a97c2681so1394667a91.2; Thu, 10 Oct 2024 23:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728629249; x=1729234049; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q1xLA2ZdOD5akuMksJfTrwXkXi5lDx/hKNx9gA7Toxw=; b=X7/7Cua7CNgQd5zcCCOEhvkSWTtxwNZQioxXe4agqSJOeToW+uFrLxfpgj8oZNlWF5 X427iksKJsD2nmDUZg9WLdN/Pt5N6oiUBtLcb/lTriP2hDHdRFWg//ZGGbLOCIcGGygS W+g1Kpr8JFbEli1b29NUPDb22eEPjqaHi/4UkVOayTkkXGbrxc8vqYKGDdrJ/PTYa2ju x26Ws9QMU3rAbuCukb2MqpwKLXgzFUO5ZlcZtsReknzk4Pb5mQnfcQPeSf0pDztsFfWh rHD8icreEJUsMmsdul4tVMZJocz8C5KLvnZkXZAOAuQA00jzoIvsprzze9haj4D/F3D1 /09A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728629249; x=1729234049; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q1xLA2ZdOD5akuMksJfTrwXkXi5lDx/hKNx9gA7Toxw=; b=vszH33xprzmzuRT4V3PkhghLCdRjf+HTn3+pE0glRDbSWazElzmWA0IG31M39bstiw pDvTucdJy3k50/80fvVlLzh1XQ8tLy2w1uSqsiq1F3dXl17Sa0F6ZTkZMy4sBvBxiWo9 Awz8LD7Q+/p7Gsh5pqtxt3p6eV/hOI+SjOE8k95kil1L/rFebs0O8/jGqhAyn/zKN5xr 6GSoRf2VNZVgyu0tISosXSAy/Km82PM+ZgLDyUKLtIV+HhqMetpMnHe8IufWwzkqJrYO 35Ae6CxrB7VkMCtWEciQKmyKVaWxO0p7uTNX1IpF8viFdrZmuHF//lk9SuvYlnK4Pb1v 6vgg== X-Forwarded-Encrypted: i=1; AJvYcCV+KJrAsVjn61vD2adm1Bg+qI2cOpljs+ddpL+TnxTrzkSCc7banhk9LkuqmkalfOQ25oqDOO7tYrN9r0Y=@vger.kernel.org, AJvYcCWN8/Y0qx/qR7c6TIx2gwXjoE/z8gehsDegVNkX/K1ehE257/DmQ5oSD366IgAHwiHSbMegP/19SjDzks336Hwm/8vDTQ==@vger.kernel.org X-Gm-Message-State: AOJu0YzHAfEVH/Mdt+Co8KKkNzfIUoTqpokn3jdHKApJDUlFYJmvfsGs qdJT61TZ8xbPsE1XdIC7XhPIj0BJfN5HiC48O8fC9B7OUQi/TZ1R X-Google-Smtp-Source: AGHT+IGrXWkRQduWbJleB3oXVLkgVLVtXn/df1aMkVMMc1T7gacUba8m7Sh85k8jyc5FiFHgs86/vg== X-Received: by 2002:a17:90b:1056:b0:2e0:db81:4f79 with SMTP id 98e67ed59e1d1-2e2f0a2fb2cmr1983969a91.2.1728629248723; Thu, 10 Oct 2024 23:47:28 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2d5f0a476sm2503903a91.30.2024.10.10.23.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 23:47:28 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, W_Armin@gmx.de, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v4 2/4] alienware-wmi: alienware_wmax_command() is now input size agnostic Date: Fri, 11 Oct 2024 03:47:13 -0300 Message-ID: <20241011064712.306484-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011064336.305795-2-kuurtb@gmail.com> References: <20241011064336.305795-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x= 86/dell/alienware-wmi.c index 16a3fe9ac..8f7a8bfef 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -500,15 +500,15 @@ static void alienware_zone_exit(struct platform_devic= e *dev) kfree(zone_attrs); } =20 -static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args, - u32 command, int *out_data) +static acpi_status alienware_wmax_command(void *in_args, size_t insize, + u32 command, u32 *out_data) { acpi_status status; union acpi_object *obj; struct acpi_buffer input; struct acpi_buffer output; =20 - input.length =3D sizeof(*in_args); + input.length =3D insize; input.pointer =3D in_args; if (out_data) { output.length =3D ACPI_ALLOCATE_BUFFER; @@ -541,8 +541,8 @@ static ssize_t show_hdmi_cable(struct device *dev, .arg =3D 0, }; status =3D - alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_CABLE, - &out_data); + alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_HDMI_CABLE, &out_data); if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -562,8 +562,8 @@ static ssize_t show_hdmi_source(struct device *dev, .arg =3D 0, }; status =3D - alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_STATUS, - &out_data); + alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_HDMI_STATUS, &out_data); =20 if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 1) @@ -589,7 +589,8 @@ static ssize_t toggle_hdmi_source(struct device *dev, args.arg =3D 3; pr_debug("alienware-wmi: setting hdmi to %d : %s", args.arg, buf); =20 - status =3D alienware_wmax_command(&args, WMAX_METHOD_HDMI_SOURCE, NULL); + status =3D alienware_wmax_command(&args, sizeof(args), + WMAX_METHOD_HDMI_SOURCE, NULL); =20 if (ACPI_FAILURE(status)) pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", @@ -642,8 +643,8 @@ static ssize_t show_amplifier_status(struct device *dev, .arg =3D 0, }; status =3D - alienware_wmax_command(&in_args, WMAX_METHOD_AMPLIFIER_CABLE, - &out_data); + alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_AMPLIFIER_CABLE, &out_data); if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -694,8 +695,8 @@ static ssize_t show_deepsleep_status(struct device *dev, struct wmax_basic_args in_args =3D { .arg =3D 0, }; - status =3D alienware_wmax_command(&in_args, WMAX_METHOD_DEEP_SLEEP_STATUS, - &out_data); + status =3D alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_DEEP_SLEEP_STATUS, &out_data); if (ACPI_SUCCESS(status)) { if (out_data =3D=3D 0) return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); @@ -723,8 +724,8 @@ static ssize_t toggle_deepsleep(struct device *dev, args.arg =3D 2; pr_debug("alienware-wmi: setting deep sleep to %d : %s", args.arg, buf); =20 - status =3D alienware_wmax_command(&args, WMAX_METHOD_DEEP_SLEEP_CONTROL, - NULL); + status =3D alienware_wmax_command(&args, sizeof(args), + WMAX_METHOD_DEEP_SLEEP_CONTROL, NULL); =20 if (ACPI_FAILURE(status)) pr_err("alienware-wmi: deep sleep control failed: results: %u\n", --=20 2.47.0 From nobody Wed Nov 27 10:28:47 2024 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65C64208997; Fri, 11 Oct 2024 06:48:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629287; cv=none; b=SJ4iRk3HfbUE0cvh6FnI7jWyWWbaKG5ny33SvvIEeaVK70p5Fym4+OkshP+OjmsBwglF8gFxCGOIeou5uf1bumltNOOQJyFHCzCx3iIeyDZsvgxhpAlzaw2uOMkChE5aBXy8W8AsFp7usUToQsKFkhnSHT2pcgye/QmjBp3mcno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629287; c=relaxed/simple; bh=roUlvYh8tk5VwX4xgLjM3LKEC9fdBEhoR+wg5elB3ek=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hexJaAxO90VE2AGWp9ARiPT/dZlPDR0EMlptcDPAP3XQG60xU5Ad0DtLrwgUEpjMoNlZIZcUVd3F3Z3FGhKAOopo658V3ofRbmZEmqejffWQ7yTtgGusnwBdEWH2FnOo7u1a5fXNEz6Btm3xkVzMiJjj2I9AK7L9XOlM06qhXd0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TyTCu+jJ; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TyTCu+jJ" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-7c3e1081804so1191769a12.3; Thu, 10 Oct 2024 23:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728629285; x=1729234085; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=95SFpqoAUV6SFrATAs96UjJLFFMy1Jx1iNhCNqIgsls=; b=TyTCu+jJBYBu8kDgiLqzE9uMJuq8J5ojfgFaW3KmXpJXLcMVEg0kYvDxC7zHU6wywv whoSBLv8FGe7X8l+xFmrO6exYJ4Zrnbnc/cdII/poiJD3lsUhVfskaoPzB9PI/Y3i2y7 Mek/rPO5LmL4wP9wPYy85GguGoFpSDBwSRTssnUBX90/bi+Pt+o+I0M3rIVpledeTEJO T7Ms2fwwwAGeSh5eNKId073caI8DHl4vphWR1npznVfrlYj1kRqPZm+cbYyDj2seSx8j 8n6btkCHRJGPguvWTrSp+CvUkNeYOzA5BHo8DjXeTadkudy//vvL6EaXCmyDC1UoAo07 cNmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728629285; x=1729234085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=95SFpqoAUV6SFrATAs96UjJLFFMy1Jx1iNhCNqIgsls=; b=DpVkV3reZEOqqofU4XJ8D0pIjOGeA7nlV1/w9u9yXoc26MylgFuOCc47EAUTqAqDAm ukMLbdB2nFWXU/1ToGoLoTyCNwG/31naAXJk3zUs80JWotPFG1zVLTRxlYx2B18oOB9U wWZv6HkAVFgJ3V5npk/MYL/ODZ9NyYHjhMu1aWJM0r7dzvWLqYrGdffSj3hQhjIFO5xU 7JOomWncHWbmAqdh+NGJk3Bb+7Jdq0rUfHdZ7iCVQEtccamSlNsZdbkOCyHsc3Gz2bio SSuKDSeooknHIx/Hg4avEUrlnPUJWE/nxjzDwzZwfiKFo76kU+PA1dKRPoUcxjO1Cmx+ 1Q0g== X-Forwarded-Encrypted: i=1; AJvYcCVUV/7sZoUqEvhBgLe+518lDlflGpt55biF8BuQyrITzC+1iSONgSj1iGa7kmCUvpvad8/JJ7ArkcPmyea6UpxaWXx/Aw==@vger.kernel.org, AJvYcCWz2ab4/OWYeVd3qLX6mz9RvFGxBvqD0FKJjInOeFulLQAsKE1GTefXXwYSfE0tBsUc1qdDwI/qN2U9UVI=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6Yit3W0djC115RSNvn3jO+6Qs93xKAAhlCAPYQCf5VhWxzT/A qaqNxDIp1Jb/Oy7iTFvPVtNbQPaZuV5d9hdmX6yhxx1pAH5CEBRs X-Google-Smtp-Source: AGHT+IHvNSP0/Ctj7483/cRjWrkletoIDDnLAAtaPDJRRZLgkZWzpu0hH3DORufu7Ed3IuclLv2sPw== X-Received: by 2002:a05:6a21:3983:b0:1d6:d0d3:c50c with SMTP id adf61e73a8af0-1d8bcfb27abmr2120411637.35.1728629284607; Thu, 10 Oct 2024 23:48:04 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2a36417afsm4877614a91.0.2024.10.10.23.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 23:48:03 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, W_Armin@gmx.de, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v4 3/4] alienware-wmi: added platform profile support Date: Fri, 11 Oct 2024 03:47:52 -0300 Message-ID: <20241011064751.306795-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011064336.305795-2-kuurtb@gmail.com> References: <20241011064336.305795-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/Kconfig | 1 + drivers/platform/x86/dell/alienware-wmi.c | 236 ++++++++++++++++++++++ 2 files changed, 237 insertions(+) diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/= Kconfig index 68a49788a..b06d634cd 100644 --- a/drivers/platform/x86/dell/Kconfig +++ b/drivers/platform/x86/dell/Kconfig @@ -21,6 +21,7 @@ config ALIENWARE_WMI depends on LEDS_CLASS depends on NEW_LEDS depends on ACPI_WMI + select ACPI_PLATFORM_PROFILE help This is a driver for controlling Alienware BIOS driven features. It exposes an interface for controlling the AlienFX diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x= 86/dell/alienware-wmi.c index 8f7a8bfef..8af2ab7fe 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -8,8 +8,11 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt =20 #include +#include +#include #include #include +#include #include #include =20 @@ -25,6 +28,12 @@ #define WMAX_METHOD_AMPLIFIER_CABLE 0x6 #define WMAX_METHOD_DEEP_SLEEP_CONTROL 0x0B #define WMAX_METHOD_DEEP_SLEEP_STATUS 0x0C +#define WMAX_METHOD_THERMAL_INFORMATION 0x14 +#define WMAX_METHOD_THERMAL_CONTROL 0x15 + +#define WMAX_ARG_GET_CURRENT_PROF 0x0B + +#define WMAX_FAILURE_CODE 0xFFFFFFFF =20 MODULE_AUTHOR("Mario Limonciello "); MODULE_DESCRIPTION("Alienware special feature control"); @@ -49,11 +58,27 @@ enum WMAX_CONTROL_STATES { WMAX_SUSPEND =3D 3, }; =20 +enum WMAX_THERMAL_PROFILE { + WMAX_THERMAL_QUIET =3D 0x96, + WMAX_THERMAL_BALANCED =3D 0x97, + WMAX_THERMAL_BALANCED_PERFORMANCE =3D 0x98, + WMAX_THERMAL_PERFORMANCE =3D 0x99, + WMAX_THERMAL_USTT_LOW_POWER =3D 0xA5, + WMAX_THERMAL_USTT_QUIET =3D 0xA3, + WMAX_THERMAL_USTT_BALANCED =3D 0xA0, + WMAX_THERMAL_USTT_BALANCED_PERFORMANCE =3D 0xA1, + WMAX_THERMAL_USTT_PERFORMANCE =3D 0xA4, + WMAX_THERMAL_GMODE =3D 0xAB, +}; + struct quirk_entry { u8 num_zones; u8 hdmi_mux; u8 amplifier; u8 deepslp; + u8 thermal; + u8 thermal_ustt; + u8 gmode; }; =20 static struct quirk_entry *quirks; @@ -64,6 +89,9 @@ static struct quirk_entry quirk_inspiron5675 =3D { .hdmi_mux =3D 0, .amplifier =3D 0, .deepslp =3D 0, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, }; =20 static struct quirk_entry quirk_unknown =3D { @@ -71,6 +99,9 @@ static struct quirk_entry quirk_unknown =3D { .hdmi_mux =3D 0, .amplifier =3D 0, .deepslp =3D 0, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, }; =20 static struct quirk_entry quirk_x51_r1_r2 =3D { @@ -78,6 +109,9 @@ static struct quirk_entry quirk_x51_r1_r2 =3D { .hdmi_mux =3D 0, .amplifier =3D 0, .deepslp =3D 0, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, }; =20 static struct quirk_entry quirk_x51_r3 =3D { @@ -85,6 +119,9 @@ static struct quirk_entry quirk_x51_r3 =3D { .hdmi_mux =3D 0, .amplifier =3D 1, .deepslp =3D 0, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, }; =20 static struct quirk_entry quirk_asm100 =3D { @@ -92,6 +129,9 @@ static struct quirk_entry quirk_asm100 =3D { .hdmi_mux =3D 1, .amplifier =3D 0, .deepslp =3D 0, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, }; =20 static struct quirk_entry quirk_asm200 =3D { @@ -99,6 +139,9 @@ static struct quirk_entry quirk_asm200 =3D { .hdmi_mux =3D 1, .amplifier =3D 0, .deepslp =3D 1, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, }; =20 static struct quirk_entry quirk_asm201 =3D { @@ -106,6 +149,19 @@ static struct quirk_entry quirk_asm201 =3D { .hdmi_mux =3D 1, .amplifier =3D 1, .deepslp =3D 1, + .thermal =3D 0, + .thermal_ustt =3D 0, + .gmode =3D 0, +}; + +static struct quirk_entry quirk_x15_r1 =3D { + .num_zones =3D 2, + .hdmi_mux =3D 0, + .amplifier =3D 0, + .deepslp =3D 0, + .thermal =3D 0, + .thermal_ustt =3D 1, + .gmode =3D 0, }; =20 static int __init dmi_matched(const struct dmi_system_id *dmi) @@ -169,6 +225,15 @@ static const struct dmi_system_id alienware_quirks[] _= _initconst =3D { }, .driver_data =3D &quirk_asm201, }, + { + .callback =3D dmi_matched, + .ident =3D "Alienware x15 R1", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1") + }, + .driver_data =3D &quirk_x15_r1, + }, { .callback =3D dmi_matched, .ident =3D "Dell Inc. Inspiron 5675", @@ -218,6 +283,7 @@ static struct platform_device *platform_device; static struct device_attribute *zone_dev_attrs; static struct attribute **zone_attrs; static struct platform_zone *zone_data; +static struct platform_profile_handler pp_handler; =20 static struct platform_driver platform_driver =3D { .driver =3D { @@ -761,6 +827,168 @@ static int create_deepsleep(struct platform_device *d= ev) return ret; } =20 +/* + * Thermal Profile control + * - Provides thermal profile control through the Platform Profile API + */ +#define WMAX_PROFILE_MASK GENMASK(15, 8) +#define WMAX_PROFILE_ACTIVATE BIT(0) + +static u32 profile_to_wmax_arg(enum WMAX_THERMAL_PROFILE prof) +{ + return FIELD_PREP(WMAX_PROFILE_MASK, prof) | WMAX_PROFILE_ACTIVATE; +} + +static int thermal_profile_get(struct platform_profile_handler *pprof, + enum platform_profile_option *profile) +{ + acpi_status status; + u32 in_args =3D WMAX_ARG_GET_CURRENT_PROF; + u32 out_data; + + status =3D alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_INFORMATION, &out_data); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (out_data =3D=3D WMAX_FAILURE_CODE) + return -EBADRQC; + + switch (out_data) { + case WMAX_THERMAL_USTT_LOW_POWER: + *profile =3D PLATFORM_PROFILE_LOW_POWER; + break; + case WMAX_THERMAL_QUIET: + case WMAX_THERMAL_USTT_QUIET: + *profile =3D PLATFORM_PROFILE_QUIET; + break; + case WMAX_THERMAL_BALANCED: + case WMAX_THERMAL_USTT_BALANCED: + *profile =3D PLATFORM_PROFILE_BALANCED; + break; + case WMAX_THERMAL_BALANCED_PERFORMANCE: + case WMAX_THERMAL_USTT_BALANCED_PERFORMANCE: + *profile =3D PLATFORM_PROFILE_BALANCED_PERFORMANCE; + break; + case WMAX_THERMAL_GMODE: + case WMAX_THERMAL_PERFORMANCE: + case WMAX_THERMAL_USTT_PERFORMANCE: + *profile =3D PLATFORM_PROFILE_PERFORMANCE; + break; + default: + return -ENODATA; + } + + return 0; +} + +static int thermal_profile_set(struct platform_profile_handler *pprof, + enum platform_profile_option profile) +{ + acpi_status status; + u32 in_args; + u32 out_data; + + switch (profile) { + case PLATFORM_PROFILE_QUIET: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_QUIET); + break; + case PLATFORM_PROFILE_BALANCED: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_BALANCED); + break; + case PLATFORM_PROFILE_BALANCED_PERFORMANCE: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_BALANCED_PERFORMANCE); + break; + case PLATFORM_PROFILE_PERFORMANCE: + if (quirks->gmode > 0) + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_GMODE); + else + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_PERFORMANCE); + break; + default: + return -EOPNOTSUPP; + } + + status =3D alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_CONTROL, &out_data); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (out_data =3D=3D WMAX_FAILURE_CODE) + return -EBADRQC; + + return 0; +} + +static int thermal_profile_set_ustt(struct platform_profile_handler *pprof, + enum platform_profile_option profile) +{ + acpi_status status; + u32 in_args; + u32 out_data; + + switch (profile) { + case PLATFORM_PROFILE_LOW_POWER: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_USTT_LOW_POWER); + break; + case PLATFORM_PROFILE_QUIET: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_USTT_QUIET); + break; + case PLATFORM_PROFILE_BALANCED: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_USTT_BALANCED); + break; + case PLATFORM_PROFILE_BALANCED_PERFORMANCE: + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_USTT_BALANCED_PERFORMANCE); + break; + case PLATFORM_PROFILE_PERFORMANCE: + if (quirks->gmode > 0) + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_GMODE); + else + in_args =3D profile_to_wmax_arg(WMAX_THERMAL_USTT_PERFORMANCE); + break; + default: + return -EOPNOTSUPP; + } + + status =3D alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_CONTROL, &out_data); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (out_data =3D=3D WMAX_FAILURE_CODE) + return -EBADRQC; + + return 0; +} + +static int create_thermal_profile(void) +{ + pp_handler.profile_get =3D thermal_profile_get; + + if (quirks->thermal > 0) + pp_handler.profile_set =3D thermal_profile_set; + else { + pp_handler.profile_set =3D thermal_profile_set_ustt; + set_bit(PLATFORM_PROFILE_LOW_POWER, pp_handler.choices); + } + + set_bit(PLATFORM_PROFILE_QUIET, pp_handler.choices); + set_bit(PLATFORM_PROFILE_BALANCED, pp_handler.choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pp_handler.choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pp_handler.choices); + + return platform_profile_register(&pp_handler); +} + +static void remove_thermal_profile(void) +{ + if (quirks->thermal > 0) + platform_profile_remove(); +} + static int __init alienware_wmi_init(void) { int ret; @@ -808,6 +1036,12 @@ static int __init alienware_wmi_init(void) goto fail_prep_deepsleep; } =20 + if (quirks->thermal > 0 || quirks->thermal_ustt > 0) { + ret =3D create_thermal_profile(); + if (ret) + goto fail_prep_thermal_profile; + } + ret =3D alienware_zone_init(platform_device); if (ret) goto fail_prep_zones; @@ -818,6 +1052,7 @@ static int __init alienware_wmi_init(void) alienware_zone_exit(platform_device); fail_prep_deepsleep: fail_prep_amplifier: +fail_prep_thermal_profile: fail_prep_hdmi: platform_device_del(platform_device); fail_platform_device2: @@ -835,6 +1070,7 @@ static void __exit alienware_wmi_exit(void) if (platform_device) { alienware_zone_exit(platform_device); remove_hdmi(platform_device); + remove_thermal_profile(); platform_device_unregister(platform_device); platform_driver_unregister(&platform_driver); } --=20 2.47.0 From nobody Wed Nov 27 10:28:47 2024 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4326B209F4B; Fri, 11 Oct 2024 06:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629334; cv=none; b=UczyC2tTKfl/tH6UTlrevtCCzKtJVcJRNaGS429a/iAprTSnM99Mje5McyVK/kEmJRt3VtLxkzOGaeXHl+4axdqSL9bb34RFN6hhCceVI13PRic6WulAjcylI2qi+lmAhvX4BkdmUf5BYZPKgmizBybHuNVWjRGnGB0vvwwKmuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728629334; c=relaxed/simple; bh=T6kufcUz90PY22ZUdYq7DB9r+c6jj+c/dWVKLga8iTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g7oQiLk11Yka/3t95xoQt5AT0jhYV74MGUvYpQQ5GLeiJNERxk0/YlLKVewPdp3lrLcPHyYyO83TgwYh5V3VWtpoa+QfIZmVZ1bKrtXibt1WfKCi9CIJpa/J+IF/K9+ezW2CKQfHKflMQWjqICfwlHwVNe9KUl2J9uk+b0buvr0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NwjkqSyq; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NwjkqSyq" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7db908c9c83so1049636a12.2; Thu, 10 Oct 2024 23:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728629331; x=1729234131; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z5ermRXamu1j2z0NI4N0QaXWQDdS+RjUY4K3H9GJZsY=; b=NwjkqSyqx7bq2ILlrOnc6zLQtryKtDP+bnEtVumHykhTnIpzL9UsHlA5JRwbtiPAFG xD54dXSN1XzXUpXV3Px9xeP7Bq8qatNbruWyIZUtMIeEnyQ7Owq0vee5AMNq30FBkIm4 zl+Vl7GFkgPjsFqNMK23s806B+Fg39IKZIPF7z45aPoyT9D9F8xGcn9NPNWax45FMOm+ 9RMw3jz9ROp1KtD4b7c9Tj3E9uo5+J2NAY26Fy32l+a4By+6oZaGthy7pkGGwVRmWXbH beGrDHhRCDItJEgvL6ZkUQ6gRkbdTeiZDPmLIA5PHWu2VtnQgfzNXMclAfvRkR7N2Y5Q xz1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728629331; x=1729234131; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z5ermRXamu1j2z0NI4N0QaXWQDdS+RjUY4K3H9GJZsY=; b=Z5frBTp90XgCgnViw7BJLM+933u3YPAn6deAJtmKsJNxVqlKfdASosn0uodtIEGKCQ QSUndZDJ/SLQrD/8fmjMhVfGlbYzuYwZl+Suyk0b4+leGKJ9xAknvCsCAxBIROn5XxtK ZxmBwvODAc4pDs8xHeBn9uZQzgZQG244vJC4MNdzYPLM297lC9kxNYezGV6J7zI1dV3I b7idNBBQ/Wd3Q/jag/cSFbPicJA2ufvXPWovTpBCLtoQJKfDP4cPumqi2EqEBGm6Xmn3 YM7+mfcv4K222bS/LrZpxLrYsXu6IhxfHuYVN5bKDtC1LzrVxPkPhPUVAAs2WmgRSCeu g0GQ== X-Forwarded-Encrypted: i=1; AJvYcCVLL5sQH1RztSKOU6756LI7vOkl0j4U0Ysszzpv9X0X2tymIxbf5Eq85ChONEMSUw/Xc49AHzEes+gplVA=@vger.kernel.org, AJvYcCVakoy38N/NEfQiX0QXcTQnAcLNV0k9lxU76UTMD+H/YOjaxJ89JpyCuBUUBuVlJBvmD2OwxG9T31mv5AhMaPxvj+ETmQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yx6qjJ2XpkI5lQWaI/cd0CRQfJ455BhkOnKJOfyguvRUJF2epyJ j82h7KUnoJYuJRMcJgfXKw8FwY+GT2mzf4Gr7HmKAVdgdG5tWF/n X-Google-Smtp-Source: AGHT+IFs6oLVBBW4jsvaJW7yhPRzCDKAc81uAXiwkuJDz8ifhJtZVaS6z2Nq7L6bhcnpUNuSUiwKKA== X-Received: by 2002:a05:6a20:b418:b0:1d2:e94d:45a6 with SMTP id adf61e73a8af0-1d8bcf181d8mr2736362637.14.1728629331328; Thu, 10 Oct 2024 23:48:51 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e2a9e95f9sm2031810b3a.39.2024.10.10.23.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2024 23:48:50 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, W_Armin@gmx.de, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v4 4/4] alienware-wmi: WMAX interface documentation Date: Fri, 11 Oct 2024 03:48:38 -0300 Message-ID: <20241011064837.307053-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241011064336.305795-2-kuurtb@gmail.com> References: <20241011064336.305795-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Kurt Borja --- Documentation/wmi/devices/alienware-wmi.rst | 364 ++++++++++++++++++++ 1 file changed, 364 insertions(+) create mode 100644 Documentation/wmi/devices/alienware-wmi.rst diff --git a/Documentation/wmi/devices/alienware-wmi.rst b/Documentation/wm= i/devices/alienware-wmi.rst new file mode 100644 index 000000000..cf5d6259f --- /dev/null +++ b/Documentation/wmi/devices/alienware-wmi.rst @@ -0,0 +1,364 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Dell AWCC WMI interface driver (alienware-wmi) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Introduction +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The WMI device WMAX has been implemented for many Alienware and Dell's G-S= eries +models. Throughout these models, two implementations have been identified.= The +first one, used by older systems, deals with HDMI, brightness, RGB, amplif= ier +and deep sleep control. The second one used by newer systems deals primari= ly +with thermal, overclocking, and GPIO control. + +It is suspected that the latter is used by Alienware Command Center (AWCC)= to +manage manufacturer predefined thermal profiles. The alienware-wmi driver +exposes Thermal_Information and Thermal_Control methods through the Platfo= rm +Profile API to mimic AWCC's behavior. + +This newer interface, named AWCCMethodFunction has been reverse engineered= , as +Dell has not provided any official documentation. We will try to describe = to the +best of our ability its discovered inner workings. + +.. note:: + The following method description may vary between models. + +WMI interface description +------------------------- + +The WMI interface description can be decoded from the embedded binary MOF = (bmof) +data using the `bmfdec `_ utility: + +:: + + [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"), Description("WMI= Function"), guid("{A70591CE-A997-11DA-B012-B622A1EF5492}")] + class AWCCWmiMethodFunction { + [key, read] string InstanceName; + [read] boolean Active; + + [WmiMethodId(13), Implemented, read, write, Description("Return Overclo= cking Report.")] void Return_OverclockingReport([out] uint32 argr); + [WmiMethodId(14), Implemented, read, write, Description("Set OCUIBIOS C= ontrol.")] void Set_OCUIBIOSControl([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(15), Implemented, read, write, Description("Clear OC FailS= afe Flag.")] void Clear_OCFailSafeFlag([out] uint32 argr); + [WmiMethodId(19), Implemented, read, write, Description("Get Fan Sensor= s.")] void GetFanSensors([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(20), Implemented, read, write, Description("Thermal Inform= ation.")] void Thermal_Information([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(21), Implemented, read, write, Description("Thermal Contro= l.")] void Thermal_Control([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(23), Implemented, read, write, Description("MemoryOCContro= l.")] void MemoryOCControl([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(26), Implemented, read, write, Description("System Informa= tion.")] void SystemInformation([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(28), Implemented, read, write, Description("Power Informat= ion.")] void PowerInformation([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(32), Implemented, read, write, Description("FW Update GPIO= toggle.")] void FWUpdateGPIOtoggle([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(33), Implemented, read, write, Description("Read Total of = GPIOs.")] void ReadTotalofGPIOs([out] uint32 argr); + [WmiMethodId(34), Implemented, read, write, Description("Read GPIO pin = Status.")] void ReadGPIOpPinStatus([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(35), Implemented, read, write, Description("Read Chassis C= olor.")] void ReadChassisColor([out] uint32 argr); + [WmiMethodId(36), Implemented, read, write, Description("Read Platform = Properties.")] void ReadPlatformProperties([out] uint32 argr); + [WmiMethodId(128), Implemented, read, write, Description("Caldera SW in= stallation.")] void CalderaSWInstallation([out] uint32 argr); + [WmiMethodId(129), Implemented, read, write, Description("Caldera SW is= released.")] void CalderaSWReleased([out] uint32 argr); + [WmiMethodId(130), Implemented, read, write, Description("Caldera Conne= ction Status.")] void CalderaConnectionStatus([in] uint32 arg2, [out] uint3= 2 argr); + [WmiMethodId(131), Implemented, read, write, Description("Surprise Unpl= ugged Flag Status.")] void SurpriseUnpluggedFlagStatus([out] uint32 argr); + [WmiMethodId(132), Implemented, read, write, Description("Clear Surpris= e Unplugged Flag.")] void ClearSurpriseUnpluggedFlag([out] uint32 argr); + [WmiMethodId(133), Implemented, read, write, Description("Cancel Undock= Request.")] void CancelUndockRequest([out] uint32 argr); + [WmiMethodId(135), Implemented, read, write, Description("Devices in Ca= ldera.")] void DevicesInCaldera([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(136), Implemented, read, write, Description("Notify BIOS f= or SW ready to disconnect Caldera.")] void NotifyBIOSForSWReadyToDisconnect= Caldera([out] uint32 argr); + [WmiMethodId(160), Implemented, read, write, Description("Tobii SW inst= allation.")] void TobiiSWinstallation([out] uint32 argr); + [WmiMethodId(161), Implemented, read, write, Description("Tobii SW Rele= ased.")] void TobiiSWReleased([out] uint32 argr); + [WmiMethodId(162), Implemented, read, write, Description("Tobii Camera = Power Reset.")] void TobiiCameraPowerReset([out] uint32 argr); + [WmiMethodId(163), Implemented, read, write, Description("Tobii Camera = Power On.")] void TobiiCameraPowerOn([out] uint32 argr); + [WmiMethodId(164), Implemented, read, write, Description("Tobii Camera = Power Off.")] void TobiiCameraPowerOff([out] uint32 argr); + }; + +Some of these methods get quite intricate so we will describe them using +pseudo-code that vaguely resembles the original ASL code. + +Argument Structure +------------------ + +All input arguments have type **uint32** and their structure is very simil= ar +between methods. Usually, the first byte corresponds to a specific *operat= ion* +the method performs, and the subsequent bytes correspond to *arguments* pa= ssed +to this *operation*. For example, if an operation has code 0x01 and requir= es an +ID 0xA0, the argument you would pass to the method is 0xA001. + + +Thermal Methods +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +WMI method Thermal_Information([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------- + +:: + + if BYTE_0(arg2) =3D=3D 0x01: + argr =3D 1 + + if BYTE_0(arg2) =3D=3D 0x02: + argr =3D UNKNOWN_CONSTANT + + if BYTE_0(arg2) =3D=3D 0x03: + if BYTE_1(arg2) =3D=3D 0x00: + argr =3D FAN_ID_0 + + if BYTE_1(arg2) =3D=3D 0x01: + argr =3D FAN_ID_1 + + if BYTE_1(arg2) =3D=3D 0x02: + argr =3D FAN_ID_2 + + if BYTE_1(arg2) =3D=3D 0x03: + argr =3D FAN_ID_3 + + if BYTE_1(arg2) =3D=3D 0x04: + argr =3D SENSOR_ID_CPU | 0x0100 + + if BYTE_1(arg2) =3D=3D 0x05: + argr =3D SENSOR_ID_GPU | 0x0100 + + if BYTE_1(arg2) =3D=3D 0x06: + argr =3D THERMAL_MODE_QUIET_ID + + if BYTE_1(arg2) =3D=3D 0x07: + argr =3D THERMAL_MODE_BALANCED_ID + + if BYTE_1(arg2) =3D=3D 0x08: + argr =3D THERMAL_MODE_BALANCED_PERFORMANCE_ID + + if BYTE_1(arg2) =3D=3D 0x09: + argr =3D THERMAL_MODE_PERFORMANCE_ID + + if BYTE_1(arg2) =3D=3D 0x0A: + argr =3D THERMAL_MODE_LOW_POWER_ID + + if BYTE_1(arg2) =3D=3D 0x0B: + argr =3D THERMAL_MODE_GMODE_ID + + else: + argr =3D 0xFFFFFFFF + + if BYTE_0(arg2) =3D=3D 0x04: + if is_valid_sensor(BYTE_1(arg2)): + argr =3D SENSOR_TEMP_C + else: + argr =3D 0xFFFFFFFF + + if BYTE_0(arg2) =3D=3D 0x05: + if is_valid_fan(BYTE_1(arg2)): + argr =3D FAN_RPM() + + if BYTE_0(arg2) =3D=3D 0x06: + skip + + if BYTE_0(arg2) =3D=3D 0x07: + argr =3D 0 + + If BYTE_0(arg2) =3D=3D 0x08: + if is_valid_fan(BYTE_1(arg2)): + argr =3D 0 + else: + argr =3D 0xFFFFFFFF + + if BYTE_0(arg2) =3D=3D 0x09: + if is_valid_fan(BYTE_1(arg2)): + argr =3D FAN_UNKNOWN_STAT_0() + + else: + argr =3D 0xFFFFFFFF + + if BYTE_0(arg2) =3D=3D 0x0A: + argr =3D THERMAL_MODE_BALANCED_ID + + if BYTE_0(arg2) =3D=3D 0x0B: + argr =3D CURRENT_THERMAL_MODE() + + if BYTE_0(arg2) =3D=3D 0x0C: + if is_valid_fan(BYTE_1(arg2)): + argr =3D FAN_UNKNOWN_STAT_1() + else: + argr =3D 0xFFFFFFFF + +WMI method Thermal_Control([in] uint32 arg2, [out] uint32 argr) +--------------------------------------------------------------- + +:: + + if BYTE_0(arg2) =3D=3D 0x01: + if is_valid_thermal_profile(BYTE_1(arg2)): + SET_THERMAL_PROFILE(BYTE_1(arg2)) + argr =3D 0 + + if BYTE_0(arg2) =3D=3D 0x02: + if is_valid_fan(BYTE_1(arg2)): + SET_FAN_SPEED_MULTIPLIER(BYTE_2(arg2)) + argr =3D 0 + else: + argr =3D 0xFFFFFFFF + +.. note:: + While you can manually change the fan speed multiplier with this method, + Dell's BIOS tends to overwrite this changes anyway. + +These are the known thermal profile codes: + +:: + + CUSTOM 0x00 + + QUIET 0x96 + BALANCED 0x97 + BALANCED_PERFORMANCE 0x98 + PERFORMANCE 0x99 + + QUIET_USTT 0xA3 + BALANCED_USTT 0xA0 + BALANCED_PERFORMANCE_USTT 0xA1 + PERFORMANCE_USTT 0xA4 + LOW_POWER_USTT 0xA5 + + GMODE 0xAB + +Usually if a model doesn't support the first four profiles they will suppo= rt +the User Selectable Thermal Tables (USTT) profiles and vice-versa. + +GMODE replaces PERFORMANCE in G-Series laptops. + +Very grateful to `AlexIII `_ for disco= vering +some of the codes compatible with G-Series laptops. + +WMI method GetFanSensors([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------- + +:: + + if BYTE_0(arg2) =3D=3D 1: + if is_valid_fan(BYTE_1(arg2)): + argr =3D 1 + else: + argr =3D 0 + + if BYTE_0(arg2) =3D=3D 2: + if is_valid_fan(BYTE_1(arg2)): + if BYTE_2(arg2) =3D=3D 0: + argr =3D=3D SENSOR_ID + else + argr =3D=3D 0xFFFFFFFF + else: + argr =3D 0 + +Overclocking Methods +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +.. warning:: + These methods have not been tested and are only partially reverse + engineered. + +WMI method Return_OverclockingReport([out] uint32 argr) +------------------------------------------------------- + +:: + + CSMI (0xE3, 0x99) + argr =3D 0 + +CSMI is an unknown operation. + +WMI method Set_OCUIBIOSControl([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------- + +:: + + CSMI (0xE3, 0x99) + argr =3D 0 + +CSMI is an unknown operation + +WMI method Clear_OCFailSafeFlag([out] uint32 argr) +-------------------------------------------------- + +:: + + CSMI (0xE3, 0x99) + argr =3D 0 + +CSMI is an unknown operation + + +WMI method MemoryOCControl([in] uint32 arg2, [out] uint32 argr) +--------------------------------------------------------------- + +AWCC supports memory overclocking, but this method is very intricate and h= as +not been deciphered yet. + +GPIO methods +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +These methods are probably related to some kind of firmware update system, +through a GPIO device. + +.. warning:: + These methods have not been tested and are only partially reverse + engineered. + +WMI method FWUpdateGPIOtoggle([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------ + +:: + + if BYTE_0(arg2) =3D=3D 0: + if BYTE_1(arg2) =3D=3D 1: + SET_PIN_A_HIGH() + else: + SET_PIN_A_LOW() + + if BYTE_0(arg2) =3D=3D 1: + if BYTE_1(arg2) =3D=3D 1: + SET_PIN_B_HIGH() + + else: + SET_PIN_B_LOW() + + else: + argr =3D 1 + +WMI method ReadTotalofGPIOs([out] uint32 argr) +---------------------------------------------- + +:: + + argr =3D 0x02 + +WMI method ReadGPIOpPinStatus([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------ + +:: + + if BYTE_0(arg2) =3D=3D 0: + argr =3D PIN_A_STATUS + + if BYTE_0(arg2) =3D=3D 1: + argr =3D PIN_B_STATUS + + +Other information Methods +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D + +WMI method SystemInformation([in] uint32 arg2, [out] uint32 argr) +----------------------------------------------------------------- + +Returns unknown information. + +WMI method PowerInformation([in] uint32 arg2, [out] uint32 argr) +---------------------------------------------------------------- + +Returns unknown information. + +WMI method ReadChassisColor([out] uint32 argr) +---------------------------------------------- + +:: + + argr =3D CHASSIS_COLOR_ID + +WMI method ReadPlatformProperties([out] uint32 argr) +---------------------------------------------------- + +Returns unknown information. + --=20 2.47.0