drm_connector.h 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376
  1. /*
  2. * Copyright (c) 2016 Intel Corporation
  3. *
  4. * Permission to use, copy, modify, distribute, and sell this software and its
  5. * documentation for any purpose is hereby granted without fee, provided that
  6. * the above copyright notice appear in all copies and that both that copyright
  7. * notice and this permission notice appear in supporting documentation, and
  8. * that the name of the copyright holders not be used in advertising or
  9. * publicity pertaining to distribution of the software without specific,
  10. * written prior permission. The copyright holders make no representations
  11. * about the suitability of this software for any purpose. It is provided "as
  12. * is" without express or implied warranty.
  13. *
  14. * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  16. * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18. * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  19. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  20. * OF THIS SOFTWARE.
  21. */
  22. #ifndef __DRM_CONNECTOR_H__
  23. #define __DRM_CONNECTOR_H__
  24. #include <linux/list.h>
  25. #include <linux/llist.h>
  26. #include <linux/ctype.h>
  27. #include <linux/hdmi.h>
  28. #include <linux/notifier.h>
  29. #include <drm/drm_mode_object.h>
  30. #include <drm/drm_util.h>
  31. #include <drm/drm_property.h>
  32. #include <uapi/drm/drm_mode.h>
  33. struct drm_connector_helper_funcs;
  34. struct drm_modeset_acquire_ctx;
  35. struct drm_device;
  36. struct drm_crtc;
  37. struct drm_display_mode;
  38. struct drm_encoder;
  39. struct drm_panel;
  40. struct drm_property;
  41. struct drm_property_blob;
  42. struct drm_printer;
  43. struct drm_privacy_screen;
  44. struct edid;
  45. struct i2c_adapter;
  46. enum drm_connector_force {
  47. DRM_FORCE_UNSPECIFIED,
  48. DRM_FORCE_OFF,
  49. DRM_FORCE_ON, /* force on analog part normally */
  50. DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
  51. };
  52. /**
  53. * enum drm_connector_status - status for a &drm_connector
  54. *
  55. * This enum is used to track the connector status. There are no separate
  56. * #defines for the uapi!
  57. */
  58. enum drm_connector_status {
  59. /**
  60. * @connector_status_connected: The connector is definitely connected to
  61. * a sink device, and can be enabled.
  62. */
  63. connector_status_connected = 1,
  64. /**
  65. * @connector_status_disconnected: The connector isn't connected to a
  66. * sink device which can be autodetect. For digital outputs like DP or
  67. * HDMI (which can be realiable probed) this means there's really
  68. * nothing there. It is driver-dependent whether a connector with this
  69. * status can be lit up or not.
  70. */
  71. connector_status_disconnected = 2,
  72. /**
  73. * @connector_status_unknown: The connector's status could not be
  74. * reliably detected. This happens when probing would either cause
  75. * flicker (like load-detection when the connector is in use), or when a
  76. * hardware resource isn't available (like when load-detection needs a
  77. * free CRTC). It should be possible to light up the connector with one
  78. * of the listed fallback modes. For default configuration userspace
  79. * should only try to light up connectors with unknown status when
  80. * there's not connector with @connector_status_connected.
  81. */
  82. connector_status_unknown = 3,
  83. };
  84. /**
  85. * enum drm_connector_registration_state - userspace registration status for
  86. * a &drm_connector
  87. *
  88. * This enum is used to track the status of initializing a connector and
  89. * registering it with userspace, so that DRM can prevent bogus modesets on
  90. * connectors that no longer exist.
  91. */
  92. enum drm_connector_registration_state {
  93. /**
  94. * @DRM_CONNECTOR_INITIALIZING: The connector has just been created,
  95. * but has yet to be exposed to userspace. There should be no
  96. * additional restrictions to how the state of this connector may be
  97. * modified.
  98. */
  99. DRM_CONNECTOR_INITIALIZING = 0,
  100. /**
  101. * @DRM_CONNECTOR_REGISTERED: The connector has been fully initialized
  102. * and registered with sysfs, as such it has been exposed to
  103. * userspace. There should be no additional restrictions to how the
  104. * state of this connector may be modified.
  105. */
  106. DRM_CONNECTOR_REGISTERED = 1,
  107. /**
  108. * @DRM_CONNECTOR_UNREGISTERED: The connector has either been exposed
  109. * to userspace and has since been unregistered and removed from
  110. * userspace, or the connector was unregistered before it had a chance
  111. * to be exposed to userspace (e.g. still in the
  112. * @DRM_CONNECTOR_INITIALIZING state). When a connector is
  113. * unregistered, there are additional restrictions to how its state
  114. * may be modified:
  115. *
  116. * - An unregistered connector may only have its DPMS changed from
  117. * On->Off. Once DPMS is changed to Off, it may not be switched back
  118. * to On.
  119. * - Modesets are not allowed on unregistered connectors, unless they
  120. * would result in disabling its assigned CRTCs. This means
  121. * disabling a CRTC on an unregistered connector is OK, but enabling
  122. * one is not.
  123. * - Removing a CRTC from an unregistered connector is OK, but new
  124. * CRTCs may never be assigned to an unregistered connector.
  125. */
  126. DRM_CONNECTOR_UNREGISTERED = 2,
  127. };
  128. enum subpixel_order {
  129. SubPixelUnknown = 0,
  130. SubPixelHorizontalRGB,
  131. SubPixelHorizontalBGR,
  132. SubPixelVerticalRGB,
  133. SubPixelVerticalBGR,
  134. SubPixelNone,
  135. };
  136. /**
  137. * enum drm_connector_tv_mode - Analog TV output mode
  138. *
  139. * This enum is used to indicate the TV output mode used on an analog TV
  140. * connector.
  141. *
  142. * WARNING: The values of this enum is uABI since they're exposed in the
  143. * "TV mode" connector property.
  144. */
  145. enum drm_connector_tv_mode {
  146. /**
  147. * @DRM_MODE_TV_MODE_NTSC: CCIR System M (aka 525-lines)
  148. * together with the NTSC Color Encoding.
  149. */
  150. DRM_MODE_TV_MODE_NTSC,
  151. /**
  152. * @DRM_MODE_TV_MODE_NTSC_443: Variant of
  153. * @DRM_MODE_TV_MODE_NTSC. Uses a color subcarrier frequency
  154. * of 4.43 MHz.
  155. */
  156. DRM_MODE_TV_MODE_NTSC_443,
  157. /**
  158. * @DRM_MODE_TV_MODE_NTSC_J: Variant of @DRM_MODE_TV_MODE_NTSC
  159. * used in Japan. Uses a black level equals to the blanking
  160. * level.
  161. */
  162. DRM_MODE_TV_MODE_NTSC_J,
  163. /**
  164. * @DRM_MODE_TV_MODE_PAL: CCIR System B together with the PAL
  165. * color system.
  166. */
  167. DRM_MODE_TV_MODE_PAL,
  168. /**
  169. * @DRM_MODE_TV_MODE_PAL_M: CCIR System M (aka 525-lines)
  170. * together with the PAL color encoding
  171. */
  172. DRM_MODE_TV_MODE_PAL_M,
  173. /**
  174. * @DRM_MODE_TV_MODE_PAL_N: CCIR System N together with the PAL
  175. * color encoding. It uses 625 lines, but has a color subcarrier
  176. * frequency of 3.58MHz, the SECAM color space, and narrower
  177. * channels compared to most of the other PAL variants.
  178. */
  179. DRM_MODE_TV_MODE_PAL_N,
  180. /**
  181. * @DRM_MODE_TV_MODE_SECAM: CCIR System B together with the
  182. * SECAM color system.
  183. */
  184. DRM_MODE_TV_MODE_SECAM,
  185. /**
  186. * @DRM_MODE_TV_MODE_MONOCHROME: Use timings appropriate to
  187. * the DRM mode, including equalizing pulses for a 525-line
  188. * or 625-line mode, with no pedestal or color encoding.
  189. */
  190. DRM_MODE_TV_MODE_MONOCHROME,
  191. /**
  192. * @DRM_MODE_TV_MODE_MAX: Number of analog TV output modes.
  193. *
  194. * Internal implementation detail; this is not uABI.
  195. */
  196. DRM_MODE_TV_MODE_MAX,
  197. };
  198. /**
  199. * struct drm_scrambling: sink's scrambling support.
  200. */
  201. struct drm_scrambling {
  202. /**
  203. * @supported: scrambling supported for rates > 340 Mhz.
  204. */
  205. bool supported;
  206. /**
  207. * @low_rates: scrambling supported for rates <= 340 Mhz.
  208. */
  209. bool low_rates;
  210. };
  211. /*
  212. * struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink
  213. *
  214. * Provides SCDC register support and capabilities related information on a
  215. * HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0.
  216. */
  217. struct drm_scdc {
  218. /**
  219. * @supported: status control & data channel present.
  220. */
  221. bool supported;
  222. /**
  223. * @read_request: sink is capable of generating scdc read request.
  224. */
  225. bool read_request;
  226. /**
  227. * @scrambling: sink's scrambling capabilities
  228. */
  229. struct drm_scrambling scrambling;
  230. };
  231. /**
  232. * struct drm_hdmi_dsc_cap - DSC capabilities of HDMI sink
  233. *
  234. * Describes the DSC support provided by HDMI 2.1 sink.
  235. * The information is fetched fom additional HFVSDB blocks defined
  236. * for HDMI 2.1.
  237. */
  238. struct drm_hdmi_dsc_cap {
  239. /** @v_1p2: flag for dsc1.2 version support by sink */
  240. bool v_1p2;
  241. /** @native_420: Does sink support DSC with 4:2:0 compression */
  242. bool native_420;
  243. /**
  244. * @all_bpp: Does sink support all bpp with 4:4:4: or 4:2:2
  245. * compressed formats
  246. */
  247. bool all_bpp;
  248. /**
  249. * @bpc_supported: compressed bpc supported by sink : 10, 12 or 16 bpc
  250. */
  251. u8 bpc_supported;
  252. /** @max_slices: maximum number of Horizontal slices supported by */
  253. u8 max_slices;
  254. /** @clk_per_slice : max pixel clock in MHz supported per slice */
  255. int clk_per_slice;
  256. /** @max_lanes : dsc max lanes supported for Fixed rate Link training */
  257. u8 max_lanes;
  258. /** @max_frl_rate_per_lane : maximum frl rate with DSC per lane */
  259. u8 max_frl_rate_per_lane;
  260. /** @total_chunk_kbytes: max size of chunks in KBs supported per line*/
  261. u8 total_chunk_kbytes;
  262. };
  263. /**
  264. * struct drm_hdmi_info - runtime information about the connected HDMI sink
  265. *
  266. * Describes if a given display supports advanced HDMI 2.0 features.
  267. * This information is available in CEA-861-F extension blocks (like HF-VSDB).
  268. */
  269. struct drm_hdmi_info {
  270. /** @scdc: sink's scdc support and capabilities */
  271. struct drm_scdc scdc;
  272. /**
  273. * @y420_vdb_modes: bitmap of modes which can support ycbcr420
  274. * output only (not normal RGB/YCBCR444/422 outputs). The max VIC
  275. * defined by the CEA-861-G spec is 219, so the size is 256 bits to map
  276. * up to 256 VICs.
  277. */
  278. unsigned long y420_vdb_modes[BITS_TO_LONGS(256)];
  279. /**
  280. * @y420_cmdb_modes: bitmap of modes which can support ycbcr420
  281. * output also, along with normal HDMI outputs. The max VIC defined by
  282. * the CEA-861-G spec is 219, so the size is 256 bits to map up to 256
  283. * VICs.
  284. */
  285. unsigned long y420_cmdb_modes[BITS_TO_LONGS(256)];
  286. /** @y420_dc_modes: bitmap of deep color support index */
  287. u8 y420_dc_modes;
  288. /** @max_frl_rate_per_lane: support fixed rate link */
  289. u8 max_frl_rate_per_lane;
  290. /** @max_lanes: supported by sink */
  291. u8 max_lanes;
  292. /** @dsc_cap: DSC capabilities of the sink */
  293. struct drm_hdmi_dsc_cap dsc_cap;
  294. };
  295. /**
  296. * enum drm_link_status - connector's link_status property value
  297. *
  298. * This enum is used as the connector's link status property value.
  299. * It is set to the values defined in uapi.
  300. *
  301. * @DRM_LINK_STATUS_GOOD: DP Link is Good as a result of successful
  302. * link training
  303. * @DRM_LINK_STATUS_BAD: DP Link is BAD as a result of link training
  304. * failure
  305. */
  306. enum drm_link_status {
  307. DRM_LINK_STATUS_GOOD = DRM_MODE_LINK_STATUS_GOOD,
  308. DRM_LINK_STATUS_BAD = DRM_MODE_LINK_STATUS_BAD,
  309. };
  310. /**
  311. * enum drm_panel_orientation - panel_orientation info for &drm_display_info
  312. *
  313. * This enum is used to track the (LCD) panel orientation. There are no
  314. * separate #defines for the uapi!
  315. *
  316. * @DRM_MODE_PANEL_ORIENTATION_UNKNOWN: The drm driver has not provided any
  317. * panel orientation information (normal
  318. * for non panels) in this case the "panel
  319. * orientation" connector prop will not be
  320. * attached.
  321. * @DRM_MODE_PANEL_ORIENTATION_NORMAL: The top side of the panel matches the
  322. * top side of the device's casing.
  323. * @DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP: The top side of the panel matches the
  324. * bottom side of the device's casing, iow
  325. * the panel is mounted upside-down.
  326. * @DRM_MODE_PANEL_ORIENTATION_LEFT_UP: The left side of the panel matches the
  327. * top side of the device's casing.
  328. * @DRM_MODE_PANEL_ORIENTATION_RIGHT_UP: The right side of the panel matches the
  329. * top side of the device's casing.
  330. */
  331. enum drm_panel_orientation {
  332. DRM_MODE_PANEL_ORIENTATION_UNKNOWN = -1,
  333. DRM_MODE_PANEL_ORIENTATION_NORMAL = 0,
  334. DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP,
  335. DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
  336. DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
  337. };
  338. /**
  339. * enum drm_hdmi_broadcast_rgb - Broadcast RGB Selection for an HDMI @drm_connector
  340. */
  341. enum drm_hdmi_broadcast_rgb {
  342. /**
  343. * @DRM_HDMI_BROADCAST_RGB_AUTO: The RGB range is selected
  344. * automatically based on the mode.
  345. */
  346. DRM_HDMI_BROADCAST_RGB_AUTO,
  347. /**
  348. * @DRM_HDMI_BROADCAST_RGB_FULL: Full range RGB is forced.
  349. */
  350. DRM_HDMI_BROADCAST_RGB_FULL,
  351. /**
  352. * @DRM_HDMI_BROADCAST_RGB_LIMITED: Limited range RGB is forced.
  353. */
  354. DRM_HDMI_BROADCAST_RGB_LIMITED,
  355. };
  356. const char *
  357. drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb);
  358. const char *
  359. drm_hdmi_connector_get_output_format_name(enum hdmi_colorspace fmt);
  360. /**
  361. * struct drm_monitor_range_info - Panel's Monitor range in EDID for
  362. * &drm_display_info
  363. *
  364. * This struct is used to store a frequency range supported by panel
  365. * as parsed from EDID's detailed monitor range descriptor block.
  366. *
  367. * @min_vfreq: This is the min supported refresh rate in Hz from
  368. * EDID's detailed monitor range.
  369. * @max_vfreq: This is the max supported refresh rate in Hz from
  370. * EDID's detailed monitor range
  371. */
  372. struct drm_monitor_range_info {
  373. u16 min_vfreq;
  374. u16 max_vfreq;
  375. };
  376. /**
  377. * struct drm_luminance_range_info - Panel's luminance range for
  378. * &drm_display_info. Calculated using data in EDID
  379. *
  380. * This struct is used to store a luminance range supported by panel
  381. * as calculated using data from EDID's static hdr metadata.
  382. *
  383. * @min_luminance: This is the min supported luminance value
  384. *
  385. * @max_luminance: This is the max supported luminance value
  386. */
  387. struct drm_luminance_range_info {
  388. u32 min_luminance;
  389. u32 max_luminance;
  390. };
  391. /**
  392. * enum drm_privacy_screen_status - privacy screen status
  393. *
  394. * This enum is used to track and control the state of the integrated privacy
  395. * screen present on some display panels, via the "privacy-screen sw-state"
  396. * and "privacy-screen hw-state" properties. Note the _LOCKED enum values
  397. * are only valid for the "privacy-screen hw-state" property.
  398. *
  399. * @PRIVACY_SCREEN_DISABLED:
  400. * The privacy-screen on the panel is disabled
  401. * @PRIVACY_SCREEN_ENABLED:
  402. * The privacy-screen on the panel is enabled
  403. * @PRIVACY_SCREEN_DISABLED_LOCKED:
  404. * The privacy-screen on the panel is disabled and locked (cannot be changed)
  405. * @PRIVACY_SCREEN_ENABLED_LOCKED:
  406. * The privacy-screen on the panel is enabled and locked (cannot be changed)
  407. */
  408. enum drm_privacy_screen_status {
  409. PRIVACY_SCREEN_DISABLED = 0,
  410. PRIVACY_SCREEN_ENABLED,
  411. PRIVACY_SCREEN_DISABLED_LOCKED,
  412. PRIVACY_SCREEN_ENABLED_LOCKED,
  413. };
  414. /**
  415. * enum drm_colorspace - color space
  416. *
  417. * This enum is a consolidated colorimetry list supported by HDMI and
  418. * DP protocol standard. The respective connectors will register
  419. * a property with the subset of this list (supported by that
  420. * respective protocol). Userspace will set the colorspace through
  421. * a colorspace property which will be created and exposed to
  422. * userspace.
  423. *
  424. * DP definitions come from the DP v2.0 spec
  425. * HDMI definitions come from the CTA-861-H spec
  426. *
  427. * @DRM_MODE_COLORIMETRY_DEFAULT:
  428. * Driver specific behavior.
  429. * @DRM_MODE_COLORIMETRY_NO_DATA:
  430. * Driver specific behavior.
  431. * @DRM_MODE_COLORIMETRY_SMPTE_170M_YCC:
  432. * (HDMI)
  433. * SMPTE ST 170M colorimetry format
  434. * @DRM_MODE_COLORIMETRY_BT709_YCC:
  435. * (HDMI, DP)
  436. * ITU-R BT.709 colorimetry format
  437. * @DRM_MODE_COLORIMETRY_XVYCC_601:
  438. * (HDMI, DP)
  439. * xvYCC601 colorimetry format
  440. * @DRM_MODE_COLORIMETRY_XVYCC_709:
  441. * (HDMI, DP)
  442. * xvYCC709 colorimetry format
  443. * @DRM_MODE_COLORIMETRY_SYCC_601:
  444. * (HDMI, DP)
  445. * sYCC601 colorimetry format
  446. * @DRM_MODE_COLORIMETRY_OPYCC_601:
  447. * (HDMI, DP)
  448. * opYCC601 colorimetry format
  449. * @DRM_MODE_COLORIMETRY_OPRGB:
  450. * (HDMI, DP)
  451. * opRGB colorimetry format
  452. * @DRM_MODE_COLORIMETRY_BT2020_CYCC:
  453. * (HDMI, DP)
  454. * ITU-R BT.2020 Y'c C'bc C'rc (constant luminance) colorimetry format
  455. * @DRM_MODE_COLORIMETRY_BT2020_RGB:
  456. * (HDMI, DP)
  457. * ITU-R BT.2020 R' G' B' colorimetry format
  458. * @DRM_MODE_COLORIMETRY_BT2020_YCC:
  459. * (HDMI, DP)
  460. * ITU-R BT.2020 Y' C'b C'r colorimetry format
  461. * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65:
  462. * (HDMI)
  463. * SMPTE ST 2113 P3D65 colorimetry format
  464. * @DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER:
  465. * (HDMI)
  466. * SMPTE ST 2113 P3DCI colorimetry format
  467. * @DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED:
  468. * (DP)
  469. * RGB wide gamut fixed point colorimetry format
  470. * @DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT:
  471. * (DP)
  472. * RGB wide gamut floating point
  473. * (scRGB (IEC 61966-2-2)) colorimetry format
  474. * @DRM_MODE_COLORIMETRY_BT601_YCC:
  475. * (DP)
  476. * ITU-R BT.601 colorimetry format
  477. * The DP spec does not say whether this is the 525 or the 625
  478. * line version.
  479. * @DRM_MODE_COLORIMETRY_COUNT:
  480. * Not a valid value; merely used four counting
  481. */
  482. enum drm_colorspace {
  483. /* For Default case, driver will set the colorspace */
  484. DRM_MODE_COLORIMETRY_DEFAULT = 0,
  485. /* CEA 861 Normal Colorimetry options */
  486. DRM_MODE_COLORIMETRY_NO_DATA = 0,
  487. DRM_MODE_COLORIMETRY_SMPTE_170M_YCC = 1,
  488. DRM_MODE_COLORIMETRY_BT709_YCC = 2,
  489. /* CEA 861 Extended Colorimetry Options */
  490. DRM_MODE_COLORIMETRY_XVYCC_601 = 3,
  491. DRM_MODE_COLORIMETRY_XVYCC_709 = 4,
  492. DRM_MODE_COLORIMETRY_SYCC_601 = 5,
  493. DRM_MODE_COLORIMETRY_OPYCC_601 = 6,
  494. DRM_MODE_COLORIMETRY_OPRGB = 7,
  495. DRM_MODE_COLORIMETRY_BT2020_CYCC = 8,
  496. DRM_MODE_COLORIMETRY_BT2020_RGB = 9,
  497. DRM_MODE_COLORIMETRY_BT2020_YCC = 10,
  498. /* Additional Colorimetry extension added as part of CTA 861.G */
  499. DRM_MODE_COLORIMETRY_DCI_P3_RGB_D65 = 11,
  500. DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER = 12,
  501. /* Additional Colorimetry Options added for DP 1.4a VSC Colorimetry Format */
  502. DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED = 13,
  503. DRM_MODE_COLORIMETRY_RGB_WIDE_FLOAT = 14,
  504. DRM_MODE_COLORIMETRY_BT601_YCC = 15,
  505. DRM_MODE_COLORIMETRY_COUNT
  506. };
  507. /**
  508. * enum drm_bus_flags - bus_flags info for &drm_display_info
  509. *
  510. * This enum defines signal polarities and clock edge information for signals on
  511. * a bus as bitmask flags.
  512. *
  513. * The clock edge information is conveyed by two sets of symbols,
  514. * DRM_BUS_FLAGS_*_DRIVE_\* and DRM_BUS_FLAGS_*_SAMPLE_\*. When this enum is
  515. * used to describe a bus from the point of view of the transmitter, the
  516. * \*_DRIVE_\* flags should be used. When used from the point of view of the
  517. * receiver, the \*_SAMPLE_\* flags should be used. The \*_DRIVE_\* and
  518. * \*_SAMPLE_\* flags alias each other, with the \*_SAMPLE_POSEDGE and
  519. * \*_SAMPLE_NEGEDGE flags being equal to \*_DRIVE_NEGEDGE and \*_DRIVE_POSEDGE
  520. * respectively. This simplifies code as signals are usually sampled on the
  521. * opposite edge of the driving edge. Transmitters and receivers may however
  522. * need to take other signal timings into account to convert between driving
  523. * and sample edges.
  524. */
  525. enum drm_bus_flags {
  526. /**
  527. * @DRM_BUS_FLAG_DE_LOW:
  528. *
  529. * The Data Enable signal is active low
  530. */
  531. DRM_BUS_FLAG_DE_LOW = BIT(0),
  532. /**
  533. * @DRM_BUS_FLAG_DE_HIGH:
  534. *
  535. * The Data Enable signal is active high
  536. */
  537. DRM_BUS_FLAG_DE_HIGH = BIT(1),
  538. /**
  539. * @DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE:
  540. *
  541. * Data is driven on the rising edge of the pixel clock
  542. */
  543. DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE = BIT(2),
  544. /**
  545. * @DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE:
  546. *
  547. * Data is driven on the falling edge of the pixel clock
  548. */
  549. DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE = BIT(3),
  550. /**
  551. * @DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE:
  552. *
  553. * Data is sampled on the rising edge of the pixel clock
  554. */
  555. DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
  556. /**
  557. * @DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE:
  558. *
  559. * Data is sampled on the falling edge of the pixel clock
  560. */
  561. DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
  562. /**
  563. * @DRM_BUS_FLAG_DATA_MSB_TO_LSB:
  564. *
  565. * Data is transmitted MSB to LSB on the bus
  566. */
  567. DRM_BUS_FLAG_DATA_MSB_TO_LSB = BIT(4),
  568. /**
  569. * @DRM_BUS_FLAG_DATA_LSB_TO_MSB:
  570. *
  571. * Data is transmitted LSB to MSB on the bus
  572. */
  573. DRM_BUS_FLAG_DATA_LSB_TO_MSB = BIT(5),
  574. /**
  575. * @DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE:
  576. *
  577. * Sync signals are driven on the rising edge of the pixel clock
  578. */
  579. DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE = BIT(6),
  580. /**
  581. * @DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE:
  582. *
  583. * Sync signals are driven on the falling edge of the pixel clock
  584. */
  585. DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE = BIT(7),
  586. /**
  587. * @DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE:
  588. *
  589. * Sync signals are sampled on the rising edge of the pixel clock
  590. */
  591. DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE = DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
  592. /**
  593. * @DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE:
  594. *
  595. * Sync signals are sampled on the falling edge of the pixel clock
  596. */
  597. DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE = DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
  598. /**
  599. * @DRM_BUS_FLAG_SHARP_SIGNALS:
  600. *
  601. * Set if the Sharp-specific signals (SPL, CLS, PS, REV) must be used
  602. */
  603. DRM_BUS_FLAG_SHARP_SIGNALS = BIT(8),
  604. };
  605. /**
  606. * struct drm_display_info - runtime data about the connected sink
  607. *
  608. * Describes a given display (e.g. CRT or flat panel) and its limitations. For
  609. * fixed display sinks like built-in panels there's not much difference between
  610. * this and &struct drm_connector. But for sinks with a real cable this
  611. * structure is meant to describe all the things at the other end of the cable.
  612. *
  613. * For sinks which provide an EDID this can be filled out by calling
  614. * drm_add_edid_modes().
  615. */
  616. struct drm_display_info {
  617. /**
  618. * @width_mm: Physical width in mm.
  619. */
  620. unsigned int width_mm;
  621. /**
  622. * @height_mm: Physical height in mm.
  623. */
  624. unsigned int height_mm;
  625. /**
  626. * @bpc: Maximum bits per color channel. Used by HDMI and DP outputs.
  627. */
  628. unsigned int bpc;
  629. /**
  630. * @subpixel_order: Subpixel order of LCD panels.
  631. */
  632. enum subpixel_order subpixel_order;
  633. #define DRM_COLOR_FORMAT_RGB444 (1<<0)
  634. #define DRM_COLOR_FORMAT_YCBCR444 (1<<1)
  635. #define DRM_COLOR_FORMAT_YCBCR422 (1<<2)
  636. #define DRM_COLOR_FORMAT_YCBCR420 (1<<3)
  637. /**
  638. * @panel_orientation: Read only connector property for built-in panels,
  639. * indicating the orientation of the panel vs the device's casing.
  640. * drm_connector_init() sets this to DRM_MODE_PANEL_ORIENTATION_UNKNOWN.
  641. * When not UNKNOWN this gets used by the drm_fb_helpers to rotate the
  642. * fb to compensate and gets exported as prop to userspace.
  643. */
  644. int panel_orientation;
  645. /**
  646. * @color_formats: HDMI Color formats, selects between RGB and YCrCb
  647. * modes. Used DRM_COLOR_FORMAT\_ defines, which are _not_ the same ones
  648. * as used to describe the pixel format in framebuffers, and also don't
  649. * match the formats in @bus_formats which are shared with v4l.
  650. */
  651. u32 color_formats;
  652. /**
  653. * @bus_formats: Pixel data format on the wire, somewhat redundant with
  654. * @color_formats. Array of size @num_bus_formats encoded using
  655. * MEDIA_BUS_FMT\_ defines shared with v4l and media drivers.
  656. */
  657. const u32 *bus_formats;
  658. /**
  659. * @num_bus_formats: Size of @bus_formats array.
  660. */
  661. unsigned int num_bus_formats;
  662. /**
  663. * @bus_flags: Additional information (like pixel signal polarity) for
  664. * the pixel data on the bus, using &enum drm_bus_flags values
  665. * DRM_BUS_FLAGS\_.
  666. */
  667. u32 bus_flags;
  668. /**
  669. * @max_tmds_clock: Maximum TMDS clock rate supported by the
  670. * sink in kHz. 0 means undefined.
  671. */
  672. int max_tmds_clock;
  673. /**
  674. * @dvi_dual: Dual-link DVI sink?
  675. */
  676. bool dvi_dual;
  677. /**
  678. * @is_hdmi: True if the sink is an HDMI device.
  679. *
  680. * This field shall be used instead of calling
  681. * drm_detect_hdmi_monitor() when possible.
  682. */
  683. bool is_hdmi;
  684. /**
  685. * @has_audio: True if the sink supports audio.
  686. *
  687. * This field shall be used instead of calling
  688. * drm_detect_monitor_audio() when possible.
  689. */
  690. bool has_audio;
  691. /**
  692. * @has_hdmi_infoframe: Does the sink support the HDMI infoframe?
  693. */
  694. bool has_hdmi_infoframe;
  695. /**
  696. * @rgb_quant_range_selectable: Does the sink support selecting
  697. * the RGB quantization range?
  698. */
  699. bool rgb_quant_range_selectable;
  700. /**
  701. * @edid_hdmi_rgb444_dc_modes: Mask of supported hdmi deep color modes
  702. * in RGB 4:4:4. Even more stuff redundant with @bus_formats.
  703. */
  704. u8 edid_hdmi_rgb444_dc_modes;
  705. /**
  706. * @edid_hdmi_ycbcr444_dc_modes: Mask of supported hdmi deep color
  707. * modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats.
  708. */
  709. u8 edid_hdmi_ycbcr444_dc_modes;
  710. /**
  711. * @cea_rev: CEA revision of the HDMI sink.
  712. */
  713. u8 cea_rev;
  714. /**
  715. * @hdmi: advance features of a HDMI sink.
  716. */
  717. struct drm_hdmi_info hdmi;
  718. /**
  719. * @non_desktop: Non desktop display (HMD).
  720. */
  721. bool non_desktop;
  722. /**
  723. * @monitor_range: Frequency range supported by monitor range descriptor
  724. */
  725. struct drm_monitor_range_info monitor_range;
  726. /**
  727. * @luminance_range: Luminance range supported by panel
  728. */
  729. struct drm_luminance_range_info luminance_range;
  730. /**
  731. * @mso_stream_count: eDP Multi-SST Operation (MSO) stream count from
  732. * the DisplayID VESA vendor block. 0 for conventional Single-Stream
  733. * Transport (SST), or 2 or 4 MSO streams.
  734. */
  735. u8 mso_stream_count;
  736. /**
  737. * @mso_pixel_overlap: eDP MSO segment pixel overlap, 0-8 pixels.
  738. */
  739. u8 mso_pixel_overlap;
  740. /**
  741. * @max_dsc_bpp: Maximum DSC target bitrate, if it is set to 0 the
  742. * monitor's default value is used instead.
  743. */
  744. u32 max_dsc_bpp;
  745. /**
  746. * @vics: Array of vics_len VICs. Internal to EDID parsing.
  747. */
  748. u8 *vics;
  749. /**
  750. * @vics_len: Number of elements in vics. Internal to EDID parsing.
  751. */
  752. int vics_len;
  753. /**
  754. * @quirks: EDID based quirks. Internal to EDID parsing.
  755. */
  756. u32 quirks;
  757. /**
  758. * @source_physical_address: Source Physical Address from HDMI
  759. * Vendor-Specific Data Block, for CEC usage.
  760. *
  761. * Defaults to CEC_PHYS_ADDR_INVALID (0xffff).
  762. */
  763. u16 source_physical_address;
  764. };
  765. int drm_display_info_set_bus_formats(struct drm_display_info *info,
  766. const u32 *formats,
  767. unsigned int num_formats);
  768. /**
  769. * struct drm_connector_tv_margins - TV connector related margins
  770. *
  771. * Describes the margins in pixels to put around the image on TV
  772. * connectors to deal with overscan.
  773. */
  774. struct drm_connector_tv_margins {
  775. /**
  776. * @bottom: Bottom margin in pixels.
  777. */
  778. unsigned int bottom;
  779. /**
  780. * @left: Left margin in pixels.
  781. */
  782. unsigned int left;
  783. /**
  784. * @right: Right margin in pixels.
  785. */
  786. unsigned int right;
  787. /**
  788. * @top: Top margin in pixels.
  789. */
  790. unsigned int top;
  791. };
  792. /**
  793. * struct drm_tv_connector_state - TV connector related states
  794. * @select_subconnector: selected subconnector
  795. * @subconnector: detected subconnector
  796. * @margins: TV margins
  797. * @legacy_mode: Legacy TV mode, driver specific value
  798. * @mode: TV mode
  799. * @brightness: brightness in percent
  800. * @contrast: contrast in percent
  801. * @flicker_reduction: flicker reduction in percent
  802. * @overscan: overscan in percent
  803. * @saturation: saturation in percent
  804. * @hue: hue in percent
  805. */
  806. struct drm_tv_connector_state {
  807. enum drm_mode_subconnector select_subconnector;
  808. enum drm_mode_subconnector subconnector;
  809. struct drm_connector_tv_margins margins;
  810. unsigned int legacy_mode;
  811. unsigned int mode;
  812. unsigned int brightness;
  813. unsigned int contrast;
  814. unsigned int flicker_reduction;
  815. unsigned int overscan;
  816. unsigned int saturation;
  817. unsigned int hue;
  818. };
  819. /**
  820. * struct drm_connector_hdmi_infoframe - HDMI Infoframe container
  821. */
  822. struct drm_connector_hdmi_infoframe {
  823. /**
  824. * @data: HDMI Infoframe structure
  825. */
  826. union hdmi_infoframe data;
  827. /**
  828. * @set: Is the content of @data valid?
  829. */
  830. bool set;
  831. };
  832. /*
  833. * struct drm_connector_hdmi_state - HDMI state container
  834. */
  835. struct drm_connector_hdmi_state {
  836. /**
  837. * @broadcast_rgb: Connector property to pass the
  838. * Broadcast RGB selection value.
  839. */
  840. enum drm_hdmi_broadcast_rgb broadcast_rgb;
  841. /**
  842. * @infoframes: HDMI Infoframes matching that state
  843. */
  844. struct {
  845. /**
  846. * @avi: AVI Infoframes structure matching our
  847. * state.
  848. */
  849. struct drm_connector_hdmi_infoframe avi;
  850. /**
  851. * @hdr_drm: DRM (Dynamic Range and Mastering)
  852. * Infoframes structure matching our state.
  853. */
  854. struct drm_connector_hdmi_infoframe hdr_drm;
  855. /**
  856. * @spd: SPD Infoframes structure matching our
  857. * state.
  858. */
  859. struct drm_connector_hdmi_infoframe spd;
  860. /**
  861. * @vendor: HDMI Vendor Infoframes structure
  862. * matching our state.
  863. */
  864. struct drm_connector_hdmi_infoframe hdmi;
  865. } infoframes;
  866. /**
  867. * @is_limited_range: Is the output supposed to use a limited
  868. * RGB Quantization Range or not?
  869. */
  870. bool is_limited_range;
  871. /**
  872. * @output_bpc: Bits per color channel to output.
  873. */
  874. unsigned int output_bpc;
  875. /**
  876. * @output_format: Pixel format to output in.
  877. */
  878. enum hdmi_colorspace output_format;
  879. /**
  880. * @tmds_char_rate: TMDS Character Rate, in Hz.
  881. */
  882. unsigned long long tmds_char_rate;
  883. };
  884. /**
  885. * struct drm_connector_state - mutable connector state
  886. */
  887. struct drm_connector_state {
  888. /** @connector: backpointer to the connector */
  889. struct drm_connector *connector;
  890. /**
  891. * @crtc: CRTC to connect connector to, NULL if disabled.
  892. *
  893. * Do not change this directly, use drm_atomic_set_crtc_for_connector()
  894. * instead.
  895. */
  896. struct drm_crtc *crtc;
  897. /**
  898. * @best_encoder:
  899. *
  900. * Used by the atomic helpers to select the encoder, through the
  901. * &drm_connector_helper_funcs.atomic_best_encoder or
  902. * &drm_connector_helper_funcs.best_encoder callbacks.
  903. *
  904. * This is also used in the atomic helpers to map encoders to their
  905. * current and previous connectors, see
  906. * drm_atomic_get_old_connector_for_encoder() and
  907. * drm_atomic_get_new_connector_for_encoder().
  908. *
  909. * NOTE: Atomic drivers must fill this out (either themselves or through
  910. * helpers), for otherwise the GETCONNECTOR and GETENCODER IOCTLs will
  911. * not return correct data to userspace.
  912. */
  913. struct drm_encoder *best_encoder;
  914. /**
  915. * @link_status: Connector link_status to keep track of whether link is
  916. * GOOD or BAD to notify userspace if retraining is necessary.
  917. */
  918. enum drm_link_status link_status;
  919. /** @state: backpointer to global drm_atomic_state */
  920. struct drm_atomic_state *state;
  921. /**
  922. * @commit: Tracks the pending commit to prevent use-after-free conditions.
  923. *
  924. * Is only set when @crtc is NULL.
  925. */
  926. struct drm_crtc_commit *commit;
  927. /** @tv: TV connector state */
  928. struct drm_tv_connector_state tv;
  929. /**
  930. * @self_refresh_aware:
  931. *
  932. * This tracks whether a connector is aware of the self refresh state.
  933. * It should be set to true for those connector implementations which
  934. * understand the self refresh state. This is needed since the crtc
  935. * registers the self refresh helpers and it doesn't know if the
  936. * connectors downstream have implemented self refresh entry/exit.
  937. *
  938. * Drivers should set this to true in atomic_check if they know how to
  939. * handle self_refresh requests.
  940. */
  941. bool self_refresh_aware;
  942. /**
  943. * @picture_aspect_ratio: Connector property to control the
  944. * HDMI infoframe aspect ratio setting.
  945. *
  946. * The %DRM_MODE_PICTURE_ASPECT_\* values much match the
  947. * values for &enum hdmi_picture_aspect
  948. */
  949. enum hdmi_picture_aspect picture_aspect_ratio;
  950. /**
  951. * @content_type: Connector property to control the
  952. * HDMI infoframe content type setting.
  953. * The %DRM_MODE_CONTENT_TYPE_\* values much
  954. * match the values.
  955. */
  956. unsigned int content_type;
  957. /**
  958. * @hdcp_content_type: Connector property to pass the type of
  959. * protected content. This is most commonly used for HDCP.
  960. */
  961. unsigned int hdcp_content_type;
  962. /**
  963. * @scaling_mode: Connector property to control the
  964. * upscaling, mostly used for built-in panels.
  965. */
  966. unsigned int scaling_mode;
  967. /**
  968. * @content_protection: Connector property to request content
  969. * protection. This is most commonly used for HDCP.
  970. */
  971. unsigned int content_protection;
  972. /**
  973. * @colorspace: State variable for Connector property to request
  974. * colorspace change on Sink. This is most commonly used to switch
  975. * to wider color gamuts like BT2020.
  976. */
  977. enum drm_colorspace colorspace;
  978. /**
  979. * @writeback_job: Writeback job for writeback connectors
  980. *
  981. * Holds the framebuffer and out-fence for a writeback connector. As
  982. * the writeback completion may be asynchronous to the normal commit
  983. * cycle, the writeback job lifetime is managed separately from the
  984. * normal atomic state by this object.
  985. *
  986. * See also: drm_writeback_queue_job() and
  987. * drm_writeback_signal_completion()
  988. */
  989. struct drm_writeback_job *writeback_job;
  990. /**
  991. * @max_requested_bpc: Connector property to limit the maximum bit
  992. * depth of the pixels.
  993. */
  994. u8 max_requested_bpc;
  995. /**
  996. * @max_bpc: Connector max_bpc based on the requested max_bpc property
  997. * and the connector bpc limitations obtained from edid.
  998. */
  999. u8 max_bpc;
  1000. /**
  1001. * @privacy_screen_sw_state: See :ref:`Standard Connector
  1002. * Properties<standard_connector_properties>`
  1003. */
  1004. enum drm_privacy_screen_status privacy_screen_sw_state;
  1005. /**
  1006. * @hdr_output_metadata:
  1007. * DRM blob property for HDR output metadata
  1008. */
  1009. struct drm_property_blob *hdr_output_metadata;
  1010. /**
  1011. * @hdmi: HDMI-related variable and properties. Filled by
  1012. * @drm_atomic_helper_connector_hdmi_check().
  1013. */
  1014. struct drm_connector_hdmi_state hdmi;
  1015. };
  1016. /**
  1017. * struct drm_connector_hdmi_funcs - drm_hdmi_connector control functions
  1018. */
  1019. struct drm_connector_hdmi_funcs {
  1020. /**
  1021. * @tmds_char_rate_valid:
  1022. *
  1023. * This callback is invoked at atomic_check time to figure out
  1024. * whether a particular TMDS character rate is supported by the
  1025. * driver.
  1026. *
  1027. * The @tmds_char_rate_valid callback is optional.
  1028. *
  1029. * Returns:
  1030. *
  1031. * Either &drm_mode_status.MODE_OK or one of the failure reasons
  1032. * in &enum drm_mode_status.
  1033. */
  1034. enum drm_mode_status
  1035. (*tmds_char_rate_valid)(const struct drm_connector *connector,
  1036. const struct drm_display_mode *mode,
  1037. unsigned long long tmds_rate);
  1038. /**
  1039. * @clear_infoframe:
  1040. *
  1041. * This callback is invoked through
  1042. * @drm_atomic_helper_connector_hdmi_update_infoframes during a
  1043. * commit to clear the infoframes into the hardware. It will be
  1044. * called multiple times, once for every disabled infoframe
  1045. * type.
  1046. *
  1047. * The @clear_infoframe callback is optional.
  1048. *
  1049. * Returns:
  1050. * 0 on success, a negative error code otherwise
  1051. */
  1052. int (*clear_infoframe)(struct drm_connector *connector,
  1053. enum hdmi_infoframe_type type);
  1054. /**
  1055. * @write_infoframe:
  1056. *
  1057. * This callback is invoked through
  1058. * @drm_atomic_helper_connector_hdmi_update_infoframes during a
  1059. * commit to program the infoframes into the hardware. It will
  1060. * be called multiple times, once for every updated infoframe
  1061. * type.
  1062. *
  1063. * The @write_infoframe callback is mandatory.
  1064. *
  1065. * Returns:
  1066. * 0 on success, a negative error code otherwise
  1067. */
  1068. int (*write_infoframe)(struct drm_connector *connector,
  1069. enum hdmi_infoframe_type type,
  1070. const u8 *buffer, size_t len);
  1071. };
  1072. /**
  1073. * struct drm_connector_funcs - control connectors on a given device
  1074. *
  1075. * Each CRTC may have one or more connectors attached to it. The functions
  1076. * below allow the core DRM code to control connectors, enumerate available modes,
  1077. * etc.
  1078. */
  1079. struct drm_connector_funcs {
  1080. /**
  1081. * @dpms:
  1082. *
  1083. * Legacy entry point to set the per-connector DPMS state. Legacy DPMS
  1084. * is exposed as a standard property on the connector, but diverted to
  1085. * this callback in the drm core. Note that atomic drivers don't
  1086. * implement the 4 level DPMS support on the connector any more, but
  1087. * instead only have an on/off "ACTIVE" property on the CRTC object.
  1088. *
  1089. * This hook is not used by atomic drivers, remapping of the legacy DPMS
  1090. * property is entirely handled in the DRM core.
  1091. *
  1092. * RETURNS:
  1093. *
  1094. * 0 on success or a negative error code on failure.
  1095. */
  1096. int (*dpms)(struct drm_connector *connector, int mode);
  1097. /**
  1098. * @reset:
  1099. *
  1100. * Reset connector hardware and software state to off. This function isn't
  1101. * called by the core directly, only through drm_mode_config_reset().
  1102. * It's not a helper hook only for historical reasons.
  1103. *
  1104. * Atomic drivers can use drm_atomic_helper_connector_reset() to reset
  1105. * atomic state using this hook.
  1106. */
  1107. void (*reset)(struct drm_connector *connector);
  1108. /**
  1109. * @detect:
  1110. *
  1111. * Check to see if anything is attached to the connector. The parameter
  1112. * force is set to false whilst polling, true when checking the
  1113. * connector due to a user request. force can be used by the driver to
  1114. * avoid expensive, destructive operations during automated probing.
  1115. *
  1116. * This callback is optional, if not implemented the connector will be
  1117. * considered as always being attached.
  1118. *
  1119. * FIXME:
  1120. *
  1121. * Note that this hook is only called by the probe helper. It's not in
  1122. * the helper library vtable purely for historical reasons. The only DRM
  1123. * core entry point to probe connector state is @fill_modes.
  1124. *
  1125. * Note that the helper library will already hold
  1126. * &drm_mode_config.connection_mutex. Drivers which need to grab additional
  1127. * locks to avoid races with concurrent modeset changes need to use
  1128. * &drm_connector_helper_funcs.detect_ctx instead.
  1129. *
  1130. * Also note that this callback can be called no matter the
  1131. * state the connector is in. Drivers that need the underlying
  1132. * device to be powered to perform the detection will first need
  1133. * to make sure it's been properly enabled.
  1134. *
  1135. * RETURNS:
  1136. *
  1137. * drm_connector_status indicating the connector's status.
  1138. */
  1139. enum drm_connector_status (*detect)(struct drm_connector *connector,
  1140. bool force);
  1141. /**
  1142. * @force:
  1143. *
  1144. * This function is called to update internal encoder state when the
  1145. * connector is forced to a certain state by userspace, either through
  1146. * the sysfs interfaces or on the kernel cmdline. In that case the
  1147. * @detect callback isn't called.
  1148. *
  1149. * FIXME:
  1150. *
  1151. * Note that this hook is only called by the probe helper. It's not in
  1152. * the helper library vtable purely for historical reasons. The only DRM
  1153. * core entry point to probe connector state is @fill_modes.
  1154. */
  1155. void (*force)(struct drm_connector *connector);
  1156. /**
  1157. * @fill_modes:
  1158. *
  1159. * Entry point for output detection and basic mode validation. The
  1160. * driver should reprobe the output if needed (e.g. when hotplug
  1161. * handling is unreliable), add all detected modes to &drm_connector.modes
  1162. * and filter out any the device can't support in any configuration. It
  1163. * also needs to filter out any modes wider or higher than the
  1164. * parameters max_width and max_height indicate.
  1165. *
  1166. * The drivers must also prune any modes no longer valid from
  1167. * &drm_connector.modes. Furthermore it must update
  1168. * &drm_connector.status and &drm_connector.edid. If no EDID has been
  1169. * received for this output connector->edid must be NULL.
  1170. *
  1171. * Drivers using the probe helpers should use
  1172. * drm_helper_probe_single_connector_modes() to implement this
  1173. * function.
  1174. *
  1175. * RETURNS:
  1176. *
  1177. * The number of modes detected and filled into &drm_connector.modes.
  1178. */
  1179. int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
  1180. /**
  1181. * @set_property:
  1182. *
  1183. * This is the legacy entry point to update a property attached to the
  1184. * connector.
  1185. *
  1186. * This callback is optional if the driver does not support any legacy
  1187. * driver-private properties. For atomic drivers it is not used because
  1188. * property handling is done entirely in the DRM core.
  1189. *
  1190. * RETURNS:
  1191. *
  1192. * 0 on success or a negative error code on failure.
  1193. */
  1194. int (*set_property)(struct drm_connector *connector, struct drm_property *property,
  1195. uint64_t val);
  1196. /**
  1197. * @late_register:
  1198. *
  1199. * This optional hook can be used to register additional userspace
  1200. * interfaces attached to the connector, light backlight control, i2c,
  1201. * DP aux or similar interfaces. It is called late in the driver load
  1202. * sequence from drm_connector_register() when registering all the
  1203. * core drm connector interfaces. Everything added from this callback
  1204. * should be unregistered in the early_unregister callback.
  1205. *
  1206. * This is called while holding &drm_connector.mutex.
  1207. *
  1208. * Returns:
  1209. *
  1210. * 0 on success, or a negative error code on failure.
  1211. */
  1212. int (*late_register)(struct drm_connector *connector);
  1213. /**
  1214. * @early_unregister:
  1215. *
  1216. * This optional hook should be used to unregister the additional
  1217. * userspace interfaces attached to the connector from
  1218. * late_register(). It is called from drm_connector_unregister(),
  1219. * early in the driver unload sequence to disable userspace access
  1220. * before data structures are torndown.
  1221. *
  1222. * This is called while holding &drm_connector.mutex.
  1223. */
  1224. void (*early_unregister)(struct drm_connector *connector);
  1225. /**
  1226. * @destroy:
  1227. *
  1228. * Clean up connector resources. This is called at driver unload time
  1229. * through drm_mode_config_cleanup(). It can also be called at runtime
  1230. * when a connector is being hot-unplugged for drivers that support
  1231. * connector hotplugging (e.g. DisplayPort MST).
  1232. */
  1233. void (*destroy)(struct drm_connector *connector);
  1234. /**
  1235. * @atomic_duplicate_state:
  1236. *
  1237. * Duplicate the current atomic state for this connector and return it.
  1238. * The core and helpers guarantee that any atomic state duplicated with
  1239. * this hook and still owned by the caller (i.e. not transferred to the
  1240. * driver by calling &drm_mode_config_funcs.atomic_commit) will be
  1241. * cleaned up by calling the @atomic_destroy_state hook in this
  1242. * structure.
  1243. *
  1244. * This callback is mandatory for atomic drivers.
  1245. *
  1246. * Atomic drivers which don't subclass &struct drm_connector_state should use
  1247. * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the
  1248. * state structure to extend it with driver-private state should use
  1249. * __drm_atomic_helper_connector_duplicate_state() to make sure shared state is
  1250. * duplicated in a consistent fashion across drivers.
  1251. *
  1252. * It is an error to call this hook before &drm_connector.state has been
  1253. * initialized correctly.
  1254. *
  1255. * NOTE:
  1256. *
  1257. * If the duplicate state references refcounted resources this hook must
  1258. * acquire a reference for each of them. The driver must release these
  1259. * references again in @atomic_destroy_state.
  1260. *
  1261. * RETURNS:
  1262. *
  1263. * Duplicated atomic state or NULL when the allocation failed.
  1264. */
  1265. struct drm_connector_state *(*atomic_duplicate_state)(struct drm_connector *connector);
  1266. /**
  1267. * @atomic_destroy_state:
  1268. *
  1269. * Destroy a state duplicated with @atomic_duplicate_state and release
  1270. * or unreference all resources it references
  1271. *
  1272. * This callback is mandatory for atomic drivers.
  1273. */
  1274. void (*atomic_destroy_state)(struct drm_connector *connector,
  1275. struct drm_connector_state *state);
  1276. /**
  1277. * @atomic_set_property:
  1278. *
  1279. * Decode a driver-private property value and store the decoded value
  1280. * into the passed-in state structure. Since the atomic core decodes all
  1281. * standardized properties (even for extensions beyond the core set of
  1282. * properties which might not be implemented by all drivers) this
  1283. * requires drivers to subclass the state structure.
  1284. *
  1285. * Such driver-private properties should really only be implemented for
  1286. * truly hardware/vendor specific state. Instead it is preferred to
  1287. * standardize atomic extension and decode the properties used to expose
  1288. * such an extension in the core.
  1289. *
  1290. * Do not call this function directly, use
  1291. * drm_atomic_connector_set_property() instead.
  1292. *
  1293. * This callback is optional if the driver does not support any
  1294. * driver-private atomic properties.
  1295. *
  1296. * NOTE:
  1297. *
  1298. * This function is called in the state assembly phase of atomic
  1299. * modesets, which can be aborted for any reason (including on
  1300. * userspace's request to just check whether a configuration would be
  1301. * possible). Drivers MUST NOT touch any persistent state (hardware or
  1302. * software) or data structures except the passed in @state parameter.
  1303. *
  1304. * Also since userspace controls in which order properties are set this
  1305. * function must not do any input validation (since the state update is
  1306. * incomplete and hence likely inconsistent). Instead any such input
  1307. * validation must be done in the various atomic_check callbacks.
  1308. *
  1309. * RETURNS:
  1310. *
  1311. * 0 if the property has been found, -EINVAL if the property isn't
  1312. * implemented by the driver (which shouldn't ever happen, the core only
  1313. * asks for properties attached to this connector). No other validation
  1314. * is allowed by the driver. The core already checks that the property
  1315. * value is within the range (integer, valid enum value, ...) the driver
  1316. * set when registering the property.
  1317. */
  1318. int (*atomic_set_property)(struct drm_connector *connector,
  1319. struct drm_connector_state *state,
  1320. struct drm_property *property,
  1321. uint64_t val);
  1322. /**
  1323. * @atomic_get_property:
  1324. *
  1325. * Reads out the decoded driver-private property. This is used to
  1326. * implement the GETCONNECTOR IOCTL.
  1327. *
  1328. * Do not call this function directly, use
  1329. * drm_atomic_connector_get_property() instead.
  1330. *
  1331. * This callback is optional if the driver does not support any
  1332. * driver-private atomic properties.
  1333. *
  1334. * RETURNS:
  1335. *
  1336. * 0 on success, -EINVAL if the property isn't implemented by the
  1337. * driver (which shouldn't ever happen, the core only asks for
  1338. * properties attached to this connector).
  1339. */
  1340. int (*atomic_get_property)(struct drm_connector *connector,
  1341. const struct drm_connector_state *state,
  1342. struct drm_property *property,
  1343. uint64_t *val);
  1344. /**
  1345. * @atomic_print_state:
  1346. *
  1347. * If driver subclasses &struct drm_connector_state, it should implement
  1348. * this optional hook for printing additional driver specific state.
  1349. *
  1350. * Do not call this directly, use drm_atomic_connector_print_state()
  1351. * instead.
  1352. */
  1353. void (*atomic_print_state)(struct drm_printer *p,
  1354. const struct drm_connector_state *state);
  1355. /**
  1356. * @oob_hotplug_event:
  1357. *
  1358. * This will get called when a hotplug-event for a drm-connector
  1359. * has been received from a source outside the display driver / device.
  1360. */
  1361. void (*oob_hotplug_event)(struct drm_connector *connector,
  1362. enum drm_connector_status status);
  1363. /**
  1364. * @debugfs_init:
  1365. *
  1366. * Allows connectors to create connector-specific debugfs files.
  1367. */
  1368. void (*debugfs_init)(struct drm_connector *connector, struct dentry *root);
  1369. };
  1370. /**
  1371. * struct drm_cmdline_mode - DRM Mode passed through the kernel command-line
  1372. *
  1373. * Each connector can have an initial mode with additional options
  1374. * passed through the kernel command line. This structure allows to
  1375. * express those parameters and will be filled by the command-line
  1376. * parser.
  1377. */
  1378. struct drm_cmdline_mode {
  1379. /**
  1380. * @name:
  1381. *
  1382. * Name of the mode.
  1383. */
  1384. char name[DRM_DISPLAY_MODE_LEN];
  1385. /**
  1386. * @specified:
  1387. *
  1388. * Has a mode been read from the command-line?
  1389. */
  1390. bool specified;
  1391. /**
  1392. * @refresh_specified:
  1393. *
  1394. * Did the mode have a preferred refresh rate?
  1395. */
  1396. bool refresh_specified;
  1397. /**
  1398. * @bpp_specified:
  1399. *
  1400. * Did the mode have a preferred BPP?
  1401. */
  1402. bool bpp_specified;
  1403. /**
  1404. * @pixel_clock:
  1405. *
  1406. * Pixel Clock in kHz. Optional.
  1407. */
  1408. unsigned int pixel_clock;
  1409. /**
  1410. * @xres:
  1411. *
  1412. * Active resolution on the X axis, in pixels.
  1413. */
  1414. int xres;
  1415. /**
  1416. * @yres:
  1417. *
  1418. * Active resolution on the Y axis, in pixels.
  1419. */
  1420. int yres;
  1421. /**
  1422. * @bpp:
  1423. *
  1424. * Bits per pixels for the mode.
  1425. */
  1426. int bpp;
  1427. /**
  1428. * @refresh:
  1429. *
  1430. * Refresh rate, in Hertz.
  1431. */
  1432. int refresh;
  1433. /**
  1434. * @rb:
  1435. *
  1436. * Do we need to use reduced blanking?
  1437. */
  1438. bool rb;
  1439. /**
  1440. * @interlace:
  1441. *
  1442. * The mode is interlaced.
  1443. */
  1444. bool interlace;
  1445. /**
  1446. * @cvt:
  1447. *
  1448. * The timings will be calculated using the VESA Coordinated
  1449. * Video Timings instead of looking up the mode from a table.
  1450. */
  1451. bool cvt;
  1452. /**
  1453. * @margins:
  1454. *
  1455. * Add margins to the mode calculation (1.8% of xres rounded
  1456. * down to 8 pixels and 1.8% of yres).
  1457. */
  1458. bool margins;
  1459. /**
  1460. * @force:
  1461. *
  1462. * Ignore the hotplug state of the connector, and force its
  1463. * state to one of the DRM_FORCE_* values.
  1464. */
  1465. enum drm_connector_force force;
  1466. /**
  1467. * @rotation_reflection:
  1468. *
  1469. * Initial rotation and reflection of the mode setup from the
  1470. * command line. See DRM_MODE_ROTATE_* and
  1471. * DRM_MODE_REFLECT_*. The only rotations supported are
  1472. * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
  1473. */
  1474. unsigned int rotation_reflection;
  1475. /**
  1476. * @panel_orientation:
  1477. *
  1478. * drm-connector "panel orientation" property override value,
  1479. * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set.
  1480. */
  1481. enum drm_panel_orientation panel_orientation;
  1482. /**
  1483. * @tv_margins: TV margins to apply to the mode.
  1484. */
  1485. struct drm_connector_tv_margins tv_margins;
  1486. /**
  1487. * @tv_mode: TV mode standard. See DRM_MODE_TV_MODE_*.
  1488. */
  1489. enum drm_connector_tv_mode tv_mode;
  1490. /**
  1491. * @tv_mode_specified:
  1492. *
  1493. * Did the mode have a preferred TV mode?
  1494. */
  1495. bool tv_mode_specified;
  1496. };
  1497. /*
  1498. * struct drm_connector_hdmi - DRM Connector HDMI-related structure
  1499. */
  1500. struct drm_connector_hdmi {
  1501. #define DRM_CONNECTOR_HDMI_VENDOR_LEN 8
  1502. /**
  1503. * @vendor: HDMI Controller Vendor Name
  1504. */
  1505. unsigned char vendor[DRM_CONNECTOR_HDMI_VENDOR_LEN] __nonstring;
  1506. #define DRM_CONNECTOR_HDMI_PRODUCT_LEN 16
  1507. /**
  1508. * @product: HDMI Controller Product Name
  1509. */
  1510. unsigned char product[DRM_CONNECTOR_HDMI_PRODUCT_LEN] __nonstring;
  1511. /**
  1512. * @supported_formats: Bitmask of @hdmi_colorspace
  1513. * supported by the controller.
  1514. */
  1515. unsigned long supported_formats;
  1516. /**
  1517. * @funcs: HDMI connector Control Functions
  1518. */
  1519. const struct drm_connector_hdmi_funcs *funcs;
  1520. /**
  1521. * @infoframes: Current Infoframes output by the connector
  1522. */
  1523. struct {
  1524. /**
  1525. * @lock: Mutex protecting against concurrent access to
  1526. * the infoframes, most notably between KMS and ALSA.
  1527. */
  1528. struct mutex lock;
  1529. /**
  1530. * @audio: Current Audio Infoframes structure. Protected
  1531. * by @lock.
  1532. */
  1533. struct drm_connector_hdmi_infoframe audio;
  1534. } infoframes;
  1535. };
  1536. /**
  1537. * struct drm_connector - central DRM connector control structure
  1538. *
  1539. * Each connector may be connected to one or more CRTCs, or may be clonable by
  1540. * another connector if they can share a CRTC. Each connector also has a specific
  1541. * position in the broader display (referred to as a 'screen' though it could
  1542. * span multiple monitors).
  1543. */
  1544. struct drm_connector {
  1545. /** @dev: parent DRM device */
  1546. struct drm_device *dev;
  1547. /** @kdev: kernel device for sysfs attributes */
  1548. struct device *kdev;
  1549. /** @attr: sysfs attributes */
  1550. struct device_attribute *attr;
  1551. /**
  1552. * @fwnode: associated fwnode supplied by platform firmware
  1553. *
  1554. * Drivers can set this to associate a fwnode with a connector, drivers
  1555. * are expected to get a reference on the fwnode when setting this.
  1556. * drm_connector_cleanup() will call fwnode_handle_put() on this.
  1557. */
  1558. struct fwnode_handle *fwnode;
  1559. /**
  1560. * @head:
  1561. *
  1562. * List of all connectors on a @dev, linked from
  1563. * &drm_mode_config.connector_list. Protected by
  1564. * &drm_mode_config.connector_list_lock, but please only use
  1565. * &drm_connector_list_iter to walk this list.
  1566. */
  1567. struct list_head head;
  1568. /**
  1569. * @global_connector_list_entry:
  1570. *
  1571. * Connector entry in the global connector-list, used by
  1572. * drm_connector_find_by_fwnode().
  1573. */
  1574. struct list_head global_connector_list_entry;
  1575. /** @base: base KMS object */
  1576. struct drm_mode_object base;
  1577. /** @name: human readable name, can be overwritten by the driver */
  1578. char *name;
  1579. /**
  1580. * @mutex: Lock for general connector state, but currently only protects
  1581. * @registered. Most of the connector state is still protected by
  1582. * &drm_mode_config.mutex.
  1583. */
  1584. struct mutex mutex;
  1585. /**
  1586. * @index: Compacted connector index, which matches the position inside
  1587. * the mode_config.list for drivers not supporting hot-add/removing. Can
  1588. * be used as an array index. It is invariant over the lifetime of the
  1589. * connector.
  1590. */
  1591. unsigned index;
  1592. /**
  1593. * @connector_type:
  1594. * one of the DRM_MODE_CONNECTOR_<foo> types from drm_mode.h
  1595. */
  1596. int connector_type;
  1597. /** @connector_type_id: index into connector type enum */
  1598. int connector_type_id;
  1599. /**
  1600. * @interlace_allowed:
  1601. * Can this connector handle interlaced modes? Only used by
  1602. * drm_helper_probe_single_connector_modes() for mode filtering.
  1603. */
  1604. bool interlace_allowed;
  1605. /**
  1606. * @doublescan_allowed:
  1607. * Can this connector handle doublescan? Only used by
  1608. * drm_helper_probe_single_connector_modes() for mode filtering.
  1609. */
  1610. bool doublescan_allowed;
  1611. /**
  1612. * @stereo_allowed:
  1613. * Can this connector handle stereo modes? Only used by
  1614. * drm_helper_probe_single_connector_modes() for mode filtering.
  1615. */
  1616. bool stereo_allowed;
  1617. /**
  1618. * @ycbcr_420_allowed : This bool indicates if this connector is
  1619. * capable of handling YCBCR 420 output. While parsing the EDID
  1620. * blocks it's very helpful to know if the source is capable of
  1621. * handling YCBCR 420 outputs.
  1622. */
  1623. bool ycbcr_420_allowed;
  1624. /**
  1625. * @registration_state: Is this connector initializing, exposed
  1626. * (registered) with userspace, or unregistered?
  1627. *
  1628. * Protected by @mutex.
  1629. */
  1630. enum drm_connector_registration_state registration_state;
  1631. /**
  1632. * @modes:
  1633. * Modes available on this connector (from fill_modes() + user).
  1634. * Protected by &drm_mode_config.mutex.
  1635. */
  1636. struct list_head modes;
  1637. /**
  1638. * @status:
  1639. * One of the drm_connector_status enums (connected, not, or unknown).
  1640. * Protected by &drm_mode_config.mutex.
  1641. */
  1642. enum drm_connector_status status;
  1643. /**
  1644. * @probed_modes:
  1645. * These are modes added by probing with DDC or the BIOS, before
  1646. * filtering is applied. Used by the probe helpers. Protected by
  1647. * &drm_mode_config.mutex.
  1648. */
  1649. struct list_head probed_modes;
  1650. /**
  1651. * @display_info: Display information is filled from EDID information
  1652. * when a display is detected. For non hot-pluggable displays such as
  1653. * flat panels in embedded systems, the driver should initialize the
  1654. * &drm_display_info.width_mm and &drm_display_info.height_mm fields
  1655. * with the physical size of the display.
  1656. *
  1657. * Protected by &drm_mode_config.mutex.
  1658. */
  1659. struct drm_display_info display_info;
  1660. /** @funcs: connector control functions */
  1661. const struct drm_connector_funcs *funcs;
  1662. /**
  1663. * @edid_blob_ptr: DRM property containing EDID if present. Protected by
  1664. * &drm_mode_config.mutex.
  1665. *
  1666. * This must be updated only by calling drm_edid_connector_update() or
  1667. * drm_connector_update_edid_property().
  1668. *
  1669. * This must not be used by drivers directly.
  1670. */
  1671. struct drm_property_blob *edid_blob_ptr;
  1672. /** @properties: property tracking for this connector */
  1673. struct drm_object_properties properties;
  1674. /**
  1675. * @scaling_mode_property: Optional atomic property to control the
  1676. * upscaling. See drm_connector_attach_content_protection_property().
  1677. */
  1678. struct drm_property *scaling_mode_property;
  1679. /**
  1680. * @vrr_capable_property: Optional property to help userspace
  1681. * query hardware support for variable refresh rate on a connector.
  1682. * connector. Drivers can add the property to a connector by
  1683. * calling drm_connector_attach_vrr_capable_property().
  1684. *
  1685. * This should be updated only by calling
  1686. * drm_connector_set_vrr_capable_property().
  1687. */
  1688. struct drm_property *vrr_capable_property;
  1689. /**
  1690. * @colorspace_property: Connector property to set the suitable
  1691. * colorspace supported by the sink.
  1692. */
  1693. struct drm_property *colorspace_property;
  1694. /**
  1695. * @path_blob_ptr:
  1696. *
  1697. * DRM blob property data for the DP MST path property. This should only
  1698. * be updated by calling drm_connector_set_path_property().
  1699. */
  1700. struct drm_property_blob *path_blob_ptr;
  1701. /**
  1702. * @max_bpc: Maximum bits per color channel the connector supports.
  1703. */
  1704. unsigned int max_bpc;
  1705. /**
  1706. * @max_bpc_property: Default connector property for the max bpc to be
  1707. * driven out of the connector.
  1708. */
  1709. struct drm_property *max_bpc_property;
  1710. /** @privacy_screen: drm_privacy_screen for this connector, or NULL. */
  1711. struct drm_privacy_screen *privacy_screen;
  1712. /** @privacy_screen_notifier: privacy-screen notifier_block */
  1713. struct notifier_block privacy_screen_notifier;
  1714. /**
  1715. * @privacy_screen_sw_state_property: Optional atomic property for the
  1716. * connector to control the integrated privacy screen.
  1717. */
  1718. struct drm_property *privacy_screen_sw_state_property;
  1719. /**
  1720. * @privacy_screen_hw_state_property: Optional atomic property for the
  1721. * connector to report the actual integrated privacy screen state.
  1722. */
  1723. struct drm_property *privacy_screen_hw_state_property;
  1724. /**
  1725. * @broadcast_rgb_property: Connector property to set the
  1726. * Broadcast RGB selection to output with.
  1727. */
  1728. struct drm_property *broadcast_rgb_property;
  1729. #define DRM_CONNECTOR_POLL_HPD (1 << 0)
  1730. #define DRM_CONNECTOR_POLL_CONNECT (1 << 1)
  1731. #define DRM_CONNECTOR_POLL_DISCONNECT (1 << 2)
  1732. /**
  1733. * @polled:
  1734. *
  1735. * Connector polling mode, a combination of
  1736. *
  1737. * DRM_CONNECTOR_POLL_HPD
  1738. * The connector generates hotplug events and doesn't need to be
  1739. * periodically polled. The CONNECT and DISCONNECT flags must not
  1740. * be set together with the HPD flag.
  1741. *
  1742. * DRM_CONNECTOR_POLL_CONNECT
  1743. * Periodically poll the connector for connection.
  1744. *
  1745. * DRM_CONNECTOR_POLL_DISCONNECT
  1746. * Periodically poll the connector for disconnection, without
  1747. * causing flickering even when the connector is in use. DACs should
  1748. * rarely do this without a lot of testing.
  1749. *
  1750. * Set to 0 for connectors that don't support connection status
  1751. * discovery.
  1752. */
  1753. uint8_t polled;
  1754. /**
  1755. * @dpms: Current dpms state. For legacy drivers the
  1756. * &drm_connector_funcs.dpms callback must update this. For atomic
  1757. * drivers, this is handled by the core atomic code, and drivers must
  1758. * only take &drm_crtc_state.active into account.
  1759. */
  1760. int dpms;
  1761. /** @helper_private: mid-layer private data */
  1762. const struct drm_connector_helper_funcs *helper_private;
  1763. /** @cmdline_mode: mode line parsed from the kernel cmdline for this connector */
  1764. struct drm_cmdline_mode cmdline_mode;
  1765. /** @force: a DRM_FORCE_<foo> state for forced mode sets */
  1766. enum drm_connector_force force;
  1767. /**
  1768. * @edid_override: Override EDID set via debugfs.
  1769. *
  1770. * Do not modify or access outside of the drm_edid_override_* family of
  1771. * functions.
  1772. */
  1773. const struct drm_edid *edid_override;
  1774. /**
  1775. * @edid_override_mutex: Protect access to edid_override.
  1776. */
  1777. struct mutex edid_override_mutex;
  1778. /** @epoch_counter: used to detect any other changes in connector, besides status */
  1779. u64 epoch_counter;
  1780. /**
  1781. * @possible_encoders: Bit mask of encoders that can drive this
  1782. * connector, drm_encoder_index() determines the index into the bitfield
  1783. * and the bits are set with drm_connector_attach_encoder().
  1784. */
  1785. u32 possible_encoders;
  1786. /**
  1787. * @encoder: Currently bound encoder driving this connector, if any.
  1788. * Only really meaningful for non-atomic drivers. Atomic drivers should
  1789. * instead look at &drm_connector_state.best_encoder, and in case they
  1790. * need the CRTC driving this output, &drm_connector_state.crtc.
  1791. */
  1792. struct drm_encoder *encoder;
  1793. #define MAX_ELD_BYTES 128
  1794. /** @eld: EDID-like data, if present, protected by @eld_mutex */
  1795. uint8_t eld[MAX_ELD_BYTES];
  1796. /** @eld_mutex: protection for concurrenct access to @eld */
  1797. struct mutex eld_mutex;
  1798. /** @latency_present: AV delay info from ELD, if found */
  1799. bool latency_present[2];
  1800. /**
  1801. * @video_latency: Video latency info from ELD, if found.
  1802. * [0]: progressive, [1]: interlaced
  1803. */
  1804. int video_latency[2];
  1805. /**
  1806. * @audio_latency: audio latency info from ELD, if found
  1807. * [0]: progressive, [1]: interlaced
  1808. */
  1809. int audio_latency[2];
  1810. /**
  1811. * @ddc: associated ddc adapter.
  1812. * A connector usually has its associated ddc adapter. If a driver uses
  1813. * this field, then an appropriate symbolic link is created in connector
  1814. * sysfs directory to make it easy for the user to tell which i2c
  1815. * adapter is for a particular display.
  1816. *
  1817. * The field should be set by calling drm_connector_init_with_ddc().
  1818. */
  1819. struct i2c_adapter *ddc;
  1820. /**
  1821. * @null_edid_counter: track sinks that give us all zeros for the EDID.
  1822. * Needed to workaround some HW bugs where we get all 0s
  1823. */
  1824. int null_edid_counter;
  1825. /** @bad_edid_counter: track sinks that give us an EDID with invalid checksum */
  1826. unsigned bad_edid_counter;
  1827. /**
  1828. * @edid_corrupt: Indicates whether the last read EDID was corrupt. Used
  1829. * in Displayport compliance testing - Displayport Link CTS Core 1.2
  1830. * rev1.1 4.2.2.6
  1831. */
  1832. bool edid_corrupt;
  1833. /**
  1834. * @real_edid_checksum: real edid checksum for corrupted edid block.
  1835. * Required in Displayport 1.4 compliance testing
  1836. * rev1.1 4.2.2.6
  1837. */
  1838. u8 real_edid_checksum;
  1839. /** @debugfs_entry: debugfs directory for this connector */
  1840. struct dentry *debugfs_entry;
  1841. /**
  1842. * @state:
  1843. *
  1844. * Current atomic state for this connector.
  1845. *
  1846. * This is protected by &drm_mode_config.connection_mutex. Note that
  1847. * nonblocking atomic commits access the current connector state without
  1848. * taking locks. Either by going through the &struct drm_atomic_state
  1849. * pointers, see for_each_oldnew_connector_in_state(),
  1850. * for_each_old_connector_in_state() and
  1851. * for_each_new_connector_in_state(). Or through careful ordering of
  1852. * atomic commit operations as implemented in the atomic helpers, see
  1853. * &struct drm_crtc_commit.
  1854. */
  1855. struct drm_connector_state *state;
  1856. /* DisplayID bits. FIXME: Extract into a substruct? */
  1857. /**
  1858. * @tile_blob_ptr:
  1859. *
  1860. * DRM blob property data for the tile property (used mostly by DP MST).
  1861. * This is meant for screens which are driven through separate display
  1862. * pipelines represented by &drm_crtc, which might not be running with
  1863. * genlocked clocks. For tiled panels which are genlocked, like
  1864. * dual-link LVDS or dual-link DSI, the driver should try to not expose
  1865. * the tiling and virtualize both &drm_crtc and &drm_plane if needed.
  1866. *
  1867. * This should only be updated by calling
  1868. * drm_connector_set_tile_property().
  1869. */
  1870. struct drm_property_blob *tile_blob_ptr;
  1871. /** @has_tile: is this connector connected to a tiled monitor */
  1872. bool has_tile;
  1873. /** @tile_group: tile group for the connected monitor */
  1874. struct drm_tile_group *tile_group;
  1875. /** @tile_is_single_monitor: whether the tile is one monitor housing */
  1876. bool tile_is_single_monitor;
  1877. /** @num_h_tile: number of horizontal tiles in the tile group */
  1878. /** @num_v_tile: number of vertical tiles in the tile group */
  1879. uint8_t num_h_tile, num_v_tile;
  1880. /** @tile_h_loc: horizontal location of this tile */
  1881. /** @tile_v_loc: vertical location of this tile */
  1882. uint8_t tile_h_loc, tile_v_loc;
  1883. /** @tile_h_size: horizontal size of this tile. */
  1884. /** @tile_v_size: vertical size of this tile. */
  1885. uint16_t tile_h_size, tile_v_size;
  1886. /**
  1887. * @free_node:
  1888. *
  1889. * List used only by &drm_connector_list_iter to be able to clean up a
  1890. * connector from any context, in conjunction with
  1891. * &drm_mode_config.connector_free_work.
  1892. */
  1893. struct llist_node free_node;
  1894. /** @hdr_sink_metadata: HDR Metadata Information read from sink */
  1895. struct hdr_sink_metadata hdr_sink_metadata;
  1896. /**
  1897. * @hdmi: HDMI-related variable and properties.
  1898. */
  1899. struct drm_connector_hdmi hdmi;
  1900. };
  1901. #define obj_to_connector(x) container_of(x, struct drm_connector, base)
  1902. int drm_connector_init(struct drm_device *dev,
  1903. struct drm_connector *connector,
  1904. const struct drm_connector_funcs *funcs,
  1905. int connector_type);
  1906. int drm_connector_init_with_ddc(struct drm_device *dev,
  1907. struct drm_connector *connector,
  1908. const struct drm_connector_funcs *funcs,
  1909. int connector_type,
  1910. struct i2c_adapter *ddc);
  1911. int drmm_connector_init(struct drm_device *dev,
  1912. struct drm_connector *connector,
  1913. const struct drm_connector_funcs *funcs,
  1914. int connector_type,
  1915. struct i2c_adapter *ddc);
  1916. int drmm_connector_hdmi_init(struct drm_device *dev,
  1917. struct drm_connector *connector,
  1918. const char *vendor, const char *product,
  1919. const struct drm_connector_funcs *funcs,
  1920. const struct drm_connector_hdmi_funcs *hdmi_funcs,
  1921. int connector_type,
  1922. struct i2c_adapter *ddc,
  1923. unsigned long supported_formats,
  1924. unsigned int max_bpc);
  1925. void drm_connector_attach_edid_property(struct drm_connector *connector);
  1926. int drm_connector_register(struct drm_connector *connector);
  1927. void drm_connector_unregister(struct drm_connector *connector);
  1928. int drm_connector_attach_encoder(struct drm_connector *connector,
  1929. struct drm_encoder *encoder);
  1930. void drm_connector_cleanup(struct drm_connector *connector);
  1931. static inline unsigned int drm_connector_index(const struct drm_connector *connector)
  1932. {
  1933. return connector->index;
  1934. }
  1935. static inline u32 drm_connector_mask(const struct drm_connector *connector)
  1936. {
  1937. return 1 << connector->index;
  1938. }
  1939. /**
  1940. * drm_connector_lookup - lookup connector object
  1941. * @dev: DRM device
  1942. * @file_priv: drm file to check for lease against.
  1943. * @id: connector object id
  1944. *
  1945. * This function looks up the connector object specified by id
  1946. * add takes a reference to it.
  1947. */
  1948. static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
  1949. struct drm_file *file_priv,
  1950. uint32_t id)
  1951. {
  1952. struct drm_mode_object *mo;
  1953. mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);
  1954. return mo ? obj_to_connector(mo) : NULL;
  1955. }
  1956. /**
  1957. * drm_connector_get - acquire a connector reference
  1958. * @connector: DRM connector
  1959. *
  1960. * This function increments the connector's refcount.
  1961. */
  1962. static inline void drm_connector_get(struct drm_connector *connector)
  1963. {
  1964. drm_mode_object_get(&connector->base);
  1965. }
  1966. /**
  1967. * drm_connector_put - release a connector reference
  1968. * @connector: DRM connector
  1969. *
  1970. * This function decrements the connector's reference count and frees the
  1971. * object if the reference count drops to zero.
  1972. */
  1973. static inline void drm_connector_put(struct drm_connector *connector)
  1974. {
  1975. drm_mode_object_put(&connector->base);
  1976. }
  1977. /**
  1978. * drm_connector_is_unregistered - has the connector been unregistered from
  1979. * userspace?
  1980. * @connector: DRM connector
  1981. *
  1982. * Checks whether or not @connector has been unregistered from userspace.
  1983. *
  1984. * Returns:
  1985. * True if the connector was unregistered, false if the connector is
  1986. * registered or has not yet been registered with userspace.
  1987. */
  1988. static inline bool
  1989. drm_connector_is_unregistered(struct drm_connector *connector)
  1990. {
  1991. return READ_ONCE(connector->registration_state) ==
  1992. DRM_CONNECTOR_UNREGISTERED;
  1993. }
  1994. void drm_connector_oob_hotplug_event(struct fwnode_handle *connector_fwnode,
  1995. enum drm_connector_status status);
  1996. const char *drm_get_connector_type_name(unsigned int connector_type);
  1997. const char *drm_get_connector_status_name(enum drm_connector_status status);
  1998. const char *drm_get_subpixel_order_name(enum subpixel_order order);
  1999. const char *drm_get_dpms_name(int val);
  2000. const char *drm_get_dvi_i_subconnector_name(int val);
  2001. const char *drm_get_dvi_i_select_name(int val);
  2002. const char *drm_get_tv_mode_name(int val);
  2003. const char *drm_get_tv_subconnector_name(int val);
  2004. const char *drm_get_tv_select_name(int val);
  2005. const char *drm_get_dp_subconnector_name(int val);
  2006. const char *drm_get_content_protection_name(int val);
  2007. const char *drm_get_hdcp_content_type_name(int val);
  2008. int drm_get_tv_mode_from_name(const char *name, size_t len);
  2009. int drm_mode_create_dvi_i_properties(struct drm_device *dev);
  2010. void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector);
  2011. int drm_mode_create_tv_margin_properties(struct drm_device *dev);
  2012. int drm_mode_create_tv_properties_legacy(struct drm_device *dev,
  2013. unsigned int num_modes,
  2014. const char * const modes[]);
  2015. int drm_mode_create_tv_properties(struct drm_device *dev,
  2016. unsigned int supported_tv_modes);
  2017. void drm_connector_attach_tv_margin_properties(struct drm_connector *conn);
  2018. int drm_mode_create_scaling_mode_property(struct drm_device *dev);
  2019. int drm_connector_attach_content_type_property(struct drm_connector *dev);
  2020. int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
  2021. u32 scaling_mode_mask);
  2022. int drm_connector_attach_vrr_capable_property(
  2023. struct drm_connector *connector);
  2024. int drm_connector_attach_broadcast_rgb_property(struct drm_connector *connector);
  2025. int drm_connector_attach_colorspace_property(struct drm_connector *connector);
  2026. int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
  2027. bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,
  2028. struct drm_connector_state *new_state);
  2029. int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
  2030. int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector,
  2031. u32 supported_colorspaces);
  2032. int drm_mode_create_dp_colorspace_property(struct drm_connector *connector,
  2033. u32 supported_colorspaces);
  2034. int drm_mode_create_content_type_property(struct drm_device *dev);
  2035. int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
  2036. int drm_connector_set_path_property(struct drm_connector *connector,
  2037. const char *path);
  2038. int drm_connector_set_tile_property(struct drm_connector *connector);
  2039. int drm_connector_update_edid_property(struct drm_connector *connector,
  2040. const struct edid *edid);
  2041. void drm_connector_set_link_status_property(struct drm_connector *connector,
  2042. uint64_t link_status);
  2043. void drm_connector_set_vrr_capable_property(
  2044. struct drm_connector *connector, bool capable);
  2045. int drm_connector_set_panel_orientation(
  2046. struct drm_connector *connector,
  2047. enum drm_panel_orientation panel_orientation);
  2048. int drm_connector_set_panel_orientation_with_quirk(
  2049. struct drm_connector *connector,
  2050. enum drm_panel_orientation panel_orientation,
  2051. int width, int height);
  2052. int drm_connector_set_orientation_from_panel(
  2053. struct drm_connector *connector,
  2054. struct drm_panel *panel);
  2055. int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
  2056. int min, int max);
  2057. void drm_connector_create_privacy_screen_properties(struct drm_connector *conn);
  2058. void drm_connector_attach_privacy_screen_properties(struct drm_connector *conn);
  2059. void drm_connector_attach_privacy_screen_provider(
  2060. struct drm_connector *connector, struct drm_privacy_screen *priv);
  2061. void drm_connector_update_privacy_screen(const struct drm_connector_state *connector_state);
  2062. /**
  2063. * struct drm_tile_group - Tile group metadata
  2064. * @refcount: reference count
  2065. * @dev: DRM device
  2066. * @id: tile group id exposed to userspace
  2067. * @group_data: Sink-private data identifying this group
  2068. *
  2069. * @group_data corresponds to displayid vend/prod/serial for external screens
  2070. * with an EDID.
  2071. */
  2072. struct drm_tile_group {
  2073. struct kref refcount;
  2074. struct drm_device *dev;
  2075. int id;
  2076. u8 group_data[8];
  2077. };
  2078. struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
  2079. const char topology[8]);
  2080. struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
  2081. const char topology[8]);
  2082. void drm_mode_put_tile_group(struct drm_device *dev,
  2083. struct drm_tile_group *tg);
  2084. /**
  2085. * struct drm_connector_list_iter - connector_list iterator
  2086. *
  2087. * This iterator tracks state needed to be able to walk the connector_list
  2088. * within struct drm_mode_config. Only use together with
  2089. * drm_connector_list_iter_begin(), drm_connector_list_iter_end() and
  2090. * drm_connector_list_iter_next() respectively the convenience macro
  2091. * drm_for_each_connector_iter().
  2092. *
  2093. * Note that the return value of drm_connector_list_iter_next() is only valid
  2094. * up to the next drm_connector_list_iter_next() or
  2095. * drm_connector_list_iter_end() call. If you want to use the connector later,
  2096. * then you need to grab your own reference first using drm_connector_get().
  2097. */
  2098. struct drm_connector_list_iter {
  2099. /* private: */
  2100. struct drm_device *dev;
  2101. struct drm_connector *conn;
  2102. };
  2103. void drm_connector_list_iter_begin(struct drm_device *dev,
  2104. struct drm_connector_list_iter *iter);
  2105. struct drm_connector *
  2106. drm_connector_list_iter_next(struct drm_connector_list_iter *iter);
  2107. void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);
  2108. bool drm_connector_has_possible_encoder(struct drm_connector *connector,
  2109. struct drm_encoder *encoder);
  2110. const char *drm_get_colorspace_name(enum drm_colorspace colorspace);
  2111. /**
  2112. * drm_for_each_connector_iter - connector_list iterator macro
  2113. * @connector: &struct drm_connector pointer used as cursor
  2114. * @iter: &struct drm_connector_list_iter
  2115. *
  2116. * Note that @connector is only valid within the list body, if you want to use
  2117. * @connector after calling drm_connector_list_iter_end() then you need to grab
  2118. * your own reference first using drm_connector_get().
  2119. */
  2120. #define drm_for_each_connector_iter(connector, iter) \
  2121. while ((connector = drm_connector_list_iter_next(iter)))
  2122. /**
  2123. * drm_connector_for_each_possible_encoder - iterate connector's possible encoders
  2124. * @connector: &struct drm_connector pointer
  2125. * @encoder: &struct drm_encoder pointer used as cursor
  2126. */
  2127. #define drm_connector_for_each_possible_encoder(connector, encoder) \
  2128. drm_for_each_encoder_mask(encoder, (connector)->dev, \
  2129. (connector)->possible_encoders)
  2130. #endif