drm_connector.h 76 KB

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