2018-07-11 21:17:22 +08:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Copyright © 2014 Intel Corporation
|
|
|
|
|
|
|
|
#ifndef _DRM_AUDIO_COMPONENT_H_
|
|
|
|
#define _DRM_AUDIO_COMPONENT_H_
|
|
|
|
|
ALSA: hda: Make audio component support more generic
This is the final step for more generic support of DRM audio
component. The generic audio component code is now moved to its own
file, and the symbols are renamed from snd_hac_i915_* to
snd_hdac_acomp_*, respectively. The generic code is enabled via the
new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
kept as the super-class.
Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and
the widget id, and master_bind/master_unbin are called at binding /
unbinding the master component, respectively. All these are optional,
but used in i915 implementation and also other later implementations.
A note about the new snd_hdac_acomp_init() function: there is a slight
difference between this and the old snd_hdac_i915_init(). The latter
(still) synchronizes with the master component binding, i.e. it
assures that the relevant DRM component gets bound when it returns, or
gives a negative error. Meanwhile the new function doesn't
synchronize but just leaves as is. It's the responsibility by the
caller's side to synchronize, or the caller may accept the
asynchronous binding on the fly.
v1->v2: Fix missing NULL check in master_bind/unbind
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-11 22:23:16 +08:00
|
|
|
struct drm_audio_component;
|
2019-02-16 13:04:59 +08:00
|
|
|
struct device;
|
ALSA: hda: Make audio component support more generic
This is the final step for more generic support of DRM audio
component. The generic audio component code is now moved to its own
file, and the symbols are renamed from snd_hac_i915_* to
snd_hdac_acomp_*, respectively. The generic code is enabled via the
new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
kept as the super-class.
Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and
the widget id, and master_bind/master_unbin are called at binding /
unbinding the master component, respectively. All these are optional,
but used in i915 implementation and also other later implementations.
A note about the new snd_hdac_acomp_init() function: there is a slight
difference between this and the old snd_hdac_i915_init(). The latter
(still) synchronizes with the master component binding, i.e. it
assures that the relevant DRM component gets bound when it returns, or
gives a negative error. Meanwhile the new function doesn't
synchronize but just leaves as is. It's the responsibility by the
caller's side to synchronize, or the caller may accept the
asynchronous binding on the fly.
v1->v2: Fix missing NULL check in master_bind/unbind
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-11 22:23:16 +08:00
|
|
|
|
2018-07-11 21:17:22 +08:00
|
|
|
/**
|
|
|
|
* struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver
|
|
|
|
*/
|
|
|
|
struct drm_audio_component_ops {
|
|
|
|
/**
|
|
|
|
* @owner: drm module to pin down
|
|
|
|
*/
|
|
|
|
struct module *owner;
|
|
|
|
/**
|
|
|
|
* @get_power: get the POWER_DOMAIN_AUDIO power well
|
|
|
|
*
|
|
|
|
* Request the power well to be turned on.
|
2019-02-13 23:21:09 +08:00
|
|
|
*
|
|
|
|
* Returns a wakeref cookie to be passed back to the corresponding
|
|
|
|
* call to @put_power.
|
2018-07-11 21:17:22 +08:00
|
|
|
*/
|
2019-02-13 23:21:09 +08:00
|
|
|
unsigned long (*get_power)(struct device *);
|
2018-07-11 21:17:22 +08:00
|
|
|
/**
|
|
|
|
* @put_power: put the POWER_DOMAIN_AUDIO power well
|
|
|
|
*
|
|
|
|
* Allow the power well to be turned off.
|
|
|
|
*/
|
2019-02-13 23:21:09 +08:00
|
|
|
void (*put_power)(struct device *, unsigned long);
|
2018-07-11 21:17:22 +08:00
|
|
|
/**
|
|
|
|
* @codec_wake_override: Enable/disable codec wake signal
|
|
|
|
*/
|
|
|
|
void (*codec_wake_override)(struct device *, bool enable);
|
|
|
|
/**
|
|
|
|
* @get_cdclk_freq: Get the Core Display Clock in kHz
|
|
|
|
*/
|
|
|
|
int (*get_cdclk_freq)(struct device *);
|
|
|
|
/**
|
|
|
|
* @sync_audio_rate: set n/cts based on the sample rate
|
|
|
|
*
|
|
|
|
* Called from audio driver. After audio driver sets the
|
|
|
|
* sample rate, it will call this function to set n/cts
|
|
|
|
*/
|
|
|
|
int (*sync_audio_rate)(struct device *, int port, int pipe, int rate);
|
|
|
|
/**
|
|
|
|
* @get_eld: fill the audio state and ELD bytes for the given port
|
|
|
|
*
|
|
|
|
* Called from audio driver to get the HDMI/DP audio state of the given
|
|
|
|
* digital port, and also fetch ELD bytes to the given pointer.
|
|
|
|
*
|
|
|
|
* It returns the byte size of the original ELD (not the actually
|
|
|
|
* copied size), zero for an invalid ELD, or a negative error code.
|
|
|
|
*
|
|
|
|
* Note that the returned size may be over @max_bytes. Then it
|
|
|
|
* implies that only a part of ELD has been copied to the buffer.
|
|
|
|
*/
|
|
|
|
int (*get_eld)(struct device *, int port, int pipe, bool *enabled,
|
|
|
|
unsigned char *buf, int max_bytes);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct drm_audio_component_audio_ops - Ops implemented by hda driver, called by DRM driver
|
|
|
|
*/
|
|
|
|
struct drm_audio_component_audio_ops {
|
|
|
|
/**
|
|
|
|
* @audio_ptr: Pointer to be used in call to pin_eld_notify
|
|
|
|
*/
|
|
|
|
void *audio_ptr;
|
|
|
|
/**
|
|
|
|
* @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed
|
|
|
|
*
|
|
|
|
* Called when the DRM driver has set up audio pipeline or has just
|
|
|
|
* begun to tear it down. This allows the HDA driver to update its
|
|
|
|
* status accordingly (even when the HDA controller is in power save
|
|
|
|
* mode).
|
|
|
|
*/
|
|
|
|
void (*pin_eld_notify)(void *audio_ptr, int port, int pipe);
|
ALSA: hda: Make audio component support more generic
This is the final step for more generic support of DRM audio
component. The generic audio component code is now moved to its own
file, and the symbols are renamed from snd_hac_i915_* to
snd_hdac_acomp_*, respectively. The generic code is enabled via the
new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is
kept as the super-class.
Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and
the widget id, and master_bind/master_unbin are called at binding /
unbinding the master component, respectively. All these are optional,
but used in i915 implementation and also other later implementations.
A note about the new snd_hdac_acomp_init() function: there is a slight
difference between this and the old snd_hdac_i915_init(). The latter
(still) synchronizes with the master component binding, i.e. it
assures that the relevant DRM component gets bound when it returns, or
gives a negative error. Meanwhile the new function doesn't
synchronize but just leaves as is. It's the responsibility by the
caller's side to synchronize, or the caller may accept the
asynchronous binding on the fly.
v1->v2: Fix missing NULL check in master_bind/unbind
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-11 22:23:16 +08:00
|
|
|
/**
|
|
|
|
* @pin2port: Check and convert from pin node to port number
|
|
|
|
*
|
|
|
|
* Called by HDA driver to check and convert from the pin widget node
|
|
|
|
* number to a port number in the graphics side.
|
|
|
|
*/
|
|
|
|
int (*pin2port)(void *audio_ptr, int pin);
|
|
|
|
/**
|
|
|
|
* @master_bind: (Optional) component master bind callback
|
|
|
|
*
|
|
|
|
* Called at binding master component, for HDA codec-specific
|
|
|
|
* handling of dynamic binding.
|
|
|
|
*/
|
|
|
|
int (*master_bind)(struct device *dev, struct drm_audio_component *);
|
|
|
|
/**
|
|
|
|
* @master_unbind: (Optional) component master unbind callback
|
|
|
|
*
|
|
|
|
* Called at unbinding master component, for HDA codec-specific
|
|
|
|
* handling of dynamic unbinding.
|
|
|
|
*/
|
|
|
|
void (*master_unbind)(struct device *dev, struct drm_audio_component *);
|
2018-07-11 21:17:22 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct drm_audio_component - Used for direct communication between DRM and hda drivers
|
|
|
|
*/
|
|
|
|
struct drm_audio_component {
|
|
|
|
/**
|
|
|
|
* @dev: DRM device, used as parameter for ops
|
|
|
|
*/
|
|
|
|
struct device *dev;
|
|
|
|
/**
|
|
|
|
* @ops: Ops implemented by DRM driver, called by hda driver
|
|
|
|
*/
|
|
|
|
const struct drm_audio_component_ops *ops;
|
|
|
|
/**
|
|
|
|
* @audio_ops: Ops implemented by hda driver, called by DRM driver
|
|
|
|
*/
|
|
|
|
const struct drm_audio_component_audio_ops *audio_ops;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _DRM_AUDIO_COMPONENT_H_ */
|