summaryrefslogtreecommitdiff
path: root/include/video/msm_dba.h
blob: 8ce2138044c324c5614310eba29f1366bc369cb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
/*
 * Copyright (c) 2015,2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef _MSM_DBA_H
#define _MSM_DBA_H

#include <linux/types.h>
#include <linux/bitops.h>

#define MSM_DBA_CHIP_NAME_MAX_LEN 20
#define MSM_DBA_CLIENT_NAME_LEN   20

#define MSM_DBA_DEFER_PROPERTY_FLAG 0x1
#define MSM_DBA_ASYNC_FLAG          0x2

/**
 * enum msm_dba_callback_event - event types for callback notification
 * @MSM_DBA_CB_REMOTE_INT: Event associated with remote devices on an interface
 *			   that supports a bi-directional control channel.
 * @MSM_DBA_CB_HDCP_LINK_AUTHENTICATED: Authentication session is successful.
 *					The link is authenticated and encryption
 *					can be enabled if not enabled already.
 * @MSM_DBA_CB_HDCP_LINK_UNAUTHENTICATED: A previously authenticated link has
 *					  failed. The content on the interface
 *					  is no longer secure.
 * @MSM_DBA_CB_HPD_CONNECT: Detected a cable connect event.
 * @MSM_DBA_CB_HPD_DISCONNECT: Detected a cable disconnect event.
 * @MSM_DBA_CB_VIDEO_FAILURE: Detected a failure with respect to video data on
 *			      the interface. This is a generic failure and
 *			      client should request a debug dump to debug the
 *			      issue. Client can also attempt a reset to recover
 *			      the device.
 * @MSM_DBA_CB_AUDIO_FAILURE: Detected a failure with respect to audio data on
 *			      the interface. This is a generic failure and
 *			      client should request a debug dump. Client can
 *			      also attempt a reset to recover the device.
 * @MSM_DBA_CB_CEC_WRITE_SUCCESS: The asynchronous CEC write request is
 *				  successful.
 * @MSM_DBA_CB_CEC_WRITE_FAIL: The asynchronous CEC write request failed.
 * @MSM_DBA_CB_CEC_READ_PENDING: There is a pending CEC read message.
 * @MSM_DBA_CB_PRE_RESET: This callback is called just before the device is
 *			  being reset.
 * @MSM_DBA_CB_POST_RESET: This callback is called after device reset is
 *			   complete and the driver has applied back all the
 *			   properties.
 * @MSM_DBA_CB_DDC_I2C_ERROR: Detected a failure in DDC block for i2c error.
 * @MSM_DBA_CB_DDC_TIMEOUT: Detected a failure in DDC block for timed out
 *				waiting for downstream receiver.
 *
 * Clients for this driver can register for receiving callbacks for specific
 * events. This enum defines the type of events supported by the driver. An
 * event mask is typically used to denote multiple events.
 */
enum msm_dba_callback_event {
	MSM_DBA_CB_REMOTE_INT = BIT(0),
	MSM_DBA_CB_HDCP_LINK_AUTHENTICATED = BIT(1),
	MSM_DBA_CB_HDCP_LINK_UNAUTHENTICATED = BIT(2),
	MSM_DBA_CB_HPD_CONNECT = BIT(3),
	MSM_DBA_CB_HPD_DISCONNECT = BIT(4),
	MSM_DBA_CB_VIDEO_FAILURE = BIT(5),
	MSM_DBA_CB_AUDIO_FAILURE = BIT(6),
	MSM_DBA_CB_CEC_WRITE_SUCCESS = BIT(7),
	MSM_DBA_CB_CEC_WRITE_FAIL = BIT(8),
	MSM_DBA_CB_CEC_READ_PENDING = BIT(9),
	MSM_DBA_CB_PRE_RESET = BIT(10),
	MSM_DBA_CB_POST_RESET = BIT(11),
	MSM_DBA_CB_DDC_I2C_ERROR = BIT(12),
	MSM_DBA_CB_DDC_TIMEOUT = BIT(13),
};

/**
 * enum msm_dba_audio_interface_type - audio interface type
 * @MSM_DBA_AUDIO_I2S_INTERFACE: I2S interface for audio
 * @MSM_DBA_AUDIO_SPDIF_INTERFACE: SPDIF interface for audio
 */
enum msm_dba_audio_interface_type {
	MSM_DBA_AUDIO_I2S_INTERFACE = BIT(0),
	MSM_DBA_AUDIO_SPDIF_INTERFACE = BIT(1),
};

