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;
32
NVPtr pNv = NVPTR(pScrn);
33
xf86MonPtr rval = NULL;
35
NVWrite(pNv, NV50_CONNECTOR_I2C_PORT(connector->pDDCBus->DriverPrivate.val), NV50_I2C_START);
37
rval = xf86DoEDID_DDC2(pScrn->scrnIndex, connector->pDDCBus);
39
NVWrite(pNv, NV50_CONNECTOR_I2C_PORT(connector->pDDCBus->DriverPrivate.val), NV50_I2C_STOP);
45
NV50ConnectorDDCDetect(nouveauConnectorPtr connector)
47
ScrnInfoPtr pScrn = connector->scrn;
50
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV50ConnectorDDCDetect is called.\n");
52
if (!connector->pDDCBus)
55
ddc_mon = NV50ConnectorGetEDID(connector);
61
NV50ConnectorGetDDCModes(nouveauConnectorPtr connector)
63
ScrnInfoPtr pScrn = connector->scrn;
66
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "NV50ConnectorGetDDCModes is called.\n");
68
ddc_mon = NV50ConnectorGetEDID(connector);
73
return xf86DDCGetModes(pScrn->scrnIndex, ddc_mon);
77
NV50ConnectorInit(ScrnInfoPtr pScrn)
80
NVPtr pNv = NVPTR(pScrn);
82
/* Maybe a bit overdone, because often only 3 or 4 connectors are present. */
83
for (i = 0; i < MAX_NUM_DCB_ENTRIES; i++) {
84
nouveauConnectorPtr connector = xnfcalloc(sizeof(nouveauConnectorRec), 1);
85
connector->scrn = pScrn;
88
char connector_name[20];
89
sprintf(connector_name, "Connector-%d", i);
90
connector->name = xstrdup(connector_name);
92
/* Function pointers. */
93
connector->DDCDetect = NV50ConnectorDDCDetect;
94
connector->GetDDCModes = NV50ConnectorGetDDCModes;
95
connector->HotplugDetect = NULL;
97
pNv->connector[i] = connector;
102
NV50ConnectorDestroy(ScrnInfoPtr pScrn)
105
NVPtr pNv = NVPTR(pScrn);
107
/* Maybe a bit overdone, because often only 3 or 4 connectors are present. */
108
for (i = 0; i < MAX_NUM_DCB_ENTRIES; i++) {
109
nouveauConnectorPtr connector = pNv->connector[i];
111
xfree(connector->name);
113
pNv->connector[i] = NULL;