Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2238829lqo; Mon, 13 May 2024 11:51:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVe5GxNsBfsaJ7reHggeKFfYioc0I6CVg4uyZqNAqWoV3asbUBPO+/2pM7HQpBblJiFRwBcULqnEpQLOWvobgwW8WPVjvJiZej7LFZJkw== X-Google-Smtp-Source: AGHT+IF7WAQFYQuqiaFFbX5fTWUl6ti7jLaMUuIhtR2ZcSVJMM0BfXarG4kZOXWFFkalErQwblOX X-Received: by 2002:a05:6a21:3392:b0:1ad:7e4d:2ea6 with SMTP id adf61e73a8af0-1afde0e694dmr11068555637.20.1715626309057; Mon, 13 May 2024 11:51:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715626309; cv=pass; d=google.com; s=arc-20160816; b=ixDMRpN4nqnqJrddcBnVcEFQODe0NcZBsLKtfAt8fVW8NdCmjlxu1ok9c+JJGSdCNW l3JIL7H31j7x5JJs152RnQOefJJ7uBSMvpmaFufrazXHxPUy5pvjcm3oDD6f4oewPqFU 9LUVPhDyFVsI8IWbh96zuLyqTWP/qnvJ1bbeWKH4A5TBbq/f4MlEMtUaCK42DkVIg6kp 6CzPgwx37MWgs3h9HzI4yok7d5rhzEYhBGj/zB/yAs0/rv+kDRWH6C50vgcn+HHaGsPy u3EAVJ20hyOtqx0W5PA6W8v+mVjLfBudNrHMxZxokpFsDgW0pdg8fzDK9jAdTc9Ib5sf UoiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=12tRDbW2LR3lXqoHnvqV+BbKjSxGZDFRPqS/M7r5LC8=; fh=jtZQLOKtIGGDuG6wAuySBrh1qU0yG/uiS0bXKFDoTjo=; b=XKE++W2cxOTnV7ARP4bcLWn1u4kXPgX6XfI4RWMcTWNw543vQ5AdUaLLjiN0kfR38Y MHyfw3JuaMbapjvaVR+QDnF8bA3sqW5XL1V3MAW1nk0wgC1XoZnrITyVeMxjakozIub4 yUf3KAHLU1hkY2QsaHLun3ziQVemc+GCM0/X4a1aDP0/F4kmcalAUmzkCS+LxysZApS5 j16UWsgZUbjQ93DMXr+j9uilT1509y9tdwNThkmxs7qdem1dgQ39QWaMAYrF8BTJRIkN BbjygcpMnN5yWNNu80JdQzRDKkZNdel539JAmMG46h8A5aUtOy24B3hLFRqNmUG9dX/X i4KA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a4rwJRdl; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-177988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177988-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0bf31a50si100813355ad.224.2024.05.13.11.51.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 11:51:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=a4rwJRdl; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-177988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177988-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BB1E5B207E5 for ; Mon, 13 May 2024 18:51:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5189D3BBE9; Mon, 13 May 2024 18:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a4rwJRdl" Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D4883C060; Mon, 13 May 2024 18:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715626291; cv=none; b=YTvul4+eXB/fQlDolHZSSDk/kNuded0F4AAeDSQ6Laq+fBzBhI3MQw5aY3SqdEwpz0wi+CaIo7IC2sHX7JlzQdTiv2S7rwkAurY+9B5KZKKdiLt+9uTLDh4Q1D3IJhTpc2fk9hRvdPhusSi0RlfjCF2j8qouQqGrKpI6A4Rkrxs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715626291; c=relaxed/simple; bh=uKk5RVSZilQekGUDZr4YfLhpn3Ugc+p7LNsMzPoKt0w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Wc/lbHIuqCht4y9qiZJ+5K7t2dUNBIgwNbgxSMj5sqOB5ULCrKLroBaA66oHpESDmyW1RSdSd9i0A5g4A4u2+CPTTCRcjhtEDxB1zcPkIqCd6mlJKIDnBOknaLmoPVX2vg6BDgD73353RE9QDMWxvsRw9PvGIDsuDNJvNzo/q0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a4rwJRdl; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1f0537e39b3so21762395ad.3; Mon, 13 May 2024 11:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715626289; x=1716231089; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=12tRDbW2LR3lXqoHnvqV+BbKjSxGZDFRPqS/M7r5LC8=; b=a4rwJRdlN7KCwb/7xrGc7DiBu9jm4LOJP5AeBXkAK6s1iyZ3f/+B5dzJDC/ryJnlqc iVsscIEZPmtvn/80YGqDsYyr7D+ziqHOCaoaCWn4RFeWe5YQBLjynzQlZyHiO6a2JhMJ KY/oooygNYPU8iYe3K52ryez9Oa65CsKRCC9Nvl9sMZdu7VeEbmmNIDl9GnsjJli2EwX e9qLc/0c6pdu6dh+WkDE0OhMpmj++bsjEOcAfxv2felE2k3P7BzALzIg25pRJCex3/j6 zfAEHTtkiTE4tV9Vny4vlEfvq43q/XpHAh32pJJmzyEXZHwAo/ygdfySzA2Yfx2lTofy dqtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715626289; x=1716231089; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=12tRDbW2LR3lXqoHnvqV+BbKjSxGZDFRPqS/M7r5LC8=; b=Yhq0mH3JymPpExVT5qoKxPKPyGy9/dE8hGpM1FeuIKUOYQzIqIG7iB5jE+x9sy3fHj C9vELU9Wv668ZgD9JkSjXFbZ91THMPB4nEYp4rVXg3SQNAkN/xAqJl1ON6ia99qdme+w sTCbzLGgWc+EZFmjMBRbe/nKHDCY4KiGxeuf92Xd+597MMKsICYomMFOT2iBbZFfd2r9 DBXr7SU8dpJ7E1cQorHsZasWB44gMOeIZw3L2hgZkCaZsc+Aikqo6CGohyy6guC2wUDl mlWHNXQrNShXtVdBbH+BNhRciGnyFrMY/0ZyTMSnUl/S6T9Q4BOaVGKudPZE3Ca7wcqF u/Gg== X-Forwarded-Encrypted: i=1; AJvYcCWvxevf1EDMFQTA/nxXc+BfmtkW2QLNXg235eOuyfYmPGOHyfjWJiEmQ6kIrnu8HehVCciuq2WiuHJ2fIRKeC7mzrR4yf13Q8c9uTDuK290hPTZyNyzhD3FaE7PoPP61/6mYfjAdsSHFJA= X-Gm-Message-State: AOJu0Yx+tX6tQJ0PBN3fp+hgYSNYXzr+KbqD4BID1Mbtpq3puii0WiOh Dcbja89EAGBw4tiHxKiYahpbDBYYZBtfGjbVVxFkyaOubtLMqD8Bnq2GYw== X-Received: by 2002:a17:902:d543:b0:1ee:90a0:bbb2 with SMTP id d9443c01a7336-1ef43d1aea0mr131949225ad.17.1715626288583; Mon, 13 May 2024 11:51:28 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c2565b6sm82342895ad.295.2024.05.13.11.51.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 May 2024 11:51:27 -0700 (PDT) Sender: Guenter Roeck Message-ID: <0e5d5843-e91a-4c0e-a7a7-fbda55301265@roeck-us.net> Date: Mon, 13 May 2024 11:51:25 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] hwmon: (corsair-cpro) Add firmware and bootloader information To: Marius Zachmann Cc: Jean Delvare , Jonathan Corbet , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240513162328.17636-3-mail@mariuszachmann.de> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY2stdXM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40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <20240513162328.17636-3-mail@mariuszachmann.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/13/24 09:23, Marius Zachmann wrote: > Add support for reporting firmware and bootloader version using debugfs. > Update documentation accordingly. > > Signed-off-by: Marius Zachmann > --- > Changes in v3: > - use different debugfs directory name for each device > > Changes in v2: > - better patch description > - Documentation uses "Firmware version" and "Bootloader version" > - removed conditional CONFIG_DEBUG_FS > - get_fw_version gets called from ccp_debugfs_init > - get_fw_version does print a hid_notice when an error occurs > instead of failing. > --- > Documentation/hwmon/corsair-cpro.rst | 8 ++++ > drivers/hwmon/corsair-cpro.c | 71 ++++++++++++++++++++++++++++ > 2 files changed, 79 insertions(+) > > diff --git a/Documentation/hwmon/corsair-cpro.rst b/Documentation/hwmon/corsair-cpro.rst > index 751f95476b57..15077203a2f8 100644 > --- a/Documentation/hwmon/corsair-cpro.rst > +++ b/Documentation/hwmon/corsair-cpro.rst > @@ -39,3 +39,11 @@ fan[1-6]_target Sets fan speed target rpm. > pwm[1-6] Sets the fan speed. Values from 0-255. Can only be read if pwm > was set directly. > ======================= ===================================================================== > + > +Debugfs entries > +--------------- > + > +======================= =================== > +firmware_version Firmware version > +bootloader_version Bootloader version > +======================= =================== > diff --git a/drivers/hwmon/corsair-cpro.c b/drivers/hwmon/corsair-cpro.c > index 3e63666a61bd..f7d321d8676e 100644 > --- a/drivers/hwmon/corsair-cpro.c > +++ b/drivers/hwmon/corsair-cpro.c > @@ -10,11 +10,13 @@ > > #include > #include > +#include > #include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -28,6 +30,8 @@ > #define LABEL_LENGTH 11 > #define REQ_TIMEOUT 300 > > +#define CTL_GET_FW_VER 0x02 /* returns the firmware version in bytes 1-3 */ > +#define CTL_GET_BL_VER 0x06 /* returns the bootloader version in bytes 1-2 */ > #define CTL_GET_TMP_CNCT 0x10 /* > * returns in bytes 1-4 for each temp sensor: > * 0 not connected > @@ -78,6 +82,7 @@ > struct ccp_device { > struct hid_device *hdev; > struct device *hwmon_dev; > + struct dentry *debugfs; > /* For reinitializing the completion below */ > spinlock_t wait_input_report_lock; > struct completion wait_input_report; > @@ -88,6 +93,8 @@ struct ccp_device { > DECLARE_BITMAP(temp_cnct, NUM_TEMP_SENSORS); > DECLARE_BITMAP(fan_cnct, NUM_FANS); > char fan_label[6][LABEL_LENGTH]; > + u8 firmware_ver[3]; > + u8 bootloader_ver[2]; > }; > > /* converts response error in buffer to errno */ > @@ -496,6 +503,66 @@ static int get_temp_cnct(struct ccp_device *ccp) > return 0; > } > > +/* read firmware and bootloader version */ > +static void get_fw_version(struct ccp_device *ccp) > +{ > + int ret; > + > + ret = send_usb_cmd(ccp, CTL_GET_FW_VER, 0, 0, 0); > + if (ret) { > + hid_notice(ccp->hdev, "Failed to read firmware version.\n"); If this happens, the debugfs file should not be created, or at the very least display something like "unavailable". > + } else { > + ccp->firmware_ver[0] = ccp->buffer[1]; > + ccp->firmware_ver[1] = ccp->buffer[2]; > + ccp->firmware_ver[2] = ccp->buffer[3]; That makes me wonder: What is in buffer[0] ? > + } > + > + ret = send_usb_cmd(ccp, CTL_GET_BL_VER, 0, 0, 0); > + if (ret) { > + hid_notice(ccp->hdev, "Failed to read bootloader version.\n"); Same here. > + } else { > + ccp->bootloader_ver[0] = ccp->buffer[1]; > + ccp->bootloader_ver[1] = ccp->buffer[2]; > + } > +} > + > +static int firmware_show(struct seq_file *seqf, void *unused) > +{ > + struct ccp_device *ccp = seqf->private; > + > + seq_printf(seqf, "%d.%d.%d\n", > + ccp->firmware_ver[0], > + ccp->firmware_ver[1], > + ccp->firmware_ver[2]); > + > + return 0; > +} > +DEFINE_SHOW_ATTRIBUTE(firmware); > + > +static int bootloader_show(struct seq_file *seqf, void *unused) > +{ > + struct ccp_device *ccp = seqf->private; > + > + seq_printf(seqf, "%d.%d\n", > + ccp->bootloader_ver[0], > + ccp->bootloader_ver[1]); > + > + return 0; > +} > +DEFINE_SHOW_ATTRIBUTE(bootloader); > + > +static void ccp_debugfs_init(struct ccp_device *ccp) > +{ > + char name[32]; > + > + get_fw_version(ccp); > + > + scnprintf(name, sizeof(name), "corsaircpro-%s", dev_name(&ccp->hdev->dev)); > + ccp->debugfs = debugfs_create_dir(name, NULL); > + debugfs_create_file("firmware_version", 0444, ccp->debugfs, ccp, &firmware_fops); > + debugfs_create_file("bootloader_version", 0444, ccp->debugfs, ccp, &bootloader_fops); > +} > + > static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id) > { > struct ccp_device *ccp; > @@ -542,6 +609,9 @@ static int ccp_probe(struct hid_device *hdev, const struct hid_device_id *id) > ret = get_fan_cnct(ccp); > if (ret) > goto out_hw_close; > + > + ccp_debugfs_init(ccp); > + > ccp->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "corsaircpro", > ccp, &ccp_chip_info, NULL); > if (IS_ERR(ccp->hwmon_dev)) { > @@ -562,6 +632,7 @@ static void ccp_remove(struct hid_device *hdev) > { > struct ccp_device *ccp = hid_get_drvdata(hdev); > > + debugfs_remove_recursive(ccp->debugfs); > hwmon_device_unregister(ccp->hwmon_dev); > hid_hw_close(hdev); > hid_hw_stop(hdev);