| 1 |
|
| 2 |
|
| 3 |
#ifndef _ZL3073X_OUT_H |
| 4 |
#define _ZL3073X_OUT_H |
| 5 |
|
| 6 |
#include <linux/bitfield.h> |
| 7 |
#include <linux/types.h> |
| 8 |
|
| 9 |
#include "regs.h" |
| 10 |
|
| 11 |
struct zl3073x_dev; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
struct zl3073x_out { |
| 24 |
u32 div; |
| 25 |
u32 width; |
| 26 |
u32 esync_n_period; |
| 27 |
u32 esync_n_width; |
| 28 |
s32 phase_comp; |
| 29 |
u8 ctrl; |
| 30 |
u8 mode; |
| 31 |
}; |
| 32 |
|
| 33 |
int zl3073x_out_state_fetch(struct zl3073x_dev *zldev, u8 index); |
| 34 |
const struct zl3073x_out *zl3073x_out_state_get(struct zl3073x_dev *zldev, |
| 35 |
u8 index); |
| 36 |
|
| 37 |
int zl3073x_out_state_set(struct zl3073x_dev *zldev, u8 index, |
| 38 |
const struct zl3073x_out *out); |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
static inline u8 zl3073x_out_signal_format_get(const struct zl3073x_out *out) |
| 47 |
{ |
| 48 |
return FIELD_GET(ZL_OUTPUT_MODE_SIGNAL_FORMAT, out->mode); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
static inline bool zl3073x_out_is_diff(const struct zl3073x_out *out) |
| 58 |
{ |
| 59 |
switch (zl3073x_out_signal_format_get(out)) { |
| 60 |
case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LVDS: |
| 61 |
case ZL_OUTPUT_MODE_SIGNAL_FORMAT_DIFF: |
| 62 |
case ZL_OUTPUT_MODE_SIGNAL_FORMAT_LOWVCM: |
| 63 |
return true; |
| 64 |
default: |
| 65 |
break; |
| 66 |
} |
| 67 |
|
| 68 |
return false; |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
static inline bool zl3073x_out_is_enabled(const struct zl3073x_out *out) |
| 78 |
{ |
| 79 |
return !!FIELD_GET(ZL_OUTPUT_CTRL_EN, out->ctrl); |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
static inline bool zl3073x_out_is_ndiv(const struct zl3073x_out *out) |
| 89 |
{ |
| 90 |
switch (zl3073x_out_signal_format_get(out)) { |
| 91 |
case ZL_OUTPUT_MODE_SIGNAL_FORMAT_2_NDIV: |
| 92 |
case ZL_OUTPUT_MODE_SIGNAL_FORMAT_2_NDIV_INV: |
| 93 |
return true; |
| 94 |
default: |
| 95 |
return false; |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
static inline u8 zl3073x_out_synth_get(const struct zl3073x_out *out) |
| 106 |
{ |
| 107 |
return FIELD_GET(ZL_OUTPUT_CTRL_SYNTH_SEL, out->ctrl); |
| 108 |
} |
| 109 |
|
| 110 |
#endif |