nouveau_connector.h revision fdb751ef2bbc78314d1e01d3425cfacfb19b9f86
17423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese/* 27423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * Copyright (C) 2008 Maarten Maathuis. 37423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * All Rights Reserved. 47423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * 57423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * Permission is hereby granted, free of charge, to any person obtaining 67423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * a copy of this software and associated documentation files (the 77423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * "Software"), to deal in the Software without restriction, including 87423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * without limitation the rights to use, copy, modify, merge, publish, 97423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * distribute, sublicense, and/or sell copies of the Software, and to 107423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * permit persons to whom the Software is furnished to do so, subject to 117423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * the following conditions: 127423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * 1369144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard * The above copyright notice and this permission notice (including the 147423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * next paragraph) shall be included in all copies or substantial 157423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese * portions of the Software. 1669144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard * 1769144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18e751cce9b7b106b62c6d2c4f098c28c7feb10ef6Emilio López * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19e751cce9b7b106b62c6d2c4f098c28c7feb10ef6Emilio López * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 2010b302a297aee952949423aaec0749b757f34950Maxime Ripard * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 2110b302a297aee952949423aaec0749b757f34950Maxime Ripard * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22143b13d6e603abb0dc374cf31ec22f5dd28500ebMaxime Ripard * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23143b13d6e603abb0dc374cf31ec22f5dd28500ebMaxime Ripard * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24143b13d6e603abb0dc374cf31ec22f5dd28500ebMaxime Ripard * 25143b13d6e603abb0dc374cf31ec22f5dd28500ebMaxime Ripard */ 26143b13d6e603abb0dc374cf31ec22f5dd28500ebMaxime Ripard 27143b13d6e603abb0dc374cf31ec22f5dd28500ebMaxime Ripard#ifndef __NOUVEAU_CONNECTOR_H__ 28e751cce9b7b106b62c6d2c4f098c28c7feb10ef6Emilio López#define __NOUVEAU_CONNECTOR_H__ 29e751cce9b7b106b62c6d2c4f098c28c7feb10ef6Emilio López 3069144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard#include <drm/drm_edid.h> 318b2efa896cc618e055e90c9d9600e7c8388ae3b7Arnd Bergmann#include <drm/drm_dp_helper.h> 328b2efa896cc618e055e90c9d9600e7c8388ae3b7Arnd Bergmann#include "nouveau_crtc.h" 3369144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard 3414c44aa541744d4cf06db89c27a1e6df293c64d5Lorenzo Pieralisistruct nouveau_i2c_port; 3569144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard 3614c44aa541744d4cf06db89c27a1e6df293c64d5Lorenzo Pieralisienum nouveau_underscan_type { 3769144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard UNDERSCAN_OFF, 3869144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard UNDERSCAN_ON, 3969144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard UNDERSCAN_AUTO, 407423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese}; 417423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese 427423d2d817b815cc5bc41316f4aaa8ace3c4153eStefan Roese/* the enum values specifically defined here match nv50/nvd0 hw values, and 43874b4e451527ae1ad290b148ceac0662702d4ff2Maxime Ripard * the code relies on this 4469144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard */ 4569144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripardenum nouveau_dithering_mode { 4669144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_MODE_OFF = 0x00, 4769144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_MODE_ON = 0x01, 4869144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, 4969144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, 5069144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, 5169144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_MODE_AUTO 5269144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard}; 5369144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard 5469144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripardenum nouveau_dithering_depth { 5569144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_DEPTH_6BPC = 0x00, 5669144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_DEPTH_8BPC = 0x02, 5769144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard DITHERING_DEPTH_AUTO 5869144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard}; 5969144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard 6069144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripardstruct nouveau_connector { 61dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai struct drm_connector base; 6269144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard enum dcb_connector_type type; 63bf6534a180d6d596521b0bfa6de29da5e18314a6Maxime Ripard u8 index; 6469144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard u8 *dcb; 6592fd6e066a4ecdf161710afe6460bc372899ae5fEmilio López 66dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai struct nvkm_notify hpd; 6769144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard 6869144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard struct drm_dp_aux aux; 69dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai 7069144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard int dithering_mode; 7169144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard int dithering_depth; 7269144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard int scaling_mode; 73dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai enum nouveau_underscan_type underscan; 7469144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard u32 underscan_hborder; 7569144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard u32 underscan_vborder; 76dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai 7769144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard struct nouveau_encoder *detected_encoder; 78bf6534a180d6d596521b0bfa6de29da5e18314a6Maxime Ripard struct edid *edid; 7969144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard struct drm_display_mode *native_mode; 8069144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard}; 81dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai 8269144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripardstatic inline struct nouveau_connector *nouveau_connector( 8369144e3baf3dec9efae6fb197bbe21ed2b56323fMaxime Ripard struct drm_connector *con) 84dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai{ 85ec5589f7a33956ea3671d198ff170dc51ff2145dEmilio López return container_of(con, struct nouveau_connector, base); 86bf6534a180d6d596521b0bfa6de29da5e18314a6Maxime Ripard} 87ec5589f7a33956ea3671d198ff170dc51ff2145dEmilio López 88ec5589f7a33956ea3671d198ff170dc51ff2145dEmilio Lópezstatic inline struct nouveau_connector * 89dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsainouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc) 90ec5589f7a33956ea3671d198ff170dc51ff2145dEmilio López{ 91ec5589f7a33956ea3671d198ff170dc51ff2145dEmilio López struct drm_device *dev = nv_crtc->base.dev; 92dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai struct drm_connector *connector; 93c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López struct drm_crtc *crtc = to_drm_crtc(nv_crtc); 94bf6534a180d6d596521b0bfa6de29da5e18314a6Maxime Ripard 95c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 96c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López if (connector->encoder && connector->encoder->crtc == crtc) 97c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López return nouveau_connector(connector); 98c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López } 99c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López 100dfb12c0c35b6cca5e55f40870b65af87988adb3eChen-Yu Tsai return NULL; 101c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López} 102bf6534a180d6d596521b0bfa6de29da5e18314a6Maxime Ripard 103c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio Lópezstruct drm_connector * 104c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio Lópeznouveau_connector_create(struct drm_device *, int index); 105c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López 106c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López#endif /* __NOUVEAU_CONNECTOR_H__ */ 107c3e5e66b65a57df8025cbf59801d9c357cf807eaEmilio López