From nobody Mon Feb 9 13:36:53 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 D8EDF423A8A for ; Thu, 5 Feb 2026 15:44:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770306251; cv=none; b=eTtl3Enpp/Uk8DJQZiY+MQrsKbAfQW1WEGTo1ZwO2IYmCjSI6wDd1gQ3nmYifJR/I1HwE9HwQ0KZwx1xMJUPs5UdrwnYSiOrjyuRnd4cFAK43fLYmirsnD5g6igLXohHeLUV3X2TLGarjKTXOyZM36qPzaWJ8uJL9EZmTWKOlus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770306251; c=relaxed/simple; bh=beJbh9Q51hftX3sFzrLlw65qA1wbptRaJa7R+UbWVuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AZ1PRKeysxDYjnD8ByZBNhc7U3LKbViqhJqaUJPc7s2gvPgYkilZAJnMxDnai5asOYEyz0a+DW8BmAVSoNIlV6kPml0IRuziXzKEIdE/jYXI2LX6AImQtz2Ux2GJOo3XPUbIcXDqg5WQOY7UY6Cf/4vmBen1qwAItGFIxweizck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SWp3o/yy; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SWp3o/yy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770306249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iUIU87dxavbL2UbuwPOctpcR60YHm3cGpL66RI9YjQs=; b=SWp3o/yyh4tnKx1ltP5tK6/tK3m2zNrw8WH0Yknq9mYD9EftC6r7AQC0i0M/YkOfkZrxoD 4RlGXqyXMScBP1wlfJIE/xsO4H5OJZuVSjKsG57TXdR/bpdxGz4b8cnivg9jAENax+VAbl wW3IxVcPo/Wr2zV6VhQUJj5qeJZMI8k= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-84-wS1-gwcLMwaB8eP9VknEig-1; Thu, 05 Feb 2026 10:44:08 -0500 X-MC-Unique: wS1-gwcLMwaB8eP9VknEig-1 X-Mimecast-MFC-AGG-ID: wS1-gwcLMwaB8eP9VknEig_1770306243 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A46E4195C276; Thu, 5 Feb 2026 15:44:00 +0000 (UTC) Received: from cnb-01.lab.eng.brq2.redhat.com (cnb-01.lab.eng.brq2.redhat.com [10.37.129.36]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 282F018003F6; Thu, 5 Feb 2026 15:43:57 +0000 (UTC) From: Ivan Vecera To: netdev@vger.kernel.org Cc: Prathosh Satish , Vadim Fedorenko , Arkadiusz Kubalewski , Jiri Pirko , linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] dpll: zl3073x: Include current frequency in supported frequencies list Date: Thu, 5 Feb 2026 16:43:50 +0100 Message-ID: <20260205154350.3180465-3-ivecera@redhat.com> In-Reply-To: <20260205154350.3180465-1-ivecera@redhat.com> References: <20260205154350.3180465-1-ivecera@redhat.com> 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" Ensure the current pin frequency is always present in the list of supported frequencies reported to userspace. Previously, if the firmware node was missing or didn't include the current operating frequency in the supported-frequencies-hz property, the pin would report a frequency that wasn't in its supported list. Get the current frequency early in zl3073x_pin_props_get(): - For input pins: use zl3073x_dev_ref_freq_get() - For output pins: use zl3073x_dev_output_pin_freq_get() Place the current frequency at index 0 of the supported frequencies array, then append frequencies from the firmware node (if present), skipping any duplicate of the current frequency. Signed-off-by: Ivan Vecera --- drivers/dpll/zl3073x/prop.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/dpll/zl3073x/prop.c b/drivers/dpll/zl3073x/prop.c index 4ed153087570..51748b0e523b 100644 --- a/drivers/dpll/zl3073x/prop.c +++ b/drivers/dpll/zl3073x/prop.c @@ -193,9 +193,10 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct= zl3073x_dev *zldev, { struct dpll_pin_frequency *ranges; struct zl3073x_pin_props *props; - int i, j, num_freqs, rc; + int i, j, num_freqs =3D 0, rc; + u64 *freqs =3D NULL; const char *type; - u64 *freqs; + u32 curr_freq; =20 props =3D kzalloc(sizeof(*props), GFP_KERNEL); if (!props) @@ -207,6 +208,7 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct = zl3073x_dev *zldev, props->dpll_props.capabilities =3D DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE | DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE; + curr_freq =3D zl3073x_dev_ref_freq_get(zldev, index); } else { u8 out, synth; u32 f; @@ -220,6 +222,7 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct = zl3073x_dev *zldev, synth =3D zl3073x_dev_out_synth_get(zldev, out); f =3D 2 * zl3073x_dev_synth_freq_get(zldev, synth); props->dpll_props.phase_gran =3D f ? div_u64(PSEC_PER_SEC, f) : 1; + curr_freq =3D zl3073x_dev_output_pin_freq_get(zldev, index); } =20 props->dpll_props.phase_range.min =3D S32_MIN; @@ -230,7 +233,7 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct = zl3073x_dev *zldev, /* Get firmware node for the given pin */ rc =3D zl3073x_prop_pin_fwnode_get(zldev, props, dir, index); if (rc) - return props; /* Return if it does not exist */ + goto skip_fwnode_props; =20 /* Look for label property and store the value as board label */ fwnode_property_read_string(props->fwnode, "label", @@ -262,9 +265,10 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struct= zl3073x_dev *zldev, /* Read supported frequencies property if it is specified */ num_freqs =3D fwnode_property_count_u64(props->fwnode, "supported-frequencies-hz"); - if (num_freqs <=3D 0) - /* Return if the property does not exist or number is 0 */ - return props; + if (num_freqs <=3D 0) { + num_freqs =3D 0; + goto skip_fwnode_props; + } =20 /* The firmware node specifies list of supported frequencies while * DPLL core pin properties requires list of frequency ranges. @@ -281,19 +285,25 @@ struct zl3073x_pin_props *zl3073x_pin_props_get(struc= t zl3073x_dev *zldev, "supported-frequencies-hz", freqs, num_freqs); =20 - /* Allocate frequency ranges list and fill it */ - ranges =3D kcalloc(num_freqs, sizeof(*ranges), GFP_KERNEL); +skip_fwnode_props: + /* Allocate frequency ranges list - extra slot for current frequency */ + ranges =3D kcalloc(num_freqs + 1, sizeof(*ranges), GFP_KERNEL); if (!ranges) { rc =3D -ENOMEM; goto err_alloc_ranges; } =20 - /* Convert list of frequencies to list of frequency ranges but - * filter-out frequencies that are not representable by device + /* Start with current frequency at index 0 */ + ranges[0] =3D (struct dpll_pin_frequency)DPLL_PIN_FREQUENCY(curr_freq); + + /* Add frequencies from firmware node, skipping current frequency + * and filtering out frequencies not representable by device */ - for (i =3D 0, j =3D 0; i < num_freqs; i++) { + for (i =3D 0, j =3D 1; i < num_freqs; i++) { struct dpll_pin_frequency freq =3D DPLL_PIN_FREQUENCY(freqs[i]); =20 + if (freqs[i] =3D=3D curr_freq) + continue; if (zl3073x_pin_check_freq(zldev, dir, index, freqs[i])) { ranges[j] =3D freq; j++; --=20 2.52.0