| .. | .. |
|---|
| 29 | 29 | |
|---|
| 30 | 30 | #include <nvif/notify.h> |
|---|
| 31 | 31 | |
|---|
| 32 | +#include <nvhw/class/cl507d.h> |
|---|
| 33 | +#include <nvhw/class/cl907d.h> |
|---|
| 34 | +#include <nvhw/drf.h> |
|---|
| 35 | + |
|---|
| 32 | 36 | #include <drm/drm_crtc.h> |
|---|
| 33 | 37 | #include <drm/drm_edid.h> |
|---|
| 34 | 38 | #include <drm/drm_encoder.h> |
|---|
| 35 | 39 | #include <drm/drm_dp_helper.h> |
|---|
| 40 | +#include <drm/drm_util.h> |
|---|
| 41 | + |
|---|
| 36 | 42 | #include "nouveau_crtc.h" |
|---|
| 37 | 43 | #include "nouveau_encoder.h" |
|---|
| 38 | 44 | |
|---|
| 39 | 45 | struct nvkm_i2c_port; |
|---|
| 46 | +struct dcb_output; |
|---|
| 47 | + |
|---|
| 48 | +#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT |
|---|
| 49 | +struct nouveau_backlight; |
|---|
| 50 | +#endif |
|---|
| 40 | 51 | |
|---|
| 41 | 52 | #define nouveau_conn_atom(p) \ |
|---|
| 42 | 53 | container_of((p), struct nouveau_conn_atom, state) |
|---|
| .. | .. |
|---|
| 49 | 60 | * hw values, and the code relies on this. |
|---|
| 50 | 61 | */ |
|---|
| 51 | 62 | enum { |
|---|
| 52 | | - DITHERING_MODE_OFF = 0x00, |
|---|
| 53 | | - DITHERING_MODE_ON = 0x01, |
|---|
| 54 | | - DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, |
|---|
| 55 | | - DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, |
|---|
| 56 | | - DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, |
|---|
| 63 | + DITHERING_MODE_OFF = |
|---|
| 64 | + NVDEF(NV507D, HEAD_SET_DITHER_CONTROL, ENABLE, DISABLE), |
|---|
| 65 | + DITHERING_MODE_ON = |
|---|
| 66 | + NVDEF(NV507D, HEAD_SET_DITHER_CONTROL, ENABLE, ENABLE), |
|---|
| 67 | + DITHERING_MODE_DYNAMIC2X2 = DITHERING_MODE_ON | |
|---|
| 68 | + NVDEF(NV507D, HEAD_SET_DITHER_CONTROL, MODE, DYNAMIC_2X2), |
|---|
| 69 | + DITHERING_MODE_STATIC2X2 = DITHERING_MODE_ON | |
|---|
| 70 | + NVDEF(NV507D, HEAD_SET_DITHER_CONTROL, MODE, STATIC_2X2), |
|---|
| 71 | + DITHERING_MODE_TEMPORAL = DITHERING_MODE_ON | |
|---|
| 72 | + NVDEF(NV907D, HEAD_SET_DITHER_CONTROL, MODE, TEMPORAL), |
|---|
| 57 | 73 | DITHERING_MODE_AUTO |
|---|
| 58 | 74 | } mode; |
|---|
| 59 | 75 | enum { |
|---|
| 60 | | - DITHERING_DEPTH_6BPC = 0x00, |
|---|
| 61 | | - DITHERING_DEPTH_8BPC = 0x02, |
|---|
| 76 | + DITHERING_DEPTH_6BPC = |
|---|
| 77 | + NVDEF(NV507D, HEAD_SET_DITHER_CONTROL, BITS, DITHER_TO_6_BITS), |
|---|
| 78 | + DITHERING_DEPTH_8BPC = |
|---|
| 79 | + NVDEF(NV507D, HEAD_SET_DITHER_CONTROL, BITS, DITHER_TO_8_BITS), |
|---|
| 62 | 80 | DITHERING_DEPTH_AUTO |
|---|
| 63 | 81 | } depth; |
|---|
| 64 | 82 | } dither; |
|---|
| .. | .. |
|---|
| 108 | 126 | struct nouveau_encoder *detected_encoder; |
|---|
| 109 | 127 | struct edid *edid; |
|---|
| 110 | 128 | struct drm_display_mode *native_mode; |
|---|
| 129 | +#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT |
|---|
| 130 | + struct nouveau_backlight *backlight; |
|---|
| 131 | +#endif |
|---|
| 132 | + /* |
|---|
| 133 | + * Our connector property code expects a nouveau_conn_atom struct |
|---|
| 134 | + * even on pre-nv50 where we do not support atomic. This embedded |
|---|
| 135 | + * version gets used in the non atomic modeset case. |
|---|
| 136 | + */ |
|---|
| 137 | + struct nouveau_conn_atom properties_state; |
|---|
| 111 | 138 | }; |
|---|
| 112 | 139 | |
|---|
| 113 | 140 | static inline struct nouveau_connector *nouveau_connector( |
|---|
| .. | .. |
|---|
| 159 | 186 | } |
|---|
| 160 | 187 | |
|---|
| 161 | 188 | struct drm_connector * |
|---|
| 162 | | -nouveau_connector_create(struct drm_device *, int index); |
|---|
| 189 | +nouveau_connector_create(struct drm_device *, const struct dcb_output *); |
|---|
| 190 | +void nouveau_connector_hpd(struct drm_connector *connector); |
|---|
| 163 | 191 | |
|---|
| 164 | 192 | extern int nouveau_tv_disable; |
|---|
| 165 | 193 | extern int nouveau_ignorelid; |
|---|
| .. | .. |
|---|
| 179 | 207 | const struct drm_connector_state *, |
|---|
| 180 | 208 | struct drm_property *, u64 *); |
|---|
| 181 | 209 | struct drm_display_mode *nouveau_conn_native_mode(struct drm_connector *); |
|---|
| 210 | +enum drm_mode_status |
|---|
| 211 | +nouveau_conn_mode_clock_valid(const struct drm_display_mode *, |
|---|
| 212 | + const unsigned min_clock, |
|---|
| 213 | + const unsigned max_clock, |
|---|
| 214 | + unsigned *clock); |
|---|
| 215 | + |
|---|
| 216 | +#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT |
|---|
| 217 | +extern int nouveau_backlight_init(struct drm_connector *); |
|---|
| 218 | +extern void nouveau_backlight_fini(struct drm_connector *); |
|---|
| 219 | +extern void nouveau_backlight_ctor(void); |
|---|
| 220 | +extern void nouveau_backlight_dtor(void); |
|---|
| 221 | +#else |
|---|
| 222 | +static inline int |
|---|
| 223 | +nouveau_backlight_init(struct drm_connector *connector) |
|---|
| 224 | +{ |
|---|
| 225 | + return 0; |
|---|
| 226 | +} |
|---|
| 227 | + |
|---|
| 228 | +static inline void |
|---|
| 229 | +nouveau_backlight_fini(struct drm_connector *connector) { |
|---|
| 230 | +} |
|---|
| 231 | + |
|---|
| 232 | +static inline void |
|---|
| 233 | +nouveau_backlight_ctor(void) { |
|---|
| 234 | +} |
|---|
| 235 | + |
|---|
| 236 | +static inline void |
|---|
| 237 | +nouveau_backlight_dtor(void) { |
|---|
| 238 | +} |
|---|
| 239 | +#endif |
|---|
| 240 | + |
|---|
| 182 | 241 | #endif /* __NOUVEAU_CONNECTOR_H__ */ |
|---|