From nobody Mon Feb 9 08:41:30 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 9314C34BA49 for ; Wed, 24 Dec 2025 15:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766589768; cv=none; b=fiIDybEJyvKLBubECJeLbQivrInCeLvfTNSQZqP5ip6jh+Va9ADK5d4H0xp9JrMe+Q6EmEoEs6FzH12S8u3DxRl36D322DhPhI6X03V9kafKdrxv4FlrRSl0vmxmqJa05oEcPnaLyJAcvwrpFvr/SP0WYRd+JWxZsFLI8vzgjac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766589768; c=relaxed/simple; bh=WTyMTbSMQzIIk8c/zE5eemB8w2d2eo13RjTPG4hAHpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M6lMJmrrKJ9lYxXX4jakhyv6zWVjCFtfEUd4RCJf0Sjh6f/DHoI7W2L+xCn4B9/2Ir0WrdyZWLRrUNCrMFS8Jb32Nc8E966gBg4rB7c5DsyMKzVwmX1r37nJ7BWvB7udekWN+RhhbWLFoCAHpRGNY7hAPyHyuvmGotkdxrDbd8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=GEdZVv1f; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GEdZVv1f" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-477a219dbcaso49794855e9.3 for ; Wed, 24 Dec 2025 07:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1766589762; x=1767194562; 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=RyefeZtkA984opS3wh2QxIpFCcn7cjIx25blSwfv61M=; b=GEdZVv1fdfi/2iNqG+uDZQPR9AZ4aK4I+k7vgenlWv9dS2ekqYPTjmaiTbLfqU/fTc DM+CAw0y1o/OGBq+hoAxGsHo48IKINeRu2JiZ7F0ayFJ+ZIDvibPdfwX9nr3H+q6FoUa Cs1jHO2AWvwTsUYfJsn6WgMBGi6iG49MCYJSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766589762; x=1767194562; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=RyefeZtkA984opS3wh2QxIpFCcn7cjIx25blSwfv61M=; b=ae6DR5ld8Hwv0SM+3Dom5crIFIfmUOJo3GT5R005cmZ0IQdLH9NTJl5OeVB0G2X9g7 j+6ThaXyRnXOtydiqRyAwm08Yunue3Bm67XFD7nwPZcrC/QQN2KJgMyGiYbR+QnKpRXm otdX1DNixYNrZfyrBeKWcnLZYwVS75vNymbOvOWv6SWUbHobOGRQaF0eqbJbxEcNFOhI jlFbVbOvLWKL7xFVK78gDAeBSsWkt0owgT4VrD5kIFlkFDg0R0zJLrNFo/nIomEtuTK7 4XGNYNkGDCNu+E9NmFqw3T6Ad5hboVBJVIcJHaAPDBKa3pNWNoEen93nqTgkoCtLRwRJ 5R5Q== X-Forwarded-Encrypted: i=1; AJvYcCXPyjSBr+3khdy4hulv2mLd22nAgAkxBQRIOVvrCD6Gl8qfQV5tB18KGrhmRBQ1AYNKXD0pIPZB5Moc9D0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7daVV435oqPEERGAkyYx2tnumjSg8ut9/p0bDIOo9t0XKWBu+ JvDc55qUIG9zDW2uaiijz8aDo5N04e7RnoiAU6V+/LsNly2pMm3cB/nIjXokj/A3fg== X-Gm-Gg: AY/fxX5WO+FzPwdSsoNZ1mepIqJxeZo/YH8kSXWot6bta9wns/XLXNGhQf8aCh4BNYC FfDCMqg8fj2Rpc1wu69m5tz++jHdA4JPC1GS0JYa93Z4BFaW18x4XW+kJk0phCqO6iDJCfXLlk5 I/1+UFtVcR/4YD+ffxFcb/LcVSP3CLqkgt4+mdCJDGPhKKsJ9QtM9i5iEBKxoI4yaCUa+LHwNJQ K0JOn1+4dDFEv1Xyxa8IYOLmIY/hAThleul7G+UFMre84I1722kTFKFFGhk9RdT84f3GW1sEAoQ 3rXxZ4WxT4G5Q/k2NQBaMfntCmJtzCJArPtYo2b5FJWLFSuMXkfFCTm2Hc2RqLaYhd2mFLBIh5R gJwc7ilO36KXB59cac2ofxRvBQGkfOXuyJrlmSzTYbOLMJSab10IfB/T8SZ1vKh/+BdBwsrjule 9Z/zvAzFzPmYTff6M= X-Google-Smtp-Source: AGHT+IEzhtmx7B/YgjG7IPSjUb5Fjb72PWnzr64AjzD+3FsHwgw5UML4dhc5sj7PIJMUpUGd5SDRTw== X-Received: by 2002:a05:6000:2386:b0:431:1ae:a3ca with SMTP id ffacd0b85a97d-4324e4c1207mr21162355f8f.11.1766589762212; Wed, 24 Dec 2025 07:22:42 -0800 (PST) Received: from balto-ws ([37.228.206.31]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324e9ba877sm34307363f8f.0.2025.12.24.07.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 07:22:41 -0800 (PST) From: Fabio Baltieri To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Benson Leung , Guenter Roeck Cc: Fabio Baltieri , Tzung-Bi Shih , Simon Glass , linux-input@vger.kernel.org, devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] Input: cros_ec_keyb - add function key support Date: Wed, 24 Dec 2025 15:22:37 +0000 Message-ID: <20251224152238.485415-2-fabiobaltieri@chromium.org> X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog In-Reply-To: <20251224152238.485415-1-fabiobaltieri@chromium.org> References: <20251224152238.485415-1-fabiobaltieri@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- drivers/input/keyboard/cros_ec_keyb.c | 120 ++++++++++++++++++++++---- 1 file changed, 104 insertions(+), 16 deletions(-) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard= /cros_ec_keyb.c index 1c6b0461dc35..8b95b4f8a37d 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -29,6 +29,11 @@ =20 #include =20 +/* Maximum size of the normal key matrix, this is limited by the host comm= and + * key_matrix field defined in ec_response_get_next_data_v3 + */ +#define CROS_EC_KEYBOARD_COLS_MAX 18 + /** * struct cros_ec_keyb - Structure representing EC keyboard device * @@ -44,6 +49,11 @@ * @bs_idev: The input device for non-matrix buttons and switches (or NULL= ). * @notifier: interrupt event notifier for transport devices * @vdata: vivaldi function row data + * @use_fn_overlay: whether the driver use an fn function overlay + * @normal_key_status: active normal keys map + * @fn_key_status: active function keys map + * @fn_key_pressed: tracks the function key status + * @fn_key_triggered: tracks where any function key fired */ struct cros_ec_keyb { unsigned int rows; @@ -61,6 +71,12 @@ struct cros_ec_keyb { struct notifier_block notifier; =20 struct vivaldi_data vdata; + + bool use_fn_overlay; + u8 normal_key_status[CROS_EC_KEYBOARD_COLS_MAX]; + u8 fn_key_status[CROS_EC_KEYBOARD_COLS_MAX]; + bool fn_key_pressed; + bool fn_key_triggered; }; =20 /** @@ -166,16 +182,83 @@ static bool cros_ec_keyb_has_ghosting(struct cros_ec_= keyb *ckdev, uint8_t *buf) return false; } =20 +static void cros_ec_keyb_process_fn_key(struct cros_ec_keyb *ckdev, + int row, int col, bool state) +{ + struct input_dev *idev =3D ckdev->idev; + int pos =3D MATRIX_SCAN_CODE(row, col, ckdev->row_shift); + + ckdev->fn_key_pressed =3D state; + + if (state) { + ckdev->fn_key_triggered =3D false; + } else if (!ckdev->fn_key_triggered) { + /* + * Send the original code if nothing else has been pressed + * together with Fn. + */ + input_event(idev, EV_MSC, MSC_SCAN, pos); + input_report_key(idev, KEY_FN, true); + input_sync(idev); + + input_event(idev, EV_MSC, MSC_SCAN, pos); + input_report_key(idev, KEY_FN, false); + } +} + +static void cros_ec_keyb_process_one(struct cros_ec_keyb *ckdev, + int row, int col, bool state) +{ + struct input_dev *idev =3D ckdev->idev; + const unsigned short *keycodes =3D idev->keycode; + int pos =3D MATRIX_SCAN_CODE(row, col, ckdev->row_shift); + unsigned int code =3D keycodes[pos]; + + dev_dbg(ckdev->dev, "changed: [r%d c%d]: byte %02x\n", row, col, state); + + if (ckdev->use_fn_overlay) { + if (code =3D=3D KEY_FN) + return cros_ec_keyb_process_fn_key(ckdev, row, col, state); + + if (!state) { + if (ckdev->fn_key_status[col] & BIT(row)) { + pos =3D MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift); + code =3D keycodes[pos]; + + ckdev->fn_key_status[col] &=3D ~BIT(row); + } else if (ckdev->normal_key_status[col] & BIT(row)) { + ckdev->normal_key_status[col] &=3D ~BIT(row); + } else { + /* Discard, key press code was not sent */ + return; + } + } else if (ckdev->fn_key_pressed) { + pos =3D MATRIX_SCAN_CODE(row + ckdev->rows, col, ckdev->row_shift); + code =3D keycodes[pos]; + + ckdev->fn_key_triggered =3D true; + + if (!code) + return; + + ckdev->fn_key_status[col] |=3D BIT(row); + } else { + ckdev->normal_key_status[col] |=3D BIT(row); + } + } + + input_event(idev, EV_MSC, MSC_SCAN, pos); + input_report_key(idev, code, state); +} =20 /* * Compares the new keyboard state to the old one and produces key - * press/release events accordingly. The keyboard state is 13 bytes (one = byte - * per column) + * press/release events accordingly. The keyboard state is one byte + * per column. */ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev, uint8_t *kb_state, int len) { - struct input_dev *idev =3D ckdev->idev; int col, row; int new_state; int old_state; @@ -192,20 +275,13 @@ static void cros_ec_keyb_process(struct cros_ec_keyb = *ckdev, =20 for (col =3D 0; col < ckdev->cols; col++) { for (row =3D 0; row < ckdev->rows; row++) { - int pos =3D MATRIX_SCAN_CODE(row, col, ckdev->row_shift); - const unsigned short *keycodes =3D idev->keycode; - new_state =3D kb_state[col] & (1 << row); old_state =3D ckdev->old_kb_state[col] & (1 << row); - if (new_state !=3D old_state) { - dev_dbg(ckdev->dev, - "changed: [r%d c%d]: byte %02x\n", - row, col, new_state); - - input_event(idev, EV_MSC, MSC_SCAN, pos); - input_report_key(idev, keycodes[pos], - new_state); - } + + if (new_state =3D=3D old_state) + continue; + + cros_ec_keyb_process_one(ckdev, row, col, new_state); } ckdev->old_kb_state[col] =3D kb_state[col]; } @@ -597,12 +673,19 @@ static int cros_ec_keyb_register_matrix(struct cros_e= c_keyb *ckdev) struct device *dev =3D ckdev->dev; struct input_dev *idev; const char *phys; + unsigned int rows_keymap; int err; =20 err =3D matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols); if (err) return err; =20 + if (ckdev->cols > CROS_EC_KEYBOARD_COLS_MAX) { + dev_err(dev, "keypad,num-columns too large: %d (max: %d)\n", + ckdev->cols, CROS_EC_KEYBOARD_COLS_MAX); + return -EINVAL; + } + ckdev->valid_keys =3D devm_kzalloc(dev, ckdev->cols, GFP_KERNEL); if (!ckdev->valid_keys) return -ENOMEM; @@ -635,7 +718,12 @@ static int cros_ec_keyb_register_matrix(struct cros_ec= _keyb *ckdev) ckdev->ghost_filter =3D device_property_read_bool(dev, "google,needs-ghost-filter"); =20 - err =3D matrix_keypad_build_keymap(NULL, NULL, ckdev->rows, ckdev->cols, + ckdev->use_fn_overlay =3D device_property_read_bool(dev, + "google,use-fn-overlay"); + + rows_keymap =3D ckdev->use_fn_overlay ? ckdev->rows * 2 : ckdev->rows; + + err =3D matrix_keypad_build_keymap(NULL, NULL, rows_keymap, ckdev->cols, NULL, idev); if (err) { dev_err(dev, "cannot build key matrix\n"); --=20 2.52.0.351.gbe84eed79e-goog From nobody Mon Feb 9 08:41:30 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 7E39934C988 for ; Wed, 24 Dec 2025 15:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766589771; cv=none; b=Cmno6846F7YtOkC1wK2sRZRKiZcLA+6quUGYdu4Zc87zKPTdzORJn+6uiVa4bkBzqdyPq90miHxbr9jnh1jG/PhiRilB83rK1FtFL2vbQGq3aFgzJU+P0A9O8Up8nbpzIVd91mfyy4hNl6WCed4jGQ2Vu9GuOGRCt7d1r+M0u1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766589771; c=relaxed/simple; bh=E76HtQ/wOlk/iTdKNvwcIKzGwEJiphG6wBguNie0bF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LhVXGYhZg1IDH/xb8q+gQlZxtdFqxEOkUbF7HKQwW69xQ9RmVtNVSMPsnwJPGEkjbpa752a9FtR0Gps4fOPdC5o9zC0QrmAYcHV6QvGjcu/CJJiIkPorvJadm/h/QwMOfGKP6kvSE/Zxu0I93sGWhkcQWv0ADpS2cjzcI5MqlxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=kT0VxBN2; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kT0VxBN2" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-42fb03c3cf2so3163093f8f.1 for ; Wed, 24 Dec 2025 07:22:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1766589763; x=1767194563; 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=broTySSYLTvfYQKOi4uFtvxxGHeRyXiGXlc1qJUuO3A=; b=kT0VxBN26z8X7X52pg/GlagL459ncI1WlyfiSnSCrOFlFky2GxHeGYxHbb7C9NhoyK 1i5uPjfg5hFSUzClqefPPWXeUb7BAISPWIs6M8s/NEUu3bQv1Af9Gu/QI5uw/iTqB7TY 3gPhYp8njMjC/UQ+n52XvnLx6qPgi+OD3Kfws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766589763; x=1767194563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=broTySSYLTvfYQKOi4uFtvxxGHeRyXiGXlc1qJUuO3A=; b=oW2EowBLRmY7nNswH9qd4sjrS62SOWAW0GMa4lkhhAjlhjuXXJoV3RlMWeHa8mV7Ys lSjuOC9N8uiQvuXlVzftTciegjnu2JLlFVtMFOfr8BROHMfIgO2HDlZ9QWtFGYinScpo 2dblQMVaxxz6V9xQVVgseZQnqZTxiehYWvTkttV5ZEqrFnuF+FhUqV0sYVqrgK9dpWls AWJC7QVr/G8A+j1wJ/PCWAeXk5kL5xfxF7V5FeQqTm0ZNY48sS85zu41djgmab4GRXrd suUk+t+dH819z7DtcCGoO4WJ2CCMPKrmA0ERsUnYjFeRJDNHBLHVvuu/TR6sQiFu4Ros /l6Q== X-Forwarded-Encrypted: i=1; AJvYcCUP45erWZHqSy/daIM2TX1+iKptGu2F6uC79o4wE+K4RXH5XYouAVSF9VJ2iy9PuwM6M6vAUUVHV5A/IxM=@vger.kernel.org X-Gm-Message-State: AOJu0YxabqbV6FtR06XJB1ZwW+OQGpqezfiCMyh/3og8/7WdlQ/S19gF if3VvL7qToXoUkl6oQkqrqCuJoe2ZUyU86AwK0oTAcNWwHlT/c0woosuNLB9+zWC4Q== X-Gm-Gg: AY/fxX4BINsnQAJ6x7NJJamxxDEeNDmtg4EO/P5WnI0fs3Kk14K9Zb9VFWjWgOO+/5u SgFPrNnHYcMOB2cTg5SQvbdt7qqEZXKHlzU8sJ3UdZ7w9nU90Z6KUfNhOIrphHgBcUA2a82GLEe rJglW8Sx1uqNOxrQ2vsBAKqmfPFKNZwLnKzPnqlaASWMbuc+MR4GVtQyMzo2QsGrjjqDGYuQJGv wgM2+Ptmfa43vmRZOZocS+HFbP/kimUARVvpL0PqU8hxQixa35+mNJA4vKY4xMTpnGQ+IZ8HAcz mr95lkoREnL3jIEGbKbf0GxD7ykhmZhoLrxipq44m0/7dZFLouz9zyDmjpSzX/VPtezRURGCzOw uvzu66qXaAVFB07TgdaaC2Vn+W9cON0upk3arpP5WnmgaR92nd2gkwNMNzMXqaQ1xdrr5Ffyfx6 4Bx7SxFcbb/xqf760= X-Google-Smtp-Source: AGHT+IHB446KR9bbT+6fe4P8dhCXUz9efTM0RI8RQnUg/3RKKGMv4Zs6DxHZ83wur1VVBkRdUAUQzA== X-Received: by 2002:a05:6000:2586:b0:431:84:357 with SMTP id ffacd0b85a97d-4324e4fb143mr21280148f8f.29.1766589763244; Wed, 24 Dec 2025 07:22:43 -0800 (PST) Received: from balto-ws ([37.228.206.31]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324e9ba877sm34307363f8f.0.2025.12.24.07.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Dec 2025 07:22:42 -0800 (PST) From: Fabio Baltieri To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Benson Leung , Guenter Roeck Cc: Fabio Baltieri , Tzung-Bi Shih , Simon Glass , linux-input@vger.kernel.org, devicetree@vger.kernel.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] dt-bindings: google,cros-ec-keyb: add use-fn-overlay prop Date: Wed, 24 Dec 2025 15:22:38 +0000 Message-ID: <20251224152238.485415-3-fabiobaltieri@chromium.org> X-Mailer: git-send-email 2.52.0.351.gbe84eed79e-goog In-Reply-To: <20251224152238.485415-1-fabiobaltieri@chromium.org> References: <20251224152238.485415-1-fabiobaltieri@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add binding documentation for the use-fn-overlay property. Signed-off-by: Fabio Baltieri --- .../bindings/input/google,cros-ec-keyb.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.ya= ml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml index fefaaf46a240..437575cdf352 100644 --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml @@ -44,6 +44,14 @@ properties: where the lower 16 bits are reserved. This property is specified only when the keyboard has a custom design for the top row keys. =20 + google,use-fn-overlay: + description: | + Use a function key overlay. This allows defining an extra set of cod= es + that are sent if a key is pressed while the KEY_FN is held pressed as + well. The function codes have to be defined in the linux,keymap prop= erty + with an offset of keypad,num-rows from the normal ones. + type: boolean + dependencies: function-row-physmap: [ 'linux,keymap' ] google,needs-ghost-filter: [ 'linux,keymap' ] @@ -132,6 +140,23 @@ examples: /* UP LEFT */ 0x070b0067 0x070c0069>; }; + - | + /* With function keys */ + #include + keyboard-controller { + compatible =3D "google,cros-ec-keyb"; + keypad,num-rows =3D <8>; + keypad,num-columns =3D <18>; + google,use-fn-overlay; + linux,keymap =3D < + MATRIX_KEY(0x00, 0x00, KEY_FN) + MATRIX_KEY(0x01, 0x00, KEY_1) + MATRIX_KEY(0x02, 0x00, KEY_2) + + MATRIX_KEY(8 + 0x01, 0x00, KEY_F1) + MATRIX_KEY(8 + 0x02, 0x00, KEY_F2) + >; + }; - | /* No matrix keyboard, just buttons/switches */ keyboard-controller { --=20 2.52.0.351.gbe84eed79e-goog