提交 de52bcab 编写于 作者: D Dave Airlie

Merge remote branch 'keithp/drm-intel-fixes' of /ssd/git/drm-next into drm-fixes

* 'keithp/drm-intel-fixes' of /ssd/git/drm-next:
  drm/i915: Add a no lvds quirk for the Asus EeeBox PC EB1007
  drm/i915: Share the common force-audio property between connectors
  drm/i915: Remove unused enum "chip_family"
  drm/915: fix relaxed tiling on gen2: tile height
  drm/i915/crt: Explicitly return false if connected to a digital monitor
  drm/i915: Replace ironlake_compute_wm0 with g4x_compute_wm0
  drm/i915: Only print out the actual number of fences for i915_error_state
  drm/i915: s/addr & ~PAGE_MASK/offset_in_page(addr)/
  drm: i915: correct return status in intel_hdmi_mode_valid()
  drm/i915: fix regression after clock gating init split
  drm/i915: fix if statement in ivybridge irq handler
...@@ -776,7 +776,7 @@ static int i915_error_state(struct seq_file *m, void *unused) ...@@ -776,7 +776,7 @@ static int i915_error_state(struct seq_file *m, void *unused)
seq_printf(m, " INSTPM: 0x%08x\n", error->instpm); seq_printf(m, " INSTPM: 0x%08x\n", error->instpm);
seq_printf(m, " seqno: 0x%08x\n", error->seqno); seq_printf(m, " seqno: 0x%08x\n", error->seqno);
for (i = 0; i < 16; i++) for (i = 0; i < dev_priv->num_fence_regs; i++)
seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]); seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]);
if (error->active_bo) if (error->active_bo)
......
...@@ -716,6 +716,7 @@ typedef struct drm_i915_private { ...@@ -716,6 +716,7 @@ typedef struct drm_i915_private {
struct intel_fbdev *fbdev; struct intel_fbdev *fbdev;
struct drm_property *broadcast_rgb_property; struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
atomic_t forcewake_count; atomic_t forcewake_count;
} drm_i915_private_t; } drm_i915_private_t;
...@@ -909,13 +910,6 @@ struct drm_i915_file_private { ...@@ -909,13 +910,6 @@ struct drm_i915_file_private {
} mm; } mm;
}; };
enum intel_chip_family {
CHIP_I8XX = 0x01,
CHIP_I9XX = 0x02,
CHIP_I915 = 0x04,
CHIP_I965 = 0x08,
};
#define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info) #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info)
#define IS_I830(dev) ((dev)->pci_device == 0x3577) #define IS_I830(dev) ((dev)->pci_device == 0x3577)
......
...@@ -354,7 +354,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, ...@@ -354,7 +354,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev,
* page_offset = offset within page * page_offset = offset within page
* page_length = bytes to copy for this page * page_length = bytes to copy for this page
*/ */
page_offset = offset & (PAGE_SIZE-1); page_offset = offset_in_page(offset);
page_length = remain; page_length = remain;
if ((page_offset + remain) > PAGE_SIZE) if ((page_offset + remain) > PAGE_SIZE)
page_length = PAGE_SIZE - page_offset; page_length = PAGE_SIZE - page_offset;
...@@ -453,9 +453,9 @@ i915_gem_shmem_pread_slow(struct drm_device *dev, ...@@ -453,9 +453,9 @@ i915_gem_shmem_pread_slow(struct drm_device *dev,
* data_page_offset = offset with data_page_index page. * data_page_offset = offset with data_page_index page.
* page_length = bytes to copy for this page * page_length = bytes to copy for this page
*/ */
shmem_page_offset = offset & ~PAGE_MASK; shmem_page_offset = offset_in_page(offset);
data_page_index = data_ptr / PAGE_SIZE - first_data_page; data_page_index = data_ptr / PAGE_SIZE - first_data_page;
data_page_offset = data_ptr & ~PAGE_MASK; data_page_offset = offset_in_page(data_ptr);
page_length = remain; page_length = remain;
if ((shmem_page_offset + page_length) > PAGE_SIZE) if ((shmem_page_offset + page_length) > PAGE_SIZE)
...@@ -638,8 +638,8 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, ...@@ -638,8 +638,8 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
* page_offset = offset within page * page_offset = offset within page
* page_length = bytes to copy for this page * page_length = bytes to copy for this page
*/ */
page_base = (offset & ~(PAGE_SIZE-1)); page_base = offset & PAGE_MASK;
page_offset = offset & (PAGE_SIZE-1); page_offset = offset_in_page(offset);
page_length = remain; page_length = remain;
if ((page_offset + remain) > PAGE_SIZE) if ((page_offset + remain) > PAGE_SIZE)
page_length = PAGE_SIZE - page_offset; page_length = PAGE_SIZE - page_offset;
...@@ -650,7 +650,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev, ...@@ -650,7 +650,6 @@ i915_gem_gtt_pwrite_fast(struct drm_device *dev,
*/ */
if (fast_user_write(dev_priv->mm.gtt_mapping, page_base, if (fast_user_write(dev_priv->mm.gtt_mapping, page_base,
page_offset, user_data, page_length)) page_offset, user_data, page_length))
return -EFAULT; return -EFAULT;
remain -= page_length; remain -= page_length;
...@@ -730,9 +729,9 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev, ...@@ -730,9 +729,9 @@ i915_gem_gtt_pwrite_slow(struct drm_device *dev,
* page_length = bytes to copy for this page * page_length = bytes to copy for this page
*/ */
gtt_page_base = offset & PAGE_MASK; gtt_page_base = offset & PAGE_MASK;
gtt_page_offset = offset & ~PAGE_MASK; gtt_page_offset = offset_in_page(offset);
data_page_index = data_ptr / PAGE_SIZE - first_data_page; data_page_index = data_ptr / PAGE_SIZE - first_data_page;
data_page_offset = data_ptr & ~PAGE_MASK; data_page_offset = offset_in_page(data_ptr);
page_length = remain; page_length = remain;
if ((gtt_page_offset + page_length) > PAGE_SIZE) if ((gtt_page_offset + page_length) > PAGE_SIZE)
...@@ -791,7 +790,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, ...@@ -791,7 +790,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev,
* page_offset = offset within page * page_offset = offset within page
* page_length = bytes to copy for this page * page_length = bytes to copy for this page
*/ */
page_offset = offset & (PAGE_SIZE-1); page_offset = offset_in_page(offset);
page_length = remain; page_length = remain;
if ((page_offset + remain) > PAGE_SIZE) if ((page_offset + remain) > PAGE_SIZE)
page_length = PAGE_SIZE - page_offset; page_length = PAGE_SIZE - page_offset;
...@@ -896,9 +895,9 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev, ...@@ -896,9 +895,9 @@ i915_gem_shmem_pwrite_slow(struct drm_device *dev,
* data_page_offset = offset with data_page_index page. * data_page_offset = offset with data_page_index page.
* page_length = bytes to copy for this page * page_length = bytes to copy for this page
*/ */
shmem_page_offset = offset & ~PAGE_MASK; shmem_page_offset = offset_in_page(offset);
data_page_index = data_ptr / PAGE_SIZE - first_data_page; data_page_index = data_ptr / PAGE_SIZE - first_data_page;
data_page_offset = data_ptr & ~PAGE_MASK; data_page_offset = offset_in_page(data_ptr);
page_length = remain; page_length = remain;
if ((shmem_page_offset + page_length) > PAGE_SIZE) if ((shmem_page_offset + page_length) > PAGE_SIZE)
...@@ -1450,8 +1449,9 @@ i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj) ...@@ -1450,8 +1449,9 @@ i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj)
* edge of an even tile row (where tile rows are counted as if the bo is * edge of an even tile row (where tile rows are counted as if the bo is
* placed in a fenced gtt region). * placed in a fenced gtt region).
*/ */
if (IS_GEN2(dev) || if (IS_GEN2(dev))
(obj->tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) tile_height = 16;
else if (obj->tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))
tile_height = 32; tile_height = 32;
else else
tile_height = 8; tile_height = 8;
......
...@@ -517,7 +517,7 @@ irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) ...@@ -517,7 +517,7 @@ irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
if (de_iir & DE_PIPEA_VBLANK_IVB) if (de_iir & DE_PIPEA_VBLANK_IVB)
drm_handle_vblank(dev, 0); drm_handle_vblank(dev, 0);
if (de_iir & DE_PIPEB_VBLANK_IVB); if (de_iir & DE_PIPEB_VBLANK_IVB)
drm_handle_vblank(dev, 1); drm_handle_vblank(dev, 1);
/* check event from PCH */ /* check event from PCH */
......
...@@ -288,6 +288,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) ...@@ -288,6 +288,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
* This may be a DVI-I connector with a shared DDC * This may be a DVI-I connector with a shared DDC
* link between analog and digital outputs, so we * link between analog and digital outputs, so we
* have to check the EDID input spec of the attached device. * have to check the EDID input spec of the attached device.
*
* On the other hand, what should we do if it is a broken EDID?
*/ */
if (edid != NULL) { if (edid != NULL) {
is_digital = edid->input & DRM_EDID_INPUT_DIGITAL; is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
...@@ -298,6 +300,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector) ...@@ -298,6 +300,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
if (!is_digital) { if (!is_digital) {
DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n"); DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
return true; return true;
} else {
DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a digital panel]\n");
} }
} }
......
...@@ -3983,54 +3983,6 @@ static void i830_update_wm(struct drm_device *dev) ...@@ -3983,54 +3983,6 @@ static void i830_update_wm(struct drm_device *dev)
#define ILK_LP0_PLANE_LATENCY 700 #define ILK_LP0_PLANE_LATENCY 700
#define ILK_LP0_CURSOR_LATENCY 1300 #define ILK_LP0_CURSOR_LATENCY 1300
static bool ironlake_compute_wm0(struct drm_device *dev,
int pipe,
const struct intel_watermark_params *display,
int display_latency_ns,
const struct intel_watermark_params *cursor,
int cursor_latency_ns,
int *plane_wm,
int *cursor_wm)
{
struct drm_crtc *crtc;
int htotal, hdisplay, clock, pixel_size;
int line_time_us, line_count;
int entries, tlb_miss;
crtc = intel_get_crtc_for_pipe(dev, pipe);
if (crtc->fb == NULL || !crtc->enabled)
return false;
htotal = crtc->mode.htotal;
hdisplay = crtc->mode.hdisplay;
clock = crtc->mode.clock;
pixel_size = crtc->fb->bits_per_pixel / 8;
/* Use the small buffer method to calculate plane watermark */
entries = ((clock * pixel_size / 1000) * display_latency_ns) / 1000;
tlb_miss = display->fifo_size*display->cacheline_size - hdisplay * 8;
if (tlb_miss > 0)
entries += tlb_miss;
entries = DIV_ROUND_UP(entries, display->cacheline_size);
*plane_wm = entries + display->guard_size;
if (*plane_wm > (int)display->max_wm)
*plane_wm = display->max_wm;
/* Use the large buffer method to calculate cursor watermark */
line_time_us = ((htotal * 1000) / clock);
line_count = (cursor_latency_ns / line_time_us + 1000) / 1000;
entries = line_count * 64 * pixel_size;
tlb_miss = cursor->fifo_size*cursor->cacheline_size - hdisplay * 8;
if (tlb_miss > 0)
entries += tlb_miss;
entries = DIV_ROUND_UP(entries, cursor->cacheline_size);
*cursor_wm = entries + cursor->guard_size;
if (*cursor_wm > (int)cursor->max_wm)
*cursor_wm = (int)cursor->max_wm;
return true;
}
/* /*
* Check the wm result. * Check the wm result.
* *
...@@ -4139,12 +4091,12 @@ static void ironlake_update_wm(struct drm_device *dev) ...@@ -4139,12 +4091,12 @@ static void ironlake_update_wm(struct drm_device *dev)
unsigned int enabled; unsigned int enabled;
enabled = 0; enabled = 0;
if (ironlake_compute_wm0(dev, 0, if (g4x_compute_wm0(dev, 0,
&ironlake_display_wm_info, &ironlake_display_wm_info,
ILK_LP0_PLANE_LATENCY, ILK_LP0_PLANE_LATENCY,
&ironlake_cursor_wm_info, &ironlake_cursor_wm_info,
ILK_LP0_CURSOR_LATENCY, ILK_LP0_CURSOR_LATENCY,
&plane_wm, &cursor_wm)) { &plane_wm, &cursor_wm)) {
I915_WRITE(WM0_PIPEA_ILK, I915_WRITE(WM0_PIPEA_ILK,
(plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm);
DRM_DEBUG_KMS("FIFO watermarks For pipe A -" DRM_DEBUG_KMS("FIFO watermarks For pipe A -"
...@@ -4153,12 +4105,12 @@ static void ironlake_update_wm(struct drm_device *dev) ...@@ -4153,12 +4105,12 @@ static void ironlake_update_wm(struct drm_device *dev)
enabled |= 1; enabled |= 1;
} }
if (ironlake_compute_wm0(dev, 1, if (g4x_compute_wm0(dev, 1,
&ironlake_display_wm_info, &ironlake_display_wm_info,
ILK_LP0_PLANE_LATENCY, ILK_LP0_PLANE_LATENCY,
&ironlake_cursor_wm_info, &ironlake_cursor_wm_info,
ILK_LP0_CURSOR_LATENCY, ILK_LP0_CURSOR_LATENCY,
&plane_wm, &cursor_wm)) { &plane_wm, &cursor_wm)) {
I915_WRITE(WM0_PIPEB_ILK, I915_WRITE(WM0_PIPEB_ILK,
(plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm);
DRM_DEBUG_KMS("FIFO watermarks For pipe B -" DRM_DEBUG_KMS("FIFO watermarks For pipe B -"
...@@ -4223,10 +4175,10 @@ static void sandybridge_update_wm(struct drm_device *dev) ...@@ -4223,10 +4175,10 @@ static void sandybridge_update_wm(struct drm_device *dev)
unsigned int enabled; unsigned int enabled;
enabled = 0; enabled = 0;
if (ironlake_compute_wm0(dev, 0, if (g4x_compute_wm0(dev, 0,
&sandybridge_display_wm_info, latency, &sandybridge_display_wm_info, latency,
&sandybridge_cursor_wm_info, latency, &sandybridge_cursor_wm_info, latency,
&plane_wm, &cursor_wm)) { &plane_wm, &cursor_wm)) {
I915_WRITE(WM0_PIPEA_ILK, I915_WRITE(WM0_PIPEA_ILK,
(plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm);
DRM_DEBUG_KMS("FIFO watermarks For pipe A -" DRM_DEBUG_KMS("FIFO watermarks For pipe A -"
...@@ -4235,10 +4187,10 @@ static void sandybridge_update_wm(struct drm_device *dev) ...@@ -4235,10 +4187,10 @@ static void sandybridge_update_wm(struct drm_device *dev)
enabled |= 1; enabled |= 1;
} }
if (ironlake_compute_wm0(dev, 1, if (g4x_compute_wm0(dev, 1,
&sandybridge_display_wm_info, latency, &sandybridge_display_wm_info, latency,
&sandybridge_cursor_wm_info, latency, &sandybridge_cursor_wm_info, latency,
&plane_wm, &cursor_wm)) { &plane_wm, &cursor_wm)) {
I915_WRITE(WM0_PIPEB_ILK, I915_WRITE(WM0_PIPEB_ILK,
(plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm); (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm);
DRM_DEBUG_KMS("FIFO watermarks For pipe B -" DRM_DEBUG_KMS("FIFO watermarks For pipe B -"
...@@ -7675,6 +7627,7 @@ static void intel_init_display(struct drm_device *dev) ...@@ -7675,6 +7627,7 @@ static void intel_init_display(struct drm_device *dev)
dev_priv->display.update_wm = NULL; dev_priv->display.update_wm = NULL;
} else } else
dev_priv->display.update_wm = pineview_update_wm; dev_priv->display.update_wm = pineview_update_wm;
dev_priv->display.init_clock_gating = gen3_init_clock_gating;
} else if (IS_G4X(dev)) { } else if (IS_G4X(dev)) {
dev_priv->display.update_wm = g4x_update_wm; dev_priv->display.update_wm = g4x_update_wm;
dev_priv->display.init_clock_gating = g4x_init_clock_gating; dev_priv->display.init_clock_gating = g4x_init_clock_gating;
......
...@@ -59,8 +59,6 @@ struct intel_dp { ...@@ -59,8 +59,6 @@ struct intel_dp {
bool is_pch_edp; bool is_pch_edp;
uint8_t train_set[4]; uint8_t train_set[4];
uint8_t link_status[DP_LINK_STATUS_SIZE]; uint8_t link_status[DP_LINK_STATUS_SIZE];
struct drm_property *force_audio_property;
}; };
/** /**
...@@ -1702,7 +1700,7 @@ intel_dp_set_property(struct drm_connector *connector, ...@@ -1702,7 +1700,7 @@ intel_dp_set_property(struct drm_connector *connector,
if (ret) if (ret)
return ret; return ret;
if (property == intel_dp->force_audio_property) { if (property == dev_priv->force_audio_property) {
int i = val; int i = val;
bool has_audio; bool has_audio;
...@@ -1841,16 +1839,7 @@ bool intel_dpd_is_edp(struct drm_device *dev) ...@@ -1841,16 +1839,7 @@ bool intel_dpd_is_edp(struct drm_device *dev)
static void static void
intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector) intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; intel_attach_force_audio_property(connector);
intel_dp->force_audio_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2);
if (intel_dp->force_audio_property) {
intel_dp->force_audio_property->values[0] = -1;
intel_dp->force_audio_property->values[1] = 1;
drm_connector_attach_property(connector, intel_dp->force_audio_property, 0);
}
intel_attach_broadcast_rgb_property(connector); intel_attach_broadcast_rgb_property(connector);
} }
......
...@@ -236,6 +236,7 @@ struct intel_unpin_work { ...@@ -236,6 +236,7 @@ struct intel_unpin_work {
int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus); extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus);
extern void intel_attach_force_audio_property(struct drm_connector *connector);
extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector); extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
extern void intel_crt_init(struct drm_device *dev); extern void intel_crt_init(struct drm_device *dev);
......
...@@ -45,7 +45,6 @@ struct intel_hdmi { ...@@ -45,7 +45,6 @@ struct intel_hdmi {
bool has_hdmi_sink; bool has_hdmi_sink;
bool has_audio; bool has_audio;
int force_audio; int force_audio;
struct drm_property *force_audio_property;
}; };
static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder)
...@@ -194,7 +193,7 @@ static int intel_hdmi_mode_valid(struct drm_connector *connector, ...@@ -194,7 +193,7 @@ static int intel_hdmi_mode_valid(struct drm_connector *connector,
if (mode->clock > 165000) if (mode->clock > 165000)
return MODE_CLOCK_HIGH; return MODE_CLOCK_HIGH;
if (mode->clock < 20000) if (mode->clock < 20000)
return MODE_CLOCK_HIGH; return MODE_CLOCK_LOW;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN) if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN; return MODE_NO_DBLESCAN;
...@@ -287,7 +286,7 @@ intel_hdmi_set_property(struct drm_connector *connector, ...@@ -287,7 +286,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
if (ret) if (ret)
return ret; return ret;
if (property == intel_hdmi->force_audio_property) { if (property == dev_priv->force_audio_property) {
int i = val; int i = val;
bool has_audio; bool has_audio;
...@@ -365,16 +364,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { ...@@ -365,16 +364,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
static void static void
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector) intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; intel_attach_force_audio_property(connector);
intel_hdmi->force_audio_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2);
if (intel_hdmi->force_audio_property) {
intel_hdmi->force_audio_property->values[0] = -1;
intel_hdmi->force_audio_property->values[1] = 1;
drm_connector_attach_property(connector, intel_hdmi->force_audio_property, 0);
}
intel_attach_broadcast_rgb_property(connector); intel_attach_broadcast_rgb_property(connector);
} }
......
...@@ -727,6 +727,14 @@ static const struct dmi_system_id intel_no_lvds[] = { ...@@ -727,6 +727,14 @@ static const struct dmi_system_id intel_no_lvds[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "U800"), DMI_MATCH(DMI_PRODUCT_NAME, "U800"),
}, },
}, },
{
.callback = intel_no_lvds_dmi_callback,
.ident = "Asus EeeBox PC EB1007",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "EB1007"),
},
},
{ } /* terminating entry */ { } /* terminating entry */
}; };
......
...@@ -81,6 +81,36 @@ int intel_ddc_get_modes(struct drm_connector *connector, ...@@ -81,6 +81,36 @@ int intel_ddc_get_modes(struct drm_connector *connector,
return ret; return ret;
} }
static const char *force_audio_names[] = {
"off",
"auto",
"on",
};
void
intel_attach_force_audio_property(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_property *prop;
int i;
prop = dev_priv->force_audio_property;
if (prop == NULL) {
prop = drm_property_create(dev, DRM_MODE_PROP_ENUM,
"audio",
ARRAY_SIZE(force_audio_names));
if (prop == NULL)
return;
for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
dev_priv->force_audio_property = prop;
}
drm_connector_attach_property(connector, prop, 0);
}
static const char *broadcast_rgb_names[] = { static const char *broadcast_rgb_names[] = {
"Full", "Full",
"Limited 16:235", "Limited 16:235",
......
...@@ -148,8 +148,6 @@ struct intel_sdvo_connector { ...@@ -148,8 +148,6 @@ struct intel_sdvo_connector {
int format_supported_num; int format_supported_num;
struct drm_property *tv_format; struct drm_property *tv_format;
struct drm_property *force_audio_property;
/* add the property for the SDVO-TV */ /* add the property for the SDVO-TV */
struct drm_property *left; struct drm_property *left;
struct drm_property *right; struct drm_property *right;
...@@ -1712,7 +1710,7 @@ intel_sdvo_set_property(struct drm_connector *connector, ...@@ -1712,7 +1710,7 @@ intel_sdvo_set_property(struct drm_connector *connector,
if (ret) if (ret)
return ret; return ret;
if (property == intel_sdvo_connector->force_audio_property) { if (property == dev_priv->force_audio_property) {
int i = val; int i = val;
bool has_audio; bool has_audio;
...@@ -2037,15 +2035,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector) ...@@ -2037,15 +2035,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector)
{ {
struct drm_device *dev = connector->base.base.dev; struct drm_device *dev = connector->base.base.dev;
connector->force_audio_property = intel_attach_force_audio_property(&connector->base.base);
drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2);
if (connector->force_audio_property) {
connector->force_audio_property->values[0] = -1;
connector->force_audio_property->values[1] = 1;
drm_connector_attach_property(&connector->base.base,
connector->force_audio_property, 0);
}
if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev))
intel_attach_broadcast_rgb_property(&connector->base.base); intel_attach_broadcast_rgb_property(&connector->base.base);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册