Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
drm_edid.c File Reference
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <drm/drmP.h>
#include <drm/drm_edid.h>
#include "drm_edid_modes.h"

Go to the source code of this file.

Data Structures

struct  detailed_mode_closure
 
struct  edid_quirk
 

Macros

#define version_greater(edid, maj, min)
 
#define EDID_EST_TIMINGS   16
 
#define EDID_STD_TIMINGS   8
 
#define EDID_DETAILED_TIMINGS   4
 
#define EDID_QUIRK_PREFER_LARGE_60   (1 << 0)
 
#define EDID_QUIRK_135_CLOCK_TOO_HIGH   (1 << 1)
 
#define EDID_QUIRK_PREFER_LARGE_75   (1 << 2)
 
#define EDID_QUIRK_DETAILED_IN_CM   (1 << 3)
 
#define EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE   (1 << 4)
 
#define EDID_QUIRK_FIRST_DETAILED_PREFERRED   (1 << 5)
 
#define EDID_QUIRK_DETAILED_SYNC_PP   (1 << 6)
 
#define EDID_QUIRK_FORCE_REDUCED_BLANKING   (1 << 7)
 
#define LEVEL_DMT   0
 
#define LEVEL_GTF   1
 
#define LEVEL_GTF2   2
 
#define LEVEL_CVT   3
 
#define DDC_SEGMENT_ADDR   0x30
 
#define MODE_SIZE(m)   ((m)->hdisplay * (m)->vdisplay)
 
#define MODE_REFRESH_DIFF(m, r)   (abs((m)->vrefresh - target_refresh))
 
#define HDMI_IDENTIFIER   0x000C03
 
#define AUDIO_BLOCK   0x01
 
#define VIDEO_BLOCK   0x02
 
#define VENDOR_BLOCK   0x03
 
#define SPEAKER_BLOCK   0x04
 
#define EDID_BASIC_AUDIO   (1 << 6)
 
#define EDID_CEA_YCRCB444   (1 << 5)
 
#define EDID_CEA_YCRCB422   (1 << 4)
 
#define for_each_cea_db(cea, i, start, end)   for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
 

Typedefs

typedef void detailed_cb (struct detailed_timing *timing, void *closure)
 

Functions

int drm_edid_header_is_valid (const u8 *raw_edid)
 
 EXPORT_SYMBOL (drm_edid_header_is_valid)
 
 module_param_named (edid_fixup, edid_fixup, int, 0400)
 
 MODULE_PARM_DESC (edid_fixup,"Minimum number of valid EDID header bytes (0-8, default 6)")
 
bool drm_edid_block_valid (u8 *raw_edid, int block, bool print_bad_edid)
 
 EXPORT_SYMBOL (drm_edid_block_valid)
 
bool drm_edid_is_valid (struct edid *edid)
 
 EXPORT_SYMBOL (drm_edid_is_valid)
 
bool drm_probe_ddc (struct i2c_adapter *adapter)
 
 EXPORT_SYMBOL (drm_probe_ddc)
 
struct ediddrm_get_edid (struct drm_connector *connector, struct i2c_adapter *adapter)
 
 EXPORT_SYMBOL (drm_get_edid)
 
struct drm_display_modedrm_mode_find_dmt (struct drm_device *dev, int hsize, int vsize, int fresh, bool rb)
 
 EXPORT_SYMBOL (drm_mode_find_dmt)
 
u8drm_find_cea_extension (struct edid *edid)
 
 EXPORT_SYMBOL (drm_find_cea_extension)
 
void drm_edid_to_eld (struct drm_connector *connector, struct edid *edid)
 
 EXPORT_SYMBOL (drm_edid_to_eld)
 
int drm_av_sync_delay (struct drm_connector *connector, struct drm_display_mode *mode)
 
 EXPORT_SYMBOL (drm_av_sync_delay)
 
struct drm_connectordrm_select_eld (struct drm_encoder *encoder, struct drm_display_mode *mode)
 
 EXPORT_SYMBOL (drm_select_eld)
 
bool drm_detect_hdmi_monitor (struct edid *edid)
 
 EXPORT_SYMBOL (drm_detect_hdmi_monitor)
 
bool drm_detect_monitor_audio (struct edid *edid)
 
 EXPORT_SYMBOL (drm_detect_monitor_audio)
 
int drm_add_edid_modes (struct drm_connector *connector, struct edid *edid)
 
 EXPORT_SYMBOL (drm_add_edid_modes)
 
