drm_connector.h 60 KB

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