From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f175.google.com (mail-dy1-f175.google.com [74.125.82.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 BCAF254758 for ; Mon, 23 Feb 2026 03:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771818464; cv=none; b=OeaoRddTVLdq5MF5By5HcLAVvSm7COogODMgCzSAmlThtFfKANi92W8ClQeDUN4oU3DT/Pm0ZpPVSGKd/mc/hcYd+0yW1JWelAoxxuJLDjk3TWkOXP0u6RjInZBsye77dcMlLUichUXkm8k/wJtIu8F47gYUWSC3feM6R1FTwM8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771818464; c=relaxed/simple; bh=qyezi+5oRt5fdZzUTR89voTedv8Cri4rLMYuSwn4zhU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a2RzeJAYQy+/nT8xYwb/hgIe7lewPwBIuI8ZeJQhHsVqiY2J/5zn/4cNIEfWR1vEa7Y2by7//SlqtFqFwQxbXxDSb5EbC3zNf0+Z4P+BxTUZpOOJGLtthpx0bZBaaeDtSsZvV06JnLCFgu2B6RDCe1R3giYMIOxHBGBsVx/rwuA= 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=Mh7aM00d; arc=none smtp.client-ip=74.125.82.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="Mh7aM00d" Received: by mail-dy1-f175.google.com with SMTP id 5a478bee46e88-2ba68df3687so5973506eec.1 for ; Sun, 22 Feb 2026 19:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771818462; x=1772423262; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=be26L28JegJQaN5VnjZu90EYCa/zt+aS/UGDpDvVaps=; b=Mh7aM00de/iJ6otCA5Pz8XuRLL0S/1rUw5UorY3Sz37b5pRKynO2WbHSZ6zjA4uG6B xJXKD2PliM6FQniogoN3c4MXXKz9KGl4kcn9JAi3+tth9eAWAs0YFMLgVPAzAEhrtJ8y cuzL/7L7hFMD7yejTGQ88VGK0azXNfbWNwOmS1Qm0N0iSTDdMqjWO63aS9MSyms55UGH Ddw9t8LVEm0a85wEZClSKwbqWv1NlELCKaFlHcVDqalJQSll50dojPcSL4PuwVbgHdwe 5cKjaTicFJw9BSNO8pwT2bil0rwegL7uY3YrScvYxCXeb58fbUry11GOv0xzdLrKywkm KBDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771818462; x=1772423262; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=be26L28JegJQaN5VnjZu90EYCa/zt+aS/UGDpDvVaps=; b=Jyj3Kq7laiKmVGvvPc5MFZ9w0fyONzZmYZ9USKoDodpkm/JO9MCCsWlYgoob5X14FZ vGLre4u8SqMTWFxaCiZtff/EeVik7u+Cei1xIDfVCF+I1/Uor3I9t88O3HxJxIM96a/P tREEF2Ljh1Ryip9XC32DljxM9JeJftiE1O6FzKiejOk8FbjSmug4Av4ItZ1IUEWeyPlC d/VzqtUtbb5zv269aL/M4QKup/DJc97KhukpYy6z0vfk6TVSHcxKxsBPqUOu4WIymNfR 80L27ay339go+Ue+eI8Sd96MlD6+Y3iWqa0JzUtuMxPIvUmyoX/SsyFtkqkIQDPCQVi4 4ABw== X-Forwarded-Encrypted: i=1; AJvYcCVyJZOZEqj9P3oLfwP9M9OixXkuIiD6i3Yv0CWwozC+TajlDEUYW9GhkgXPmHYuEcKEjUEU37JTlWq81jo=@vger.kernel.org X-Gm-Message-State: AOJu0YxZCAfanuxeMine2ZfkhTdFpPnz/Pt09hCsOGVOZYm5eWguJt/l CMfdKiTCzW2ZZalILKqprxbhgPZs7rlvDRsZyozggBF0GrMxXmimfK0X X-Gm-Gg: ATEYQzxvUUn7QZbOxg9M4bikWkqNp6cltygFlZ2ikV/TnOSK8pKlg/U4C+gB6wMq9UV 7timduT3HcLq2EkOVZNXr2+QNPUnD0L6mhCpurZmnmMJOMjxsEvO+5mGQMowNrPQ6E3Gyu/VW6n jcGrUkJDHKVlT2lC3nKHLipHrq/eClq+i9o77x7SwaAkgPRLSSXHXms28HTTFOBmWKBldbeE31V byxqx2Jv6PGLcbL/0zT3JGfBDUYPQLni3e1JMWha6a6NO4uZA419l8NS9b0RxqNChsoBs3N6snr axvBMQno16fXeDpGClGxyAwTISBdd1mmO9r4LgGZfVmQkOckaJ31Hciwj7PiLzDoqYNNzaOy8L1 dvn1lUwSwiEza7VLD170L6olX5fRhoB/3gS3aUchO9aN6vPdnYC3s7W3cc+dnQqMLJeU91UwXRT ahEtujCWdS5v5KsBrTSjdxc6LEEOz7moMQmpTJzZKyAAXuY3/HSp0c6Uk+Ia8K3ZSUoCRSKXcfU g== X-Received: by 2002:a05:7300:324c:b0:2b8:64ad:ad4e with SMTP id 5a478bee46e88-2bd7bd5a2d3mr3270113eec.24.1771818461734; Sun, 22 Feb 2026 19:47:41 -0800 (PST) Received: from google.com ([2a00:79e0:2ebe:8:c6c:6cca:170e:c77b]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2bd7dbe78b9sm4075021eec.18.2026.02.22.19.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Feb 2026 19:47:41 -0800 (PST) Date: Sun, 22 Feb 2026 19:47:38 -0800 From: Dmitry Torokhov To: Tzung-Bi Shih Cc: Fabio Baltieri , Benson Leung , Guenter Roeck , Simon Glass , linux-input@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/7] Input: cros_ec_keyb - add function key support Message-ID: References: <20260222003717.471977-1-dmitry.torokhov@gmail.com> <20260222003717.471977-2-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sun, Feb 22, 2026 at 06:46:53PM +0800, Tzung-Bi Shih wrote: > On Sat, Feb 21, 2026 at 04:37:10PM -0800, Dmitry Torokhov wrote: > > From: Fabio Baltieri > > > > Add support for handling an Fn button and sending separate keycodes for > > a subset of keys in the matrix defined in the upper half of the keymap. > > > > Signed-off-by: Fabio Baltieri > > Reviewed-by: Simon Glass > > Link: https://patch.msgid.link/20260211173421.1206478-3-fabiobaltieri@chromium.org > > Signed-off-by: Dmitry Torokhov > > The patch looks good to me, just a few minor nits below. I don't insist on > these being fixed for this patch to be merged, > > Reviewed-by: Tzung-Bi Shih Thanks Tzung-Bi. > > > +static void cros_ec_keyb_process_key_fn_map(struct cros_ec_keyb *ckdev, > > + int row, int col, bool state) > > +{ > > + struct input_dev *idev = ckdev->idev; > > + const unsigned short *keycodes = idev->keycode; > > + unsigned int pos, fn_pos; > > + unsigned int code, fn_code; > > Nit: does declaring `code` and `fn_code` as unsigned short make more sense? > Or they can be declared in the same line. I do not think making temporary variables unsigned short changes anything, so I will leave it as is. > > > + > > + pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift); > > + code = keycodes[pos]; > > + > > + if (code == KEY_FN) { > > + ckdev->fn_active = state; > > + if (state) { > > + ckdev->fn_combo_active = false; > > + } else if (!ckdev->fn_combo_active) { > > + /* > > + * Send both Fn press and release events if nothing > > + * else has been pressed together with Fn. > > + */ > > + cros_ec_emit_fn_key(idev, pos); > > + } > > + return; > > + } > > + > > + fn_pos = MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift); > > + fn_code = keycodes[fn_pos]; > > + > > + if (state) { > > + if (ckdev->fn_active) { > > + ckdev->fn_combo_active = true; > > + if (!fn_code) > > + return; /* Discard if no Fn mapping exists */ > > + > > + code = fn_code; > > + pos = fn_pos; > > Nit: assigning `pos` before `code` makes it neater. > > > + } > > + } else { > > + /* > > + * If the Fn-remapped code is currently pressed, release it. > > + * Otherwise, release the standard code (if it was pressed). > > + */ > > + if (fn_code && test_bit(fn_code, idev->key)) { > > + code = fn_code; > > + pos = fn_pos; > > Nit: same here. Yep, I'll update before applying. Thanks. -- Dmitry