Skip to content

Commit b1d0c41

Browse files
iveceraPaolo Abeni
authored andcommitted
dpll: add STATE_CONNECTED_OVERRIDE pin capability
Add DPLL_PIN_CAPABILITIES_STATE_CONNECTED_OVERRIDE capability flag that indicates a pin can be set to connected regardless of the current DPLL device mode, overriding the active input selection. This is useful for automatic-only DPLL devices where mode cannot be switched to manual, allowing userspace to directly connect such pin from automatic mode. The capability requires STATE_CAN_CHANGE to be set as well; dpll_pin_register() warns if a driver violates this. Document the new capability in the Pin selection section of Documentation/driver-api/dpll.rst. Signed-off-by: Ivan Vecera <ivecera@redhat.com> Link: https://patch.msgid.link/20260630125536.720717-2-ivecera@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 1704cc8 commit b1d0c41

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

Documentation/driver-api/dpll.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,13 @@ following pin states:
9191
- ``DPLL_PIN_STATE_DISCONNECTED`` - the pin shall be not considered as
9292
a valid input for automatic selection algorithm
9393

94+
Pins that have the ``DPLL_PIN_CAPABILITIES_STATE_CONNECTED_OVERRIDE``
95+
capability can additionally be set to ``DPLL_PIN_STATE_CONNECTED`` in
96+
automatic mode, overriding the active input selection. This is useful
97+
for automatic-only DPLL devices where mode cannot be switched to manual.
98+
When such a pin is disconnected, the device returns to automatic input
99+
selection.
100+
94101
The actual hardware status of a pin is reported via the operational
95102
state (``DPLL_A_PIN_OPERSTATE``) attribute nested under the parent
96103
device:

Documentation/netlink/specs/dpll.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ definitions:
252252
-
253253
name: state-can-change
254254
doc: pin state can be changed
255+
-
256+
name: state-connected-override
257+
doc: |
258+
pin state can be set to connected regardless of current
259+
DPLL device mode, overriding the active input selection.
260+
Requires state-can-change to be set as well.
255261
-
256262
type: const
257263
name: phase-offset-divider

drivers/dpll/dpll_core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,11 @@ dpll_pin_register(struct dpll_device *dpll, struct dpll_pin *pin,
884884
WARN_ON(ops->measured_freq_get &&
885885
(!dpll_device_ops(dpll)->freq_monitor_get ||
886886
!dpll_device_ops(dpll)->freq_monitor_set)) ||
887-
WARN_ON(ops->supported_ffo && !ops->ffo_get))
887+
WARN_ON(ops->supported_ffo && !ops->ffo_get) ||
888+
WARN_ON((pin->prop.capabilities &
889+
DPLL_PIN_CAPABILITIES_STATE_CONNECTED_OVERRIDE) &&
890+
!(pin->prop.capabilities &
891+
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE)))
888892
return -EINVAL;
889893

890894
mutex_lock(&dpll_lock);

include/uapi/linux/dpll.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,15 @@ enum dpll_pin_operstate {
208208
* @DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE: pin direction can be changed
209209
* @DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE: pin priority can be changed
210210
* @DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE: pin state can be changed
211+
* @DPLL_PIN_CAPABILITIES_STATE_CONNECTED_OVERRIDE: pin state can be set to
212+
* connected regardless of current DPLL device mode, overriding the active
213+
* input selection. Requires state-can-change to be set as well.
211214
*/
212215
enum dpll_pin_capabilities {
213216
DPLL_PIN_CAPABILITIES_DIRECTION_CAN_CHANGE = 1,
214217
DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE = 2,
215218
DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE = 4,
219+
DPLL_PIN_CAPABILITIES_STATE_CONNECTED_OVERRIDE = 8,
216220
};
217221

218222
#define DPLL_PHASE_OFFSET_DIVIDER 1000

0 commit comments

Comments
 (0)