Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) /* SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3)  * linux/sound/soc.h -- ALSA SoC Layer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)  * Author:	Liam Girdwood
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)  * Created:	Aug 11th 2005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7)  * Copyright:	Wolfson Microelectronics. PLC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10) #ifndef __LINUX_SND_SOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) #define __LINUX_SND_SOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) #include <linux/log2.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) #include <linux/android_kabi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25) #include <sound/compress_driver.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) #include <sound/control.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) #include <sound/ac97_codec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30)  * Convenience kcontrol builders
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert, xautodisable) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) 	((unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) 	{.reg = xreg, .rreg = xreg, .shift = shift_left, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) 	.rshift = shift_right, .max = xmax, .platform_max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) 	.invert = xinvert, .autodisable = xautodisable})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) #define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) 	((unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) 	{.reg = xreg, .rreg = xreg, .shift = shift_left, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) 	.rshift = shift_right, .min = xmin, .max = xmax, .platform_max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) 	.sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) 	SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) 	((unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) 	{.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) #define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) 	((unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) 	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) 	.max = xmax, .platform_max = xmax, .invert = xinvert})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) #define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) 	((unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) 	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) 	.max = xmax, .min = xmin, .platform_max = xmax, .sign_bit = xsign_bit, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) 	.invert = xinvert})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) #define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) 	((unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) 	{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) 	.min = xmin, .max = xmax, .platform_max = xmax, .invert = xinvert})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) #define SOC_SINGLE(xname, reg, shift, max, invert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 	.put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) 	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) #define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) 	.info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) 	.put = snd_soc_put_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 	.private_value = (unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) 		{.reg = xreg, .rreg = xreg, .shift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) 		 .rshift = xshift,  .min = xmin, .max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) 		 .platform_max = xmax, .invert = xinvert} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) 	.put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) 	.private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) #define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) 	SNDRV_CTL_ELEM_ACCESS_READWRITE, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 	.tlv.p  = (tlv_array),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 	.info = snd_soc_info_volsw_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 	.get = snd_soc_get_volsw_sx,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) 	.put = snd_soc_put_volsw_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) 	.private_value = (unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) 		{.reg = xreg, .rreg = xreg, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) 		.shift = xshift, .rshift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) 		.max = xmax, .min = xmin} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) #define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) 	.info = snd_soc_info_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) 	.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 	.private_value = (unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) 		{.reg = xreg, .rreg = xreg, .shift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 		 .rshift = xshift, .min = xmin, .max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 		 .platform_max = xmax, .invert = xinvert} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) 	.put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) 	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) 					  max, invert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) #define SOC_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) {									\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) 	.access = SNDRV_CTL_ELEM_ACCESS_READ |				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) 		SNDRV_CTL_ELEM_ACCESS_VOLATILE,				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) 	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 					  max, invert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 	.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) 					    xmax, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) #define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) 			   xmax, xinvert)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 	.info = snd_soc_info_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) 	.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) 	.private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 					    xshift, xmin, xmax, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) 	.put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) 	.private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) 					  max, invert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 	.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 					    xmax, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) #define SOC_DOUBLE_R_RANGE_TLV(xname, reg_left, reg_right, xshift, xmin, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 			       xmax, xinvert, tlv_array)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 	.info = snd_soc_info_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 	.get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 	.private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) 					    xshift, xmin, xmax, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	SNDRV_CTL_ELEM_ACCESS_READWRITE, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) 	.tlv.p  = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) 	.info = snd_soc_info_volsw_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) 	.get = snd_soc_get_volsw_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) 	.put = snd_soc_put_volsw_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) 	.private_value = (unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 		{.reg = xreg, .rreg = xrreg, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 		.shift = xshift, .rshift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 		.max = xmax, .min = xmin} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) #define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 	.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 	.private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) 					    xmin, xmax, xsign_bit, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) #define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) {	.iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 		  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 	.tlv.p  = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) 	.put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 	.private_value = (unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) 	{.reg = xreg, .rreg = xreg,  \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 	 .min = xmin, .max = xmax, .platform_max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	.sign_bit = 7,} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) {	.iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) 		  SNDRV_CTL_ELEM_ACCESS_READWRITE, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	.tlv.p  = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 	.info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	.put = snd_soc_put_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	.private_value = SOC_DOUBLE_S_VALUE(xreg, 0, 8, xmin, xmax, 7, 0, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) {	.reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 	.items = xitems, .texts = xtexts, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	.mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) #define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 	SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) #define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) {	.items = xitems, .texts = xtexts }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) {	.reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	.mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 	SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) {	.reg = xreg, .shift_l = xshift, .shift_r = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 	.mask = xmask, .items = xitems, .texts = xtexts, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 	.values = xvalues, .autodisable = 1}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 	SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) #define SOC_ENUM(xname, xenum) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) 	.info = snd_soc_info_enum_double, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 	.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 	.private_value = (unsigned long)&xenum }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) 	 xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) 	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 	 xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 	.private_value = \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) 		SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) #define SOC_DOUBLE_R_EXT(xname, reg_left, reg_right, xshift, xmax, xinvert,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) 	 xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) 					    xmax, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) #define SOC_SINGLE_MULTI_EXT(xname, xreg, xshift, xmax, xinvert, xcount,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 	xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 	.info = snd_soc_info_multi_ext, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 	.private_value = (unsigned long)&(struct soc_multi_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 		{.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 		.count = xcount, .platform_max = xmax, .invert = xinvert} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) 	 xhandler_get, xhandler_put, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 	.private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) #define SOC_SINGLE_RANGE_EXT_TLV(xname, xreg, xshift, xmin, xmax, xinvert, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) 				 xhandler_get, xhandler_put, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 	.info = snd_soc_info_volsw_range, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) 	.private_value = (unsigned long)&(struct soc_mixer_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 		{.reg = xreg, .rreg = xreg, .shift = xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 		 .rshift = xshift, .min = xmin, .max = xmax, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 		 .platform_max = xmax, .invert = xinvert} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 	 xhandler_get, xhandler_put, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 	.private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 					  xmax, xinvert, 0) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 	 xhandler_get, xhandler_put, tlv_array) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 		 SNDRV_CTL_ELEM_ACCESS_READWRITE, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	.tlv.p = (tlv_array), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 	.info = snd_soc_info_volsw, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 	.private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) 					    xmax, xinvert) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 	.info = snd_soc_info_bool_ext, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 	.private_value = xdata }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 	.info = snd_soc_info_enum_double, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 	.private_value = (unsigned long)&xenum }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) #define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 	SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) #define SND_SOC_BYTES(xname, xbase, xregs)		      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,   \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 	.info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 	.put = snd_soc_bytes_put, .private_value =	      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 		((unsigned long)&(struct soc_bytes)           \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 		{.base = xbase, .num_regs = xregs }) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) #define SND_SOC_BYTES_E(xname, xbase, xregs, xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 	.info = snd_soc_bytes_info, .get = xhandler_get, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 	.put = xhandler_put, .private_value = \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 		((unsigned long)&(struct soc_bytes) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 		{.base = xbase, .num_regs = xregs }) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask)	      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,   \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 	.info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	.put = snd_soc_bytes_put, .private_value =	      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 		((unsigned long)&(struct soc_bytes)           \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 		{.base = xbase, .num_regs = xregs,	      \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 		 .mask = xmask }) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327)  * SND_SOC_BYTES_EXT is deprecated, please USE SND_SOC_BYTES_TLV instead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) #define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	.info = snd_soc_bytes_info_ext, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) 	.get = xhandler_get, .put = xhandler_put, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 	.private_value = (unsigned long)&(struct soc_bytes_ext) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 		{.max = xcount} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) #define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 		  SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 	.tlv.c = (snd_soc_bytes_tlv_callback), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 	.info = snd_soc_bytes_info_ext, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	.private_value = (unsigned long)&(struct soc_bytes_ext) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 		{.max = xcount, .get = xhandler_get, .put = xhandler_put, } }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 		xmin, xmax, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) {	.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 	.info = snd_soc_info_xr_sx, .get = snd_soc_get_xr_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 	.put = snd_soc_put_xr_sx, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	.private_value = (unsigned long)&(struct soc_mreg_control) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) 		{.regbase = xregbase, .regcount = xregcount, .nbits = xnbits, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 		.invert = xinvert, .min = xmin, .max = xmax} }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) #define SOC_SINGLE_STROBE(xname, xreg, xshift, xinvert) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	SOC_SINGLE_EXT(xname, xreg, xshift, 1, xinvert, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 		snd_soc_get_strobe, snd_soc_put_strobe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357)  * Simplified versions of above macros, declaring a struct and calculating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358)  * ARRAY_SIZE internally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 						ARRAY_SIZE(xtexts), xtexts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) 	SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 	const struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 	const struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 							ARRAY_SIZE(xtexts), xtexts, xvalues)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) 	SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) 	const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 		xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) 	const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) struct device_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) struct snd_jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) struct snd_soc_card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) struct snd_soc_pcm_stream;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) struct snd_soc_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) struct snd_soc_pcm_runtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) struct snd_soc_dai;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) struct snd_soc_dai_driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) struct snd_soc_dai_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) struct snd_soc_component;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) struct snd_soc_component_driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) struct soc_enum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) struct snd_soc_jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) struct snd_soc_jack_zone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) struct snd_soc_jack_pin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) #include <sound/soc-dapm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) #include <sound/soc-dpcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) #include <sound/soc-topology.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) struct snd_soc_jack_gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) typedef int (*hw_write_t)(void *,const char* ,int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) enum snd_soc_pcm_subclass {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 	SND_SOC_PCM_CLASS_PCM	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 	SND_SOC_PCM_CLASS_BE	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) int snd_soc_register_card(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) int snd_soc_unregister_card(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) #ifdef CONFIG_PM_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) int snd_soc_suspend(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) int snd_soc_resume(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) static inline int snd_soc_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) static inline int snd_soc_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) int snd_soc_poweroff(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) int snd_soc_component_initialize(struct snd_soc_component *component,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 				 const struct snd_soc_component_driver *driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 				 struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) int snd_soc_add_component(struct snd_soc_component *component,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 			  struct snd_soc_dai_driver *dai_drv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 			  int num_dai);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) int snd_soc_register_component(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 			 const struct snd_soc_component_driver *component_driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 			 struct snd_soc_dai_driver *dai_drv, int num_dai);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) int devm_snd_soc_register_component(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 			 const struct snd_soc_component_driver *component_driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 			 struct snd_soc_dai_driver *dai_drv, int num_dai);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) void snd_soc_unregister_component(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) void snd_soc_unregister_component_by_driver(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 			 const struct snd_soc_component_driver *component_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 							    const char *driver_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 						   const char *driver_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) #ifdef CONFIG_SND_SOC_COMPRESS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) void snd_soc_disconnect_sync(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 				struct snd_soc_dai_link *dai_link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 			    int stream, int action);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) static inline void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 				     int stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	snd_soc_runtime_action(rtd, stream, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) static inline void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 				       int stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) 	snd_soc_runtime_action(rtd, stream, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 			    struct snd_pcm_hardware *hw, int stream);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 	unsigned int dai_fmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) #ifdef CONFIG_DMI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) static inline int snd_soc_set_dmi_name(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 				       const char *flavour)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) /* Utility functions to get clock rates from various things */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) /* set runtime hw params */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	const struct snd_pcm_hardware *hw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) /* Jack reporting */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 			  struct snd_soc_jack_pin *pins);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 				    struct notifier_block *nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 				      struct notifier_block *nb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 			  struct snd_soc_jack_zone *zones);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) #ifdef CONFIG_GPIOLIB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) 			struct snd_soc_jack_gpio *gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 			    struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 			    int count, struct snd_soc_jack_gpio *gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 			struct snd_soc_jack_gpio *gpios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 					 struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 					  struct snd_soc_jack *jack,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 					  int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 					  struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 					   struct snd_soc_jack_gpio *gpios)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 	unsigned int id, unsigned int id_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) void snd_soc_free_ac97_component(struct snd_ac97 *ac97);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) #ifdef CONFIG_SND_SOC_AC97_BUS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 		struct platform_device *pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) extern struct snd_ac97_bus_ops *soc_ac97_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) static inline int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 	struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567)  *Controls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 				  void *data, const char *long_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 				  const char *prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) int snd_soc_add_component_controls(struct snd_soc_component *component,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 	const struct snd_kcontrol_new *controls, unsigned int num_controls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 	const struct snd_kcontrol_new *controls, int num_controls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) int snd_soc_add_dai_controls(struct snd_soc_dai *dai,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	const struct snd_kcontrol_new *controls, int num_controls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 	struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 	struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 			  struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) #define snd_soc_info_bool_ext		snd_ctl_boolean_mono_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) #define snd_soc_get_volsw_2r snd_soc_get_volsw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) #define snd_soc_put_volsw_2r snd_soc_put_volsw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 	struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) int snd_soc_limit_volume(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	const char *name, int max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 		       struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) 		      struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 		      struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 	struct snd_ctl_elem_info *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	unsigned int size, unsigned int __user *tlv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 	struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) int snd_soc_get_strobe(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) int snd_soc_put_strobe(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	struct snd_ctl_elem_value *ucontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) int snd_soc_info_multi_ext(struct snd_kcontrol *kcontrol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 	struct snd_ctl_elem_info *uinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631)  * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633)  * @pin:    name of the pin to update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634)  * @mask:   bits to check for in reported jack status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635)  * @invert: if non-zero then pin is enabled when status is not reported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636)  * @list:   internal list entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) struct snd_soc_jack_pin {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 	const char *pin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 	int mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	bool invert;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646)  * struct snd_soc_jack_zone - Describes voltage zones of jack detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648)  * @min_mv: start voltage in mv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649)  * @max_mv: end voltage in mv
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650)  * @jack_type: type of jack that is expected for this voltage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651)  * @debounce_time: debounce_time for jack, codec driver should wait for this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652)  *		duration before reading the adc for voltages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653)  * @list:   internal list entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) struct snd_soc_jack_zone {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 	unsigned int min_mv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	unsigned int max_mv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 	unsigned int jack_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 	unsigned int debounce_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664)  * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666)  * @gpio:         legacy gpio number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667)  * @idx:          gpio descriptor index within the function of the GPIO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668)  *                consumer device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669)  * @gpiod_dev:    GPIO consumer device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670)  * @name:         gpio name. Also as connection ID for the GPIO consumer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671)  *                device function name lookup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672)  * @report:       value to report when jack detected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673)  * @invert:       report presence in low state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674)  * @debounce_time: debounce time in ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675)  * @wake:	  enable as wake source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676)  * @jack_status_check: callback function which overrides the detection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677)  *		       to provide more complex checks (eg, reading an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678)  *		       ADC).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) struct snd_soc_jack_gpio {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	unsigned int gpio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	unsigned int idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	struct device *gpiod_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 	int report;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 	int invert;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 	int debounce_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	bool wake;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 	/* private: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 	struct snd_soc_jack *jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 	struct delayed_work work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 	struct notifier_block pm_notifier;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 	struct gpio_desc *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 	void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 	/* public: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) 	int (*jack_status_check)(void *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) struct snd_soc_jack {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 	struct mutex mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	struct snd_jack *jack;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 	struct snd_soc_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 	struct list_head pins;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 	int status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 	struct blocking_notifier_head notifier;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 	struct list_head jack_zones;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) /* SoC PCM stream information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) struct snd_soc_pcm_stream {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 	const char *stream_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 	u64 formats;			/* SNDRV_PCM_FMTBIT_* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 	unsigned int rates;		/* SNDRV_PCM_RATE_* */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	unsigned int rate_min;		/* min rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 	unsigned int rate_max;		/* max rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	unsigned int channels_min;	/* min channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	unsigned int channels_max;	/* max channels */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 	unsigned int sig_bits;		/* number of bits of content */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) /* SoC audio ops */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) struct snd_soc_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	int (*startup)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 	void (*shutdown)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	int (*hw_free)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 	int (*prepare)(struct snd_pcm_substream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 	int (*trigger)(struct snd_pcm_substream *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) struct snd_soc_compr_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 	int (*startup)(struct snd_compr_stream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 	void (*shutdown)(struct snd_compr_stream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 	int (*set_params)(struct snd_compr_stream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) 	int (*trigger)(struct snd_compr_stream *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) struct snd_soc_component*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 		       const char *driver_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) struct snd_soc_dai_link_component {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 	struct device_node *of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 	const char *dai_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) struct snd_soc_dai_link {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 	/* config - must be set by machine driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 	const char *name;			/* Codec name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) 	const char *stream_name;		/* Stream name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 	 * You MAY specify the link's CPU-side device, either by device name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) 	 * or by DT/OF node, but not both. If this information is omitted,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 	 * the CPU-side DAI is matched using .cpu_dai_name only, which hence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 	 * must be globally unique. These fields are currently typically used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 	 * only for codec to codec links, or systems using device tree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 	 * You MAY specify the DAI name of the CPU DAI. If this information is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 	 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 	 * only, which only works well when that device exposes a single DAI.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	struct snd_soc_dai_link_component *cpus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 	unsigned int num_cpus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 	 * You MUST specify the link's codec, either by device name, or by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	 * DT/OF node, but not both.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 	/* You MUST specify the DAI name within the codec */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 	struct snd_soc_dai_link_component *codecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 	unsigned int num_codecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 	 * You MAY specify the link's platform/PCM/DMA driver, either by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 	 * device name, or by DT/OF node, but not both. Some forms of link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 	 * do not need a platform. In such case, platforms are not mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 	struct snd_soc_dai_link_component *platforms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	unsigned int num_platforms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 	int id;	/* optional ID for machine driver link identification */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 	const struct snd_soc_pcm_stream *params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 	unsigned int num_params;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 	unsigned int dai_fmt;           /* format to set on init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 	enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 	/* codec/machine specific init - e.g. add machine controls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 	int (*init)(struct snd_soc_pcm_runtime *rtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	/* codec/machine specific exit - dual of init() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 	void (*exit)(struct snd_soc_pcm_runtime *rtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 	/* optional hw_params re-writing for BE and FE sync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 	int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 			struct snd_pcm_hw_params *params);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 	/* machine stream operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 	const struct snd_soc_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 	const struct snd_soc_compr_ops *compr_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 	/* Mark this pcm with non atomic ops */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 	unsigned int nonatomic:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 	/* For unidirectional dai links */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	unsigned int playback_only:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	unsigned int capture_only:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	/* Keep DAI active over suspend */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 	unsigned int ignore_suspend:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 	/* Symmetry requirements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	unsigned int symmetric_rates:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 	unsigned int symmetric_channels:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	unsigned int symmetric_samplebits:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 	/* Do not create a PCM for this DAI link (Backend link) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 	unsigned int no_pcm:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 	/* This DAI link can route to other DAI links at runtime (Frontend)*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	unsigned int dynamic:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 	/* DPCM capture and Playback support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	unsigned int dpcm_capture:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	unsigned int dpcm_playback:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 	/* DPCM used FE & BE merged format */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 	unsigned int dpcm_merged_format:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	/* DPCM used FE & BE merged channel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 	unsigned int dpcm_merged_chan:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	/* DPCM used FE & BE merged rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 	unsigned int dpcm_merged_rate:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	/* pmdown_time is ignored at stop */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 	unsigned int ignore_pmdown_time:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 	/* Do not create a PCM for this DAI link (Backend link) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 	unsigned int ignore:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) #ifdef CONFIG_SND_SOC_TOPOLOGY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 	struct snd_soc_dobj dobj; /* For topology */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) #define for_each_link_codecs(link, i, codec)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 	     ((i) < link->num_codecs) && ((codec) = &link->codecs[i]);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) #define for_each_link_platforms(link, i, platform)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 	     ((i) < link->num_platforms) &&				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 	     ((platform) = &link->platforms[i]);			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) #define for_each_link_cpus(link, i, cpu)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 	     ((i) < link->num_cpus) && ((cpu) = &link->cpus[i]);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870)  * Sample 1 : Single CPU/Codec/Platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872)  * SND_SOC_DAILINK_DEFS(test,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873)  *	DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874)  *	DAILINK_COMP_ARRAY(COMP_CODEC("codec", "codec_dai")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875)  *	DAILINK_COMP_ARRAY(COMP_PLATFORM("platform")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877)  * struct snd_soc_dai_link link = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878)  *	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879)  *	SND_SOC_DAILINK_REG(test),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880)  * };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882)  * Sample 2 : Multi CPU/Codec, no Platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884)  * SND_SOC_DAILINK_DEFS(test,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885)  *	DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886)  *			   COMP_CPU("cpu_dai2")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887)  *	DAILINK_COMP_ARRAY(COMP_CODEC("codec1", "codec_dai1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888)  *			   COMP_CODEC("codec2", "codec_dai2")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890)  * struct snd_soc_dai_link link = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891)  *	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892)  *	SND_SOC_DAILINK_REG(test),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893)  * };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895)  * Sample 3 : Define each CPU/Codec/Platform manually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897)  * SND_SOC_DAILINK_DEF(test_cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898)  *		DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899)  *				   COMP_CPU("cpu_dai2")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900)  * SND_SOC_DAILINK_DEF(test_codec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901)  *		DAILINK_COMP_ARRAY(COMP_CODEC("codec1", "codec_dai1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902)  *				   COMP_CODEC("codec2", "codec_dai2")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903)  * SND_SOC_DAILINK_DEF(test_platform,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904)  *		DAILINK_COMP_ARRAY(COMP_PLATFORM("platform")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906)  * struct snd_soc_dai_link link = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907)  *	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908)  *	SND_SOC_DAILINK_REG(test_cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909)  *			    test_codec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910)  *			    test_platform),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911)  * };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913)  * Sample 4 : Sample3 without platform
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915)  * struct snd_soc_dai_link link = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916)  *	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917)  *	SND_SOC_DAILINK_REG(test_cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918)  *			    test_codec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919)  * };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) #define SND_SOC_DAILINK_REG1(name)	 SND_SOC_DAILINK_REG3(name##_cpus, name##_codecs, name##_platforms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) #define SND_SOC_DAILINK_REG2(cpu, codec) SND_SOC_DAILINK_REG3(cpu, codec, null_dailink_component)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) #define SND_SOC_DAILINK_REG3(cpu, codec, platform)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) 	.cpus		= cpu,				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 	.num_cpus	= ARRAY_SIZE(cpu),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 	.codecs		= codec,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 	.num_codecs	= ARRAY_SIZE(codec),		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 	.platforms	= platform,			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) 	.num_platforms	= ARRAY_SIZE(platform)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) #define SND_SOC_DAILINK_REGx(_1, _2, _3, func, ...) func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) #define SND_SOC_DAILINK_REG(...) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 	SND_SOC_DAILINK_REGx(__VA_ARGS__,		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 			SND_SOC_DAILINK_REG3,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 			SND_SOC_DAILINK_REG2,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 			SND_SOC_DAILINK_REG1)(__VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) #define SND_SOC_DAILINK_DEF(name, def...)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 	static struct snd_soc_dai_link_component name[]	= { def }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) #define SND_SOC_DAILINK_DEFS(name, cpu, codec, platform...)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 	SND_SOC_DAILINK_DEF(name##_cpus, cpu);			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 	SND_SOC_DAILINK_DEF(name##_codecs, codec);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 	SND_SOC_DAILINK_DEF(name##_platforms, platform)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) #define DAILINK_COMP_ARRAY(param...)	param
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) #define COMP_EMPTY()			{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) #define COMP_CPU(_dai)			{ .dai_name = _dai, }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) #define COMP_CODEC(_name, _dai)		{ .name = _name, .dai_name = _dai, }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) #define COMP_PLATFORM(_name)		{ .name = _name }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) #define COMP_AUX(_name)			{ .name = _name }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) #define COMP_CODEC_CONF(_name)		{ .name = _name }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) #define COMP_DUMMY()			{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) extern struct snd_soc_dai_link_component null_dailink_component[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) struct snd_soc_codec_conf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) 	 * specify device either by device name, or by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 	 * DT/OF node, but not both.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 	struct snd_soc_dai_link_component dlc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) 	 * optional map of kcontrol, widget and path name prefixes that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) 	 * associated per device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) 	const char *name_prefix;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) struct snd_soc_aux_dev {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 	 * specify multi-codec either by device name, or by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 	 * DT/OF node, but not both.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 	struct snd_soc_dai_link_component dlc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) 	/* codec/machine specific init - e.g. add machine controls */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 	int (*init)(struct snd_soc_component *component);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) /* SoC card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) struct snd_soc_card {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) 	const char *long_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) 	const char *driver_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) 	const char *components;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) #ifdef CONFIG_DMI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 	char dmi_longname[80];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) #endif /* CONFIG_DMI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 	char topology_shortname[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 	struct snd_card *snd_card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) 	struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 	struct mutex mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 	struct mutex dapm_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 	/* Mutex for PCM operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) 	struct mutex pcm_mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) 	enum snd_soc_pcm_subclass pcm_subclass;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 	spinlock_t dpcm_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	int (*probe)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 	int (*late_probe)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	int (*remove)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 	/* the pre and post PM functions are used to do any PM work before and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 	 * after the codec and DAI's do any PM work. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 	int (*suspend_pre)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 	int (*suspend_post)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 	int (*resume_pre)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	int (*resume_post)(struct snd_soc_card *card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 	/* callbacks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 	int (*set_bias_level)(struct snd_soc_card *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 			      struct snd_soc_dapm_context *dapm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 			      enum snd_soc_bias_level level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 	int (*set_bias_level_post)(struct snd_soc_card *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 				   struct snd_soc_dapm_context *dapm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 				   enum snd_soc_bias_level level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 	int (*add_dai_link)(struct snd_soc_card *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 			    struct snd_soc_dai_link *link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) 	void (*remove_dai_link)(struct snd_soc_card *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 			    struct snd_soc_dai_link *link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 	long pmdown_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 	/* CPU <--> Codec DAI links  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 	struct snd_soc_dai_link *dai_link;  /* predefined links only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 	int num_links;  /* predefined links only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) 	struct list_head rtd_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 	int num_rtd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) 	/* optional codec specific configuration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) 	struct snd_soc_codec_conf *codec_conf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 	int num_configs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) 	 * optional auxiliary devices such as amplifiers or codecs with DAI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) 	 * link unused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) 	struct snd_soc_aux_dev *aux_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 	int num_aux_devs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) 	struct list_head aux_comp_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 	const struct snd_kcontrol_new *controls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 	int num_controls;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 	 * Card-specific routes and widgets.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 	 * Note: of_dapm_xxx for Device Tree; Otherwise for driver build-in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 	const struct snd_soc_dapm_widget *dapm_widgets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 	int num_dapm_widgets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 	const struct snd_soc_dapm_route *dapm_routes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) 	int num_dapm_routes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 	const struct snd_soc_dapm_widget *of_dapm_widgets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 	int num_of_dapm_widgets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 	const struct snd_soc_dapm_route *of_dapm_routes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) 	int num_of_dapm_routes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 	/* lists of probed devices belonging to this card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 	struct list_head component_dev_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) 	struct list_head widgets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 	struct list_head paths;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 	struct list_head dapm_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 	struct list_head dapm_dirty;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 	/* attached dynamic objects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	struct list_head dobj_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	/* Generic DAPM context for the card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 	struct snd_soc_dapm_context dapm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 	struct snd_soc_dapm_stats dapm_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 	struct snd_soc_dapm_update *update;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 	struct dentry *debugfs_card_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) #ifdef CONFIG_PM_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 	struct work_struct deferred_resume_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) 	u32 pop_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) 	/* bit field */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 	unsigned int instantiated:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) 	unsigned int topology_shortname_created:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 	unsigned int fully_routed:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 	unsigned int disable_route_checks:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) 	unsigned int probed:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 	void *drvdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) 	ANDROID_KABI_RESERVE(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) 	ANDROID_KABI_RESERVE(3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) 	ANDROID_KABI_RESERVE(4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) #define for_each_card_prelinks(card, i, link)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) 	     ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) #define for_each_card_pre_auxs(card, i, aux)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) 	     ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) #define for_each_card_rtds(card, rtd)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) 	list_for_each_entry(rtd, &(card)->rtd_list, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) #define for_each_card_rtds_safe(card, rtd, _rtd)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) 	list_for_each_entry_safe(rtd, _rtd, &(card)->rtd_list, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) #define for_each_card_auxs(card, component)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) 	list_for_each_entry(component, &card->aux_comp_list, card_aux_list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) #define for_each_card_auxs_safe(card, component, _comp)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) 	list_for_each_entry_safe(component, _comp,	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 				 &card->aux_comp_list, card_aux_list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) #define for_each_card_components(card, component)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 	list_for_each_entry(component, &(card)->component_dev_list, card_list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) #define for_each_card_dapms(card, dapm)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) 	list_for_each_entry(dapm, &card->dapm_list, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) #define for_each_card_widgets(card, w)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) 	list_for_each_entry(w, &card->widgets, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) #define for_each_card_widgets_safe(card, w, _w)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) 	list_for_each_entry_safe(w, _w, &card->widgets, list)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) /* SoC machine DAI configuration, glues a codec and cpu DAI together */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) struct snd_soc_pcm_runtime {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) 	struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) 	struct snd_soc_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) 	struct snd_soc_dai_link *dai_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 	struct snd_pcm_ops ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) 	unsigned int params_select; /* currently selected param for dai link */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) 	/* Dynamic PCM BE runtime data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) 	struct snd_soc_dpcm_runtime dpcm[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 	long pmdown_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 	/* runtime devices */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 	struct snd_pcm *pcm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) 	struct snd_compr *compr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) 	 * dais = cpu_dai + codec_dai
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 	 * see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 	 *	soc_new_pcm_runtime()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) 	 *	asoc_rtd_to_cpu()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) 	 *	asoc_rtd_to_codec()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 	struct snd_soc_dai **dais;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 	unsigned int num_codecs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 	unsigned int num_cpus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) 	struct snd_soc_dapm_widget *playback_widget;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 	struct snd_soc_dapm_widget *capture_widget;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 	struct delayed_work delayed_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) 	void (*close_delayed_work_func)(struct snd_soc_pcm_runtime *rtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) 	struct dentry *debugfs_dpcm_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) 	unsigned int num; /* 0-based and monotonic increasing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 	struct list_head list; /* rtd list of the soc card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 	/* function mark */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) 	struct snd_pcm_substream *mark_startup;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 	/* bit field */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) 	unsigned int pop_wait:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) 	unsigned int fe_compr:1; /* for Dynamic PCM */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) 	int num_components;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) 	struct snd_soc_component *components[]; /* CPU/Codec/Platform */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) /* see soc_new_pcm_runtime()  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) #define asoc_rtd_to_cpu(rtd, n)   (rtd)->dais[n]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) #define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) #define asoc_substream_to_rtd(substream) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) 	(struct snd_soc_pcm_runtime *)snd_pcm_substream_chip(substream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) #define for_each_rtd_components(rtd, i, component)			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) 	for ((i) = 0, component = NULL;					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 	     ((i) < rtd->num_components) && ((component) = rtd->components[i]);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) #define for_each_rtd_cpu_dais(rtd, i, dai)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) 	     ((i) < rtd->num_cpus) && ((dai) = asoc_rtd_to_cpu(rtd, i)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) #define for_each_rtd_cpu_dais_rollback(rtd, i, dai)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) 	for (; (--(i) >= 0) && ((dai) = asoc_rtd_to_cpu(rtd, i));)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) #define for_each_rtd_codec_dais(rtd, i, dai)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) 	     ((i) < rtd->num_codecs) && ((dai) = asoc_rtd_to_codec(rtd, i)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) #define for_each_rtd_codec_dais_rollback(rtd, i, dai)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) 	for (; (--(i) >= 0) && ((dai) = asoc_rtd_to_codec(rtd, i));)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) #define for_each_rtd_dais(rtd, i, dai)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) 	for ((i) = 0;							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) 	     ((i) < (rtd)->num_cpus + (rtd)->num_codecs) &&		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) 		     ((dai) = (rtd)->dais[i]);				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) 	     (i)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) #define for_each_rtd_dais_rollback(rtd, i, dai)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 	for (; (--(i) >= 0) && ((dai) = (rtd)->dais[i]);)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) /* mixer control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) struct soc_mixer_control {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) 	int min, max, platform_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) 	int reg, rreg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) 	unsigned int shift, rshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) 	unsigned int sign_bit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) 	unsigned int invert:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) 	unsigned int autodisable:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) #ifdef CONFIG_SND_SOC_TOPOLOGY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) 	struct snd_soc_dobj dobj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) struct soc_bytes {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) 	int base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) 	int num_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 	u32 mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) struct soc_bytes_ext {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) 	int max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) #ifdef CONFIG_SND_SOC_TOPOLOGY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) 	struct snd_soc_dobj dobj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) 	/* used for TLV byte control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) 	int (*get)(struct snd_kcontrol *kcontrol, unsigned int __user *bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) 			unsigned int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) 	int (*put)(struct snd_kcontrol *kcontrol, const unsigned int __user *bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) 			unsigned int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) /* multi register control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) struct soc_mreg_control {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) 	long min, max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) 	unsigned int regbase, regcount, nbits, invert;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) struct soc_multi_mixer_control {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) 	int min, max, platform_max, count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) 	unsigned int reg, rreg, shift, rshift, invert;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) /* enumerated kcontrol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270) struct soc_enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) 	int reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) 	unsigned char shift_l;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) 	unsigned char shift_r;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) 	unsigned int items;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) 	unsigned int mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) 	const char * const *texts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) 	const unsigned int *values;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) 	unsigned int autodisable:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) #ifdef CONFIG_SND_SOC_TOPOLOGY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) 	struct snd_soc_dobj dobj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) 	ANDROID_KABI_RESERVE(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) 	if (mc->reg == mc->rreg && mc->shift == mc->rshift)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) 		return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) 	 * mc->reg == mc->rreg && mc->shift != mc->rshift, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) 	 * mc->reg != mc->rreg means that the control is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) 	 * stereo (bits in one register or in two registers)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) 	return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299) 	unsigned int val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301) 	unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303) 	if (!e->values)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) 		return val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) 	for (i = 0; i < e->items; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) 		if (val == e->values[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) 			return i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) 	unsigned int item)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) 	if (!e->values)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) 		return item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) 	return e->values[item];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323)  * snd_soc_kcontrol_component() - Returns the component that registered the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324)  *  control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325)  * @kcontrol: The control for which to get the component
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327)  * Note: This function will work correctly if the control has been registered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328)  * for a component. With snd_soc_add_codec_controls() or via table based
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329)  * setup for either a CODEC or component driver. Otherwise the behavior is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330)  * undefined.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) static inline struct snd_soc_component *snd_soc_kcontrol_component(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) 	struct snd_kcontrol *kcontrol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) 	return snd_kcontrol_chip(kcontrol);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) int snd_soc_util_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) void snd_soc_util_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) int snd_soc_of_parse_card_name(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) 			       const char *propname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) 					  const char *propname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) int snd_soc_of_get_slot_mask(struct device_node *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) 			     const char *prop_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) 			     unsigned int *mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) int snd_soc_of_parse_tdm_slot(struct device_node *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) 			      unsigned int *tx_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) 			      unsigned int *rx_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) 			      unsigned int *slots,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) 			      unsigned int *slot_width);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) void snd_soc_of_parse_node_prefix(struct device_node *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) 				   struct snd_soc_codec_conf *codec_conf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) 				   struct device_node *of_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) 				   const char *propname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358) void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) 				   struct snd_soc_codec_conf *codec_conf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) 				   struct device_node *of_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) 				   const char *propname)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) 	snd_soc_of_parse_node_prefix(card->dev->of_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) 				     codec_conf, of_node, propname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) 				   const char *propname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371) 				     const char *prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372) 				     struct device_node **bitclkmaster,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) 				     struct device_node **framemaster);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374) int snd_soc_get_dai_id(struct device_node *ep);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) int snd_soc_get_dai_name(struct of_phandle_args *args,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376) 			 const char **dai_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) int snd_soc_of_get_dai_name(struct device_node *of_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) 			    const char **dai_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) int snd_soc_of_get_dai_link_codecs(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) 				   struct device_node *of_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381) 				   struct snd_soc_dai_link *dai_link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) void snd_soc_of_put_dai_link_codecs(struct snd_soc_dai_link *dai_link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) 			    struct snd_soc_dai_link *dai_link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) void snd_soc_remove_pcm_runtime(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) 				struct snd_soc_pcm_runtime *rtd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390) 					 struct snd_soc_dai_driver *dai_drv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) 					 bool legacy_dai_naming);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) struct snd_soc_dai *devm_snd_soc_register_dai(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393) 					      struct snd_soc_component *component,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) 					      struct snd_soc_dai_driver *dai_drv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395) 					      bool legacy_dai_naming);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) void snd_soc_unregister_dai(struct snd_soc_dai *dai);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) struct snd_soc_dai *snd_soc_find_dai(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399) 	const struct snd_soc_dai_link_component *dlc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400) struct snd_soc_dai *snd_soc_find_dai_with_mutex(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) 	const struct snd_soc_dai_link_component *dlc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) #include <sound/soc-dai.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) int snd_soc_fixup_dai_links_platform_name(struct snd_soc_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407) 					  const char *platform_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) 	struct snd_soc_dai_link *dai_link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) 	if (!platform_name) /* nothing to do */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) 	/* set platform name for each dailink */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) 	for_each_card_prelinks(card, i, dai_link) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) 		name = devm_kstrdup(card->dev, platform_name, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419) 		if (!name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) 			return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422) 		if (!dai_link->platforms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425) 		/* only single platform is supported for now */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) 		dai_link->platforms->name = name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433) extern struct dentry *snd_soc_debugfs_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) extern const struct dev_pm_ops snd_soc_pm_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) /* Helper functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439) static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) 	mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) 	mutex_unlock(&dapm->card->dapm_mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) #include <sound/soc-component.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) #include <sound/soc-card.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452) #endif