aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/skylake/nhlt/max98357.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-06-28 15:00:30 -0500
committerAaron Durbin <adurbin@chromium.org>2016-06-29 23:15:29 +0200
commite9657bc8dc6dc94216fcbbc9b83c12b210c32be9 (patch)
treebfdd123492d1f2287299e0542ab80bb97e624998 /src/soc/intel/skylake/nhlt/max98357.c
parent5e0a9c7436f77a4e488d77c80fba38cd00b67e67 (diff)
soc/intel/skylake: refactor nhlt support
Utilize the new NHLT helper functions by driving the NHLT endpoints through data descriptors. Change-Id: I80838214d3615b83d4939ec2d96a4fd7050d5920 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/15488 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/soc/intel/skylake/nhlt/max98357.c')
-rw-r--r--src/soc/intel/skylake/nhlt/max98357.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/soc/intel/skylake/nhlt/max98357.c b/src/soc/intel/skylake/nhlt/max98357.c
index fa14dd2f61..b2abc26cea 100644
--- a/src/soc/intel/skylake/nhlt/max98357.c
+++ b/src/soc/intel/skylake/nhlt/max98357.c
@@ -15,7 +15,7 @@
#include <soc/nhlt.h>
-static const struct nhlt_format_config max98357_render_cfg[] = {
+static const struct nhlt_format_config max98357_render_formats[] = {
/* 48 KHz 24-bits per sample. */
{
.num_channels = 2,
@@ -27,22 +27,21 @@ static const struct nhlt_format_config max98357_render_cfg[] = {
},
};
+static const struct nhlt_endp_descriptor max98357_descriptors[] = {
+ {
+ .link = NHLT_LINK_SSP,
+ .device = NHLT_SSP_DEV_I2S,
+ .direction = NHLT_DIR_RENDER,
+ .vid = NHLT_VID,
+ .did = NHLT_DID_SSP,
+ .formats = max98357_render_formats,
+ .num_formats = ARRAY_SIZE(max98357_render_formats),
+ },
+};
+
int nhlt_soc_add_max98357(struct nhlt *nhlt, int hwlink)
{
- struct nhlt_endpoint *endp;
-
- /* Render Endpoint */
- endp = nhlt_soc_add_endpoint(nhlt, hwlink, AUDIO_DEV_I2S,
- NHLT_DIR_RENDER);
-
- if (endp == NULL)
- return -1;
-
- if (nhlt_endpoint_add_formats(endp, max98357_render_cfg,
- ARRAY_SIZE(max98357_render_cfg)))
- return -1;
-
- nhlt_next_instance(nhlt, NHLT_LINK_SSP);
-
- return 0;
+ /* Virtual bus id of SSP links are the hardware port ids proper. */
+ return nhlt_add_ssp_endpoints(nhlt, hwlink, max98357_descriptors,
+ ARRAY_SIZE(max98357_descriptors));
}