/**
 * enum msm_dba_audio_format_type - audio format type
 * @MSM_DBA_AUDIO_FMT_UNCOMPRESSED_LPCM: uncompressed format
 * @MSM_DBA_AUDIO_FMT_COMPRESSED: compressed formats
 */
enum msm_dba_audio_format_type {
	MSM_DBA_AUDIO_FMT_UNCOMPRESSED_LPCM = BIT(0),
	MSM_DBA_AUDIO_FMT_COMPRESSED = BIT(1),
};

/**
 * enum msm_dba_audio_copyright_type - audio copyright
 * @MSM_DBA_AUDIO_COPYRIGHT_PROTECTED: copy right protected
 * @MSM_DBA_AUDIO_COPYRIGHT_NOT_PROTECTED: not copy right protected
 */
enum msm_dba_audio_copyright_type {
	MSM_DBA_AUDIO_COPYRIGHT_PROTECTED = BIT(0),
	MSM_DBA_AUDIO_COPYRIGHT_NOT_PROTECTED = BIT(1),
};

/**
 * enum msm_dba_audio_pre_emphasis_type - pre-emphasis
 * @MSM_DBA_AUDIO_NO_PRE_EMPHASIS: 2 audio channels w/o pre-emphasis
 * @MSM_DBA_AUDIO_PRE_EMPHASIS_50_15us: 2 audio channels with 50/15uS
 */
enum msm_dba_audio_pre_emphasis_type {
	MSM_DBA_AUDIO_NO_PRE_EMPHASIS = BIT(0),
	MSM_DBA_AUDIO_PRE_EMPHASIS_50_15us = BIT(1),
};

/**
 * enum msm_dba_audio_clock_accuracy - Audio Clock Accuracy
 * @MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL1: normal accuracy +/-1000 x 10^-6
 * @MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL2: high accuracy +/- 50 x 10^-6
 * @MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL3: variable pitch shifted clock
 */
enum msm_dba_audio_clock_accuracy {
	MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL1 = BIT(1),
	MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL2 = BIT(0),
	MSM_DBA_AUDIO_CLOCK_ACCURACY_LVL3 = BIT(2),
};

/**
 * enum msm_dba_channel_status_source - CS override
 * @MSM_DBA_AUDIO_CS_SOURCE_I2S_STREAM: use channel status bits from I2S stream
 * @MSM_DBA_AUDIO_CS_SOURCE_REGISTERS: use channel status bits from registers
 */
enum msm_dba_channel_status_source {
	MSM_DBA_AUDIO_CS_SOURCE_I2S_STREAM,
	MSM_DBA_AUDIO_CS_SOURCE_REGISTERS
};

/**
 * enum msm_dba_audio_sampling_rates_type - audio sampling rates
 * @MSM_DBA_AUDIO_32KHZ: 32KHz sampling rate
 * @MSM_DBA_AUDIO_44P1KHZ: 44.1KHz sampling rate
 * @MSM_DBA_AUDIO_48KHZ: 48KHz sampling rate
 * @MSM_DBA_AUDIO_96KHZ: 96KHz sampling rate
 * @MSM_DBA_AUDIO_192KHZ: 192KHz sampling rate
 */
enum msm_dba_audio_sampling_rates_type {
	MSM_DBA_AUDIO_32KHZ = BIT(0),
	MSM_DBA_AUDIO_44P1KHZ = BIT(1),
	MSM_DBA_AUDIO_48KHZ = BIT(2),
	MSM_DBA_AUDIO_88P2KHZ = BIT(1),
	MSM_DBA_AUDIO_96KHZ = BIT(3),
	MSM_DBA_AUDIO_176P4KHZ = BIT(1),
	MSM_DBA_AUDIO_192KHZ = BIT(4),
};

/**
 * enum msm_dba_audio_word_bit_depth - audio word size
 * @MSM_DBA_AUDIO_WORD_16BIT: 16 bits per word
 * @MSM_DBA_AUDIO_WORD_24BIT: 24 bits per word
 * @MSM_DBA_AUDIO_WORD_32BIT: 32 bits per word
 */
enum msm_dba_audio_word_bit_depth {
	MSM_DBA_AUDIO_WORD_16BIT = BIT(0),
	MSM_DBA_AUDIO_WORD_24BIT = BIT(1),
	MSM_DBA_AUDIO_WORD_32BIT = BIT(2),
};

