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; }