# fuchsia.hardware.clock

<br />

Added: 22

## **PROTOCOLS**

## Clock

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=15)*

Used for driver-to-driver communication.

<br />

### Disable

Disables (gates) this clock.
Drivers should call this method to indicate to the clock subsystem that
a particular clock signal is no longer necessary.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `Disable`
Returns `ZX_ERR_INTERNAL` if the operation failed for any other reason.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_Disable_Result` |

### Enable

Enables (ungates) this clock.
Drivers *must* call enable on all clocks they depend upon.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `Enable`.
Returns `ZX_ERR_TIMED_OUT` if an operation timed out (for instance, a PLL was unable to lock).
Returns `ZX_ERR_INTERNAL` if the operation failed for any other reason.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_Enable_Result` |

### GetInput

Returns the index of the current input of this clock.
GetInput shall not alter the state of the clock tree in any way.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `GetInput`.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetInput_Result` |

### GetNumInputs

Returns the number of inputs this clock has.
Any value between 0 and UINT32_MAX is a valid return for this method.
A Root Oscillator may return 0 for instance, if it has no inputs.
GetNumInputs shall not alter the state of the clock tree in any way.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `GetNumInputs`.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetNumInputs_Result` |

### GetProperties

Returns the static properties of a clock.
Added: 29

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetProperties_Result` |

### GetRate

Returns the current rate that a given clock is running at.
GetRate shall not alter the state of the clock tree in any way.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `GetRate `.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetRate_Result` |

### IsEnabled

Returns `true` if a given clock is running.
May query the hardware or return a cached value.
IsEnabled shall not alter the state of the clock tree in any way.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `IsEnabled`.

#### Request

\<EMPTY\>

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_IsEnabled_Result` |

### QuerySupportedRate

Query the hardware for the highest supported rate that does not
exceed hz_in.
`QuerySupportedRate` shall not alter the state of the clock tree in any way.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `QuerySupportedRate`.
Returns `ZX_ERR_OUT_OF_RANGE` if a suitable rate could not be found.

#### Request

| Name | Type |
|---|---|
| `hz_in` | `uint64` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_QuerySupportedRate_Result` |

### SetInput

Sets the input of this clock by index. I.e. by selecting a mux.
This clock has N inputs defined 0 through N-1, which are valid arguemts
as the index to SetInput.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `SetInput`
Returns `ZX_ERR_OUT_OF_RANGE` if `idx` is outside of the range supplied by `GetNumInputs`.
Returns `ZX_ERR_INTERNAL` if the operation failed for any other reason.

#### Request

| Name | Type |
|---|---|
| `idx` | `uint32` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_SetInput_Result` |

### SetRate

Attempt to set the rate of the clock provider.
Returns `ZX_ERR_NOT_SUPPORTED` if this clock type does not support `SetRate`
Returns `ZX_ERR_INVALID_ARGS` if the requested rate is not one that is reported as supported by `QuerySupportedRate`.
Returns `ZX_ERR_TIMED_OUT` if an operation timed out (for instance, a PLL was unable to lock).
Returns `ZX_ERR_INTERNAL` if the operation failed for any other reason.

#### Request

| Name | Type |
|---|---|
| `hz` | `uint64` |

#### Response

| Name | Type |
|---|---|
| `payload` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_SetRate_Result` |

## **STRUCTS**

### Clock_Disable_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=29)*

\<EMPTY\>

### Clock_Enable_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=22)*

\<EMPTY\>

### Clock_GetInput_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=88)*

| Field | Type | Description | Default |
|---|---|---|---|
| `index` | `uint32` |   | No default |

### Clock_GetNumInputs_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=81)*

| Field | Type | Description | Default |
|---|---|---|---|
| `n` | `uint32` |   | No default |

### Clock_GetProperties_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=94)*

| Field | Type | Description | Default |
|---|---|---|---|
| `id` | `uint32` | The platform-specific number of this clock, set as a bind property on the driver node. | No default |
| `name` | `string:256` | The human-readable name of this clock. Either provided by the implementation, or the device tree. | No default |

### Clock_GetRate_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=62)*

| Field | Type | Description | Default |
|---|---|---|---|
| `hz` | `uint64` |   | No default |

### Clock_IsEnabled_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=35)*

| Field | Type | Description | Default |
|---|---|---|---|
| `enabled` | `bool` |   | No default |

### Clock_QuerySupportedRate_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=55)*

| Field | Type | Description | Default |
|---|---|---|---|
| `hz_out` | `uint64` |   | No default |

### Clock_SetInput_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=74)*

\<EMPTY\>

### Clock_SetRate_Response

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=46)*

\<EMPTY\>

## **UNIONS**

### Clock_Disable_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=29)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_Disable_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_Enable_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=22)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_Enable_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_GetInput_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=88)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetInput_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_GetNumInputs_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=81)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetNumInputs_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_GetProperties_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=94)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetProperties_Response` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_GetRate_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=62)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_GetRate_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_IsEnabled_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=35)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_IsEnabled_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_QuerySupportedRate_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=55)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_QuerySupportedRate_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_SetInput_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=74)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_SetInput_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

### Clock_SetRate_Result [strict](https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#strict-vs-flexible)

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=46)*

| Ordinal | Variant | Type | Description |
|---|---|---|---|
| ### 1 | `response` | `https://fuchsia.dev/reference/fidl/fuchsia.hardware.clock#Clock_SetRate_Response` |   |
| ### 2 | `err` | `https://fuchsia.dev/reference/zx//https://fuchsia.dev/reference/zx#Status` |   |
| ### 3 | `framework_err` | `internal` |   |

<br />

## **CONSTANTS**

| Name | Value | Type | Description |
|---|---|---|---|
| [MAX_CLOCK_NAME_LEN](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=11) | `256` | `uint32` | Maximum length of the clock name. Added: 29 |

## **SERVICES**

### DebugService

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=107)*

| Name | Type | Transport |
|---|---|---|
| [device](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=108) | `fuchsia.hardware.clock/Clock` | Channel |

<br />

### Service

*Defined in [fuchsia.hardware.clock/clock.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=103)*

| Name | Type | Transport |
|---|---|---|
| [clock](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.hardware.clock/clock.fidl;l=104) | `fuchsia.hardware.clock/Clock` | Channel |

<br />