/**
 * enum msm_dba_audio_channel_count - audio channel count
 * @MSM_DBA_AUDIO_CHANNEL_2: 2 channel audio
 * @MSM_DBA_AUDIO_CHANNEL_4: 4 channel audio
 * @MSM_DBA_AUDIO_CHANNEL_8: 8 channel audio
 */
enum msm_dba_audio_channel_count {
	MSM_DBA_AUDIO_CHANNEL_2 = BIT(0),
	MSM_DBA_AUDIO_CHANNEL_4 = BIT(1),
	MSM_DBA_AUDIO_CHANNEL_8 = BIT(2),
};

/**
 * enum msm_dba_audio_i2s_format - i2s audio data format
 * @MSM_DBA_AUDIO_I2S_FMT_STANDARD: Standard format
 * @MSM_DBA_AUDIO_I2S_FMT_RIGHT_JUSTIFIED: i2s data is right justified
 * @MSM_DBA_AUDIO_I2S_FMT_LEFT_JUSTIFIED: i2s data is left justified
 * @MSM_DBA_AUDIO_I2S_FMT_AES3_DIRECT: AES signal format
 */
enum msm_dba_audio_i2s_format {
	MSM_DBA_AUDIO_I2S_FMT_STANDARD = 0,
	MSM_DBA_AUDIO_I2S_FMT_RIGHT_JUSTIFIED,
	MSM_DBA_AUDIO_I2S_FMT_LEFT_JUSTIFIED,
	MSM_DBA_AUDIO_I2S_FMT_AES3_DIRECT,
	MSM_DBA_AUDIO_I2S_FMT_MAX,
};

enum msm_dba_video_aspect_ratio {
	MSM_DBA_AR_UNKNOWN = 0,
	MSM_DBA_AR_4_3,
	MSM_DBA_AR_5_4,
	MSM_DBA_AR_16_9,
	MSM_DBA_AR_16_10,
	MSM_DBA_AR_64_27,
	MSM_DBA_AR_256_135,
	MSM_DBA_AR_MAX
};

enum msm_dba_audio_word_endian_type {
	MSM_DBA_AUDIO_WORD_LITTLE_ENDIAN = 0,
	MSM_DBA_AUDIO_WORD_BIG_ENDIAN,
	MSM_DBA_AUDIO_WORD_ENDIAN_MAX
};

/**
 * msm_dba_audio_op_mode - i2s audio operation mode
 * @MSM_DBA_AUDIO_MODE_MANUAL: Manual mode
 * @MSM_DBA_AUDIO_MODE_AUTOMATIC: Automatic mode
 */
enum msm_dba_audio_op_mode {
	MSM_DBA_AUDIO_MODE_MANUAL,
	MSM_DBA_AUDIO_MODE_AUTOMATIC,
};

/**
 * typedef *msm_dba_cb() - Prototype for callback function
 * @data: Pointer to user data provided with register API
 * @event: Event type associated with callback. This can be a bitmask.
 */
typedef void (*msm_dba_cb)(void *data, enum msm_dba_callback_event event);

/**
 * struct msm_dba_reg_info - Client information used with register API
 * @client_name: Name of the client for debug purposes
 * @chip_name: Bridge chip ID
 * @instance_id: Instance ID of the bridge chip in case of multiple instances
 * @cb: callback function called in case of events.
 * @cb_data: pointer to a data structure that will be returned with callback
 *
 * msm_dba_reg_info structure will be used to provide information during
 * registering with driver. This structure will contain the information required
 * to identify the specific bridge chip the client wants to use.
 *
 * Client should also specify the callback function which needs to be called in
 * case of events. There is an optional data field which is a pointer that will
 * be returned as one of arguments in the callback function. This data field can
 * be NULL if client does not wish to use it.
 */
struct msm_dba_reg_info {
	char client_name[MSM_DBA_CLIENT_NAME_LEN];
	char chip_name[MSM_DBA_CHIP_NAME_MAX_LEN];
	u32 instance_id;
	msm_dba_cb cb;
	void *cb_data;
};

/**
 * struct msm_dba_video_caps_info - video capabilities of the bridge chip
 * @hdcp_support: if hdcp is supported
 * @edid_support: if reading edid from sink is supported
 * @data_lanes_lp_support: if low power mode is supported on data lanes
 * @clock_lanes_lp_support: If low power mode is supported on clock lanes
 * @max_pclk_khz: maximum pixel clock supported
 * @num_of_input_lanes: Number of input data lanes supported by the bridge chip
 */