int drm_add_modes_noedid (struct drm_connector *connector, int hdisplay, int vdisplay)
 
 EXPORT_SYMBOL (drm_add_modes_noedid)
 

Macro Definition Documentation

#define AUDIO_BLOCK   0x01

Definition at line 1485 of file drm_edid.c.

#define DDC_SEGMENT_ADDR   0x30

Definition at line 246 of file drm_edid.c.

#define EDID_BASIC_AUDIO   (1 << 6)

Definition at line 1489 of file drm_edid.c.

#define EDID_CEA_YCRCB422   (1 << 4)

Definition at line 1491 of file drm_edid.c.

#define EDID_CEA_YCRCB444   (1 << 5)

Definition at line 1490 of file drm_edid.c.

#define EDID_DETAILED_TIMINGS   4

Definition at line 44 of file drm_edid.c.

#define EDID_EST_TIMINGS   16

Definition at line 42 of file drm_edid.c.

#define EDID_QUIRK_135_CLOCK_TOO_HIGH   (1 << 1)

Definition at line 56 of file drm_edid.c.

#define EDID_QUIRK_DETAILED_IN_CM   (1 << 3)

Definition at line 60 of file drm_edid.c.

#define EDID_QUIRK_DETAILED_SYNC_PP   (1 << 6)

Definition at line 68 of file drm_edid.c.

#define EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE   (1 << 4)

Definition at line 64 of file drm_edid.c.

#define EDID_QUIRK_FIRST_DETAILED_PREFERRED   (1 << 5)

Definition at line 66 of file drm_edid.c.

#define EDID_QUIRK_FORCE_REDUCED_BLANKING   (1 << 7)

Definition at line 70 of file drm_edid.c.

#define EDID_QUIRK_PREFER_LARGE_60   (1 << 0)

Definition at line 54 of file drm_edid.c.

#define EDID_QUIRK_PREFER_LARGE_75   (1 << 2)

Definition at line 58 of file drm_edid.c.

#define EDID_STD_TIMINGS   8

Definition at line 43 of file drm_edid.c.

#define for_each_cea_db (   cea,
  i,
  start,
  end 
)    for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)

Definition at line 1573 of file drm_edid.c.

#define HDMI_IDENTIFIER   0x000C03

Definition at line 1484 of file drm_edid.c.

#define LEVEL_CVT   3

Definition at line 83 of file drm_edid.c.

#define LEVEL_DMT   0

Definition at line 80 of file drm_edid.c.

#define LEVEL_GTF   1

Definition at line 81 of file drm_edid.c.

#define LEVEL_GTF2   2

Definition at line 82 of file drm_edid.c.

#define MODE_REFRESH_DIFF (   m,
  r 
)    (abs((m)->vrefresh - target_refresh))

Definition at line 473 of file drm_edid.c.

#define MODE_SIZE (   m)    ((m)->hdisplay * (m)->vdisplay)

Definition at line 472 of file drm_edid.c.

#define SPEAKER_BLOCK   0x04

Definition at line 1488 of file drm_edid.c.

#define VENDOR_BLOCK   0x03

Definition at line 1487 of file drm_edid.c.

#define version_greater (   edid,
  maj,
  min 
)
Value:
(((edid)->version > (maj)) || \
((edid)->version == (maj) && (edid)->revision > (min)))

Definition at line 38 of file drm_edid.c.

#define VIDEO_BLOCK   0x02

Definition at line 1486 of file drm_edid.c.

Typedef Documentation

typedef void detailed_cb(struct detailed_timing *timing, void *closure)

Definition at line 565 of file drm_edid.c.

Function Documentation

int drm_add_edid_modes ( struct drm_connector connector,
struct edid edid 
)

drm_add_edid_modes - add modes from EDID data, if available : connector we're probing : edid data

Add the specified modes to the connector's mode list.

Return number of modes added or 0 if we couldn't find any.

Definition at line 1972 of file drm_edid.c.

int drm_add_modes_noedid ( struct drm_connector connector,
int  hdisplay,
int  vdisplay 
)

drm_add_modes_noedid - add modes for the connectors without EDID : connector we're probing : the horizontal display limit : the vertical display limit

Add the specified modes to the connector's mode list. Only when the hdisplay/vdisplay is not beyond the given limit, it will be added.

Return number of modes added or 0 if we couldn't find any.

Definition at line 2029 of file drm_edid.c.

