mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (28 commits) drm: remove unused #include <linux/version.h>'s drm/radeon: fix driver initialization order so radeon kms can be builtin drm: Fix shifts which were miscalculated when converting from bitfields. drm/radeon: Clear surface registers at initialization time. drm/radeon: Don't initialize acceleration related fields of struct fb_info. drm/radeon: fix radeon kms framebuffer device drm/i915: initialize fence registers to zero when loading GEM drm/i915: Fix HDMI regression introduced in new chipset support drm/i915: fix LFP data fetch drm/i915: set TV detection mode when tv is already connected drm/i915: Catch up to obj_priv->page_list rename in disabled debug code. drm/i915: Fix size_t handling in off-by-default debug printfs drm/i915: Don't change the blank/sync width when calculating scaled modes drm/i915: Add support for changing LVDS panel fitting using an output property. drm/i915: correct suspend/resume ordering drm/i915: Add missing dependency on Intel AGP support. drm/i915: Generate 2MHz clock for display port aux channel I/O. Retry I/O. drm/i915: Clarify error returns from display port aux channel I/O drm/i915: Add CLKCFG register definition drm/i915: Split array of DAC limits into separate structures. ...
This commit is contained in:
commit
987fed3bf6
39 changed files with 2394 additions and 334 deletions
|
@ -81,6 +81,7 @@ config DRM_I830
|
|||
|
||||
config DRM_I915
|
||||
tristate "i915 driver"
|
||||
depends on AGP_INTEL
|
||||
select FB_CFB_FILLRECT
|
||||
select FB_CFB_COPYAREA
|
||||
select FB_CFB_IMAGEBLIT
|
||||
|
|
|
@ -16,6 +16,7 @@ drm-y := drm_auth.o drm_bufs.o drm_cache.o \
|
|||
drm-$(CONFIG_COMPAT) += drm_ioc32.o
|
||||
|
||||
obj-$(CONFIG_DRM) += drm.o
|
||||
obj-$(CONFIG_DRM_TTM) += ttm/
|
||||
obj-$(CONFIG_DRM_TDFX) += tdfx/
|
||||
obj-$(CONFIG_DRM_R128) += r128/
|
||||
obj-$(CONFIG_DRM_RADEON)+= radeon/
|
||||
|
@ -26,4 +27,3 @@ obj-$(CONFIG_DRM_I915) += i915/
|
|||
obj-$(CONFIG_DRM_SIS) += sis/
|
||||
obj-$(CONFIG_DRM_SAVAGE)+= savage/
|
||||
obj-$(CONFIG_DRM_VIA) +=via/
|
||||
obj-$(CONFIG_DRM_TTM) += ttm/
|
||||
|
|
|
@ -294,10 +294,10 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
|
|||
unsigned vactive = (pt->vactive_vblank_hi & 0xf0) << 4 | pt->vactive_lo;
|
||||
unsigned hblank = (pt->hactive_hblank_hi & 0xf) << 8 | pt->hblank_lo;
|
||||
unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo;
|
||||
unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 8 | pt->hsync_offset_lo;
|
||||
unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 6 | pt->hsync_pulse_width_lo;
|
||||
unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) | (pt->vsync_offset_pulse_width_lo & 0xf);
|
||||
unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) >> 2 | pt->vsync_offset_pulse_width_lo >> 4;
|
||||
unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo;
|
||||
unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse_width_lo;
|
||||
unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) >> 2 | pt->vsync_offset_pulse_width_lo >> 4;
|
||||
unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offset_pulse_width_lo & 0xf);
|
||||
|
||||
/* ignore tiny modes */
|
||||
if (hactive < 64 || vactive < 64)
|
||||
|
@ -347,8 +347,8 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
|
|||
mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
|
||||
DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
|
||||
|
||||
mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf) << 8;
|
||||
mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4;
|
||||
mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4;
|
||||
mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf) << 8;
|
||||
|
||||
if (quirks & EDID_QUIRK_DETAILED_IN_CM) {
|
||||
mode->width_mm *= 10;
|
||||
|
|
|
@ -13,6 +13,8 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o i915_mem.o \
|
|||
intel_crt.o \
|
||||
intel_lvds.o \
|
||||
intel_bios.o \
|
||||
intel_dp.o \
|
||||
intel_dp_i2c.o \
|
||||
intel_hdmi.o \
|
||||
intel_sdvo.o \
|
||||
intel_modes.o \
|
||||
|
|
|
@ -37,7 +37,7 @@ struct intel_dvo_device {
|
|||
/* GPIO register used for i2c bus to control this device */
|
||||
u32 gpio;
|
||||
int slave_addr;
|
||||
struct intel_i2c_chan *i2c_bus;
|
||||
struct i2c_adapter *i2c_bus;
|
||||
|
||||
const struct intel_dvo_dev_ops *dev_ops;
|
||||
void *dev_priv;
|
||||
|
@ -52,7 +52,7 @@ struct intel_dvo_dev_ops {
|
|||
* Returns NULL if the device does not exist.
|
||||
*/
|
||||
bool (*init)(struct intel_dvo_device *dvo,
|
||||
struct intel_i2c_chan *i2cbus);
|
||||
struct i2c_adapter *i2cbus);
|
||||
|
||||
/*
|
||||
* Called to allow the output a chance to create properties after the
|
||||
|
|
|
@ -176,19 +176,20 @@ static void ch7017_dpms(struct intel_dvo_device *dvo, int mode);
|
|||
|
||||
static bool ch7017_read(struct intel_dvo_device *dvo, int addr, uint8_t *val)
|
||||
{
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
u8 out_buf[2];
|
||||
u8 in_buf[2];
|
||||
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 1,
|
||||
.buf = out_buf,
|
||||
},
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = I2C_M_RD,
|
||||
.len = 1,
|
||||
.buf = in_buf,
|
||||
|
@ -208,10 +209,11 @@ static bool ch7017_read(struct intel_dvo_device *dvo, int addr, uint8_t *val)
|
|||
|
||||
static bool ch7017_write(struct intel_dvo_device *dvo, int addr, uint8_t val)
|
||||
{
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
uint8_t out_buf[2];
|
||||
struct i2c_msg msg = {
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 2,
|
||||
.buf = out_buf,
|
||||
|
@ -228,8 +230,9 @@ static bool ch7017_write(struct intel_dvo_device *dvo, int addr, uint8_t val)
|
|||
|
||||
/** Probes for a CH7017 on the given bus and slave address. */
|
||||
static bool ch7017_init(struct intel_dvo_device *dvo,
|
||||
struct intel_i2c_chan *i2cbus)
|
||||
struct i2c_adapter *adapter)
|
||||
{
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
struct ch7017_priv *priv;
|
||||
uint8_t val;
|
||||
|
||||
|
@ -237,8 +240,7 @@ static bool ch7017_init(struct intel_dvo_device *dvo,
|
|||
if (priv == NULL)
|
||||
return false;
|
||||
|
||||
dvo->i2c_bus = i2cbus;
|
||||
dvo->i2c_bus->slave_addr = dvo->slave_addr;
|
||||
dvo->i2c_bus = adapter;
|
||||
dvo->dev_priv = priv;
|
||||
|
||||
if (!ch7017_read(dvo, CH7017_DEVICE_ID, &val))
|
||||
|
@ -248,7 +250,7 @@ static bool ch7017_init(struct intel_dvo_device *dvo,
|
|||
val != CH7018_DEVICE_ID_VALUE &&
|
||||
val != CH7019_DEVICE_ID_VALUE) {
|
||||
DRM_DEBUG("ch701x not detected, got %d: from %s Slave %d.\n",
|
||||
val, i2cbus->adapter.name,i2cbus->slave_addr);
|
||||
val, i2cbus->adapter.name,dvo->slave_addr);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,19 +123,20 @@ static char *ch7xxx_get_id(uint8_t vid)
|
|||
static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
||||
{
|
||||
struct ch7xxx_priv *ch7xxx= dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
u8 out_buf[2];
|
||||
u8 in_buf[2];
|
||||
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 1,
|
||||
.buf = out_buf,
|
||||
},
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = I2C_M_RD,
|
||||
.len = 1,
|
||||
.buf = in_buf,
|
||||
|
@ -152,7 +153,7 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
|||
|
||||
if (!ch7xxx->quiet) {
|
||||
DRM_DEBUG("Unable to read register 0x%02x from %s:%02x.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -161,10 +162,11 @@ static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
|||
static bool ch7xxx_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
||||
{
|
||||
struct ch7xxx_priv *ch7xxx = dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
uint8_t out_buf[2];
|
||||
struct i2c_msg msg = {
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 2,
|
||||
.buf = out_buf,
|
||||
|
@ -178,14 +180,14 @@ static bool ch7xxx_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
|||
|
||||
if (!ch7xxx->quiet) {
|
||||
DRM_DEBUG("Unable to write register 0x%02x to %s:%d.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool ch7xxx_init(struct intel_dvo_device *dvo,
|
||||
struct intel_i2c_chan *i2cbus)
|
||||
struct i2c_adapter *adapter)
|
||||
{
|
||||
/* this will detect the CH7xxx chip on the specified i2c bus */
|
||||
struct ch7xxx_priv *ch7xxx;
|
||||
|
@ -196,8 +198,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo,
|
|||
if (ch7xxx == NULL)
|
||||
return false;
|
||||
|
||||
dvo->i2c_bus = i2cbus;
|
||||
dvo->i2c_bus->slave_addr = dvo->slave_addr;
|
||||
dvo->i2c_bus = adapter;
|
||||
dvo->dev_priv = ch7xxx;
|
||||
ch7xxx->quiet = true;
|
||||
|
||||
|
@ -207,7 +208,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo,
|
|||
name = ch7xxx_get_id(vendor);
|
||||
if (!name) {
|
||||
DRM_DEBUG("ch7xxx not detected; got 0x%02x from %s slave %d.\n",
|
||||
vendor, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
vendor, adapter->name, dvo->slave_addr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -217,7 +218,7 @@ static bool ch7xxx_init(struct intel_dvo_device *dvo,
|
|||
|
||||
if (device != CH7xxx_DID) {
|
||||
DRM_DEBUG("ch7xxx not detected; got 0x%02x from %s slave %d.\n",
|
||||
vendor, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
vendor, adapter->name, dvo->slave_addr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -169,13 +169,14 @@ static void ivch_dump_regs(struct intel_dvo_device *dvo);
|
|||
static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data)
|
||||
{
|
||||
struct ivch_priv *priv = dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
u8 out_buf[1];
|
||||
u8 in_buf[2];
|
||||
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = I2C_M_RD,
|
||||
.len = 0,
|
||||
},
|
||||
|
@ -186,7 +187,7 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data)
|
|||
.buf = out_buf,
|
||||
},
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = I2C_M_RD | I2C_M_NOSTART,
|
||||
.len = 2,
|
||||
.buf = in_buf,
|
||||
|
@ -202,7 +203,7 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data)
|
|||
|
||||
if (!priv->quiet) {
|
||||
DRM_DEBUG("Unable to read register 0x%02x from %s:%02x.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -211,10 +212,11 @@ static bool ivch_read(struct intel_dvo_device *dvo, int addr, uint16_t *data)
|
|||
static bool ivch_write(struct intel_dvo_device *dvo, int addr, uint16_t data)
|
||||
{
|
||||
struct ivch_priv *priv = dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
u8 out_buf[3];
|
||||
struct i2c_msg msg = {
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 3,
|
||||
.buf = out_buf,
|
||||
|
@ -229,7 +231,7 @@ static bool ivch_write(struct intel_dvo_device *dvo, int addr, uint16_t data)
|
|||
|
||||
if (!priv->quiet) {
|
||||
DRM_DEBUG("Unable to write register 0x%02x to %s:%d.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -237,7 +239,7 @@ static bool ivch_write(struct intel_dvo_device *dvo, int addr, uint16_t data)
|
|||
|
||||
/** Probes the given bus and slave address for an ivch */
|
||||
static bool ivch_init(struct intel_dvo_device *dvo,
|
||||
struct intel_i2c_chan *i2cbus)
|
||||
struct i2c_adapter *adapter)
|
||||
{
|
||||
struct ivch_priv *priv;
|
||||
uint16_t temp;
|
||||
|
@ -246,8 +248,7 @@ static bool ivch_init(struct intel_dvo_device *dvo,
|
|||
if (priv == NULL)
|
||||
return false;
|
||||
|
||||
dvo->i2c_bus = i2cbus;
|
||||
dvo->i2c_bus->slave_addr = dvo->slave_addr;
|
||||
dvo->i2c_bus = adapter;
|
||||
dvo->dev_priv = priv;
|
||||
priv->quiet = true;
|
||||
|
||||
|
|
|
@ -76,19 +76,20 @@ struct sil164_priv {
|
|||
static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
||||
{
|
||||
struct sil164_priv *sil = dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
u8 out_buf[2];
|
||||
u8 in_buf[2];
|
||||
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 1,
|
||||
.buf = out_buf,
|
||||
},
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = I2C_M_RD,
|
||||
.len = 1,
|
||||
.buf = in_buf,
|
||||
|
@ -105,7 +106,7 @@ static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
|||
|
||||
if (!sil->quiet) {
|
||||
DRM_DEBUG("Unable to read register 0x%02x from %s:%02x.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -113,10 +114,11 @@ static bool sil164_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
|||
static bool sil164_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
||||
{
|
||||
struct sil164_priv *sil= dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
uint8_t out_buf[2];
|
||||
struct i2c_msg msg = {
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 2,
|
||||
.buf = out_buf,
|
||||
|
@ -130,7 +132,7 @@ static bool sil164_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
|||
|
||||
if (!sil->quiet) {
|
||||
DRM_DEBUG("Unable to write register 0x%02x to %s:%d.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -138,7 +140,7 @@ static bool sil164_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
|||
|
||||
/* Silicon Image 164 driver for chip on i2c bus */
|
||||
static bool sil164_init(struct intel_dvo_device *dvo,
|
||||
struct intel_i2c_chan *i2cbus)
|
||||
struct i2c_adapter *adapter)
|
||||
{
|
||||
/* this will detect the SIL164 chip on the specified i2c bus */
|
||||
struct sil164_priv *sil;
|
||||
|
@ -148,8 +150,7 @@ static bool sil164_init(struct intel_dvo_device *dvo,
|
|||
if (sil == NULL)
|
||||
return false;
|
||||
|
||||
dvo->i2c_bus = i2cbus;
|
||||
dvo->i2c_bus->slave_addr = dvo->slave_addr;
|
||||
dvo->i2c_bus = adapter;
|
||||
dvo->dev_priv = sil;
|
||||
sil->quiet = true;
|
||||
|
||||
|
@ -158,7 +159,7 @@ static bool sil164_init(struct intel_dvo_device *dvo,
|
|||
|
||||
if (ch != (SIL164_VID & 0xff)) {
|
||||
DRM_DEBUG("sil164 not detected got %d: from %s Slave %d.\n",
|
||||
ch, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
ch, adapter->name, dvo->slave_addr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -167,7 +168,7 @@ static bool sil164_init(struct intel_dvo_device *dvo,
|
|||
|
||||
if (ch != (SIL164_DID & 0xff)) {
|
||||
DRM_DEBUG("sil164 not detected got %d: from %s Slave %d.\n",
|
||||
ch, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
ch, adapter->name, dvo->slave_addr);
|
||||
goto out;
|
||||
}
|
||||
sil->quiet = false;
|
||||
|
|
|
@ -101,19 +101,20 @@ struct tfp410_priv {
|
|||
static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
||||
{
|
||||
struct tfp410_priv *tfp = dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
u8 out_buf[2];
|
||||
u8 in_buf[2];
|
||||
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 1,
|
||||
.buf = out_buf,
|
||||
},
|
||||
{
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = I2C_M_RD,
|
||||
.len = 1,
|
||||
.buf = in_buf,
|
||||
|
@ -130,7 +131,7 @@ static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
|||
|
||||
if (!tfp->quiet) {
|
||||
DRM_DEBUG("Unable to read register 0x%02x from %s:%02x.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -138,10 +139,11 @@ static bool tfp410_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
|
|||
static bool tfp410_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
||||
{
|
||||
struct tfp410_priv *tfp = dvo->dev_priv;
|
||||
struct intel_i2c_chan *i2cbus = dvo->i2c_bus;
|
||||
struct i2c_adapter *adapter = dvo->i2c_bus;
|
||||
struct intel_i2c_chan *i2cbus = container_of(adapter, struct intel_i2c_chan, adapter);
|
||||
uint8_t out_buf[2];
|
||||
struct i2c_msg msg = {
|
||||
.addr = i2cbus->slave_addr,
|
||||
.addr = dvo->slave_addr,
|
||||
.flags = 0,
|
||||
.len = 2,
|
||||
.buf = out_buf,
|
||||
|
@ -155,7 +157,7 @@ static bool tfp410_writeb(struct intel_dvo_device *dvo, int addr, uint8_t ch)
|
|||
|
||||
if (!tfp->quiet) {
|
||||
DRM_DEBUG("Unable to write register 0x%02x to %s:%d.\n",
|
||||
addr, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
addr, i2cbus->adapter.name, dvo->slave_addr);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -174,7 +176,7 @@ static int tfp410_getid(struct intel_dvo_device *dvo, int addr)
|
|||
|
||||
/* Ti TFP410 driver for chip on i2c bus */
|
||||
static bool tfp410_init(struct intel_dvo_device *dvo,
|
||||
struct intel_i2c_chan *i2cbus)
|
||||
struct i2c_adapter *adapter)
|
||||
{
|
||||
/* this will detect the tfp410 chip on the specified i2c bus */
|
||||
struct tfp410_priv *tfp;
|
||||
|
@ -184,20 +186,19 @@ static bool tfp410_init(struct intel_dvo_device *dvo,
|
|||
if (tfp == NULL)
|
||||
return false;
|
||||
|
||||
dvo->i2c_bus = i2cbus;
|
||||
dvo->i2c_bus->slave_addr = dvo->slave_addr;
|
||||
dvo->i2c_bus = adapter;
|
||||
dvo->dev_priv = tfp;
|
||||
tfp->quiet = true;
|
||||
|
||||
if ((id = tfp410_getid(dvo, TFP410_VID_LO)) != TFP410_VID) {
|
||||
DRM_DEBUG("tfp410 not detected got VID %X: from %s Slave %d.\n",
|
||||
id, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
id, adapter->name, dvo->slave_addr);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((id = tfp410_getid(dvo, TFP410_DID_LO)) != TFP410_DID) {
|
||||
DRM_DEBUG("tfp410 not detected got DID %X: from %s Slave %d.\n",
|
||||
id, i2cbus->adapter.name, i2cbus->slave_addr);
|
||||
id, adapter->name, dvo->slave_addr);
|
||||
goto out;
|
||||
}
|
||||
tfp->quiet = false;
|
||||
|
|
|
@ -67,8 +67,6 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
|
|||
|
||||
pci_save_state(dev->pdev);
|
||||
|
||||
i915_save_state(dev);
|
||||
|
||||
/* If KMS is active, we do the leavevt stuff here */
|
||||
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||
if (i915_gem_idle(dev))
|
||||
|
@ -77,6 +75,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
|
|||
drm_irq_uninstall(dev);
|
||||
}
|
||||
|
||||
i915_save_state(dev);
|
||||
|
||||
intel_opregion_free(dev, 1);
|
||||
|
||||
if (state.event == PM_EVENT_SUSPEND) {
|
||||
|
|
|
@ -306,6 +306,17 @@ typedef struct drm_i915_private {
|
|||
u32 saveCURBPOS;
|
||||
u32 saveCURBBASE;
|
||||
u32 saveCURSIZE;
|
||||
u32 saveDP_B;
|
||||
u32 saveDP_C;
|
||||
u32 saveDP_D;
|
||||
u32 savePIPEA_GMCH_DATA_M;
|
||||
u32 savePIPEB_GMCH_DATA_M;
|
||||
u32 savePIPEA_GMCH_DATA_N;
|
||||
u32 savePIPEB_GMCH_DATA_N;
|
||||
u32 savePIPEA_DP_LINK_M;
|
||||
u32 savePIPEB_DP_LINK_M;
|
||||
u32 savePIPEA_DP_LINK_N;
|
||||
u32 savePIPEB_DP_LINK_N;
|
||||
|
||||
struct {
|
||||
struct drm_mm gtt_space;
|
||||
|
@ -857,6 +868,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
|
|||
#define HAS_128_BYTE_Y_TILING(dev) (IS_I9XX(dev) && !(IS_I915G(dev) || \
|
||||
IS_I915GM(dev)))
|
||||
#define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev))
|
||||
#define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev))
|
||||
#define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev))
|
||||
|
||||
#define PRIMARY_RINGBUFFER_SIZE (128*1024)
|
||||
|
|
|
@ -1006,7 +1006,7 @@ i915_gem_set_domain_ioctl(struct drm_device *dev, void *data,
|
|||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
#if WATCH_BUF
|
||||
DRM_INFO("set_domain_ioctl %p(%d), %08x %08x\n",
|
||||
DRM_INFO("set_domain_ioctl %p(%zd), %08x %08x\n",
|
||||
obj, obj->size, read_domains, write_domain);
|
||||
#endif
|
||||
if (read_domains & I915_GEM_DOMAIN_GTT) {
|
||||
|
@ -1050,7 +1050,7 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
|
|||
}
|
||||
|
||||
#if WATCH_BUF
|
||||
DRM_INFO("%s: sw_finish %d (%p %d)\n",
|
||||
DRM_INFO("%s: sw_finish %d (%p %zd)\n",
|
||||
__func__, args->handle, obj, obj->size);
|
||||
#endif
|
||||
obj_priv = obj->driver_private;
|
||||
|
@ -2423,7 +2423,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
|
|||
}
|
||||
|
||||
#if WATCH_BUF
|
||||
DRM_INFO("Binding object of size %d at 0x%08x\n",
|
||||
DRM_INFO("Binding object of size %zd at 0x%08x\n",
|
||||
obj->size, obj_priv->gtt_offset);
|
||||
#endif
|
||||
ret = i915_gem_object_get_pages(obj);
|
||||
|
@ -4227,6 +4227,7 @@ i915_gem_lastclose(struct drm_device *dev)
|
|||
void
|
||||
i915_gem_load(struct drm_device *dev)
|
||||
{
|
||||
int i;
|
||||
drm_i915_private_t *dev_priv = dev->dev_private;
|
||||
|
||||
spin_lock_init(&dev_priv->mm.active_list_lock);
|
||||
|
@ -4246,6 +4247,18 @@ i915_gem_load(struct drm_device *dev)
|
|||
else
|
||||
dev_priv->num_fence_regs = 8;
|
||||
|
||||
/* Initialize fence registers to zero */
|
||||
if (IS_I965G(dev)) {
|
||||
for (i = 0; i < 16; i++)
|
||||
I915_WRITE64(FENCE_REG_965_0 + (i * 8), 0);
|
||||
} else {
|
||||
for (i = 0; i < 8; i++)
|
||||
I915_WRITE(FENCE_REG_830_0 + (i * 4), 0);
|
||||
if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
|
||||
for (i = 0; i < 8; i++)
|
||||
I915_WRITE(FENCE_REG_945_8 + (i * 4), 0);
|
||||
}
|
||||
|
||||
i915_gem_detect_bit_6_swizzle(dev);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ i915_gem_dump_object(struct drm_gem_object *obj, int len,
|
|||
chunk_len = page_len - chunk;
|
||||
if (chunk_len > 128)
|
||||
chunk_len = 128;
|
||||
i915_gem_dump_page(obj_priv->page_list[page],
|
||||
i915_gem_dump_page(obj_priv->pages[page],
|
||||
chunk, chunk + chunk_len,
|
||||
obj_priv->gtt_offset +
|
||||
page * PAGE_SIZE,
|
||||
|
@ -143,7 +143,7 @@ i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle)
|
|||
uint32_t *backing_map = NULL;
|
||||
int bad_count = 0;
|
||||
|
||||
DRM_INFO("%s: checking coherency of object %p@0x%08x (%d, %dkb):\n",
|
||||
DRM_INFO("%s: checking coherency of object %p@0x%08x (%d, %zdkb):\n",
|
||||
__func__, obj, obj_priv->gtt_offset, handle,
|
||||
obj->size / 1024);
|
||||
|
||||
|
@ -157,7 +157,7 @@ i915_gem_object_check_coherency(struct drm_gem_object *obj, int handle)
|
|||
for (page = 0; page < obj->size / PAGE_SIZE; page++) {
|
||||
int i;
|
||||
|
||||
backing_map = kmap_atomic(obj_priv->page_list[page], KM_USER0);
|
||||
backing_map = kmap_atomic(obj_priv->pages[page], KM_USER0);
|
||||
|
||||
if (backing_map == NULL) {
|
||||
DRM_ERROR("failed to map backing page\n");
|
||||
|
|
|
@ -114,11 +114,13 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
|
|||
mchbar_addr = ((u64)temp_hi << 32) | temp_lo;
|
||||
|
||||
/* If ACPI doesn't have it, assume we need to allocate it ourselves */
|
||||
#ifdef CONFIG_PNP
|
||||
if (mchbar_addr &&
|
||||
pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) {
|
||||
ret = 0;
|
||||
goto out_put;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get some space for it */
|
||||
ret = pci_bus_alloc_resource(bridge_dev->bus, &dev_priv->mch_res,
|
||||
|
|
|
@ -232,7 +232,17 @@ static void i915_hotplug_work_func(struct work_struct *work)
|
|||
drm_i915_private_t *dev_priv = container_of(work, drm_i915_private_t,
|
||||
hotplug_work);
|
||||
struct drm_device *dev = dev_priv->dev;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct drm_connector *connector;
|
||||
|
||||
if (mode_config->num_connector) {
|
||||
list_for_each_entry(connector, &mode_config->connector_list, head) {
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
|
||||
if (intel_output->hot_plug)
|
||||
(*intel_output->hot_plug) (intel_output);
|
||||
}
|
||||
}
|
||||
/* Just fire off a uevent and let userspace tell us what to do */
|
||||
drm_sysfs_hotplug_event(dev);
|
||||
}
|
||||
|
|
|
@ -569,6 +569,19 @@
|
|||
#define C0DRB3 0x10206
|
||||
#define C1DRB3 0x10606
|
||||
|
||||
/* Clocking configuration register */
|
||||
#define CLKCFG 0x10c00
|
||||
#define CLKCFG_FSB_400 (0 << 0) /* hrawclk 100 */
|
||||
#define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */
|
||||
#define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */
|
||||
#define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */
|
||||
#define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */
|
||||
#define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */
|
||||
/* this is a guess, could be 5 as well */
|
||||
#define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */
|
||||
#define CLKCFG_FSB_1600_ALT (5 << 0) /* hrawclk 400 */
|
||||
#define CLKCFG_FSB_MASK (7 << 0)
|
||||
|
||||
/** GM965 GM45 render standby register */
|
||||
#define MCHBAR_RENDER_STANDBY 0x111B8
|
||||
|
||||
|
@ -834,9 +847,25 @@
|
|||
#define HORIZ_INTERP_MASK (3 << 6)
|
||||
#define HORIZ_AUTO_SCALE (1 << 5)
|
||||
#define PANEL_8TO6_DITHER_ENABLE (1 << 3)
|
||||
#define PFIT_FILTER_FUZZY (0 << 24)
|
||||
#define PFIT_SCALING_AUTO (0 << 26)
|
||||
#define PFIT_SCALING_PROGRAMMED (1 << 26)
|
||||
#define PFIT_SCALING_PILLAR (2 << 26)
|
||||
#define PFIT_SCALING_LETTER (3 << 26)
|
||||
#define PFIT_PGM_RATIOS 0x61234
|
||||
#define PFIT_VERT_SCALE_MASK 0xfff00000
|
||||
#define PFIT_HORIZ_SCALE_MASK 0x0000fff0
|
||||
/* Pre-965 */
|
||||
#define PFIT_VERT_SCALE_SHIFT 20
|
||||
#define PFIT_VERT_SCALE_MASK 0xfff00000
|
||||
#define PFIT_HORIZ_SCALE_SHIFT 4
|
||||
#define PFIT_HORIZ_SCALE_MASK 0x0000fff0
|
||||
/* 965+ */
|
||||
#define PFIT_VERT_SCALE_SHIFT_965 16
|
||||
#define PFIT_VERT_SCALE_MASK_965 0x1fff0000
|
||||
#define PFIT_HORIZ_SCALE_SHIFT_965 0
|
||||
#define PFIT_HORIZ_SCALE_MASK_965 0x00001fff
|
||||
|
||||
#define PFIT_AUTO_RATIOS 0x61238
|
||||
|
||||
/* Backlight control */
|
||||
|
|
|
@ -322,6 +322,20 @@ int i915_save_state(struct drm_device *dev)
|
|||
dev_priv->savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS);
|
||||
dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR);
|
||||
|
||||
/* Display Port state */
|
||||
if (SUPPORTS_INTEGRATED_DP(dev)) {
|
||||
dev_priv->saveDP_B = I915_READ(DP_B);
|
||||
dev_priv->saveDP_C = I915_READ(DP_C);
|
||||
dev_priv->saveDP_D = I915_READ(DP_D);
|
||||
dev_priv->savePIPEA_GMCH_DATA_M = I915_READ(PIPEA_GMCH_DATA_M);
|
||||
dev_priv->savePIPEB_GMCH_DATA_M = I915_READ(PIPEB_GMCH_DATA_M);
|
||||
dev_priv->savePIPEA_GMCH_DATA_N = I915_READ(PIPEA_GMCH_DATA_N);
|
||||
dev_priv->savePIPEB_GMCH_DATA_N = I915_READ(PIPEB_GMCH_DATA_N);
|
||||
dev_priv->savePIPEA_DP_LINK_M = I915_READ(PIPEA_DP_LINK_M);
|
||||
dev_priv->savePIPEB_DP_LINK_M = I915_READ(PIPEB_DP_LINK_M);
|
||||
dev_priv->savePIPEA_DP_LINK_N = I915_READ(PIPEA_DP_LINK_N);
|
||||
dev_priv->savePIPEB_DP_LINK_N = I915_READ(PIPEB_DP_LINK_N);
|
||||
}
|
||||
/* FIXME: save TV & SDVO state */
|
||||
|
||||
/* FBC state */
|
||||
|
@ -404,7 +418,19 @@ int i915_restore_state(struct drm_device *dev)
|
|||
for (i = 0; i < 8; i++)
|
||||
I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]);
|
||||
}
|
||||
|
||||
|
||||
/* Display port ratios (must be done before clock is set) */
|
||||
if (SUPPORTS_INTEGRATED_DP(dev)) {
|
||||
I915_WRITE(PIPEA_GMCH_DATA_M, dev_priv->savePIPEA_GMCH_DATA_M);
|
||||
I915_WRITE(PIPEB_GMCH_DATA_M, dev_priv->savePIPEB_GMCH_DATA_M);
|
||||
I915_WRITE(PIPEA_GMCH_DATA_N, dev_priv->savePIPEA_GMCH_DATA_N);
|
||||
I915_WRITE(PIPEB_GMCH_DATA_N, dev_priv->savePIPEB_GMCH_DATA_N);
|
||||
I915_WRITE(PIPEA_DP_LINK_M, dev_priv->savePIPEA_DP_LINK_M);
|
||||
I915_WRITE(PIPEB_DP_LINK_M, dev_priv->savePIPEB_DP_LINK_M);
|
||||
I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N);
|
||||
I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N);
|
||||
}
|
||||
|
||||
/* Pipe & plane A info */
|
||||
/* Prime the clock */
|
||||
if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) {
|
||||
|
@ -518,6 +544,12 @@ int i915_restore_state(struct drm_device *dev)
|
|||
I915_WRITE(PP_DIVISOR, dev_priv->savePP_DIVISOR);
|
||||
I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL);
|
||||
|
||||
/* Display Port state */
|
||||
if (SUPPORTS_INTEGRATED_DP(dev)) {
|
||||
I915_WRITE(DP_B, dev_priv->saveDP_B);
|
||||
I915_WRITE(DP_C, dev_priv->saveDP_C);
|
||||
I915_WRITE(DP_D, dev_priv->saveDP_D);
|
||||
}
|
||||
/* FIXME: restore TV & SDVO state */
|
||||
|
||||
/* FBC info */
|
||||
|
|
|
@ -99,9 +99,11 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
|
|||
{
|
||||
struct bdb_lvds_options *lvds_options;
|
||||
struct bdb_lvds_lfp_data *lvds_lfp_data;
|
||||
struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;
|
||||
struct bdb_lvds_lfp_data_entry *entry;
|
||||
struct lvds_dvo_timing *dvo_timing;
|
||||
struct drm_display_mode *panel_fixed_mode;
|
||||
int lfp_data_size;
|
||||
|
||||
/* Defaults if we can't find VBT info */
|
||||
dev_priv->lvds_dither = 0;
|
||||
|
@ -119,9 +121,17 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
|
|||
if (!lvds_lfp_data)
|
||||
return;
|
||||
|
||||
lvds_lfp_data_ptrs = find_section(bdb, BDB_LVDS_LFP_DATA_PTRS);
|
||||
if (!lvds_lfp_data_ptrs)
|
||||
return;
|
||||
|
||||
dev_priv->lvds_vbt = 1;
|
||||
|
||||
entry = &lvds_lfp_data->data[lvds_options->panel_type];
|
||||
lfp_data_size = lvds_lfp_data_ptrs->ptr[1].dvo_timing_offset -
|
||||
lvds_lfp_data_ptrs->ptr[0].dvo_timing_offset;
|
||||
entry = (struct bdb_lvds_lfp_data_entry *)
|
||||
((uint8_t *)lvds_lfp_data->data + (lfp_data_size *
|
||||
lvds_options->panel_type));
|
||||
dvo_timing = &entry->dvo_timing;
|
||||
|
||||
panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "intel_drv.h"
|
||||
#include "i915_drm.h"
|
||||
#include "i915_drv.h"
|
||||
#include "intel_dp.h"
|
||||
|
||||
#include "drm_crtc_helper.h"
|
||||
|
||||
|
@ -127,19 +128,6 @@ struct intel_limit {
|
|||
#define I9XX_P2_LVDS_FAST 7
|
||||
#define I9XX_P2_LVDS_SLOW_LIMIT 112000
|
||||
|
||||
#define INTEL_LIMIT_I8XX_DVO_DAC 0
|
||||
#define INTEL_LIMIT_I8XX_LVDS 1
|
||||
#define INTEL_LIMIT_I9XX_SDVO_DAC 2
|
||||
#define INTEL_LIMIT_I9XX_LVDS 3
|
||||
#define INTEL_LIMIT_G4X_SDVO 4
|
||||
#define INTEL_LIMIT_G4X_HDMI_DAC 5
|
||||
#define INTEL_LIMIT_G4X_SINGLE_CHANNEL_LVDS 6
|
||||
#define INTEL_LIMIT_G4X_DUAL_CHANNEL_LVDS 7
|
||||
#define INTEL_LIMIT_IGD_SDVO_DAC 8
|
||||
#define INTEL_LIMIT_IGD_LVDS 9
|
||||
#define INTEL_LIMIT_IGDNG_SDVO_DAC 10
|
||||
#define INTEL_LIMIT_IGDNG_LVDS 11
|
||||
|
||||
/*The parameter is for SDVO on G4x platform*/
|
||||
#define G4X_DOT_SDVO_MIN 25000
|
||||
#define G4X_DOT_SDVO_MAX 270000
|
||||
|
@ -218,6 +206,25 @@ struct intel_limit {
|
|||
#define G4X_P2_DUAL_CHANNEL_LVDS_FAST 7
|
||||
#define G4X_P2_DUAL_CHANNEL_LVDS_LIMIT 0
|
||||
|
||||
/*The parameter is for DISPLAY PORT on G4x platform*/
|
||||
#define G4X_DOT_DISPLAY_PORT_MIN 161670
|
||||
#define G4X_DOT_DISPLAY_PORT_MAX 227000
|
||||
#define G4X_N_DISPLAY_PORT_MIN 1
|
||||
#define G4X_N_DISPLAY_PORT_MAX 2
|
||||
#define G4X_M_DISPLAY_PORT_MIN 97
|
||||
#define G4X_M_DISPLAY_PORT_MAX 108
|
||||
#define G4X_M1_DISPLAY_PORT_MIN 0x10
|
||||
#define G4X_M1_DISPLAY_PORT_MAX 0x12
|
||||
#define G4X_M2_DISPLAY_PORT_MIN 0x05
|
||||
#define G4X_M2_DISPLAY_PORT_MAX 0x06
|
||||
#define G4X_P_DISPLAY_PORT_MIN 10
|
||||
#define G4X_P_DISPLAY_PORT_MAX 20
|
||||
#define G4X_P1_DISPLAY_PORT_MIN 1
|
||||
#define G4X_P1_DISPLAY_PORT_MAX 2
|
||||
#define G4X_P2_DISPLAY_PORT_SLOW 10
|
||||
#define G4X_P2_DISPLAY_PORT_FAST 10
|
||||
#define G4X_P2_DISPLAY_PORT_LIMIT 0
|
||||
|
||||
/* IGDNG */
|
||||
/* as we calculate clock using (register_value + 2) for
|
||||
N/M1/M2, so here the range value for them is (actual_value-2).
|
||||
|
@ -256,8 +263,11 @@ static bool
|
|||
intel_igdng_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
|
||||
int target, int refclk, intel_clock_t *best_clock);
|
||||
|
||||
static const intel_limit_t intel_limits[] = {
|
||||
{ /* INTEL_LIMIT_I8XX_DVO_DAC */
|
||||
static bool
|
||||
intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc,
|
||||
int target, int refclk, intel_clock_t *best_clock);
|
||||
|
||||
static const intel_limit_t intel_limits_i8xx_dvo = {
|
||||
.dot = { .min = I8XX_DOT_MIN, .max = I8XX_DOT_MAX },
|
||||
.vco = { .min = I8XX_VCO_MIN, .max = I8XX_VCO_MAX },
|
||||
.n = { .min = I8XX_N_MIN, .max = I8XX_N_MAX },
|
||||
|
@ -269,8 +279,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2 = { .dot_limit = I8XX_P2_SLOW_LIMIT,
|
||||
.p2_slow = I8XX_P2_SLOW, .p2_fast = I8XX_P2_FAST },
|
||||
.find_pll = intel_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_I8XX_LVDS */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_i8xx_lvds = {
|
||||
.dot = { .min = I8XX_DOT_MIN, .max = I8XX_DOT_MAX },
|
||||
.vco = { .min = I8XX_VCO_MIN, .max = I8XX_VCO_MAX },
|
||||
.n = { .min = I8XX_N_MIN, .max = I8XX_N_MAX },
|
||||
|
@ -282,8 +293,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2 = { .dot_limit = I8XX_P2_SLOW_LIMIT,
|
||||
.p2_slow = I8XX_P2_LVDS_SLOW, .p2_fast = I8XX_P2_LVDS_FAST },
|
||||
.find_pll = intel_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_I9XX_SDVO_DAC */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_i9xx_sdvo = {
|
||||
.dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX },
|
||||
.vco = { .min = I9XX_VCO_MIN, .max = I9XX_VCO_MAX },
|
||||
.n = { .min = I9XX_N_MIN, .max = I9XX_N_MAX },
|
||||
|
@ -295,8 +307,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2 = { .dot_limit = I9XX_P2_SDVO_DAC_SLOW_LIMIT,
|
||||
.p2_slow = I9XX_P2_SDVO_DAC_SLOW, .p2_fast = I9XX_P2_SDVO_DAC_FAST },
|
||||
.find_pll = intel_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_I9XX_LVDS */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_i9xx_lvds = {
|
||||
.dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX },
|
||||
.vco = { .min = I9XX_VCO_MIN, .max = I9XX_VCO_MAX },
|
||||
.n = { .min = I9XX_N_MIN, .max = I9XX_N_MAX },
|
||||
|
@ -311,9 +324,10 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2 = { .dot_limit = I9XX_P2_LVDS_SLOW_LIMIT,
|
||||
.p2_slow = I9XX_P2_LVDS_SLOW, .p2_fast = I9XX_P2_LVDS_FAST },
|
||||
.find_pll = intel_find_best_PLL,
|
||||
},
|
||||
};
|
||||
|
||||
/* below parameter and function is for G4X Chipset Family*/
|
||||
{ /* INTEL_LIMIT_G4X_SDVO */
|
||||
static const intel_limit_t intel_limits_g4x_sdvo = {
|
||||
.dot = { .min = G4X_DOT_SDVO_MIN, .max = G4X_DOT_SDVO_MAX },
|
||||
.vco = { .min = G4X_VCO_MIN, .max = G4X_VCO_MAX},
|
||||
.n = { .min = G4X_N_SDVO_MIN, .max = G4X_N_SDVO_MAX },
|
||||
|
@ -327,8 +341,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2_fast = G4X_P2_SDVO_FAST
|
||||
},
|
||||
.find_pll = intel_g4x_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_G4X_HDMI_DAC */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_g4x_hdmi = {
|
||||
.dot = { .min = G4X_DOT_HDMI_DAC_MIN, .max = G4X_DOT_HDMI_DAC_MAX },
|
||||
.vco = { .min = G4X_VCO_MIN, .max = G4X_VCO_MAX},
|
||||
.n = { .min = G4X_N_HDMI_DAC_MIN, .max = G4X_N_HDMI_DAC_MAX },
|
||||
|
@ -342,8 +357,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2_fast = G4X_P2_HDMI_DAC_FAST
|
||||
},
|
||||
.find_pll = intel_g4x_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_G4X_SINGLE_CHANNEL_LVDS */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_g4x_single_channel_lvds = {
|
||||
.dot = { .min = G4X_DOT_SINGLE_CHANNEL_LVDS_MIN,
|
||||
.max = G4X_DOT_SINGLE_CHANNEL_LVDS_MAX },
|
||||
.vco = { .min = G4X_VCO_MIN,
|
||||
|
@ -365,8 +381,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2_fast = G4X_P2_SINGLE_CHANNEL_LVDS_FAST
|
||||
},
|
||||
.find_pll = intel_g4x_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_G4X_DUAL_CHANNEL_LVDS */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_g4x_dual_channel_lvds = {
|
||||
.dot = { .min = G4X_DOT_DUAL_CHANNEL_LVDS_MIN,
|
||||
.max = G4X_DOT_DUAL_CHANNEL_LVDS_MAX },
|
||||
.vco = { .min = G4X_VCO_MIN,
|
||||
|
@ -388,8 +405,32 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2_fast = G4X_P2_DUAL_CHANNEL_LVDS_FAST
|
||||
},
|
||||
.find_pll = intel_g4x_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_IGD_SDVO */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_g4x_display_port = {
|
||||
.dot = { .min = G4X_DOT_DISPLAY_PORT_MIN,
|
||||
.max = G4X_DOT_DISPLAY_PORT_MAX },
|
||||
.vco = { .min = G4X_VCO_MIN,
|
||||
.max = G4X_VCO_MAX},
|
||||
.n = { .min = G4X_N_DISPLAY_PORT_MIN,
|
||||
.max = G4X_N_DISPLAY_PORT_MAX },
|
||||
.m = { .min = G4X_M_DISPLAY_PORT_MIN,
|
||||
.max = G4X_M_DISPLAY_PORT_MAX },
|
||||
.m1 = { .min = G4X_M1_DISPLAY_PORT_MIN,
|
||||
.max = G4X_M1_DISPLAY_PORT_MAX },
|
||||
.m2 = { .min = G4X_M2_DISPLAY_PORT_MIN,
|
||||
.max = G4X_M2_DISPLAY_PORT_MAX },
|
||||
.p = { .min = G4X_P_DISPLAY_PORT_MIN,
|
||||
.max = G4X_P_DISPLAY_PORT_MAX },
|
||||
.p1 = { .min = G4X_P1_DISPLAY_PORT_MIN,
|
||||
.max = G4X_P1_DISPLAY_PORT_MAX},
|
||||
.p2 = { .dot_limit = G4X_P2_DISPLAY_PORT_LIMIT,
|
||||
.p2_slow = G4X_P2_DISPLAY_PORT_SLOW,
|
||||
.p2_fast = G4X_P2_DISPLAY_PORT_FAST },
|
||||
.find_pll = intel_find_pll_g4x_dp,
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_igd_sdvo = {
|
||||
.dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX},
|
||||
.vco = { .min = IGD_VCO_MIN, .max = IGD_VCO_MAX },
|
||||
.n = { .min = IGD_N_MIN, .max = IGD_N_MAX },
|
||||
|
@ -401,8 +442,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2 = { .dot_limit = I9XX_P2_SDVO_DAC_SLOW_LIMIT,
|
||||
.p2_slow = I9XX_P2_SDVO_DAC_SLOW, .p2_fast = I9XX_P2_SDVO_DAC_FAST },
|
||||
.find_pll = intel_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_IGD_LVDS */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_igd_lvds = {
|
||||
.dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX },
|
||||
.vco = { .min = IGD_VCO_MIN, .max = IGD_VCO_MAX },
|
||||
.n = { .min = IGD_N_MIN, .max = IGD_N_MAX },
|
||||
|
@ -415,8 +457,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2 = { .dot_limit = I9XX_P2_LVDS_SLOW_LIMIT,
|
||||
.p2_slow = I9XX_P2_LVDS_SLOW, .p2_fast = I9XX_P2_LVDS_SLOW },
|
||||
.find_pll = intel_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_IGDNG_SDVO_DAC */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_igdng_sdvo = {
|
||||
.dot = { .min = IGDNG_DOT_MIN, .max = IGDNG_DOT_MAX },
|
||||
.vco = { .min = IGDNG_VCO_MIN, .max = IGDNG_VCO_MAX },
|
||||
.n = { .min = IGDNG_N_MIN, .max = IGDNG_N_MAX },
|
||||
|
@ -429,8 +472,9 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2_slow = IGDNG_P2_SDVO_DAC_SLOW,
|
||||
.p2_fast = IGDNG_P2_SDVO_DAC_FAST },
|
||||
.find_pll = intel_igdng_find_best_PLL,
|
||||
},
|
||||
{ /* INTEL_LIMIT_IGDNG_LVDS */
|
||||
};
|
||||
|
||||
static const intel_limit_t intel_limits_igdng_lvds = {
|
||||
.dot = { .min = IGDNG_DOT_MIN, .max = IGDNG_DOT_MAX },
|
||||
.vco = { .min = IGDNG_VCO_MIN, .max = IGDNG_VCO_MAX },
|
||||
.n = { .min = IGDNG_N_MIN, .max = IGDNG_N_MAX },
|
||||
|
@ -443,16 +487,15 @@ static const intel_limit_t intel_limits[] = {
|
|||
.p2_slow = IGDNG_P2_LVDS_SLOW,
|
||||
.p2_fast = IGDNG_P2_LVDS_FAST },
|
||||
.find_pll = intel_igdng_find_best_PLL,
|
||||
},
|
||||
};
|
||||
|
||||
static const intel_limit_t *intel_igdng_limit(struct drm_crtc *crtc)
|
||||
{
|
||||
const intel_limit_t *limit;
|
||||
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
|
||||
limit = &intel_limits[INTEL_LIMIT_IGDNG_LVDS];
|
||||
limit = &intel_limits_igdng_lvds;
|
||||
else
|
||||
limit = &intel_limits[INTEL_LIMIT_IGDNG_SDVO_DAC];
|
||||
limit = &intel_limits_igdng_sdvo;
|
||||
|
||||
return limit;
|
||||
}
|
||||
|
@ -467,19 +510,19 @@ static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
|
|||
if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
|
||||
LVDS_CLKB_POWER_UP)
|
||||
/* LVDS with dual channel */
|
||||
limit = &intel_limits
|
||||
[INTEL_LIMIT_G4X_DUAL_CHANNEL_LVDS];
|
||||
limit = &intel_limits_g4x_dual_channel_lvds;
|
||||
else
|
||||
/* LVDS with dual channel */
|
||||
limit = &intel_limits
|
||||
[INTEL_LIMIT_G4X_SINGLE_CHANNEL_LVDS];
|
||||
limit = &intel_limits_g4x_single_channel_lvds;
|
||||
} else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI) ||
|
||||
intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) {
|
||||
limit = &intel_limits[INTEL_LIMIT_G4X_HDMI_DAC];
|
||||
limit = &intel_limits_g4x_hdmi;
|
||||
} else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_SDVO)) {
|
||||
limit = &intel_limits[INTEL_LIMIT_G4X_SDVO];
|
||||
limit = &intel_limits_g4x_sdvo;
|
||||
} else if (intel_pipe_has_type (crtc, INTEL_OUTPUT_DISPLAYPORT)) {
|
||||
limit = &intel_limits_g4x_display_port;
|
||||
} else /* The option is for other outputs */
|
||||
limit = &intel_limits[INTEL_LIMIT_I9XX_SDVO_DAC];
|
||||
limit = &intel_limits_i9xx_sdvo;
|
||||
|
||||
return limit;
|
||||
}
|
||||
|
@ -495,19 +538,19 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
|
|||
limit = intel_g4x_limit(crtc);
|
||||
} else if (IS_I9XX(dev) && !IS_IGD(dev)) {
|
||||
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
|
||||
limit = &intel_limits[INTEL_LIMIT_I9XX_LVDS];
|
||||
limit = &intel_limits_i9xx_lvds;
|
||||
else
|
||||
limit = &intel_limits[INTEL_LIMIT_I9XX_SDVO_DAC];
|
||||
limit = &intel_limits_i9xx_sdvo;
|
||||
} else if (IS_IGD(dev)) {
|
||||
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
|
||||
limit = &intel_limits[INTEL_LIMIT_IGD_LVDS];
|
||||
limit = &intel_limits_igd_lvds;
|
||||
else
|
||||
limit = &intel_limits[INTEL_LIMIT_IGD_SDVO_DAC];
|
||||
limit = &intel_limits_igd_sdvo;
|
||||
} else {
|
||||
if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
|
||||
limit = &intel_limits[INTEL_LIMIT_I8XX_LVDS];
|
||||
limit = &intel_limits_i8xx_lvds;
|
||||
else
|
||||
limit = &intel_limits[INTEL_LIMIT_I8XX_DVO_DAC];
|
||||
limit = &intel_limits_i8xx_dvo;
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
@ -764,6 +807,35 @@ out:
|
|||
return found;
|
||||
}
|
||||
|
||||
/* DisplayPort has only two frequencies, 162MHz and 270MHz */
|
||||
static bool
|
||||
intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc,
|
||||
int target, int refclk, intel_clock_t *best_clock)
|
||||
{
|
||||
intel_clock_t clock;
|
||||
if (target < 200000) {
|
||||
clock.dot = 161670;
|
||||
clock.p = 20;
|
||||
clock.p1 = 2;
|
||||
clock.p2 = 10;
|
||||
clock.n = 0x01;
|
||||
clock.m = 97;
|
||||
clock.m1 = 0x10;
|
||||
clock.m2 = 0x05;
|
||||
} else {
|
||||
clock.dot = 270000;
|
||||
clock.p = 10;
|
||||
clock.p1 = 1;
|
||||
clock.p2 = 10;
|
||||
clock.n = 0x02;
|
||||
clock.m = 108;
|
||||
clock.m1 = 0x12;
|
||||
clock.m2 = 0x06;
|
||||
}
|
||||
memcpy(best_clock, &clock, sizeof(intel_clock_t));
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
intel_wait_for_vblank(struct drm_device *dev)
|
||||
{
|
||||
|
@ -1541,7 +1613,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
|
|||
intel_clock_t clock;
|
||||
u32 dpll = 0, fp = 0, dspcntr, pipeconf;
|
||||
bool ok, is_sdvo = false, is_dvo = false;
|
||||
bool is_crt = false, is_lvds = false, is_tv = false;
|
||||
bool is_crt = false, is_lvds = false, is_tv = false, is_dp = false;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
struct drm_connector *connector;
|
||||
const intel_limit_t *limit;
|
||||
|
@ -1585,6 +1657,9 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
|
|||
case INTEL_OUTPUT_ANALOG:
|
||||
is_crt = true;
|
||||
break;
|
||||
case INTEL_OUTPUT_DISPLAYPORT:
|
||||
is_dp = true;
|
||||
break;
|
||||
}
|
||||
|
||||
num_outputs++;
|
||||
|
@ -1600,6 +1675,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
|
|||
} else {
|
||||
refclk = 48000;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns a set of divisors for the desired target clock with the given
|
||||
|
@ -1662,6 +1738,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
|
|||
else if (IS_IGDNG(dev))
|
||||
dpll |= (sdvo_pixel_multiply - 1) << PLL_REF_SDVO_HDMI_MULTIPLIER_SHIFT;
|
||||
}
|
||||
if (is_dp)
|
||||
dpll |= DPLL_DVO_HIGH_SPEED;
|
||||
|
||||
/* compute bitmask from p1 value */
|
||||
if (IS_IGD(dev))
|
||||
|
@ -1809,6 +1887,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
|
|||
I915_WRITE(lvds_reg, lvds);
|
||||
I915_READ(lvds_reg);
|
||||
}
|
||||
if (is_dp)
|
||||
intel_dp_set_m_n(crtc, mode, adjusted_mode);
|
||||
|
||||
I915_WRITE(fp_reg, fp);
|
||||
I915_WRITE(dpll_reg, dpll);
|
||||
|
@ -2475,6 +2555,8 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|||
found = intel_sdvo_init(dev, SDVOB);
|
||||
if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
|
||||
intel_hdmi_init(dev, SDVOB);
|
||||
if (!found && SUPPORTS_INTEGRATED_DP(dev))
|
||||
intel_dp_init(dev, DP_B);
|
||||
}
|
||||
|
||||
/* Before G4X SDVOC doesn't have its own detect register */
|
||||
|
@ -2487,7 +2569,11 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|||
found = intel_sdvo_init(dev, SDVOC);
|
||||
if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
|
||||
intel_hdmi_init(dev, SDVOC);
|
||||
if (!found && SUPPORTS_INTEGRATED_DP(dev))
|
||||
intel_dp_init(dev, DP_C);
|
||||
}
|
||||
if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED))
|
||||
intel_dp_init(dev, DP_D);
|
||||
} else
|
||||
intel_dvo_init(dev);
|
||||
|
||||
|
@ -2530,6 +2616,11 @@ static void intel_setup_outputs(struct drm_device *dev)
|
|||
(1 << 1));
|
||||
clone_mask = (1 << INTEL_OUTPUT_TVOUT);
|
||||
break;
|
||||
case INTEL_OUTPUT_DISPLAYPORT:
|
||||
crtc_mask = ((1 << 0) |
|
||||
(1 << 1));
|
||||
clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT);
|
||||
break;
|
||||
}
|
||||
encoder->possible_crtcs = crtc_mask;
|
||||
encoder->possible_clones = intel_connector_clones(dev, clone_mask);
|
||||
|
|
1153
drivers/gpu/drm/i915/intel_dp.c
Normal file
1153
drivers/gpu/drm/i915/intel_dp.c
Normal file
File diff suppressed because it is too large
Load diff
144
drivers/gpu/drm/i915/intel_dp.h
Normal file
144
drivers/gpu/drm/i915/intel_dp.h
Normal file
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright © 2008 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _INTEL_DP_H_
|
||||
#define _INTEL_DP_H_
|
||||
|
||||
/* From the VESA DisplayPort spec */
|
||||
|
||||
#define AUX_NATIVE_WRITE 0x8
|
||||
#define AUX_NATIVE_READ 0x9
|
||||
#define AUX_I2C_WRITE 0x0
|
||||
#define AUX_I2C_READ 0x1
|
||||
#define AUX_I2C_STATUS 0x2
|
||||
#define AUX_I2C_MOT 0x4
|
||||
|
||||
#define AUX_NATIVE_REPLY_ACK (0x0 << 4)
|
||||
#define AUX_NATIVE_REPLY_NACK (0x1 << 4)
|
||||
#define AUX_NATIVE_REPLY_DEFER (0x2 << 4)
|
||||
#define AUX_NATIVE_REPLY_MASK (0x3 << 4)
|
||||
|
||||
#define AUX_I2C_REPLY_ACK (0x0 << 6)
|
||||
#define AUX_I2C_REPLY_NACK (0x1 << 6)
|
||||
#define AUX_I2C_REPLY_DEFER (0x2 << 6)
|
||||
#define AUX_I2C_REPLY_MASK (0x3 << 6)
|
||||
|
||||
/* AUX CH addresses */
|
||||
#define DP_LINK_BW_SET 0x100
|
||||
# define DP_LINK_BW_1_62 0x06
|
||||
# define DP_LINK_BW_2_7 0x0a
|
||||
|
||||
#define DP_LANE_COUNT_SET 0x101
|
||||
# define DP_LANE_COUNT_MASK 0x0f
|
||||
# define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7)
|
||||
|
||||
#define DP_TRAINING_PATTERN_SET 0x102
|
||||
|
||||
# define DP_TRAINING_PATTERN_DISABLE 0
|
||||
# define DP_TRAINING_PATTERN_1 1
|
||||
# define DP_TRAINING_PATTERN_2 2
|
||||
# define DP_TRAINING_PATTERN_MASK 0x3
|
||||
|
||||
# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2)
|
||||
# define DP_LINK_QUAL_PATTERN_D10_2 (1 << 2)
|
||||
# define DP_LINK_QUAL_PATTERN_ERROR_RATE (2 << 2)
|
||||
# define DP_LINK_QUAL_PATTERN_PRBS7 (3 << 2)
|
||||
# define DP_LINK_QUAL_PATTERN_MASK (3 << 2)
|
||||
|
||||
# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4)
|
||||
# define DP_LINK_SCRAMBLING_DISABLE (1 << 5)
|
||||
|
||||
# define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6)
|
||||
# define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6)
|
||||
# define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6)
|
||||
# define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6)
|
||||
|
||||
#define DP_TRAINING_LANE0_SET 0x103
|
||||
#define DP_TRAINING_LANE1_SET 0x104
|
||||
#define DP_TRAINING_LANE2_SET 0x105
|
||||
#define DP_TRAINING_LANE3_SET 0x106
|
||||
|
||||
# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3
|
||||
# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0
|
||||
# define DP_TRAIN_MAX_SWING_REACHED (1 << 2)
|
||||
# define DP_TRAIN_VOLTAGE_SWING_400 (0 << 0)
|
||||
# define DP_TRAIN_VOLTAGE_SWING_600 (1 << 0)
|
||||
# define DP_TRAIN_VOLTAGE_SWING_800 (2 << 0)
|
||||
# define DP_TRAIN_VOLTAGE_SWING_1200 (3 << 0)
|
||||
|
||||
# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3)
|
||||
# define DP_TRAIN_PRE_EMPHASIS_0 (0 << 3)
|
||||
# define DP_TRAIN_PRE_EMPHASIS_3_5 (1 << 3)
|
||||
# define DP_TRAIN_PRE_EMPHASIS_6 (2 << 3)
|
||||
# define DP_TRAIN_PRE_EMPHASIS_9_5 (3 << 3)
|
||||
|
||||
# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3
|
||||
# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5)
|
||||
|
||||
#define DP_DOWNSPREAD_CTRL 0x107
|
||||
# define DP_SPREAD_AMP_0_5 (1 << 4)
|
||||
|
||||
#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108
|
||||
# define DP_SET_ANSI_8B10B (1 << 0)
|
||||
|
||||
#define DP_LANE0_1_STATUS 0x202
|
||||
#define DP_LANE2_3_STATUS 0x203
|
||||
|
||||
# define DP_LANE_CR_DONE (1 << 0)
|
||||
# define DP_LANE_CHANNEL_EQ_DONE (1 << 1)
|
||||
# define DP_LANE_SYMBOL_LOCKED (1 << 2)
|
||||
|
||||
#define DP_LANE_ALIGN_STATUS_UPDATED 0x204
|
||||
|
||||
#define DP_INTERLANE_ALIGN_DONE (1 << 0)
|
||||
#define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6)
|
||||
#define DP_LINK_STATUS_UPDATED (1 << 7)
|
||||
|
||||
#define DP_SINK_STATUS 0x205
|
||||
|
||||
#define DP_RECEIVE_PORT_0_STATUS (1 << 0)
|
||||
#define DP_RECEIVE_PORT_1_STATUS (1 << 1)
|
||||
|
||||
#define DP_ADJUST_REQUEST_LANE0_1 0x206
|
||||
#define DP_ADJUST_REQUEST_LANE2_3 0x207
|
||||
|
||||
#define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03
|
||||
#define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0
|
||||
#define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c
|
||||
#define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2
|
||||
#define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30
|
||||
#define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4
|
||||
#define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0
|
||||
#define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6
|
||||
|
||||
struct i2c_algo_dp_aux_data {
|
||||
bool running;
|
||||
u16 address;
|
||||
int (*aux_ch) (struct i2c_adapter *adapter,
|
||||
uint8_t *send, int send_bytes,
|
||||
uint8_t *recv, int recv_bytes);
|
||||
};
|
||||
|
||||
int
|
||||
i2c_dp_aux_add_bus(struct i2c_adapter *adapter);
|
||||
|
||||
#endif /* _INTEL_DP_H_ */
|
272
drivers/gpu/drm/i915/intel_dp_i2c.c
Normal file
272
drivers/gpu/drm/i915/intel_dp_i2c.c
Normal file
|
@ -0,0 +1,272 @@
|
|||
/*
|
||||
* Copyright © 2009 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/i2c.h>
|
||||
#include "intel_dp.h"
|
||||
|
||||
/* Run a single AUX_CH I2C transaction, writing/reading data as necessary */
|
||||
|
||||
#define MODE_I2C_START 1
|
||||
#define MODE_I2C_WRITE 2
|
||||
#define MODE_I2C_READ 4
|
||||
#define MODE_I2C_STOP 8
|
||||
|
||||
static int
|
||||
i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode,
|
||||
uint8_t write_byte, uint8_t *read_byte)
|
||||
{
|
||||
struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data;
|
||||
uint16_t address = algo_data->address;
|
||||
uint8_t msg[5];
|
||||
uint8_t reply[2];
|
||||
int msg_bytes;
|
||||
int reply_bytes;
|
||||
int ret;
|
||||
|
||||
/* Set up the command byte */
|
||||
if (mode & MODE_I2C_READ)
|
||||
msg[0] = AUX_I2C_READ << 4;
|
||||
else
|
||||
msg[0] = AUX_I2C_WRITE << 4;
|
||||
|
||||
if (!(mode & MODE_I2C_STOP))
|
||||
msg[0] |= AUX_I2C_MOT << 4;
|
||||
|
||||
msg[1] = address >> 8;
|
||||
msg[2] = address;
|
||||
|
||||
switch (mode) {
|
||||
case MODE_I2C_WRITE:
|
||||
msg[3] = 0;
|
||||
msg[4] = write_byte;
|
||||
msg_bytes = 5;
|
||||
reply_bytes = 1;
|
||||
break;
|
||||
case MODE_I2C_READ:
|
||||
msg[3] = 0;
|
||||
msg_bytes = 4;
|
||||
reply_bytes = 2;
|
||||
break;
|
||||
default:
|
||||
msg_bytes = 3;
|
||||
reply_bytes = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
ret = (*algo_data->aux_ch)(adapter,
|
||||
msg, msg_bytes,
|
||||
reply, reply_bytes);
|
||||
if (ret < 0) {
|
||||
printk(KERN_ERR "aux_ch failed %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
switch (reply[0] & AUX_I2C_REPLY_MASK) {
|
||||
case AUX_I2C_REPLY_ACK:
|
||||
if (mode == MODE_I2C_READ) {
|
||||
*read_byte = reply[1];
|
||||
}
|
||||
return reply_bytes - 1;
|
||||
case AUX_I2C_REPLY_NACK:
|
||||
printk(KERN_ERR "aux_ch nack\n");
|
||||
return -EREMOTEIO;
|
||||
case AUX_I2C_REPLY_DEFER:
|
||||
printk(KERN_ERR "aux_ch defer\n");
|
||||
udelay(100);
|
||||
break;
|
||||
default:
|
||||
printk(KERN_ERR "aux_ch invalid reply 0x%02x\n", reply[0]);
|
||||
return -EREMOTEIO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* I2C over AUX CH
|
||||
*/
|
||||
|
||||
/*
|
||||
* Send the address. If the I2C link is running, this 'restarts'
|
||||
* the connection with the new address, this is used for doing
|
||||
* a write followed by a read (as needed for DDC)
|
||||
*/
|
||||
static int
|
||||
i2c_algo_dp_aux_address(struct i2c_adapter *adapter, u16 address, bool reading)
|
||||
{
|
||||
struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data;
|
||||
int mode = MODE_I2C_START;
|
||||
int ret;
|
||||
|
||||
if (reading)
|
||||
mode |= MODE_I2C_READ;
|
||||
else
|
||||
mode |= MODE_I2C_WRITE;
|
||||
algo_data->address = address;
|
||||
algo_data->running = true;
|
||||
ret = i2c_algo_dp_aux_transaction(adapter, mode, 0, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop the I2C transaction. This closes out the link, sending
|
||||
* a bare address packet with the MOT bit turned off
|
||||
*/
|
||||
static void
|
||||
i2c_algo_dp_aux_stop(struct i2c_adapter *adapter, bool reading)
|
||||
{
|
||||
struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data;
|
||||
int mode = MODE_I2C_STOP;
|
||||
|
||||
if (reading)
|
||||
mode |= MODE_I2C_READ;
|
||||
else
|
||||
mode |= MODE_I2C_WRITE;
|
||||
if (algo_data->running) {
|
||||
(void) i2c_algo_dp_aux_transaction(adapter, mode, 0, NULL);
|
||||
algo_data->running = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Write a single byte to the current I2C address, the
|
||||
* the I2C link must be running or this returns -EIO
|
||||
*/
|
||||
static int
|
||||
i2c_algo_dp_aux_put_byte(struct i2c_adapter *adapter, u8 byte)
|
||||
{
|
||||
struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data;
|
||||
int ret;
|
||||
|
||||
if (!algo_data->running)
|
||||
return -EIO;
|
||||
|
||||
ret = i2c_algo_dp_aux_transaction(adapter, MODE_I2C_WRITE, byte, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read a single byte from the current I2C address, the
|
||||
* I2C link must be running or this returns -EIO
|
||||
*/
|
||||
static int
|
||||
i2c_algo_dp_aux_get_byte(struct i2c_adapter *adapter, u8 *byte_ret)
|
||||
{
|
||||
struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data;
|
||||
int ret;
|
||||
|
||||
if (!algo_data->running)
|
||||
return -EIO;
|
||||
|
||||
ret = i2c_algo_dp_aux_transaction(adapter, MODE_I2C_READ, 0, byte_ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
i2c_algo_dp_aux_xfer(struct i2c_adapter *adapter,
|
||||
struct i2c_msg *msgs,
|
||||
int num)
|
||||
{
|
||||
int ret = 0;
|
||||
bool reading = false;
|
||||
int m;
|
||||
int b;
|
||||
|
||||
for (m = 0; m < num; m++) {
|
||||
u16 len = msgs[m].len;
|
||||
u8 *buf = msgs[m].buf;
|
||||
reading = (msgs[m].flags & I2C_M_RD) != 0;
|
||||
ret = i2c_algo_dp_aux_address(adapter, msgs[m].addr, reading);
|
||||
if (ret < 0)
|
||||
break;
|
||||
if (reading) {
|
||||
for (b = 0; b < len; b++) {
|
||||
ret = i2c_algo_dp_aux_get_byte(adapter, &buf[b]);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
for (b = 0; b < len; b++) {
|
||||
ret = i2c_algo_dp_aux_put_byte(adapter, buf[b]);
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
break;
|
||||
}
|
||||
if (ret >= 0)
|
||||
ret = num;
|
||||
i2c_algo_dp_aux_stop(adapter, reading);
|
||||
printk(KERN_ERR "dp_aux_xfer return %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static u32
|
||||
i2c_algo_dp_aux_functionality(struct i2c_adapter *adapter)
|
||||
{
|
||||
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
|
||||
I2C_FUNC_SMBUS_READ_BLOCK_DATA |
|
||||
I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
|
||||
I2C_FUNC_10BIT_ADDR;
|
||||
}
|
||||
|
||||
static const struct i2c_algorithm i2c_dp_aux_algo = {
|
||||
.master_xfer = i2c_algo_dp_aux_xfer,
|
||||
.functionality = i2c_algo_dp_aux_functionality,
|
||||
};
|
||||
|
||||
static void
|
||||
i2c_dp_aux_reset_bus(struct i2c_adapter *adapter)
|
||||
{
|
||||
(void) i2c_algo_dp_aux_address(adapter, 0, false);
|
||||
(void) i2c_algo_dp_aux_stop(adapter, false);
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
i2c_dp_aux_prepare_bus(struct i2c_adapter *adapter)
|
||||
{
|
||||
adapter->algo = &i2c_dp_aux_algo;
|
||||
adapter->retries = 3;
|
||||
i2c_dp_aux_reset_bus(adapter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
i2c_dp_aux_add_bus(struct i2c_adapter *adapter)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = i2c_dp_aux_prepare_bus(adapter);
|
||||
if (error)
|
||||
return error;
|
||||
error = i2c_add_adapter(adapter);
|
||||
return error;
|
||||
}
|
||||
EXPORT_SYMBOL(i2c_dp_aux_add_bus);
|
|
@ -54,6 +54,7 @@
|
|||
#define INTEL_OUTPUT_LVDS 4
|
||||
#define INTEL_OUTPUT_TVOUT 5
|
||||
#define INTEL_OUTPUT_HDMI 6
|
||||
#define INTEL_OUTPUT_DISPLAYPORT 7
|
||||
|
||||
#define INTEL_DVO_CHIP_NONE 0
|
||||
#define INTEL_DVO_CHIP_LVDS 1
|
||||
|
@ -65,7 +66,6 @@ struct intel_i2c_chan {
|
|||
u32 reg; /* GPIO reg */
|
||||
struct i2c_adapter adapter;
|
||||
struct i2c_algo_bit_data algo;
|
||||
u8 slave_addr;
|
||||
};
|
||||
|
||||
struct intel_framebuffer {
|
||||
|
@ -79,11 +79,12 @@ struct intel_output {
|
|||
|
||||
struct drm_encoder enc;
|
||||
int type;
|
||||
struct intel_i2c_chan *i2c_bus; /* for control functions */
|
||||
struct intel_i2c_chan *ddc_bus; /* for DDC only stuff */
|
||||
struct i2c_adapter *i2c_bus;
|
||||
struct i2c_adapter *ddc_bus;
|
||||
bool load_detect_temp;
|
||||
bool needs_tv_clock;
|
||||
void *dev_priv;
|
||||
void (*hot_plug)(struct intel_output *);
|
||||
};
|
||||
|
||||
struct intel_crtc {
|
||||
|
@ -104,9 +105,9 @@ struct intel_crtc {
|
|||
#define enc_to_intel_output(x) container_of(x, struct intel_output, enc)
|
||||
#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
|
||||
|
||||
struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
|
||||
const char *name);
|
||||
void intel_i2c_destroy(struct intel_i2c_chan *chan);
|
||||
struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg,
|
||||
const char *name);
|
||||
void intel_i2c_destroy(struct i2c_adapter *adapter);
|
||||
int intel_ddc_get_modes(struct intel_output *intel_output);
|
||||
extern bool intel_ddc_probe(struct intel_output *intel_output);
|
||||
void intel_i2c_quirk_set(struct drm_device *dev, bool enable);
|
||||
|
@ -116,6 +117,10 @@ extern bool intel_sdvo_init(struct drm_device *dev, int output_device);
|
|||
extern void intel_dvo_init(struct drm_device *dev);
|
||||
extern void intel_tv_init(struct drm_device *dev);
|
||||
extern void intel_lvds_init(struct drm_device *dev);
|
||||
extern void intel_dp_init(struct drm_device *dev, int dp_reg);
|
||||
void
|
||||
intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode);
|
||||
|
||||
extern void intel_crtc_load_lut(struct drm_crtc *crtc);
|
||||
extern void intel_encoder_prepare (struct drm_encoder *encoder);
|
||||
|
|
|
@ -384,10 +384,9 @@ void intel_dvo_init(struct drm_device *dev)
|
|||
{
|
||||
struct intel_output *intel_output;
|
||||
struct intel_dvo_device *dvo;
|
||||
struct intel_i2c_chan *i2cbus = NULL;
|
||||
struct i2c_adapter *i2cbus = NULL;
|
||||
int ret = 0;
|
||||
int i;
|
||||
int gpio_inited = 0;
|
||||
int encoder_type = DRM_MODE_ENCODER_NONE;
|
||||
intel_output = kzalloc (sizeof(struct intel_output), GFP_KERNEL);
|
||||
if (!intel_output)
|
||||
|
@ -420,14 +419,11 @@ void intel_dvo_init(struct drm_device *dev)
|
|||
* It appears that everything is on GPIOE except for panels
|
||||
* on i830 laptops, which are on GPIOB (DVOA).
|
||||
*/
|
||||
if (gpio_inited != gpio) {
|
||||
if (i2cbus != NULL)
|
||||
intel_i2c_destroy(i2cbus);
|
||||
if (!(i2cbus = intel_i2c_create(dev, gpio,
|
||||
gpio == GPIOB ? "DVOI2C_B" : "DVOI2C_E"))) {
|
||||
continue;
|
||||
}
|
||||
gpio_inited = gpio;
|
||||
if (i2cbus != NULL)
|
||||
intel_i2c_destroy(i2cbus);
|
||||
if (!(i2cbus = intel_i2c_create(dev, gpio,
|
||||
gpio == GPIOB ? "DVOI2C_B" : "DVOI2C_E"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dvo->dev_ops!= NULL)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "drmP.h"
|
||||
#include "drm.h"
|
||||
#include "drm_crtc.h"
|
||||
#include "drm_edid.h"
|
||||
#include "intel_drv.h"
|
||||
#include "i915_drm.h"
|
||||
#include "i915_drv.h"
|
||||
|
@ -56,8 +57,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
|
|||
sdvox = SDVO_ENCODING_HDMI |
|
||||
SDVO_BORDER_ENABLE |
|
||||
SDVO_VSYNC_ACTIVE_HIGH |
|
||||
SDVO_HSYNC_ACTIVE_HIGH |
|
||||
SDVO_NULL_PACKETS_DURING_VSYNC;
|
||||
SDVO_HSYNC_ACTIVE_HIGH;
|
||||
|
||||
if (hdmi_priv->has_hdmi_sink)
|
||||
sdvox |= SDVO_AUDIO_ENABLE;
|
||||
|
@ -129,20 +129,26 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
intel_hdmi_sink_detect(struct drm_connector *connector)
|
||||
static enum drm_connector_status
|
||||
intel_hdmi_edid_detect(struct drm_connector *connector)
|
||||
{
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
|
||||
struct edid *edid = NULL;
|
||||
enum drm_connector_status status = connector_status_disconnected;
|
||||
|
||||
edid = drm_get_edid(&intel_output->base,
|
||||
&intel_output->ddc_bus->adapter);
|
||||
if (edid != NULL) {
|
||||
hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
|
||||
kfree(edid);
|
||||
intel_output->ddc_bus);
|
||||
hdmi_priv->has_hdmi_sink = false;
|
||||
if (edid) {
|
||||
if (edid->input & DRM_EDID_INPUT_DIGITAL) {
|
||||
status = connector_status_connected;
|
||||
hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
|
||||
}
|
||||
intel_output->base.display_info.raw_edid = NULL;
|
||||
kfree(edid);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
|
@ -154,11 +160,7 @@ igdng_hdmi_detect(struct drm_connector *connector)
|
|||
/* FIXME hotplug detect */
|
||||
|
||||
hdmi_priv->has_hdmi_sink = false;
|
||||
intel_hdmi_sink_detect(connector);
|
||||
if (hdmi_priv->has_hdmi_sink)
|
||||
return connector_status_connected;
|
||||
else
|
||||
return connector_status_disconnected;
|
||||
return intel_hdmi_edid_detect(connector);
|
||||
}
|
||||
|
||||
static enum drm_connector_status
|
||||
|
@ -201,10 +203,9 @@ intel_hdmi_detect(struct drm_connector *connector)
|
|||
return connector_status_unknown;
|
||||
}
|
||||
|
||||
if ((I915_READ(PORT_HOTPLUG_STAT) & bit) != 0) {
|
||||
intel_hdmi_sink_detect(connector);
|
||||
return connector_status_connected;
|
||||
} else
|
||||
if ((I915_READ(PORT_HOTPLUG_STAT) & bit) != 0)
|
||||
return intel_hdmi_edid_detect(connector);
|
||||
else
|
||||
return connector_status_disconnected;
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ static void set_data(void *data, int state_high)
|
|||
* @output: driver specific output device
|
||||
* @reg: GPIO reg to use
|
||||
* @name: name for this bus
|
||||
* @slave_addr: slave address (if fixed)
|
||||
*
|
||||
* Creates and registers a new i2c bus with the Linux i2c layer, for use
|
||||
* in output probing and control (e.g. DDC or SDVO control functions).
|
||||
|
@ -139,8 +140,8 @@ static void set_data(void *data, int state_high)
|
|||
* %GPIOH
|
||||
* see PRM for details on how these different busses are used.
|
||||
*/
|
||||
struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
|
||||
const char *name)
|
||||
struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg,
|
||||
const char *name)
|
||||
{
|
||||
struct intel_i2c_chan *chan;
|
||||
|
||||
|
@ -174,7 +175,7 @@ struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
|
|||
intel_i2c_quirk_set(dev, false);
|
||||
udelay(20);
|
||||
|
||||
return chan;
|
||||
return &chan->adapter;
|
||||
|
||||
out_free:
|
||||
kfree(chan);
|
||||
|
@ -187,11 +188,16 @@ out_free:
|
|||
*
|
||||
* Unregister the adapter from the i2c layer, then free the structure.
|
||||
*/
|
||||
void intel_i2c_destroy(struct intel_i2c_chan *chan)
|
||||
void intel_i2c_destroy(struct i2c_adapter *adapter)
|
||||
{
|
||||
if (!chan)
|
||||
struct intel_i2c_chan *chan;
|
||||
|
||||
if (!adapter)
|
||||
return;
|
||||
|
||||
chan = container_of(adapter,
|
||||
struct intel_i2c_chan,
|
||||
adapter);
|
||||
i2c_del_adapter(&chan->adapter);
|
||||
kfree(chan);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,21 @@
|
|||
|
||||
#define I915_LVDS "i915_lvds"
|
||||
|
||||
/*
|
||||
* the following four scaling options are defined.
|
||||
* #define DRM_MODE_SCALE_NON_GPU 0
|
||||
* #define DRM_MODE_SCALE_FULLSCREEN 1
|
||||
* #define DRM_MODE_SCALE_NO_SCALE 2
|
||||
* #define DRM_MODE_SCALE_ASPECT 3
|
||||
*/
|
||||
|
||||
/* Private structure for the integrated LVDS support */
|
||||
struct intel_lvds_priv {
|
||||
int fitting_mode;
|
||||
u32 pfit_control;
|
||||
u32 pfit_pgm_ratios;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the backlight level.
|
||||
*
|
||||
|
@ -213,10 +228,27 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
|
|||
struct drm_display_mode *mode,
|
||||
struct drm_display_mode *adjusted_mode)
|
||||
{
|
||||
/*
|
||||
* float point operation is not supported . So the PANEL_RATIO_FACTOR
|
||||
* is defined, which can avoid the float point computation when
|
||||
* calculating the panel ratio.
|
||||
*/
|
||||
#define PANEL_RATIO_FACTOR 8192
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
struct drm_encoder *tmp_encoder;
|
||||
struct intel_output *intel_output = enc_to_intel_output(encoder);
|
||||
struct intel_lvds_priv *lvds_priv = intel_output->dev_priv;
|
||||
u32 pfit_control = 0, pfit_pgm_ratios = 0;
|
||||
int left_border = 0, right_border = 0, top_border = 0;
|
||||
int bottom_border = 0;
|
||||
bool border = 0;
|
||||
int panel_ratio, desired_ratio, vert_scale, horiz_scale;
|
||||
int horiz_ratio, vert_ratio;
|
||||
u32 hsync_width, vsync_width;
|
||||
u32 hblank_width, vblank_width;
|
||||
u32 hsync_pos, vsync_pos;
|
||||
|
||||
/* Should never happen!! */
|
||||
if (!IS_I965G(dev) && intel_crtc->pipe == 0) {
|
||||
|
@ -232,7 +264,9 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we don't have a panel mode, there is nothing we can do */
|
||||
if (dev_priv->panel_fixed_mode == NULL)
|
||||
return true;
|
||||
/*
|
||||
* If we have timings from the BIOS for the panel, put them in
|
||||
* to the adjusted mode. The CRTC will be set up for this mode,
|
||||
|
@ -256,6 +290,243 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
|
|||
drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
|
||||
}
|
||||
|
||||
/* Make sure pre-965s set dither correctly */
|
||||
if (!IS_I965G(dev)) {
|
||||
if (dev_priv->panel_wants_dither || dev_priv->lvds_dither)
|
||||
pfit_control |= PANEL_8TO6_DITHER_ENABLE;
|
||||
}
|
||||
|
||||
/* Native modes don't need fitting */
|
||||
if (adjusted_mode->hdisplay == mode->hdisplay &&
|
||||
adjusted_mode->vdisplay == mode->vdisplay) {
|
||||
pfit_pgm_ratios = 0;
|
||||
border = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* 965+ wants fuzzy fitting */
|
||||
if (IS_I965G(dev))
|
||||
pfit_control |= (intel_crtc->pipe << PFIT_PIPE_SHIFT) |
|
||||
PFIT_FILTER_FUZZY;
|
||||
|
||||
hsync_width = adjusted_mode->crtc_hsync_end -
|
||||
adjusted_mode->crtc_hsync_start;
|
||||
vsync_width = adjusted_mode->crtc_vsync_end -
|
||||
adjusted_mode->crtc_vsync_start;
|
||||
hblank_width = adjusted_mode->crtc_hblank_end -
|
||||
adjusted_mode->crtc_hblank_start;
|
||||
vblank_width = adjusted_mode->crtc_vblank_end -
|
||||
adjusted_mode->crtc_vblank_start;
|
||||
/*
|
||||
* Deal with panel fitting options. Figure out how to stretch the
|
||||
* image based on its aspect ratio & the current panel fitting mode.
|
||||
*/
|
||||
panel_ratio = adjusted_mode->hdisplay * PANEL_RATIO_FACTOR /
|
||||
adjusted_mode->vdisplay;
|
||||
desired_ratio = mode->hdisplay * PANEL_RATIO_FACTOR /
|
||||
mode->vdisplay;
|
||||
/*
|
||||
* Enable automatic panel scaling for non-native modes so that they fill
|
||||
* the screen. Should be enabled before the pipe is enabled, according
|
||||
* to register description and PRM.
|
||||
* Change the value here to see the borders for debugging
|
||||
*/
|
||||
I915_WRITE(BCLRPAT_A, 0);
|
||||
I915_WRITE(BCLRPAT_B, 0);
|
||||
|
||||
switch (lvds_priv->fitting_mode) {
|
||||
case DRM_MODE_SCALE_NO_SCALE:
|
||||
/*
|
||||
* For centered modes, we have to calculate border widths &
|
||||
* heights and modify the values programmed into the CRTC.
|
||||
*/
|
||||
left_border = (adjusted_mode->hdisplay - mode->hdisplay) / 2;
|
||||
right_border = left_border;
|
||||
if (mode->hdisplay & 1)
|
||||
right_border++;
|
||||
top_border = (adjusted_mode->vdisplay - mode->vdisplay) / 2;
|
||||
bottom_border = top_border;
|
||||
if (mode->vdisplay & 1)
|
||||
bottom_border++;
|
||||
/* Set active & border values */
|
||||
adjusted_mode->crtc_hdisplay = mode->hdisplay;
|
||||
/* Keep the boder be even */
|
||||
if (right_border & 1)
|
||||
right_border++;
|
||||
/* use the border directly instead of border minuse one */
|
||||
adjusted_mode->crtc_hblank_start = mode->hdisplay +
|
||||
right_border;
|
||||
/* keep the blank width constant */
|
||||
adjusted_mode->crtc_hblank_end =
|
||||
adjusted_mode->crtc_hblank_start + hblank_width;
|
||||
/* get the hsync pos relative to hblank start */
|
||||
hsync_pos = (hblank_width - hsync_width) / 2;
|
||||
/* keep the hsync pos be even */
|
||||
if (hsync_pos & 1)
|
||||
hsync_pos++;
|
||||
adjusted_mode->crtc_hsync_start =
|
||||
adjusted_mode->crtc_hblank_start + hsync_pos;
|
||||
/* keep the hsync width constant */
|
||||
adjusted_mode->crtc_hsync_end =
|
||||
adjusted_mode->crtc_hsync_start + hsync_width;
|
||||
adjusted_mode->crtc_vdisplay = mode->vdisplay;
|
||||
/* use the border instead of border minus one */
|
||||
adjusted_mode->crtc_vblank_start = mode->vdisplay +
|
||||
bottom_border;
|
||||
/* keep the vblank width constant */
|
||||
adjusted_mode->crtc_vblank_end =
|
||||
adjusted_mode->crtc_vblank_start + vblank_width;
|
||||
/* get the vsync start postion relative to vblank start */
|
||||
vsync_pos = (vblank_width - vsync_width) / 2;
|
||||
adjusted_mode->crtc_vsync_start =
|
||||
adjusted_mode->crtc_vblank_start + vsync_pos;
|
||||
/* keep the vsync width constant */
|
||||
adjusted_mode->crtc_vsync_end =
|
||||
adjusted_mode->crtc_vblank_start + vsync_width;
|
||||
border = 1;
|
||||
break;
|
||||
case DRM_MODE_SCALE_ASPECT:
|
||||
/* Scale but preserve the spect ratio */
|
||||
pfit_control |= PFIT_ENABLE;
|
||||
if (IS_I965G(dev)) {
|
||||
/* 965+ is easy, it does everything in hw */
|
||||
if (panel_ratio > desired_ratio)
|
||||
pfit_control |= PFIT_SCALING_PILLAR;
|
||||
else if (panel_ratio < desired_ratio)
|
||||
pfit_control |= PFIT_SCALING_LETTER;
|
||||
else
|
||||
pfit_control |= PFIT_SCALING_AUTO;
|
||||
} else {
|
||||
/*
|
||||
* For earlier chips we have to calculate the scaling
|
||||
* ratio by hand and program it into the
|
||||
* PFIT_PGM_RATIO register
|
||||
*/
|
||||
u32 horiz_bits, vert_bits, bits = 12;
|
||||
horiz_ratio = mode->hdisplay * PANEL_RATIO_FACTOR/
|
||||
adjusted_mode->hdisplay;
|
||||
vert_ratio = mode->vdisplay * PANEL_RATIO_FACTOR/
|
||||
adjusted_mode->vdisplay;
|
||||
horiz_scale = adjusted_mode->hdisplay *
|
||||
PANEL_RATIO_FACTOR / mode->hdisplay;
|
||||
vert_scale = adjusted_mode->vdisplay *
|
||||
PANEL_RATIO_FACTOR / mode->vdisplay;
|
||||
|
||||
/* retain aspect ratio */
|
||||
if (panel_ratio > desired_ratio) { /* Pillar */
|
||||
u32 scaled_width;
|
||||
scaled_width = mode->hdisplay * vert_scale /
|
||||
PANEL_RATIO_FACTOR;
|
||||
horiz_ratio = vert_ratio;
|
||||
pfit_control |= (VERT_AUTO_SCALE |
|
||||
VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
/* Pillar will have left/right borders */
|
||||
left_border = (adjusted_mode->hdisplay -
|
||||
scaled_width) / 2;
|
||||
right_border = left_border;
|
||||
if (mode->hdisplay & 1) /* odd resolutions */
|
||||
right_border++;
|
||||
/* keep the border be even */
|
||||
if (right_border & 1)
|
||||
right_border++;
|
||||
adjusted_mode->crtc_hdisplay = scaled_width;
|
||||
/* use border instead of border minus one */
|
||||
adjusted_mode->crtc_hblank_start =
|
||||
scaled_width + right_border;
|
||||
/* keep the hblank width constant */
|
||||
adjusted_mode->crtc_hblank_end =
|
||||
adjusted_mode->crtc_hblank_start +
|
||||
hblank_width;
|
||||
/*
|
||||
* get the hsync start pos relative to
|
||||
* hblank start
|
||||
*/
|
||||
hsync_pos = (hblank_width - hsync_width) / 2;
|
||||
/* keep the hsync_pos be even */
|
||||
if (hsync_pos & 1)
|
||||
hsync_pos++;
|
||||
adjusted_mode->crtc_hsync_start =
|
||||
adjusted_mode->crtc_hblank_start +
|
||||
hsync_pos;
|
||||
/* keept hsync width constant */
|
||||
adjusted_mode->crtc_hsync_end =
|
||||
adjusted_mode->crtc_hsync_start +
|
||||
hsync_width;
|
||||
border = 1;
|
||||
} else if (panel_ratio < desired_ratio) { /* letter */
|
||||
u32 scaled_height = mode->vdisplay *
|
||||
horiz_scale / PANEL_RATIO_FACTOR;
|
||||
vert_ratio = horiz_ratio;
|
||||
pfit_control |= (HORIZ_AUTO_SCALE |
|
||||
VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
/* Letterbox will have top/bottom border */
|
||||
top_border = (adjusted_mode->vdisplay -
|
||||
scaled_height) / 2;
|
||||
bottom_border = top_border;
|
||||
if (mode->vdisplay & 1)
|
||||
bottom_border++;
|
||||
adjusted_mode->crtc_vdisplay = scaled_height;
|
||||
/* use border instead of border minus one */
|
||||
adjusted_mode->crtc_vblank_start =
|
||||
scaled_height + bottom_border;
|
||||
/* keep the vblank width constant */
|
||||
adjusted_mode->crtc_vblank_end =
|
||||
adjusted_mode->crtc_vblank_start +
|
||||
vblank_width;
|
||||
/*
|
||||
* get the vsync start pos relative to
|
||||
* vblank start
|
||||
*/
|
||||
vsync_pos = (vblank_width - vsync_width) / 2;
|
||||
adjusted_mode->crtc_vsync_start =
|
||||
adjusted_mode->crtc_vblank_start +
|
||||
vsync_pos;
|
||||
/* keep the vsync width constant */
|
||||
adjusted_mode->crtc_vsync_end =
|
||||
adjusted_mode->crtc_vsync_start +
|
||||
vsync_width;
|
||||
border = 1;
|
||||
} else {
|
||||
/* Aspects match, Let hw scale both directions */
|
||||
pfit_control |= (VERT_AUTO_SCALE |
|
||||
HORIZ_AUTO_SCALE |
|
||||
VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
}
|
||||
horiz_bits = (1 << bits) * horiz_ratio /
|
||||
PANEL_RATIO_FACTOR;
|
||||
vert_bits = (1 << bits) * vert_ratio /
|
||||
PANEL_RATIO_FACTOR;
|
||||
pfit_pgm_ratios =
|
||||
((vert_bits << PFIT_VERT_SCALE_SHIFT) &
|
||||
PFIT_VERT_SCALE_MASK) |
|
||||
((horiz_bits << PFIT_HORIZ_SCALE_SHIFT) &
|
||||
PFIT_HORIZ_SCALE_MASK);
|
||||
}
|
||||
break;
|
||||
|
||||
case DRM_MODE_SCALE_FULLSCREEN:
|
||||
/*
|
||||
* Full scaling, even if it changes the aspect ratio.
|
||||
* Fortunately this is all done for us in hw.
|
||||
*/
|
||||
pfit_control |= PFIT_ENABLE;
|
||||
if (IS_I965G(dev))
|
||||
pfit_control |= PFIT_SCALING_AUTO;
|
||||
else
|
||||
pfit_control |= (VERT_AUTO_SCALE | HORIZ_AUTO_SCALE |
|
||||
VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
lvds_priv->pfit_control = pfit_control;
|
||||
lvds_priv->pfit_pgm_ratios = pfit_pgm_ratios;
|
||||
/*
|
||||
* XXX: It would be nice to support lower refresh rates on the
|
||||
* panels to reduce power consumption, and perhaps match the
|
||||
|
@ -301,8 +572,8 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
|
|||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
|
||||
u32 pfit_control;
|
||||
struct intel_output *intel_output = enc_to_intel_output(encoder);
|
||||
struct intel_lvds_priv *lvds_priv = intel_output->dev_priv;
|
||||
|
||||
/*
|
||||
* The LVDS pin pair will already have been turned on in the
|
||||
|
@ -319,22 +590,8 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
|
|||
* screen. Should be enabled before the pipe is enabled, according to
|
||||
* register description and PRM.
|
||||
*/
|
||||
if (mode->hdisplay != adjusted_mode->hdisplay ||
|
||||
mode->vdisplay != adjusted_mode->vdisplay)
|
||||
pfit_control = (PFIT_ENABLE | VERT_AUTO_SCALE |
|
||||
HORIZ_AUTO_SCALE | VERT_INTERP_BILINEAR |
|
||||
HORIZ_INTERP_BILINEAR);
|
||||
else
|
||||
pfit_control = 0;
|
||||
|
||||
if (!IS_I965G(dev)) {
|
||||
if (dev_priv->panel_wants_dither || dev_priv->lvds_dither)
|
||||
pfit_control |= PANEL_8TO6_DITHER_ENABLE;
|
||||
}
|
||||
else
|
||||
pfit_control |= intel_crtc->pipe << PFIT_PIPE_SHIFT;
|
||||
|
||||
I915_WRITE(PFIT_CONTROL, pfit_control);
|
||||
I915_WRITE(PFIT_PGM_RATIOS, lvds_priv->pfit_pgm_ratios);
|
||||
I915_WRITE(PFIT_CONTROL, lvds_priv->pfit_control);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -406,6 +663,34 @@ static int intel_lvds_set_property(struct drm_connector *connector,
|
|||
struct drm_property *property,
|
||||
uint64_t value)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct intel_output *intel_output =
|
||||
to_intel_output(connector);
|
||||
|
||||
if (property == dev->mode_config.scaling_mode_property &&
|
||||
connector->encoder) {
|
||||
struct drm_crtc *crtc = connector->encoder->crtc;
|
||||
struct intel_lvds_priv *lvds_priv = intel_output->dev_priv;
|
||||
if (value == DRM_MODE_SCALE_NON_GPU) {
|
||||
DRM_DEBUG_KMS(I915_LVDS,
|
||||
"non_GPU property is unsupported\n");
|
||||
return 0;
|
||||
}
|
||||
if (lvds_priv->fitting_mode == value) {
|
||||
/* the LVDS scaling property is not changed */
|
||||
return 0;
|
||||
}
|
||||
lvds_priv->fitting_mode = value;
|
||||
if (crtc && crtc->enabled) {
|
||||
/*
|
||||
* If the CRTC is enabled, the display will be changed
|
||||
* according to the new panel fitting mode.
|
||||
*/
|
||||
drm_crtc_helper_set_mode(crtc, &crtc->mode,
|
||||
crtc->x, crtc->y, crtc->fb);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -456,7 +741,7 @@ static const struct dmi_system_id intel_no_lvds[] = {
|
|||
.callback = intel_no_lvds_dmi_callback,
|
||||
.ident = "Apple Mac Mini (Core series)",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Apple"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
|
||||
},
|
||||
},
|
||||
|
@ -464,7 +749,7 @@ static const struct dmi_system_id intel_no_lvds[] = {
|
|||
.callback = intel_no_lvds_dmi_callback,
|
||||
.ident = "Apple Mac Mini (Core 2 series)",
|
||||
.matches = {
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
|
||||
DMI_MATCH(DMI_SYS_VENDOR, "Apple"),
|
||||
DMI_MATCH(DMI_PRODUCT_NAME, "Macmini2,1"),
|
||||
},
|
||||
},
|
||||
|
@ -518,6 +803,7 @@ void intel_lvds_init(struct drm_device *dev)
|
|||
struct drm_encoder *encoder;
|
||||
struct drm_display_mode *scan; /* *modes, *bios_mode; */
|
||||
struct drm_crtc *crtc;
|
||||
struct intel_lvds_priv *lvds_priv;
|
||||
u32 lvds;
|
||||
int pipe, gpio = GPIOC;
|
||||
|
||||
|
@ -531,7 +817,8 @@ void intel_lvds_init(struct drm_device *dev)
|
|||
gpio = PCH_GPIOC;
|
||||
}
|
||||
|
||||
intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
|
||||
intel_output = kzalloc(sizeof(struct intel_output) +
|
||||
sizeof(struct intel_lvds_priv), GFP_KERNEL);
|
||||
if (!intel_output) {
|
||||
return;
|
||||
}
|
||||
|
@ -553,7 +840,18 @@ void intel_lvds_init(struct drm_device *dev)
|
|||
connector->interlace_allowed = false;
|
||||
connector->doublescan_allowed = false;
|
||||
|
||||
lvds_priv = (struct intel_lvds_priv *)(intel_output + 1);
|
||||
intel_output->dev_priv = lvds_priv;
|
||||
/* create the scaling mode property */
|
||||
drm_mode_create_scaling_mode_property(dev);
|
||||
/*
|
||||
* the initial panel fitting mode will be FULL_SCREEN.
|
||||
*/
|
||||
|
||||
drm_connector_attach_property(&intel_output->base,
|
||||
dev->mode_config.scaling_mode_property,
|
||||
DRM_MODE_SCALE_FULLSCREEN);
|
||||
lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN;
|
||||
/*
|
||||
* LVDS discovery:
|
||||
* 1) check for EDID on DDC
|
||||
|
@ -649,5 +947,5 @@ failed:
|
|||
if (intel_output->ddc_bus)
|
||||
intel_i2c_destroy(intel_output->ddc_bus);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(connector);
|
||||
kfree(intel_output);
|
||||
}
|
||||
|
|
|
@ -53,10 +53,9 @@ bool intel_ddc_probe(struct intel_output *intel_output)
|
|||
}
|
||||
};
|
||||
|
||||
intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, true);
|
||||
ret = i2c_transfer(&intel_output->ddc_bus->adapter, msgs, 2);
|
||||
intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, false);
|
||||
|
||||
intel_i2c_quirk_set(intel_output->base.dev, true);
|
||||
ret = i2c_transfer(intel_output->ddc_bus, msgs, 2);
|
||||
intel_i2c_quirk_set(intel_output->base.dev, false);
|
||||
if (ret == 2)
|
||||
return true;
|
||||
|
||||
|
@ -74,10 +73,9 @@ int intel_ddc_get_modes(struct intel_output *intel_output)
|
|||
struct edid *edid;
|
||||
int ret = 0;
|
||||
|
||||
intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, true);
|
||||
edid = drm_get_edid(&intel_output->base,
|
||||
&intel_output->ddc_bus->adapter);
|
||||
intel_i2c_quirk_set(intel_output->ddc_bus->drm_dev, false);
|
||||
intel_i2c_quirk_set(intel_output->base.dev, true);
|
||||
edid = drm_get_edid(&intel_output->base, intel_output->ddc_bus);
|
||||
intel_i2c_quirk_set(intel_output->base.dev, false);
|
||||
if (edid) {
|
||||
drm_mode_connector_update_edid_property(&intel_output->base,
|
||||
edid);
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
#undef SDVO_DEBUG
|
||||
#define I915_SDVO "i915_sdvo"
|
||||
struct intel_sdvo_priv {
|
||||
struct intel_i2c_chan *i2c_bus;
|
||||
int slaveaddr;
|
||||
u8 slave_addr;
|
||||
|
||||
/* Register for the SDVO device: SDVOB or SDVOC */
|
||||
int output_device;
|
||||
|
@ -146,13 +145,13 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr,
|
|||
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = sdvo_priv->i2c_bus->slave_addr,
|
||||
.addr = sdvo_priv->slave_addr >> 1,
|
||||
.flags = 0,
|
||||
.len = 1,
|
||||
.buf = out_buf,
|
||||
},
|
||||
{
|
||||
.addr = sdvo_priv->i2c_bus->slave_addr,
|
||||
.addr = sdvo_priv->slave_addr >> 1,
|
||||
.flags = I2C_M_RD,
|
||||
.len = 1,
|
||||
.buf = buf,
|
||||
|
@ -162,7 +161,7 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr,
|
|||
out_buf[0] = addr;
|
||||
out_buf[1] = 0;
|
||||
|
||||
if ((ret = i2c_transfer(&sdvo_priv->i2c_bus->adapter, msgs, 2)) == 2)
|
||||
if ((ret = i2c_transfer(intel_output->i2c_bus, msgs, 2)) == 2)
|
||||
{
|
||||
*ch = buf[0];
|
||||
return true;
|
||||
|
@ -175,10 +174,11 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr,
|
|||
static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr,
|
||||
u8 ch)
|
||||
{
|
||||
struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
|
||||
u8 out_buf[2];
|
||||
struct i2c_msg msgs[] = {
|
||||
{
|
||||
.addr = intel_output->i2c_bus->slave_addr,
|
||||
.addr = sdvo_priv->slave_addr >> 1,
|
||||
.flags = 0,
|
||||
.len = 2,
|
||||
.buf = out_buf,
|
||||
|
@ -188,7 +188,7 @@ static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr,
|
|||
out_buf[0] = addr;
|
||||
out_buf[1] = ch;
|
||||
|
||||
if (i2c_transfer(&intel_output->i2c_bus->adapter, msgs, 1) == 1)
|
||||
if (i2c_transfer(intel_output->i2c_bus, msgs, 1) == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1369,9 +1369,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
|
|||
struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
|
||||
struct edid *edid = NULL;
|
||||
|
||||
intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus);
|
||||
edid = drm_get_edid(&intel_output->base,
|
||||
&intel_output->ddc_bus->adapter);
|
||||
intel_output->ddc_bus);
|
||||
if (edid != NULL) {
|
||||
sdvo_priv->is_hdmi = drm_detect_hdmi_monitor(edid);
|
||||
kfree(edid);
|
||||
|
@ -1549,7 +1548,6 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
|
|||
static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
|
||||
{
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
|
||||
struct drm_i915_private *dev_priv = connector->dev->dev_private;
|
||||
|
||||
/*
|
||||
|
@ -1557,8 +1555,6 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
|
|||
* Assume that the preferred modes are
|
||||
* arranged in priority order.
|
||||
*/
|
||||
/* set the bus switch and get the modes */
|
||||
intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus);
|
||||
intel_ddc_get_modes(intel_output);
|
||||
if (list_empty(&connector->probed_modes) == false)
|
||||
return;
|
||||
|
@ -1709,7 +1705,7 @@ intel_sdvo_chan_to_intel_output(struct intel_i2c_chan *chan)
|
|||
|
||||
list_for_each_entry(connector,
|
||||
&dev->mode_config.connector_list, head) {
|
||||
if (to_intel_output(connector)->ddc_bus == chan) {
|
||||
if (to_intel_output(connector)->ddc_bus == &chan->adapter) {
|
||||
intel_output = to_intel_output(connector);
|
||||
break;
|
||||
}
|
||||
|
@ -1723,7 +1719,7 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap,
|
|||
struct intel_output *intel_output;
|
||||
struct intel_sdvo_priv *sdvo_priv;
|
||||
struct i2c_algo_bit_data *algo_data;
|
||||
struct i2c_algorithm *algo;
|
||||
const struct i2c_algorithm *algo;
|
||||
|
||||
algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data;
|
||||
intel_output =
|
||||
|
@ -1733,7 +1729,7 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap,
|
|||
return -EINVAL;
|
||||
|
||||
sdvo_priv = intel_output->dev_priv;
|
||||
algo = (struct i2c_algorithm *)intel_output->i2c_bus->adapter.algo;
|
||||
algo = intel_output->i2c_bus->algo;
|
||||
|
||||
intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus);
|
||||
return algo->master_xfer(i2c_adap, msgs, num);
|
||||
|
@ -1785,13 +1781,11 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
|
|||
struct drm_connector *connector;
|
||||
struct intel_output *intel_output;
|
||||
struct intel_sdvo_priv *sdvo_priv;
|
||||
struct intel_i2c_chan *i2cbus = NULL;
|
||||
struct intel_i2c_chan *ddcbus = NULL;
|
||||
|
||||
int connector_type;
|
||||
u8 ch[0x40];
|
||||
int i;
|
||||
int encoder_type, output_id;
|
||||
u8 slave_addr;
|
||||
int encoder_type;
|
||||
|
||||
intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL);
|
||||
if (!intel_output) {
|
||||
|
@ -1799,29 +1793,24 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
|
|||
}
|
||||
|
||||
sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1);
|
||||
sdvo_priv->output_device = output_device;
|
||||
|
||||
intel_output->dev_priv = sdvo_priv;
|
||||
intel_output->type = INTEL_OUTPUT_SDVO;
|
||||
|
||||
/* setup the DDC bus. */
|
||||
if (output_device == SDVOB)
|
||||
i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB");
|
||||
intel_output->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB");
|
||||
else
|
||||
i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC");
|
||||
intel_output->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC");
|
||||
|
||||
if (!i2cbus)
|
||||
if (!intel_output->i2c_bus)
|
||||
goto err_inteloutput;
|
||||
|
||||
slave_addr = intel_sdvo_get_slave_addr(dev, output_device);
|
||||
sdvo_priv->i2c_bus = i2cbus;
|
||||
sdvo_priv->slave_addr = intel_sdvo_get_slave_addr(dev, output_device);
|
||||
|
||||
if (output_device == SDVOB) {
|
||||
output_id = 1;
|
||||
} else {
|
||||
output_id = 2;
|
||||
}
|
||||
sdvo_priv->i2c_bus->slave_addr = slave_addr >> 1;
|
||||
sdvo_priv->output_device = output_device;
|
||||
intel_output->i2c_bus = i2cbus;
|
||||
intel_output->dev_priv = sdvo_priv;
|
||||
/* Save the bit-banging i2c functionality for use by the DDC wrapper */
|
||||
intel_sdvo_i2c_bit_algo.functionality = intel_output->i2c_bus->algo->functionality;
|
||||
|
||||
/* Read the regs to test if we can talk to the device */
|
||||
for (i = 0; i < 0x40; i++) {
|
||||
|
@ -1835,17 +1824,15 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
|
|||
|
||||
/* setup the DDC bus. */
|
||||
if (output_device == SDVOB)
|
||||
ddcbus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS");
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS");
|
||||
else
|
||||
ddcbus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS");
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS");
|
||||
|
||||
if (ddcbus == NULL)
|
||||
if (intel_output->ddc_bus == NULL)
|
||||
goto err_i2c;
|
||||
|
||||
intel_sdvo_i2c_bit_algo.functionality =
|
||||
intel_output->i2c_bus->adapter.algo->functionality;
|
||||
ddcbus->adapter.algo = &intel_sdvo_i2c_bit_algo;
|
||||
intel_output->ddc_bus = ddcbus;
|
||||
/* Wrap with our custom algo which switches to DDC mode */
|
||||
intel_output->ddc_bus->algo = &intel_sdvo_i2c_bit_algo;
|
||||
|
||||
/* In defaut case sdvo lvds is false */
|
||||
sdvo_priv->is_lvds = false;
|
||||
|
@ -1965,9 +1952,10 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
|
|||
return true;
|
||||
|
||||
err_i2c:
|
||||
if (ddcbus != NULL)
|
||||
if (intel_output->ddc_bus != NULL)
|
||||
intel_i2c_destroy(intel_output->ddc_bus);
|
||||
intel_i2c_destroy(intel_output->i2c_bus);
|
||||
if (intel_output->i2c_bus != NULL)
|
||||
intel_i2c_destroy(intel_output->i2c_bus);
|
||||
err_inteloutput:
|
||||
kfree(intel_output);
|
||||
|
||||
|
|
|
@ -1383,34 +1383,31 @@ intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output)
|
|||
/*
|
||||
* Detect TV by polling)
|
||||
*/
|
||||
if (intel_output->load_detect_temp) {
|
||||
/* TV not currently running, prod it with destructive detect */
|
||||
save_tv_dac = tv_dac;
|
||||
tv_ctl = I915_READ(TV_CTL);
|
||||
save_tv_ctl = tv_ctl;
|
||||
tv_ctl &= ~TV_ENC_ENABLE;
|
||||
tv_ctl &= ~TV_TEST_MODE_MASK;
|
||||
tv_ctl |= TV_TEST_MODE_MONITOR_DETECT;
|
||||
tv_dac &= ~TVDAC_SENSE_MASK;
|
||||
tv_dac &= ~DAC_A_MASK;
|
||||
tv_dac &= ~DAC_B_MASK;
|
||||
tv_dac &= ~DAC_C_MASK;
|
||||
tv_dac |= (TVDAC_STATE_CHG_EN |
|
||||
TVDAC_A_SENSE_CTL |
|
||||
TVDAC_B_SENSE_CTL |
|
||||
TVDAC_C_SENSE_CTL |
|
||||
DAC_CTL_OVERRIDE |
|
||||
DAC_A_0_7_V |
|
||||
DAC_B_0_7_V |
|
||||
DAC_C_0_7_V);
|
||||
I915_WRITE(TV_CTL, tv_ctl);
|
||||
I915_WRITE(TV_DAC, tv_dac);
|
||||
intel_wait_for_vblank(dev);
|
||||
tv_dac = I915_READ(TV_DAC);
|
||||
I915_WRITE(TV_DAC, save_tv_dac);
|
||||
I915_WRITE(TV_CTL, save_tv_ctl);
|
||||
intel_wait_for_vblank(dev);
|
||||
}
|
||||
save_tv_dac = tv_dac;
|
||||
tv_ctl = I915_READ(TV_CTL);
|
||||
save_tv_ctl = tv_ctl;
|
||||
tv_ctl &= ~TV_ENC_ENABLE;
|
||||
tv_ctl &= ~TV_TEST_MODE_MASK;
|
||||
tv_ctl |= TV_TEST_MODE_MONITOR_DETECT;
|
||||
tv_dac &= ~TVDAC_SENSE_MASK;
|
||||
tv_dac &= ~DAC_A_MASK;
|
||||
tv_dac &= ~DAC_B_MASK;
|
||||
tv_dac &= ~DAC_C_MASK;
|
||||
tv_dac |= (TVDAC_STATE_CHG_EN |
|
||||
TVDAC_A_SENSE_CTL |
|
||||
TVDAC_B_SENSE_CTL |
|
||||
TVDAC_C_SENSE_CTL |
|
||||
DAC_CTL_OVERRIDE |
|
||||
DAC_A_0_7_V |
|
||||
DAC_B_0_7_V |
|
||||
DAC_C_0_7_V);
|
||||
I915_WRITE(TV_CTL, tv_ctl);
|
||||
I915_WRITE(TV_DAC, tv_dac);
|
||||
intel_wait_for_vblank(dev);
|
||||
tv_dac = I915_READ(TV_DAC);
|
||||
I915_WRITE(TV_DAC, save_tv_dac);
|
||||
I915_WRITE(TV_CTL, save_tv_ctl);
|
||||
intel_wait_for_vblank(dev);
|
||||
/*
|
||||
* A B C
|
||||
* 0 1 1 Composite
|
||||
|
|
|
@ -34,6 +34,23 @@
|
|||
#include "radeon_asic.h"
|
||||
#include "atom.h"
|
||||
|
||||
/*
|
||||
* Clear GPU surface registers.
|
||||
*/
|
||||
static void radeon_surface_init(struct radeon_device *rdev)
|
||||
{
|
||||
/* FIXME: check this out */
|
||||
if (rdev->family < CHIP_R600) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
WREG32(RADEON_SURFACE0_INFO +
|
||||
i * (RADEON_SURFACE1_INFO - RADEON_SURFACE0_INFO),
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* GPU scratch registers helpers function.
|
||||
*/
|
||||
|
@ -496,6 +513,8 @@ int radeon_device_init(struct radeon_device *rdev,
|
|||
radeon_errata(rdev);
|
||||
/* Initialize scratch registers */
|
||||
radeon_scratch_init(rdev);
|
||||
/* Initialize surface registers */
|
||||
radeon_surface_init(rdev);
|
||||
|
||||
/* TODO: disable VGA need to use VGA request */
|
||||
/* BIOS*/
|
||||
|
@ -604,9 +623,6 @@ int radeon_device_init(struct radeon_device *rdev,
|
|||
if (r) {
|
||||
return r;
|
||||
}
|
||||
if (rdev->fbdev_rfb && rdev->fbdev_rfb->obj) {
|
||||
rdev->fbdev_robj = rdev->fbdev_rfb->obj->driver_private;
|
||||
}
|
||||
if (!ret) {
|
||||
DRM_INFO("radeon: kernel modesetting successfully initialized.\n");
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ static void __exit radeon_exit(void)
|
|||
drm_exit(driver);
|
||||
}
|
||||
|
||||
late_initcall(radeon_init);
|
||||
module_init(radeon_init);
|
||||
module_exit(radeon_exit);
|
||||
|
||||
MODULE_AUTHOR(DRIVER_AUTHOR);
|
||||
|
|
|
@ -478,14 +478,16 @@ int radeonfb_create(struct radeon_device *rdev,
|
|||
{
|
||||
struct fb_info *info;
|
||||
struct radeon_fb_device *rfbdev;
|
||||
struct drm_framebuffer *fb;
|
||||
struct drm_framebuffer *fb = NULL;
|
||||
struct radeon_framebuffer *rfb;
|
||||
struct drm_mode_fb_cmd mode_cmd;
|
||||
struct drm_gem_object *gobj = NULL;
|
||||
struct radeon_object *robj = NULL;
|
||||
struct device *device = &rdev->pdev->dev;
|
||||
int size, aligned_size, ret;
|
||||
u64 fb_gpuaddr;
|
||||
void *fbptr = NULL;
|
||||
unsigned long tmp;
|
||||
|
||||
mode_cmd.width = surface_width;
|
||||
mode_cmd.height = surface_height;
|
||||
|
@ -498,11 +500,12 @@ int radeonfb_create(struct radeon_device *rdev,
|
|||
aligned_size = ALIGN(size, PAGE_SIZE);
|
||||
|
||||
ret = radeon_gem_object_create(rdev, aligned_size, 0,
|
||||
RADEON_GEM_DOMAIN_VRAM,
|
||||
false, ttm_bo_type_kernel,
|
||||
false, &gobj);
|
||||
RADEON_GEM_DOMAIN_VRAM,
|
||||
false, ttm_bo_type_kernel,
|
||||
false, &gobj);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "failed to allocate framebuffer\n");
|
||||
printk(KERN_ERR "failed to allocate framebuffer (%d %d)\n",
|
||||
surface_width, surface_height);
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
@ -515,12 +518,19 @@ int radeonfb_create(struct radeon_device *rdev,
|
|||
ret = -ENOMEM;
|
||||
goto out_unref;
|
||||
}
|
||||
ret = radeon_object_pin(robj, RADEON_GEM_DOMAIN_VRAM, &fb_gpuaddr);
|
||||
if (ret) {
|
||||
printk(KERN_ERR "failed to pin framebuffer\n");
|
||||
ret = -ENOMEM;
|
||||
goto out_unref;
|
||||
}
|
||||
|
||||
list_add(&fb->filp_head, &rdev->ddev->mode_config.fb_kernel_list);
|
||||
|
||||
rfb = to_radeon_framebuffer(fb);
|
||||
*rfb_p = rfb;
|
||||
rdev->fbdev_rfb = rfb;
|
||||
rdev->fbdev_robj = robj;
|
||||
|
||||
info = framebuffer_alloc(sizeof(struct radeon_fb_device), device);
|
||||
if (info == NULL) {
|
||||
|
@ -541,13 +551,13 @@ int radeonfb_create(struct radeon_device *rdev,
|
|||
info->fix.xpanstep = 1; /* doing it in hw */
|
||||
info->fix.ypanstep = 1; /* doing it in hw */
|
||||
info->fix.ywrapstep = 0;
|
||||
info->fix.accel = FB_ACCEL_I830;
|
||||
info->fix.accel = FB_ACCEL_NONE;
|
||||
info->fix.type_aux = 0;
|
||||
info->flags = FBINFO_DEFAULT;
|
||||
info->fbops = &radeonfb_ops;
|
||||
info->fix.line_length = fb->pitch;
|
||||
info->screen_base = fbptr;
|
||||
info->fix.smem_start = (unsigned long)fbptr;
|
||||
tmp = fb_gpuaddr - rdev->mc.vram_location;
|
||||
info->fix.smem_start = rdev->mc.aper_base + tmp;
|
||||
info->fix.smem_len = size;
|
||||
info->screen_base = fbptr;
|
||||
info->screen_size = size;
|
||||
|
@ -562,8 +572,8 @@ int radeonfb_create(struct radeon_device *rdev,
|
|||
info->var.width = -1;
|
||||
info->var.xres = fb_width;
|
||||
info->var.yres = fb_height;
|
||||
info->fix.mmio_start = pci_resource_start(rdev->pdev, 2);
|
||||
info->fix.mmio_len = pci_resource_len(rdev->pdev, 2);
|
||||
info->fix.mmio_start = 0;
|
||||
info->fix.mmio_len = 0;
|
||||
info->pixmap.size = 64*1024;
|
||||
info->pixmap.buf_align = 8;
|
||||
info->pixmap.access_align = 32;
|
||||
|
@ -644,7 +654,7 @@ out_unref:
|
|||
if (robj) {
|
||||
radeon_object_kunmap(robj);
|
||||
}
|
||||
if (ret) {
|
||||
if (fb && ret) {
|
||||
list_del(&fb->filp_head);
|
||||
drm_gem_object_unreference(gobj);
|
||||
drm_framebuffer_cleanup(fb);
|
||||
|
@ -813,6 +823,7 @@ int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb)
|
|||
robj = rfb->obj->driver_private;
|
||||
unregister_framebuffer(info);
|
||||
radeon_object_kunmap(robj);
|
||||
radeon_object_unpin(robj);
|
||||
framebuffer_release(info);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,6 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain,
|
|||
{
|
||||
uint32_t flags;
|
||||
uint32_t tmp;
|
||||
void *fbptr;
|
||||
int r;
|
||||
|
||||
flags = radeon_object_flags_from_domain(domain);
|
||||
|
@ -242,10 +241,6 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain,
|
|||
DRM_ERROR("radeon: failed to reserve object for pinning it.\n");
|
||||
return r;
|
||||
}
|
||||
if (robj->rdev->fbdev_robj == robj) {
|
||||
mutex_lock(&robj->rdev->fbdev_info->lock);
|
||||
radeon_object_kunmap(robj);
|
||||
}
|
||||
tmp = robj->tobj.mem.placement;
|
||||
ttm_flag_masked(&tmp, flags, TTM_PL_MASK_MEM);
|
||||
robj->tobj.proposed_placement = tmp | TTM_PL_FLAG_NO_EVICT | TTM_PL_MASK_CACHING;
|
||||
|
@ -261,23 +256,12 @@ int radeon_object_pin(struct radeon_object *robj, uint32_t domain,
|
|||
DRM_ERROR("radeon: failed to pin object.\n");
|
||||
}
|
||||
radeon_object_unreserve(robj);
|
||||
if (robj->rdev->fbdev_robj == robj) {
|
||||
if (!r) {
|
||||
r = radeon_object_kmap(robj, &fbptr);
|
||||
}
|
||||
if (!r) {
|
||||
robj->rdev->fbdev_info->screen_base = fbptr;
|
||||
robj->rdev->fbdev_info->fix.smem_start = (unsigned long)fbptr;
|
||||
}
|
||||
mutex_unlock(&robj->rdev->fbdev_info->lock);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void radeon_object_unpin(struct radeon_object *robj)
|
||||
{
|
||||
uint32_t flags;
|
||||
void *fbptr;
|
||||
int r;
|
||||
|
||||
spin_lock(&robj->tobj.lock);
|
||||
|
@ -297,10 +281,6 @@ void radeon_object_unpin(struct radeon_object *robj)
|
|||
DRM_ERROR("radeon: failed to reserve object for unpinning it.\n");
|
||||
return;
|
||||
}
|
||||
if (robj->rdev->fbdev_robj == robj) {
|
||||
mutex_lock(&robj->rdev->fbdev_info->lock);
|
||||
radeon_object_kunmap(robj);
|
||||
}
|
||||
flags = robj->tobj.mem.placement;
|
||||
robj->tobj.proposed_placement = flags & ~TTM_PL_FLAG_NO_EVICT;
|
||||
r = ttm_buffer_object_validate(&robj->tobj,
|
||||
|
@ -310,16 +290,6 @@ void radeon_object_unpin(struct radeon_object *robj)
|
|||
DRM_ERROR("radeon: failed to unpin buffer.\n");
|
||||
}
|
||||
radeon_object_unreserve(robj);
|
||||
if (robj->rdev->fbdev_robj == robj) {
|
||||
if (!r) {
|
||||
r = radeon_object_kmap(robj, &fbptr);
|
||||
}
|
||||
if (!r) {
|
||||
robj->rdev->fbdev_info->screen_base = fbptr;
|
||||
robj->rdev->fbdev_info->fix.smem_start = (unsigned long)fbptr;
|
||||
}
|
||||
mutex_unlock(&robj->rdev->fbdev_info->lock);
|
||||
}
|
||||
}
|
||||
|
||||
int radeon_object_wait(struct radeon_object *robj)
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <linux/highmem.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <ttm/ttm_bo_driver.h>
|
||||
#include <ttm/ttm_placement.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
|
||||
*/
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/highmem.h>
|
||||
|
|
|
@ -35,11 +35,11 @@ struct est_timings {
|
|||
} __attribute__((packed));
|
||||
|
||||
/* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
|
||||
#define EDID_TIMING_ASPECT_SHIFT 0
|
||||
#define EDID_TIMING_ASPECT_SHIFT 6
|
||||
#define EDID_TIMING_ASPECT_MASK (0x3 << EDID_TIMING_ASPECT_SHIFT)
|
||||
|
||||
/* need to add 60 */
|
||||
#define EDID_TIMING_VFREQ_SHIFT 2
|
||||
#define EDID_TIMING_VFREQ_SHIFT 0
|
||||
#define EDID_TIMING_VFREQ_MASK (0x3f << EDID_TIMING_VFREQ_SHIFT)
|
||||
|
||||
struct std_timing {
|
||||
|
@ -47,11 +47,11 @@ struct std_timing {
|
|||
u8 vfreq_aspect;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 6)
|
||||
#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 5)
|
||||
#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1)
|
||||
#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2)
|
||||
#define DRM_EDID_PT_SEPARATE_SYNC (3 << 3)
|
||||
#define DRM_EDID_PT_STEREO (1 << 2)
|
||||
#define DRM_EDID_PT_INTERLACED (1 << 1)
|
||||
#define DRM_EDID_PT_STEREO (1 << 5)
|
||||
#define DRM_EDID_PT_INTERLACED (1 << 7)
|
||||
|
||||
/* If detailed data is pixel timing */
|
||||
struct detailed_pixel_timing {
|
||||
|
@ -93,7 +93,7 @@ struct detailed_data_monitor_range {
|
|||
} __attribute__((packed));
|
||||
|
||||
struct detailed_data_wpindex {
|
||||
u8 white_xy_lo; /* Upper 2 bits each */
|
||||
u8 white_yx_lo; /* Lower 2 bits each */
|
||||
u8 white_x_hi;
|
||||
u8 white_y_hi;
|
||||
u8 gamma; /* need to divide by 100 then add 1 */
|
||||
|
@ -135,21 +135,21 @@ struct detailed_timing {
|
|||
} data;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 7)
|
||||
#define DRM_EDID_INPUT_SYNC_ON_GREEN (1 << 5)
|
||||
#define DRM_EDID_INPUT_COMPOSITE_SYNC (1 << 4)
|
||||
#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
|
||||
#define DRM_EDID_INPUT_SYNC_ON_GREEN (1 << 1)
|
||||
#define DRM_EDID_INPUT_COMPOSITE_SYNC (1 << 2)
|
||||
#define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3)
|
||||
#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 2)
|
||||
#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 1)
|
||||
#define DRM_EDID_INPUT_DIGITAL (1 << 0) /* bits above must be zero if set */
|
||||
#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4)
|
||||
#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5)
|
||||
#define DRM_EDID_INPUT_DIGITAL (1 << 7) /* bits below must be zero if set */
|
||||
|
||||
#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 7)
|
||||
#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 6)
|
||||
#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 5)
|
||||
#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0)
|
||||
#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1)
|
||||
#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 2)
|
||||
#define DRM_EDID_FEATURE_DISPLAY_TYPE (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
|
||||
#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 2)
|
||||
#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 1)
|
||||
#define DRM_EDID_FEATURE_PM_STANDBY (1 << 0)
|
||||
#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 5)
|
||||
#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 6)
|
||||
#define DRM_EDID_FEATURE_PM_STANDBY (1 << 7)
|
||||
|
||||
struct edid {
|
||||
u8 header[8];
|
||||
|
|
Loading…
Reference in a new issue