struct msm_dba_video_caps_info {
	bool hdcp_support;
	bool edid_support;
	bool data_lanes_lp_support;
	bool clock_lanes_lp_support;
	u32 max_pclk_khz;
	u32 num_of_input_lanes;
};

/**
 * struct msm_dba_audio_caps_info - audio capabilities of the bridge chip
 * @audio_support: if audio is supported
 * @audio_rates: audio sampling rates supported
 * @audio_fmts: audio formats supported
 */
struct msm_dba_audio_caps_info {
	u32 audio_support;
	u32 audio_rates;
	u32 audio_fmts;
};

/**
 * struct msm_dba_capabilities - general capabilities of the bridge chip
 * @vid_caps: video capabilities
 * @aud_caps: audio capabilities
 * @av_mute_support: av mute support in bridge chip
 * @deferred_commit_support: support for deferred commit
 */
struct msm_dba_capabilities {
	struct msm_dba_video_caps_info vid_caps;
	struct msm_dba_audio_caps_info aud_caps;
	bool av_mute_support;
	bool deferred_commit_support;
};

/**
 * struct msm_dba_audio_cfg - Structure for audio configuration
 * @interface: Specifies audio interface type. Client should check the
 *	       capabilities for the interfaces supported by the bridge.
 * @format: Compressed vs Uncompressed formats.
 * @channels: Number of channels.
 * @i2s_fmt: I2S data packing format. This is valid only if interface is I2S.
 * @sampling_rate: sampling rate of audio data
 * @word_size: word size
 * @word_endianness: little or big endian words
 */
struct msm_dba_audio_cfg {
	enum msm_dba_audio_interface_type interface;
	enum msm_dba_audio_format_type format;
	enum msm_dba_audio_channel_count channels;
	enum msm_dba_audio_i2s_format i2s_fmt;
	enum msm_dba_audio_sampling_rates_type sampling_rate;
	enum msm_dba_audio_word_bit_depth word_size;
	enum msm_dba_audio_word_endian_type word_endianness;
	enum msm_dba_audio_copyright_type copyright;
	enum msm_dba_audio_pre_emphasis_type pre_emphasis;
	enum msm_dba_audio_clock_accuracy clock_accuracy;
	enum msm_dba_channel_status_source channel_status_source;
	enum msm_dba_audio_op_mode mode;

	u32 channel_status_category_code;
	u32 channel_status_source_number;
	u32 channel_status_v_bit;
	u32 channel_allocation;
	u32 channel_status_word_length;

	u32 n;
	u32 cts;
};

/**
 * struct msm_dba_video_cfg - video configuration data
 * @h_active: active width of the video signal
 * @h_front_porch: horizontal front porch in pixels
 * @h_pulse_width: pulse width of hsync in pixels
 * @h_back_porch: horizontal back porch in pixels
 * @h_polarity: polarity of hsync signal
 * @v_active: active height of the video signal
 * @v_front_porch: vertical front porch in lines
 * @v_pulse_width: pulse width of vsync in lines
 * @v_back_porch: vertical back porch in lines
 * @v_polarity: polarity of vsync signal
 * @pclk_khz: pixel clock in KHz
 * @interlaced: if video is interlaced
 * @vic: video indetification code
 * @hdmi_mode: hdmi or dvi mode for the sink
 * @ar: aspect ratio of the signal
 * @num_of_input_lanes: number of input lanes in case of DSI/LVDS
 */
struct msm_dba_video_cfg {
	u32  h_active;
	u32  h_front_porch;
	u32  h_pulse_width;
	u32  h_back_porch;
	bool h_polarity;
	u32  v_active;
	u32  v_front_porch;
	u32  v_pulse_width;
	u32  v_back_porch;
	bool v_polarity;
	u32  pclk_khz;
	bool interlaced;
	u32  vic;
	bool hdmi_mode;
	enum msm_dba_video_aspect_ratio ar;
	u32  num_of_input_lanes;
	u8 scaninfo;
};

