1 // SPDX-License-Identifier: MIT
2 // Copyright © 2014 Intel Corporation
4 #ifndef _DRM_AUDIO_COMPONENT_H_
5 #define _DRM_AUDIO_COMPONENT_H_
7 struct drm_audio_component
;
11 * struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver
13 struct drm_audio_component_ops
{
15 * @owner: drm module to pin down
19 * @get_power: get the POWER_DOMAIN_AUDIO power well
21 * Request the power well to be turned on.
23 void (*get_power
)(struct device
*);
25 * @put_power: put the POWER_DOMAIN_AUDIO power well
27 * Allow the power well to be turned off.
29 void (*put_power
)(struct device
*);
31 * @codec_wake_override: Enable/disable codec wake signal
33 void (*codec_wake_override
)(struct device
*, bool enable
);
35 * @get_cdclk_freq: Get the Core Display Clock in kHz
37 int (*get_cdclk_freq
)(struct device
*);
39 * @sync_audio_rate: set n/cts based on the sample rate
41 * Called from audio driver. After audio driver sets the
42 * sample rate, it will call this function to set n/cts
44 int (*sync_audio_rate
)(struct device
*, int port
, int pipe
, int rate
);
46 * @get_eld: fill the audio state and ELD bytes for the given port
48 * Called from audio driver to get the HDMI/DP audio state of the given
49 * digital port, and also fetch ELD bytes to the given pointer.
51 * It returns the byte size of the original ELD (not the actually
52 * copied size), zero for an invalid ELD, or a negative error code.
54 * Note that the returned size may be over @max_bytes. Then it
55 * implies that only a part of ELD has been copied to the buffer.
57 int (*get_eld
)(struct device
*, int port
, int pipe
, bool *enabled
,
58 unsigned char *buf
, int max_bytes
);
62 * struct drm_audio_component_audio_ops - Ops implemented by hda driver, called by DRM driver
64 struct drm_audio_component_audio_ops
{
66 * @audio_ptr: Pointer to be used in call to pin_eld_notify
70 * @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed
72 * Called when the DRM driver has set up audio pipeline or has just
73 * begun to tear it down. This allows the HDA driver to update its
74 * status accordingly (even when the HDA controller is in power save
77 void (*pin_eld_notify
)(void *audio_ptr
, int port
, int pipe
);
79 * @pin2port: Check and convert from pin node to port number
81 * Called by HDA driver to check and convert from the pin widget node
82 * number to a port number in the graphics side.
84 int (*pin2port
)(void *audio_ptr
, int pin
);
86 * @master_bind: (Optional) component master bind callback
88 * Called at binding master component, for HDA codec-specific
89 * handling of dynamic binding.
91 int (*master_bind
)(struct device
*dev
, struct drm_audio_component
*);
93 * @master_unbind: (Optional) component master unbind callback
95 * Called at unbinding master component, for HDA codec-specific
96 * handling of dynamic unbinding.
98 void (*master_unbind
)(struct device
*dev
, struct drm_audio_component
*);
102 * struct drm_audio_component - Used for direct communication between DRM and hda drivers
104 struct drm_audio_component
{
106 * @dev: DRM device, used as parameter for ops
110 * @ops: Ops implemented by DRM driver, called by hda driver
112 const struct drm_audio_component_ops
*ops
;
114 * @audio_ops: Ops implemented by hda driver, called by DRM driver
116 const struct drm_audio_component_audio_ops
*audio_ops
;
119 #endif /* _DRM_AUDIO_COMPONENT_H_ */