int drm_av_sync_delay ( struct drm_connector connector,
struct drm_display_mode mode 
)

drm_av_sync_delay - HDMI/DP sink audio-video sync delay in millisecond : connector associated with the HDMI/DP sink : the display mode

Definition at line 1754 of file drm_edid.c.

bool drm_detect_hdmi_monitor ( struct edid edid)

drm_detect_hdmi_monitor - detect whether monitor is hdmi. : monitor EDID information

Parse the CEA extension according to CEA-861-B. Return true if HDMI, false if not or unknown.

Definition at line 1816 of file drm_edid.c.

bool drm_detect_monitor_audio ( struct edid edid)

drm_detect_monitor_audio - check monitor audio capability

Monitor should have CEA extension block. If monitor has 'basic audio', but no CEA audio blocks, it's 'basic audio' only. If there is any audio extension block and supported audio format, assume at least 'basic audio' support, even if 'basic audio' is not defined in EDID.

Definition at line 1852 of file drm_edid.c.

bool drm_edid_block_valid ( u8 raw_edid,
int  block,
bool  print_bad_edid 
)

Definition at line 164 of file drm_edid.c.

int drm_edid_header_is_valid ( const u8 raw_edid)

Definition at line 143 of file drm_edid.c.

bool drm_edid_is_valid ( struct edid edid)

drm_edid_is_valid - sanity check EDID data : EDID data

Sanity-check an entire EDID record (including extensions)

Definition at line 230 of file drm_edid.c.

void drm_edid_to_eld ( struct drm_connector connector,
struct edid edid 
)

drm_edid_to_eld - build ELD from EDID : connector corresponding to the HDMI/DP sink : EDID to parse

Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. Some ELD fields are left to the graphics driver caller:

  • Conn_Type
  • HDCP
  • Port_ID

Definition at line 1673 of file drm_edid.c.

u8* drm_find_cea_extension ( struct edid edid)

Search EDID for CEA extension block.

Definition at line 1496 of file drm_edid.c.

struct edid* drm_get_edid ( struct drm_connector connector,
struct i2c_adapter adapter 
)
read

drm_get_edid - get EDID data, if available : connector we're probing : i2c adapter to use for DDC

Poke the given i2c channel to grab EDID data if possible. If found, attach it to the connector.

Return edid data or NULL if we couldn't find any.

Definition at line 417 of file drm_edid.c.

struct drm_display_mode* drm_mode_find_dmt ( struct drm_device dev,
int  hsize,
int  vsize,
int  fresh,
bool  rb 
)
read

Definition at line 541 of file drm_edid.c.

bool drm_probe_ddc ( struct i2c_adapter adapter)

Probe DDC presence.

Parameters
adapter: i2c device adaptor
Returns
1 on success

Definition at line 399 of file drm_edid.c.

struct drm_connector* drm_select_eld ( struct drm_encoder encoder,
struct drm_display_mode mode 
)
read

drm_select_eld - select one ELD from multiple HDMI/DP sinks : the encoder just changed display mode : the adjusted display mode

It's possible for one encoder to be associated with multiple HDMI/DP sinks. The policy is now hard coded to simply use the first HDMI/DP sink's ELD.

Definition at line 1795 of file drm_edid.c.

EXPORT_SYMBOL ( drm_edid_header_is_valid  )
EXPORT_SYMBOL ( drm_edid_block_valid  )
EXPORT_SYMBOL ( drm_edid_is_valid  )
EXPORT_SYMBOL ( drm_probe_ddc  )
EXPORT_SYMBOL ( drm_get_edid  )
EXPORT_SYMBOL ( drm_mode_find_dmt  )
EXPORT_SYMBOL ( drm_find_cea_extension  )
EXPORT_SYMBOL ( drm_edid_to_eld  )
EXPORT_SYMBOL ( drm_av_sync_delay  )
EXPORT_SYMBOL ( drm_select_eld  )
EXPORT_SYMBOL ( drm_detect_hdmi_monitor  )
EXPORT_SYMBOL ( drm_detect_monitor_audio  )
EXPORT_SYMBOL ( drm_add_edid_modes  )
EXPORT_SYMBOL ( drm_add_modes_noedid  )
module_param_named ( edid_fixup  ,
edid_fixup  ,
int  ,
0400   
)
MODULE_PARM_DESC ( edid_fixup  ,
"Minimum number of valid EDID header bytes (0-8, default 6)"   
)