/**
 * struct msm_dba_ops- operation supported by bridge chip
 * @get_caps: returns the bridge chip capabilities
 *	      DEFER and ASYNC flags are not supported.
 * @power_on: powers on/off the bridge chip. This usually involves turning on
 *	      the power regulators and bringing the chip out of reset. Chip
 *	      should be capable of raising interrupts at this point.
 *	      DEFER and ASYNC flags are supported.
 * @video_on: turn on/off video stream. This function also requires the video
 *	      timing information that might be needed for programming the bridge
 *	      chip.
 *	      DEFER flag is supported.
 *	      ASYNC flag is not supported.
 * @audio_on: turn on/off audio stream.
 *	      DEFER flag is supported.
 *	      ASYNC flag is not supported.
 * @configure_audio: setup audio configuration
 *		     DEFER flag is supported.
 *		     ASYNC flag is not supported.
 * @av_mute: controls av mute functionalities if supported. AV mute is different
 *	     from audio_on and video_on where in even though the actual data is
 *	     sent, mute is specified through control packets.
 *	     DEFER flag is supported.
 *	     ASYNC flag is not supported.
 * @interupts_enable: enables interrupts to get event callbacks. Clients need
 *		      to specify an event mask of the events they are
 *		      interested in. If a client provides an event as part of
 *		      the mask, it will receive the interrupt regardless of the
 *		      client modifying the property.
 *		      DEFER flag is supported.
 *		      ASYNC flag is not supported.
 * @hdcp_enable: enable/disable hdcp. If HDCP is enabled, this function will
 *		 start a new authentication session. There is a separate
 *		 argument for enabling encryption. Encryption can be enabled any
 *		 time after HDCP has been fully authenticated. This function
 *		 will support an asynchronous mode where calling this function
 *		 will kick off HDCP and return to the caller. Caller has to wait
 *		 for MSM_DBA_CB_HDCP_SUCCESS callback to ensure link is
 *		 authenticated.
 *		 DEFER flag is not supported.
 *		 ASYNC flag is supported.
 * @hdcp_get_ksv_list_size: returns the KSV list size. In case of a simple sink
 *			    the size will be 1. In case of a repeater, this can
 *			    be more than one.
 *			    DEFER and ASYNC flags are not supported.
 * @hdcp_get_ksv_list: return the KSV list. Client can query the KSV information
 *		       from the bridge. Client should call
 *		       hdcp_get_ksv_list_size first and then allocate 40*size
 *		       bytes to hold all the KSVs.
 *		       DEFER and ASYNC flags are not supported.
 * @hdmi_cec_on: enable or disable cec module. Clients need to enable CEC
 *		 feature before they do read or write CEC messages.
 * @hdmi_cec_write: perform a CEC write. For bridges with HDMI as output
 *		    interface, this function allows clients to send a CEC
 *		    message. Client should pack the data according to the CEC
 *		    specification and provide the final buffer. Since CEC writes
 *		    can take longer time to ascertaining if they are successful,
 *		    this function supports the ASYNC flag. Driver will return
 *		    either MSM_DBA_CB_CEC_WRITE_SUCCESS or
 *		    MSM_DBA_CB_CEC_WRITE_FAIL callbacks.
 *		    DEFER is not supported.
 *		    ASYNC flag is supported.
 * @hdmi_cec_read: get a pending CEC read message. In case of an incoming CEC
 *		   message, driver will return MSM_DBA_CB_CEC_READ_PENDING
 *		   callback. On getting this event callback, client should call
 *		   hdmi_cec_read to get the message. The buffer should at least
 *		   be 15 bytes or more. Client should read the CEC message from
 *		   a thread different from the callback.
 *		   DEFER and ASYNC flags are not supported.
 * @get_edid_size: returns size of the edid.
 *		   DEFER and ASYNC flags are not supported.
 * @get_raw_edid: returns raw edid data.
 *		   DEFER and ASYNC flags are not supported.
 * @enable_remote_comm: enable/disable remote communication. Some interfaces
 *		        like FPDLINK III support a bi-directional control
 *		        channel that could be used to send control data using an
 *		        I2C or SPI protocol. This Function will enable this
 *		        control channel if supported.
 *		        DEFER and ASYNC flags are not supported.
 * @add_remote_device: add slaves on remote side for enabling communication. For
 *		       interfaces that support bi directional control channel,
 *		       this function allows clients to specify slave IDs of
 *		       devices on remote bus. Messages addressed to these IDs
 *		       will be trapped by the bridge chip and put on the remote
 *		       bus.
 *		       DEFER and ASYNC flags are not supported.
 * @commit_deferred_props: commits deferred properties
 *			   DEFER and ASYNC flags are not supported.
 * @force_reset: reset the device forcefully. In case the device goes into a bad
 *		 state, a client can force reset to try and recover the device.
 *		 The reset will be applied in spite of different configurations
 *		 from other clients. Driver will apply all the properties that
 *		 have been applied so far after the reset is complete. In case
 *		 of multiple clients, driver will issue a reset callback.
 * @dump_debug_info: dumps debug information to dmesg.
 * @check_hpd: Check if cable is connected or not. if cable is connected we
 *		send notification to display framework.
 * @set_audio_block: This function will populate the raw audio speaker block
 *		     data along with size of each block in bridgechip buffer.
 * @get_audio_block: This function will return the raw audio speaker block
 *		     along with size of each block.
 *
 * The msm_dba_ops structure represents a set of operations that can be
 * supported by each bridge chip. Depending on the functionality supported by a
 * specific bridge chip, some of the operations need not be supported. For
 * example if a bridge chip does not support reading EDID from a sink device,
 * get_edid_size and get_raw_edid can be NULL.
 *
 * Deferring properties: The deferred flag allows us to address any quirks with
 * respect to specific bridge chips. If there is a need for some properties to
 * be committed together, turning on video and audio at the same time, the
 * deferred flag can be used. Properties that are set using a DEFER flag will
 * not be committed to hardware until commit_deferred_props() function is
 * called.
 *
 */
