From nobody Wed Oct 8 09:23:59 2025 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49E382586DA; Mon, 30 Jun 2025 10:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278798; cv=pass; b=E5S3rCMvdFgkLHbsMx88Pdqrn+jN8DGwbitJXs8chiRyoSZPVgv40N6CqzoZqy/P1puHM2xVXsR9br4mewYm+hhw3SAKBbpcxXy3ZiGWo/Z+9NYcFZKDpud7NrhSfy/gJxapgzSfPwHxwUSapEbOSa2n6j0sI2AF7qziZyi2xaA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278798; c=relaxed/simple; bh=ASq0tjpTaHDZM4PzpTdawhPcb7Wy65QFKCDV1OzNB0I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JKLIDb38y1dwgoJHYktaAeb8dVhD6v5OXVL2Wx9bWiEIPGqZAV//fHQJ5sSwRnwkSiFymw+vfzsbyWPXv5uGVK6M2mDrBDT+ChfMPSFk092OugxvpJo3VU3M3AJA3FdiMCbYbONyO5qorwF6gg1IH2L+9GDdLFzYVbVY1wv60UM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=f5CowVq/; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="f5CowVq/" ARC-Seal: i=1; a=rsa-sha256; t=1751278776; cv=none; d=zohomail.com; s=zohoarc; b=UenH2PSwuBcCB0VSc0tN7EZqkcRncrF0BlEgwCF+98x3a2QZvtPfHafdjPmS0npBh0rdxF2slFXtsonSe3J+xjU/ES0LuJtnViVuiU+ZraEeQQc4yfy8T1bavVqwtPyYCDsrajgLf/TjBUO0HEJBZ/KJNMaF/pCKc6O7WPJKicE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751278776; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=6PpIVd/iyvJzOX8nF42c2ZQhA/JbIIXEjxLRd183mMY=; b=T1ET82UWFUv5RWR6gcdxiXnuqnbJXS0i7ydKBYv4u2Yr8iPH1VYOd8CZwX4uzD2DXZzKFrnRckm6V1kjhk/eghCWfnhfN6RrQesArjh4O3uMcXMZJNGS7PFBjr2fD2rv05W6dUck4dZz1Z6ooSENh1YBR0NUyenfHzp/88rZbUM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1751278776; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=6PpIVd/iyvJzOX8nF42c2ZQhA/JbIIXEjxLRd183mMY=; b=f5CowVq/qV4oeWU9rr+BLMx+h7M6sWL+uKZOpIB+9YjpaaLW8Ye/kNtQn/YHEYSB AiiNmHxJHZ+VQgyqqJo6rn8SbQLwLn3LOAwcpo94KVcSruABG2tP9PIIsYdbAcTW1iK 4yWnAoFepGgA7zFkOlfSfXiek/wMfzQseQR/L+wA= Received: by mx.zohomail.com with SMTPS id 1751278774601621.415894842219; Mon, 30 Jun 2025 03:19:34 -0700 (PDT) From: Nicolas Frattaroli Date: Mon, 30 Jun 2025 12:19:24 +0200 Subject: [PATCH 1/4] dt-bindings: input: adc-keys: allow linux,input-type property 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250630-rock4d-audio-v1-1-0b3c8e8fda9c@collabora.com> References: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> In-Reply-To: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Belloni , Heiko Stuebner Cc: kernel@collabora.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Nicolas Frattaroli X-Mailer: b4 0.14.2 adc-keys, unlike gpio-keys, does not allow linux,input-type as a valid property. This makes it impossible to model devices that have ADC inputs that should generate switch events. Add the property to the binding with the same default as gpio-keys. Signed-off-by: Nicolas Frattaroli Reviewed-by: Heiko Stuebner --- Documentation/devicetree/bindings/input/adc-keys.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/input/adc-keys.yaml b/Docume= ntation/devicetree/bindings/input/adc-keys.yaml index 7aa078dead37816294732501e1983ab869f38311..e372ebc23d1651d73ef3749a56d= 54872067037b5 100644 --- a/Documentation/devicetree/bindings/input/adc-keys.yaml +++ b/Documentation/devicetree/bindings/input/adc-keys.yaml @@ -42,6 +42,9 @@ patternProperties: =20 linux,code: true =20 + linux,input-type: + default: 1 # EV_KEY + press-threshold-microvolt: description: Voltage above or equal to which this key is considered pressed. = No --=20 2.50.0 From nobody Wed Oct 8 09:23:59 2025 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D406259C85; Mon, 30 Jun 2025 10:19:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278801; cv=pass; b=rmpQVsX2vUFj/aG21tii7gwsd/wj9M0IOD5RBBM1tf/VUvNbvqTS1HUzuuy+qOjxE2wzKZ8eqetbn6ZtovBBqdxdLz7B6nfZWkRW2DVKYAzPHUZyQ23xhmyxsyPmsq+3LHOz4PUS5arPUlP908zoPHNiSVVmtyDZ1SFcbJDT41w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278801; c=relaxed/simple; bh=4eyvv0/2giuD4Q5COyMgr9Lxtd2J8gTHuQte5/vtILk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h0MAqK/XM3Ir498PcyXeB0ehWvFOnTu9RxHSUzRnsGHSxmdTQrhZ5Lg4RRoK7/v804odvgsc9eFHZVnHces3fSz8Tj1CB9D999T0uGyFGNxVHU1sPWWgnxbhQctAzZoU+oB6AVCoQuZXoKAZgZ1RKw2vjvHZDL/GzKLia3Djqy4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=QWENp+4+; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="QWENp+4+" ARC-Seal: i=1; a=rsa-sha256; t=1751278780; cv=none; d=zohomail.com; s=zohoarc; b=jROBuHf0xcyCm8EJp0YEPAO+1wuYvGA9BllRQAAUkju9dEqdDp+Y7iqHrhFGZ3tSTrirfTL9tkOUeJiaXHcahDeCqtDRU5Nw5b+POayxdC4em5heAPSG9Nc9HC27MHuzPtZLe5LLw7tnic5QeI4ehOQVXizfFO1Z49sJH+yU1Fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751278780; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=WFu69/QqOwnD97nGaVd7ct9S+S2KCBb9pcd5mzHtYXU=; b=IdPK/3CstqL1VXykLEs1XNKwqW+rvCR1HCXkFSecOUhJrInAs8oJr4Gpj0NJAag3/ia+vz4938QQfs/Uw6I7Bx8JTYs71GBsWNdgiae6b+WAGkjHGBPxiOhYnexT3hBUEA5uNeuwngNQSNeqDwof0Bm0r93aGKdR/+a3M+7GgUU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1751278780; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=WFu69/QqOwnD97nGaVd7ct9S+S2KCBb9pcd5mzHtYXU=; b=QWENp+4+IXgftLgYRZiqAOgSZ3OgoNfMGaioQ8KyiFl5u5OC9QYfICWpNR/acv0i rmmESTZ9QacXO9I717FwdAuaydQXLA9hW1rNZ40VlfhiXkmJUKV9R1S5bfFTOkfWJf6 Aah1b/NA168jbH/JCokQ0M5mrKmwhu03nhFYg1Po= Received: by mx.zohomail.com with SMTPS id 1751278778027201.13477834233447; Mon, 30 Jun 2025 03:19:38 -0700 (PDT) From: Nicolas Frattaroli Date: Mon, 30 Jun 2025 12:19:25 +0200 Subject: [PATCH 2/4] Input: adc-keys - support types that aren't just keyboard keys 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250630-rock4d-audio-v1-2-0b3c8e8fda9c@collabora.com> References: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> In-Reply-To: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Belloni , Heiko Stuebner Cc: kernel@collabora.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Nicolas Frattaroli X-Mailer: b4 0.14.2 Instead of doing something like what gpio-keys is doing, adc-keys hardcodes that all keycodes must be of type EV_KEY. This limits the usefulness of adc-keys, and overcomplicates the code with manual bit-setting logic. Instead, refactor the code to read the linux,input-type fwnode property, and get rid of the custom bit setting logic, replacing it with input_set_capability instead. input_report_key is replaced with input_event, which allows us to explicitly pass the type. Signed-off-by: Nicolas Frattaroli Reviewed-by: Heiko Stuebner --- drivers/input/keyboard/adc-keys.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/adc-keys.c b/drivers/input/keyboard/adc= -keys.c index f1753207429db02ce6510e5ec0da9b24d9edb61d..339dd4d4a0842108da2c6136b1e= 0098cd1f6a3cd 100644 --- a/drivers/input/keyboard/adc-keys.c +++ b/drivers/input/keyboard/adc-keys.c @@ -19,12 +19,14 @@ struct adc_keys_button { u32 voltage; u32 keycode; + u32 type; }; =20 struct adc_keys_state { struct iio_channel *channel; u32 num_keys; u32 last_key; + u32 last_type; u32 keyup_voltage; const struct adc_keys_button *map; }; @@ -35,6 +37,7 @@ static void adc_keys_poll(struct input_dev *input) int i, value, ret; u32 diff, closest =3D 0xffffffff; int keycode =3D 0; + u32 type =3D EV_KEY; =20 ret =3D iio_read_channel_processed(st->channel, &value); if (unlikely(ret < 0)) { @@ -46,6 +49,7 @@ static void adc_keys_poll(struct input_dev *input) if (diff < closest) { closest =3D diff; keycode =3D st->map[i].keycode; + type =3D st->map[i].type; } } } @@ -54,13 +58,14 @@ static void adc_keys_poll(struct input_dev *input) keycode =3D 0; =20 if (st->last_key && st->last_key !=3D keycode) - input_report_key(input, st->last_key, 0); + input_event(input, st->last_type, st->last_key, 0); =20 if (keycode) - input_report_key(input, keycode, 1); + input_event(input, type, keycode, 1); =20 input_sync(input); st->last_key =3D keycode; + st->last_type =3D type; } =20 static int adc_keys_load_keymap(struct device *dev, struct adc_keys_state = *st) @@ -93,6 +98,10 @@ static int adc_keys_load_keymap(struct device *dev, stru= ct adc_keys_state *st) return -EINVAL; } =20 + if (fwnode_property_read_u32(child, "linux,input-type", + &map[i].type)) + map[i].type =3D EV_KEY; + i++; } =20 @@ -156,9 +165,8 @@ static int adc_keys_probe(struct platform_device *pdev) input->id.product =3D 0x0001; input->id.version =3D 0x0100; =20 - __set_bit(EV_KEY, input->evbit); for (i =3D 0; i < st->num_keys; i++) - __set_bit(st->map[i].keycode, input->keybit); + input_set_capability(input, st->map[i].type, st->map[i].keycode); =20 if (device_property_read_bool(dev, "autorepeat")) __set_bit(EV_REP, input->evbit); --=20 2.50.0 From nobody Wed Oct 8 09:23:59 2025 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 555BC2580E7; Mon, 30 Jun 2025 10:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278806; cv=pass; b=BnHUUhpfo26VqdBJ3BNglmysesO0oNkazea2W2mJCguEhh/phwhhcrVLkLz7EiTub+RUChdw3bN0B0r3x687es8R76xojIWW/R75qS7Q8VDmTkAjplWbY9UWdK6kN2X3uBhQ/lvu+lFE/VraPrHxGkdctjeerJg5xh7+nmfne0U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278806; c=relaxed/simple; bh=GUq2T+Z+kmaJ2SmSYOaIAKce3jqNoG/q/U1F/7YkYgk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NtpTDo1oL5DfW6V9szIwPWY4EcKPuuobkii5QwlSNtD55fvQPnxFB/qFgwxm857T+Uu5fSlL/bA/PvZ5Zdp4yt4/NvceYn6F3IZiWwBNCzp/PVDotuND+Hbv7xObbbN0PbHWIZI09KfNqmAChc6Qzt18IGAExc6vzJ4V2yQSpb8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=biKSowR0; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="biKSowR0" ARC-Seal: i=1; a=rsa-sha256; t=1751278784; cv=none; d=zohomail.com; s=zohoarc; b=cnKWfeDr3EjYX52A+2jJFuq5YD7l6N4BuYsn7yK7ZQ/4ikBXKCpsFAJS1TDQlwBqxXipn/2bXefpOE5l6cIL5PffugsqVEr4w//+eF52rMwt/SLs+fPurJ3ldMGaYQJ+4tXCQFxoUsIFwYvywQE6VKySqW9rM0dv9haLtaaP73E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751278784; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=v5CW2bj+oVB/Xn4FH4bL2uotFhsK3zyngzq7FjyuLqM=; b=cXosbHCB31arcRcaDiFlLW/ifoL+6grSimTAvSfFPsXCUhVGN5h39I0WzXrRPAyHkeGnlBJSHNrEL95dOBdH4rHRUyAMOkANVbvdr8xaiBMdJ7slvod+U6GstmXIrLqLYca6s+CZ5xs9TzAIJyluZI+RVWfBJRSIcV2VmamVQxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1751278784; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=v5CW2bj+oVB/Xn4FH4bL2uotFhsK3zyngzq7FjyuLqM=; b=biKSowR0RyprTLbVslIZRkPh6fmjuOXMIgT7uYNM7WoPPGA5hxybQ7iLm1MAff63 qUdqmTN1bAJCQF/SRtOpwNtfj//Fi2E/t5CmMs+NOPWdvSAN8xNLW5mPv1nyPRdTCgV XJddyMnfYvUbY7Lpt2dc1iw3MWGdvQjZKmjUHd6I= Received: by mx.zohomail.com with SMTPS id 1751278781441383.500485393065; Mon, 30 Jun 2025 03:19:41 -0700 (PDT) From: Nicolas Frattaroli Date: Mon, 30 Jun 2025 12:19:26 +0200 Subject: [PATCH 3/4] arm64: dts: rockchip: add analog audio to ROCK 4D 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250630-rock4d-audio-v1-3-0b3c8e8fda9c@collabora.com> References: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> In-Reply-To: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Belloni , Heiko Stuebner Cc: kernel@collabora.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Nicolas Frattaroli X-Mailer: b4 0.14.2 The RADXA ROCK 4D, like many other Rockchip-based boards, uses an ES8388 analog audio codec. On the production version of the board, the codec's LOUT1 and ROUT1 pins are tied to the headphone jack, whereas pins LOUT2 and ROUT2 lead to a non-populated speaker amplifier that itself leads to a non-populated speaker jack. The schematic is still haunted by the ghosts of those symbols, but it clearly marks them as "NC". The 3.5mm TRRS jack has its microphone ring (and ground ring) wired to the codec's LINPUT1 and RINPUT1 pins for differential signalling. Furthermore, it uses the SoCs ADC to detect whether the inserted cable is of headphones (i.e., no microphone), or a headset (i.e., with microphone). The way this is done is that the ADC input taps the output of a 100K/100K resistor divider that divides the microphone ring pin that's pulled up to 3.3V. There is no ADC level difference between a completely empty jack and one with a set of headphones (i.e., ones that don't have a microphone) connected. Consequently headphone insertion detection isn't something that can be done. Add the necessary codec and audio card nodes. The non-populated parts, i.e. LOUT2 and ROUT2, are not modeled at all, as they are not present on the hardware. Also, add an adc-keys node for the headset detection, which uses an input type of EV_SW with the SW_MICROPHONE_INSERT keycode. Below the 220mV pressed voltage level of our SW_MICROPHONE_INSERT switch, we also define a button that emits a KEY_RESERVED code, which is there to model this part of the voltage range as not just being extra legroom for the button above it, but actually a state that is encountered in the real world, and should be recognised as a valid state for the ADC range to be in so that no "closer" ADC button is chosen. Signed-off-by: Nicolas Frattaroli Tested-by: Cristian Ciocaltea --- arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts | 90 +++++++++++++++++++++= ++++ 1 file changed, 90 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts b/arch/arm64/b= oot/dts/rockchip/rk3576-rock-4d.dts index 6756403111e704cad42f6674d5ab55eb0306f1e3..4d4b8ababd2436b82515443b029= 916b3c786dba1 100644 --- a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts +++ b/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts @@ -6,6 +6,7 @@ /dts-v1/; =20 #include +#include #include #include #include @@ -37,6 +38,31 @@ hdmi_con_in: endpoint { }; }; =20 + es8388_sound: es8388-sound { + compatible =3D "simple-audio-card"; + simple-audio-card,format =3D "i2s"; + simple-audio-card,mclk-fs =3D <256>; + simple-audio-card,name =3D "On-board Analog ES8388"; + simple-audio-card,widgets =3D "Microphone", "Headphone Mic", + "Headphone", "Headphone"; + simple-audio-card,routing =3D "Headphone", "LOUT1", + "Headphone", "ROUT1", + "Left PGA Mux", "Differential Mux", + "Differential Mux", "LINPUT1", + "Differential Mux", "RINPUT1", + "LINPUT1", "Headphone Mic", + "RINPUT1", "Headphone Mic"; + + simple-audio-card,cpu { + sound-dai =3D <&sai1>; + }; + + simple-audio-card,codec { + sound-dai =3D <&es8388>; + system-clock-frequency =3D <12288000>; + }; + }; + leds: leds { compatible =3D "gpio-leds"; pinctrl-names =3D "default"; @@ -57,6 +83,37 @@ user-led { }; }; =20 + saradc_keys: adc-keys { + compatible =3D "adc-keys"; + io-channels =3D <&saradc 3>; + io-channel-names =3D "buttons"; + keyup-threshold-microvolt =3D <3000000>; + poll-interval =3D <100>; + + /* + * During insertion and removal of a regular set of headphones, + * i.e. one without a microphone, the voltage level briefly + * dips below the 220mV of the headset connection switch. + * By having a button definition with a KEY_RESERVED signal + * between 0 to 220, we ensure no driver implementation thinks + * that the closest thing to 0V is 220mV so clearly there must + * be a headset connected. + */ + + button-headset-disconnected { + label =3D "Headset Microphone Disconnected"; + linux,code =3D ; + press-threshold-microvolt =3D <0>; + }; + + button-headset-connected { + label =3D "Headset Microphone Connected"; + linux,code =3D ; + linux,input-type =3D ; + press-threshold-microvolt =3D <220000>; + }; + }; + vcc_12v0_dcin: regulator-vcc-12v0-dcin { compatible =3D "regulator-fixed"; regulator-always-on; @@ -639,6 +696,25 @@ hym8563: rtc@51 { }; }; =20 +&i2c3 { + status =3D "okay"; + + es8388: audio-codec@10 { + compatible =3D "everest,es8388", "everest,es8328"; + reg =3D <0x10>; + clocks =3D <&cru CLK_SAI1_MCLKOUT_TO_IO>; + AVDD-supply =3D <&vcca_3v3_s0>; + DVDD-supply =3D <&vcc_3v3_s0>; + HPVDD-supply =3D <&vcca_3v3_s0>; + PVDD-supply =3D <&vcc_3v3_s0>; + assigned-clocks =3D <&cru CLK_SAI1_MCLKOUT_TO_IO>; + assigned-clock-rates =3D <12288000>; + #sound-dai-cells =3D <0>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sai1m0_mclk>; + }; +}; + &mdio0 { rgmii_phy0: ethernet-phy@1 { compatible =3D "ethernet-phy-ieee802.3-c22"; @@ -687,6 +763,20 @@ usb_host_pwren: usb-host-pwren { }; }; =20 +&sai1 { + pinctrl-names =3D "default"; + pinctrl-0 =3D <&sai1m0_lrck + &sai1m0_sclk + &sai1m0_sdi0 + &sai1m0_sdo0>; + status =3D "okay"; +}; + +&saradc { + vref-supply =3D <&vcca1v8_pldo2_s0>; + status =3D "okay"; +}; + &sdmmc { bus-width =3D <4>; cap-mmc-highspeed; --=20 2.50.0 From nobody Wed Oct 8 09:23:59 2025 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0380F25B2FD; Mon, 30 Jun 2025 10:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278809; cv=pass; b=KKGls9TR4S6IREmUXxywWs9DZvYkmZW7IttwdymI0ZmZr2I01cZL6v4YSVXCpmCJYSLJ23G8Syr/xpLoaouUGz5gZo7g5QPnBfp4jlbMv8mEfwvTJY8mdwq6+rC8sV6yDg0DFOn+BVdO55QPj2bqpJ3Ri3jLgtiqUQsi8mghucw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751278809; c=relaxed/simple; bh=5IKHBKNkvDIqPBpGJU+iUfBRQ0Xc7cnG5YynHtBb5a0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=us3ZFVP977znkRnI8LrtDZD0fpSNI8qW48XyN6G2V4MSMzEkCD9EOoFrgmVtwVQBaTqwytpPgmkcBGxYKuB2cU0aFSbUC8f2njDc6H1FjdS/c6MS1DAVTNIFYKMLt1Avk9s/KLAqM+8OBuJlCONtisonro+M11Acp0H7E+ElcYI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b=V646PLmc; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="V646PLmc" ARC-Seal: i=1; a=rsa-sha256; t=1751278786; cv=none; d=zohomail.com; s=zohoarc; b=R+XsFmJlOH88IPsfmTD8tDk8RlbfWYQS8CSLDpRd2LvIOpVOD7Dm3hDLgBinQLA4CNNc/G14bapI+9XdK1FGzEVMudSq9Ca0i6dOp2TyhoFyvLOx1cvb35uuuDX9r/zqyCaD5qe2oXal61UvDlH431rTVsDiA5wnv3udMAY0u3g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751278786; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=DVGNQK3ovA1eStReJPPWHDBj+E6PFN3lZlWCymwT7kA=; b=gg4y2DBoW9TKvUNNXly/AJWjkkICsOzIuY2Evbzn6psahfRaXgkvcS6L+f+55zBA3YCwKzLXmM8DmMKZ2R5digvIejp3mGJQWGLaKyaa/MZx+lyQ/Ulh3zerGqe2wBa9jzvTMy+yc0l5SW3fIXcbsHVKHdZ89Cb+FsAbyjvKnSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1751278786; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=DVGNQK3ovA1eStReJPPWHDBj+E6PFN3lZlWCymwT7kA=; b=V646PLmcVVU+4vqXaywt467wXSxznevX+2nnj9Y+ClnwXT/t3J07FZRwilpzrx9s l9KyRR4S+bKU1DIPh6e7jWhiiz4S6cQ1CLvrk8XsHXS6n5bRJdT1sSo6cTeC+AnkHsk 3rI/iK9O30eumSFoaJiaZjZyPIZx4LExc/BzICyw= Received: by mx.zohomail.com with SMTPS id 1751278785189692.9528694352027; Mon, 30 Jun 2025 03:19:45 -0700 (PDT) From: Nicolas Frattaroli Date: Mon, 30 Jun 2025 12:19:27 +0200 Subject: [PATCH 4/4] arm64: dts: rockchip: add HDMI audio on ROCK 4D 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250630-rock4d-audio-v1-4-0b3c8e8fda9c@collabora.com> References: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> In-Reply-To: <20250630-rock4d-audio-v1-0-0b3c8e8fda9c@collabora.com> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexandre Belloni , Heiko Stuebner Cc: kernel@collabora.com, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Nicolas Frattaroli X-Mailer: b4 0.14.2 Much like the Sige5, the ROCK 4D also has an HDMI port, so is capable of providing HDMI audio output as well. Enable the SoC's hdmi_sound card, and also enable the SoC audio controller (sai6) that feeds into it. Signed-off-by: Nicolas Frattaroli Tested-by: Cristian Ciocaltea --- arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts b/arch/arm64/b= oot/dts/rockchip/rk3576-rock-4d.dts index 4d4b8ababd2436b82515443b029916b3c786dba1..70bc6f909ec0843607c2705ee9f= 73b0ba521a977 100644 --- a/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts +++ b/arch/arm64/boot/dts/rockchip/rk3576-rock-4d.dts @@ -322,6 +322,10 @@ hdmi_out_con: endpoint { }; }; =20 +&hdmi_sound { + status =3D "okay"; +}; + &hdptxphy { status =3D "okay"; }; @@ -772,6 +776,10 @@ &sai1m0_sdi0 status =3D "okay"; }; =20 +&sai6 { + status =3D "okay"; +}; + &saradc { vref-supply =3D <&vcca1v8_pldo2_s0>; status =3D "okay"; --=20 2.50.0