Sachin Bhayare | eeb8889 | 2018-01-02 16:36:01 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #ifndef _MSM_DBA_H |
| 15 | #define _MSM_DBA_H |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/bitops.h> |
| 19 | |
| 20 | #define MSM_DBA_CHIP_NAME_MAX_LEN 20 |
| 21 | #define MSM_DBA_CLIENT_NAME_LEN 20 |
| 22 | |
| 23 | #define MSM_DBA_DEFER_PROPERTY_FLAG 0x1 |
| 24 | #define MSM_DBA_ASYNC_FLAG 0x2 |
| 25 | |
| 26 | /** |
| 27 | * enum msm_dba_callback_event - event types for callback notification |
| 28 | * @MSM_DBA_CB_REMOTE_INT: Event associated with remote devices on an interface |
| 29 | * that supports a bi-directional control channel. |
| 30 | * @MSM_DBA_CB_HDCP_LINK_AUTHENTICATED: Authentication session is successful. |
| 31 | * The link is authenticated and encryption |
| 32 | * can be enabled if not enabled already. |
| 33 | * @MSM_DBA_CB_HDCP_LINK_UNAUTHENTICATED: A previously authenticated link has |
| 34 | * failed. The content on the interface |
| 35 | * is no longer secure. |
| 36 | * @MSM_DBA_CB_HPD_CONNECT: Detected a cable connect event. |
| 37 | * @MSM_DBA_CB_HPD_DISCONNECT: Detected a cable disconnect event. |
| 38 | * @MSM_DBA_CB_VIDEO_FAILURE: Detected a failure with respect to video data on |
| 39 | * the interface. This is a generic failure and |
| 40 | * client should request a debug dump to debug the |
| 41 | * issue. Client can also attempt a reset to recover |
| 42 | * the device. |
| 43 | * @MSM_DBA_CB_AUDIO_FAILURE: Detected a failure with respect to audio data on |
| 44 | * the interface. This is a generic failure and |
| 45 | * client should request a debug dump. Client can |
| 46 | * also attempt a reset to recover the device. |
| 47 | * @MSM_DBA_CB_CEC_WRITE_SUCCESS: The asynchronous CEC write request is |
| 48 | * successful. |
| 49 | * @MSM_DBA_CB_CEC_WRITE_FAIL: The asynchronous CEC write request failed. |
| 50 | * @MSM_DBA_CB_CEC_READ_PENDING: There is a pending CEC read message. |
| 51 | * @MSM_DBA_CB_PRE_RESET: This callback is called just before the device is |
| 52 | * being reset. |
| 53 | * @MSM_DBA_CB_POST_RESET: This callback is called after device reset is |
| 54 | * complete and the driver has applied back all the |
| 55 | * properties. |
| 56 | * |
| 57 | * Clients for this driver can register for receiving callbacks for specific |
| 58 | * events. This enum defines the type of events supported by the driver. An |
| 59 | * event mask is typically used to denote multiple events. |
| 60 | */ |
| 61 | enum msm_dba_callback_event { |
| 62 | MSM_DBA_CB_REMOTE_INT = BIT(0), |
| 63 | MSM_DBA_CB_HDCP_LINK_AUTHENTICATED = BIT(1), |
| 64 | MSM_DBA_CB_HDCP_LINK_UNAUTHENTICATED = BIT(2), |
| 65 | MSM_DBA_CB_HPD_CONNECT = BIT(3), |
| 66 | MSM_DBA_CB_HPD_DISCONNECT = BIT(4), |
| 67 | MSM_DBA_CB_VIDEO_FAILURE = BIT(5), |
| 68 | MSM_DBA_CB_AUDIO_FAILURE = BIT(6), |
| 69 | MSM_DBA_CB_CEC_WRITE_SUCCESS = BIT(7), |
| 70 | MSM_DBA_CB_CEC_WRITE_FAIL = BIT(8), |
| 71 | MSM_DBA_CB_CEC_READ_PENDING = BIT(9), |
| 72 | MSM_DBA_CB_PRE_RESET = BIT(10), |
| 73 | MSM_DBA_CB_POST_RESET = BIT(11), |
| 74 | }; |
| 75 | |
| 76 | /** |
| 77 | * enum msm_dba_audio_interface_type - audio interface type |
| 78 | * @MSM_DBA_AUDIO_I2S_INTERFACE: I2S interface for audio |
| 79 | * @MSM_DBA_AUDIO_SPDIF_INTERFACE: SPDIF interface for audio |
| 80 | */ |
| 81 | enum msm_dba_audio_interface_type { |
| 82 | MSM_DBA_AUDIO_I2S_INTERFACE = BIT(0), |
| 83 | MSM_DBA_AUDIO_SPDIF_INTERFACE = BIT(1), |
| 84 | }; |
| 85 | |
| 86 | /** |
| 87 | * enum msm_dba_audio_format_type - audio format type |
| 88 | * @MSM_DBA_AUDIO_FMT_UNCOMPRESSED_LPCM: uncompressed format |
| 89 | * @MSM_DBA_AUDIO_FMT_COMPRESSED: compressed formats |
| 90 | */ |
| 91 | enum msm_dba_audio_format_type { |
| 92 | MSM_DBA_AUDIO_FMT_UNCOMPRESSED_LPCM = BIT(0), |
| 93 | MSM_DBA_AUDIO_FMT_COMPRESSED = BIT(1), |
| 94 | }; |
| 95 | |
| 96 | /** |
| 97 | * enum msm_dba_audio_copyright_type - audio copyright |
| 98 | * @MSM_DBA_AUDIO_COPYRIGHT_PROTECTED: copy right protected |
| 99 | * @MSM_DBA_AUDIO_COPYRIGHT_NOT_PROTECTED: not copy right protected |
| 100 | */ |
| 101 | enum msm_dba_audio_copyright_type { |
| 102 | MSM_DBA_AUDIO_COPYRIGHT_PROTECTED = BIT(0), |
| 103 | MSM_DBA_AUDIO_COPYRIGHT_NOT_PROTECTED = BIT(1), |
| 104 | }; |
| 105 | |
| 106 | /** |
| 107 | * enum msm_dba_audio_pre_emphasis_type - pre-emphasis |
| 108 | * @MSM_DBA_AUDIO_NO_PRE_EMPHASIS: 2 audio channels w/o pre-emphasis |
| 109 | * @MSM_DBA_AUDIO_PRE_EMPHASIS_50_15us: 2 audio channels with 50/15uS |
| 110 | */ |
| 111 | enum msm_dba_audio_pre_emphasis_type { |
| 112 | MSM_DBA_AUDIO_NO_PRE_EMPHASIS = BIT(0), |
| 113 | MSM_DBA_AUDIO_PRE_EMPHASIS_50_15us = BIT(1), |
| 114 | }; |
| 115 | |
| 116 | /** |
| 117 | * enum msm_dba_audio_clock_accuracy - Audio Clock Accuracy |
| 118 | * @MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL1: normal accuracy +/-1000 x 10^-6 |
| 119 | * @MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL2: high accuracy +/- 50 x 10^-6 |
| 120 | * @MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL3: variable pitch shifted clock |
| 121 | */ |
| 122 | enum msm_dba_audio_clock_accuracy { |
| 123 | MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL1 = BIT(1), |
| 124 | MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL2 = BIT(0), |
| 125 | MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL3 = BIT(2), |
| 126 | }; |
| 127 | |
| 128 | /** |
| 129 | * enum msm_dba_channel_status_source - CS override |
| 130 | * @MSM_DBA_AUDIO_CS_SOURCE_I2S_STREAM: use channel status bits from I2S stream |
| 131 | * @MSM_DBA_AUDIO_CS_SOURCE_REGISTERS: use channel status bits from registers |
| 132 | */ |
| 133 | enum msm_dba_channel_status_source { |
| 134 | MSM_DBA_AUDIO_CS_SOURCE_I2S_STREAM, |
| 135 | MSM_DBA_AUDIO_CS_SOURCE_REGISTERS |
| 136 | }; |
| 137 | |
| 138 | /** |
| 139 | * enum msm_dba_audio_sampling_rates_type - audio sampling rates |
| 140 | * @MSM_DBA_AUDIO_32KHZ: 32KHz sampling rate |
| 141 | * @MSM_DBA_AUDIO_44P1KHZ: 44.1KHz sampling rate |
| 142 | * @MSM_DBA_AUDIO_48KHZ: 48KHz sampling rate |
| 143 | * @MSM_DBA_AUDIO_96KHZ: 96KHz sampling rate |
| 144 | * @MSM_DBA_AUDIO_192KHZ: 192KHz sampling rate |
| 145 | */ |
| 146 | enum msm_dba_audio_sampling_rates_type { |
| 147 | MSM_DBA_AUDIO_32KHZ = BIT(0), |
| 148 | MSM_DBA_AUDIO_44P1KHZ = BIT(1), |
| 149 | MSM_DBA_AUDIO_48KHZ = BIT(2), |
| 150 | MSM_DBA_AUDIO_88P2KHZ = BIT(1), |
| 151 | MSM_DBA_AUDIO_96KHZ = BIT(3), |
| 152 | MSM_DBA_AUDIO_176P4KHZ = BIT(1), |
| 153 | MSM_DBA_AUDIO_192KHZ = BIT(4), |
| 154 | }; |
| 155 | |
| 156 | /** |
| 157 | * enum msm_dba_audio_word_bit_depth - audio word size |
| 158 | * @MSM_DBA_AUDIO_WORD_16BIT: 16 bits per word |
| 159 | * @MSM_DBA_AUDIO_WORD_24BIT: 24 bits per word |
| 160 | * @MSM_DBA_AUDIO_WORD_32BIT: 32 bits per word |
| 161 | */ |
| 162 | enum msm_dba_audio_word_bit_depth { |
| 163 | MSM_DBA_AUDIO_WORD_16BIT = BIT(1), |
| 164 | MSM_DBA_AUDIO_WORD_24BIT = BIT(2), |
| 165 | MSM_DBA_AUDIO_WORD_32BIT = BIT(3), |
| 166 | }; |
| 167 | |
| 168 | /** |
| 169 | * enum msm_dba_audio_channel_count - audio channel count |
| 170 | * @MSM_DBA_AUDIO_CHANNEL_2: 2 channel audio |
| 171 | * @MSM_DBA_AUDIO_CHANNEL_4: 4 channel audio |
| 172 | * @MSM_DBA_AUDIO_CHANNEL_8: 8 channel audio |
| 173 | */ |
| 174 | enum msm_dba_audio_channel_count { |
| 175 | MSM_DBA_AUDIO_CHANNEL_2 = BIT(0), |
| 176 | MSM_DBA_AUDIO_CHANNEL_4 = BIT(1), |
| 177 | MSM_DBA_AUDIO_CHANNEL_8 = BIT(2), |
| 178 | }; |
| 179 | |
| 180 | /** |
| 181 | * enum msm_dba_audio_i2s_format - i2s audio data format |
| 182 | * @MSM_DBA_AUDIO_I2S_FMT_STANDARD: Standard format |
| 183 | * @MSM_DBA_AUDIO_I2S_FMT_RIGHT_JUSTIFIED: i2s data is right justified |
| 184 | * @MSM_DBA_AUDIO_I2S_FMT_LEFT_JUSTIFIED: i2s data is left justified |
| 185 | * @MSM_DBA_AUDIO_I2S_FMT_AES3_DIRECT: AES signal format |
| 186 | */ |
| 187 | enum msm_dba_audio_i2s_format { |
| 188 | MSM_DBA_AUDIO_I2S_FMT_STANDARD = 0, |
| 189 | MSM_DBA_AUDIO_I2S_FMT_RIGHT_JUSTIFIED, |
| 190 | MSM_DBA_AUDIO_I2S_FMT_LEFT_JUSTIFIED, |
| 191 | MSM_DBA_AUDIO_I2S_FMT_AES3_DIRECT, |
| 192 | MSM_DBA_AUDIO_I2S_FMT_MAX, |
| 193 | }; |
| 194 | |
| 195 | enum msm_dba_video_aspect_ratio { |
| 196 | MSM_DBA_AR_UNKNOWN = 0, |
| 197 | MSM_DBA_AR_4_3, |
| 198 | MSM_DBA_AR_5_4, |
| 199 | MSM_DBA_AR_16_9, |
| 200 | MSM_DBA_AR_16_10, |
| 201 | MSM_DBA_AR_64_27, |
| 202 | MSM_DBA_AR_256_135, |
| 203 | MSM_DBA_AR_MAX |
| 204 | }; |
| 205 | |
| 206 | enum msm_dba_audio_word_endian_type { |
| 207 | MSM_DBA_AUDIO_WORD_LITTLE_ENDIAN = 0, |
| 208 | MSM_DBA_AUDIO_WORD_BIG_ENDIAN, |
| 209 | MSM_DBA_AUDIO_WORD_ENDIAN_MAX |
| 210 | }; |
| 211 | |
| 212 | /** |
| 213 | * msm_dba_audio_op_mode - i2s audio operation mode |
| 214 | * @MSM_DBA_AUDIO_MODE_MANUAL: Manual mode |
| 215 | * @MSM_DBA_AUDIO_MODE_AUTOMATIC: Automatic mode |
| 216 | */ |
| 217 | enum msm_dba_audio_op_mode { |
| 218 | MSM_DBA_AUDIO_MODE_MANUAL, |
| 219 | MSM_DBA_AUDIO_MODE_AUTOMATIC, |
| 220 | }; |
| 221 | |
| 222 | /** |
| 223 | * typedef *msm_dba_cb() - Prototype for callback function |
| 224 | * @data: Pointer to user data provided with register API |
| 225 | * @event: Event type associated with callback. This can be a bitmask. |
| 226 | */ |
| 227 | typedef void (*msm_dba_cb)(void *data, enum msm_dba_callback_event event); |
| 228 | |
| 229 | /** |
| 230 | * struct msm_dba_reg_info - Client information used with register API |
| 231 | * @client_name: Name of the client for debug purposes |
| 232 | * @chip_name: Bridge chip ID |
| 233 | * @instance_id: Instance ID of the bridge chip in case of multiple instances |
| 234 | * @cb: callback function called in case of events. |
| 235 | * @cb_data: pointer to a data structure that will be returned with callback |
| 236 | * |
| 237 | * msm_dba_reg_info structure will be used to provide information during |
| 238 | * registering with driver. This structure will contain the information required |
| 239 | * to identify the specific bridge chip the client wants to use. |
| 240 | * |
| 241 | * Client should also specify the callback function which needs to be called in |
| 242 | * case of events. There is an optional data field which is a pointer that will |
| 243 | * be returned as one of arguments in the callback function. This data field can |
| 244 | * be NULL if client does not wish to use it. |
| 245 | */ |
| 246 | struct msm_dba_reg_info { |
| 247 | char client_name[MSM_DBA_CLIENT_NAME_LEN]; |
| 248 | char chip_name[MSM_DBA_CHIP_NAME_MAX_LEN]; |
| 249 | u32 instance_id; |
| 250 | msm_dba_cb cb; |
| 251 | void *cb_data; |
| 252 | }; |
| 253 | |
| 254 | /** |
| 255 | * struct msm_dba_video_caps_info - video capabilities of the bridge chip |
| 256 | * @hdcp_support: if hdcp is supported |
| 257 | * @edid_support: if reading edid from sink is supported |
| 258 | * @data_lanes_lp_support: if low power mode is supported on data lanes |
| 259 | * @clock_lanes_lp_support: If low power mode is supported on clock lanes |
| 260 | * @max_pclk_khz: maximum pixel clock supported |
| 261 | * @num_of_input_lanes: Number of input data lanes supported by the bridge chip |
| 262 | */ |
| 263 | struct msm_dba_video_caps_info { |
| 264 | bool hdcp_support; |
| 265 | bool edid_support; |
| 266 | bool data_lanes_lp_support; |
| 267 | bool clock_lanes_lp_support; |
| 268 | u32 max_pclk_khz; |
| 269 | u32 num_of_input_lanes; |
| 270 | }; |
| 271 | |
| 272 | /** |
| 273 | * struct msm_dba_audio_caps_info - audio capabilities of the bridge chip |
| 274 | * @audio_support: if audio is supported |
| 275 | * @audio_rates: audio sampling rates supported |
| 276 | * @audio_fmts: audio formats supported |
| 277 | */ |
| 278 | struct msm_dba_audio_caps_info { |
| 279 | u32 audio_support; |
| 280 | u32 audio_rates; |
| 281 | u32 audio_fmts; |
| 282 | }; |
| 283 | |
| 284 | /** |
| 285 | * struct msm_dba_capabilities - general capabilities of the bridge chip |
| 286 | * @vid_caps: video capabilities |
| 287 | * @aud_caps: audio capabilities |
| 288 | * @av_mute_support: av mute support in bridge chip |
| 289 | * @deferred_commit_support: support for deferred commit |
| 290 | */ |
| 291 | struct msm_dba_capabilities { |
| 292 | struct msm_dba_video_caps_info vid_caps; |
| 293 | struct msm_dba_audio_caps_info aud_caps; |
| 294 | bool av_mute_support; |
| 295 | bool deferred_commit_support; |
| 296 | }; |
| 297 | |
| 298 | /** |
| 299 | * struct msm_dba_audio_cfg - Structure for audio configuration |
| 300 | * @interface: Specifies audio interface type. Client should check the |
| 301 | * capabilities for the interfaces supported by the bridge. |
| 302 | * @format: Compressed vs Uncompressed formats. |
| 303 | * @channels: Number of channels. |
| 304 | * @i2s_fmt: I2S data packing format. This is valid only if interface is I2S. |
| 305 | * @sampling_rate: sampling rate of audio data |
| 306 | * @word_size: word size |
| 307 | * @word_endianness: little or big endian words |
| 308 | */ |
| 309 | struct msm_dba_audio_cfg { |
| 310 | enum msm_dba_audio_interface_type interface; |
| 311 | enum msm_dba_audio_format_type format; |
| 312 | enum msm_dba_audio_channel_count channels; |
| 313 | enum msm_dba_audio_i2s_format i2s_fmt; |
| 314 | enum msm_dba_audio_sampling_rates_type sampling_rate; |
| 315 | enum msm_dba_audio_word_bit_depth word_size; |
| 316 | enum msm_dba_audio_word_endian_type word_endianness; |
| 317 | enum msm_dba_audio_copyright_type copyright; |
| 318 | enum msm_dba_audio_pre_emphasis_type pre_emphasis; |
| 319 | enum msm_dba_audio_clock_accuracy clock_accuracy; |
| 320 | enum msm_dba_channel_status_source channel_status_source; |
| 321 | enum msm_dba_audio_op_mode mode; |
| 322 | |
| 323 | u32 channel_status_category_code; |
| 324 | u32 channel_status_source_number; |
| 325 | u32 channel_status_v_bit; |
| 326 | u32 channel_allocation; |
| 327 | u32 channel_status_word_length; |
| 328 | |
| 329 | u32 n; |
| 330 | u32 cts; |
| 331 | }; |
| 332 | |
| 333 | /** |
| 334 | * struct msm_dba_video_cfg - video configuration data |
| 335 | * @h_active: active width of the video signal |
| 336 | * @h_front_porch: horizontal front porch in pixels |
| 337 | * @h_pulse_width: pulse width of hsync in pixels |
| 338 | * @h_back_porch: horizontal back porch in pixels |
| 339 | * @h_polarity: polarity of hsync signal |
| 340 | * @v_active: active height of the video signal |
| 341 | * @v_front_porch: vertical front porch in lines |
| 342 | * @v_pulse_width: pulse width of vsync in lines |
| 343 | * @v_back_porch: vertical back porch in lines |
| 344 | * @v_polarity: polarity of vsync signal |
| 345 | * @pclk_khz: pixel clock in KHz |
| 346 | * @interlaced: if video is interlaced |
| 347 | * @vic: video indetification code |
| 348 | * @hdmi_mode: hdmi or dvi mode for the sink |
| 349 | * @ar: aspect ratio of the signal |
| 350 | * @num_of_input_lanes: number of input lanes in case of DSI/LVDS |
| 351 | */ |
| 352 | struct msm_dba_video_cfg { |
| 353 | u32 h_active; |
| 354 | u32 h_front_porch; |
| 355 | u32 h_pulse_width; |
| 356 | u32 h_back_porch; |
| 357 | bool h_polarity; |
| 358 | u32 v_active; |
| 359 | u32 v_front_porch; |
| 360 | u32 v_pulse_width; |
| 361 | u32 v_back_porch; |
| 362 | bool v_polarity; |
| 363 | u32 pclk_khz; |
| 364 | bool interlaced; |
| 365 | u32 vic; |
| 366 | bool hdmi_mode; |
| 367 | enum msm_dba_video_aspect_ratio ar; |
| 368 | u32 num_of_input_lanes; |
| 369 | u8 scaninfo; |
| 370 | }; |
| 371 | |
| 372 | struct mdss_dba_timing_info { |
| 373 | u16 xres; |
| 374 | u16 yres; |
| 375 | u8 bpp; |
| 376 | u8 fps; |
| 377 | u8 lanes; |
| 378 | }; |
| 379 | |
| 380 | /** |
| 381 | * struct msm_dba_ops- operation supported by bridge chip |
| 382 | * @get_caps: returns the bridge chip capabilities |
| 383 | * DEFER and ASYNC flags are not supported. |
| 384 | * @power_on: powers on/off the bridge chip. This usually involves turning on |
| 385 | * the power regulators and bringing the chip out of reset. Chip |
| 386 | * should be capable of raising interrupts at this point. |
| 387 | * DEFER and ASYNC flags are supported. |
| 388 | * @video_on: turn on/off video stream. This function also requires the video |
| 389 | * timing information that might be needed for programming the bridge |
| 390 | * chip. |
| 391 | * DEFER flag is supported. |
| 392 | * ASYNC flag is not supported. |
| 393 | * @audio_on: turn on/off audio stream. |
| 394 | * DEFER flag is supported. |
| 395 | * ASYNC flag is not supported. |
| 396 | * @configure_audio: setup audio configuration |
| 397 | * DEFER flag is supported. |
| 398 | * ASYNC flag is not supported. |
| 399 | * @av_mute: controls av mute functionalities if supported. AV mute is different |
| 400 | * from audio_on and video_on where in even though the actual data is |
| 401 | * sent, mute is specified through control packets. |
| 402 | * DEFER flag is supported. |
| 403 | * ASYNC flag is not supported. |
| 404 | * @interupts_enable: enables interrupts to get event callbacks. Clients need |
| 405 | * to specify an event mask of the events they are |
| 406 | * interested in. If a client provides an event as part of |
| 407 | * the mask, it will receive the interrupt regardless of the |
| 408 | * client modifying the property. |
| 409 | * DEFER flag is supported. |
| 410 | * ASYNC flag is not supported. |
| 411 | * @hdcp_enable: enable/disable hdcp. If HDCP is enabled, this function will |
| 412 | * start a new authentication session. There is a separate |
| 413 | * argument for enabling encryption. Encryption can be enabled any |
| 414 | * time after HDCP has been fully authenticated. This function |
| 415 | * will support an asynchronous mode where calling this function |
| 416 | * will kick off HDCP and return to the caller. Caller has to wait |
| 417 | * for MSM_DBA_CB_HDCP_SUCCESS callback to ensure link is |
| 418 | * authenticated. |
| 419 | * DEFER flag is not supported. |
| 420 | * ASYNC flag is supported. |
| 421 | * @hdcp_get_ksv_list_size: returns the KSV list size. In case of a simple sink |
| 422 | * the size will be 1. In case of a repeater, this can |
| 423 | * be more than one. |
| 424 | * DEFER and ASYNC flags are not supported. |
| 425 | * @hdcp_get_ksv_list: return the KSV list. Client can query the KSV information |
| 426 | * from the bridge. Client should call |
| 427 | * hdcp_get_ksv_list_size first and then allocate 40*size |
| 428 | * bytes to hold all the KSVs. |
| 429 | * DEFER and ASYNC flags are not supported. |
| 430 | * @hdmi_cec_on: enable or disable cec module. Clients need to enable CEC |
| 431 | * feature before they do read or write CEC messages. |
| 432 | * @hdmi_cec_write: perform a CEC write. For bridges with HDMI as output |
| 433 | * interface, this function allows clients to send a CEC |
| 434 | * message. Client should pack the data according to the CEC |
| 435 | * specification and provide the final buffer. Since CEC writes |
| 436 | * can take longer time to ascertaining if they are successful, |
| 437 | * this function supports the ASYNC flag. Driver will return |
| 438 | * either MSM_DBA_CB_CEC_WRITE_SUCCESS or |
| 439 | * MSM_DBA_CB_CEC_WRITE_FAIL callbacks. |
| 440 | * DEFER is not supported. |
| 441 | * ASYNC flag is supported. |
| 442 | * @hdmi_cec_read: get a pending CEC read message. In case of an incoming CEC |
| 443 | * message, driver will return MSM_DBA_CB_CEC_READ_PENDING |
| 444 | * callback. On getting this event callback, client should call |
| 445 | * hdmi_cec_read to get the message. The buffer should at least |
| 446 | * be 15 bytes or more. Client should read the CEC message from |
| 447 | * a thread different from the callback. |
| 448 | * DEFER and ASYNC flags are not supported. |
| 449 | * @get_edid_size: returns size of the edid. |
| 450 | * DEFER and ASYNC flags are not supported. |
| 451 | * @get_raw_edid: returns raw edid data. |
| 452 | * DEFER and ASYNC flags are not supported. |
| 453 | * @enable_remote_comm: enable/disable remote communication. Some interfaces |
| 454 | * like FPDLINK III support a bi-directional control |
| 455 | * channel that could be used to send control data using an |
| 456 | * I2C or SPI protocol. This Function will enable this |
| 457 | * control channel if supported. |
| 458 | * DEFER and ASYNC flags are not supported. |
| 459 | * @add_remote_device: add slaves on remote side for enabling communication. For |
| 460 | * interfaces that support bi directional control channel, |
| 461 | * this function allows clients to specify slave IDs of |
| 462 | * devices on remote bus. Messages addressed to these IDs |
| 463 | * will be trapped by the bridge chip and put on the remote |
| 464 | * bus. |
| 465 | * DEFER and ASYNC flags are not supported. |
| 466 | * @commit_deferred_props: commits deferred properties |
| 467 | * DEFER and ASYNC flags are not supported. |
| 468 | * @force_reset: reset the device forcefully. In case the device goes into a bad |
| 469 | * state, a client can force reset to try and recover the device. |
| 470 | * The reset will be applied in spite of different configurations |
| 471 | * from other clients. Driver will apply all the properties that |
| 472 | * have been applied so far after the reset is complete. In case |
| 473 | * of multiple clients, driver will issue a reset callback. |
| 474 | * @dump_debug_info: dumps debug information to dmesg. |
| 475 | * @check_hpd: Check if cable is connected or not. if cable is connected we |
| 476 | * send notification to display framework. |
| 477 | * @set_audio_block: This function will populate the raw audio speaker block |
| 478 | * data along with size of each block in bridgechip buffer. |
| 479 | * @get_audio_block: This function will return the raw audio speaker block |
| 480 | * along with size of each block. |
| 481 | * |
| 482 | * The msm_dba_ops structure represents a set of operations that can be |
| 483 | * supported by each bridge chip. Depending on the functionality supported by a |
| 484 | * specific bridge chip, some of the operations need not be supported. For |
| 485 | * example if a bridge chip does not support reading EDID from a sink device, |
| 486 | * get_edid_size and get_raw_edid can be NULL. |
| 487 | * |
| 488 | * Deferring properties: The deferred flag allows us to address any quirks with |
| 489 | * respect to specific bridge chips. If there is a need for some properties to |
| 490 | * be committed together, turning on video and audio at the same time, the |
| 491 | * deferred flag can be used. Properties that are set using a DEFER flag will |
| 492 | * not be committed to hardware until commit_deferred_props() function is |
| 493 | * called. |
| 494 | * |
| 495 | */ |
| 496 | struct msm_dba_ops { |
| 497 | int (*get_caps)(void *client, |
| 498 | struct msm_dba_capabilities *caps); |
| 499 | |
| 500 | int (*power_on)(void *client, |
| 501 | bool on, |
| 502 | u32 flags); |
| 503 | |
| 504 | int (*video_on)(void *client, |
| 505 | bool on, |
| 506 | struct msm_dba_video_cfg *cfg, |
| 507 | u32 flags); |
| 508 | |
| 509 | int (*audio_on)(void *client, |
| 510 | bool on, |
| 511 | u32 flags); |
| 512 | |
| 513 | int (*configure_audio)(void *client, |
| 514 | struct msm_dba_audio_cfg *cfg, |
| 515 | u32 flags); |
| 516 | |
| 517 | int (*av_mute)(void *client, |
| 518 | bool video_mute, |
| 519 | bool audio_mute, |
| 520 | u32 flags); |
| 521 | |
| 522 | int (*interrupts_enable)(void *client, |
| 523 | bool on, |
| 524 | u32 event_mask, |
| 525 | u32 flags); |
| 526 | |
| 527 | int (*hdcp_enable)(void *client, |
| 528 | bool hdcp_on, |
| 529 | bool enc_on, |
| 530 | u32 flags); |
| 531 | |
| 532 | int (*hdcp_get_ksv_list_size)(void *client, |
| 533 | u32 *count, |
| 534 | u32 flags); |
| 535 | |
| 536 | int (*hdcp_get_ksv_list)(void *client, |
| 537 | u32 count, |
| 538 | char *buf, |
| 539 | u32 flags); |
| 540 | |
| 541 | int (*hdmi_cec_on)(void *client, |
| 542 | bool enable, |
| 543 | u32 flags); |
| 544 | |
| 545 | int (*hdmi_cec_write)(void *client, |
| 546 | u32 size, |
| 547 | char *buf, |
| 548 | u32 flags); |
| 549 | |
| 550 | int (*hdmi_cec_read)(void *client, |
| 551 | u32 *size, |
| 552 | char *buf, |
| 553 | u32 flags); |
| 554 | |
| 555 | int (*get_edid_size)(void *client, |
| 556 | u32 *size, |
| 557 | u32 flags); |
| 558 | |
| 559 | int (*get_raw_edid)(void *client, |
| 560 | u32 size, |
| 561 | char *buf, |
| 562 | u32 flags); |
| 563 | |
| 564 | int (*enable_remote_comm)(void *client, |
| 565 | bool on, |
| 566 | u32 flags); |
| 567 | |
| 568 | int (*add_remote_device)(void *client, |
| 569 | u32 *slave_ids, |
| 570 | u32 count, |
| 571 | u32 flags); |
| 572 | |
| 573 | int (*commit_deferred_props)(void *client, |
| 574 | u32 flags); |
| 575 | |
| 576 | int (*force_reset)(void *client, u32 flags); |
| 577 | int (*dump_debug_info)(void *client, u32 flags); |
| 578 | int (*check_hpd)(void *client, u32 flags); |
| 579 | void (*set_audio_block)(void *client, u32 size, void *buf); |
| 580 | void (*get_audio_block)(void *client, u32 size, void *buf); |
| 581 | void* (*get_supp_timing_info)(void); |
| 582 | }; |
| 583 | |
| 584 | /** |
| 585 | * msm_dba_register_client() - Allows a client to register with the driver. |
| 586 | * @info: Client information along with the bridge chip id the client wishes to |
| 587 | * program. |
| 588 | * @ops: Function pointers to bridge chip operations. Some function pointers can |
| 589 | * be NULL depending on the functionalities supported by bridge chip. |
| 590 | * |
| 591 | * The register API supports multiple clients to register for the same bridge |
| 592 | * chip. If Successful, this will return a pointer that should be used as a |
| 593 | * handle for all subsequent function calls. |
| 594 | */ |
| 595 | void *msm_dba_register_client(struct msm_dba_reg_info *info, |
| 596 | struct msm_dba_ops *ops); |
| 597 | |
| 598 | /** |
| 599 | * msm_dba_deregister_client() - Allows client to de-register with the driver. |
| 600 | * @client: client handle returned by register API. |
| 601 | * |
| 602 | * This function will release all the resources used by a particular client. If |
| 603 | * it is the only client using the bridge chip, the bridge chip will be powered |
| 604 | * down and put into reset. |
| 605 | */ |
| 606 | int msm_dba_deregister_client(void *client); |
| 607 | |
| 608 | #endif /* _MSM_DBA_H */ |