struct msm_dba_ops {
	int (*get_caps)(void *client,
			struct msm_dba_capabilities *caps);

	int (*power_on)(void *client,
			bool on,
			u32 flags);

	int (*video_on)(void *client,
			bool on,
			struct msm_dba_video_cfg *cfg,
			u32 flags);

	int (*audio_on)(void *client,
			bool on,
			u32 flags);

	int (*configure_audio)(void *client,
			       struct msm_dba_audio_cfg *cfg,
			       u32 flags);

	int (*av_mute)(void *client,
		       bool video_mute,
		       bool audio_mute,
		       u32 flags);

	int (*interrupts_enable)(void *client,
				bool on,
				u32 event_mask,
				u32 flags);

	int (*hdcp_enable)(void *client,
			   bool hdcp_on,
			   bool enc_on,
			   u32 flags);

	int (*hdcp_get_ksv_list_size)(void *client,
				      u32 *count,
				      u32 flags);

	int (*hdcp_get_ksv_list)(void *client,
				 u32 count,
				 char *buf,
				 u32 flags);

	int (*hdmi_cec_on)(void *client,
			      bool enable,
			      u32 flags);

	int (*hdmi_cec_write)(void *client,
			      u32 size,
			      char *buf,
			      u32 flags);

	int (*hdmi_cec_read)(void *client,
			     u32 *size,
			     char *buf,
			     u32 flags);

	int (*get_edid_size)(void *client,
			     u32 *size,
			     u32 flags);

	int (*get_raw_edid)(void *client,
			    u32 size,
			    char *buf,
			    u32 flags);

	int (*enable_remote_comm)(void *client,
				  bool on,
				  u32 flags);

	int (*add_remote_device)(void *client,
				 u32 *slave_ids,
				 u32 count,
				 u32 flags);

	int (*commit_deferred_props)(void *client,
				    u32 flags);

	int (*force_reset)(void *client, u32 flags);
	int (*dump_debug_info)(void *client, u32 flags);
	int (*check_hpd)(void *client, u32 flags);
	void (*set_audio_block)(void *client, u32 size, void *buf);
	void (*get_audio_block)(void *client, u32 size, void *buf);
};

/**
 * msm_dba_register_client() - Allows a client to register with the driver.
 * @info: Client information along with the bridge chip id the client wishes to
 *	  program.
 * @ops: Function pointers to bridge chip operations. Some function pointers can
 *	 be NULL depending on the functionalities supported by bridge chip.
 *
 * The register API supports multiple clients to register for the same bridge
 * chip. If Successful, this will return a pointer that should be used as a
 * handle for all subsequent function calls.
 */
void *msm_dba_register_client(struct msm_dba_reg_info *info,
			      struct msm_dba_ops *ops);

/**
 * msm_dba_deregister_client() - Allows client to de-register with the driver.
 * @client: client handle returned by register API.
 *
 * This function will release all the resources used by a particular client. If
 * it is the only client using the bridge chip, the bridge chip will be powered
 * down and put into reset.
 */
int msm_dba_deregister_client(void *client);

#endif /* _MSM_DBA_H */