2 * Copyright 2008 Maarten Maathuis
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #include "nouveau_modeset.h"
24 #include "nouveau_crtc.h"
25 #include "nouveau_output.h"
26 #include "nouveau_connector.h"
29 NV50ConnectorGetEDID(nouveauConnectorPtr connector)
31 ScrnInfoPtr pScrn = connector->scrn;
33 return xf86DoEDID_DDC2(pScrn->scrnIndex, connector->pDDCBus);
37 NV50ConnectorDDCDetect(nouveauConnectorPtr connector)
39 ScrnInfoPtr pScrn = connector->scrn;
42 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV50ConnectorDDCDetect is called.\n");
44 if (!connector->pDDCBus)
47 ddc_mon = NV50ConnectorGetEDID(connector);
53 NV50ConnectorGetDDCModes(nouveauConnectorPtr connector)
55 ScrnInfoPtr pScrn = connector->scrn;
58 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV50ConnectorGetDDCModes is called.\n");
60 ddc_mon = NV50ConnectorGetEDID(connector);
65 return xf86DDCGetModes(pScrn->scrnIndex, ddc_mon);
69 NV50ConnectorInit(ScrnInfoPtr pScrn)
72 NVPtr pNv = NVPTR(pScrn);
74 /* Maybe a bit overdone, because often only 3 or 4 connectors are present. */
75 for (i = 0; i < MAX_NUM_DCB_ENTRIES; i++) {
76 nouveauConnectorPtr connector = xnfcalloc(sizeof(nouveauConnectorRec), 1);
77 connector->scrn = pScrn;
80 char connector_name[20];
81 sprintf(connector_name, "Connector-%d", i);
82 connector->name = xstrdup(connector_name);
84 /* Function pointers. */
85 connector->DDCDetect = NV50ConnectorDDCDetect;
86 connector->GetDDCModes = NV50ConnectorGetDDCModes;
87 connector->HotplugDetect = NULL;
89 pNv->connector[i] = connector;
94 NV50ConnectorDestroy(ScrnInfoPtr pScrn)
97 NVPtr pNv = NVPTR(pScrn);
99 /* Maybe a bit overdone, because often only 3 or 4 connectors are present. */
100 for (i = 0; i < MAX_NUM_DCB_ENTRIES; i++) {
101 nouveauConnectorPtr connector = pNv->connector[i];
103 xfree(connector->name);
105 pNv->connector[i] = NULL;