From: Libin Yang <libin.yang@xxxxxxxxx> Create hdac_hdmi_common.h and define some general functions related to hdac_hdmi codec. Signed-off-by: Libin Yang <libin.yang@xxxxxxxxx> --- sound/soc/intel/boards/hdac_hdmi_common.h | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sound/soc/intel/boards/hdac_hdmi_common.h diff --git a/sound/soc/intel/boards/hdac_hdmi_common.h b/sound/soc/intel/boards/hdac_hdmi_common.h new file mode 100644 index 0000000..9e6f07a --- /dev/null +++ b/sound/soc/intel/boards/hdac_hdmi_common.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright(c) 2019 Intel Corporation. + */ + +/* + * This file includes the general functions related to hdac_hdmi codec, + * which is used by the different boards + */ + +#ifndef __SOUND_SOC_HDAC_HDMI_COMMON +#define __SOUND_SOC_HDAC_HDMI_COMMON + +static int hdac_hdmi_add_device_link(struct device *consumer, + struct device *supplier, + struct device_link **link) +{ + /* + * Setup a device_link between machine device and HDMI codec device. + * The machine device is the consumer and the HDMI codec device is + * the supplier. With this setting, we can make sure that the audio + * domain in display power will be always turned on before operating + * on the HDMI audio codec registers. + */ + if (!(*link)) + *link = device_link_add(consumer, supplier, DL_FLAG_RPM_ACTIVE | \ + DL_FLAG_AUTOREMOVE_CONSUMER); + + if (!(*link)) + dev_warn(consumer, + "failed creating device_link for HDMI codec\n"); + + return 0; +} + +#endif /* __SOUND_SOC_HDAC_HDMI_COMMON */ -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx https://mailman.alsa-project.org/mailman/listinfo/alsa-devel