Skip to content

Commit 2add479

Browse files
committed
Merge: CNB97: dpll: add clock quality level attribute and op
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6413 JIRA: https://issues.redhat.com/browse/RHEL-77838 Patches: `a1afb959add1f ("dpll: add clock quality level attribute and op") ` Signed-off-by: Petr Oros <poros@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents 4cbae32 + 0786dff commit 2add479

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

Documentation/netlink/specs/dpll.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,36 @@ definitions:
8585
This may happen for example if dpll device was previously
8686
locked on an input pin of type PIN_TYPE_SYNCE_ETH_PORT.
8787
render-max: true
88+
-
89+
type: enum
90+
name: clock-quality-level
91+
doc: |
92+
level of quality of a clock device. This mainly applies when
93+
the dpll lock-status is DPLL_LOCK_STATUS_HOLDOVER.
94+
The current list is defined according to the table 11-7 contained
95+
in ITU-T G.8264/Y.1364 document. One may extend this list freely
96+
by other ITU-T defined clock qualities, or different ones defined
97+
by another standardization body (for those, please use
98+
different prefix).
99+
entries:
100+
-
101+
name: itu-opt1-prc
102+
value: 1
103+
-
104+
name: itu-opt1-ssu-a
105+
-
106+
name: itu-opt1-ssu-b
107+
-
108+
name: itu-opt1-eec1
109+
-
110+
name: itu-opt1-prtc
111+
-
112+
name: itu-opt1-eprtc
113+
-
114+
name: itu-opt1-eeec
115+
-
116+
name: itu-opt1-eprc
117+
render-max: true
88118
-
89119
type: const
90120
name: temp-divider
@@ -252,6 +282,17 @@ attribute-sets:
252282
name: lock-status-error
253283
type: u32
254284
enum: lock-status-error
285+
-
286+
name: clock-quality-level
287+
type: u32
288+
enum: clock-quality-level
289+
multi-attr: true
290+
doc: |
291+
Level of quality of a clock device. This mainly applies when
292+
the dpll lock-status is DPLL_LOCK_STATUS_HOLDOVER. This could
293+
be put to message multiple times to indicate possible parallel
294+
quality levels (e.g. one specified by ITU option 1 and another
295+
one specified by option 2).
255296
-
256297
name: pin
257298
enum-name: dpll_a_pin

drivers/dpll/dpll_netlink.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,27 @@ dpll_msg_add_temp(struct sk_buff *msg, struct dpll_device *dpll,
169169
return 0;
170170
}
171171

172+
static int
173+
dpll_msg_add_clock_quality_level(struct sk_buff *msg, struct dpll_device *dpll,
174+
struct netlink_ext_ack *extack)
175+
{
176+
const struct dpll_device_ops *ops = dpll_device_ops(dpll);
177+
DECLARE_BITMAP(qls, DPLL_CLOCK_QUALITY_LEVEL_MAX) = { 0 };
178+
enum dpll_clock_quality_level ql;
179+
int ret;
180+
181+
if (!ops->clock_quality_level_get)
182+
return 0;
183+
ret = ops->clock_quality_level_get(dpll, dpll_priv(dpll), qls, extack);
184+
if (ret)
185+
return ret;
186+
for_each_set_bit(ql, qls, DPLL_CLOCK_QUALITY_LEVEL_MAX)
187+
if (nla_put_u32(msg, DPLL_A_CLOCK_QUALITY_LEVEL, ql))
188+
return -EMSGSIZE;
189+
190+
return 0;
191+
}
192+
172193
static int
173194
dpll_msg_add_pin_prio(struct sk_buff *msg, struct dpll_pin *pin,
174195
struct dpll_pin_ref *ref,
@@ -557,6 +578,9 @@ dpll_device_get_one(struct dpll_device *dpll, struct sk_buff *msg,
557578
if (ret)
558579
return ret;
559580
ret = dpll_msg_add_lock_status(msg, dpll, extack);
581+
if (ret)
582+
return ret;
583+
ret = dpll_msg_add_clock_quality_level(msg, dpll, extack);
560584
if (ret)
561585
return ret;
562586
ret = dpll_msg_add_mode(msg, dpll, extack);

include/linux/dpll.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ struct dpll_device_ops {
2626
struct netlink_ext_ack *extack);
2727
int (*temp_get)(const struct dpll_device *dpll, void *dpll_priv,
2828
s32 *temp, struct netlink_ext_ack *extack);
29+
int (*clock_quality_level_get)(const struct dpll_device *dpll,
30+
void *dpll_priv,
31+
unsigned long *qls,
32+
struct netlink_ext_ack *extack);
2933
};
3034

3135
struct dpll_pin_ops {

include/uapi/linux/dpll.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,29 @@ enum dpll_lock_status_error {
7979
DPLL_LOCK_STATUS_ERROR_MAX = (__DPLL_LOCK_STATUS_ERROR_MAX - 1)
8080
};
8181

82+
/**
83+
* enum dpll_clock_quality_level - level of quality of a clock device. This
84+
* mainly applies when the dpll lock-status is DPLL_LOCK_STATUS_HOLDOVER. The
85+
* current list is defined according to the table 11-7 contained in ITU-T
86+
* G.8264/Y.1364 document. One may extend this list freely by other ITU-T
87+
* defined clock qualities, or different ones defined by another
88+
* standardization body (for those, please use different prefix).
89+
*/
90+
enum dpll_clock_quality_level {
91+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_PRC = 1,
92+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_SSU_A,
93+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_SSU_B,
94+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EEC1,
95+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_PRTC,
96+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EPRTC,
97+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EEEC,
98+
DPLL_CLOCK_QUALITY_LEVEL_ITU_OPT1_EPRC,
99+
100+
/* private: */
101+
__DPLL_CLOCK_QUALITY_LEVEL_MAX,
102+
DPLL_CLOCK_QUALITY_LEVEL_MAX = (__DPLL_CLOCK_QUALITY_LEVEL_MAX - 1)
103+
};
104+
82105
#define DPLL_TEMP_DIVIDER 1000
83106

84107
/**
@@ -180,6 +203,7 @@ enum dpll_a {
180203
DPLL_A_TEMP,
181204
DPLL_A_TYPE,
182205
DPLL_A_LOCK_STATUS_ERROR,
206+
DPLL_A_CLOCK_QUALITY_LEVEL,
183207

184208
__DPLL_A_MAX,
185209
DPLL_A_MAX = (__DPLL_A_MAX - 1)

0 commit comments

Comments
 (0)