Add new argument on dpll device register, a capabilities bitmask of features supported by the dpll device. Provide capability value on dpll device dump.
Reviewed-by: Milena Olech <milena.ol...@intel.com> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalew...@intel.com> --- drivers/dpll/dpll_core.c | 5 ++++- drivers/dpll/dpll_core.h | 2 ++ drivers/dpll/dpll_netlink.c | 2 ++ drivers/net/ethernet/intel/ice/ice_dpll.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/dpll.c | 2 +- drivers/ptp/ptp_ocp.c | 2 +- include/linux/dpll.h | 3 ++- 7 files changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index 20bdc52f63a5..563ac37c83ad 100644 --- a/drivers/dpll/dpll_core.c +++ b/drivers/dpll/dpll_core.c @@ -342,6 +342,7 @@ dpll_device_registration_find(struct dpll_device *dpll, * dpll_device_register - register the dpll device in the subsystem * @dpll: pointer to a dpll * @type: type of a dpll + * @capabilities: mask of available features supported by dpll * @ops: ops for a dpll device * @priv: pointer to private information of owner * @@ -353,7 +354,8 @@ dpll_device_registration_find(struct dpll_device *dpll, * * negative - error value */ int dpll_device_register(struct dpll_device *dpll, enum dpll_type type, - const struct dpll_device_ops *ops, void *priv) + u32 capabilities, const struct dpll_device_ops *ops, + void *priv) { struct dpll_device_registration *reg; bool first_registration = false; @@ -382,6 +384,7 @@ int dpll_device_register(struct dpll_device *dpll, enum dpll_type type, reg->ops = ops; reg->priv = priv; dpll->type = type; + dpll->capabilities = capabilities; first_registration = list_empty(&dpll->registration_list); list_add_tail(®->list, &dpll->registration_list); if (!first_registration) { diff --git a/drivers/dpll/dpll_core.h b/drivers/dpll/dpll_core.h index 2b6d8ef1cdf3..70bbafb9b635 100644 --- a/drivers/dpll/dpll_core.h +++ b/drivers/dpll/dpll_core.h @@ -21,6 +21,7 @@ * @clock_id: unique identifier (clock_id) of a dpll * @module: module of creator * @type: type of a dpll + * @capabilities: capabilities of a dpll * @pin_refs: stores pins registered within a dpll * @refcount: refcount * @registration_list: list of registered ops and priv data of dpll owners @@ -31,6 +32,7 @@ struct dpll_device { u64 clock_id; struct module *module; enum dpll_type type; + u32 capabilities; struct xarray pin_refs; refcount_t refcount; struct list_head registration_list; diff --git a/drivers/dpll/dpll_netlink.c b/drivers/dpll/dpll_netlink.c index c130f87147fa..41aed0d29be2 100644 --- a/drivers/dpll/dpll_netlink.c +++ b/drivers/dpll/dpll_netlink.c @@ -591,6 +591,8 @@ dpll_device_get_one(struct dpll_device *dpll, struct sk_buff *msg, return ret; if (nla_put_u32(msg, DPLL_A_TYPE, dpll->type)) return -EMSGSIZE; + if (nla_put_u32(msg, DPLL_A_CAPABILITIES, dpll->capabilities)) + return -EMSGSIZE; return 0; } diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c index bce3ad6ca2a6..614a813c7772 100644 --- a/drivers/net/ethernet/intel/ice/ice_dpll.c +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c @@ -2012,7 +2012,7 @@ ice_dpll_init_dpll(struct ice_pf *pf, struct ice_dpll *d, bool cgu, d->pf = pf; if (cgu) { ice_dpll_update_state(pf, d, true); - ret = dpll_device_register(d->dpll, type, &ice_dpll_ops, d); + ret = dpll_device_register(d->dpll, type, 0, &ice_dpll_ops, d); if (ret) { dpll_device_put(d->dpll); return ret; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c index 1e5522a19483..0e430f93b047 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/dpll.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/dpll.c @@ -444,7 +444,7 @@ static int mlx5_dpll_probe(struct auxiliary_device *adev, goto err_free_mdpll; } - err = dpll_device_register(mdpll->dpll, DPLL_TYPE_EEC, + err = dpll_device_register(mdpll->dpll, DPLL_TYPE_EEC, 0, &mlx5_dpll_device_ops, mdpll); if (err) goto err_put_dpll_device; diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index b25635c5c745..87b9890d8ef2 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -4745,7 +4745,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto out; } - err = dpll_device_register(bp->dpll, DPLL_TYPE_PPS, &dpll_ops, bp); + err = dpll_device_register(bp->dpll, DPLL_TYPE_PPS, 0, &dpll_ops, bp); if (err) goto out; diff --git a/include/linux/dpll.h b/include/linux/dpll.h index 5e4f9ab1cf75..dde8dee83dc6 100644 --- a/include/linux/dpll.h +++ b/include/linux/dpll.h @@ -171,7 +171,8 @@ dpll_device_get(u64 clock_id, u32 dev_driver_id, struct module *module); void dpll_device_put(struct dpll_device *dpll); int dpll_device_register(struct dpll_device *dpll, enum dpll_type type, - const struct dpll_device_ops *ops, void *priv); + u32 capabilities, const struct dpll_device_ops *ops, + void *priv); void dpll_device_unregister(struct dpll_device *dpll, const struct dpll_device_ops *ops, void *priv); -- 2.38.1