forked from microsoft/WSL2-Linux-Kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/drm_audio_component' of https://git.kernel.org/pu…
…b/scm/linux/kernel/git/tiwai/sound into asoc-4.19
- Loading branch information
Showing
31 changed files
with
1,285 additions
and
1,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright © 2014 Intel Corporation | ||
|
||
#ifndef _DRM_AUDIO_COMPONENT_H_ | ||
#define _DRM_AUDIO_COMPONENT_H_ | ||
|
||
struct drm_audio_component; | ||
|
||
/** | ||
* 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. | ||
*/ | ||
void (*get_power)(struct device *); | ||
/** | ||
* @put_power: put the POWER_DOMAIN_AUDIO power well | ||
* | ||
* Allow the power well to be turned off. | ||
*/ | ||
void (*put_power)(struct device *); | ||
/** | ||
* @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); | ||
/** | ||
* @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 *); | ||
}; | ||
|
||
/** | ||
* 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_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
// HD-Audio helpers to sync with DRM driver | ||
|
||
#ifndef __SOUND_HDA_COMPONENT_H | ||
#define __SOUND_HDA_COMPONENT_H | ||
|
||
#include <drm/drm_audio_component.h> | ||
|
||
#ifdef CONFIG_SND_HDA_COMPONENT | ||
int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); | ||
int snd_hdac_display_power(struct hdac_bus *bus, bool enable); | ||
int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, | ||
int dev_id, int rate); | ||
int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, | ||
bool *audio_enabled, char *buffer, int max_bytes); | ||
int snd_hdac_acomp_init(struct hdac_bus *bus, | ||
const struct drm_audio_component_audio_ops *aops, | ||
int (*match_master)(struct device *, void *), | ||
size_t extra_size); | ||
int snd_hdac_acomp_exit(struct hdac_bus *bus); | ||
int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, | ||
const struct drm_audio_component_audio_ops *ops); | ||
#else | ||
static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) | ||
{ | ||
return 0; | ||
} | ||
static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable) | ||
{ | ||
return 0; | ||
} | ||
static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec, | ||
hda_nid_t nid, int dev_id, int rate) | ||
{ | ||
return 0; | ||
} | ||
static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, | ||
int dev_id, bool *audio_enabled, | ||
char *buffer, int max_bytes) | ||
{ | ||
return -ENODEV; | ||
} | ||
static inline int snd_hdac_acomp_init(struct hdac_bus *bus, | ||
const struct drm_audio_component_audio_ops *aops, | ||
int (*match_master)(struct device *, void *), | ||
size_t extra_size) | ||
{ | ||
return -ENODEV; | ||
} | ||
static inline int snd_hdac_acomp_exit(struct hdac_bus *bus) | ||
{ | ||
return 0; | ||
} | ||
static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, | ||
const struct drm_audio_component_audio_ops *ops) | ||
{ | ||
return -ENODEV; | ||
} | ||
#endif | ||
|
||
#endif /* __SOUND_HDA_COMPONENT_H */ |
Oops, something went wrong.