2009-12-11 16:24:15 +07:00
|
|
|
/*
|
|
|
|
* Copyright 2009 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Ben Skeggs
|
|
|
|
*/
|
|
|
|
|
2012-10-03 00:01:07 +07:00
|
|
|
#include <drm/drmP.h>
|
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm merge (part 1) from Dave Airlie:
"So first of all my tree and uapi stuff has a conflict mess, its my
fault as the nouveau stuff didn't hit -next as were trying to rebase
regressions out of it before we merged.
Highlights:
- SH mobile modesetting driver and associated helpers
- some DRM core documentation
- i915 modesetting rework, haswell hdmi, haswell and vlv fixes, write
combined pte writing, ilk rc6 support,
- nouveau: major driver rework into a hw core driver, makes features
like SLI a lot saner to implement,
- psb: add eDP/DP support for Cedarview
- radeon: 2 layer page tables, async VM pte updates, better PLL
selection for > 2 screens, better ACPI interactions
The rest is general grab bag of fixes.
So why part 1? well I have the exynos pull req which came in a bit
late but was waiting for me to do something they shouldn't have and it
looks fairly safe, and David Howells has some more header cleanups
he'd like me to pull, that seem like a good idea, but I'd like to get
this merge out of the way so -next dosen't get blocked."
Tons of conflicts mostly due to silly include line changes, but mostly
mindless. A few other small semantic conflicts too, noted from Dave's
pre-merged branch.
* 'drm-next' of git://people.freedesktop.org/~airlied/linux: (447 commits)
drm/nv98/crypt: fix fuc build with latest envyas
drm/nouveau/devinit: fixup various issues with subdev ctor/init ordering
drm/nv41/vm: fix and enable use of "real" pciegart
drm/nv44/vm: fix and enable use of "real" pciegart
drm/nv04/dmaobj: fixup vm target handling in preparation for nv4x pcie
drm/nouveau: store supported dma mask in vmmgr
drm/nvc0/ibus: initial implementation of subdev
drm/nouveau/therm: add support for fan-control modes
drm/nouveau/hwmon: rename pwm0* to pmw1* to follow hwmon's rules
drm/nouveau/therm: calculate the pwm divisor on nv50+
drm/nouveau/fan: rewrite the fan tachometer driver to get more precision, faster
drm/nouveau/therm: move thermal-related functions to the therm subdev
drm/nouveau/bios: parse the pwm divisor from the perf table
drm/nouveau/therm: use the EXTDEV table to detect i2c monitoring devices
drm/nouveau/therm: rework thermal table parsing
drm/nouveau/gpio: expose the PWM/TOGGLE parameter found in the gpio vbios table
drm/nouveau: fix pm initialization order
drm/nouveau/bios: check that fixed tvdac gpio data is valid before using it
drm/nouveau: log channel debug/error messages from client object rather than drm client
drm/nouveau: have drm debugging macros build on top of core macros
...
2012-10-04 13:29:23 +07:00
|
|
|
#include <drm/drm_dp_helper.h>
|
2010-07-23 08:39:03 +07:00
|
|
|
|
2012-07-31 13:16:21 +07:00
|
|
|
#include "nouveau_drm.h"
|
2010-07-23 08:39:03 +07:00
|
|
|
#include "nouveau_connector.h"
|
2009-12-11 16:24:15 +07:00
|
|
|
#include "nouveau_encoder.h"
|
2011-08-04 06:26:44 +07:00
|
|
|
#include "nouveau_crtc.h"
|
2009-12-11 16:24:15 +07:00
|
|
|
|
2012-05-15 03:05:49 +07:00
|
|
|
static void
|
2015-08-20 11:54:15 +07:00
|
|
|
nouveau_dp_probe_oui(struct drm_device *dev, struct nvkm_i2c_aux *aux, u8 *dpcd)
|
2012-05-15 03:05:49 +07:00
|
|
|
{
|
2012-07-31 13:16:21 +07:00
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
2012-05-15 03:05:49 +07:00
|
|
|
u8 buf[3];
|
|
|
|
|
|
|
|
if (!(dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT))
|
|
|
|
return;
|
|
|
|
|
2015-08-20 11:54:15 +07:00
|
|
|
if (!nvkm_rdaux(aux, DP_SINK_OUI, buf, 3))
|
2012-07-31 13:16:21 +07:00
|
|
|
NV_DEBUG(drm, "Sink OUI: %02hx%02hx%02hx\n",
|
2012-05-15 03:05:49 +07:00
|
|
|
buf[0], buf[1], buf[2]);
|
|
|
|
|
2015-08-20 11:54:15 +07:00
|
|
|
if (!nvkm_rdaux(aux, DP_BRANCH_OUI, buf, 3))
|
2012-07-31 13:16:21 +07:00
|
|
|
NV_DEBUG(drm, "Branch OUI: %02hx%02hx%02hx\n",
|
2012-05-15 03:05:49 +07:00
|
|
|
buf[0], buf[1], buf[2]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-06-06 15:09:55 +07:00
|
|
|
int
|
|
|
|
nouveau_dp_detect(struct nouveau_encoder *nv_encoder)
|
2009-12-11 16:24:15 +07:00
|
|
|
{
|
2014-06-06 15:09:55 +07:00
|
|
|
struct drm_device *dev = nv_encoder->base.base.dev;
|
2012-07-31 13:16:21 +07:00
|
|
|
struct nouveau_drm *drm = nouveau_drm(dev);
|
2015-08-20 11:54:15 +07:00
|
|
|
struct nvkm_i2c_aux *aux;
|
2011-08-04 11:31:28 +07:00
|
|
|
u8 *dpcd = nv_encoder->dp.dpcd;
|
2009-12-11 16:24:15 +07:00
|
|
|
int ret;
|
|
|
|
|
2015-08-20 11:54:15 +07:00
|
|
|
aux = nv_encoder->aux;
|
|
|
|
if (!aux)
|
2014-06-06 15:09:55 +07:00
|
|
|
return -ENODEV;
|
2011-08-04 11:31:28 +07:00
|
|
|
|
2015-08-20 11:54:15 +07:00
|
|
|
ret = nvkm_rdaux(aux, DP_DPCD_REV, dpcd, 8);
|
2009-12-11 16:24:15 +07:00
|
|
|
if (ret)
|
2014-06-06 15:09:55 +07:00
|
|
|
return ret;
|
2009-12-11 16:24:15 +07:00
|
|
|
|
2011-08-04 06:55:44 +07:00
|
|
|
nv_encoder->dp.link_bw = 27000 * dpcd[1];
|
|
|
|
nv_encoder->dp.link_nr = dpcd[2] & DP_MAX_LANE_COUNT_MASK;
|
2009-12-11 16:24:15 +07:00
|
|
|
|
2012-07-31 13:16:21 +07:00
|
|
|
NV_DEBUG(drm, "display: %dx%d dpcd 0x%02x\n",
|
2011-08-04 06:55:44 +07:00
|
|
|
nv_encoder->dp.link_nr, nv_encoder->dp.link_bw, dpcd[0]);
|
2012-07-31 13:16:21 +07:00
|
|
|
NV_DEBUG(drm, "encoder: %dx%d\n",
|
2011-08-04 06:55:44 +07:00
|
|
|
nv_encoder->dcb->dpconf.link_nr,
|
|
|
|
nv_encoder->dcb->dpconf.link_bw);
|
2009-12-11 16:24:15 +07:00
|
|
|
|
2011-08-04 06:55:44 +07:00
|
|
|
if (nv_encoder->dcb->dpconf.link_nr < nv_encoder->dp.link_nr)
|
2009-12-11 16:24:15 +07:00
|
|
|
nv_encoder->dp.link_nr = nv_encoder->dcb->dpconf.link_nr;
|
2011-08-04 06:55:44 +07:00
|
|
|
if (nv_encoder->dcb->dpconf.link_bw < nv_encoder->dp.link_bw)
|
|
|
|
nv_encoder->dp.link_bw = nv_encoder->dcb->dpconf.link_bw;
|
2009-12-11 16:24:15 +07:00
|
|
|
|
2012-07-31 13:16:21 +07:00
|
|
|
NV_DEBUG(drm, "maximum: %dx%d\n",
|
2011-08-04 06:55:44 +07:00
|
|
|
nv_encoder->dp.link_nr, nv_encoder->dp.link_bw);
|
2010-09-27 05:29:33 +07:00
|
|
|
|
2015-08-20 11:54:15 +07:00
|
|
|
nouveau_dp_probe_oui(dev, aux, dpcd);
|
2014-06-06 15:09:55 +07:00
|
|
|
return 0;
|
2009-12-11 16:24:15 +07:00
|
|
|
}
|