Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5233046rwb; Mon, 8 Aug 2022 14:56:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR79kGFLvWTa9nrbsplOnDKrXwlteYwZLaXT2fBArDbPNW9YCx9ZDm7WLeIUK6xoNILpCead X-Received: by 2002:a05:6402:4441:b0:43d:5bcf:afa0 with SMTP id o1-20020a056402444100b0043d5bcfafa0mr19091294edb.91.1659995802683; Mon, 08 Aug 2022 14:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659995802; cv=none; d=google.com; s=arc-20160816; b=XR+AkurWRBg9PI4fcKI1cvIF/kim0+lJA1A1xvb/deYBvtapQS+7KWsZhwPnFjRSFQ RhT56GMyIbKx4pMbbeluYGOozc7Bo/uXMSi9CtWnNsv+xhlEoc2OeuGcSofb5x2Is8kQ XaXiUlqAugnIlC0f6KUtzJOYqH1NSpZzZuTzQfQCPbit4wBU9PSGLUaK4uvu8mz9PMo+ SWgtttWc6qPkBtx9aWAtJKCJk32WlqeXIGJCguhE/1UnuRq1+nPi487644WlYm1mcttN tBIA9Z0byABvSKPJOt4+7TimwTWWdWqSHXXMyDUiNhhsEjCon8STVFzTD3NCBcrUU2Qo imkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :cc:to:subject:from:date:feedback-id:dkim-signature:dkim-signature; bh=Noq7c0NawzgYCdsg9ZW5dIqk4AKYo1HmGlvkyEbTt+c=; b=m2paalHSDRv0c+hYogHSuV7389VmdEag/FW9t46VsBnrtdwgSUqYcOx4Menjp1npLR pW/UqE9KdPbymEp9LEvzj0zWy/NvesCiEF9PPfGQV/4rM0YSkxyfIMXz/KCLrxzjq48f PBsnN97c3aVstaT6P8tYpNtmRSrK3gtMK5n3AK4Ud4NMG62Qz4US15knIkyafV6UxL/X pFe+7EUfXhM5TXayK/opVSYb3xmmHYFrnviv0Q5I/SQOJxYaL3CLl7LPivMJtwO5FJjp FsQ4FEU5I0TePI6R2mYTcL+H12wvNuYalZtnEYmjTi9TEn7ougBJpZQsLt6i1Jcho+ti cL8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=NzBoaOMR; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hWJITFkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a1709063cf200b0072b1b099d55si485573ejh.268.2022.08.08.14.56.18; Mon, 08 Aug 2022 14:56:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm2 header.b=NzBoaOMR; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hWJITFkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244530AbiHHVoA (ORCPT + 99 others); Mon, 8 Aug 2022 17:44:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236856AbiHHVn4 (ORCPT ); Mon, 8 Aug 2022 17:43:56 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A05836369; Mon, 8 Aug 2022 14:43:54 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4E74B5C012B; Mon, 8 Aug 2022 17:43:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 08 Aug 2022 17:43:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1659995031; x=1660081431; bh=Noq7c0Nawz gYCdsg9ZW5dIqk4AKYo1HmGlvkyEbTt+c=; b=NzBoaOMR564b9o7V+HRo3/nIkd FFrKyQHi2J4r/hOcCnBif/E5rH35hfZdzTrDHzOiWNTndrciYHPflbX3rxT4otuq n+HfFq4qXXh5noZhRaYFley+ZtcEaH2oT9pkUl6Nx7IIC206rZoc48LxnRLM+JTH 0irsuf6BNMaVn7Cnx5MhRMwsIwjL+vqwKIAlWApIQVY8NTipKdpZKChVfEc4baYS atGXCzX2xNuQjx0yHqGZlaXpx92cp8i9xq0jY9dg/ZpVBlHU/EGVJ8JRyQ4WFgoo E44AaDSb5A3HMspYOlWQ1s3RhvzQvvZaGWjv77ALZSOhv8XruqTSVRh07TJw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1659995031; x=1660081431; bh=Noq7c0NawzgYCdsg9ZW5dIqk4AKY o1HmGlvkyEbTt+c=; b=hWJITFklnaX55cOl0D/padFTW6Q44xFfQcivdn+cnBVQ LzqDXvc91jS0IcXdppGr7dgDdClEYagzZ//Ep+cyNhGYG/j5XTPmApcEsMDC1WQz hQxso2BA3fnYBeXPo9lxn4nelFL0ioi2YCKDqEZAAlb50Xczwk2WXe9Nd43BFX5Q Ip4jgt5ROy+R2Zmrhu/UmkbBumKN+Mnf4YbrBrcEzbuVsnicEt3vN5BGn1TuXVth fMGvSC6s8Fm0b0MiFut+Va7oK1w91OzesVTOBeles1YmDva/hTxcFZjN+kYvioGi 1Vj6EYPmtpMcMkCTVEXa1nGL9ak66D0zNOxiDuGXIg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefledgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhuffvvefkjghfofggtgesthdtredtredtvdenucfhrhhomhepnfhukhgv ucflohhnvghsuceolhhukhgvsehljhhonhgvshdruggvvheqnecuggftrfgrthhtvghrnh epvddvgeeltdehfeeijefgveegfeeihfdtveetfeetudfhvedtfeeltefhteegledunecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhhukhgvse hljhhonhgvshdruggvvh X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 8 Aug 2022 17:43:46 -0400 (EDT) Date: Tue, 09 Aug 2022 09:43:32 +1200 From: Luke Jones Subject: Re: [PATCH v2 2/6] asus-wmi: Implement TUF laptop keyboard LED modes To: Andy Shevchenko Cc: Hans de Goede , Mark Gross , Platform Driver , Linux Kernel Mailing List Message-Id: In-Reply-To: References: <20220808030420.8633-1-luke@ljones.dev> <20220808030420.8633-3-luke@ljones.dev> X-Mailer: geary/40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, > >> + if (sscanf(buf, "%hhd %hhd %hhd", &save, &mode, &speed) != >> 3) >> + return -EINVAL; > > Same comment as per v1. > You wrote: > Usually we have three separate nodes for that, but they are kinda > hidden in one driver, so I don't care much. I think that is the wrong direction to take. Doing so would mean that every write to one of these values has to write-out to device. I don't know how long writes on an i2c device take, but on the USB connected versions they are 1ms, which means that to individually set colour, save, mode, speed (also direction and sometimes a 2nd colour on USB) adds up to 4-6ms - and I don't know what sort of impact that has in the kernel itself, but I do know that users expect there to be fancy effects available on par with Windows (like audio equalizer visuals on the RGB, something that is in progress in asusctl). Using multicolor LED class already breaks away from having a single packet write, but the gain in API scope was worth the compromise. Hopefully we can keep the single set of parameters here? Pavel suggested using triggers, I've yet to look at that, but will do so after finalising this. I suppose one alternative would be to store speed and mode as attributes, but not write out until the "save" node is written to? So this raises the question of: we can't read from device, and speed+mode must be saved in module for use with "save" now, should I then allow showing these values in a _show? On fresh boot they will be incorrect.. I'm going to go ahead and split those parameters in to individual nodes now anyway - it may help with later work using triggers. > ... > >> + asus->keyboard_rgb_mode.mode = mode < 12 && mode != 9 ? >> mode : 0x0a; > > Same comment as per v1. > I missed it sorry. Done now. > ... > >> + switch (speed) { >> + case 0: >> + asus->keyboard_rgb_mode.speed = 0xe1; >> + break; >> + case 1: >> + asus->keyboard_rgb_mode.speed = 0xeb; >> + break; >> + case 2: >> + asus->keyboard_rgb_mode.speed = 0xf5; >> + break; >> + default: >> + asus->keyboard_rgb_mode.speed = 0xeb; > > break; Done > >> + } > > ... > >> + > > A blank line is not needed here. Okay thanks, I'll go through previous patches and check this. Kind regards, Luke. >