From patchwork Mon Jan 27 04:03:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950963 Received: from mail-vs1-f46.google.com (mail-vs1-f46.google.com [209.85.217.46]) (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 790A515ADB4; Mon, 27 Jan 2025 04:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950662; cv=none; b=CHQqNGbLvFEHG4oo3Rm5mtPw79jzo5pCBA4w2WpmclcWfHVt0ESf73Ie2YrYgJ7FoKtsY89hBa+Vd/dxnCovIrnNDmr6g9qFNBkjeRNpc7CeDNMyII6D8xemQXUdwCPMYf3IFMVgzCUdZNirm47lm75LBiW9uffSfK6pK0lq3h8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950662; c=relaxed/simple; bh=49eKxDqQtP3po1mBGZJU1bNO+vDFpnsz8KG9NigI21E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZebJLY4yPItpgSPxdJhRmgfN2uxzfBWXfL9BkJAz9MbMNpxWEwvkEIW3Q700UNSo0nPLldMcPMUdOxbOwb3ovcVmbgFO24ERZQ8W0knnHad3MOz34FoNQZBJUizZX0AapgRE93MHG4IFCSR+Qq8vtKXli/jji3HbQ++TDnBD/Yo= 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=Tm+TelF5; arc=none smtp.client-ip=209.85.217.46 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="Tm+TelF5" Received: by mail-vs1-f46.google.com with SMTP id ada2fe7eead31-4aff31b77e8so1433892137.1; Sun, 26 Jan 2025 20:04:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950659; x=1738555459; 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=78jUbb12GWv+OJbtaS4vNafGBdENBEI5UTnuBg/ppNE=; b=Tm+TelF5x6ofHANwK6TgRm1vQ3406lnIX9ArXfnulGhQhCe6qNwMAcUPH4ZDNmoNvu c6ucPWeQEreSE6LGbfbGNKoyMeF7Y04srCS5A5ycNRtt5jWCzszU+KPt2o2OLGmSDKnN oQuS1zjZsKoHO8h2CRo76VoiQ0nxlumMZ/62ruYFLeei0OMQs9DK/cNlk+l5OPdZyC6a RdHG8DL7BEcrT0L15YoLuH3iOCOXVXm6MvU/OTAh1TL/2592PM5RvZpJF2EpKCVIpKQn XVhfhOipFceUuwF4y99B4HR76iwfb5C0k/14U5wAJQd6sqhtto7g+F91UJI4pzewYFwQ LNZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950659; x=1738555459; 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=78jUbb12GWv+OJbtaS4vNafGBdENBEI5UTnuBg/ppNE=; b=xCIGUvCCxFn7SDB6TEeVocKu3d08+DS2JkZM1eR4ol2CxJNWIx/Dpncv2AKZTGhu26 rr7IpJ20ceHK5EkIrgu/WxejpX7Bjn9loelB8d7yszWXz7Fbw1Lhpxkszp42A3kJ4J5g 6H4EfzDPx+oCs+zc36AIwPghslrx6P0K+2JQln1I02m61MyRVoT0qySeOUOU0MVWq7Fr sP3z0Dsl8Ru/w/lOkHG9LPSmTh00t73Ua/ruJhLB0Qkw4VlUV4f1tM2z+8rOV8tCrESp iZszx2VVe/HgQGsR/StE+czx/a72ComGkH0XZwgFdyu3Q9utHA5b49PMD/7HUF5GUkLA W80Q== X-Forwarded-Encrypted: i=1; AJvYcCWYoNdAyaYa4frkGD7ahd5gAcToN+CiQW2jdUuMdeJVpXxUUfC+JH5dn/MY2XGlmXYqZvBR1IKGleo4bB4=@vger.kernel.org X-Gm-Message-State: AOJu0YyowrW3EUirMIlaaI+YVSZNfOXFMy1GZOST8u9I2Cg/KVyOmPbE 82y17jvwvtnzqW0IdemY8qORdDk3wSDdYZhxPmUWF2ueV7oxpCgLbI5eig== X-Gm-Gg: ASbGncvW0zY3ln7FVQsZcw1zSbxNhz+st6m4mKVqbiB14V3l07wFSQnJbtCBLfp5ZHk +ZoH/UIDuQhkXzeCBHcQpZCdc49AQvBaQri3ALNCmMpha6a7UFuvx6ycwIN6YrGA8gub/E9Su1/ qhL9mmNa5CTCm4+0NaeTFZ53A0gjmzrd6OeaWanuLcrcaajMdDH+PI+AJzDWzXID7mUT4W1YOM5 eGhPTKB7EcDEdp0Ei6ARDkqLPK1M+BCqf4+QexLIEmkvaX/57BEZ1sj4OBJFsBmWzhRYPRsgtlg fDAmPjTD7G7T X-Google-Smtp-Source: AGHT+IEc+xeWMI2ykjEDCMmWhbs2BlLl1rxoHtNVb/MHBRu59yWf8HoHapThFymraTfwTWNG8FPXxg== X-Received: by 2002:a05:6102:38c9:b0:4b2:5d16:f75 with SMTP id ada2fe7eead31-4b690b8b049mr31130465137.4.1737950658838; Sun, 26 Jan 2025 20:04:18 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:18 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 01/14] platform/x86: alienware-wmi: Add a state container for LED control feature Date: Sun, 26 Jan 2025 23:03:53 -0500 Message-ID: <20250127040406.17112-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a state container for the "alienware-wmi" platform device and initialize it on the new alienfx_probe(). Migrate all LED control functions to use this state container to support upcoming file split. Additionally move the led_classdev registration to the platform driver probe and make it device managed. Drop alienware_zone_init() and alienware_zone_exit() because they are no longer needed and mimic the `quirks->num_zone > 0` check by failing the platform device probe. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 125 ++++++++++++---------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index e252e0cf47ef..ab86deb1adb9 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -413,13 +413,18 @@ struct wmax_u32_args { u8 arg3; }; +struct alienfx_priv { + struct platform_device *pdev; + struct led_classdev global_led; + struct color_platform colors[4]; + u8 global_brightness; + u8 lighting_control_state; +}; + static struct platform_device *platform_device; -static struct color_platform colors[4]; static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; static u8 interface; -static u8 lighting_control_state; -static u8 global_brightness; /* * Helpers used for zone control @@ -451,7 +456,7 @@ static int parse_rgb(const char *buf, struct color_platform *colors) /* * Individual RGB zone control */ -static int alienware_update_led(u8 location) +static int alienware_update_led(struct alienfx_priv *priv, u8 location) { int method_id; acpi_status status; @@ -461,21 +466,21 @@ static int alienware_update_led(u8 location) struct wmax_led_args wmax_basic_args; if (interface == WMAX) { wmax_basic_args.led_mask = 1 << location; - wmax_basic_args.colors = colors[location]; - wmax_basic_args.state = lighting_control_state; + wmax_basic_args.colors = priv->colors[location]; + wmax_basic_args.state = priv->lighting_control_state; guid = WMAX_CONTROL_GUID; method_id = WMAX_METHOD_ZONE_CONTROL; input.length = sizeof(wmax_basic_args); input.pointer = &wmax_basic_args; } else { - legacy_args.colors = colors[location]; - legacy_args.brightness = global_brightness; + legacy_args.colors = priv->colors[location]; + legacy_args.brightness = priv->global_brightness; legacy_args.state = 0; - if (lighting_control_state == LEGACY_BOOTING || - lighting_control_state == LEGACY_SUSPEND) { + if (priv->lighting_control_state == LEGACY_BOOTING || + priv->lighting_control_state == LEGACY_SUSPEND) { guid = LEGACY_POWER_CONTROL_GUID; - legacy_args.state = lighting_control_state; + legacy_args.state = priv->lighting_control_state; } else guid = LEGACY_CONTROL_GUID; method_id = location + 1; @@ -494,22 +499,26 @@ static int alienware_update_led(u8 location) static ssize_t zone_show(struct device *dev, struct device_attribute *attr, char *buf, u8 location) { + struct alienfx_priv *priv = dev_get_drvdata(dev); + struct color_platform *colors = &priv->colors[location]; + return sprintf(buf, "red: %d, green: %d, blue: %d\n", - colors[location].red, colors[location].green, - colors[location].blue); + colors->red, colors->green, colors->blue); } static ssize_t zone_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count, u8 location) { + struct alienfx_priv *priv = dev_get_drvdata(dev); + struct color_platform *colors = &priv->colors[location]; int ret; - ret = parse_rgb(buf, &colors[location]); + ret = parse_rgb(buf, colors); if (ret) return ret; - ret = alienware_update_led(location); + ret = alienware_update_led(priv, location); return ret ? ret : count; } @@ -577,9 +586,11 @@ static ssize_t lighting_control_state_show(struct device *dev, struct device_attribute *attr, char *buf) { - if (lighting_control_state == LEGACY_BOOTING) + struct alienfx_priv *priv = dev_get_drvdata(dev); + + if (priv->lighting_control_state == LEGACY_BOOTING) return sysfs_emit(buf, "[booting] running suspend\n"); - else if (lighting_control_state == LEGACY_SUSPEND) + else if (priv->lighting_control_state == LEGACY_SUSPEND) return sysfs_emit(buf, "booting running [suspend]\n"); return sysfs_emit(buf, "booting [running] suspend\n"); @@ -589,6 +600,7 @@ static ssize_t lighting_control_state_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + struct alienfx_priv *priv = dev_get_drvdata(dev); u8 val; if (strcmp(buf, "booting\n") == 0) @@ -600,9 +612,9 @@ static ssize_t lighting_control_state_store(struct device *dev, else val = WMAX_RUNNING; - lighting_control_state = val; + priv->lighting_control_state = val; pr_debug("alienware-wmi: updated control state to %d\n", - lighting_control_state); + priv->lighting_control_state); return count; } @@ -662,46 +674,26 @@ static int wmax_brightness(int brightness) static void global_led_set(struct led_classdev *led_cdev, enum led_brightness brightness) { + struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, + global_led); int ret; - global_brightness = brightness; + + priv->global_brightness = brightness; + if (interface == WMAX) ret = wmax_brightness(brightness); else - ret = alienware_update_led(0); + ret = alienware_update_led(priv, 0); if (ret) pr_err("LED brightness update failed\n"); } static enum led_brightness global_led_get(struct led_classdev *led_cdev) { - return global_brightness; -} - -static struct led_classdev global_led = { - .brightness_set = global_led_set, - .brightness_get = global_led_get, - .name = "alienware::global_brightness", -}; + struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, + global_led); -static int alienware_zone_init(struct platform_device *dev) -{ - if (interface == WMAX) { - lighting_control_state = WMAX_RUNNING; - } else if (interface == LEGACY) { - lighting_control_state = LEGACY_RUNNING; - } - global_led.max_brightness = 0x0F; - global_brightness = global_led.max_brightness; - - return led_classdev_register(&dev->dev, &global_led); -} - -static void alienware_zone_exit(struct platform_device *dev) -{ - if (!quirks->num_zones) - return; - - led_classdev_unregister(&global_led); + return priv->global_brightness; } static acpi_status alienware_wmax_command(void *in_args, size_t in_size, @@ -1157,6 +1149,33 @@ static int create_thermal_profile(struct platform_device *platform_device) /* * Platform Driver */ +static int alienfx_probe(struct platform_device *pdev) +{ + struct alienfx_priv *priv; + + if (!quirks->num_zones) + return -ENODEV; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + if (interface == WMAX) + priv->lighting_control_state = WMAX_RUNNING; + else + priv->lighting_control_state = LEGACY_RUNNING; + + priv->pdev = pdev; + priv->global_led.name = "alienware::global_brightness"; + priv->global_led.brightness_set = global_led_set; + priv->global_led.brightness_get = global_led_get; + priv->global_led.max_brightness = 0x0F; + priv->global_brightness = priv->global_led.max_brightness; + platform_set_drvdata(pdev, priv); + + return devm_led_classdev_register(&pdev->dev, &priv->global_led); +} + static const struct attribute_group *alienfx_groups[] = { &zone_attribute_group, &hdmi_attribute_group, @@ -1170,6 +1189,7 @@ static struct platform_driver platform_driver = { .name = "alienware-wmi", .dev_groups = alienfx_groups, }, + .probe = alienfx_probe, }; static int __init alienware_wmi_init(void) @@ -1217,16 +1237,8 @@ static int __init alienware_wmi_init(void) goto fail_prep_thermal_profile; } - if (quirks->num_zones > 0) { - ret = alienware_zone_init(platform_device); - if (ret) - goto fail_prep_zones; - } - return 0; -fail_prep_zones: - alienware_zone_exit(platform_device); fail_prep_thermal_profile: platform_device_del(platform_device); fail_platform_device2: @@ -1241,7 +1253,6 @@ module_init(alienware_wmi_init); static void __exit alienware_wmi_exit(void) { - alienware_zone_exit(platform_device); platform_device_unregister(platform_device); platform_driver_unregister(&platform_driver); } From patchwork Mon Jan 27 04:03:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950964 Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (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 D42C21FC10A; Mon, 27 Jan 2025 04:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950664; cv=none; b=iKFaJccZPNdzxTOm6lENq7rDA5VGwB52BTHsk0DX4Vsy4p8ib2drRcJuuxF2MFIVIDLPRJ6s64iKdkLJZl7CW8rVezlBaatl1fk5Fu7ARn7geUjVwiYEQuaqm2+xRV71hQbWzqPLC6CzMHBLILSC8ePRHfot2u2MbE+tfRmw9N0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950664; c=relaxed/simple; bh=Nz6ONgylnCGIumm6z4NqRWq+4jYKATzny4AQL2IHkts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qK+ArC5BYM+8cw92pqhZlKMV1ZJPmBHluO+QVu0WAYoo+kisQX++TTVUV7q8px5wR3nmWPsFT1suJ5MsI++onYFM4R+3R6wd69goxpMtI2AZowS+XDboZSrh3xKwXb/yta0L5Ywoiq0VnmXEYSG6db4EYHM6RpntwA3xG71PYns= 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=fE6mne9S; arc=none smtp.client-ip=209.85.222.51 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="fE6mne9S" Received: by mail-ua1-f51.google.com with SMTP id a1e0cc1a2514c-85c41442fdeso837794241.1; Sun, 26 Jan 2025 20:04:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950661; x=1738555461; 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=gjgDNchXmN6B6qa+3bHMzbtRh13rIGcqQh1ZeiaAbLE=; b=fE6mne9SaIGb3ylpKvqOvvD2HBWRNg4agJytGRpqkoY5hfNOHsRbBorPGn3b00rFlQ k/MuTawOK8BOYpAdnxsHvwAjIRfEX/lHLjebIGCROaeIjLBQCiEF8whiOd2LY+RxQyFb 8Frpa0Hws9XZEqJGBfuXvB1EaSBKHnyH5kWlfOM8pNEHmMpUs6jCqGRpAHhkvLpmfJlM CjYzEUQapYah3KeNXqf1RWny3JoBgxMFlIWdW9kSDnPckTQslc4K/Mn5VnpozDVr5V1T 1KYLCX0grABYrjEsMZz3L6BeMye3Qw8EHoICYyqSURZe3NA3uq98/B3FbxNtBHJhBZ/d NioA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950661; x=1738555461; 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=gjgDNchXmN6B6qa+3bHMzbtRh13rIGcqQh1ZeiaAbLE=; b=pxzzSmuee+3R90pixshquju9etoyGOctHCtlKSWjc1xMY9uS6LHDrtpYOVAuLgMj7o zQ5Uto+t067EMKb2D+KYvCegrc80eOxRTTBMEYnJXH69C17/h4FQa4bQVpM8HMyif1Mh kcCz+Nx23Xf71JxukQKTVMHQf+XXGbzpxrusxUP07dDcXYIl79M1ajvRkI38EJqqpCTs G/yBeHR4MDwunlRWGXELm0KHENUpoCK+tQxqQ4Fib2ZtDwNMsb4NVfzQs6rBFYPwzRlz eChntQ7IZoAwsTI2fpJ4YK4teuD27tAftp1W96rXaRKVZLNYXXxmzNZe+2GEJxiwoFHq 98Mg== X-Forwarded-Encrypted: i=1; AJvYcCVYZ+3rOynEZvEBMBpmuEQ6cntSChofteaioNnEyczxSK6zU+auWLLIPyc1a0a/fYTabk30IHtXeMZsGOk=@vger.kernel.org X-Gm-Message-State: AOJu0YwgE1YCmXh7IFqfUrlNjjPgH774BIhKMogzfFnkJ6KxofZYx+2l 3HCXbsqVFba26j9+6/yxlAkuBQ7xbEIIcGzSNLqzulv43jiylVdr3FL6wQ== X-Gm-Gg: ASbGncsK7keQA/0IaCZd52y3mbtW6dhiY8RieLjdGlhEp6HwR4jzxUvpwn9KghJkYgC PO2EilnmnQyU0SjVcBZ3HlR/y6dHpZOun4lPBFixA4rOtzUUyd84wKT/gZ3suSeRNIBJn0KBTgQ hmwFj3AEFNbZmw7n4+6vE+I/WpSVdsQF+th3Gkj4gcbAekI5kGcHTQEQ5VxtsAEPhGbymRQQ0fg GkgWEq1SAEJn1afdvOhPlSjHg0L56XKHcuwzpqfVBsagaxP9NMXWSGRc7W99EeytyMeH7Nq5+/h +pQ1B4BI9ib5 X-Google-Smtp-Source: AGHT+IHwhQ8FbGCKB+8Z4zwcomIlET1BYbMnq3EMhDYs9r365xANNRGKv50Qp29ArZZ1kHqt+s0sgQ== X-Received: by 2002:a05:6102:3e0a:b0:4b2:73f7:5adf with SMTP id ada2fe7eead31-4b690be5b36mr35024778137.9.1737950661058; Sun, 26 Jan 2025 20:04:21 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:20 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 02/14] platform/x86: alienware-wmi: Add WMI Drivers Date: Sun, 26 Jan 2025 23:03:54 -0500 Message-ID: <20250127040406.17112-3-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add WMI drivers for LEGACY and WMAX devices. This involves moving the platform device registration to a helper function that is now called from the driver's preferred WMI device driver probe. In the case of the WMAX this is done only if `!quirks->thermal` because the newer WMAX interface doesn't support any of the LED features of this driver. This also eliminates the need to check for `quirks->num_zones > 0` inside alienfx_probe(). Only one WMI driver is registered on module initialization to prevent registering a duplicate platform device. Additionally, create_thermal_profile() now takes wmi_device * instead of platform_device *. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 195 +++++++++++++++++----- 1 file changed, 156 insertions(+), 39 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index ab86deb1adb9..38a38fe394d3 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -15,6 +15,7 @@ #include #include #include +#include #define LEGACY_CONTROL_GUID "A90597CE-A997-11DA-B012-B622A1EF5492" #define LEGACY_POWER_CONTROL_GUID "A80593CE-A997-11DA-B012-B622A1EF5492" @@ -39,8 +40,6 @@ MODULE_AUTHOR("Mario Limonciello "); MODULE_DESCRIPTION("Alienware special feature control"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("wmi:" LEGACY_CONTROL_GUID); -MODULE_ALIAS("wmi:" WMAX_CONTROL_GUID); static bool force_platform_profile; module_param_unsafe(force_platform_profile, bool, 0); @@ -421,7 +420,10 @@ struct alienfx_priv { u8 lighting_control_state; }; -static struct platform_device *platform_device; +struct alienfx_platdata { + struct wmi_device *wdev; +}; + static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; static u8 interface; @@ -1136,11 +1138,11 @@ static const struct platform_profile_ops awcc_platform_profile_ops = { .profile_set = thermal_profile_set, }; -static int create_thermal_profile(struct platform_device *platform_device) +static int create_thermal_profile(struct wmi_device *wdev) { struct device *ppdev; - ppdev = devm_platform_profile_register(&platform_device->dev, "alienware-wmi", + ppdev = devm_platform_profile_register(&wdev->dev, "alienware-wmi", NULL, &awcc_platform_profile_ops); return PTR_ERR_OR_ZERO(ppdev); @@ -1153,9 +1155,6 @@ static int alienfx_probe(struct platform_device *pdev) { struct alienfx_priv *priv; - if (!quirks->num_zones) - return -ENODEV; - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -1178,6 +1177,10 @@ static int alienfx_probe(struct platform_device *pdev) static const struct attribute_group *alienfx_groups[] = { &zone_attribute_group, + NULL +}; + +static const struct attribute_group *wmax_alienfx_groups[] = { &hdmi_attribute_group, &lifier_attribute_group, &deepsleep_attribute_group, @@ -1192,18 +1195,140 @@ static struct platform_driver platform_driver = { .probe = alienfx_probe, }; -static int __init alienware_wmi_init(void) +static int alienware_alienfx_setup(struct alienfx_platdata *pdata) +{ + struct platform_device *pdev; + + pdev = platform_device_register_data(NULL, "alienware-wmi", + PLATFORM_DEVID_NONE, pdata, + sizeof(*pdata)); + + dev_set_drvdata(&pdata->wdev->dev, pdev); + + return PTR_ERR_OR_ZERO(pdev); +} + +static void alienware_alienfx_exit(struct wmi_device *wdev) +{ + struct platform_device *pdev = dev_get_drvdata(&wdev->dev); + + platform_device_unregister(pdev); +} + +/* + * Legacy WMI driver + */ +static int legacy_wmi_probe(struct wmi_device *wdev, const void *context) +{ + struct alienfx_platdata pdata = { + .wdev = wdev, + }; + + return alienware_alienfx_setup(&pdata); +} + +static void legacy_wmi_remove(struct wmi_device *wdev) +{ + alienware_alienfx_exit(wdev); +} + +static const struct wmi_device_id alienware_legacy_device_id_table[] = { + { LEGACY_CONTROL_GUID, NULL }, + { }, +}; +MODULE_DEVICE_TABLE(wmi, alienware_legacy_device_id_table); + +static struct wmi_driver alienware_legacy_wmi_driver = { + .driver = { + .name = "alienware-wmi-alienfx", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, + .id_table = alienware_legacy_device_id_table, + .probe = legacy_wmi_probe, + .remove = legacy_wmi_remove, + .no_singleton = true, +}; + +static int __init alienware_legacy_wmi_init(void) +{ + return wmi_driver_register(&alienware_legacy_wmi_driver); +} + +static void __exit alienware_legacy_wmi_exit(void) +{ + wmi_driver_unregister(&alienware_legacy_wmi_driver); +} + +/* + * WMAX WMI driver + */ +static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) { + struct alienfx_platdata pdata = { + .wdev = wdev, + }; + struct platform_device *pdev; int ret; - if (wmi_has_guid(LEGACY_CONTROL_GUID)) - interface = LEGACY; - else if (wmi_has_guid(WMAX_CONTROL_GUID)) - interface = WMAX; - else { - pr_warn("alienware-wmi: No known WMI GUID found\n"); - return -ENODEV; + if (quirks->thermal) { + return create_thermal_profile(wdev); + } else { + ret = alienware_alienfx_setup(&pdata); + if (ret < 0) + return ret; + + pdev = dev_get_drvdata(&wdev->dev); + + ret = device_add_groups(&pdev->dev, wmax_alienfx_groups); + if (ret < 0) + alienware_alienfx_exit(wdev); + + return ret; + } +} + +static void wmax_wmi_remove(struct wmi_device *wdev) +{ + struct platform_device *pdev; + + if (!quirks->thermal) { + pdev = dev_get_drvdata(&wdev->dev); + + device_remove_groups(&pdev->dev, wmax_alienfx_groups); + alienware_alienfx_exit(wdev); } +} + +static const struct wmi_device_id alienware_wmax_device_id_table[] = { + { WMAX_CONTROL_GUID, NULL }, + { }, +}; +MODULE_DEVICE_TABLE(wmi, alienware_wmax_device_id_table); + +static struct wmi_driver alienware_wmax_wmi_driver = { + .driver = { + .name = "alienware-wmi-wmax", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, + .id_table = alienware_wmax_device_id_table, + .probe = wmax_wmi_probe, + .remove = wmax_wmi_remove, + .no_singleton = true, +}; + +static int __init alienware_wmax_wmi_init(void) +{ + return wmi_driver_register(&alienware_wmax_wmi_driver); +} + +static void __exit alienware_wmax_wmi_exit(void) +{ + wmi_driver_unregister(&alienware_wmax_wmi_driver); +} + +static int __init alienware_wmi_init(void) +{ + int ret; dmi_check_system(alienware_quirks); if (quirks == NULL) @@ -1220,32 +1345,20 @@ static int __init alienware_wmi_init(void) } ret = platform_driver_register(&platform_driver); - if (ret) - goto fail_platform_driver; - platform_device = platform_device_alloc("alienware-wmi", PLATFORM_DEVID_NONE); - if (!platform_device) { - ret = -ENOMEM; - goto fail_platform_device1; - } - ret = platform_device_add(platform_device); - if (ret) - goto fail_platform_device2; + if (ret < 0) + return ret; - if (quirks->thermal) { - ret = create_thermal_profile(platform_device); - if (ret) - goto fail_prep_thermal_profile; + if (wmi_has_guid(WMAX_CONTROL_GUID)) { + interface = WMAX; + ret = alienware_wmax_wmi_init(); + } else { + interface = LEGACY; + ret = alienware_legacy_wmi_init(); } - return 0; + if (ret < 0) + platform_driver_unregister(&platform_driver); -fail_prep_thermal_profile: - platform_device_del(platform_device); -fail_platform_device2: - platform_device_put(platform_device); -fail_platform_device1: - platform_driver_unregister(&platform_driver); -fail_platform_driver: return ret; } @@ -1253,7 +1366,11 @@ module_init(alienware_wmi_init); static void __exit alienware_wmi_exit(void) { - platform_device_unregister(platform_device); + if (interface == WMAX) + alienware_wmax_wmi_exit(); + else + alienware_legacy_wmi_exit(); + platform_driver_unregister(&platform_driver); } From patchwork Mon Jan 27 04:03:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950965 Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) (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 D125F1FC7C1; Mon, 27 Jan 2025 04:04:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950666; cv=none; b=O6+AsEparsK//Pjs+4dA8nr2WzHvLuxHWJK3m8Z/3hg3B5XKNPu20XmPD8+fmOGEpfQU2vrvEy+P6r/2N+chf8IvPP4uy+ykbfeSEAQvJcXUmB21jthxcnfEoFMt+fkHpQI7iQ593H5/4up1bL+ijafF6Gce5LdU7z6lqqR+xXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950666; c=relaxed/simple; bh=PNVw4WDB5Kus9UjJkOcqQoGFifJvtrY8nkTaBgXOTWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VqgNjDCqKhibHKrf7z0wn5i5ttaNhtfOv1vY/9OTh8e4MMvr+j0P2lE08SfDJCw5o00Hpyivzl0vi2oGn4rWZ8fdN5DQW0tC5yTIO1hKMcCzbSTssU9d9DNC1Fn3p6B8PwBoX7+XCIEqLxNAD38e6MJpGDj16zP/AoVAocl21l8= 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=a2fVuTUm; arc=none smtp.client-ip=209.85.222.41 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="a2fVuTUm" Received: by mail-ua1-f41.google.com with SMTP id a1e0cc1a2514c-85c662ebbc3so697515241.0; Sun, 26 Jan 2025 20:04:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950663; x=1738555463; 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=eyw0MjsuanNO/4ipodD4xIuZ3tGVBj0Xv2kwkS6ypaE=; b=a2fVuTUmhTMBxgw6HhtMdOGQCAM2q0unymf02wfIFLxHNB4Gns/AmP48oJhHVku1SU SvoOE8EH+Pz5Pv8OnXMnDXPrSlkDVntdfs/Jj64QaIi67SVQ/q3YsV8aGvHFJMBEI4oU bCpNrbkMv4sBK0IH8CuHszqzccaT4FsC3e+OhJObV8WKepNSNG1PkCO9V5BPLHFYhV3J vW/Ov9QVCQGjiGuZyYfcs+8xv/HKkUopFpFAK7Tl/Gp/U9N846Yqg78EUWDLQ93mLxMS D/eEn+Wj3uzC0d4XbgpdIB14kwFIf5By2+TZDx4NcSlcBkXLHmm5oz7c6hGP8qGyIXq3 GtPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950663; x=1738555463; 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=eyw0MjsuanNO/4ipodD4xIuZ3tGVBj0Xv2kwkS6ypaE=; b=CBi42i6QXpmJ2PHC9p3n3+t1QKNHnEP66VENSEjygwn3RIY66MJ0c5qyLefkEV/QLn oBFIlbIDFOHEzn8J7iCu4hCxVeObLrF/Lv2K/sL2Voyx67tzNwNDabBf8RVXxhM1Zxs6 FLZaGO5MYj7aQjT2OQtoiH8xR7HXw2+A4Ovxdy3tgLLzcNjSWMhBqGaWbclDXmaYS9hg IDhJLYf8/oPXVlrDYWT8kUrj9bMeGrLeyQ0Ij2MB17rKxT7dFZ1a+8OVTLNOXXXMs+uB XwU5mQxu85x1UNIMnvOJqCn6NAriNtIiLnG+GFGF4OCishO8sYIsBBnmzs48AufVTXfa hAKA== X-Forwarded-Encrypted: i=1; AJvYcCVgb6Ps6id7jCULZf2qF/uNiCmhACc9MCC4HRzFOVorp4q12gX1GCa+mtFKVHM1Jg2MERmcGR8IzGka1r4=@vger.kernel.org X-Gm-Message-State: AOJu0YznliyzPubegYLmwVCecKi8OlWA910U965N7ltn3/qHB6MunSD3 Qh0BCan8cVfR5iroN3wIu5ccRbnbF7Ha/9npd4JY5id7B+FKfmOZmQ27sQ== X-Gm-Gg: ASbGncuy7G9QXAhXgldnKeTrM+L7BzjRCh3gHzAais0SD1CuySB1EI6lddAmkcGhjD0 U7Qy/Lo2aJj23RaKcwrb/sMcwBwZH3TZTTCyDnm+yn9ekgwXoxejp4bhVhrd02nT/QG7PpMOJNj P/dL1/DJ37Ct4wDWgZWknv2G30NyVY/yXOyTCvvq5yNkcDtHAF3NS0d5QhGXBiK7QTXn0UsHNBf MXmoYSl9WR5tiuCa9JgWe/cwpMCCljRxCpz+6/qPWTbuXxWbTeCVrwMJK0yrktwuEwh1Tc1w70p +ItvAsGgF4pt X-Google-Smtp-Source: AGHT+IFl+1KG9wF1uiG4ed0L75VKl+0vAom6VORmZE9jm7pf7NgiJF1WT+GiFQSKL/+UZ2wdk7tWQQ== X-Received: by 2002:a05:6102:38c8:b0:4b2:cc94:1877 with SMTP id ada2fe7eead31-4b690be5571mr30563514137.13.1737950663116; Sun, 26 Jan 2025 20:04:23 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:22 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 03/14] platform/x86: alienware-wmi: Add a state container for thermal control methods Date: Sun, 26 Jan 2025 23:03:55 -0500 Message-ID: <20250127040406.17112-4-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Refactor all thermal control methods to use the newly defined awcc_priv state container instead of global variables. While at it, rename create_thermal_profile to alienware_awcc_setup and use it to set up the WMI device "awcc" driver data. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 38a38fe394d3..b681b86e3894 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -412,6 +412,12 @@ struct wmax_u32_args { u8 arg3; }; +struct awcc_priv { + struct wmi_device *wdev; + struct device *ppdev; + enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; +}; + struct alienfx_priv { struct platform_device *pdev; struct led_classdev global_led; @@ -424,8 +430,6 @@ struct alienfx_platdata { struct wmi_device *wdev; }; -static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; - static u8 interface; /* @@ -1060,6 +1064,8 @@ static int thermal_profile_get(struct device *dev, static int thermal_profile_set(struct device *dev, enum platform_profile_option profile) { + struct awcc_priv *priv = dev_get_drvdata(dev); + if (quirks->gmode) { u32 gmode_status; int ret; @@ -1080,12 +1086,13 @@ static int thermal_profile_set(struct device *dev, } } - return wmax_thermal_control(supported_thermal_profiles[profile]); + return wmax_thermal_control(priv->supported_thermal_profiles[profile]); } static int thermal_profile_probe(void *drvdata, unsigned long *choices) { enum platform_profile_option profile; + struct awcc_priv *priv = drvdata; enum wmax_thermal_mode mode; u8 sys_desc[4]; u32 first_mode; @@ -1114,7 +1121,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) mode = out_data & WMAX_THERMAL_MODE_MASK; profile = wmax_mode_to_platform_profile[mode]; - supported_thermal_profiles[profile] = out_data; + priv->supported_thermal_profiles[profile] = out_data; set_bit(profile, choices); } @@ -1123,7 +1130,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) return -ENODEV; if (quirks->gmode) { - supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = + priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = WMAX_THERMAL_MODE_GMODE; set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); @@ -1138,14 +1145,21 @@ static const struct platform_profile_ops awcc_platform_profile_ops = { .profile_set = thermal_profile_set, }; -static int create_thermal_profile(struct wmi_device *wdev) +static int alienware_awcc_setup(struct wmi_device *wdev) { - struct device *ppdev; + struct awcc_priv *priv; + + priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->wdev = wdev; + dev_set_drvdata(&wdev->dev, priv); - ppdev = devm_platform_profile_register(&wdev->dev, "alienware-wmi", - NULL, &awcc_platform_profile_ops); + priv->ppdev = devm_platform_profile_register(&wdev->dev, "alienware-wmi", + priv, &awcc_platform_profile_ops); - return PTR_ERR_OR_ZERO(ppdev); + return PTR_ERR_OR_ZERO(priv->ppdev); } /* @@ -1271,7 +1285,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) int ret; if (quirks->thermal) { - return create_thermal_profile(wdev); + return alienware_awcc_setup(wdev); } else { ret = alienware_alienfx_setup(&pdata); if (ret < 0) From patchwork Mon Jan 27 04:03:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950966 Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (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 3262C1FC7E4; Mon, 27 Jan 2025 04:04:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950669; cv=none; b=gSWx24/d60RGGVZMkt2eNs72HLGtc/eDm8PuOmLmt3dqE1IOHFkHBkILFEABszBl7ca+FeZYpDx+Mw1iizplKBf6CWrUMt23TNRYIEoBbaCX9L+lwR3WW04icNzAVwHryaQX72BHxO8PbrMsBke07WsedMAQWH+ui4v5KC1yQvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950669; c=relaxed/simple; bh=ZIzW+htGWGosViRTAiyRFL5GGFpNgaomx5pjZPEFkg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AK9+T7OxntWwZjTNo/f3h4/g6DA7XJ8FNc4EABh89r93WCBebSh0T3R0+T33eGfJVwB1DhMDBHyqv85XB00iZIkE05WExvSYliW1j1TjSm/GWu5FJjGwr4k76wfUNb42gkPiEPcZ1TIS6PprHS4b+W11k6bKLL01T/4GOElr3p4= 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=jEWddxsY; arc=none smtp.client-ip=209.85.217.54 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="jEWddxsY" Received: by mail-vs1-f54.google.com with SMTP id ada2fe7eead31-4b24bc0cc65so2497022137.2; Sun, 26 Jan 2025 20:04:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950665; x=1738555465; 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=9H0HNusswph+vw18OEfCZzKqgd39+ujZYdZ5oQgL4ls=; b=jEWddxsYwS+Kz7N0EPyZd7oGdzzv2AXiE3HEPfZ3YbzI/o6e7RBhr3D39rAFv4Q/VX /7x6jGLQ8v3WrVqBqoIfNtHENsYZsyKi+2A1R3W0Q0D2DeKnST9zzUTvo07F3F9Enhsj EVC4yPIms2Y5wOK3ROfXoKN4AnsiZDf1mmYOeahPmJqfdKqTAh9qJBmftAmvPIUCJXlJ 35JwhAqGGHr/MQvW0fIzvBoBI7KdNw7ohY2LpVJqZ6ZUXN2ORJTGjWIpb93ChgGEh5OC Y2AtROST5sJnHY06rTWXhXxxhkPp/9kbIES/94BYGcLA9Ivv9nEqreHccsscvAMxuBkS FXNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950665; x=1738555465; 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=9H0HNusswph+vw18OEfCZzKqgd39+ujZYdZ5oQgL4ls=; b=e4TWnM75l+v1xCD6A2ns0bbMNS0Xf0bgIFeUCv6B8ykABcjA1pMzPaoWDQnM1A3GgS kyFnH71xAGWwMq9ozc3gt3khaagcVaYzkR8cRXdnvC18pJVMGDFu3wxYMfrkZ+L/6bX7 SYToMlCJCjEApn4Oyax3QV74jpLK5AYeWcrrbln6LKhe2egz1b2vw8/d95qLAGFTFY78 G3mlh/FPcSBuxpI4cKzb2n5eT0LHuYY+KIdercGQowNKIKAzWT+T1tP8y/6tFE9nmagE ahLRWQa8O0PZacyb7UOK6dO3L4Hy9cMBPBb61LXYKkPKt4kTcCnnYAnW7kNwJ0HvZI3m xUoA== X-Forwarded-Encrypted: i=1; AJvYcCUTsyxH0tnUA6BJP+g6jcRl75j5uXZ40mI5hv9pXwOe/2dMJhKUssdOx18q+Ku8VnYoBloXHVaThIW5q/w=@vger.kernel.org X-Gm-Message-State: AOJu0YzreqbB+kl/yCGPLv4XLW7PmyFb2RS+bGkjvToT+boOtkwLiEtN a7nox3LZU1c6XSAVnHVBehrfQ8x0L8Cnj4Zq6dp9FmK+zDdB4Kd9d2iM/g== X-Gm-Gg: ASbGnct16gY6vaPVF5ESHJzhZBv/JYxCqJeCihUWG8/dhx3CQruKXZO0j9sZmslyrUB HJ/57KToLEpZwLBRkWG3GVHxLEN8ic2kiIOyTfcy7WI87q5eqAd/d2qU0YLQO6jM46lFwz+xPZ1 yGVcXa9IvFXMu8S47i5aJMljrp1or8kKdA3iV+34JRBMJJMPzB8otpf8HWvOa/bQGpT0yzx52vJ zp2vl+amnGkZhrSJ2Gf5mjZj8w+kSLL0va/ivJqc4Ed448CK17OnLbyHfitVdmKErtwRf0YmiWZ NyAc2tD8guKldf0qOSmwjlM= X-Google-Smtp-Source: AGHT+IGvT6vgPRy+XQ0ulw9Q4RY4jLRoADNqlLxIpS+D3EqAGowd6d7MBUxjpHLCJHXbuDSn0gXaLQ== X-Received: by 2002:a05:6102:c04:b0:4b6:d108:cac0 with SMTP id ada2fe7eead31-4b6d108ce5dmr26549009137.3.1737950665529; Sun, 26 Jan 2025 20:04:25 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:24 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 04/14] platform/x86: alienware-wmi: Refactor LED control methods Date: Sun, 26 Jan 2025 23:03:56 -0500 Message-ID: <20250127040406.17112-5-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Both WMI devices handled by this module specify a distinct interface for LED control. Previously this module handled this by dynamically adapting arguments passed to wmi_evaluate_method() based on the `interface` global variable. To avoid the use of global variables, and enable the migration to non-deprecated WMI methods, let the WMI drivers define upd_led and upd_brightness operations, which completely replace alienware_update_led() and wmax_brightness(). Also define alienware_wmi_command(), which serves as a wrapper for wmidev_evaluate_method(). This new method is very similar to alienware_wmax_command() but is WMI device agnostic. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 166 ++++++++++++++-------- 1 file changed, 104 insertions(+), 62 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index b681b86e3894..a5f590da139e 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -426,12 +427,43 @@ struct alienfx_priv { u8 lighting_control_state; }; +struct alienfx_ops { + int (*upd_led)(struct alienfx_priv *priv, struct wmi_device *wdev, + u8 location); + int (*upd_brightness)(struct alienfx_priv *priv, struct wmi_device *wdev, + u8 brightness); +}; + struct alienfx_platdata { struct wmi_device *wdev; + struct alienfx_ops ops; }; static u8 interface; +static int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, + void *in_args, size_t in_size, u32 *out_data) +{ + struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; + struct acpi_buffer in = {in_size, in_args}; + acpi_status ret; + + ret = wmidev_evaluate_method(wdev, 0, method_id, &in, out_data ? &out : NULL); + if (ACPI_FAILURE(ret)) + return -EIO; + + union acpi_object *obj __free(kfree) = out.pointer; + + if (out_data) { + if (obj && obj->type == ACPI_TYPE_INTEGER) + *out_data = (u32)obj->integer.value; + else + return -ENOMSG; + } + + return 0; +} + /* * Helpers used for zone control */ @@ -462,46 +494,6 @@ static int parse_rgb(const char *buf, struct color_platform *colors) /* * Individual RGB zone control */ -static int alienware_update_led(struct alienfx_priv *priv, u8 location) -{ - int method_id; - acpi_status status; - char *guid; - struct acpi_buffer input; - struct legacy_led_args legacy_args; - struct wmax_led_args wmax_basic_args; - if (interface == WMAX) { - wmax_basic_args.led_mask = 1 << location; - wmax_basic_args.colors = priv->colors[location]; - wmax_basic_args.state = priv->lighting_control_state; - guid = WMAX_CONTROL_GUID; - method_id = WMAX_METHOD_ZONE_CONTROL; - - input.length = sizeof(wmax_basic_args); - input.pointer = &wmax_basic_args; - } else { - legacy_args.colors = priv->colors[location]; - legacy_args.brightness = priv->global_brightness; - legacy_args.state = 0; - if (priv->lighting_control_state == LEGACY_BOOTING || - priv->lighting_control_state == LEGACY_SUSPEND) { - guid = LEGACY_POWER_CONTROL_GUID; - legacy_args.state = priv->lighting_control_state; - } else - guid = LEGACY_CONTROL_GUID; - method_id = location + 1; - - input.length = sizeof(legacy_args); - input.pointer = &legacy_args; - } - pr_debug("alienware-wmi: guid %s method %d\n", guid, method_id); - - status = wmi_evaluate_method(guid, 0, method_id, &input, NULL); - if (ACPI_FAILURE(status)) - pr_err("alienware-wmi: zone set failure: %u\n", status); - return ACPI_FAILURE(status); -} - static ssize_t zone_show(struct device *dev, struct device_attribute *attr, char *buf, u8 location) { @@ -518,13 +510,14 @@ static ssize_t zone_store(struct device *dev, struct device_attribute *attr, { struct alienfx_priv *priv = dev_get_drvdata(dev); struct color_platform *colors = &priv->colors[location]; + struct alienfx_platdata *pdata = dev_get_platdata(dev); int ret; ret = parse_rgb(buf, colors); if (ret) return ret; - ret = alienware_update_led(priv, location); + ret = pdata->ops.upd_led(priv, pdata->wdev, location); return ret ? ret : count; } @@ -660,36 +653,17 @@ static struct attribute_group zone_attribute_group = { /* * LED Brightness (Global) */ -static int wmax_brightness(int brightness) -{ - acpi_status status; - struct acpi_buffer input; - struct wmax_brightness_args args = { - .led_mask = 0xFF, - .percentage = brightness, - }; - input.length = sizeof(args); - input.pointer = &args; - status = wmi_evaluate_method(WMAX_CONTROL_GUID, 0, - WMAX_METHOD_BRIGHTNESS, &input, NULL); - if (ACPI_FAILURE(status)) - pr_err("alienware-wmi: brightness set failure: %u\n", status); - return ACPI_FAILURE(status); -} - static void global_led_set(struct led_classdev *led_cdev, enum led_brightness brightness) { struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, global_led); + struct alienfx_platdata *pdata = dev_get_platdata(&priv->pdev->dev); int ret; priv->global_brightness = brightness; - if (interface == WMAX) - ret = wmax_brightness(brightness); - else - ret = alienware_update_led(priv, 0); + ret = pdata->ops.upd_brightness(priv, pdata->wdev, brightness); if (ret) pr_err("LED brightness update failed\n"); } @@ -1232,10 +1206,49 @@ static void alienware_alienfx_exit(struct wmi_device *wdev) /* * Legacy WMI driver */ +static int legacy_wmi_update_led(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 location) +{ + struct legacy_led_args legacy_args = { + .colors = priv->colors[location], + .brightness = priv->global_brightness, + .state = 0, + }; + struct acpi_buffer input; + acpi_status status; + + if (legacy_args.state != LEGACY_RUNNING) { + legacy_args.state = priv->lighting_control_state; + + input.length = sizeof(legacy_args); + input.pointer = &legacy_args; + + status = wmi_evaluate_method(LEGACY_POWER_CONTROL_GUID, 0, + location + 1, &input, NULL); + if (ACPI_FAILURE(status)) + return -EIO; + + return 0; + } + + return alienware_wmi_command(wdev, location + 1, &legacy_args, + sizeof(legacy_args), NULL); +} + +static int legacy_wmi_update_brightness(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 brightness) +{ + return legacy_wmi_update_led(priv, wdev, 0); +} + static int legacy_wmi_probe(struct wmi_device *wdev, const void *context) { struct alienfx_platdata pdata = { .wdev = wdev, + .ops = { + .upd_led = legacy_wmi_update_led, + .upd_brightness = legacy_wmi_update_brightness, + }, }; return alienware_alienfx_setup(&pdata); @@ -1276,10 +1289,39 @@ static void __exit alienware_legacy_wmi_exit(void) /* * WMAX WMI driver */ +static int wmax_wmi_update_led(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 location) +{ + struct wmax_led_args in_args = { + .led_mask = 1 << location, + .colors = priv->colors[location], + .state = priv->lighting_control_state, + }; + + return alienware_wmi_command(wdev, WMAX_METHOD_ZONE_CONTROL, &in_args, + sizeof(in_args), NULL); +} + +static int wmax_wmi_update_brightness(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 brightness) +{ + struct wmax_brightness_args in_args = { + .led_mask = 0xFF, + .percentage = brightness, + }; + + return alienware_wmi_command(wdev, WMAX_METHOD_BRIGHTNESS, &in_args, + sizeof(in_args), NULL); +} + static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) { struct alienfx_platdata pdata = { .wdev = wdev, + .ops = { + .upd_led = wmax_wmi_update_led, + .upd_brightness = wmax_wmi_update_brightness, + }, }; struct platform_device *pdev; int ret; From patchwork Mon Jan 27 04:03:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950967 Received: from mail-vk1-f169.google.com (mail-vk1-f169.google.com [209.85.221.169]) (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 36B721FCCE5; Mon, 27 Jan 2025 04:04:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950670; cv=none; b=FgflvICo4TPzJWBUY0zeQxCbPNh/dBAyOrIJOf/rDwV4eO0x4rwVEla6bmvS3ElnROj+QExu6LdhAZDp8LhSnzbfDTeaXRbMZa21wcw/5YfFisest15/HamXlq9Sf0nN/LqNTH7vylgoeNRG29bB9jLgrhCKV6ZT0Rzy+8r9nqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950670; c=relaxed/simple; bh=aQLG0wkuHp3eXocBdS2uPmlIqn4PWip5uetlPv/aKCk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e5xID2YcWanTx+IRexcFq5EPRGZ5/4GRmG2ksM0jC6aVzK58enfxC98h30Dbnnn1iphrWxSVad7wgRHrCjq0yBuDPmJ1G0S7/YLZ85NYzr+sYhwZZy7qW2+shEZtGZgQO13GKuzMp0prkQNMQYuolFZYWSzAjjTEIKUkglLKwL4= 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=BnxnIM3i; arc=none smtp.client-ip=209.85.221.169 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="BnxnIM3i" Received: by mail-vk1-f169.google.com with SMTP id 71dfb90a1353d-5160f80e652so859848e0c.2; Sun, 26 Jan 2025 20:04:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950667; x=1738555467; 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=UYft7D9TYZIhx2HBZ6gkGmN/HUtqHozJ2B8OWTqBby0=; b=BnxnIM3iHdLquqD8L6Jsd+yJkD1O7gKc3ws2pdPwVxnTRzoF9lwRxLuLLi8GMOwrie SUfMCu5RkDfsRou+82yMxClhh+wEwxOfOOA4oEv/yCPlYko5xFhnzgrPDIdZ5N6HiUOx ackLUx3u/Cc84rtPxZr59KClzceg0ZgV5hq2DfomXIj/fUEBrYdq8dGjBGvprZX41sim BuCxXddUgz8kzOG31UKWnJxXdaPKZzzAGI63fUYuBIWgNnOWwAcXvDu1ajk1xUbuik5b ZZO0ZD3a+W8cx6Epq7Z7L9wPpo9ru3+Zk9H9YL1SfHpUCqiSyygyGc7F0/xA4tKMVy5/ 1Pqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950667; x=1738555467; 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=UYft7D9TYZIhx2HBZ6gkGmN/HUtqHozJ2B8OWTqBby0=; b=fFTHpQmfhWq/jqRW2QOKUjR34Oe37fAWyYGAZsdZEzoyzBY73GRD5+zonooiRLeGrO 3BF+e1JL7D+7Gp8Daox7eB0qtbr6Li1xJnST/SIVMKHiJ2jYd8lU4HEWDn4TOvMPUYzs uo363xNjH24FzCs4Ptf1XGCBBS3JnoWbQqeByFrHJrg/g0DFe6bz1N75uHzDquZleSv5 rqisNsRNsQD5Sk/TpGkL3DuZ2cfbJNRetQoBXsqPbaXq4x+Hh8J8fAuSqm3VsLHyBXME SMzKFjOyJrrx9Qd+fXjSbqt9YN3wjkL+FuZNjX5TDBHsto/LIb7t1B3KwV4EsGMq6los 0Nnw== X-Forwarded-Encrypted: i=1; AJvYcCX3obYVkEO4otC0h/Dn24s7K1GPZwKUUsGPncD5TxeXe4hH3fblb92aZY9bRp6DKF1u0hUBv/ymAtchoxo=@vger.kernel.org X-Gm-Message-State: AOJu0YwKb6bB+3XmaZBYYZPLyJIwvDsINmUW00Oe7QXZvpbSTq9EVrJS vBu5hP0fXTdmrE5FY78E2+ojW7jJw5v0PrmoW445h5MV0rhwrLSaKcUcyQ== X-Gm-Gg: ASbGncuZEhW0t3tIr7KkDz9TgZdHE3e9PVRthcKJ98jk/Fb0+i02xzvQe2j4ShQBxdL 7KFI9a5OL5S5eEYa1mzMQgTUhATgtU5TRKiKdWGltsZw0FbFUk67t6vKSt1pfQaUw6DZazXP5Ny ozBL2C3zYPECpNbNSDnhOPkwwvWP/KNutIfqXHfJ42aAvhy/7JL73DTOAtu5H+CTxg0a8tShX0l /tbAhMW7HjE+MfljV7zamdMe9dRX4gs82UL2pUwdTASuMOOAZI6MhxkuJucPu4kXTjVq1/l+Zzh Ond5NRF5YKsO X-Google-Smtp-Source: AGHT+IHBo3E78cJiRAMGrH3Zq+XSg1NtmB/aA8OxB3PRkXzfxzDGk6WvGiQ85CFMQLAQlgzINsvtxA== X-Received: by 2002:a05:6102:c52:b0:4af:c519:4e86 with SMTP id ada2fe7eead31-4b690b988b7mr30890647137.1.1737950667485; Sun, 26 Jan 2025 20:04:27 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:27 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods Date: Sun, 26 Jan 2025 23:03:57 -0500 Message-ID: <20250127040406.17112-6-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Refactor show/store methods for hdmi, amplifier, deepslp sysfs groups to use alienware_wmi_command() instead of alienware_wmax_command() which uses deprecated WMI methods. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 80 +++++++++++++---------- 1 file changed, 45 insertions(+), 35 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index a5f590da139e..cfdd9c1cfebf 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -711,53 +711,57 @@ static acpi_status alienware_wmax_command(void *in_args, size_t in_size, static ssize_t cable_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct alienfx_platdata *pdata = dev_get_platdata(dev); struct wmax_basic_args in_args = { .arg = 0, }; - acpi_status status; u32 out_data; + int ret; + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_CABLE, + &in_args, sizeof(in_args), &out_data); - status = - alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_HDMI_CABLE, &out_data); - if (ACPI_SUCCESS(status)) { + if (!ret) { if (out_data == 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); else if (out_data == 1) return sysfs_emit(buf, "unconnected [connected] unknown\n"); } - pr_err("alienware-wmi: unknown HDMI cable status: %d\n", status); + + pr_err("alienware-wmi: unknown HDMI cable status: %d\n", ret); return sysfs_emit(buf, "unconnected connected [unknown]\n"); } static ssize_t source_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct alienfx_platdata *pdata = dev_get_platdata(dev); struct wmax_basic_args in_args = { .arg = 0, }; - acpi_status status; u32 out_data; + int ret; - status = - alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_HDMI_STATUS, &out_data); + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_STATUS, + &in_args, sizeof(in_args), &out_data); - if (ACPI_SUCCESS(status)) { + if (!ret) { if (out_data == 1) return sysfs_emit(buf, "[input] gpu unknown\n"); else if (out_data == 2) return sysfs_emit(buf, "input [gpu] unknown\n"); } - pr_err("alienware-wmi: unknown HDMI source status: %u\n", status); + + pr_err("alienware-wmi: unknown HDMI source status: %u\n", ret); return sysfs_emit(buf, "input gpu [unknown]\n"); } static ssize_t source_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + struct alienfx_platdata *pdata = dev_get_platdata(dev); struct wmax_basic_args args; - acpi_status status; + int ret; if (strcmp(buf, "gpu\n") == 0) args.arg = 1; @@ -767,12 +771,12 @@ static ssize_t source_store(struct device *dev, struct device_attribute *attr, args.arg = 3; pr_debug("alienware-wmi: setting hdmi to %d : %s", args.arg, buf); - status = alienware_wmax_command(&args, sizeof(args), - WMAX_METHOD_HDMI_SOURCE, NULL); + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_SOURCE, &args, + sizeof(args), NULL); + + if (ret < 0) + pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", ret); - if (ACPI_FAILURE(status)) - pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", - status); return count; } @@ -805,22 +809,24 @@ static const struct attribute_group hdmi_attribute_group = { static ssize_t status_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct alienfx_platdata *pdata = dev_get_platdata(dev); struct wmax_basic_args in_args = { .arg = 0, }; - acpi_status status; u32 out_data; + int ret; - status = - alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_AMPLIFIER_CABLE, &out_data); - if (ACPI_SUCCESS(status)) { + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_AMPLIFIER_CABLE, + &in_args, sizeof(in_args), &out_data); + + if (!ret) { if (out_data == 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); else if (out_data == 1) return sysfs_emit(buf, "unconnected [connected] unknown\n"); } - pr_err("alienware-wmi: unknown amplifier cable status: %d\n", status); + + pr_err("alienware-wmi: unknown amplifier cable status: %d\n", ret); return sysfs_emit(buf, "unconnected connected [unknown]\n"); } @@ -850,15 +856,17 @@ static const struct attribute_group amplifier_attribute_group = { static ssize_t deepsleep_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct alienfx_platdata *pdata = dev_get_platdata(dev); struct wmax_basic_args in_args = { .arg = 0, }; - acpi_status status; u32 out_data; + int ret; - status = alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_DEEP_SLEEP_STATUS, &out_data); - if (ACPI_SUCCESS(status)) { + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_DEEP_SLEEP_STATUS, + &in_args, sizeof(in_args), &out_data); + + if (!ret) { if (out_data == 0) return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); else if (out_data == 1) @@ -866,15 +874,17 @@ static ssize_t deepsleep_show(struct device *dev, struct device_attribute *attr, else if (out_data == 2) return sysfs_emit(buf, "disabled s5 [s5_s4]\n"); } - pr_err("alienware-wmi: unknown deep sleep status: %d\n", status); + + pr_err("alienware-wmi: unknown deep sleep status: %d\n", ret); return sysfs_emit(buf, "disabled s5 s5_s4 [unknown]\n"); } static ssize_t deepsleep_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + struct alienfx_platdata *pdata = dev_get_platdata(dev); struct wmax_basic_args args; - acpi_status status; + int ret; if (strcmp(buf, "disabled\n") == 0) args.arg = 0; @@ -884,12 +894,12 @@ static ssize_t deepsleep_store(struct device *dev, struct device_attribute *attr args.arg = 2; pr_debug("alienware-wmi: setting deep sleep to %d : %s", args.arg, buf); - status = alienware_wmax_command(&args, sizeof(args), - WMAX_METHOD_DEEP_SLEEP_CONTROL, NULL); + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_DEEP_SLEEP_CONTROL, + &args, sizeof(args), NULL); + + if (!ret) + pr_err("alienware-wmi: deep sleep control failed: results: %u\n", ret); - if (ACPI_FAILURE(status)) - pr_err("alienware-wmi: deep sleep control failed: results: %u\n", - status); return count; } From patchwork Mon Jan 27 04:03:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950968 Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (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 B3F101FCD0F; Mon, 27 Jan 2025 04:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950674; cv=none; b=rh+rjOmgzKYAnpl5zAZx5+Uxa53Byf7pmsxC9rZGZUQFWLZU8hkwhRI4nP9jqJKaDPuE+b+IzrDAQAkp2ryckNbkf+yIMb2k1ehxQtb+NLTfVd1X7AuBMs+wvsc2Y6TE8EXFzqZwVsrdNovSzNHDUKZ+IeMx2WGI5+IDnoLuVWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950674; c=relaxed/simple; bh=fHI4m/Oje8Ryria7VccWqLnfvI9YVfJmZg77Dtbl1Zs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UpjzKmVyBbBSGG20b/cHknQEoa3VU+fzGkHXY2uc4SFu2Li7CsIpiwC7e9NSAidmcubSnOR+h+HHcS5vJKPRyamNCpLBgqQlq3i5e7piqyjWLeJtpu+TZumJn3tP9DrzyWx0U90sB9Rqa2UFGQmQS9H/aXyEa9qMQs19ui5xywg= 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=HGrzpBRC; arc=none smtp.client-ip=209.85.222.54 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="HGrzpBRC" Received: by mail-ua1-f54.google.com with SMTP id a1e0cc1a2514c-85b83479f45so720355241.0; Sun, 26 Jan 2025 20:04:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950670; x=1738555470; 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=pAWB5RQklM3C2ywwTH+XmhIc6sj+0+mcpfjHWcxM4BA=; b=HGrzpBRCs40kpuJrZdyh6wGTBood3gSICpBX6XuyeUjH0N21W7hKAwpPW3QwMA+dVt iyOLpNaFoHsehx/RfvFDKzESs/1aOBhEnvdLODmfqzvs5rBJzQjvMfxxDL4PJBVH9/xX ysCgzq1gFEER2xxsBztbBTMc1Gt9BeRaVyqvKpafaFH7lma4+nIk/HrCQzwdceCzpHMx Si1wyZj+eBYYHeEHp6F0pg5umW5IhfxHb7ebyQFno6YNvMUJaK5E8eJDWa9wU6Z1i+Dk TFvVUs3wCL85hmIEdibgeBfFnMacc4YZcQvLCr+S2VSAt+ceFq2rrolmswLKX+peZnBT zoYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950670; x=1738555470; 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=pAWB5RQklM3C2ywwTH+XmhIc6sj+0+mcpfjHWcxM4BA=; b=IOfQkbxrWGk7TDmfgrBK/YCSIKEpqYg5sl2pT6xdY/esbSwbR3kidf/jnCzaBS0rsP o7feDOwkPPX9eXWl5th9JOnSlfowNlySSgKoeYsSchEs999ureTVs+V4Ne2NpwCsglYn aTsk+u/JPHaYMd9p+x15fSnkOAKwOj5UBau8nUh1+CR0KRhTA+F0hlIl+9Ladm39eMJA rRzRNdzct6XSHWZEP4VcX4IMDTIqUfQSh0LrHIO7w2yvaayrLjhkuvpIYtpjEFDfhzWx OYo3am+LqPkCB/baWnpRriWGLD7+IZkGE8bGUaiRvof1l7SW9borrfsCv4qNKy8R8uLl eoDg== X-Forwarded-Encrypted: i=1; AJvYcCVt4UxLocm8R9nwPGg0MduTBV0BxA/uu+W+4/oT2MnF2dNqoHqJKEaDu7o4b8ahcPnplrgESSjf/nw6KyA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2KNAVfEUmjf0gF0cAHY12M06tBRuTAVVeqzPGG3S9TZTjz972 8zXT8IOEVcfIwWZ2mH4vfh3QqKgEYVZkMC5s2srYkAf61XIkzb6tZ4syNw== X-Gm-Gg: ASbGnctAA5bWP0QmaPlanNdamXBwIydlGDsJTotMzkN8GCu9bj8dNcl75k9oZVojis+ i4eMseFoH7pngkUSp8yMfIQnHic9B+y6Sy+N5687ufwysoW4eTj9LZHQfSp8dN+82LO9ss+yluA 65ZoYNHhl5vj41lwMKPuqKksyTOVYpU1iDV+79Alic+1OB7/B51ADUB9MJ3oumzEDdF3+OoDNph n0AaFDjBq5FghNrjClbmB5kdxTZRNylodSE0jJJ4xDAf1XWehvPw9F0QQv6ikADRRBvnAfAnBRa jtq//vnbFhC/ X-Google-Smtp-Source: AGHT+IFcqJpeBEGfYFOSwq+yVxG/mFCXQPfVZGw8K8b+ocJq2qvhwLyHtyldmXB4CzBC1Qfu894VEA== X-Received: by 2002:a05:6102:cce:b0:4b6:1efd:5c with SMTP id ada2fe7eead31-4b690ce3fa9mr32980888137.16.1737950670053; Sun, 26 Jan 2025 20:04:30 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:29 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 06/14] platform/x86: alienware-wmi: Refactor thermal control methods Date: Sun, 26 Jan 2025 23:03:58 -0500 Message-ID: <20250127040406.17112-7-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Refactor thermal control methods to use alienware_wmi_command() instead of alienware_wmax_command(). Drop alienware_wmax_command() as there is no more users left. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 87 ++++++++--------------- 1 file changed, 30 insertions(+), 57 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index cfdd9c1cfebf..cd2bcc0af282 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -676,34 +676,6 @@ static enum led_brightness global_led_get(struct led_classdev *led_cdev) return priv->global_brightness; } -static acpi_status alienware_wmax_command(void *in_args, size_t in_size, - u32 command, u32 *out_data) -{ - acpi_status status; - union acpi_object *obj; - struct acpi_buffer input; - struct acpi_buffer output; - - input.length = in_size; - input.pointer = in_args; - if (out_data) { - output.length = ACPI_ALLOCATE_BUFFER; - output.pointer = NULL; - status = wmi_evaluate_method(WMAX_CONTROL_GUID, 0, - command, &input, &output); - if (ACPI_SUCCESS(status)) { - obj = (union acpi_object *)output.pointer; - if (obj && obj->type == ACPI_TYPE_INTEGER) - *out_data = (u32)obj->integer.value; - } - kfree(output.pointer); - } else { - status = wmi_evaluate_method(WMAX_CONTROL_GUID, 0, - command, &input, NULL); - } - return status; -} - /* * The HDMI mux sysfs node indicates the status of the HDMI input mux. * It can toggle between standard system GPU output and HDMI input. @@ -949,7 +921,8 @@ static bool is_wmax_thermal_code(u32 code) return false; } -static int wmax_thermal_information(u8 operation, u8 arg, u32 *out_data) +static int wmax_thermal_information(struct wmi_device *wdev, u8 operation, + u8 arg, u32 *out_data) { struct wmax_u32_args in_args = { .operation = operation, @@ -957,14 +930,12 @@ static int wmax_thermal_information(u8 operation, u8 arg, u32 *out_data) .arg2 = 0, .arg3 = 0, }; - acpi_status status; - - status = alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_THERMAL_INFORMATION, - out_data); + int ret; - if (ACPI_FAILURE(status)) - return -EIO; + ret = alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_INFORMATION, + &in_args, sizeof(in_args), out_data); + if (ret < 0) + return ret; if (*out_data == WMAX_FAILURE_CODE) return -EBADRQC; @@ -972,7 +943,7 @@ static int wmax_thermal_information(u8 operation, u8 arg, u32 *out_data) return 0; } -static int wmax_thermal_control(u8 profile) +static int wmax_thermal_control(struct wmi_device *wdev, u8 profile) { struct wmax_u32_args in_args = { .operation = WMAX_OPERATION_ACTIVATE_PROFILE, @@ -980,15 +951,13 @@ static int wmax_thermal_control(u8 profile) .arg2 = 0, .arg3 = 0, }; - acpi_status status; u32 out_data; + int ret; - status = alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_THERMAL_CONTROL, - &out_data); - - if (ACPI_FAILURE(status)) - return -EIO; + ret = alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_CONTROL, + &in_args, sizeof(in_args), &out_data); + if (ret) + return ret; if (out_data == WMAX_FAILURE_CODE) return -EBADRQC; @@ -996,7 +965,8 @@ static int wmax_thermal_control(u8 profile) return 0; } -static int wmax_game_shift_status(u8 operation, u32 *out_data) +static int wmax_game_shift_status(struct wmi_device *wdev, u8 operation, + u32 *out_data) { struct wmax_u32_args in_args = { .operation = operation, @@ -1004,14 +974,13 @@ static int wmax_game_shift_status(u8 operation, u32 *out_data) .arg2 = 0, .arg3 = 0, }; - acpi_status status; + int ret; - status = alienware_wmax_command(&in_args, sizeof(in_args), - WMAX_METHOD_GAME_SHIFT_STATUS, - out_data); + ret = alienware_wmi_command(wdev, WMAX_METHOD_GAME_SHIFT_STATUS, + &in_args, sizeof(in_args), out_data); - if (ACPI_FAILURE(status)) - return -EIO; + if (ret < 0) + return ret; if (*out_data == WMAX_FAILURE_CODE) return -EOPNOTSUPP; @@ -1022,10 +991,11 @@ static int wmax_game_shift_status(u8 operation, u32 *out_data) static int thermal_profile_get(struct device *dev, enum platform_profile_option *profile) { + struct awcc_priv *priv = dev_get_drvdata(dev); u32 out_data; int ret; - ret = wmax_thermal_information(WMAX_OPERATION_CURRENT_PROFILE, + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_CURRENT_PROFILE, 0, &out_data); if (ret < 0) @@ -1054,7 +1024,8 @@ static int thermal_profile_set(struct device *dev, u32 gmode_status; int ret; - ret = wmax_game_shift_status(WMAX_OPERATION_GET_GAME_SHIFT_STATUS, + ret = wmax_game_shift_status(priv->wdev, + WMAX_OPERATION_GET_GAME_SHIFT_STATUS, &gmode_status); if (ret < 0) @@ -1062,7 +1033,8 @@ static int thermal_profile_set(struct device *dev, if ((profile == PLATFORM_PROFILE_PERFORMANCE && !gmode_status) || (profile != PLATFORM_PROFILE_PERFORMANCE && gmode_status)) { - ret = wmax_game_shift_status(WMAX_OPERATION_TOGGLE_GAME_SHIFT, + ret = wmax_game_shift_status(priv->wdev, + WMAX_OPERATION_TOGGLE_GAME_SHIFT, &gmode_status); if (ret < 0) @@ -1070,7 +1042,8 @@ static int thermal_profile_set(struct device *dev, } } - return wmax_thermal_control(priv->supported_thermal_profiles[profile]); + return wmax_thermal_control(priv->wdev, + priv->supported_thermal_profiles[profile]); } static int thermal_profile_probe(void *drvdata, unsigned long *choices) @@ -1083,7 +1056,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) u32 out_data; int ret; - ret = wmax_thermal_information(WMAX_OPERATION_SYS_DESCRIPTION, + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_SYS_DESCRIPTION, 0, (u32 *) &sys_desc); if (ret < 0) return ret; @@ -1091,7 +1064,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) first_mode = sys_desc[0] + sys_desc[1]; for (u32 i = 0; i < sys_desc[3]; i++) { - ret = wmax_thermal_information(WMAX_OPERATION_LIST_IDS, + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_LIST_IDS, i + first_mode, &out_data); if (ret == -EIO) From patchwork Mon Jan 27 04:03:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950969 Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) (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 747061FCD1B; Mon, 27 Jan 2025 04:04:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950676; cv=none; b=uaKY6QDDpzDtx2rSigd9rFh1rBAJOhfTVPF3jJ7N+2ZOdZZVJwjQ2QcIr7vAxnNQdypqlggGCLQH1egtNAkaGVtveFY4wDMAH1ySfoEzfQPuGlMcCOaEI8/yJW76F8hpYWs/WbWS2yZOtqrlrPMnlY3Ajo5Ow+xzU7t1RA9t0tE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950676; c=relaxed/simple; bh=4M0hg9e1jyweRgawucr68alIuzQNer5I+HBce1mVBRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U56xdc0EnKZisY8B/zGZGJn7fi49dxrqpl1aeXojI4W858jPSugzLJq9WpwV5EluIGQkiMU4aL8g9EcAIroT8SNn1oynZ+QGJw2TChcJSYFNrJ4+YGlbxRqsDl3fZxF1OXKxagIrrIvYggNJ59ATTkzZZJV+Qv46tJHSGUv7IvM= 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=b5NjJhEB; arc=none smtp.client-ip=209.85.222.46 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="b5NjJhEB" Received: by mail-ua1-f46.google.com with SMTP id a1e0cc1a2514c-85b9f2de38eso773786241.2; Sun, 26 Jan 2025 20:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950673; x=1738555473; 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=D+mrGxP7YbQoQW7IiVuIybcwjDQpNp2h9Nqxh6P0RkE=; b=b5NjJhEB5HtQ/DJQrXnBhXuYU0jusbUFwFO0+Yaox9d+VvUjC43+Kziam0wCy3ZIHR W9SGPv1mbk38efYjV3tdHOZyozl/6ieu+8ewqsNhVB0v33cKiwwWIxIeR7e6ivLV04XR p6q24ZdHcWdOq4z9XkCnHKRAxrcAuiVyW/n4+jtPT3t44xyF5UoFDuTied2Pe35wfoVc Kw3HZamySRljOiZFrp0o9YJ3DYKm17BmO4mFLjbAE2DcyFfu3yqTgNrE173gJGRcr+Bm NaEQ3WPRVHulhBWIWi2uzwy6LlZ17r2kbkoCiAnxTyNim7imdozOL5Fy6IG4D92RwbZU AfRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950673; x=1738555473; 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=D+mrGxP7YbQoQW7IiVuIybcwjDQpNp2h9Nqxh6P0RkE=; b=XBA7CQdF9e2OVnd6ECqKYzG/B2Y71wFdd0dk535XErLzr2psW0R8gGHmGQyBsi+d2G qy+mpnkWiLhTCiOrYIVFA6KZNPoGfgpjHDHEu046VizzJFmmkTNsFf5xSInLwo6Bvj/k 68dAhWmx4s5jGKRO6gA6pwg9PWWnILh/3sMPLeUoG0npYOHIJsHESwHXPNB4aAP/oMeL iOqDntnhCYVAEceXANUCSNbZOuXRow9d/+fjRI55NQGYl9IuMlL8CbxisOjwVKUeVZKO /mPP7zPSt/SRMFAuezNFyiSfhb/3mQTWMke0eNRkm3zKNMnRkNWaFy4xffOnjua4LVCW 65cg== X-Forwarded-Encrypted: i=1; AJvYcCVSN9VQHDrIlW0/nje+/+xxCv79ok+5H7NA+vzi9fRPM4lBXZUoJN+3vZ7DvZ/+3QAZ5kFoevdD5+7zkNo=@vger.kernel.org X-Gm-Message-State: AOJu0YwSNcgpmfMXFHgCnxRLGPFJBT81YvHnY6TETLovtgHmP1zdfKCi 9/vqHK5Fkzt0EK+BEUrhW+VwGWyVNDEeMkOeZJErUEGMGA7tXPdr+zwiDg== X-Gm-Gg: ASbGnctLXrmupMM/83k/ssvs+ssfWuEv6Gil+xnhNVD/rW5aUqNNjwVA6L1GJj6pvpt nBLRtcreeyYlz2lm+R23l0MHuQLHVcxfAuoZTXxZLWfCx4x7rG9EaNI5nKe6dwksTZATzh0+nrB T5OpnQDZshhaY2T39EiWrbO5QGj5Nk36GWC2O6ViPqFIbRyc0KKuuvYp+CwenkZLSbmBCTzQXy1 eh6vX1/u0mPvl8Kdl2hRL+w4Au2L3c1pDGVpe2ijWOnst53euD9dvKGfLB2QQhElDFaIgQVZVRr +wjwNxq0YYtl X-Google-Smtp-Source: AGHT+IFsJm4gAJAz/3s0IVVpY0Dk4rtOvBUKgx6LBBUfIj2tG3BKaIKpLYPtRWtTvgXUDWVZg7BBtw== X-Received: by 2002:a05:6102:6c7:b0:4b6:8e5d:4bfd with SMTP id ada2fe7eead31-4b690cc968emr32911704137.22.1737950672663; Sun, 26 Jan 2025 20:04:32 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:31 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 07/14] platform/x86: alienware-wmi: Split DMI table Date: Sun, 26 Jan 2025 23:03:59 -0500 Message-ID: <20250127040406.17112-8-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Split thermal features into a new DMI table to support upcoming file split. While at it: Rename quirk_entry -> alienfx_features, Rename quirks -> alienfx and change hdmi_mux, amplifier and deepslp types to bool, because they are already being implicitly used as bools. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 354 ++++++++++------------ 1 file changed, 166 insertions(+), 188 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index cd2bcc0af282..5763f118cc3f 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -114,102 +114,68 @@ static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_ [THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, }; -struct quirk_entry { +struct alienfx_quirks { u8 num_zones; - u8 hdmi_mux; - u8 amplifier; - u8 deepslp; - bool thermal; - bool gmode; + bool hdmi_mux; + bool amplifier; + bool deepslp; }; -static struct quirk_entry *quirks; +static struct alienfx_quirks *alienfx; -static struct quirk_entry quirk_inspiron5675 = { +static struct alienfx_quirks quirk_inspiron5675 = { .num_zones = 2, - .hdmi_mux = 0, - .amplifier = 0, - .deepslp = 0, - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_unknown = { +static struct alienfx_quirks quirk_unknown = { .num_zones = 2, - .hdmi_mux = 0, - .amplifier = 0, - .deepslp = 0, - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_x51_r1_r2 = { +static struct alienfx_quirks quirk_x51_r1_r2 = { .num_zones = 3, - .hdmi_mux = 0, - .amplifier = 0, - .deepslp = 0, - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_x51_r3 = { +static struct alienfx_quirks quirk_x51_r3 = { .num_zones = 4, - .hdmi_mux = 0, - .amplifier = 1, - .deepslp = 0, - .thermal = false, - .gmode = false, + .hdmi_mux = false, + .amplifier = true, + .deepslp = false, }; -static struct quirk_entry quirk_asm100 = { +static struct alienfx_quirks quirk_asm100 = { .num_zones = 2, - .hdmi_mux = 1, - .amplifier = 0, - .deepslp = 0, - .thermal = false, - .gmode = false, + .hdmi_mux = true, + .amplifier = false, + .deepslp = false, }; -static struct quirk_entry quirk_asm200 = { +static struct alienfx_quirks quirk_asm200 = { .num_zones = 2, - .hdmi_mux = 1, - .amplifier = 0, - .deepslp = 1, - .thermal = false, - .gmode = false, + .hdmi_mux = true, + .amplifier = false, + .deepslp = true, }; -static struct quirk_entry quirk_asm201 = { +static struct alienfx_quirks quirk_asm201 = { .num_zones = 2, - .hdmi_mux = 1, - .amplifier = 1, - .deepslp = 1, - .thermal = false, - .gmode = false, -}; - -static struct quirk_entry quirk_g_series = { - .num_zones = 0, - .hdmi_mux = 0, - .amplifier = 0, - .deepslp = 0, - .thermal = true, - .gmode = true, -}; - -static struct quirk_entry quirk_x_series = { - .num_zones = 0, - .hdmi_mux = 0, - .amplifier = 0, - .deepslp = 0, - .thermal = true, - .gmode = false, + .hdmi_mux = true, + .amplifier = true, + .deepslp = true, }; static int __init dmi_matched(const struct dmi_system_id *dmi) { - quirks = dmi->driver_data; + alienfx = dmi->driver_data; return 1; } @@ -241,51 +207,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { }, .driver_data = &quirk_asm201, }, - { - .callback = dmi_matched, - .ident = "Alienware m16 R1 AMD", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m16 R1 AMD"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware m17 R5", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware m18 R2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware x15 R1", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"), - }, - .driver_data = &quirk_x_series, - }, - { - .callback = dmi_matched, - .ident = "Alienware x17 R2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"), - }, - .driver_data = &quirk_x_series, - }, { .callback = dmi_matched, .ident = "Alienware X51 R1", @@ -313,60 +234,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { }, .driver_data = &quirk_x51_r3, }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G15 5510", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G15 5511", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G15 5515", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G3 3500", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G3 3590", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"), - }, - .driver_data = &quirk_g_series, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. G5 5500", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"), - }, - .driver_data = &quirk_g_series, - }, { .callback = dmi_matched, .ident = "Dell Inc. Inspiron 5675", @@ -441,6 +308,111 @@ struct alienfx_platdata { static u8 interface; +struct awcc_quirks { + bool gmode; +}; + +static struct awcc_quirks g_series_quirks = { + .gmode = true, +}; + +static struct awcc_quirks generic_quirks = { + .gmode = false, +}; + +static const struct dmi_system_id awcc_dmi_table[] __initconst = { + { + .ident = "Alienware m16 R1 AMD", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m16 R1 AMD"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware m17 R5", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware m18 R2", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware x15 R1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware x17 R2", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Dell Inc. G15 5510", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G15 5511", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G15 5515", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G3 3500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G3 3590", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G5 5500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"), + }, + .driver_data = &g_series_quirks, + }, +}; + +static struct awcc_quirks *awcc; + static int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, void *in_args, size_t in_size, u32 *out_data) { @@ -623,7 +595,7 @@ static DEVICE_ATTR_RW(lighting_control_state); static umode_t zone_attr_visible(struct kobject *kobj, struct attribute *attr, int n) { - if (n < quirks->num_zones + 1) + if (n < alienfx->num_zones + 1) return attr->mode; return 0; @@ -631,7 +603,7 @@ static umode_t zone_attr_visible(struct kobject *kobj, static bool zone_group_visible(struct kobject *kobj) { - return quirks->num_zones > 0; + return alienfx->num_zones > 0; } DEFINE_SYSFS_GROUP_VISIBLE(zone); @@ -757,7 +729,7 @@ static DEVICE_ATTR_RW(source); static bool hdmi_group_visible(struct kobject *kobj) { - return quirks->hdmi_mux; + return alienfx->hdmi_mux; } DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(hdmi); @@ -806,7 +778,7 @@ static DEVICE_ATTR_RO(status); static bool amplifier_group_visible(struct kobject *kobj) { - return quirks->amplifier; + return alienfx->amplifier; } DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(amplifier); @@ -879,7 +851,7 @@ static DEVICE_ATTR_RW(deepsleep); static bool deepsleep_group_visible(struct kobject *kobj) { - return quirks->deepslp; + return alienfx->deepslp; } DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(deepsleep); @@ -1020,7 +992,7 @@ static int thermal_profile_set(struct device *dev, { struct awcc_priv *priv = dev_get_drvdata(dev); - if (quirks->gmode) { + if (awcc->gmode) { u32 gmode_status; int ret; @@ -1086,7 +1058,7 @@ static int thermal_profile_probe(void *drvdata, unsigned long *choices) if (bitmap_empty(choices, PLATFORM_PROFILE_LAST)) return -ENODEV; - if (quirks->gmode) { + if (awcc->gmode) { priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = WMAX_THERMAL_MODE_GMODE; @@ -1309,7 +1281,7 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) struct platform_device *pdev; int ret; - if (quirks->thermal) { + if (awcc) { return alienware_awcc_setup(wdev); } else { ret = alienware_alienfx_setup(&pdata); @@ -1330,7 +1302,7 @@ static void wmax_wmi_remove(struct wmi_device *wdev) { struct platform_device *pdev; - if (!quirks->thermal) { + if (!awcc) { pdev = dev_get_drvdata(&wdev->dev); device_remove_groups(&pdev->dev, wmax_alienfx_groups); @@ -1357,6 +1329,22 @@ static struct wmi_driver alienware_wmax_wmi_driver = { static int __init alienware_wmax_wmi_init(void) { + const struct dmi_system_id *id; + + id = dmi_first_match(awcc_dmi_table); + if (id) + awcc = id->driver_data; + + if (force_platform_profile) + awcc = &generic_quirks; + + if (force_gmode) { + if (awcc) + awcc->gmode = true; + else + pr_warn("force_gmode requires platform profile support\n"); + } + return wmi_driver_register(&alienware_wmax_wmi_driver); } @@ -1370,18 +1358,8 @@ static int __init alienware_wmi_init(void) int ret; dmi_check_system(alienware_quirks); - if (quirks == NULL) - quirks = &quirk_unknown; - - if (force_platform_profile) - quirks->thermal = true; - - if (force_gmode) { - if (quirks->thermal) - quirks->gmode = true; - else - pr_warn("force_gmode requires platform profile support\n"); - } + if (!alienfx) + alienfx = &quirk_unknown; ret = platform_driver_register(&platform_driver); if (ret < 0) From patchwork Mon Jan 27 04:04:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950970 Received: from mail-ua1-f41.google.com (mail-ua1-f41.google.com [209.85.222.41]) (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 9DBDE1FC0E0; Mon, 27 Jan 2025 04:04:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950678; cv=none; b=WNj0c3cRG5DA2L07+DbDOzmK4mJWdcwLIkOTS3S/rhZtmT3e4ww9V0W/NjgqpO0+cTmciprIgKA4rZg2IYUHuBSiivKUs1QRt2jslBgDI6EsgoiRDbzhK7iOwKz/wUGK4DYVb0mwZvsY7E9mPOlbL4Ph8C030me3vvuQRrCxPOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950678; c=relaxed/simple; bh=JF8dghz/V3qoWXscDcPAQ6EglGIYyD9KUdKTGAWJc+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SL8AKJmW7w0K+tpjMqS/rDk29YO4+UA9r3P5MRMs9vj2UaKF4L6UQoeGzwZ5apybuwMOffmRt4wPuOAhPT4jWmIHY5JJq0OGd+a187BRP+9aflXli28EFy96sN9MJyTW4N2Ugem66GkBBsclr2NiqVSCISJH/eaF/DY+6aup8Uc= 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=O//jJTkd; arc=none smtp.client-ip=209.85.222.41 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="O//jJTkd" Received: by mail-ua1-f41.google.com with SMTP id a1e0cc1a2514c-85b83479f45so720358241.0; Sun, 26 Jan 2025 20:04:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950675; x=1738555475; 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=vuNfSILdnCJ7PQTo088HkVCj2bj2Fhg3WmJOJb5OLG8=; b=O//jJTkd8EJBHa2VLe3mPyQitHH1jVj99h6aC1PoAskT4NgVa3R9kGdkvykywxL8J4 ugoXUZOI8vPDPwXIUQUOWFD/fJiLVBqsW6ZNUiAXiy5FOszwqn3WwqPW3X1DlvnaecKC +C85bLpNapHUjMaDLdFRjPfERzbaA2qk16YA2Dyuu6tcwZRsV8ogOeDYNB3fLbXWq5R7 Ljjl9ac2qgTqOwLD+v+pmi2aquFoQ/o+y5tZQ/OTJzeMU5Ue/Ed6EBMx2MIkhiw7x5CT IdmlIS+kWrR5gky2LyPhn5xTZEoY1nDDvp2XMFr76S9LztFOqcigKe5zZiC+ESNq2uHI n8tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950675; x=1738555475; 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=vuNfSILdnCJ7PQTo088HkVCj2bj2Fhg3WmJOJb5OLG8=; b=OXpxesmtA5v2nDaEuwIPwFGt/BxSINiSYYDf4wn3ZLZ4a13FJS5tyiPCbRYiF2eivR fGcUYEGDNkE4g06cpWuNCuqa/WzVbX63j2ezHSVBG7gOeB3MSQMGdqaE/fNilQl/Hphk /wS7MyV7E5JNIjKd7X4F/T8DX1PUGVivwPm2wU/gHn5YC0R05sIHRYXAF8CJBX2mp6bv 6vDsB29wlzca81kwIlR9EbAC+GwS0jlUMslwkXJqqAWgzD2lrx2GnTeY0o/UZdphIqmF e/tqjdhOAadr7+9NjaqX8PgdHWZGaOzWqFHW0383QyOt9vjxstiYFA6WyQqL4F8bDXT3 kIdw== X-Forwarded-Encrypted: i=1; AJvYcCUY/8pOvVBbcTj7VOLSGhJNT98g98PBLMqhSJnG/0MaTtOWuJn5FNWjOFIb+pIzNdsxf2N9S8aXfwf/cQw=@vger.kernel.org X-Gm-Message-State: AOJu0YymDQGtNLCzFlKBfwzYpOA6gwNQz4iR+hiohE3k+lSkfaoGYl08 0WCdla6wutJPHTla5iZU4sF+OHuKlcTJaTavrcByZZ7HMfiFh2VC7o3rSA== X-Gm-Gg: ASbGnctE/L4zbbZ8cOqLAhfKfi/3rsdbieELAqrXOhhcAS74g6gSr+bOkaWd33Mn9EC QL26fHhfUy8/WZkcloEig9F31WR+n/MwS3NmylDwsC4MKf5wzywLNdoEfdGVss8ujTWxUsfrOhf MpDukjQ9/yyYIN7v9xmyq01OLKMacvGDWx7I9Ae9F2PRBgc03xTlXUoqS6St8KJ3JVA7TqgzE32 MOFs+qqQ+RJ5+vKom4CUkyp+/rDbReFKxoRReayk99B5rwcHR5FqXCcDeKNxlpW6bFTMTtaJVVu F+bOyJf0obiI X-Google-Smtp-Source: AGHT+IFXLHrRrpKdxmh4A12zbMDntquOONjXRXUpxa0OTiFT2Kq+rRFr3IIHEmk1clZC7IAUjYloQQ== X-Received: by 2002:a05:6102:3bd7:b0:4b2:5d10:29db with SMTP id ada2fe7eead31-4b690bc6357mr26288484137.7.1737950675103; Sun, 26 Jan 2025 20:04:35 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:34 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 08/14] MAINTAINERS: Update ALIENWARE WMI DRIVER entry Date: Sun, 26 Jan 2025 23:04:00 -0500 Message-ID: <20250127040406.17112-9-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Dell has been inactive in its maintainership role of this driver since around 2021. Due to this, add myself as a maintainer and update path to support upcoming changes. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- MAINTAINERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 3809931b9240..596c6a46478c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -784,10 +784,12 @@ F: Documentation/admin-guide/perf/alibaba_pmu.rst F: drivers/perf/alibaba_uncore_drw_pmu.c ALIENWARE WMI DRIVER +M: Kurt Borja +L: platform-driver-x86@vger.kernel.org L: Dell.Client.Kernel@dell.com S: Maintained F: Documentation/wmi/devices/alienware-wmi.rst -F: drivers/platform/x86/dell/alienware-wmi.c +F: drivers/platform/x86/dell/alienware-wmi* ALLEGRO DVT VIDEO IP CORE DRIVER M: Michael Tretter From patchwork Mon Jan 27 04:04:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950971 Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com [209.85.221.178]) (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 12CC81FCFE5; Mon, 27 Jan 2025 04:04:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950680; cv=none; b=lXIaehFwLb6gfJQ/NUufwcA6gep2EsiMy/kS2wQzB4ec0mwi/LxHI4Cj7Ds8G5K/nYx6U2cIKjOCVpAv78juJh74tyzYwxRtoHNIx3VkPBv8prCU5aTdeRjYga/EgI/onEcm0iVPr1Rh4imyWaTpPt/lkyxBGZGogsZWy0yxNrU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950680; c=relaxed/simple; bh=Woq4swbnYq3xsWIj3EtplDj2WuXqxSueFP8J8UTTZS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ENKyBttSlx6vInmlwBdwMpk6c6A8T9RzFj6Ll/whX+oasenM6u++HDR4nTrTZGUfTi0AMFnE8W+/f0HQs9DQ/1d324SPb+TxVkO0U9JCeDW7IsFuXzDRS68WIWA9L9eOiH2kQoLTPS9zthJ4kc6blwMMF27/HL1uJrzOZY8GJy0= 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=MhRMoBYH; arc=none smtp.client-ip=209.85.221.178 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="MhRMoBYH" Received: by mail-vk1-f178.google.com with SMTP id 71dfb90a1353d-518957b0533so1233061e0c.1; Sun, 26 Jan 2025 20:04:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950677; x=1738555477; 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=H0Qac2DNxaP3+ckGylXZbGeHgHst/csov0aaJCMEn8w=; b=MhRMoBYH3n4pk812YDM0s536sRIAzfbtj+Z0iW0JhibUyQJ3In2wd6amFgu2ILeTp4 lFoZeJCuJBuIlinN15I5QxSND6pM+cvTTFrBmWINrMzmpXoAWiohlmVFngQiE5UMNyKr gX6PxSECGUfv+xqaUy3k0FPMw//N4K5qSLR6uR7kvPYKOGviJ9FLeGnxUY5ny/7v4q/j ftWR+IDkfllTpJAlbIFi4fcwe/9LEoOyIjfsFgqW0z8U1UtR1Ma6aRDATdMq0wKH31wO rhgGyVMicoSk3wvy90UwgLpsNLM/DpQDJjcndCQc+kdBSCCqttW4iKXLPHMF0mhUZ0U5 2E7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950677; x=1738555477; 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=H0Qac2DNxaP3+ckGylXZbGeHgHst/csov0aaJCMEn8w=; b=PREbBiovYHacnYKOHxqDsn4b38TzidegWIK6H/bcxUmA8y/qQzdH+2QxR5bGGK4Zoc O9IDUQfIab/fPj2aNaR8XREuOrln/F2cSUhO9KsaKJKZ7spA2EaMizejNDRTsII9Vbd3 nBzR7OztQU5kViRTCnfY1A4t6QKTx2b1PRKhltwkFgTHGNctGjd3TLjLT4ugzIL/8ldG FFUziQ5QT1DsvXXaVpn1AWh5RTiEbtucyo/0YKZCYdvvf6A0mAT2S6RrGik3XQmX4I2H nKOekCpG+jq9MeGvj637oG+L1epGx7xxFumiOP3iIvf6DNhSGRy9fslWSfoRXsKKpeE4 Ai+g== X-Forwarded-Encrypted: i=1; AJvYcCXSk+pumPR8/B2cQFQ33/E5Qj460RX+2DNuQxKGJGjQVliKjoasRR73iKGUU6pN5vYuzFLLLdiI2s1wa98=@vger.kernel.org X-Gm-Message-State: AOJu0Yz5nEsddVs5/uLtAJimWNJj2HzYip3iioIBb9LqzdgvS2hUDowH 5s4rI8l5XdqPlaw+PNgSxJzSOEl0JN0HCccwxK+FmpwphFgnQm9uRwAflQ== X-Gm-Gg: ASbGncue4HD5v5/yOdH2uX8xSEh6Ahxh3/SxRLx1L9iEqO0+oUDq+JFPIKt0oBsjlft We7gYh/OYWjeKlC7aKaoAIxLvpd4SLD0v811Uued6QFufw4W+RnLaQXSMuNEVTq5Lbe0zw5/gYB PSxXALtPhSqFWWcUw2Yr2wbbs/S/2LhB0mDxNUq6kvLLH8bpS2i07waeJIkfCKKRBfDWFO3T74C 8umN4qS4kV0hRE7EU8ZX/SmkVDdCxayx8IJhidzXq5h2sGBvJnBLUB8US6Qbs0tuJgOLhz1xK8Z oyEKZOKsnUCB X-Google-Smtp-Source: AGHT+IHJvtko9ToaDuhFty2MxHFucljmX2MVHMLqxH/pmyvQFCj1Ge7vYBuFQ83tuBlvVOIiEUD9oA== X-Received: by 2002:a05:6102:38c8:b0:4b1:11c6:d3c6 with SMTP id ada2fe7eead31-4b690b84bd7mr30988241137.5.1737950677581; Sun, 26 Jan 2025 20:04:37 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:36 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 09/14] platform/x86: Rename alienware-wmi.c Date: Sun, 26 Jan 2025 23:04:01 -0500 Message-ID: <20250127040406.17112-10-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Rename alienware-wmi to support upcoming split. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/Makefile | 1 + .../platform/x86/dell/{alienware-wmi.c => alienware-wmi-base.c} | 0 2 files changed, 1 insertion(+) rename drivers/platform/x86/dell/{alienware-wmi.c => alienware-wmi-base.c} (100%) diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile index bb3cbd470a46..f8aec8502c2f 100644 --- a/drivers/platform/x86/dell/Makefile +++ b/drivers/platform/x86/dell/Makefile @@ -5,6 +5,7 @@ # obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o +alienware-wmi-objs := alienware-wmi-base.o obj-$(CONFIG_DCDBAS) += dcdbas.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi-base.c similarity index 100% rename from drivers/platform/x86/dell/alienware-wmi.c rename to drivers/platform/x86/dell/alienware-wmi-base.c From patchwork Mon Jan 27 04:04:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950972 Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com [209.85.217.53]) (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 558AC1FDA78; Mon, 27 Jan 2025 04:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950683; cv=none; b=uBuBtWtDIniJgQJm5Ji9V9mpI3uoEAa/t+RyXq73MoBJyJ5UlN7VoUKklizqJ3d02+Jbv1R0SNrp4Wp+RzwO8/c+B5mJVDxmAExU2/vBI90MvGTE4mO3d4e0/lhZSqdG0oTZ084FaNlWqOtAKvD6gFrvfQ9urHvEEQORc/pgVhs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950683; c=relaxed/simple; bh=kL+AeccpGKBOpTj5NyyjP82JZ92HXzkXFpv00JIDCPM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nNhmIkksvEwLyMN5OLG0/aDztMgG3jqz5IPfgboxWu/GBiu3TVEUV/2VBdUkygd+Urea1w2NGB69rdOfQQsDgKtuBaNeaHE/pplgfW6XM/UzWdXwa35i2Ls4zhhmBA296DGzfHg43hmDiQoZ+BJDqcTKwPI50pnAj9UCz+Zi/88= 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=dRjQA0At; arc=none smtp.client-ip=209.85.217.53 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="dRjQA0At" Received: by mail-vs1-f53.google.com with SMTP id ada2fe7eead31-4afed7b7d1bso1083231137.2; Sun, 26 Jan 2025 20:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950680; x=1738555480; 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=+3VEsgFPjom4fznaJdTcJJcnqvZ2yVYhOQnuPC+vg2c=; b=dRjQA0AtEiIN2HR8QeCmbRZQ8ShogKAXgnCWt9vSMwoMYriM6PtRP7FU/BL2N8FNlB hHuZ8Zs/Rf2Du6rbC+Doh+DefoGNiua8Pu86J73l75XpnGuD77sLYYobPBWEkYghwkbi rDEBeZypsmnkZSPcEAwQNGwX4gI4Kj//UmddZ2QXDBCaKSCUf3ltaZjVaeE8zAT5AU0u oIm+140591wfW1GOjR5+OpxewQr3f+GI8wEOIGeNx+w+p8zpIONB3yTYtAeooV/d94V1 1y4jwyHq5/2LHHwR01+CwniPFr0Hd+nMpT9jXajXpXdF6m9rK2UegjRtu5LCdcTvVudD Ofvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950680; x=1738555480; 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=+3VEsgFPjom4fznaJdTcJJcnqvZ2yVYhOQnuPC+vg2c=; b=baZrNyZSn/an3JaNV+X53vjb5CYoaDTrsCz1Mjvp0PqZ/23q2FJ6zAQw/vp6fqmBsB HPcYLPGbwARk6zpo3k5N2LP933/qog1MVn5nTt/wRoxFLJPee5MqBtVmGxco6Ufjqyka BzCaUyIFVwZTFIfbUIbsUPhQFv5g2MDSKBOQmsDk9WfjnHBgy3l0ZWS8k5xfPxtU9DR3 pqovTXt+QcO4CWUedozcQEr7oBeHP2l44X5QUXSkWB0A4il1dM5P/DML6VqLysJV6N7h Z7zmgDfHz4obPWemMRj1sCmVPw0lp/8wi8djMLpZd4o3F7DQ6H+rdBTEqQEr+MptEqeO DFWg== X-Forwarded-Encrypted: i=1; AJvYcCVA0GJuuDeV0cdL1IwsMX29QXpX0/Zkw4dxKOMjlefI/9023i+vd4txagDpgfzBpoxEKy7EkyGkW0wllZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YzHQAeP78uF5NYX7Bvcaqcq+SeSv4aN7I3kMXb5DJ9W3KabO8/Y ZONUu2PhlhlscfN5eDG8vpncEDFSi5xi7bPHxOAq9HaioeTahydmYswbsQ== X-Gm-Gg: ASbGnct6OYtODAVC5jvMpM/Wf33yGnLCPRKv0OOF/fOf09zwdvww9jzN3a8Uq+TO9sS OwNcWrBWHHxo1m3kfZmXmbba4TwIZWOd/XhP/c4H3CiXF90QsSY+GvPGWLOKIvRGdomoVuf2PTX pxNGW7Nx9reualydb01dueYkxnKvzS6p5ddv9vozxGd84DPX0pnHw69C21/YoZW1mVij0FiTwAc nk2p0EbI/toz2FEqQigPCIi22B0QqkuMlred7Xj4QKLvq0kDpl57Vx+vhG7/wPCL4z+EMoD1SI9 WIGQv1BPZBbe X-Google-Smtp-Source: AGHT+IEtUo7X7CjyP59xcwzTTDd1hSm9PXb0LD0AhrgbgAs57edxwxguXQTzX6uTUXIamInTBxa/+A== X-Received: by 2002:a05:6102:390e:b0:4b2:5c0a:98c1 with SMTP id ada2fe7eead31-4b690cb5750mr32750023137.22.1737950680048; Sun, 26 Jan 2025 20:04:40 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:39 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 10/14] platform/x86: Add alienware-wmi.h Date: Sun, 26 Jan 2025 23:04:02 -0500 Message-ID: <20250127040406.17112-11-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a header file for alienware-wmi with shared resources to support the upcoming file split. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- .../platform/x86/dell/alienware-wmi-base.c | 69 +++------------- drivers/platform/x86/dell/alienware-wmi.h | 80 +++++++++++++++++++ 2 files changed, 90 insertions(+), 59 deletions(-) create mode 100644 drivers/platform/x86/dell/alienware-wmi.h diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c index 5763f118cc3f..1302b85d3e7b 100644 --- a/drivers/platform/x86/dell/alienware-wmi-base.c +++ b/drivers/platform/x86/dell/alienware-wmi-base.c @@ -17,10 +17,7 @@ #include #include #include - -#define LEGACY_CONTROL_GUID "A90597CE-A997-11DA-B012-B622A1EF5492" -#define LEGACY_POWER_CONTROL_GUID "A80593CE-A997-11DA-B012-B622A1EF5492" -#define WMAX_CONTROL_GUID "A70591CE-A997-11DA-B012-B622A1EF5492" +#include "alienware-wmi.h" #define WMAX_METHOD_HDMI_SOURCE 0x1 #define WMAX_METHOD_HDMI_STATUS 0x2 @@ -55,18 +52,6 @@ enum INTERFACE_FLAGS { WMAX, }; -enum LEGACY_CONTROL_STATES { - LEGACY_RUNNING = 1, - LEGACY_BOOTING = 0, - LEGACY_SUSPEND = 3, -}; - -enum WMAX_CONTROL_STATES { - WMAX_RUNNING = 0xFF, - WMAX_BOOTING = 0, - WMAX_SUSPEND = 3, -}; - enum WMAX_THERMAL_INFORMATION_OPERATIONS { WMAX_OPERATION_SYS_DESCRIPTION = 0x02, WMAX_OPERATION_LIST_IDS = 0x03, @@ -114,15 +99,7 @@ static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_ [THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, }; -struct alienfx_quirks { - u8 num_zones; - bool hdmi_mux; - bool amplifier; - bool deepslp; -}; - -static struct alienfx_quirks *alienfx; - +struct alienfx_quirks *alienfx; static struct alienfx_quirks quirk_inspiron5675 = { .num_zones = 2, @@ -246,12 +223,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { {} }; -struct color_platform { - u8 blue; - u8 green; - u8 red; -} __packed; - struct wmax_brightness_args { u32 led_mask; u32 percentage; @@ -286,26 +257,6 @@ struct awcc_priv { enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; }; -struct alienfx_priv { - struct platform_device *pdev; - struct led_classdev global_led; - struct color_platform colors[4]; - u8 global_brightness; - u8 lighting_control_state; -}; - -struct alienfx_ops { - int (*upd_led)(struct alienfx_priv *priv, struct wmi_device *wdev, - u8 location); - int (*upd_brightness)(struct alienfx_priv *priv, struct wmi_device *wdev, - u8 brightness); -}; - -struct alienfx_platdata { - struct wmi_device *wdev; - struct alienfx_ops ops; -}; - static u8 interface; struct awcc_quirks { @@ -413,8 +364,8 @@ static const struct dmi_system_id awcc_dmi_table[] __initconst = { static struct awcc_quirks *awcc; -static int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, - void *in_args, size_t in_size, u32 *out_data) +int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, + void *in_args, size_t in_size, u32 *out_data) { struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; struct acpi_buffer in = {in_size, in_args}; @@ -1138,7 +1089,7 @@ static struct platform_driver platform_driver = { .probe = alienfx_probe, }; -static int alienware_alienfx_setup(struct alienfx_platdata *pdata) +int alienware_alienfx_setup(struct alienfx_platdata *pdata) { struct platform_device *pdev; @@ -1151,7 +1102,7 @@ static int alienware_alienfx_setup(struct alienfx_platdata *pdata) return PTR_ERR_OR_ZERO(pdev); } -static void alienware_alienfx_exit(struct wmi_device *wdev) +void alienware_alienfx_exit(struct wmi_device *wdev) { struct platform_device *pdev = dev_get_drvdata(&wdev->dev); @@ -1231,12 +1182,12 @@ static struct wmi_driver alienware_legacy_wmi_driver = { .no_singleton = true, }; -static int __init alienware_legacy_wmi_init(void) +int __init alienware_legacy_wmi_init(void) { return wmi_driver_register(&alienware_legacy_wmi_driver); } -static void __exit alienware_legacy_wmi_exit(void) +void __exit alienware_legacy_wmi_exit(void) { wmi_driver_unregister(&alienware_legacy_wmi_driver); } @@ -1327,7 +1278,7 @@ static struct wmi_driver alienware_wmax_wmi_driver = { .no_singleton = true, }; -static int __init alienware_wmax_wmi_init(void) +int __init alienware_wmax_wmi_init(void) { const struct dmi_system_id *id; @@ -1348,7 +1299,7 @@ static int __init alienware_wmax_wmi_init(void) return wmi_driver_register(&alienware_wmax_wmi_driver); } -static void __exit alienware_wmax_wmi_exit(void) +void __exit alienware_wmax_wmi_exit(void) { wmi_driver_unregister(&alienware_wmax_wmi_driver); } diff --git a/drivers/platform/x86/dell/alienware-wmi.h b/drivers/platform/x86/dell/alienware-wmi.h new file mode 100644 index 000000000000..00b7505e1073 --- /dev/null +++ b/drivers/platform/x86/dell/alienware-wmi.h @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Alienware WMI special features driver + * + * Copyright (C) 2014 Dell Inc + * Copyright (C) 2024 Kurt Borja + */ + +#ifndef _ALIENWARE_WMI_H_ +#define _ALIENWARE_WMI_H_ + +#include +#include +#include + +#define LEGACY_CONTROL_GUID "A90597CE-A997-11DA-B012-B622A1EF5492" +#define LEGACY_POWER_CONTROL_GUID "A80593CE-A997-11DA-B012-B622A1EF5492" +#define WMAX_CONTROL_GUID "A70591CE-A997-11DA-B012-B622A1EF5492" + +extern struct alienfx_quirks *alienfx; + +enum LEGACY_CONTROL_STATES { + LEGACY_RUNNING = 1, + LEGACY_BOOTING = 0, + LEGACY_SUSPEND = 3, +}; + +enum WMAX_CONTROL_STATES { + WMAX_RUNNING = 0xFF, + WMAX_BOOTING = 0, + WMAX_SUSPEND = 3, +}; + +struct alienfx_quirks { + u8 num_zones; + bool hdmi_mux; + bool amplifier; + bool deepslp; +}; + +struct color_platform { + u8 blue; + u8 green; + u8 red; +} __packed; + +struct alienfx_priv { + struct platform_device *pdev; + struct alienfx_quirks *quirks; + struct led_classdev global_led; + struct color_platform colors[4]; + u8 global_brightness; + u8 lighting_control_state; +}; + +struct alienfx_ops { + int (*upd_led)(struct alienfx_priv *priv, struct wmi_device *wdev, + u8 location); + int (*upd_brightness)(struct alienfx_priv *priv, struct wmi_device *wdev, + u8 brightness); +}; + +struct alienfx_platdata { + struct wmi_device *wdev; + struct alienfx_ops ops; +}; + +int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, + void *in_args, size_t in_size, u32 *out_data); + +int alienware_alienfx_setup(struct alienfx_platdata *pdata); +void alienware_alienfx_exit(struct wmi_device *wdev); + +int __init alienware_legacy_wmi_init(void); +void __exit alienware_legacy_wmi_exit(void); + +int __init alienware_wmax_wmi_init(void); +void __exit alienware_wmax_wmi_exit(void); + +#endif From patchwork Mon Jan 27 04:04:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950973 Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) (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 8FE9D1FDE03; Mon, 27 Jan 2025 04:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950687; cv=none; b=gOTmuvMdVtdeJMp/uErzVN1xOqrWAoI3HOtutx/23MOIlKasmDwOCZxIL5bpUmdJZBmgjnk9YRvD4g9A/akb0XNPYRbD2ElJ/3L+kv4K9O34eSSswgj+Ek7FVsiZo80RC3frwLxKGoCcnGx1hsOzRBGIqaQBI2d5JtihFlZSbkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950687; c=relaxed/simple; bh=VjW4mkUZjcXxYgU/Te+r1RUPqPEDG3GvM9cPvP4j0jE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S+rARkkgClQDPH4f8U4xFl/8ALs0BD6V7bItzLKQRqcDmSvYcj2WDIFqRKXwgHjMyFDR/Y47/lCBGCqBUPBTrVOUs1WGm8CHMgRoTmikFJGtDAd4Yd4c9CqhF6TSelW7DmR9iwAWUq0L6oH4ZxJ5eK0sGgnNjnkfzpAGIVfpgeo= 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=Zx7fwYxA; arc=none smtp.client-ip=209.85.222.45 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="Zx7fwYxA" Received: by mail-ua1-f45.google.com with SMTP id a1e0cc1a2514c-8641c7574a5so842240241.1; Sun, 26 Jan 2025 20:04:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950683; x=1738555483; 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=dGKbQy+9KpagggPlYJ/rDgXdUjMqi9AujG3YDNpKx5M=; b=Zx7fwYxAD6fYTRIGz3F79T56aLpgWaZvEgujhG2K1ABiEXAnef6UVC4LommYKyRWco K7MtvXz1kGakKq13w801bRl2SllQmBwOuUzBK0KP3UuoEdY9r8E61NhbWAOcIP4MsdLE 0JfNlHy7QWznx29FoBUB9JWlOy/kw860vw5ubG+Psiim32vvXr1K/N1KsQIETi7qDjMb x+EoiYsQ+Yov5a9dHbX0+bMD95kYAempGg03NHAr0sI95r8LlWf4k3FkkeVDrW02wbfy tAfHvrrZYPzI5jfvki1QwJ8xvG/vC6wxasF/vJ3qKFZ2zZWdzTTessDr9Je1lQeRA8Ur SQKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950683; x=1738555483; 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=dGKbQy+9KpagggPlYJ/rDgXdUjMqi9AujG3YDNpKx5M=; b=O7N84YQmG9IhYoO+09NknTtP5QFOnr9w35cbHZ59lattmysYocSjAxBahzdXz/wk6I EXEqKlZ1NQpJf6kDUAt74Trfr0Y7r2wyh2rj1dMezKw1HoyeVfC/Q7nDNyTz2PcvkL3/ MtxR9Q4GR6c7d/QYl+UZ9M53aEqbmDA2XsFPKWyJgb/DAWhr89JcgaZkqmwSsWG5HDkh 1uvM3PpYiGZ4U181EAzz6hIqDpf1kAy26YBTyUURcBS/bE6QSdVZEZXiWfVp6gc2wBtF 0aZpugNOlv1yR1KnyGHyERt+ejTwE9eJ8WXtX3K/cV90jYe6DDj4ViSX16ovEmvOFSNO EFGA== X-Forwarded-Encrypted: i=1; AJvYcCWtQh3e456Qp4WGXT5e7hjbvWZOhz63yfmqAF/6sLmSVbEpuV3XaJ1Zgu5uyfjes2orZ83ihqaIxPTkvXw=@vger.kernel.org X-Gm-Message-State: AOJu0YxhSkH6FgwvizkyMTM0V+NmlZD3P01IcKyJLUPRnnpb6XeI/stP YRPFIL540QEJBBy/6LxKxZR311kenxNMyg7RbZ7Kxqet4heUs8+KxqMoYA== X-Gm-Gg: ASbGncsvWsLjDkvnAzfaNH0MlhzYbr4mNnBDUQDTGjqMJGaGdVMWrZquTzYOOYPddsb xLh1lm+Zj2Wi2EdP7n8PeZQDEUgjlJsg2V4hjoSxvC+UccSb1xxfV9cutf+4GjwnnT4qxAw1hEA AqHrgKhBvJCLDunz5KOKCvaNLF9FmaBkl4uXXzU0tTZ8IebAUcybMpPQNYCC7ceiTNhGqXou6iG UYPZUYQSThTb1VWy8m1NZNy5TmKWsWnuZk/UvbKHpIdFW8/Pi3XfLelGdlXMFuZ9oBoDdGcequb FQu5i2jAWrEn X-Google-Smtp-Source: AGHT+IFF5U91Czt6fHYG4nKSsgTh1u/7cbu1QQw15PZvPuutFkCr8SZT9+fECG7YC6bXqI9f0+EWeg== X-Received: by 2002:a05:6102:4b08:b0:4af:c58f:4550 with SMTP id ada2fe7eead31-4b690ba200bmr35307473137.7.1737950682792; Sun, 26 Jan 2025 20:04:42 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:41 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 11/14] platform/x86: Split the alienware-wmi driver Date: Sun, 26 Jan 2025 23:04:03 -0500 Message-ID: <20250127040406.17112-12-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Split alienware-wmi WMI drivers into different files. This is done seamlessly by copying and pasting, however some blocks are reordered. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/Makefile | 2 + .../platform/x86/dell/alienware-wmi-base.c | 859 ------------------ .../platform/x86/dell/alienware-wmi-legacy.c | 101 ++ .../platform/x86/dell/alienware-wmi-wmax.c | 782 ++++++++++++++++ drivers/platform/x86/dell/alienware-wmi.h | 1 - 5 files changed, 885 insertions(+), 860 deletions(-) create mode 100644 drivers/platform/x86/dell/alienware-wmi-legacy.c create mode 100644 drivers/platform/x86/dell/alienware-wmi-wmax.c diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile index f8aec8502c2f..03ba459f3d31 100644 --- a/drivers/platform/x86/dell/Makefile +++ b/drivers/platform/x86/dell/Makefile @@ -6,6 +6,8 @@ obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o alienware-wmi-objs := alienware-wmi-base.o +alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.o obj-$(CONFIG_DCDBAS) += dcdbas.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c index 1302b85d3e7b..d0f0b3c7a915 100644 --- a/drivers/platform/x86/dell/alienware-wmi-base.c +++ b/drivers/platform/x86/dell/alienware-wmi-base.c @@ -8,97 +8,22 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include -#include -#include #include #include #include -#include #include #include -#include #include "alienware-wmi.h" -#define WMAX_METHOD_HDMI_SOURCE 0x1 -#define WMAX_METHOD_HDMI_STATUS 0x2 -#define WMAX_METHOD_BRIGHTNESS 0x3 -#define WMAX_METHOD_ZONE_CONTROL 0x4 -#define WMAX_METHOD_HDMI_CABLE 0x5 -#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_METHOD_GAME_SHIFT_STATUS 0x25 - -#define WMAX_THERMAL_MODE_GMODE 0xAB - -#define WMAX_FAILURE_CODE 0xFFFFFFFF - MODULE_AUTHOR("Mario Limonciello "); MODULE_DESCRIPTION("Alienware special feature control"); MODULE_LICENSE("GPL"); -static bool force_platform_profile; -module_param_unsafe(force_platform_profile, bool, 0); -MODULE_PARM_DESC(force_platform_profile, "Forces auto-detecting thermal profiles without checking if WMI thermal backend is available"); - -static bool force_gmode; -module_param_unsafe(force_gmode, bool, 0); -MODULE_PARM_DESC(force_gmode, "Forces G-Mode when performance profile is selected"); - enum INTERFACE_FLAGS { LEGACY, WMAX, }; -enum WMAX_THERMAL_INFORMATION_OPERATIONS { - WMAX_OPERATION_SYS_DESCRIPTION = 0x02, - WMAX_OPERATION_LIST_IDS = 0x03, - WMAX_OPERATION_CURRENT_PROFILE = 0x0B, -}; - -enum WMAX_THERMAL_CONTROL_OPERATIONS { - WMAX_OPERATION_ACTIVATE_PROFILE = 0x01, -}; - -enum WMAX_GAME_SHIFT_STATUS_OPERATIONS { - WMAX_OPERATION_TOGGLE_GAME_SHIFT = 0x01, - WMAX_OPERATION_GET_GAME_SHIFT_STATUS = 0x02, -}; - -enum WMAX_THERMAL_TABLES { - WMAX_THERMAL_TABLE_BASIC = 0x90, - WMAX_THERMAL_TABLE_USTT = 0xA0, -}; - -enum wmax_thermal_mode { - THERMAL_MODE_USTT_BALANCED, - THERMAL_MODE_USTT_BALANCED_PERFORMANCE, - THERMAL_MODE_USTT_COOL, - THERMAL_MODE_USTT_QUIET, - THERMAL_MODE_USTT_PERFORMANCE, - THERMAL_MODE_USTT_LOW_POWER, - THERMAL_MODE_BASIC_QUIET, - THERMAL_MODE_BASIC_BALANCED, - THERMAL_MODE_BASIC_BALANCED_PERFORMANCE, - THERMAL_MODE_BASIC_PERFORMANCE, - THERMAL_MODE_LAST, -}; - -static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_MODE_LAST] = { - [THERMAL_MODE_USTT_BALANCED] = PLATFORM_PROFILE_BALANCED, - [THERMAL_MODE_USTT_BALANCED_PERFORMANCE] = PLATFORM_PROFILE_BALANCED_PERFORMANCE, - [THERMAL_MODE_USTT_COOL] = PLATFORM_PROFILE_COOL, - [THERMAL_MODE_USTT_QUIET] = PLATFORM_PROFILE_QUIET, - [THERMAL_MODE_USTT_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, - [THERMAL_MODE_USTT_LOW_POWER] = PLATFORM_PROFILE_LOW_POWER, - [THERMAL_MODE_BASIC_QUIET] = PLATFORM_PROFILE_QUIET, - [THERMAL_MODE_BASIC_BALANCED] = PLATFORM_PROFILE_BALANCED, - [THERMAL_MODE_BASIC_BALANCED_PERFORMANCE] = PLATFORM_PROFILE_BALANCED_PERFORMANCE, - [THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, -}; - struct alienfx_quirks *alienfx; static struct alienfx_quirks quirk_inspiron5675 = { @@ -223,147 +148,8 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { {} }; -struct wmax_brightness_args { - u32 led_mask; - u32 percentage; -}; - -struct wmax_basic_args { - u8 arg; -}; - -struct legacy_led_args { - struct color_platform colors; - u8 brightness; - u8 state; -} __packed; - -struct wmax_led_args { - u32 led_mask; - struct color_platform colors; - u8 state; -} __packed; - -struct wmax_u32_args { - u8 operation; - u8 arg1; - u8 arg2; - u8 arg3; -}; - -struct awcc_priv { - struct wmi_device *wdev; - struct device *ppdev; - enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; -}; - static u8 interface; -struct awcc_quirks { - bool gmode; -}; - -static struct awcc_quirks g_series_quirks = { - .gmode = true, -}; - -static struct awcc_quirks generic_quirks = { - .gmode = false, -}; - -static const struct dmi_system_id awcc_dmi_table[] __initconst = { - { - .ident = "Alienware m16 R1 AMD", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m16 R1 AMD"), - }, - .driver_data = &generic_quirks, - }, - { - .ident = "Alienware m17 R5", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), - }, - .driver_data = &generic_quirks, - }, - { - .ident = "Alienware m18 R2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"), - }, - .driver_data = &generic_quirks, - }, - { - .ident = "Alienware x15 R1", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"), - }, - .driver_data = &generic_quirks, - }, - { - .ident = "Alienware x17 R2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"), - }, - .driver_data = &generic_quirks, - }, - { - .ident = "Dell Inc. G15 5510", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"), - }, - .driver_data = &g_series_quirks, - }, - { - .ident = "Dell Inc. G15 5511", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), - }, - .driver_data = &g_series_quirks, - }, - { - .ident = "Dell Inc. G15 5515", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"), - }, - .driver_data = &g_series_quirks, - }, - { - .ident = "Dell Inc. G3 3500", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"), - }, - .driver_data = &g_series_quirks, - }, - { - .ident = "Dell Inc. G3 3590", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"), - }, - .driver_data = &g_series_quirks, - }, - { - .ident = "Dell Inc. G5 5500", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"), - }, - .driver_data = &g_series_quirks, - }, -}; - -static struct awcc_quirks *awcc; - int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, void *in_args, size_t in_size, u32 *out_data) { @@ -599,449 +385,6 @@ static enum led_brightness global_led_get(struct led_classdev *led_cdev) return priv->global_brightness; } -/* - * The HDMI mux sysfs node indicates the status of the HDMI input mux. - * It can toggle between standard system GPU output and HDMI input. - */ -static ssize_t cable_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct alienfx_platdata *pdata = dev_get_platdata(dev); - struct wmax_basic_args in_args = { - .arg = 0, - }; - u32 out_data; - int ret; - - ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_CABLE, - &in_args, sizeof(in_args), &out_data); - - if (!ret) { - if (out_data == 0) - return sysfs_emit(buf, "[unconnected] connected unknown\n"); - else if (out_data == 1) - return sysfs_emit(buf, "unconnected [connected] unknown\n"); - } - - pr_err("alienware-wmi: unknown HDMI cable status: %d\n", ret); - return sysfs_emit(buf, "unconnected connected [unknown]\n"); -} - -static ssize_t source_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct alienfx_platdata *pdata = dev_get_platdata(dev); - struct wmax_basic_args in_args = { - .arg = 0, - }; - u32 out_data; - int ret; - - ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_STATUS, - &in_args, sizeof(in_args), &out_data); - - if (!ret) { - if (out_data == 1) - return sysfs_emit(buf, "[input] gpu unknown\n"); - else if (out_data == 2) - return sysfs_emit(buf, "input [gpu] unknown\n"); - } - - pr_err("alienware-wmi: unknown HDMI source status: %u\n", ret); - return sysfs_emit(buf, "input gpu [unknown]\n"); -} - -static ssize_t source_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct alienfx_platdata *pdata = dev_get_platdata(dev); - struct wmax_basic_args args; - int ret; - - if (strcmp(buf, "gpu\n") == 0) - args.arg = 1; - else if (strcmp(buf, "input\n") == 0) - args.arg = 2; - else - args.arg = 3; - pr_debug("alienware-wmi: setting hdmi to %d : %s", args.arg, buf); - - ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_SOURCE, &args, - sizeof(args), NULL); - - if (ret < 0) - pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", ret); - - return count; -} - -static DEVICE_ATTR_RO(cable); -static DEVICE_ATTR_RW(source); - -static bool hdmi_group_visible(struct kobject *kobj) -{ - return alienfx->hdmi_mux; -} -DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(hdmi); - -static struct attribute *hdmi_attrs[] = { - &dev_attr_cable.attr, - &dev_attr_source.attr, - NULL, -}; - -static const struct attribute_group hdmi_attribute_group = { - .name = "hdmi", - .is_visible = SYSFS_GROUP_VISIBLE(hdmi), - .attrs = hdmi_attrs, -}; - -/* - * Alienware GFX amplifier support - * - Currently supports reading cable status - * - Leaving expansion room to possibly support dock/undock events later - */ -static ssize_t status_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct alienfx_platdata *pdata = dev_get_platdata(dev); - struct wmax_basic_args in_args = { - .arg = 0, - }; - u32 out_data; - int ret; - - ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_AMPLIFIER_CABLE, - &in_args, sizeof(in_args), &out_data); - - if (!ret) { - if (out_data == 0) - return sysfs_emit(buf, "[unconnected] connected unknown\n"); - else if (out_data == 1) - return sysfs_emit(buf, "unconnected [connected] unknown\n"); - } - - pr_err("alienware-wmi: unknown amplifier cable status: %d\n", ret); - return sysfs_emit(buf, "unconnected connected [unknown]\n"); -} - -static DEVICE_ATTR_RO(status); - -static bool amplifier_group_visible(struct kobject *kobj) -{ - return alienfx->amplifier; -} -DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(amplifier); - -static struct attribute *amplifier_attrs[] = { - &dev_attr_status.attr, - NULL, -}; - -static const struct attribute_group amplifier_attribute_group = { - .name = "amplifier", - .is_visible = SYSFS_GROUP_VISIBLE(amplifier), - .attrs = amplifier_attrs, -}; - -/* - * Deep Sleep Control support - * - Modifies BIOS setting for deep sleep control allowing extra wakeup events - */ -static ssize_t deepsleep_show(struct device *dev, struct device_attribute *attr, - char *buf) -{ - struct alienfx_platdata *pdata = dev_get_platdata(dev); - struct wmax_basic_args in_args = { - .arg = 0, - }; - u32 out_data; - int ret; - - ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_DEEP_SLEEP_STATUS, - &in_args, sizeof(in_args), &out_data); - - if (!ret) { - if (out_data == 0) - return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); - else if (out_data == 1) - return sysfs_emit(buf, "disabled [s5] s5_s4\n"); - else if (out_data == 2) - return sysfs_emit(buf, "disabled s5 [s5_s4]\n"); - } - - pr_err("alienware-wmi: unknown deep sleep status: %d\n", ret); - return sysfs_emit(buf, "disabled s5 s5_s4 [unknown]\n"); -} - -static ssize_t deepsleep_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct alienfx_platdata *pdata = dev_get_platdata(dev); - struct wmax_basic_args args; - int ret; - - if (strcmp(buf, "disabled\n") == 0) - args.arg = 0; - else if (strcmp(buf, "s5\n") == 0) - args.arg = 1; - else - args.arg = 2; - pr_debug("alienware-wmi: setting deep sleep to %d : %s", args.arg, buf); - - ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_DEEP_SLEEP_CONTROL, - &args, sizeof(args), NULL); - - if (!ret) - pr_err("alienware-wmi: deep sleep control failed: results: %u\n", ret); - - return count; -} - -static DEVICE_ATTR_RW(deepsleep); - -static bool deepsleep_group_visible(struct kobject *kobj) -{ - return alienfx->deepslp; -} -DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(deepsleep); - -static struct attribute *deepsleep_attrs[] = { - &dev_attr_deepsleep.attr, - NULL, -}; - -static const struct attribute_group deepsleep_attribute_group = { - .name = "deepsleep", - .is_visible = SYSFS_GROUP_VISIBLE(deepsleep), - .attrs = deepsleep_attrs, -}; - -/* - * Thermal Profile control - * - Provides thermal profile control through the Platform Profile API - */ -#define WMAX_THERMAL_TABLE_MASK GENMASK(7, 4) -#define WMAX_THERMAL_MODE_MASK GENMASK(3, 0) -#define WMAX_SENSOR_ID_MASK BIT(8) - -static bool is_wmax_thermal_code(u32 code) -{ - if (code & WMAX_SENSOR_ID_MASK) - return false; - - if ((code & WMAX_THERMAL_MODE_MASK) >= THERMAL_MODE_LAST) - return false; - - if ((code & WMAX_THERMAL_TABLE_MASK) == WMAX_THERMAL_TABLE_BASIC && - (code & WMAX_THERMAL_MODE_MASK) >= THERMAL_MODE_BASIC_QUIET) - return true; - - if ((code & WMAX_THERMAL_TABLE_MASK) == WMAX_THERMAL_TABLE_USTT && - (code & WMAX_THERMAL_MODE_MASK) <= THERMAL_MODE_USTT_LOW_POWER) - return true; - - return false; -} - -static int wmax_thermal_information(struct wmi_device *wdev, u8 operation, - u8 arg, u32 *out_data) -{ - struct wmax_u32_args in_args = { - .operation = operation, - .arg1 = arg, - .arg2 = 0, - .arg3 = 0, - }; - int ret; - - ret = alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_INFORMATION, - &in_args, sizeof(in_args), out_data); - if (ret < 0) - return ret; - - if (*out_data == WMAX_FAILURE_CODE) - return -EBADRQC; - - return 0; -} - -static int wmax_thermal_control(struct wmi_device *wdev, u8 profile) -{ - struct wmax_u32_args in_args = { - .operation = WMAX_OPERATION_ACTIVATE_PROFILE, - .arg1 = profile, - .arg2 = 0, - .arg3 = 0, - }; - u32 out_data; - int ret; - - ret = alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_CONTROL, - &in_args, sizeof(in_args), &out_data); - if (ret) - return ret; - - if (out_data == WMAX_FAILURE_CODE) - return -EBADRQC; - - return 0; -} - -static int wmax_game_shift_status(struct wmi_device *wdev, u8 operation, - u32 *out_data) -{ - struct wmax_u32_args in_args = { - .operation = operation, - .arg1 = 0, - .arg2 = 0, - .arg3 = 0, - }; - int ret; - - ret = alienware_wmi_command(wdev, WMAX_METHOD_GAME_SHIFT_STATUS, - &in_args, sizeof(in_args), out_data); - - if (ret < 0) - return ret; - - if (*out_data == WMAX_FAILURE_CODE) - return -EOPNOTSUPP; - - return 0; -} - -static int thermal_profile_get(struct device *dev, - enum platform_profile_option *profile) -{ - struct awcc_priv *priv = dev_get_drvdata(dev); - u32 out_data; - int ret; - - ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_CURRENT_PROFILE, - 0, &out_data); - - if (ret < 0) - return ret; - - if (out_data == WMAX_THERMAL_MODE_GMODE) { - *profile = PLATFORM_PROFILE_PERFORMANCE; - return 0; - } - - if (!is_wmax_thermal_code(out_data)) - return -ENODATA; - - out_data &= WMAX_THERMAL_MODE_MASK; - *profile = wmax_mode_to_platform_profile[out_data]; - - return 0; -} - -static int thermal_profile_set(struct device *dev, - enum platform_profile_option profile) -{ - struct awcc_priv *priv = dev_get_drvdata(dev); - - if (awcc->gmode) { - u32 gmode_status; - int ret; - - ret = wmax_game_shift_status(priv->wdev, - WMAX_OPERATION_GET_GAME_SHIFT_STATUS, - &gmode_status); - - if (ret < 0) - return ret; - - if ((profile == PLATFORM_PROFILE_PERFORMANCE && !gmode_status) || - (profile != PLATFORM_PROFILE_PERFORMANCE && gmode_status)) { - ret = wmax_game_shift_status(priv->wdev, - WMAX_OPERATION_TOGGLE_GAME_SHIFT, - &gmode_status); - - if (ret < 0) - return ret; - } - } - - return wmax_thermal_control(priv->wdev, - priv->supported_thermal_profiles[profile]); -} - -static int thermal_profile_probe(void *drvdata, unsigned long *choices) -{ - enum platform_profile_option profile; - struct awcc_priv *priv = drvdata; - enum wmax_thermal_mode mode; - u8 sys_desc[4]; - u32 first_mode; - u32 out_data; - int ret; - - ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_SYS_DESCRIPTION, - 0, (u32 *) &sys_desc); - if (ret < 0) - return ret; - - first_mode = sys_desc[0] + sys_desc[1]; - - for (u32 i = 0; i < sys_desc[3]; i++) { - ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_LIST_IDS, - i + first_mode, &out_data); - - if (ret == -EIO) - return ret; - - if (ret == -EBADRQC) - break; - - if (!is_wmax_thermal_code(out_data)) - continue; - - mode = out_data & WMAX_THERMAL_MODE_MASK; - profile = wmax_mode_to_platform_profile[mode]; - priv->supported_thermal_profiles[profile] = out_data; - - set_bit(profile, choices); - } - - if (bitmap_empty(choices, PLATFORM_PROFILE_LAST)) - return -ENODEV; - - if (awcc->gmode) { - priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = - WMAX_THERMAL_MODE_GMODE; - - set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); - } - - return 0; -} - -static const struct platform_profile_ops awcc_platform_profile_ops = { - .probe = thermal_profile_probe, - .profile_get = thermal_profile_get, - .profile_set = thermal_profile_set, -}; - -static int alienware_awcc_setup(struct wmi_device *wdev) -{ - struct awcc_priv *priv; - - priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - priv->wdev = wdev; - dev_set_drvdata(&wdev->dev, priv); - - priv->ppdev = devm_platform_profile_register(&wdev->dev, "alienware-wmi", - priv, &awcc_platform_profile_ops); - - return PTR_ERR_OR_ZERO(priv->ppdev); -} - /* * Platform Driver */ @@ -1074,13 +417,6 @@ static const struct attribute_group *alienfx_groups[] = { NULL }; -static const struct attribute_group *wmax_alienfx_groups[] = { - &hdmi_attribute_group, - &lifier_attribute_group, - &deepsleep_attribute_group, - NULL -}; - static struct platform_driver platform_driver = { .driver = { .name = "alienware-wmi", @@ -1109,201 +445,6 @@ void alienware_alienfx_exit(struct wmi_device *wdev) platform_device_unregister(pdev); } -/* - * Legacy WMI driver - */ -static int legacy_wmi_update_led(struct alienfx_priv *priv, - struct wmi_device *wdev, u8 location) -{ - struct legacy_led_args legacy_args = { - .colors = priv->colors[location], - .brightness = priv->global_brightness, - .state = 0, - }; - struct acpi_buffer input; - acpi_status status; - - if (legacy_args.state != LEGACY_RUNNING) { - legacy_args.state = priv->lighting_control_state; - - input.length = sizeof(legacy_args); - input.pointer = &legacy_args; - - status = wmi_evaluate_method(LEGACY_POWER_CONTROL_GUID, 0, - location + 1, &input, NULL); - if (ACPI_FAILURE(status)) - return -EIO; - - return 0; - } - - return alienware_wmi_command(wdev, location + 1, &legacy_args, - sizeof(legacy_args), NULL); -} - -static int legacy_wmi_update_brightness(struct alienfx_priv *priv, - struct wmi_device *wdev, u8 brightness) -{ - return legacy_wmi_update_led(priv, wdev, 0); -} - -static int legacy_wmi_probe(struct wmi_device *wdev, const void *context) -{ - struct alienfx_platdata pdata = { - .wdev = wdev, - .ops = { - .upd_led = legacy_wmi_update_led, - .upd_brightness = legacy_wmi_update_brightness, - }, - }; - - return alienware_alienfx_setup(&pdata); -} - -static void legacy_wmi_remove(struct wmi_device *wdev) -{ - alienware_alienfx_exit(wdev); -} - -static const struct wmi_device_id alienware_legacy_device_id_table[] = { - { LEGACY_CONTROL_GUID, NULL }, - { }, -}; -MODULE_DEVICE_TABLE(wmi, alienware_legacy_device_id_table); - -static struct wmi_driver alienware_legacy_wmi_driver = { - .driver = { - .name = "alienware-wmi-alienfx", - .probe_type = PROBE_PREFER_ASYNCHRONOUS, - }, - .id_table = alienware_legacy_device_id_table, - .probe = legacy_wmi_probe, - .remove = legacy_wmi_remove, - .no_singleton = true, -}; - -int __init alienware_legacy_wmi_init(void) -{ - return wmi_driver_register(&alienware_legacy_wmi_driver); -} - -void __exit alienware_legacy_wmi_exit(void) -{ - wmi_driver_unregister(&alienware_legacy_wmi_driver); -} - -/* - * WMAX WMI driver - */ -static int wmax_wmi_update_led(struct alienfx_priv *priv, - struct wmi_device *wdev, u8 location) -{ - struct wmax_led_args in_args = { - .led_mask = 1 << location, - .colors = priv->colors[location], - .state = priv->lighting_control_state, - }; - - return alienware_wmi_command(wdev, WMAX_METHOD_ZONE_CONTROL, &in_args, - sizeof(in_args), NULL); -} - -static int wmax_wmi_update_brightness(struct alienfx_priv *priv, - struct wmi_device *wdev, u8 brightness) -{ - struct wmax_brightness_args in_args = { - .led_mask = 0xFF, - .percentage = brightness, - }; - - return alienware_wmi_command(wdev, WMAX_METHOD_BRIGHTNESS, &in_args, - sizeof(in_args), NULL); -} - -static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) -{ - struct alienfx_platdata pdata = { - .wdev = wdev, - .ops = { - .upd_led = wmax_wmi_update_led, - .upd_brightness = wmax_wmi_update_brightness, - }, - }; - struct platform_device *pdev; - int ret; - - if (awcc) { - return alienware_awcc_setup(wdev); - } else { - ret = alienware_alienfx_setup(&pdata); - if (ret < 0) - return ret; - - pdev = dev_get_drvdata(&wdev->dev); - - ret = device_add_groups(&pdev->dev, wmax_alienfx_groups); - if (ret < 0) - alienware_alienfx_exit(wdev); - - return ret; - } -} - -static void wmax_wmi_remove(struct wmi_device *wdev) -{ - struct platform_device *pdev; - - if (!awcc) { - pdev = dev_get_drvdata(&wdev->dev); - - device_remove_groups(&pdev->dev, wmax_alienfx_groups); - alienware_alienfx_exit(wdev); - } -} - -static const struct wmi_device_id alienware_wmax_device_id_table[] = { - { WMAX_CONTROL_GUID, NULL }, - { }, -}; -MODULE_DEVICE_TABLE(wmi, alienware_wmax_device_id_table); - -static struct wmi_driver alienware_wmax_wmi_driver = { - .driver = { - .name = "alienware-wmi-wmax", - .probe_type = PROBE_PREFER_ASYNCHRONOUS, - }, - .id_table = alienware_wmax_device_id_table, - .probe = wmax_wmi_probe, - .remove = wmax_wmi_remove, - .no_singleton = true, -}; - -int __init alienware_wmax_wmi_init(void) -{ - const struct dmi_system_id *id; - - id = dmi_first_match(awcc_dmi_table); - if (id) - awcc = id->driver_data; - - if (force_platform_profile) - awcc = &generic_quirks; - - if (force_gmode) { - if (awcc) - awcc->gmode = true; - else - pr_warn("force_gmode requires platform profile support\n"); - } - - return wmi_driver_register(&alienware_wmax_wmi_driver); -} - -void __exit alienware_wmax_wmi_exit(void) -{ - wmi_driver_unregister(&alienware_wmax_wmi_driver); -} - static int __init alienware_wmi_init(void) { int ret; diff --git a/drivers/platform/x86/dell/alienware-wmi-legacy.c b/drivers/platform/x86/dell/alienware-wmi-legacy.c new file mode 100644 index 000000000000..48f8a204c7cc --- /dev/null +++ b/drivers/platform/x86/dell/alienware-wmi-legacy.c @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Alienware LEGACY WMI device driver + * + * Copyright (C) 2025 Kurt Borja + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include "alienware-wmi.h" + +struct legacy_led_args { + struct color_platform colors; + u8 brightness; + u8 state; +} __packed; + + +/* + * Legacy WMI driver + */ +static int legacy_wmi_update_led(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 location) +{ + struct legacy_led_args legacy_args = { + .colors = priv->colors[location], + .brightness = priv->global_brightness, + .state = 0, + }; + struct acpi_buffer input; + acpi_status status; + + if (legacy_args.state != LEGACY_RUNNING) { + legacy_args.state = priv->lighting_control_state; + + input.length = sizeof(legacy_args); + input.pointer = &legacy_args; + + status = wmi_evaluate_method(LEGACY_POWER_CONTROL_GUID, 0, + location + 1, &input, NULL); + if (ACPI_FAILURE(status)) + return -EIO; + + return 0; + } + + return alienware_wmi_command(wdev, location + 1, &legacy_args, + sizeof(legacy_args), NULL); +} + +static int legacy_wmi_update_brightness(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 brightness) +{ + return legacy_wmi_update_led(priv, wdev, 0); +} + +static int legacy_wmi_probe(struct wmi_device *wdev, const void *context) +{ + struct alienfx_platdata pdata = { + .wdev = wdev, + .ops = { + .upd_led = legacy_wmi_update_led, + .upd_brightness = legacy_wmi_update_brightness, + }, + }; + + return alienware_alienfx_setup(&pdata); +} + +static void legacy_wmi_remove(struct wmi_device *wdev) +{ + alienware_alienfx_exit(wdev); +} + +static const struct wmi_device_id alienware_legacy_device_id_table[] = { + { LEGACY_CONTROL_GUID, NULL }, + { }, +}; +MODULE_DEVICE_TABLE(wmi, alienware_legacy_device_id_table); + +static struct wmi_driver alienware_legacy_wmi_driver = { + .driver = { + .name = "alienware-wmi-alienfx", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, + .id_table = alienware_legacy_device_id_table, + .probe = legacy_wmi_probe, + .remove = legacy_wmi_remove, + .no_singleton = true, +}; + +int __init alienware_legacy_wmi_init(void) +{ + return wmi_driver_register(&alienware_legacy_wmi_driver); +} + +void __exit alienware_legacy_wmi_exit(void) +{ + wmi_driver_unregister(&alienware_legacy_wmi_driver); +} diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platform/x86/dell/alienware-wmi-wmax.c new file mode 100644 index 000000000000..c284024f600c --- /dev/null +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -0,0 +1,782 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Alienware WMAX WMI device driver + * + * Copyright (C) 2014 Dell Inc + * Copyright (C) 2025 Kurt Borja + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include +#include +#include +#include +#include +#include +#include "alienware-wmi.h" + +#define WMAX_METHOD_HDMI_SOURCE 0x1 +#define WMAX_METHOD_HDMI_STATUS 0x2 +#define WMAX_METHOD_HDMI_CABLE 0x5 +#define WMAX_METHOD_AMPLIFIER_CABLE 0x6 +#define WMAX_METHOD_DEEP_SLEEP_CONTROL 0x0B +#define WMAX_METHOD_DEEP_SLEEP_STATUS 0x0C +#define WMAX_METHOD_BRIGHTNESS 0x3 +#define WMAX_METHOD_ZONE_CONTROL 0x4 +#define WMAX_METHOD_THERMAL_INFORMATION 0x14 +#define WMAX_METHOD_THERMAL_CONTROL 0x15 +#define WMAX_METHOD_GAME_SHIFT_STATUS 0x25 + +#define WMAX_THERMAL_MODE_GMODE 0xAB + +#define WMAX_FAILURE_CODE 0xFFFFFFFF +#define WMAX_THERMAL_TABLE_MASK GENMASK(7, 4) +#define WMAX_THERMAL_MODE_MASK GENMASK(3, 0) +#define WMAX_SENSOR_ID_MASK BIT(8) + +static bool force_platform_profile; +module_param_unsafe(force_platform_profile, bool, 0); +MODULE_PARM_DESC(force_platform_profile, "Forces auto-detecting thermal profiles without checking if WMI thermal backend is available"); + +static bool force_gmode; +module_param_unsafe(force_gmode, bool, 0); +MODULE_PARM_DESC(force_gmode, "Forces G-Mode when performance profile is selected"); + +struct awcc_quirks { + bool gmode; +}; + +static struct awcc_quirks g_series_quirks = { + .gmode = true, +}; + +static struct awcc_quirks generic_quirks = { + .gmode = false, +}; + +static const struct dmi_system_id awcc_dmi_table[] __initconst = { + { + .ident = "Alienware m16 R1 AMD", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m16 R1 AMD"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Alienware m17 R5", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m17 R5 AMD"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware m18 R2", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware m18 R2"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware x15 R1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Alienware x17 R2", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x17 R2"), + }, + .driver_data = &generic_quirks, + }, + { + .ident = "Dell Inc. G15 5510", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5510"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G15 5511", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5511"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G15 5515", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G3 3500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "G3 3500"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G3 3590", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "G3 3590"), + }, + .driver_data = &g_series_quirks, + }, + { + .ident = "Dell Inc. G5 5500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "G5 5500"), + }, + .driver_data = &g_series_quirks, + }, +}; + +enum WMAX_THERMAL_INFORMATION_OPERATIONS { + WMAX_OPERATION_SYS_DESCRIPTION = 0x02, + WMAX_OPERATION_LIST_IDS = 0x03, + WMAX_OPERATION_CURRENT_PROFILE = 0x0B, +}; + +enum WMAX_THERMAL_CONTROL_OPERATIONS { + WMAX_OPERATION_ACTIVATE_PROFILE = 0x01, +}; + +enum WMAX_GAME_SHIFT_STATUS_OPERATIONS { + WMAX_OPERATION_TOGGLE_GAME_SHIFT = 0x01, + WMAX_OPERATION_GET_GAME_SHIFT_STATUS = 0x02, +}; + +enum WMAX_THERMAL_TABLES { + WMAX_THERMAL_TABLE_BASIC = 0x90, + WMAX_THERMAL_TABLE_USTT = 0xA0, +}; + +enum wmax_thermal_mode { + THERMAL_MODE_USTT_BALANCED, + THERMAL_MODE_USTT_BALANCED_PERFORMANCE, + THERMAL_MODE_USTT_COOL, + THERMAL_MODE_USTT_QUIET, + THERMAL_MODE_USTT_PERFORMANCE, + THERMAL_MODE_USTT_LOW_POWER, + THERMAL_MODE_BASIC_QUIET, + THERMAL_MODE_BASIC_BALANCED, + THERMAL_MODE_BASIC_BALANCED_PERFORMANCE, + THERMAL_MODE_BASIC_PERFORMANCE, + THERMAL_MODE_LAST, +}; + +struct wmax_led_args { + u32 led_mask; + struct color_platform colors; + u8 state; +} __packed; + +struct wmax_brightness_args { + u32 led_mask; + u32 percentage; +}; + +struct wmax_basic_args { + u8 arg; +}; + +struct wmax_u32_args { + u8 operation; + u8 arg1; + u8 arg2; + u8 arg3; +}; + +struct awcc_priv { + struct wmi_device *wdev; + struct device *ppdev; + enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; +}; + +static const enum platform_profile_option wmax_mode_to_platform_profile[THERMAL_MODE_LAST] = { + [THERMAL_MODE_USTT_BALANCED] = PLATFORM_PROFILE_BALANCED, + [THERMAL_MODE_USTT_BALANCED_PERFORMANCE] = PLATFORM_PROFILE_BALANCED_PERFORMANCE, + [THERMAL_MODE_USTT_COOL] = PLATFORM_PROFILE_COOL, + [THERMAL_MODE_USTT_QUIET] = PLATFORM_PROFILE_QUIET, + [THERMAL_MODE_USTT_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, + [THERMAL_MODE_USTT_LOW_POWER] = PLATFORM_PROFILE_LOW_POWER, + [THERMAL_MODE_BASIC_QUIET] = PLATFORM_PROFILE_QUIET, + [THERMAL_MODE_BASIC_BALANCED] = PLATFORM_PROFILE_BALANCED, + [THERMAL_MODE_BASIC_BALANCED_PERFORMANCE] = PLATFORM_PROFILE_BALANCED_PERFORMANCE, + [THERMAL_MODE_BASIC_PERFORMANCE] = PLATFORM_PROFILE_PERFORMANCE, +}; + +static struct awcc_quirks *awcc; + +/* + * The HDMI mux sysfs node indicates the status of the HDMI input mux. + * It can toggle between standard system GPU output and HDMI input. + */ +static ssize_t cable_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct alienfx_platdata *pdata = dev_get_platdata(dev); + struct wmax_basic_args in_args = { + .arg = 0, + }; + u32 out_data; + int ret; + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_CABLE, + &in_args, sizeof(in_args), &out_data); + + if (!ret) { + if (out_data == 0) + return sysfs_emit(buf, "[unconnected] connected unknown\n"); + else if (out_data == 1) + return sysfs_emit(buf, "unconnected [connected] unknown\n"); + } + + pr_err("alienware-wmi: unknown HDMI cable status: %d\n", ret); + return sysfs_emit(buf, "unconnected connected [unknown]\n"); +} + +static ssize_t source_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct alienfx_platdata *pdata = dev_get_platdata(dev); + struct wmax_basic_args in_args = { + .arg = 0, + }; + u32 out_data; + int ret; + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_STATUS, + &in_args, sizeof(in_args), &out_data); + + if (!ret) { + if (out_data == 1) + return sysfs_emit(buf, "[input] gpu unknown\n"); + else if (out_data == 2) + return sysfs_emit(buf, "input [gpu] unknown\n"); + } + + pr_err("alienware-wmi: unknown HDMI source status: %u\n", ret); + return sysfs_emit(buf, "input gpu [unknown]\n"); +} + +static ssize_t source_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct alienfx_platdata *pdata = dev_get_platdata(dev); + struct wmax_basic_args args; + int ret; + + if (strcmp(buf, "gpu\n") == 0) + args.arg = 1; + else if (strcmp(buf, "input\n") == 0) + args.arg = 2; + else + args.arg = 3; + pr_debug("alienware-wmi: setting hdmi to %d : %s", args.arg, buf); + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_HDMI_SOURCE, &args, + sizeof(args), NULL); + + if (ret < 0) + pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", ret); + + return count; +} + +static DEVICE_ATTR_RO(cable); +static DEVICE_ATTR_RW(source); + +static bool hdmi_group_visible(struct kobject *kobj) +{ + return alienfx->hdmi_mux; +} +DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(hdmi); + +static struct attribute *hdmi_attrs[] = { + &dev_attr_cable.attr, + &dev_attr_source.attr, + NULL, +}; + +static const struct attribute_group hdmi_attribute_group = { + .name = "hdmi", + .is_visible = SYSFS_GROUP_VISIBLE(hdmi), + .attrs = hdmi_attrs, +}; + +/* + * Alienware GFX amplifier support + * - Currently supports reading cable status + * - Leaving expansion room to possibly support dock/undock events later + */ +static ssize_t status_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct alienfx_platdata *pdata = dev_get_platdata(dev); + struct wmax_basic_args in_args = { + .arg = 0, + }; + u32 out_data; + int ret; + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_AMPLIFIER_CABLE, + &in_args, sizeof(in_args), &out_data); + + if (!ret) { + if (out_data == 0) + return sysfs_emit(buf, "[unconnected] connected unknown\n"); + else if (out_data == 1) + return sysfs_emit(buf, "unconnected [connected] unknown\n"); + } + + pr_err("alienware-wmi: unknown amplifier cable status: %d\n", ret); + return sysfs_emit(buf, "unconnected connected [unknown]\n"); +} + +static DEVICE_ATTR_RO(status); + +static bool amplifier_group_visible(struct kobject *kobj) +{ + return alienfx->amplifier; +} +DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(amplifier); + +static struct attribute *amplifier_attrs[] = { + &dev_attr_status.attr, + NULL, +}; + +static const struct attribute_group amplifier_attribute_group = { + .name = "amplifier", + .is_visible = SYSFS_GROUP_VISIBLE(amplifier), + .attrs = amplifier_attrs, +}; + +/* + * Deep Sleep Control support + * - Modifies BIOS setting for deep sleep control allowing extra wakeup events + */ +static ssize_t deepsleep_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct alienfx_platdata *pdata = dev_get_platdata(dev); + struct wmax_basic_args in_args = { + .arg = 0, + }; + u32 out_data; + int ret; + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_DEEP_SLEEP_STATUS, + &in_args, sizeof(in_args), &out_data); + + if (!ret) { + if (out_data == 0) + return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); + else if (out_data == 1) + return sysfs_emit(buf, "disabled [s5] s5_s4\n"); + else if (out_data == 2) + return sysfs_emit(buf, "disabled s5 [s5_s4]\n"); + } + + pr_err("alienware-wmi: unknown deep sleep status: %d\n", ret); + return sysfs_emit(buf, "disabled s5 s5_s4 [unknown]\n"); +} + +static ssize_t deepsleep_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct alienfx_platdata *pdata = dev_get_platdata(dev); + struct wmax_basic_args args; + int ret; + + if (strcmp(buf, "disabled\n") == 0) + args.arg = 0; + else if (strcmp(buf, "s5\n") == 0) + args.arg = 1; + else + args.arg = 2; + pr_debug("alienware-wmi: setting deep sleep to %d : %s", args.arg, buf); + + ret = alienware_wmi_command(pdata->wdev, WMAX_METHOD_DEEP_SLEEP_CONTROL, + &args, sizeof(args), NULL); + + if (!ret) + pr_err("alienware-wmi: deep sleep control failed: results: %u\n", ret); + + return count; +} + +static DEVICE_ATTR_RW(deepsleep); + +static bool deepsleep_group_visible(struct kobject *kobj) +{ + return alienfx->deepslp; +} +DEFINE_SIMPLE_SYSFS_GROUP_VISIBLE(deepsleep); + +static struct attribute *deepsleep_attrs[] = { + &dev_attr_deepsleep.attr, + NULL, +}; + +static const struct attribute_group deepsleep_attribute_group = { + .name = "deepsleep", + .is_visible = SYSFS_GROUP_VISIBLE(deepsleep), + .attrs = deepsleep_attrs, +}; + +static const struct attribute_group *wmax_alienfx_groups[] = { + &hdmi_attribute_group, + &lifier_attribute_group, + &deepsleep_attribute_group, + NULL +}; + +/* + * Thermal Profile control + * - Provides thermal profile control through the Platform Profile API + */ +static bool is_wmax_thermal_code(u32 code) +{ + if (code & WMAX_SENSOR_ID_MASK) + return false; + + if ((code & WMAX_THERMAL_MODE_MASK) >= THERMAL_MODE_LAST) + return false; + + if ((code & WMAX_THERMAL_TABLE_MASK) == WMAX_THERMAL_TABLE_BASIC && + (code & WMAX_THERMAL_MODE_MASK) >= THERMAL_MODE_BASIC_QUIET) + return true; + + if ((code & WMAX_THERMAL_TABLE_MASK) == WMAX_THERMAL_TABLE_USTT && + (code & WMAX_THERMAL_MODE_MASK) <= THERMAL_MODE_USTT_LOW_POWER) + return true; + + return false; +} + +static int wmax_thermal_information(struct wmi_device *wdev, u8 operation, + u8 arg, u32 *out_data) +{ + struct wmax_u32_args in_args = { + .operation = operation, + .arg1 = arg, + .arg2 = 0, + .arg3 = 0, + }; + int ret; + + ret = alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_INFORMATION, + &in_args, sizeof(in_args), out_data); + if (ret < 0) + return ret; + + if (*out_data == WMAX_FAILURE_CODE) + return -EBADRQC; + + return 0; +} + +static int wmax_thermal_control(struct wmi_device *wdev, u8 profile) +{ + struct wmax_u32_args in_args = { + .operation = WMAX_OPERATION_ACTIVATE_PROFILE, + .arg1 = profile, + .arg2 = 0, + .arg3 = 0, + }; + u32 out_data; + int ret; + + ret = alienware_wmi_command(wdev, WMAX_METHOD_THERMAL_CONTROL, + &in_args, sizeof(in_args), &out_data); + if (ret) + return ret; + + if (out_data == WMAX_FAILURE_CODE) + return -EBADRQC; + + return 0; +} + +static int wmax_game_shift_status(struct wmi_device *wdev, u8 operation, + u32 *out_data) +{ + struct wmax_u32_args in_args = { + .operation = operation, + .arg1 = 0, + .arg2 = 0, + .arg3 = 0, + }; + int ret; + + ret = alienware_wmi_command(wdev, WMAX_METHOD_GAME_SHIFT_STATUS, + &in_args, sizeof(in_args), out_data); + + if (ret < 0) + return ret; + + if (*out_data == WMAX_FAILURE_CODE) + return -EOPNOTSUPP; + + return 0; +} + +static int thermal_profile_get(struct device *dev, + enum platform_profile_option *profile) +{ + struct awcc_priv *priv = dev_get_drvdata(dev); + u32 out_data; + int ret; + + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_CURRENT_PROFILE, + 0, &out_data); + + if (ret < 0) + return ret; + + if (out_data == WMAX_THERMAL_MODE_GMODE) { + *profile = PLATFORM_PROFILE_PERFORMANCE; + return 0; + } + + if (!is_wmax_thermal_code(out_data)) + return -ENODATA; + + out_data &= WMAX_THERMAL_MODE_MASK; + *profile = wmax_mode_to_platform_profile[out_data]; + + return 0; +} + +static int thermal_profile_set(struct device *dev, + enum platform_profile_option profile) +{ + struct awcc_priv *priv = dev_get_drvdata(dev); + + if (awcc->gmode) { + u32 gmode_status; + int ret; + + ret = wmax_game_shift_status(priv->wdev, + WMAX_OPERATION_GET_GAME_SHIFT_STATUS, + &gmode_status); + + if (ret < 0) + return ret; + + if ((profile == PLATFORM_PROFILE_PERFORMANCE && !gmode_status) || + (profile != PLATFORM_PROFILE_PERFORMANCE && gmode_status)) { + ret = wmax_game_shift_status(priv->wdev, + WMAX_OPERATION_TOGGLE_GAME_SHIFT, + &gmode_status); + + if (ret < 0) + return ret; + } + } + + return wmax_thermal_control(priv->wdev, + priv->supported_thermal_profiles[profile]); +} + +static int thermal_profile_probe(void *drvdata, unsigned long *choices) +{ + enum platform_profile_option profile; + struct awcc_priv *priv = drvdata; + enum wmax_thermal_mode mode; + u8 sys_desc[4]; + u32 first_mode; + u32 out_data; + int ret; + + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_SYS_DESCRIPTION, + 0, (u32 *) &sys_desc); + if (ret < 0) + return ret; + + first_mode = sys_desc[0] + sys_desc[1]; + + for (u32 i = 0; i < sys_desc[3]; i++) { + ret = wmax_thermal_information(priv->wdev, WMAX_OPERATION_LIST_IDS, + i + first_mode, &out_data); + + if (ret == -EIO) + return ret; + + if (ret == -EBADRQC) + break; + + if (!is_wmax_thermal_code(out_data)) + continue; + + mode = out_data & WMAX_THERMAL_MODE_MASK; + profile = wmax_mode_to_platform_profile[mode]; + priv->supported_thermal_profiles[profile] = out_data; + + set_bit(profile, choices); + } + + if (bitmap_empty(choices, PLATFORM_PROFILE_LAST)) + return -ENODEV; + + if (awcc->gmode) { + priv->supported_thermal_profiles[PLATFORM_PROFILE_PERFORMANCE] = + WMAX_THERMAL_MODE_GMODE; + + set_bit(PLATFORM_PROFILE_PERFORMANCE, choices); + } + + return 0; +} + +static const struct platform_profile_ops awcc_platform_profile_ops = { + .probe = thermal_profile_probe, + .profile_get = thermal_profile_get, + .profile_set = thermal_profile_set, +}; + +static int alienware_awcc_setup(struct wmi_device *wdev) +{ + struct awcc_priv *priv; + + priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->wdev = wdev; + dev_set_drvdata(&wdev->dev, priv); + + priv->ppdev = devm_platform_profile_register(&wdev->dev, "alienware-wmi", + priv, &awcc_platform_profile_ops); + + return PTR_ERR_OR_ZERO(priv->ppdev); +} + +/* + * WMAX WMI driver + */ +static int wmax_wmi_update_led(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 location) +{ + struct wmax_led_args in_args = { + .led_mask = 1 << location, + .colors = priv->colors[location], + .state = priv->lighting_control_state, + }; + + return alienware_wmi_command(wdev, WMAX_METHOD_ZONE_CONTROL, &in_args, + sizeof(in_args), NULL); +} + +static int wmax_wmi_update_brightness(struct alienfx_priv *priv, + struct wmi_device *wdev, u8 brightness) +{ + struct wmax_brightness_args in_args = { + .led_mask = 0xFF, + .percentage = brightness, + }; + + return alienware_wmi_command(wdev, WMAX_METHOD_BRIGHTNESS, &in_args, + sizeof(in_args), NULL); +} + +static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) +{ + struct alienfx_platdata pdata = { + .wdev = wdev, + .ops = { + .upd_led = wmax_wmi_update_led, + .upd_brightness = wmax_wmi_update_brightness, + }, + }; + struct platform_device *pdev; + int ret = 0; + + if (awcc) { + return alienware_awcc_setup(wdev); + } else { + ret = alienware_alienfx_setup(&pdata); + if (ret < 0) + return ret; + + pdev = dev_get_drvdata(&wdev->dev); + + ret = device_add_groups(&pdev->dev, wmax_alienfx_groups); + if (ret < 0) + alienware_alienfx_exit(wdev); + + return ret; + } +} + +static void wmax_wmi_remove(struct wmi_device *wdev) +{ + struct platform_device *pdev; + + if (!awcc) { + pdev = dev_get_drvdata(&wdev->dev); + + device_remove_groups(&pdev->dev, wmax_alienfx_groups); + alienware_alienfx_exit(wdev); + } +} + +static const struct wmi_device_id alienware_wmax_device_id_table[] = { + { WMAX_CONTROL_GUID, NULL }, + { }, +}; +MODULE_DEVICE_TABLE(wmi, alienware_wmax_device_id_table); + +static struct wmi_driver alienware_wmax_wmi_driver = { + .driver = { + .name = "alienware-wmi-wmax", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + }, + .id_table = alienware_wmax_device_id_table, + .probe = wmax_wmi_probe, + .remove = wmax_wmi_remove, + .no_singleton = true, +}; + +int __init alienware_wmax_wmi_init(void) +{ + const struct dmi_system_id *id; + + id = dmi_first_match(awcc_dmi_table); + if (id) + awcc = id->driver_data; + + if (force_platform_profile) + awcc = &generic_quirks; + + if (force_gmode) { + if (awcc) + awcc->gmode = true; + else + pr_warn("force_gmode requires platform profile support\n"); + } + + return wmi_driver_register(&alienware_wmax_wmi_driver); +} + +void __exit alienware_wmax_wmi_exit(void) +{ + wmi_driver_unregister(&alienware_wmax_wmi_driver); +} diff --git a/drivers/platform/x86/dell/alienware-wmi.h b/drivers/platform/x86/dell/alienware-wmi.h index 00b7505e1073..188440ef096e 100644 --- a/drivers/platform/x86/dell/alienware-wmi.h +++ b/drivers/platform/x86/dell/alienware-wmi.h @@ -46,7 +46,6 @@ struct color_platform { struct alienfx_priv { struct platform_device *pdev; - struct alienfx_quirks *quirks; struct led_classdev global_led; struct color_platform colors[4]; u8 global_brightness; From patchwork Mon Jan 27 04:04:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950974 Received: from mail-ua1-f49.google.com (mail-ua1-f49.google.com [209.85.222.49]) (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 03AF51FDE0E; Mon, 27 Jan 2025 04:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950688; cv=none; b=ktrL5uqrUfDzNuGsNTC1O3aXti0bafm41zMBz1ZqXveUMmLj6znDYC0uLSn4lFrvpuoWeay4HMXK0Bv+AK6EUZtfIaU0IePE+Z9GEXvOxAQxZCjjoQ8Omk7kNEP8n3Au8hDVyVJEpPRIB6r+KKEo9TYhEJyVd8A3eOESlAgdbdE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950688; c=relaxed/simple; bh=FuBXIXgK5ndfxQCn2S+4A0NXk7qR5VltBqHb6gMI8Kg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FGoUJ+qkYioSFI5ILKi23fnOCj3KYOksdwl6IZzut2lhfoKD3PJw0khFaCiWK6CwSpt99Nv2PBlb7g1r6WtwDiyQHHriccFWZLaPf5hiU5IIZIqxxPj96+BV2GA/a8Wf548xa+rkTr6TmDhJezfSr5K7dnw2e+fS8vx6SSRvhzE= 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=eqj58KhG; arc=none smtp.client-ip=209.85.222.49 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="eqj58KhG" Received: by mail-ua1-f49.google.com with SMTP id a1e0cc1a2514c-85b92397fe2so782624241.3; Sun, 26 Jan 2025 20:04:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950685; x=1738555485; 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=cfYoqReQRrtyZU9W1S4tsxAjwEta3UMCiJteabSijcg=; b=eqj58KhG8OrIWai6ZNQvydaduikMlxKCaepkWnd6MGC2qa4HjFM1B4Nf6nstAMhqhL Y2QuuEq2aMpRNaEYB/obiRjTfWA83ITgI05XlLY1ZyGO/sQjg2KmgeKUrzBI8c1wT/g+ ZgcMvy66Z6FjyYG8oNRaPzyOW5HqksR1Fgga1OnCusang1X1RdrYsbDsCri7Nhu6qkrk 9rYtDLqWNjRHdJ9AprsT6epO/MLEWc0quvJEfnmt/tO/S3mBJn11ffRRlh1ZARugRsCO jHKfLR03d11WjwGlARNG/gyfoN9jUCwQUGHMfbb/Ud8ezWLE31CohTzXkCWHHgFo1ZFh v2rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950685; x=1738555485; 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=cfYoqReQRrtyZU9W1S4tsxAjwEta3UMCiJteabSijcg=; b=GysVHuZk4rC5FRYl8zaKth6r7hOUFIYKnwdgci9CaF7KrLFqt/12kGYaH/ByKgGoYU PNRe+3yb1D7Ib/TeTrgRGQ6zNQ9O2Evp7oE4/50c/Yk8l7nUkqmZ093RBoTmTaCE+tL3 wTTLaEfB3phSWKDroS7tZawgcMKRiltKwD3xOZX23oNaFeqNh9k7OehVW0YY00my+SY0 9DvINzHaJ3moz+U3XITet2xvVFP9GVeHMPORWt3PEMTaQGNqM4o6FBXMvfJ7l3B+aaIy DEkTUDZQtv+huCTY2Vekstag7O88Z2Of61FYKMlY8+FiDYvQsiW4X9vfLpSzF7Lj9Cky ZEYA== X-Forwarded-Encrypted: i=1; AJvYcCWGj34tkTaRikEQiST/TJu6qthY8OccRpZ4OWX6S4edQ9kgdOpRpfwIZAzBnJUeRrnA8u7pnZwxi1+N0uk=@vger.kernel.org X-Gm-Message-State: AOJu0YwLPWZ2NEkcL4yWifdWDJf2jhQIUYJpKofXUTSU4HNicQiFsVnl wbfK9vMamWFJU7KpaUoLx5ziL5gL8CP59crda8wt8i5h288FnYcOxF/eaQ== X-Gm-Gg: ASbGncsLoHUeR2vjEVYeyX5m/+DAQxCIoDLye+W4AQfYIUGhLRNiNbG2VZpfz2R8wOy kd6nIryNNbzEb20dbRXxcrzfHYDxXTnEzGVVgPBTdxcYJdiOhxO7oyqeUubstqdH6rbIJPas58/ iLt2X0rftC6BBVz/SQyFF/gx3Dq3yCl5AZiotNXQQF9e/IkV9dFpOZtHAT9UCdFDNpkeaI3/CVi FPEymuxsmAgBPvi2/FD60iP9MBiJs0V/IOMbmNEQEvtOOP5VcAsb6MsekJEgZQCQZb5Zs5lbdYN cmXs0MY48015iOYmiNv7v4o= X-Google-Smtp-Source: AGHT+IHZdZb4Arnl9TZwe5WofRLdizcG8qJBa3Nr8k+/SoKgIymG+72aRa1mfgBp03CHgHzL4tjBdQ== X-Received: by 2002:a05:6102:374e:b0:4b6:d773:afca with SMTP id ada2fe7eead31-4b6d773b459mr19821214137.16.1737950685257; Sun, 26 Jan 2025 20:04:45 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:44 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 12/14] platform/x86: dell: Modify Makefile alignment Date: Sun, 26 Jan 2025 23:04:04 -0500 Message-ID: <20250127040406.17112-13-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add one more TAB to each line to support upcoming changes. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/Makefile | 48 +++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile index 03ba459f3d31..d5718ef34c48 100644 --- a/drivers/platform/x86/dell/Makefile +++ b/drivers/platform/x86/dell/Makefile @@ -4,27 +4,27 @@ # Dell x86 Platform-Specific Drivers # -obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o -alienware-wmi-objs := alienware-wmi-base.o -alienware-wmi-y += alienware-wmi-legacy.o -alienware-wmi-y += alienware-wmi-wmax.o -obj-$(CONFIG_DCDBAS) += dcdbas.o -obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o -obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o -obj-$(CONFIG_DELL_RBU) += dell_rbu.o -obj-$(CONFIG_DELL_PC) += dell-pc.o -obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o -dell-smbios-objs := dell-smbios-base.o -dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o -dell-smbios-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o -obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o -obj-$(CONFIG_DELL_SMO8800) += dell-lis3lv02d.o -obj-$(CONFIG_DELL_UART_BACKLIGHT) += dell-uart-backlight.o -obj-$(CONFIG_DELL_WMI) += dell-wmi.o -dell-wmi-objs := dell-wmi-base.o -dell-wmi-$(CONFIG_DELL_WMI_PRIVACY) += dell-wmi-privacy.o -obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o -obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o -obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o -obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o -obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ +obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o +alienware-wmi-objs := alienware-wmi-base.o +alienware-wmi-y += alienware-wmi-legacy.o +alienware-wmi-y += alienware-wmi-wmax.o +obj-$(CONFIG_DCDBAS) += dcdbas.o +obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o +obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o +obj-$(CONFIG_DELL_RBU) += dell_rbu.o +obj-$(CONFIG_DELL_PC) += dell-pc.o +obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o +dell-smbios-objs := dell-smbios-base.o +dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o +dell-smbios-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o +obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o +obj-$(CONFIG_DELL_SMO8800) += dell-lis3lv02d.o +obj-$(CONFIG_DELL_UART_BACKLIGHT) += dell-uart-backlight.o +obj-$(CONFIG_DELL_WMI) += dell-wmi.o +dell-wmi-objs := dell-wmi-base.o +dell-wmi-$(CONFIG_DELL_WMI_PRIVACY) += dell-wmi-privacy.o +obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o +obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o +obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o +obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o +obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ From patchwork Mon Jan 27 04:04:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950975 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.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 336031FDE1E; Mon, 27 Jan 2025 04:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950690; cv=none; b=kX5gQBHBLbk8SsD+DQA7z3SYzbBbDWKQgFbIRi4SKuRwH/W8pTO/CJZca9vGpHvuxjIe4z+hPJcbhQYbVcqeaB8+WpxloM8/+RYAv/vENoZQ2JK8nm2x+/8IDiMOrvw/xJLxhPmIHw4vIg/TzZwIpeQPh6tQJ1YEPlxnmf36jSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950690; c=relaxed/simple; bh=4AvwmgNq0K8hg1b/NuDxZBgHBGQc4Xo1hmy0Q+V/UVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZGSflYMhlAGoOsVU+3961OoL7Se8TK0Dou3u8a33tOh7RPd2agpzYEEP3JZ74Bv46gVOYVG59vrVYnIc+UMv09C6zGu+33QSGUeU5HyPkqwjyRfOoTawfiUPow9kp6YTwB9Rs9kxSUD63gDqOQ+mNRuMFKHdqFxrb3U6swKDBfc= 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=MrjjETuJ; arc=none smtp.client-ip=209.85.217.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="MrjjETuJ" Received: by mail-vs1-f44.google.com with SMTP id ada2fe7eead31-4b10dd44c8bso1159936137.3; Sun, 26 Jan 2025 20:04:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950687; x=1738555487; 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=ShFZaM62gIQnS3Q6clqV2d1/YvoqISJ/NK1jrKyTtHk=; b=MrjjETuJNii3As2235cPFaecOzMA8/usksGnhFYtM9a+Px0DO38S8jC+vXaX3K6io7 oMj8bq1dUlbezuVr+6YDq8i7a0ioUuOCFloNyJ5R855ksPhSkJwTLAhF8goo4nQ+EXcU tp9gKqGETJj/48TCY67T2mmD0O92BzmbkfN7jdzr1fhFfeoJ2oTHzESjT5hkvFEl0vN4 PQ1jFUFH+bo6jlzNk7brIk6QyKNQzkZj50EBdEDtaRafkeu9qVvhJ++6rFYMcy8crV7C wROJtnlhi/pFoXMoDuN6zYZBD+9fB9gRF908bVDSm1cNwB1lwj9x8xm6fgRWSfm0gQwY qOfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950687; x=1738555487; 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=ShFZaM62gIQnS3Q6clqV2d1/YvoqISJ/NK1jrKyTtHk=; b=OBBG8fE1lSOboQIdfmnnFqnQkP0pQK+4gp4t8g8VFhEfZ7kyOvNUGvvRdpXiqE6027 FvY17gTlcHWzkVxAXvHxEb2dMXNnIh0AQywDuIWauOHZNC2BWnXIpCVAj+bpzQzXtXFk IkN9OyczP8YJ6xIJCCPXpu+XiwetmntvwOecClyzJo/oOsQld/OPpkbaGay2lfZTqJv/ IYyQ+PcGmtXpulk/EdywzJQGWwjgZFITIaLwsbRsiaWcdIeABGxiPjw509z8FVARPnfP mLAwUFcTGclV36IaiihyUQEDMMPjiV/pdRH03//KgVFsZ0lw9yiu/3ZlbXIzajALbhOx 1eEg== X-Forwarded-Encrypted: i=1; AJvYcCWNedc0ImJOW0jwrxKGDa5sbm+9nbBqesHe9f5TteTDSVchlx76zDSeatfRcgEmRcgHuA6OX+m84iAFvmA=@vger.kernel.org X-Gm-Message-State: AOJu0Ywh9BEmPU4yxoWrNUbEqpDVVx3gDK3QA/xJxisQH8754/WxLSyV Jq3tNniCQX6w0mrBLbcSvtyQcjjX8t5l3BN8stSLzX9ud7C5Wyk0jW9REw== X-Gm-Gg: ASbGnctknPEMXcDExdCpPFzx6KhxH0HTX8b17FALqU4g6D98AhBJFDpNehxeLcU2AcR 9L8K6iXKo/MdEuYosIjzBF5EqhsKa9OBUO3FsnwoQyYpofjw8snuwCdRd8sGi2pZ2kzA+XjiYWE 3sIOGEG7NWTbhwAgdtCWDPWjaRrkuFRFoxrD5HyABZIzrxHJydl9IPV/UmjIkRxAxrSzYuDar6+ nWYgjvL/G/ZJrM2AwcalJU1DH3rEOSmhVTITVwPrg+Fik6GIloYfWpgXVD7y7evDRaolUeiFm6P 64A5X/skarSu X-Google-Smtp-Source: AGHT+IGgMkT9g6CRT1UVNf+bXwPeI5F8+IyNQ6zCu41lkafgAkGzuL9lD2u8Pbmq3wdAF4XS1bJQfA== X-Received: by 2002:a05:6102:3fa3:b0:4b2:5ccb:1596 with SMTP id ada2fe7eead31-4b690cbd949mr36790293137.24.1737950687586; Sun, 26 Jan 2025 20:04:47 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:46 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 13/14] platform/x86: Update alienware-wmi config entries Date: Sun, 26 Jan 2025 23:04:05 -0500 Message-ID: <20250127040406.17112-14-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add config entries for each WMI driver managed by the alienware-wmi module to be able to conditionally compile them. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/Kconfig | 30 +++++++++++++++++++---- drivers/platform/x86/dell/Makefile | 4 +-- drivers/platform/x86/dell/alienware-wmi.h | 23 +++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig index d09060aedd3f..f8a0dffcaab7 100644 --- a/drivers/platform/x86/dell/Kconfig +++ b/drivers/platform/x86/dell/Kconfig @@ -18,15 +18,35 @@ config ALIENWARE_WMI tristate "Alienware Special feature control" default m depends on ACPI + depends on ACPI_WMI + depends on DMI depends on LEDS_CLASS depends on NEW_LEDS - depends on ACPI_WMI + help + This is a driver for controlling Alienware WMI driven features. + + On legacy devices, it exposes an interface for controlling the AlienFX + zones on Alienware machines that don't contain a dedicated + AlienFX USB MCU such as the X51 and X51-R2. + + On newer devices, it exposes the AWCC thermal control interface through + known Kernel APIs. + +config ALIENWARE_WMI_LEGACY + bool "Alienware Legacy WMI device driver" + default y + depends on ALIENWARE_WMI + help + Legacy Alienware WMI driver with AlienFX LED control capabilities. + +config ALIENWARE_WMI_WMAX + bool "Alienware WMAX WMI device driver" + default y + depends on ALIENWARE_WMI select ACPI_PLATFORM_PROFILE help - This is a driver for controlling Alienware BIOS driven - features. It exposes an interface for controlling the AlienFX - zones on Alienware machines that don't contain a dedicated AlienFX - USB MCU such as the X51 and X51-R2. + Alienware WMI driver with AlienFX LED, HDMI, amplifier, deep sleep and + AWCC thermal control capabilities. config DCDBAS tristate "Dell Systems Management Base Driver" diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile index d5718ef34c48..8ac9a933c770 100644 --- a/drivers/platform/x86/dell/Makefile +++ b/drivers/platform/x86/dell/Makefile @@ -6,8 +6,8 @@ obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o alienware-wmi-objs := alienware-wmi-base.o -alienware-wmi-y += alienware-wmi-legacy.o -alienware-wmi-y += alienware-wmi-wmax.o +alienware-wmi-$(CONFIG_ALIENWARE_WMI_LEGACY) += alienware-wmi-legacy.o +alienware-wmi-$(CONFIG_ALIENWARE_WMI_WMAX) += alienware-wmi-wmax.o obj-$(CONFIG_DCDBAS) += dcdbas.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o diff --git a/drivers/platform/x86/dell/alienware-wmi.h b/drivers/platform/x86/dell/alienware-wmi.h index 188440ef096e..f66ae2a6e5c5 100644 --- a/drivers/platform/x86/dell/alienware-wmi.h +++ b/drivers/platform/x86/dell/alienware-wmi.h @@ -70,10 +70,33 @@ int alienware_wmi_command(struct wmi_device *wdev, u32 method_id, int alienware_alienfx_setup(struct alienfx_platdata *pdata); void alienware_alienfx_exit(struct wmi_device *wdev); +#if IS_ENABLED(CONFIG_ALIENWARE_WMI_LEGACY) int __init alienware_legacy_wmi_init(void); void __exit alienware_legacy_wmi_exit(void); +#else +static inline int alienware_legacy_wmi_init(void) +{ + return -ENODEV; +} + +static inline void alienware_legacy_wmi_exit(void) +{ +} +#endif +#if IS_ENABLED(CONFIG_ALIENWARE_WMI_WMAX) int __init alienware_wmax_wmi_init(void); void __exit alienware_wmax_wmi_exit(void); +#else +static inline int alienware_wmax_wmi_init(void) +{ + return -ENODEV; +} + + +static inline void alienware_wmax_wmi_exit(void) +{ +} +#endif #endif From patchwork Mon Jan 27 04:04:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13950976 Received: from mail-vs1-f52.google.com (mail-vs1-f52.google.com [209.85.217.52]) (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 51A0E1FDE39; Mon, 27 Jan 2025 04:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950693; cv=none; b=CyeEH7I0AoVTMYhPUofrheuGmj23WXyKfSadoAwUzdtv2lu9cBjXfgPzz7EhSB8PWcDiaj+iTlDFe9sDIjAfjqJ9MhpNFykqxJUx2yDbGk6DLmqFLVe8T5Z3U7KcS4izGOR0Oy41EJel/nJAT/opUzrYO1X3+kDxq+VyRkaIpKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737950693; c=relaxed/simple; bh=uln2bSp8cCgoiDtrWN2ZC+ClZjMq3WgUM/z2IQmiA7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BjVpLFVzT5F1R/u2C1zl3ggj/lGvUl4gEFB4gjOzRuRXxV4N74SZmG60njDCLnb+FHuJXC+KuoAqGOF6VttiztkIkHshARXZZTNle6vTRm3EIt73gG6JfhGUWvxrpExhpbKHHB2Hq62DXOQ7WyW/mkKVGT8v44sEU7qaERo0g4E= 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=e7UauQ5/; arc=none smtp.client-ip=209.85.217.52 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="e7UauQ5/" Received: by mail-vs1-f52.google.com with SMTP id ada2fe7eead31-4afe7429d37so1001183137.2; Sun, 26 Jan 2025 20:04:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737950690; x=1738555490; 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=HguH/5GHeVMnOVWR0BWd76PxkLkAFvISPM4MfQHocJ0=; b=e7UauQ5/YH8SGStFDNqiQGjBR6x9QZMG4Qy2/9mN+eXnpc/s+NwzNB6XH5wNClfDwV FPU/RvuDWW8ObgYkbQA/uBHBMv2AKK8sDwjDtUC88Q7MrxeNZqyCNPaop9TikMY4Wq2l jSEttJBLfBEV0QhPdeldP8eFRZsTxyxEOc3lKo4XHMZddn6Jpx5IrSTpLZtxrp/2w5sS XauLjNr/Ih1Er4ziCo5CpOtyFRMEBjPgaN6HBo73nuAQwSCE+H75IkXmGCkt8jHaSgpl /3jcmT3jqh917WXA/GaDQGcNwZXR+IIOaZLQ7kjd7CYbUkWfUEO0S/4eQCENU7Lp2TSD b65g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737950690; x=1738555490; 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=HguH/5GHeVMnOVWR0BWd76PxkLkAFvISPM4MfQHocJ0=; b=qMdzv4ioqpU9c6cE14nC/iOQIYW3Od5DijUQmetgJelpr4qLdXQt0FZX2N90GqMIO2 0iTFqxh0Qte+L9veH4sKjig2a135j3ubQJaduBGu/TkWKsdHE0HgE9ZJWt9xX18eJIDA 5sMV7vHbLpAtvaiuviBjceAGimGg2xs4xfH3k0QXDAkL/0BgSz96089XxfAhJVNrG6pQ C7eiJTJEA1mAzCynS87LeqH2m7ccT4sPbyGzkHoW+yLN9NAUdgUb59X7ZOcNhbSKb31p XnDQrlNEv2F2eIXjbhO4BrqTU0U9QNgqLrt0TN2qBV97UxYthqxL7NXC4OaRLJJW0ipz ZGkw== X-Forwarded-Encrypted: i=1; AJvYcCVNbnjAGs8/PQaj0Qu93qAShxOJF/FevQNell2NyCqrF8bp8ehpm52uvHVaPGEz6g5xBbZ+GHqLeDOoWtY=@vger.kernel.org X-Gm-Message-State: AOJu0YzApNQxY7BMohaKlcKtJ9eZVGWQXi0jGR/OetMQ4mxoinnne6V7 LpvaIB9ItKNRGkgSW913VOTcVBk1C0HQ9PB8jVk8tmeTeZmIGflYdfSNYw== X-Gm-Gg: ASbGnct/nGgS7RvaXpINCZUGadY2RwRTEZMwLDUF1Mn4CixdXHrig+yn3oj0xuq2Rap EAEcXJpXsUxv2FYSnT/B0+dEtwvjBXNqYLK9JVPG62AU+tYToQ8Jl8Nnh559uEwEu6syseB/6zw Z4umtxu/COpgThTgO7zxb3UOHZn51FgfrfXyzo8WRNsDf12rj6DnfLYW2zhJvMigUS4a6Ogw04E tVuuN4cNPdMHtH75Jv6CFa56f3Y7aNotoiCM/ahjBAYikv12bIBPiGLypR042XsbMjci9G3mUln osX2ySLWLuj4Vs2k9mikrtQ= X-Google-Smtp-Source: AGHT+IFCwL1lnWSIFQWSFb5gYcRgFQOhhIEn3uaZgn+V2gITJJHFR2g9sfbHz2fNLxrFEtoM93PUpw== X-Received: by 2002:a05:6102:442b:b0:4b4:7cb0:ac58 with SMTP id ada2fe7eead31-4b690b80749mr35313150137.2.1737950690054; Sun, 26 Jan 2025 20:04:50 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-864a9c176f0sm1733758241.23.2025.01.26.20.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jan 2025 20:04:49 -0800 (PST) From: Kurt Borja To: platform-driver-x86@vger.kernel.org Cc: =?utf-8?q?Ilpo_J=C3=A4rvinen?= , "Armin Wolf" , "Mario Limonciello" , "Hans de Goede" , Dell.Client.Kernel@dell.com, linux-kernel@vger.kernel.org, "Kurt Borja" Subject: [PATCH v6 14/14] platform/x86: alienware-wmi: Update header and module information Date: Sun, 26 Jan 2025 23:04:06 -0500 Message-ID: <20250127040406.17112-15-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250127040406.17112-1-kuurtb@gmail.com> References: <20250127040406.17112-1-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Update module header and description. Additionally add myself as a module author. Reviewed-by: Armin Wolf Reviewed-by: Mario Limonciello Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi-base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/dell/alienware-wmi-base.c b/drivers/platform/x86/dell/alienware-wmi-base.c index d0f0b3c7a915..4561720fdf2f 100644 --- a/drivers/platform/x86/dell/alienware-wmi-base.c +++ b/drivers/platform/x86/dell/alienware-wmi-base.c @@ -1,8 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Alienware AlienFX control + * Alienware special feature control * * Copyright (C) 2014 Dell Inc + * Copyright (C) 2025 Kurt Borja */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -16,6 +17,7 @@ #include "alienware-wmi.h" MODULE_AUTHOR("Mario Limonciello "); +MODULE_AUTHOR("Kurt Borja "); MODULE_DESCRIPTION("Alienware special feature control"); MODULE_LICENSE("GPL");