socsvn commit: r307276 - soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve
iateaca at FreeBSD.org
iateaca at FreeBSD.org
Sat Aug 6 13:01:52 UTC 2016
Author: iateaca
Date: Sat Aug 6 13:01:50 2016
New Revision: 307276
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=307276
Log:
redesign the hda_codec_parameters using macros for each node in order to allow multiple configurations
(1 output channel, 1 input channel or both of them)
M hda_codec.c
Modified:
soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c
Modified: soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c
==============================================================================
--- soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sat Aug 6 12:51:07 2016 (r307275)
+++ soc2016/iateaca/bhyve-hda-head/usr.sbin/bhyve/hda_codec.c Sat Aug 6 13:01:50 2016 (r307276)
@@ -185,70 +185,85 @@
* HDA Codec global data
*/
+#define HDA_CODEC_ROOT_DESC \
+ [HDA_CODEC_ROOT_NID] = { \
+ [HDA_PARAM_VENDOR_ID] = INTEL_VENDORID, \
+ [HDA_PARAM_REVISION_ID] = 0xffff, \
+ [HDA_PARAM_SUB_NODE_COUNT] = 0x00010001, /* 1 Subnode, StartNid = 1 */ \
+ }, \
+
+#define HDA_CODEC_FG_COMMON_DESC \
+ [HDA_PARAM_FCT_GRP_TYPE] = HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO, \
+ [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x1f << 16) | 0x7ff, /* B8 - B32, 8.0 - 192.0kHz */ \
+ [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \
+ [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \
+ [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \
+ [HDA_PARAM_GPIO_COUNT] = 0x00, \
+
+#define HDA_CODEC_FG_DUPLEX_DESC \
+ [HDA_CODEC_FG_NID] = { \
+ [HDA_PARAM_SUB_NODE_COUNT] = 0x00020004, /* 4 Subnodes, StartNid = 2 */ \
+ HDA_CODEC_FG_COMMON_DESC \
+ }, \
+
+#define HDA_CODEC_OUTPUT_DESC \
+ [HDA_CODEC_AUDIO_OUTPUT_NID] = { \
+ [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_OUTPUT | \
+ HDA_CODEC_AUDIO_WCAP_FORMAT_OVR | \
+ HDA_CODEC_AUDIO_WCAP_AMP_OVR | \
+ HDA_CODEC_AUDIO_WCAP_OUT_AMP | \
+ HDA_CODEC_AUDIO_WCAP_STEREO, \
+ [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, /* B16, 16.0 - 192.0kHz */ \
+ [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \
+ [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \
+ [HDA_PARAM_CONN_LIST_LENGTH] = 0x00, \
+ [HDA_PARAM_OUTPUT_AMP_CAP] = HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP | \
+ HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE | \
+ HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS | \
+ HDA_CODEC_OUTPUT_AMP_CAP_OFFSET, \
+ }, \
+ [HDA_CODEC_PIN_OUTPUT_NID] = { \
+ [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_PIN | \
+ HDA_CODEC_AUDIO_WCAP_CONN_LIST | \
+ HDA_CODEC_AUDIO_WCAP_STEREO, \
+ [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_OUTPUT | \
+ HDA_CODEC_PIN_CAP_PRESENCE_DETECT, \
+ [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \
+ [HDA_PARAM_CONN_LIST_LENGTH] = 0x01, \
+ [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \
+ }, \
+
+#define HDA_CODEC_INPUT_DESC \
+ [HDA_CODEC_AUDIO_INPUT_NID] = { \
+ [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_INPUT | \
+ HDA_CODEC_AUDIO_WCAP_CONN_LIST | \
+ HDA_CODEC_AUDIO_WCAP_FORMAT_OVR | \
+ HDA_CODEC_AUDIO_WCAP_AMP_OVR | \
+ HDA_CODEC_AUDIO_WCAP_IN_AMP | \
+ HDA_CODEC_AUDIO_WCAP_STEREO, \
+ [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, /* B16, 16.0 - 192.0kHz */ \
+ [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM, \
+ [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \
+ [HDA_PARAM_CONN_LIST_LENGTH] = 0x01, \
+ [HDA_PARAM_INPUT_AMP_CAP] = HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP | \
+ HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE | \
+ HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS | \
+ HDA_CODEC_OUTPUT_AMP_CAP_OFFSET, \
+ }, \
+ [HDA_CODEC_PIN_INPUT_NID] = { \
+ [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_PIN | \
+ HDA_CODEC_AUDIO_WCAP_STEREO, \
+ [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_INPUT | \
+ HDA_CODEC_PIN_CAP_PRESENCE_DETECT, \
+ [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */ \
+ [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */ \
+ }, \
+
static const uint32_t hda_codec_parameters[][HDA_CODEC_PARAMS_COUNT] = {
- [HDA_CODEC_ROOT_NID] = {
- [HDA_PARAM_VENDOR_ID] = INTEL_VENDORID,
- [HDA_PARAM_REVISION_ID] = 0xffff,
- [HDA_PARAM_SUB_NODE_COUNT] = 0x00010001, /* 1 Subnode, StartNid = 1 */
- },
- [HDA_CODEC_FG_NID] = {
- [HDA_PARAM_SUB_NODE_COUNT] = 0x00020004, /* 4 Subnodes, StartNid = 2 */
- [HDA_PARAM_FCT_GRP_TYPE] = HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO,
- [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x1f << 16) | 0x7ff, /* B8 - B32, 8.0 - 192.0kHz */
- [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM,
- [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */
- [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */
- [HDA_PARAM_GPIO_COUNT] = 0x00,
- },
- [HDA_CODEC_AUDIO_OUTPUT_NID] = {
- [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_OUTPUT |
- HDA_CODEC_AUDIO_WCAP_FORMAT_OVR |
- HDA_CODEC_AUDIO_WCAP_AMP_OVR |
- HDA_CODEC_AUDIO_WCAP_OUT_AMP |
- HDA_CODEC_AUDIO_WCAP_STEREO,
- [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, /* B16, 16.0 - 192.0kHz */
- [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM,
- [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */
- [HDA_PARAM_CONN_LIST_LENGTH] = 0x00,
- [HDA_PARAM_OUTPUT_AMP_CAP] = HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP |
- HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE |
- HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS |
- HDA_CODEC_OUTPUT_AMP_CAP_OFFSET,
- },
- [HDA_CODEC_PIN_OUTPUT_NID] = {
- [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_PIN |
- HDA_CODEC_AUDIO_WCAP_CONN_LIST |
- HDA_CODEC_AUDIO_WCAP_STEREO,
- [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_OUTPUT |
- HDA_CODEC_PIN_CAP_PRESENCE_DETECT,
- [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */
- [HDA_PARAM_CONN_LIST_LENGTH] = 0x01,
- [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */
- },
- [HDA_CODEC_AUDIO_INPUT_NID] = {
- [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_INPUT |
- HDA_CODEC_AUDIO_WCAP_CONN_LIST |
- HDA_CODEC_AUDIO_WCAP_FORMAT_OVR |
- HDA_CODEC_AUDIO_WCAP_AMP_OVR |
- HDA_CODEC_AUDIO_WCAP_IN_AMP |
- HDA_CODEC_AUDIO_WCAP_STEREO,
- [HDA_PARAM_SUPP_PCM_SIZE_RATE] = (0x02 << 16) | 0x7fc, /* B16, 16.0 - 192.0kHz */
- [HDA_PARAM_SUPP_STREAM_FORMATS] = HDA_CODEC_SUPP_STREAM_FORMATS_PCM,
- [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */
- [HDA_PARAM_CONN_LIST_LENGTH] = 0x01,
- [HDA_PARAM_INPUT_AMP_CAP] = HDA_CODEC_OUTPUT_AMP_CAP_MUTE_CAP |
- HDA_CODEC_OUTPUT_AMP_CAP_STEPSIZE |
- HDA_CODEC_OUTPUT_AMP_CAP_NUMSTEPS |
- HDA_CODEC_OUTPUT_AMP_CAP_OFFSET,
- },
- [HDA_CODEC_PIN_INPUT_NID] = {
- [HDA_PARAM_AUDIO_WIDGET_CAP] = HDA_CODEC_AUDIO_WCAP_PIN |
- HDA_CODEC_AUDIO_WCAP_STEREO,
- [HDA_PARAM_PIN_CAP] = HDA_CODEC_PIN_CAP_INPUT |
- HDA_CODEC_PIN_CAP_PRESENCE_DETECT,
- [HDA_PARAM_INPUT_AMP_CAP] = 0x00, /* None */
- [HDA_PARAM_OUTPUT_AMP_CAP] = 0x00, /* None */
- },
+ HDA_CODEC_ROOT_DESC
+ HDA_CODEC_FG_DUPLEX_DESC
+ HDA_CODEC_OUTPUT_DESC
+ HDA_CODEC_INPUT_DESC
};
#define HDA_CODEC_NODES_COUNT (ARRAY_SIZE(hda_codec_parameters))
More information about the svn-soc-all
mailing list