From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (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 4F1E446AEDF for ; Wed, 1 Apr 2026 14:47:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775054865; cv=none; b=Z6A0UJWZSL3VyLlFtbjiB1Pdi2B+rWuF3EwkiOpruarPDe1awXGILIit/v9qfzAmysAUlhg1XjNnIAOSK2GCoZP6R+nG+zn9AEbT/F77KPcidLqoDL/j4m4jIrtnwaI8aMRXKUkherhzwguskPDaOQSRikxexu6zntUsf90leKo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775054865; c=relaxed/simple; bh=IcfTPYv0xO0mqFn38HgKw9SA8wev2KEgBkVuLys6+KY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ermqTR2e9ZoP6seefHW8OyWp9iMmK7GDgw8JkSL0ZGr0MJ/FCeJBk1y5yVZEH1tZFnqx1RoL5gmMMcZ+C/p1zcKR3L09KLELWAQH5l2Cj+D+9AZYouGvOQkErgIy2OSEqNjwfI2fsGO9N2WtKKVqYW2/rZAdYIw889l0DiOTzNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=oTU24f2b; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="oTU24f2b" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775054852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UsSHmJeqtLdwZRWpgLpBgw3zlzwJ3e/H16bClqxSpSc=; b=oTU24f2bI9vYawXmQTRGgR4sqLZHqJq8d3UD46iw1BSBjIaRaH9+wbIOA9R/D8TlvEqSs/ HJ11YmHD/kwPvuYOxnI40Gf0CTdh8xJnO+nz9RE7fRO9kXRDxBBpaQPZoBHXKDth7mOzBA P0ETpp2Lloayd45l1rqJuTLHNeAfZsU= Date: Wed, 1 Apr 2026 15:47:21 +0100 Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH net-next v3 2/3] dpll: add frequency monitoring callback ops To: Ivan Vecera , netdev@vger.kernel.org Cc: Arkadiusz Kubalewski , "David S. Miller" , Donald Hunter , Eric Dumazet , Jakub Kicinski , Jiri Pirko , Jonathan Corbet , Michal Schmidt , Paolo Abeni , Petr Oros , Prathosh Satish , Shuah Khan , Simon Horman , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260401091237.1071995-1-ivecera@redhat.com> <20260401091237.1071995-3-ivecera@redhat.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Vadim Fedorenko In-Reply-To: <20260401091237.1071995-3-ivecera@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 01/04/2026 10:12, Ivan Vecera wrote: > Add new callback operations for a dpll device: > - freq_monitor_get(..) - to obtain current state of frequency monitor > feature from dpll device, > - freq_monitor_set(..) - to allow feature configuration. > > Add new callback operation for a dpll pin: > - measured_freq_get(..) - to obtain the measured frequency in mHz. > > Obtain the feature state value using the get callback and provide it to > the user if the device driver implements callbacks. The measured_freq_get > pin callback is only invoked when the frequency monitor is enabled. > The freq_monitor_get device callback is required when measured_freq_get > is provided by the driver. > > Execute the set callback upon user requests. > > Reviewed-by: Vadim Fedorenko > Signed-off-by: Ivan Vecera > --- > Changes v2 -> v3: > - Made freq_monitor_get required when measured_freq_get is present (Jakub) > > Changes v1 -> v2: > - Renamed actual-frequency to measured-frequency (Vadim) > --- > drivers/dpll/dpll_netlink.c | 92 +++++++++++++++++++++++++++++++++++++ > include/linux/dpll.h | 10 ++++ > 2 files changed, 102 insertions(+) > > diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c > index 83cbd64abf5a4..576d0cd074bd4 100644 > --- a/drivers/dpll/dpll_netlink.c > +++ b/drivers/dpll/dpll_netlink.c > @@ -175,6 +175,26 @@ dpll_msg_add_phase_offset_monitor(struct sk_buff *msg, struct dpll_device *dpll, > return 0; > } > > +static int > +dpll_msg_add_freq_monitor(struct sk_buff *msg, struct dpll_device *dpll, > + struct netlink_ext_ack *extack) > +{ > + const struct dpll_device_ops *ops = dpll_device_ops(dpll); > + enum dpll_feature_state state; > + int ret; > + > + if (ops->freq_monitor_set && ops->freq_monitor_get) { > + ret = ops->freq_monitor_get(dpll, dpll_priv(dpll), > + &state, extack); > + if (ret) > + return ret; > + if (nla_put_u32(msg, DPLL_A_FREQUENCY_MONITOR, state)) > + return -EMSGSIZE; > + } > + > + return 0; > +} > + > static int > dpll_msg_add_phase_offset_avg_factor(struct sk_buff *msg, > struct dpll_device *dpll, > @@ -400,6 +420,40 @@ static int dpll_msg_add_ffo(struct sk_buff *msg, struct dpll_pin *pin, > ffo); > } > > +static int dpll_msg_add_measured_freq(struct sk_buff *msg, struct dpll_pin *pin, > + struct dpll_pin_ref *ref, > + struct netlink_ext_ack *extack) > +{ > + const struct dpll_device_ops *dev_ops = dpll_device_ops(ref->dpll); > + const struct dpll_pin_ops *ops = dpll_pin_ops(ref); > + struct dpll_device *dpll = ref->dpll; > + enum dpll_feature_state state; > + u64 measured_freq; > + int ret; > + > + if (!ops->measured_freq_get) > + return 0; > + if (WARN_ON(!dev_ops->freq_monitor_get)) > + return -EINVAL; I think pin registration function has to be adjusted to not allow measured_freq_get() callback if device doesn't have freq_monitor_get() callback (or both freq_monitor_{s,g}et). Then this defensive part can be completely removed. > + ret = dev_ops->freq_monitor_get(dpll, dpll_priv(dpll),