From patchwork Sun Jan 19 22:05:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944598 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 A996A1DFE03; Sun, 19 Jan 2025 22:05:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324360; cv=none; b=Py68Snw6Ax4rp80FOZEsEcjpHAgzYEFJrxbFWFftp+zcECbobqu+34mGDZLgXgQmDspZCkyMyW40853MjYi5bOE8t17kY+xZ5kTFI5vS2fBkRcjyeR+zAgVg7yknG7H6r4nL9o2+myNhXzErJyW5hJcL0ujZ9W0EaQWpTiMghhw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324360; c=relaxed/simple; bh=OyM/dVSjT0Npr0iILPQFoi9HKOpxcLIKag0jUE/bjhc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lQcXABK5XpYaiMWr3Ewrnj0eTZMF8ko0v6dinJ+uDMiDemy69YKcf5tr6VDIb6cnViAn/lwGFqverm0Moj6jcmst/kRunCql4H7AxOCMUEXzlKlMpsvnjsyh03zqs+JSoyyGcs11HnEhORVoan7gnylRqr93hJJsPbhcYlyqyIE= 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=JbIjNnII; arc=none smtp.client-ip=209.85.222.177 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="JbIjNnII" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7b7041273ddso305578485a.3; Sun, 19 Jan 2025 14:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324357; x=1737929157; 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=14fzd8omXgiDsWYm9jLGs9osZNuEWGaoObZu1p63Zi0=; b=JbIjNnIIBQZUKtaU3Al24mp1bYV9jkigbISUbHeJo/f+sA3LFdE3QyruR0QuRMLDdX eHdEmrRRg5+g8UBIG63Hrn1AY9NDEu2ihVRIQukSZLaIRVa54Xz1BlPbeD+XMR9jWbgd +ZqDPSKQziWUZhNMGEOoCI0W/7iHWiHib/k30jMsTR/odorI49wssbmGDg5cl2pQno8S bVZhabboy2birwKtClDxaV7Ko0bUVoM9Z5HfaRJ67AW/Yma7aaHthCKnHBSqoN85vsM1 3cQ1B1Ng0MlpZ43nlHkRc8dZcioAxxHvf6Zfe6MSDnwM3Kks01XefFl7tn+YOLtVIr/S pnVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324357; x=1737929157; 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=14fzd8omXgiDsWYm9jLGs9osZNuEWGaoObZu1p63Zi0=; b=iPzNpXB+jY0f7DghUc8mqW350S7/1/cMndoGsIl6tW2xba7B9ZHJhtsv858ImVw/Sm UX+HFMQYvtZ9jwxuUUkr76qLw8/3DXhYi1Qhc9p1hw+dlgyuXJh673KkZnQ+Ieq+Wi24 xkVQ3gkFTM50WFeX/zhM3DqBIBk0hwzusHrpWMVvxLwiHHY/FNocQEvlY2lalTL31l+9 Pzik+YT385sSDd4t+h20ePk4KlGEFsP0YS1UkUtrf9OzfJGbzMvTtru4YfW7WMlECrAk TM+EMDWYX0t9sfPpIGnUSkpaanS5jNB+7xBlJHQ9oC3cCteb3Z1KAiDiq9454/l5yvdI NXdw== X-Forwarded-Encrypted: i=1; AJvYcCUklLY5YYIbNgplp3hTw+gxIrAuIF3Y3EBOc+4Xgllg80XPk9c1LwOKzOqGk1LL9GzTd7PYnmx8R9D7f0o=@vger.kernel.org X-Gm-Message-State: AOJu0YxKWOiD5HRoKjIURcth+4MrSOtHk9gP510RfvBYT9awoMQC/tck xijQ8KDrUOcczt5r/NU3YLmGtGHs+LdiZ/01/ZYSv9BMt751jGFscriQ4g== X-Gm-Gg: ASbGncuqQN2FvMGevda/FhGC/R5SZ2lw2f1q7liIkovPedovbzjbrMtvANtx25bYhn+ 2GxbXVcDKc6CXsR4lypVaj4J65VUd5FpxZaKK+j5m+lzhbJxNNuwp0jHT/X9pYUwLlBAaXwNmO+ 7L52zsZUen+19NNkeWJoByqm5sAsbbJvpFipG2b8qBeXzXRBcAdpKOKG1ZNPzQXg13XnF1BP/us PscwXDJlDk1dLMoJIr5MRMzyLurvuDHTX3e51Y5z2CakLVu25VPYSvQcBwuTazho0/Vba4VWZ8W AA== X-Google-Smtp-Source: AGHT+IEEFlvn7SQRzS6yS3PLLM0WgewDqrjGFZEGe4h7+a7XmZeshnCQIbQmUyayDBFOBhNKaJ3MVw== X-Received: by 2002:a05:620a:3705:b0:7b6:f34a:c0db with SMTP id af79cd13be357-7be63276c14mr2000183885a.57.1737324356994; Sun, 19 Jan 2025 14:05:56 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:05:56 -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 v5 01/14] platform/x86: alienware-wmi: Add a state container for LED control feature Date: Sun, 19 Jan 2025 17:05:29 -0500 Message-ID: <20250119220542.3136-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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. Reviewed-by: Armin Wolf Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 117 ++++++++++++---------- 1 file changed, 65 insertions(+), 52 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 63cf016bc912..5779b025761b 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -404,13 +404,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 @@ -442,7 +447,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; @@ -452,21 +457,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; @@ -485,22 +490,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; } @@ -568,9 +577,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"); @@ -580,6 +591,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) @@ -591,9 +603,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; } @@ -653,43 +665,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", -}; - -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; + struct alienfx_priv *priv = container_of(led_cdev, struct alienfx_priv, + global_led); - return led_classdev_register(&dev->dev, &global_led); -} - -static void alienware_zone_exit(struct platform_device *dev) -{ - led_classdev_unregister(&global_led); + return priv->global_brightness; } static acpi_status alienware_wmax_command(void *in_args, size_t in_size, @@ -1145,6 +1140,30 @@ static int create_thermal_profile(struct platform_device *platform_device) /* * Platform Driver */ +static int alienfx_probe(struct platform_device *pdev) +{ + struct alienfx_priv *priv; + + 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, @@ -1158,6 +1177,7 @@ static struct platform_driver platform_driver = { .name = "alienware-wmi", .dev_groups = alienfx_groups, }, + .probe = alienfx_probe, }; static int __init alienware_wmi_init(void) @@ -1205,14 +1225,8 @@ static int __init alienware_wmi_init(void) goto fail_prep_thermal_profile; } - 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: @@ -1227,7 +1241,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 Sun Jan 19 22:05:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944599 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.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 D605327450; Sun, 19 Jan 2025 22:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324362; cv=none; b=DfSbaUA7jWLyHA4uLlAv1roC7udRBgBe6Ith+qOWmhNZ5YjZnR0TbJ5l9iAPkTCxwOg2u/cjFXRsVQHBBho/Z6FGqdeTXZmhbU/OiwTum3XMjdDrPl+2MHqoZjpmnoL80OvQvxfQ1dr+4BpxILckGhoEkZtsSJoB5P1MMVAf9Lc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324362; c=relaxed/simple; bh=sOLvVTGG5cgrv9k1mP346NX/X95KFQSYoqT7c+/o7FE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tYmmBUp5hJs64P1zKYi66018vwOkeVvAe00NPQyoy/hD1qE/+8auezJ8Q+/bninlmk4RL2ZE8nfIFS8jW1LRd3xFtG9OdZwsxUYWUw2GQe6D/3mPpQNYzeoGgH4zp5GtUb4z0z33dRzcldvy7SnJ20r1XmnKQLyBQ18xP4R7q6I= 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=hWgfW10D; arc=none smtp.client-ip=209.85.222.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="hWgfW10D" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7b6f95d2eafso468286885a.3; Sun, 19 Jan 2025 14:06:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324359; x=1737929159; 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=JXKFTSodeU5PciNPVC4cO4ce2cKOASojNC9s4Na2q2U=; b=hWgfW10Dl21pdIOIJtPT4VgTGgafeSnnJP8/zzY+FJTnaSCGpMKX103wSRBvDyYL/8 fMZT0FLp+jn44cZqdxDFlJdg4Bt5dbIgJnwdv1sJvebY/huTI42N0nhLdei6zGhGrtO3 EqvyAW6CP3VJU0cW4GN0ob/DtjWDRTJ+IwzUksTmiC/xCgw0QW+hX5dLJKQboE55IDbr ZtoNnXZ13fMISuH6r5cixL+bTbvROSprVwxv5EEkMtHmZlDvMZZBj7qPtFxW6emRCSDX WX7orgtpeMnglNLDxmZ2bd/ItNCl2hbblDVs8PkJIjNhCj4rGcnlL0O9ks5P7+vqqd+U dp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324359; x=1737929159; 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=JXKFTSodeU5PciNPVC4cO4ce2cKOASojNC9s4Na2q2U=; b=L/2WStCJV56b1FQ9XD+EtsO4QsmG597eF8UFgc1aj6U3OlV6IZhGKys4nFNbzRKJxl fw7dZMmwkr9oIxIWxXmvgbfzX+ut4pSAfYbfmjHpAF+rFeX/+5una//qyRwR+4zCycLS K2YSpOA7JKGqfSqUPtYKJgMIB3QZfOz2qB3TFxOLeE7y1dRF3ijXjVYjZf6EeyJLfNfN G0g+mNQSaEQ5HmM7z9ZSB+AQDWdaHz0CClUnbk1PT476Uoi3PcXmY7QVYxny63yIWZ3i Rn5nKcZM7HviZhh/mTxSCXs7CqfBvv9+EQOxBFgVhTkLEAjJTMZ60G2v+2EOnTd3b3pi CRdA== X-Forwarded-Encrypted: i=1; AJvYcCVGNbBjrrUaV7qi7cn44hKbPdO8cJayFX2Bx0+mzBXS+MW0WMI/9sN0lo2Xh7qz6fLJOn/oNoiqcS/VY8I=@vger.kernel.org X-Gm-Message-State: AOJu0YyeFEdijH0I5I1/3ij/7RWicsfWN6UPEfcy0vHwUedcJDPwS2oU 3JaIS3dYhYXuiYfhO6Y3T4fcULxNZJrjr36vBDz1SY/SkDV6NKuriV4tPw== X-Gm-Gg: ASbGnctuHYIYph7PMeJmEAOwyWaTukZGRDWfNUbxK5UsPF2riNorQ7eFlzy0/WZToyL b7H0bT0T6Ym/uk3vgBmY/cKba7bkmXpBjDV5kctyg1um37X7WqPTE7INpWXewFbrcI6oGQMTzSy a+v2Wf9m7S+PrX9618J21rVw532a3qhjYHN4iFH+52AgO9DJ0BJt1UrliZFuTGOwZt9F+Rsqw7c umx3izwd2brtNPi6obOSbl/aMLry97019P6d6oFsUuZcCA35ia/DMlhQkPiDdwUxGcn2FgGb+Cl sA== X-Google-Smtp-Source: AGHT+IG2nFlN4pd9lMeqctVUgwP/f0RK2G6r9e515y+1zcYkfMO7Ub8yOoWAqn3zZD7jr5JuGuSYrg== X-Received: by 2002:a05:620a:d86:b0:7a9:a883:e22b with SMTP id af79cd13be357-7be632198c3mr1944068485a.7.1737324359203; Sun, 19 Jan 2025 14:05:59 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:05:58 -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 v5 02/14] platform/x86: alienware-wmi: Add WMI Drivers Date: Sun, 19 Jan 2025 17:05:30 -0500 Message-ID: <20250119220542.3136-3-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 platform driver and device registration to a helper function, which is now called from the driver's preferred WMI device driver probe. However this is only done if !quirks->thermal because newer WMAX interface doesn't support any of the features exposed by this device. Only one driver is registered on module initialization to prevent registering duplicate platform driver and device. Additionally, create_thermal_profile() now takes wmi_device * instead of platform_device *. Signed-off-by: Kurt Borja --- drivers/platform/x86/dell/alienware-wmi.c | 192 ++++++++++++++++++---- 1 file changed, 156 insertions(+), 36 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 5779b025761b..5935bf74b66d 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); @@ -412,7 +411,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; @@ -1127,11 +1129,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); @@ -1166,6 +1168,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, @@ -1180,18 +1186,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) @@ -1208,32 +1336,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; } @@ -1241,7 +1357,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 Sun Jan 19 22:05:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944600 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 F120E1DF99F; Sun, 19 Jan 2025 22:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324364; cv=none; b=JDM1/KSSTc4swbHoxKWkZd3Hq/z++NJAlpotscoXk6aBtSPZDFkf2dKt6enhXUKWnF8aUHGMFvx1snGZr0iG5w2SPrqGoAHl4spL2u95cXr/EFd4JIwh+x2QWyTntBM17jee89p0XZqzcCwonRdrw96OKPG165vTJ9uO9ut71ME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324364; c=relaxed/simple; bh=D9NzT4jMJZET2VQAg0q+MV+E0pQkxunbjlg2bM4tw0g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CkbDJxLXCQjeYPTBmijWuXyDkEcQYd05x7IwZQf6DlChTbYtDBY8X/XXExOdyBXhIbtfML3GxZTC5m1Ci2nxRdw8QC5oiJ4h9HnZgPhXe7KSyebjQ8pvN3mgr0MBnZ+AtocNe+LwyvcNkl87BkGnF5Ov6KIlNvSvxHA+VEnTCCo= 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=JK0zgE2m; arc=none smtp.client-ip=209.85.222.177 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="JK0zgE2m" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7b6c3629816so200322885a.1; Sun, 19 Jan 2025 14:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324361; x=1737929161; 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=OJZc/ljk4j+eGf3glC0e6QtO4VK5Bd1RIE2WUJLEAMw=; b=JK0zgE2mRB63MJTWqonW5yrC3mb47eclR6MTFUsNfrbrRmDXPl8kr/9xxJfVrEnGwI 1kiDatDfzsk7bUBg+zCP8dhbAFWrx3PsKjwNa+pB7+9WlEiOFKhVc0C5AHX7JVrIBxEZ P/f/XnBFHvhz1KintHRbQXm7d2/UHd9k+SEjQiSMxbjb8kdVAxtTyejwKaMQkLDYpKOB BB9QsA3bCch1da5HxGXniOTOzyEi1gqym6wJYr/9l9F4dg8fVeT8Dm54Enfix4pjDt7W gDyAcdJjK/3+gyFXH3IGimGUJspgq34cWJo8EGEjUZ9wBIwqGo4bRwKuDFEGXGBl7BVS Saig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324361; x=1737929161; 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=OJZc/ljk4j+eGf3glC0e6QtO4VK5Bd1RIE2WUJLEAMw=; b=sLMdLMjESmQ0z7IRWY8CPQqCEQmNzf0c3bihKF3d0xD0msztBD9v/6AOSztin1r2v7 vrge27gC/sFsHikPaberFL1E3pURe9G3ZeSKT0NfVebH/CaZKopTQ/mSKdE4vN/Dh81z Pvw9Qb3BhcP7k9c0v2QfL+jW574Rat1o6ZWdRNPRIkPbAxkykJgAFaW+0Fr7r12e8idS SEAOY+DQq3PizbBRMCBsPLr+vO7KD0y0YUvqRKCSOEIEp8rQ3HtQFdDR1KDolndvV+HH 7wSKSwiJ3JBMxR1yZzPeMUmmUToJ/ng8VdvOg7qrC9HnerLicJa14szyOxJUspb9FGQ6 GYBQ== X-Forwarded-Encrypted: i=1; AJvYcCUbsw7JHvgq6mfXF8kK5iXlWeNHhsH6nieTaa9sPI8tNM2346AS1tHU4HwbAFp3TOrQUJeddQWV3TqnANc=@vger.kernel.org X-Gm-Message-State: AOJu0YwqBzlzmfVQmP/l7L2v3uoNrGs2H0tXLfti//KetaHSZywwhGvF vup0qMrTng3n4iUhP+jp0B7YBlVzO4ETAB+4FQshxVamYLcqKvlIRaZvDw== X-Gm-Gg: ASbGncs1nhNFaL89fw+bMOOBJwHy0wzxHFhNRuPLwBnd/8148uj8aLsC6ev5hoakk3k IiA1BIatnLHRIUfHMQnIyDfOSNTo88dEH6z+gTinqcnFzTaKhONC4EuCc3ncPP2OegxLoEGVsGu dEt+oZGMQXy1EplgpDqOITx2JcX0ShQB0MLZLE5wEzeefDpJtDy7OU0iteepmwQP6S7NxxZH0fr DZO7HBeZjMIFW6stjmn3WRFLGN/VL0GHjuiY3f2yRv9EghfstQfiKtUqnNJ//DTWx0o/Qv1P9pm 3Q== X-Google-Smtp-Source: AGHT+IG2a9sOD5/D6oHNjluH3pc3rgGiSGaHZPG9dQMzbGN/a1+wEAG0mL/t2w1mDZKjWVCCe49iNA== X-Received: by 2002:a05:620a:450e:b0:7b6:edd0:d754 with SMTP id af79cd13be357-7be631e6be7mr1825336985a.9.1737324361344; Sun, 19 Jan 2025 14:06:01 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:00 -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 v5 03/14] platform/x86: alienware-wmi: Add a state container for thermal control methods Date: Sun, 19 Jan 2025 17:05:31 -0500 Message-ID: <20250119220542.3136-4-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 5935bf74b66d..9328bf9b6c81 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -403,6 +403,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; @@ -415,8 +421,6 @@ struct alienfx_platdata { struct wmi_device *wdev; }; -static enum wmax_thermal_mode supported_thermal_profiles[PLATFORM_PROFILE_LAST]; - static u8 interface; /* @@ -1051,6 +1055,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; @@ -1071,12 +1077,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; @@ -1105,7 +1112,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); } @@ -1114,7 +1121,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); @@ -1129,14 +1136,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); } /* @@ -1262,7 +1276,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 Sun Jan 19 22:05:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944601 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42C151E048F; Sun, 19 Jan 2025 22:06:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324367; cv=none; b=QZmrNBf6qJMIcE9LFLZBtwM90A/Z+m+8FgtJlq9NvlJ7F30Mc1KisCxASxjY2jJ9Z33GtDMrJnZ8U427pEeonDTkl8lj8qyxISF+prqjlJKMvmJvaZkaYGHvfB/YYBEqysMqalYZW7uZKOdCxMMjjm2Z+73Dysu8JAKQjxmls/k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324367; c=relaxed/simple; bh=2Dkl+z6nmWOjdLpHQU29b41UY3p127bQSzYEhN6JzHw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qhm2gF0b4N+EPP4uagz1LCsg4PZdbc1kR7iSYUQDF/4lhu4CN7aN2ZsPyrrXxnrrQtGEDzL2xIzsA07gD93tGNpZ9em1YLtQpFMbtYWQ0A/ZypPVpphBG+t1fUaQBu5argiT2tYYCJFho5t1Wp5OBZU1CTSFMRXDEUW+hDbXE/w= 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=NvQ1AvJ/; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NvQ1AvJ/" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7b6f1be1daeso380398485a.0; Sun, 19 Jan 2025 14:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324364; x=1737929164; 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=AyvDbG7b41brEYVGfP1u1SKwu5vc8yhuPpSJa7ZhQcc=; b=NvQ1AvJ/wwPJ0irLVtyysyf+kBYR+LAkI/9IqfDb5jURJ4jg0pbKL6SV3KGkjWbR2s uXskHlXdyBOLpwuzvgQUnVkyKcHXkOjDTxdXeD+81qH556rOVGDD88Lt35I5rLL+GnAk F8Fu5Jk1fa6zPhO6M7/fXGrYm0W7Ew68+8IdA4ToSltft7rhPCKmTlyc6mpx0HJ94a8U vvnBSmzaemo+n0flNP8mBVzcs8IXykmASPRyIojqL4rinHymd+DkamCMWIp2AbsaAm59 AgzUULXNKI+grwIng9g7/JqFXhLNpw1R0un7qfVS8EmXMT8AgkVIxT6dXfKftFa2kXGx t3/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324364; x=1737929164; 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=AyvDbG7b41brEYVGfP1u1SKwu5vc8yhuPpSJa7ZhQcc=; b=H0Cvgnjc/lDOuTyk4MUKBr7TcUu2QHXzwdMJgfNkAkU8LFLAff68QnX9YMXXjOLVMg ACBbp68ueTjmiOaklB6E9ta1Y9xdJxNNMK6vzY2H5Uv3XQRCagxhDM9u5Gdn/yfQS8Ho /xZGd/TE/p+oLwfKyu0gFj5v4s8d1AliR1XJV1+2hCDQNdOOxVrvI5o5t/QPz/hYAhu/ 1HZPcSf9bRkIGPX04wDLtGjicWNcK6ii7mU37P3SvDp+/ID97gr79RuayppVlI4MD8/l mPOoDfHfQGaYGsM+tRXVcDDD3IryBs7IrxAEheo4nz074VtsqcezD+FosgVZ7dAcuUir YCkg== X-Forwarded-Encrypted: i=1; AJvYcCUzx9ckTmWYl7NjQ02DuLVqk7NaE8jyW3cdO8J99lpOWSbllnCcNIxOJ0OG8Beck18avR6e/wFxrtloN6w=@vger.kernel.org X-Gm-Message-State: AOJu0YzBVitRlTC1zX676+coyOhlynI44MiEJSiQFZXZkyBFtknWrc/p xKQ1Pq/ojy4T4tnLQ6z1na/JBPuetwCT/A1zOz3dsZArYWh5sGGbYNQGgQ== X-Gm-Gg: ASbGncsInF1dJ2Ly3Pm9xZ94+/uVeL35bUxBY8SMQI7q34/oQy7uA078ocKjqzc02ww /b+LWtwdYKd0cc/QnXEpYdWJEIcA8ONBA+ZYdpv9EnMsIm8Nj6/inZHUIPYjV0PYIyWKMQVMhu6 fJHOc/SCIYLM8FKclSG8CA30ltDdrwY5s0o2nel8wl/cGYWn22CIc0AkDynSe3apvkmNEMLWCh8 C4lSSa49vNDIKFuFeJADrQjwQPm7n8KCEWGPwHC6P6hxG3B1nHuKzcdg8szFn95ivxGKW8CZ6oq Xw== X-Google-Smtp-Source: AGHT+IEAJNCi45JOZs1MgcEl91z1W7VnW00fDmOJmX40sBh/pzafEyt002a0QvFSc1U8dk/DPvTHBQ== X-Received: by 2002:a05:620a:8812:b0:7b6:f17d:f5a7 with SMTP id af79cd13be357-7be631e56b4mr2137495285a.6.1737324363945; Sun, 19 Jan 2025 14:06:03 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:03 -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 v5 04/14] platform/x86: alienware-wmi: Refactor LED control methods Date: Sun, 19 Jan 2025 17:05:32 -0500 Message-ID: <20250119220542.3136-5-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 9328bf9b6c81..18f3a619283e 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 @@ -417,12 +418,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 */ @@ -453,46 +485,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) { @@ -509,13 +501,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; } @@ -651,36 +644,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"); } @@ -1223,10 +1197,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); @@ -1267,10 +1280,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 Sun Jan 19 22:05:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944602 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (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 2F2411E0B80; Sun, 19 Jan 2025 22:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324369; cv=none; b=oZ9o5Vq8/NLyjWhU7Hb/QzCOSRCVDeJ8VDIbxy46g20aDTOEbw7fMQ1pboafFZXgCnruaB1iCYqE9tWwWLGoo5wDGhS1zDLPN+NU3fblfKxH9bDFauc5Bs8jY6KzIfLS3JEfaIZf14HTEZP2Yi1FqeShodH9Z8zLt7vaUI3fZLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324369; c=relaxed/simple; bh=L9bSuw2qZIMoTjMssj7Ja0latB6xrp/K88cjoMg7P0w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QK50MYPaRNHEgCWpXASurvOd5yU5z7cK7jZZnvKoQg71K2xNZOOPyhus3e9dHJePGjrNuXC19ioIhLJKUvph09YzSrWc6LyqsvKtVOw2wra0b3LaNqpeTWkRX9aS9nl/ChLnuLfxSh9AoG++FmsHZdrTtqrhhjvKHSCDF5wqguc= 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=nAbee9Sv; arc=none smtp.client-ip=209.85.222.173 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="nAbee9Sv" Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7be3d681e74so354300785a.0; Sun, 19 Jan 2025 14:06:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324366; x=1737929166; 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=U9fZafdmShk2zMZuNj/tBZ76Korm1Dk7BtSOSuHwhCA=; b=nAbee9SvE3CUTRi9XZ8SJV9WW2/LBpQW09Fz+hhzg1rMvt1R4lxuqhXWOG1ytNxg6R Ygu6UY4c9MuxjhBi2Ul1v3lq19OD0lpuB7y97ukEDc6dsNISMNwx8CAijqln8nrmFD8h GConZxG2+hDrJGmO2LTZrbubAdI9cShMh41fiEZxwfs87zV+SV2q5f+UkmQTdNLtv2N1 pU/n8bdtha3scCDWM83aYu3dQJT4rXlniFworSer6puBSeSE599xd/me2OaYU2zdiNO6 2M0j83gQcXWtRbwq9hAUoIJAPKhTNf/RPLWY5g8IoQRU4HikRI+WSrMkMijegMGKuzcE GP9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324366; x=1737929166; 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=U9fZafdmShk2zMZuNj/tBZ76Korm1Dk7BtSOSuHwhCA=; b=mFwvrfzNjK1M9Tlv5IH37OEtr/MYTgtKd08/Eo+saAqyyjtCImcjGaprpnv25qF4c5 RwKK67jFlCl0D7L1q7CEjXadwSkfhJiYKYptVluMolGNFgcZ99isahHXp3lvAace+gMX 8iWyPx5D2K/3YT8Ffiizj6LztexFFD8slc4K55zGQNqenLvBgGOS2+Qs6+iGfvM4E1/L ndyHAcSdKflaf1qdjrVyBCx9i1ki9j9DBuTQw0c17eXGKgRuraCg6GjO1iYd9Eqr4jGl u2Sk+MQNSnJ+gfrmhHiCbn1MylKW0B+l4UArm5+gFvQciW5cLR9MGYmuVLlgAFvfohW1 gWTQ== X-Forwarded-Encrypted: i=1; AJvYcCXCszlSFzpmfJvAwVwtxaO3H9uX34Mv6fskBwjdONeQG7GsodYKf1fIhr5VQI40hifTqTqMGZPVKELlDBs=@vger.kernel.org X-Gm-Message-State: AOJu0YxSV1FTnrIXTCzZ2TfnX1HZqoghImFZqY2vqW1KMMCEWi7kI9DL H9QvkV7jcSm1lgLlChVThNigypo5HFPRFJQaIFwQ2pwYbCMJ8JCbNLZNpg== X-Gm-Gg: ASbGncvjTz3JdOyNTJcaiUqWMCAbW+zfFPLONstTg74ELJ/TAF2vndJ/B/yJ5afyrkl g1jiLDEp2t3yklHp9+WwpdLVpGQy/4HPSb0Oh+g7Rwua1Czqp7rX65Qcyv50StULTuKK8G17H5J FoLkJFFv6DLAFg9VZXWcwcJKPvm+nO5NJXgxN7wKD2jOdnUMhumt2Iu+OjuJdtWOG95VB+orIYq hCFCLq73DY1QXzNipfGBjS3dKx8Wl+qate0M0I9/BV07BFJKLoOVJJYYDZ2MMfy3lxHdF+J5XZF kw== X-Google-Smtp-Source: AGHT+IHuplkU3srHtFUnP+4Sn3xj7pTZ9F1dtknYkk7S4u8bcp/f/wi5+p81cqSxDpZShgeBICV7KQ== X-Received: by 2002:a05:620a:28c9:b0:7ac:c348:6a52 with SMTP id af79cd13be357-7be6323ea75mr1611311985a.34.1737324366538; Sun, 19 Jan 2025 14:06:06 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:05 -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 v5 05/14] platform/x86: alienware-wmi: Refactor hdmi, amplifier, deepslp methods Date: Sun, 19 Jan 2025 17:05:33 -0500 Message-ID: <20250119220542.3136-6-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 18f3a619283e..3e9c00363a8a 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -702,53 +702,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; @@ -758,12 +762,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; } @@ -796,22 +800,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"); } @@ -841,15 +847,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) @@ -857,15 +865,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; @@ -875,12 +885,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 Sun Jan 19 22:05:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944603 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.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 11DAB1E0DB5; Sun, 19 Jan 2025 22:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324371; cv=none; b=sTcEJYQl/s+fXvL8BCN4HqPXkWIXCaOuf450JNXnNrw56szlufAxpgo/2yorDaM7qu30AgPsznogSJ5IQCaLcSC4WpvXlELNrrnzILv3JgptdmZxoRtT7J9ths4Ps8IKEzdcCcrbixsUbJ3xTHMe3olfhRgZrCbAFktDdp0FEgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324371; c=relaxed/simple; bh=pIewIp0n8je7H/7kgA9gPSXhm1eAkus8bPryD6QRa0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J2rPVmkwC+Dh+n0HbhU9fK5UP1gbWPHNjWIMvKES/8Rm8flcUIBP/NHLMhAiX21Y6FGW7pxqjonOqq9KH8UzkkZnO4qiUuH3Ral42Pa9tSD9/Vrvu/8HYtCMEdgZng7mh+JdoVvx/qa+VKOZzf+YOQRHNFht1OI50hfBo74aO18= 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=PW8E23U6; arc=none smtp.client-ip=209.85.222.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="PW8E23U6" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-7b6f75f61f9so565131785a.0; Sun, 19 Jan 2025 14:06:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324369; x=1737929169; 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=5Y9APeuAfL6iQR97qdQAd6nOKRL80HJddmJvDteN810=; b=PW8E23U62/aAnOBoW1CBSF88WMEI7EAUShDSADN2HoCyU17tyBO50rFpQTG11lCWVu VYbSYZi1YHfpWkq4yq8xCZZc7BkIGfaYN0p+2f3HaUIAX6kwRT+3rE845lby2lj/VVDY Obclgj3hWhdcEZgQDAswoCrHnQZOoi4zvokH0IlYF7w2E5aBUwgMyS+6oKLe4ceKsk0a JbJHQYRYHPNjr5DidcODZqpCmEsfEE8/3m1rJYKDOYCzoXENP8bkBe0/CFMHsiiFmg7D 3tuvAputStKEECK5xctD8NxZV26icMQTlcx8V55RLg77fYJU9v1YN54jNQxgMAR2AW+O eheQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324369; x=1737929169; 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=5Y9APeuAfL6iQR97qdQAd6nOKRL80HJddmJvDteN810=; b=LdCYTk7fUXMEjD8vN+QUx+qIasZ8dipAiOYblBRK7Lg8mRLEvL7r5iBNHYkw0KIor+ 1RFLdC0iWlvTPajGwWLbx+M0F5GZvaVB1qnE7h2cr/acnsSQLRrQtBzNdSuQQqGIJG/X 0xsQ3uEIEZozMy5Xdx32pEsLDyrrqinYshuzFKc1IV2V/mztsNS8dSBnKfzEWB/nNzem hFPkV7/6mNVhGXvUr1bZ5MmyP2AoPDJ72QwjXxhaINTjW45edayaKruUTumYLEkWJZBu SR524lk0c2CF23QbnjVTdrkW2ku5czg45rQ0k50NpyBDZLTCgjH9WZMmRUaSgCZcs5jI Gh6Q== X-Forwarded-Encrypted: i=1; AJvYcCUIrwjfC+chgoSIA6ngEUcpkq8pnfcqE9FimSWY1NVGqUtEqpwtgvaFsAY9Ffu7GnuQGt2y0ycqBGW7rgA=@vger.kernel.org X-Gm-Message-State: AOJu0YwWKdiJh7sNZz3bFNQ3ufaH7NPxe0NVUrXzBIrFJxCheStNdrm0 eG/Yr6kBjUcd6RfMQ5ioT7JM57VswqrWQhsTVq/qy1LLrRH6IHyWu3RmDQ== X-Gm-Gg: ASbGncsk0cg18OXmv4PreRq09E2Mq3u7hk1qHIuEDP/cA3tm5PKWieztD1ir/13W27M i8Lmn5pXsyMoWyTcfKi55/FoqSD6JETqSvx/gBDLNY9RaO/iMYjnx9nJDcuBwx4THJVB56PZqtB TCVaQ/OkgdjwGonPmqWHeSYbYWHm/zHmZnOUYVu+OKPIokR4CIFYvvx0gO1xo3V/k13jeuflLJe 9TZwGFAXpa3F6xrdV/IC5zqp/uLkJH9L680mT9ZkxqGi2vq68k32ajdHcsjT9YfCet1wD6JLSQQ kw== X-Google-Smtp-Source: AGHT+IFvyarFK2wpw1pXIZIitgCWfoxDiZAdRUz9LfgDYG+heAQxm15sNIivwvOywTjXSuf8RuEPgw== X-Received: by 2002:a05:620a:24c8:b0:7b6:eab3:cdd1 with SMTP id af79cd13be357-7be6325dc77mr2011172285a.49.1737324368666; Sun, 19 Jan 2025 14:06:08 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:08 -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 v5 06/14] platform/x86: alienware-wmi: Refactor thermal control methods Date: Sun, 19 Jan 2025 17:05:34 -0500 Message-ID: <20250119220542.3136-7-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 3e9c00363a8a..d2a3d58a65dc 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -667,34 +667,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. @@ -940,7 +912,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, @@ -948,14 +921,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; @@ -963,7 +934,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, @@ -971,15 +942,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; @@ -987,7 +956,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, @@ -995,14 +965,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; @@ -1013,10 +982,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) @@ -1045,7 +1015,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) @@ -1053,7 +1024,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) @@ -1061,7 +1033,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) @@ -1074,7 +1047,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; @@ -1082,7 +1055,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 Sun Jan 19 22:05:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944604 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 C33181E0DE6; Sun, 19 Jan 2025 22:06:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324374; cv=none; b=aGYl8/awfOAHNRFyK547PHJyuu/+Xv/wIlMdJjdT+htlYW+jzawZ85InyBcrGUvY9+rRhSxhCanbEjk46eGUptcs4NJKQk8806O14rdEQGh9ka74iTTjOrhFTU3h8BUK9BpsV2G4FZr32LdrQNh4aGFI5tCnHolDojeAF4sdSb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324374; c=relaxed/simple; bh=4IuArjh+AK8PJkZe1DtLRtmSa8xdmHRBNzbo/WXG014=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdl/lRxoENu1wUC0mXDbRwUjKjYvwflU3DyR0HfNknMAwkdFaq2fgv9bCUB55lTBnfyEhQEfnrT4IXz/rMAkCGaatRoOAx6IyPS0F8ed7A69rFtmUaGUARA2yzsd0bmgmgfunhV+413Pal9e1W3R/VkqmYxXGS3HQy41YzK3vYM= 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=QDBpcSQ3; arc=none smtp.client-ip=209.85.222.175 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="QDBpcSQ3" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b702c3c021so391066385a.3; Sun, 19 Jan 2025 14:06:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324371; x=1737929171; 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=WXAQGSLMtinCxvaNfiFVXbDRwjvoN1IPCs2lLpdMaWg=; b=QDBpcSQ3qZHeH2x9//iv9MP5cGSrWslZbT5PDEwBtI6TuW0+mM97eaR/XMz2VJSZTO EtOTDBp4F/oc9yq9hcXiIJPOxgsPjsy7xtmQYxPDs7SfrnGChtEaWbIZSINDf7VnuYvp X+m2SB5lOpp/Bbhfbv7HgTlG+H/NOenP6Vbo307FZHfZtv+557eSnng8Sh5qRNnL+NwF gWqNFvhBmvHzcffQTy8hQHwk9lVQdCm+yybPGqtwS6oF3qFvlEj9AJxceuLLjfFyci4n mpLjMESr2Es6RcVTT/HYTfgrsHhtD+huspwn3qVKO4so3GRVEnzPDjU1XP2desWnxAHe t/VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324371; x=1737929171; 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=WXAQGSLMtinCxvaNfiFVXbDRwjvoN1IPCs2lLpdMaWg=; b=vEHhlvjbFufUyDPeHFmfdy9AEPt5/6shRThJMtf/AjK3xn9rVvmyPncKRBv1/B5bXC Oi8UrDMb9Q2lGJtXsR9UVMzxTTehkq4NrOCbWRHoa4D83MpRRL/nptCnNmnPbnKHJS77 5VD9wK8rOcE1/owTj8DNwzF/syq1d3+f1Ja4DzOCV3FaeVDYWna5cphO++X3yTd2jhLs s1kJLqgmBf8N4PIHQ/hooBVR+RnW5sXH/oaISI+8SbtXbeA1iePE3WPB+hTYKWwEtacG O7571Z2yVVb7h8NW6OAp/D30Lqx+OvyVyUssRrc49018hUOCTWRG1dexTJBy0NSF1uQy nDKQ== X-Forwarded-Encrypted: i=1; AJvYcCVt+S5AuCPQqnTYbWRB6I7shYJKdq7kvHXEYO5H4IOO++C/cfpp23gesSqjx4OLzq0pDxLalFAgV6dI/aA=@vger.kernel.org X-Gm-Message-State: AOJu0YwoARKtql8nKEUU41jEOWHWAI7LPBs5ueNCnqke/+z/s9IISqwj dymZwXM/HY5y2yCyzscLB1aBdx3rvlFxwEteo/U/AHhxOPGyG6/qNnouKw== X-Gm-Gg: ASbGncuiFxC4pv/Og+kRGgWnpa2dW8Az94Wc1qzCIrCpG44BR5cR6G0EttWiNJQPX5M 1OUDFGp0Kjlk0EGsdaghfvtZxC7hw8rztuLhHkkRS8OgUuue8toJnDb/f6kF7/nExms/8wN7M9x QLjyzxITM2+YD0gn1NfFyUAhkSNUolqYr5JYxmjpH2F5vQpGSQ4GIQNHs92vVGdnEDSBpiTNwTH imuaNaIx+aC4ms0A0vmfCzSmtpaII+sBAjI9F2K8WyFowXU86iufDztbs9AvfgGG7LYUNZ4byAB CQ== X-Google-Smtp-Source: AGHT+IEg9NL9o/gAYVr78SzxNcBd1DIzShx1D/TIR6fMdZYRsT4L44E2/4iartfEIGBfsGlWabjH1g== X-Received: by 2002:a05:620a:2888:b0:7b6:c695:fb7c with SMTP id af79cd13be357-7be6320c398mr1651811285a.33.1737324371284; Sun, 19 Jan 2025 14:06:11 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:10 -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 v5 07/14] platform/x86: alienware-wmi: Split DMI table Date: Sun, 19 Jan 2025 17:05:35 -0500 Message-ID: <20250119220542.3136-8-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 | 337 ++++++++++------------ 1 file changed, 158 insertions(+), 179 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index d2a3d58a65dc..6b19b35dc5b9 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 = 2, - .hdmi_mux = 0, - .amplifier = 0, - .deepslp = 0, - .thermal = true, - .gmode = true, -}; - -static struct quirk_entry quirk_x_series = { - .num_zones = 2, - .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,42 +207,6 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { }, .driver_data = &quirk_asm201, }, - { - .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", @@ -304,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", @@ -432,6 +308,103 @@ 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 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) { @@ -614,7 +587,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; @@ -622,7 +595,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); @@ -748,7 +721,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); @@ -797,7 +770,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); @@ -870,7 +843,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); @@ -1011,7 +984,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; @@ -1077,7 +1050,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; @@ -1300,7 +1273,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); @@ -1321,7 +1294,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); @@ -1348,6 +1321,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); } @@ -1361,18 +1350,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 Sun Jan 19 22:05:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944605 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 1EEF71E0E15; Sun, 19 Jan 2025 22:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324376; cv=none; b=SjueKXYmvTIbOvFD8z7GCxQSOL3Q00DGr5TVDCa0RQTeyRlpHhH4xY+hqu6LwKgzJ0hCSPzCFkpBbmTs4yqOkMEaa7BLWZXXLVbunsrx64nTptEZukKL8t5AmrOM5vPB8SVZHuDRgzK3lJr4qA9qkVSftW6gB3/RgBfze0RcBhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324376; c=relaxed/simple; bh=JF8dghz/V3qoWXscDcPAQ6EglGIYyD9KUdKTGAWJc+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bEs210QjIX9mdO8jnwAnqcW7MCmxyfDrc6cTR1cyTg9vyRqE6hUnCglQLc/zt2E6Zb1UmyRrM6pxu7AeEZifWO+PVSS/RYN9KfBFUBnD8YEW90FhAKq15onAta3iZLixOMRmOexAwzkt+UnODXVWX/8r1oFyEzWHrO+otvNJoYU= 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=WGsOKlUV; arc=none smtp.client-ip=209.85.222.179 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="WGsOKlUV" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-7be44a90468so470241285a.3; Sun, 19 Jan 2025 14:06:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324374; x=1737929174; 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=WGsOKlUVjujrgiUwaPAZzcaUgsj/hLr3qf+Ig/klk+z+bdWLx6ZIbbUK+sk0RU0rAo 9B2NJ6eIm7/zlEd0aVzNGjuHdPW5IIuDvxWfuj2hmVaySsH3MqQA8cE1ElWxGFni1fw2 COsaIr1rQyRXAFXwXEUaCV87Fa6LeOuE32tE+kJDfMdXwZdwOOPUC4jfU0C97Zencior Odcbefw8Z3LarVBU49Z8oZ5qDZsBvqAWUuGccYK9/Gkzv8sv5ygq2v+aPTc4weEAJ12r yiVsG12FdQZ968RRb1HyNg42KmtDfmiALxHzkOBT/2yhALZpYCCPTHXrY2MgkWhI9B0C dtLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324374; x=1737929174; 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=eBYaGPm/D4cASLrsIX7a6q28QUkYkydhtx1ZIfTfyr+PKnDpe8CBXzgV4FqpxkOwoh fZpaf/3bThLHVWZqfVMaqbLVKZPq/yD6iEMzchQEezuYWu1ODBiKiq2JVKZnzBikvcnv mXRA1cScqDXicHWYF8x9h9xbYh3HXfS9SbJq/p7p1WtwXH6r/RF4t0bsYGlzBP7/OPpx r2ieVmUuslYcJnx/U1TZLw1p6NOfPtokYXET6jdmodUxeWHzh7zN+RqQVWm1GRIONBa5 zP46cA4p/FMw1WM0WwkeZG8mN6ubMOaZ+UklaabvZAWgN5zefh+LrxYqf7FfK5nC+3fO 9pyg== X-Forwarded-Encrypted: i=1; AJvYcCWhzpq6I2tpPoqqNMrnriGmvmFzJWX0zMS8zVKPSfXpMfdB/TqcnPOCFTDxdOiO9G4yIM3DtBY6XzF1wjw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1KEJpa1ACf+n8qh9n0uywKRshXKK2Gxl9jcCNh1aYeYqD2Cck Kf622/7t1JUF9Ifh5IgalitMGkyLNl9fKoJcUK4v/k0f68NSCdWMDKCOKQ== X-Gm-Gg: ASbGncvCBlgLsNksmLr54+vdvq/ayNmx0/oMOgA6BlqmzAB+LwJSyKYIP0rVvoDbm6o hy9T+HsnMpqH42UjnBa7cx61XEDmyFumfDInyyWN+yjNJpIqdUKpw2FVaT5i158VHc8H9k8/6Q+ teH8Ot47vfBFVWe0LSpzoLfiaRfkG7BcxGongvIGegYAKZ6lHlqebhe5GrigFZOcpwTo3UEg8qG ssOaEGEQ3AOQNubi1bfvWaAsyeRd9WdfTp4CkoXfeyuMB+cXUl4VA2SmYqdjed4c137zVvwLdRO kg== X-Google-Smtp-Source: AGHT+IHO/ek0zk5vX+s7FsFb0vs89JucJ0T9XT+BJtFzwpBZJ/9rRyqBfU1yJRdZf8Gc5nWzC0nI8g== X-Received: by 2002:a05:620a:6004:b0:7b6:7909:5208 with SMTP id af79cd13be357-7be631e571dmr1923484785a.5.1737324373781; Sun, 19 Jan 2025 14:06:13 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:13 -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 v5 08/14] MAINTAINERS: Update ALIENWARE WMI DRIVER entry Date: Sun, 19 Jan 2025 17:05:36 -0500 Message-ID: <20250119220542.3136-9-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 Sun Jan 19 22:05:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944606 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.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 BE1831E1C01; Sun, 19 Jan 2025 22:06:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324379; cv=none; b=Bhlaw5bZKNkjcPQ9/+L/NhEEjOCA5dpXhlOCO5OUPocvPlE4jLe1p/fzl5CMXH4Ma7Y5/+mvANsPXbjtHbePAWmfJ9SIq3L5UWqjc1s7Z5cOpjLZDlhYvDv9nNLepL/JSW3xmkFqBIg6ik4SDbWaVgxPgdg5xwus/Dmlj9l3Zr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324379; c=relaxed/simple; bh=Woq4swbnYq3xsWIj3EtplDj2WuXqxSueFP8J8UTTZS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pdTRzQWdKWsqH7PBgvGAae16qopMrf3SNgyaXLfvj4UoHsMOIbSvJ0hvMaobRye1+yIw9aQQtyq7Mogqvd/Dr/FnmbMyY4EJuyWynIpqFiwDxlahFU1yHggHeE7hsHOdlY2t7RoHnpgWStmP/AAd97tQ49il0s96rJWkllOU/EU= 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=JxLujZMb; arc=none smtp.client-ip=209.85.222.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="JxLujZMb" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7b6edb82f85so531417285a.3; Sun, 19 Jan 2025 14:06:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324376; x=1737929176; 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=JxLujZMbAhmbAl0UCh4bIlOTUlCtzcFh+OLz0qQeqr2XuSQ3voFKdiADHUqRpRAWKJ TdKTDaQzOlB9q+BFtHmDzDpYdMzAnlBOzyszlhSxLNv5vrkmVtFjy7YlBym9TM/tGhJF MNQ3lM0rlBS/my21zf4pn4FzgDtpnUiEfHPNPz77brn0MGguRlWtF1Oe/13rife/z2TA mMABuGG0XMPPomwf1i25DeCoIfhbLWLf2y5eDfeXanUyPSToK6KWodzDztnucm8EnxqQ 75bz1VjXPssiwVx4XipTLHsJhWNvx+SNNWIiTNLs0iGFv4N1qYnqE0ibxo9zMv+sBJmU SFlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324376; x=1737929176; 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=JNrRKC1JyPpzRiX/sUxIuwxwUUwwA40DsWCA39G9p6Sv62PGn/FwXDzDK/2mzM+HeA wQKq4PYNa17MNJVIuo97t6+OwJxQz/+BeZYeRkK2uds5R8hwn2EXLnFaGW3gteKYh1PW fcAgkeCPBLta6VOtD2nrcjE1Ox1t2/ge54L8dLTOABJBjYtjuXCIQ4VEMmfDoY19H7gr MPxsa/EZAFxRdIG40aP3f2/E9aicevM4St3d8wXUmes2wILIrTv+XDSoytnlhfwkiZKS h963n3B/uaIvezfZhGWOTqQBWx47TufEH73KddZnFCdE37PObzM/zbjgdq203EKPRP9U 4a3Q== X-Forwarded-Encrypted: i=1; AJvYcCVO/+PmbycgbIvHgtBzN3KRKZFLjb4Zh23kCvx2LkJzF0gfDEnfl8Z7jhebcWfTTOC+zVWwuw292DfkAiQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yxk3c35927TKufg788Yn/dfwK5q0OT4whzk1Aan2TanDljGUUUj 536/zRkveVHxNRCQinwYSixRr8AvWerNYcZaeDS7WM1GeiPMHODbZV6QZw== X-Gm-Gg: ASbGncvwjSmyBh1hZkTF28FSaSPUWV++zrF5bD9X8d6+8MXqcdhpuY/IWUEaooPloQr MV5JeuwAI++qgYFlwuHTxwuet70tovbVS4PgSWhh3nGEtB2WkQdr0nWgnpjaYZZGwsJdKHcBFh8 YLDAapbanX7NHLk4f6HRY6W+j2ctswxbr99GsZRxHnUW3JpYR9YvD9XS4aJp3fEUt8rDGiA0ZWr oRNHuUkwOmwjV1O8DNedzStDjuPx7Kbg7qZnoiVDLvIb1OTDm2EYxzP/h4ufZzQCQku/TmTpo6B 1w== X-Google-Smtp-Source: AGHT+IENRnzO0J/c4LcfyRiaWqw5IhOtUNCu0DD29+PqW1q+bg4zPH/U2eQ8s341OmX7gw3VEI2Anw== X-Received: by 2002:a05:620a:439b:b0:7b6:6a3b:53af with SMTP id af79cd13be357-7be631f5df0mr1661282185a.14.1737324376390; Sun, 19 Jan 2025 14:06:16 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:15 -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 v5 09/14] platform/x86: Rename alienware-wmi.c Date: Sun, 19 Jan 2025 17:05:37 -0500 Message-ID: <20250119220542.3136-10-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 Sun Jan 19 22:05:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944607 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 F3C0A1E009C; Sun, 19 Jan 2025 22:06:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324381; cv=none; b=Sx5ea1OShLp6RPqRXldjZnaszs2hWsA1MlLuR5SzukmYmvpiYpsGwJjMd5Nlm+DtjGtaJfs3E6kVXt+1CrxnsdNS2bYxX3Y71IhtqFRR73qOPVITia5bY1PMNnDHTGGAeKHimEQfbJLWZ04NKd6DjsHW4c/QoTFlS52T5KyXqac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324381; c=relaxed/simple; bh=M0iJhPMOT5SYnjt7HCSYgSI3eJfzZrDBKsjTW5Rm9bc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tG0CNq4qbnnahk9w1pBf+n9YKMuerEj/pQN6rU4ne1zYwn21NtrIPs8Z1IwMeAXx/JpgHY9jvDorz3Gmnq7uFXP+G0EgUpLZff10VKLaxH2Fo7olPJuy6pHnFxoPv5V4zAchvr+HSkUNI0U7swSXZqnftOtmUZyjUOGmAULsZrI= 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=b3WxCFex; arc=none smtp.client-ip=209.85.222.177 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="b3WxCFex" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7b6e9db19c8so359129685a.3; Sun, 19 Jan 2025 14:06:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324378; x=1737929178; 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=RDCBc//p7CnObRY4MayGE5FBduWZCOcw1cvtwYkmsXY=; b=b3WxCFexd58McRrOPirfRGapgzrwYIt/dIS7SAG+8iBypXggP7D5VTZU2QaFyQOTP3 4JEvTj3IYhO8u3PoMDrpfk7okFb7wx5RAhgb4MRDdfse5ccx8Z0yd2rO1mq0gfZll5FF ZxzEX5pSSmjbt9N5iaFQsxm9y5WSj6ov+Zp+5tnpY8J0B97vK/4dzaUSPQgFsN2EvXeL +6ppY8M39hjJSqScu1dx/0meeX6tAYQtcqYy1Ys/BBpye0ftJV2/duPZ59ybss4LaLUH ZiTvONIps1N9XgmSK35cC5GBgx3+LbdpQ/aCbnZhIPz6S3y6KFJBBC9bC6qY2pkfBUQP Mrrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324378; x=1737929178; 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=RDCBc//p7CnObRY4MayGE5FBduWZCOcw1cvtwYkmsXY=; b=u0i2WLgjUFbMcBWJNPhseR7Z0GBFtuE7244pOAj/cMzx6JgZHEc1jXj2T6PiaQH2/3 QtJw4GhsSF1W5Bx8KBEJUW4uGR32OSzlMhgUPKCPJqRNqiv6XiS1yegQZdzFKXXHsvgF UiZINgVCbXcPO3urwXmt1BzXJHgBWuFm/j/4Lau41pV+E9BGWww37+Hnz9ZSbL5q5Yq/ 5gL4ZTfit8ns/5o8UDk9R66YKc8iVU8YhIqDvStadm6dLF3gJU/BWUuwL+swsJ+GeUry S0v/JqLcDwFiIGahsqKmk6FO7y/Potzyr7k3/gi1fxSKbu93EXZfMOwtRJmphXNCmF+e KJTg== X-Forwarded-Encrypted: i=1; AJvYcCV60yY1nGCG3+2sdKDhZnrSP9Hp7JFm/SgE2zC9sTowGeRqG1DvKloNGy1h9L0KH4L/cPbMifvYhcT0tY4=@vger.kernel.org X-Gm-Message-State: AOJu0YwJynsR1a/VpY0rH2q236iIee92V0D+0gl7zi+FW7xj6qEzKGuI 4PNpXCz/b9DXsteZAaBZaZAr5JphXp53sWqkwAL0nLTfWLSX+kKH0dkd7w== X-Gm-Gg: ASbGnculJ+Nt1nt5IX3DoUEVd4p4iTChMHDrgyTbDtd7rEssKgr0aV89YMNWa5TFOyQ y7UVfmDRlZXu5qgYeVK+w7T5Ym7UiSx/LRDGTnuxosi7CqfaLQZDi5ktbyGrT7hhNp+lJ99Apy5 YLbM4MQCSIO0gzI2xUwbQEcwBniiMcDaXikQYOvCWwavgZJQvkKo18fbi/C84KnOXYZkptkrS3E C8OLlejctei5mZAMftDHw4nND/c0Uf+efPumymY0F6F4LMzixUO/3Eez/s1Ly7ulHmmvJRLtubA 7A== X-Google-Smtp-Source: AGHT+IH88BeK25rxvt0LFTkZvCXueb1AJbudzoH2ayjAGQIW2YFdhKrgJ8XE7CXYs2kx/+i4jFYx2w== X-Received: by 2002:a05:620a:2496:b0:7bc:dc89:3703 with SMTP id af79cd13be357-7be6323b5b3mr1795418285a.14.1737324378492; Sun, 19 Jan 2025 14:06:18 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06: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 v5 10/14] platform/x86: Add alienware-wmi.h Date: Sun, 19 Jan 2025 17:05:38 -0500 Message-ID: <20250119220542.3136-11-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 6b19b35dc5b9..f6001c53d631 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 { @@ -405,8 +356,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}; @@ -1130,7 +1081,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; @@ -1143,7 +1094,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); @@ -1223,12 +1174,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); } @@ -1319,7 +1270,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; @@ -1340,7 +1291,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 Sun Jan 19 22:05:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944608 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 8626A1E25F2; Sun, 19 Jan 2025 22:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324386; cv=none; b=PfHr6RvVMn7Y3aUoJpFXIG/e9NJXds3GBYzgurATxWE1ljqBt5xdgXCsbwDhR+QELG7Laz5RtykOfIUjQAEbfk6VHNX+9HiJBPGl2Srrw4LO/na3VLIdohrFRoQeLZlsMcH5K5amQ+5UsJdt89zSe3o09svtmphU6+ZGHWVG6XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324386; c=relaxed/simple; bh=G2gH4E4dVTK/8cLW1Ly1jinrUxsUbQBNpkMQrj4WnS0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fQczHGWLeLCcpbTR2sZ7EaicequkeBQ+bhHY0MNEiVOjwXTyxz1d+mJvz4qurvUF+21rHvgdzY0O1FEvj8oBetE5J98zvGhDz/6V9NwA4NnCByvW/eV1EILUShc0ZEV+rY60Y24KfINGEIQUKYW5qOjVnkfPKFTKGZ9Y0MH/E0k= 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=nV3p6IIW; arc=none smtp.client-ip=209.85.222.175 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="nV3p6IIW" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b6f19a6c04so339704485a.0; Sun, 19 Jan 2025 14:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324382; x=1737929182; 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=FUbe/N0R/8R00cRbzUwcj9WvJ8xXlERk696WZW+SFlk=; b=nV3p6IIWZFUBhepg3Ml7Ss/oYy/dXmxIDR1nwcItK7wuQ9l58AcAL93OE/0PjZ9iC9 cw+CzQYG61n+zVeNg3sjwixMpPHuePNT/n1REEsGg/G3GRBPCd2W9jkLKWQGQsIZlVoP 0/xs5TFwQaNtQDRTiuYCngoiTLKElZlzKqif4/b7gdO8cnrX5YJqLqaSdT3wb20U2YZ3 KXCR/Dkhv5IN0idpPmp+tSOi9HIhtt3XxI3z6gPSye9dXNe+Bev222ZoqEeW7QQjcXOf Mlj8PbHNufxzH/3o7ojmA7iDrTE1JmIMuKKdTTSlMcG2oyMa/6VHDRBlNn8LLmKCy5sb 6bog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324382; x=1737929182; 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=FUbe/N0R/8R00cRbzUwcj9WvJ8xXlERk696WZW+SFlk=; b=pODNYo4YLOs6mFMsNo2KzZbd887f3MOUqWxAD7WxvR+uFyWBqOFU/ydVVfPQaRfumE yX7rIDz+GnAQb+BOKJHRJp/BrylHCVwFL2jPVOl4qVa9F4dSWGRdRzMrSuNtGDm1/EkQ zQUbRS4xJObJxgRQscm+R0mT/ENfZdeK1URfS7u+isBYHSr+LMmLadGSDPnDkPyOyTPL kqmMAAnvbzXB81c8jWHFhOqJD7QvGpsL2scheZDDzdIDdv68Ph6jn3H6ETjenEyj7Psy cdYKS9rlDRKw5M0SqgD0DekUCpSTGtVP3LgoGhkPJJ9FLZck0f9hDA/TxWUygr7ARWmv zYHQ== X-Forwarded-Encrypted: i=1; AJvYcCVjRVoSUmpKrpJB10yr+gjvmqzpq7HWk4zr0KRnIJc5lEIu/aNhdByD5ZSWDlZmKC2W+pRqd7rKFLWaKHQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwZsqaNQBNnBN3UZcS2PCVmvl5P0h3y8+qIWDCNflMHWRhqDsQS no+F0j5FbDGso98g9U09f4SKbHbzRITx0bTP6YldAfHKlWPEV6yg3LiCLw== X-Gm-Gg: ASbGncun/G61pLQOkC6t2MrNwqU1JrCEZvDUy01w6Bl+44VBP+0KS8UOn3vy8pxVFLF c2N+P7Op+NVtM3CKZlZwg+yDcxo2axbclbCLD5MctWgIZfExAJRlbHJ2ix0Lt6yTGt7atOzoDiN +ATQ0nWL5igU8s3C1Nbog8JpTzVrd1523xhkvjtoRFdWLHjGlZjRvIInk1jEb94ccvYD0lXVUDw teHcVKay8HRfu0D4xX6V5yxeTUS47uxhSlwWxuwLHVRclau45WM/sqi1lsoQNCjrHwBiaUkaDv7 fQ== X-Google-Smtp-Source: AGHT+IFFGLKyT+cLY4JGBuXfwDFGNprb7heMjH8WC0Nem9LQzFsM1iUpTsHYwKRZpaKOtvMZoWdwxw== X-Received: by 2002:a05:620a:4453:b0:7be:2a68:6d79 with SMTP id af79cd13be357-7be6321032cmr2225425385a.7.1737324381669; Sun, 19 Jan 2025 14:06:21 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06: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 v5 11/14] platform/x86: Split the alienware-wmi driver Date: Sun, 19 Jan 2025 17:05:39 -0500 Message-ID: <20250119220542.3136-12-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 | 851 ------------------ .../platform/x86/dell/alienware-wmi-legacy.c | 101 +++ .../platform/x86/dell/alienware-wmi-wmax.c | 774 ++++++++++++++++ drivers/platform/x86/dell/alienware-wmi.h | 1 - 5 files changed, 877 insertions(+), 852 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 f6001c53d631..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,139 +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 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) { @@ -591,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 */ @@ -1066,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", @@ -1101,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..7f9298950731 --- /dev/null +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c @@ -0,0 +1,774 @@ +// 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 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 Sun Jan 19 22:05:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944609 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 D020E1E25F7; Sun, 19 Jan 2025 22:06:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324387; cv=none; b=StlwEy22sVa4Xp4Sw+MZ2K3F4WbfIYRt2EJU3ysU1ApkUXBtPORllTZe0hMu+BFMiG4XegD5BkVJrVRUE4NJPo1VqLUN47RPbrtiU9LsebarWST46DbZRyUYKWtrb3VaGkjaJ79P1pJHWh+j3oSBrX4+fDM3gzlIEwZs/4UwXws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324387; c=relaxed/simple; bh=FuBXIXgK5ndfxQCn2S+4A0NXk7qR5VltBqHb6gMI8Kg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fkVR+eWG8Qa6n9Alscu04HDSna8SYHMk/hiQwRg6YGsioawbQEGP69/R0L4MiXYFso/2Dgdio9MEsIH/w2J+lwC3Q1IvL/UKNHLuIirnICYKvFxCJ/uCm11vWfY6h6SeaBD3V8lX1t4xDZ+MyqQXhvz/rTyD8Q/Z3sIusgenBcY= 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=mBo9DOU2; arc=none smtp.client-ip=209.85.222.177 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="mBo9DOU2" Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-7be3d681e74so354322385a.0; Sun, 19 Jan 2025 14:06:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324384; x=1737929184; 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=mBo9DOU21GomnibleHW/eCSlPoh+BN1HYcZIwAhzSOTt28nxlHxvP3/fBaqZ6lJcXq vrYuip2qWCry7bODW+exrapMf9PffLouXbIoLQ+x1S4yz+z+icz+UNXczgEm1YuTMz80 jOQ+Uz4pMslAtgPxaueDUlZxv0j4l3m4cheyrNHKZnV4YXVSP+MhMuz9Kgq8IgRiuFjX 1Cg8Y7OkEa9efaTvtPHLIyPVAQRzyHDh4Qpn2pAPxNCS8ttouDDlj36fR7V+5mzGwtBP c9x5IKCpptHiEGMtgvF3+esn6t+UtT5u1zXiXKcM5pLnG94FpUZ6W4fmvo69b512JT5E s46Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324384; x=1737929184; 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=cw6pxtj4nNHz9Oxx3NRKy01T6wHxg9hH41fHkOWOmSVgdAbuVZ+Mq6FE41o7fup+I6 DQSORHSHa2czN2ccIOhDixXhkI8XorCSnmIBDzq6Sjx12bccORgGWbWBN1ahPYOYBrNZ v3Hb+mwHkunNxW2e3+ZiB7YOrU7tHlZKtdNkObQ10dU5J74W7pUXLV03l+rl58mjPU67 9L+dlyyy2dZvaYVDRrurYzLke4ih+quMjYcTXsKIQyS4FJTwJChcvsWz1X9nCrfcjMAz tT40VQKtNjbUUsgvKPfaZmiAyGrdS78i5WMOSjkdfYJBBtsMPoEBipHGWD6QioKW4BEJ rSAQ== X-Forwarded-Encrypted: i=1; AJvYcCVki4d/3I9oGEIixpWC0lQGjGCSTJmcvTdS7vr4Pp6jtEAPa3l9bqBgXeDQoiCAwwlKMYf7Qrwtm3468i4=@vger.kernel.org X-Gm-Message-State: AOJu0YzKKLaEBrn/GN32bc0frJMHgKPS0TGLdwKs9r7CG9W5kNooHsOG bl+hTYE7jzYe3NOOH5WwTTrMGLQJxhkLmDGkibicY/s1rhrDQ8xBdRKRiw== X-Gm-Gg: ASbGncvciPRLZ+NxyTWkfhhewHA0VcLUC53+QQvF6IMVqjx38V8E4uGRZrRCItrgSx4 7L7cyYeLWiLz/MK+duTyi8GsEUowcJN12QCk932FRenR5t0tp43+a+l2al03h57cXawShkmPlqx vAEpmCBNikbJSnwosPScIJjhCdFPOPFZFVsfexoVCYwFH6gzBhqnbZ++s8JSjW0s93o1RhYPQcG qHQiv6RI7GsgpA98AvCMXbay3IqAaOGYt51c9w8s6frHOmV4x1Gryzy13zkjphlSs3GyO619wgj Aw== X-Google-Smtp-Source: AGHT+IHgnbQnEUIaghXeJJIHIooY98sEMbnfcpYYcwYfqaEl4McDlWqDX0fV4SfBrSMhn5fHfDRhBw== X-Received: by 2002:a05:620a:3712:b0:7b6:d998:4fcd with SMTP id af79cd13be357-7be6323cc04mr2247831085a.25.1737324384260; Sun, 19 Jan 2025 14:06:24 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:23 -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 v5 12/14] platform/x86: dell: Modify Makefile alignment Date: Sun, 19 Jan 2025 17:05:40 -0500 Message-ID: <20250119220542.3136-13-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 Sun Jan 19 22:05:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944610 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.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 B60131E2607; Sun, 19 Jan 2025 22:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324389; cv=none; b=WKnLVK1Ckong+bKqSJRV1Uh+tSOfNoEPhr8RjowfVjF9HXdevUvpFhniTq3Xo+jhjp1pt2VPKpSpK3CFOPqSR9F/aM+8uGUPLE3XRra2bExVMDsFajYtSosnc+Z+8g2dkj8n3JHbNRrKi3ofYd3+Z8q5zbotz2/+dxxeIKkmBdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324389; c=relaxed/simple; bh=4AvwmgNq0K8hg1b/NuDxZBgHBGQc4Xo1hmy0Q+V/UVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DGSB1DwBYfPEihAgUGr5qPkp4Rk2rZsi/xfrrY/8Bm/fcrgEHZGUMxwJQt5SjJ2QISiEJx17QAIkFQnfisXcu3VIbRsNFiK6eduiFsUF5l8XMGm4oXpQn+SPQWy4y1myswVEfQIrDMRmeJH4r7N4klvCXGxWIdF58vXxO4b2D9Q= 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=GFLY4drX; arc=none smtp.client-ip=209.85.222.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="GFLY4drX" Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-7b6e8fe401eso367812385a.2; Sun, 19 Jan 2025 14:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324386; x=1737929186; 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=GFLY4drXW9gV9Vtr6GVIpg6qCBP37ECfXRtoMoiecJWFlX+kFhiFgZBMt8YHpvsSni oWVcIGi31bd48pVt1pZqfRcgyy2zKC8i+fxQO0BeNEZ0ELrmLrH3LfB7sN4kBIc1ky5j bq/WquFb/2z6Od156mfp9kg6ClGPtbxduscULQvLzlRFBbhdiyqd3r1SvX7hXx/NKy2i 7j6uqVadyBZQHpwpde3cds9ZSnqS4xcu8IYE4U1Bb1V4tZ/Qcmw3XTo4Y17o908IW8Lk nCn43Z+HufeKu4Z/3ojwAxonM3sDT6hc3xXSV0eDF0dvNh6VC9b4FWSi0EbpeT/tXR3+ 7gNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324386; x=1737929186; 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=WJ04D5PeH72RPTk0XhGv+wlUBqYaPvsIbg5HCHFK3L26VIyouExdHLcJkxZEjBcHfC iNDSghBlLxrvfjmo3dTedpIW9kiYrGDDXOA3hpXCFT3WMFFmcZKFRrzslHKkX6Y7tIy3 L7JgJBRt/Xle61oVH+z4plCI9HM26qisfjGvzCKavAQnKCdpPfCjqf5w+VO+bx/X220z 0FMzS3IvNQ2XFzW3+keC8f++xMXhEZG2Xgo7nv4JK18oMF2/cHds77TfqZWF1uppkBxK PeFqHapwxFmvtTo76g4t7n2E79N5AU4emKjIB/bRqGBjAxZTmyVYBv5mhba8uX+YBINx oKEg== X-Forwarded-Encrypted: i=1; AJvYcCXgAjmwXVPArotrl5R4W5YLUVT5iUvYXd91tFpYpbuv8xzfYTGYTlRyENVe7Qbzvl59D01h5qEMb40EYew=@vger.kernel.org X-Gm-Message-State: AOJu0YyfdXDoopUvtO2XwfgUwHvrJLeFYCWVTL8SifCJ7cnRyMqMDRIL ETDjZe6pOIEU//tBglbpopWduKu8ofwzsthTJABBUScI0xoU+U3c3blnVQ== X-Gm-Gg: ASbGncvhAPLx+kFWfr4q4JA6cY3832KEUxhgErVNuhDCDwX74I/O/GjwzW/XpGedBqJ JRVOojkDEOU8G6B8SCF8ekam1u6oj+eKDbBl1leXgkw9BWcQhSnj4d+6ukdlJ5ftqLg+rmlxXlu gPzrjB+L/02x+kPJDfBiW3wCLBhgr0iI+0NrMv759DJU5JnrQsAoqLvHtUD21nJ11fae2VD1qZU s/A8ijMVC/+gK58PaqgVz0TBZeOABMGibPV3V8/WJdiOHMpAl9YkF1eBHkmeOXzt2oqIlF/2a+9 Sg== X-Google-Smtp-Source: AGHT+IG2SyrN4WDx6df/z93rBgjBHmDGHqx0cUqzobmegCEwO3Gu7zqOk/y72TWUm4ioh31wiCd2Fw== X-Received: by 2002:a05:620a:6888:b0:7b6:f997:1d41 with SMTP id af79cd13be357-7be6323eb0fmr1639923585a.29.1737324386309; Sun, 19 Jan 2025 14:06:26 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06:25 -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 v5 13/14] platform/x86: Update alienware-wmi config entries Date: Sun, 19 Jan 2025 17:05:41 -0500 Message-ID: <20250119220542.3136-14-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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 Sun Jan 19 22:05:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13944611 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 706C11E2834; Sun, 19 Jan 2025 22:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324391; cv=none; b=HGf3CqyKF1Zve2AQ2nMyjhAUSsrQvKB1XxcTgCPBN2lby2tBs4gS4ZNQNOr1xB5tp+A7J7LXmn4GIorgh4iKNIJs+yIXLVL3aGWn96XnjMwm2TodgCCcoCRBfP9RFZLdjbrs2H9rE8BUA0LGPfZsIjeE9jXirTtzJNVDdc8OmtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737324391; c=relaxed/simple; bh=uln2bSp8cCgoiDtrWN2ZC+ClZjMq3WgUM/z2IQmiA7Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oe3HbUDuc2Py2hZWt4bjkuuZ9fo0DZYTjb/xovvxnDPA5D61ZXuZ+QI0JXM21sQWkdn7kvbN7rp8OkmH6yG+9B4x0XOJxOYUntmrk292l/snjLncEgm5JA4BL3VIkoiyV8Xr44un5W3qqwtWxKgBPfU1+CSODWxKBY8nrqJP9Rs= 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=SHryCTb2; arc=none smtp.client-ip=209.85.222.175 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="SHryCTb2" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7b6f8524f23so493715485a.2; Sun, 19 Jan 2025 14:06:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737324388; x=1737929188; 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=SHryCTb2t3jAg7Fe3DAnXhHGES67sKoCOG0OnTW7XD6j7Wl8NHkvaWInnz9gX/1QXo LayVbAdhZdusqA2oXJ9n7RjyTlEp6GhpH1H7XEzy6Z3lNGtiBD+uyExIKJDTrT012Y9k xxocWKRB/47FX29WakydItuHWA6rrqhOsbzXsrU0MBSYhjfqUuAX+zfyGLPZ+HMpWkFJ Ozc5qF7T5lV6nkvGV1xjXSNUNr2q4aT6foKUVqJ5U0/s9gJy96hW9mX6FXgMItjoc6az Nw6H6hCFzgLZPquhS9F5FL8pRWr+kp09P0aZ/lYEUTJrFr25m9wq/NcuABQEVmTDglRL PO2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737324388; x=1737929188; 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=cNwDPqM9DUyXiefEU8H60Nn9xFLkaZfc6da8RnxXseVdCkZTvZUk3pdcZyJzGCk8pQ 4xulPiW3ujoj9w3J9kK1F+F0KmVselTz3QfJGcO+S5JmPUB2kMqj4uccZ9nxAaMFqdQ+ SwUvOwD1vromBNv2Jtu14IGZnMMkWyZ9Pc5YKz2hOkwBPglmYTtSA+6iRIILPK8eMcUQ cBYCTXgmjCC+FYszA+I2HkT++K9e5nWB9ynEd+FK9rtMblRAtRFGdpUlEVsa0iE+Y84t 1euscjHp+NobzRo6u9HZb8zaRCbzgGT77Bti5U3cYnzj++DRWT8cyif93Jyjapz+s0R6 TvCQ== X-Forwarded-Encrypted: i=1; AJvYcCW73GQwswaYxHL21n3d4qJhX4obsiRW2Nu9Q7JVqUugP+l0CJUnTPt1EYTLHldQZvlb9Uj03OpoC0W4rcE=@vger.kernel.org X-Gm-Message-State: AOJu0Yxf9C2tNgnztJnMYCxgXSzlcqFpORfgEIpPTo2/As7+bKEyAKEV cf2k3FPW1Wcdjv0hRmNi/SRXF96JzrTsmP7+p9iwhATf4JF/V6U/ERlqRQ== X-Gm-Gg: ASbGncv5GlF4Oo4Wy1gm27hF54tUe+XYooINGOxt+BUpuxxOXSLzhAkHgQB9/56boen oq9NYAocl/i7PbvW6TDOsQcK3LqOVb0NSwuuJS6Rf/vOs83zmBgxzIwpAGiHdGY1T7rJzFBwxKA UX6R0hW+u6VC5SMab8iSggmL1kmolXzBFt14GRXInwP6J2w0m5VnPwCZuDyuV4014QZzp/3XCPf CLVNm40jHkEQwGSiyH4PnU6RfTmEDWAKQM/h8pgZogg76achxENUJRpNZvUGAdo1uEjfWo8xloM vw== X-Google-Smtp-Source: AGHT+IFOA9eP3M0hOzcbMoyWyb8ro8AZ3iJCMGJPpMoFzzhBJlVe2e3lseBRDWO4GSKA4HIA/pr6PQ== X-Received: by 2002:a05:620a:408c:b0:7b7:142d:53d4 with SMTP id af79cd13be357-7be632480c8mr1573147985a.39.1737324388019; Sun, 19 Jan 2025 14:06:28 -0800 (PST) Received: from localhost.localdomain ([2800:bf0:82:1159:c837:3446:190b:188d]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be614f0096sm369243085a.112.2025.01.19.14.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jan 2025 14:06: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 v5 14/14] platform/x86: alienware-wmi: Update header and module information Date: Sun, 19 Jan 2025 17:05:42 -0500 Message-ID: <20250119220542.3136-15-kuurtb@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250119220542.3136-1-kuurtb@gmail.com> References: <20250119220542.3136-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");