lkml.org 
[lkml]   [2020]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 5/8] media: adv748x: add an ASoC DAI definition to the driver
The definition is used to publish hardware constraints and can be used
to implement in-demand device configuration.

Signed-off-by: Alexander Riesen <alexander.riesen@cetitec.com>
---
drivers/media/i2c/adv748x/adv748x-core.c | 33 ++++++++++++++++++++++++
1 file changed, 33 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
index b6067ffb1e0d..75e4bf144ad7 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -25,6 +25,7 @@
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-ioctl.h>
+#include <sound/soc.h>

#include "adv748x.h"

@@ -689,6 +690,30 @@ static void adv748x_dt_cleanup(struct adv748x_state *state)
of_node_put(state->endpoints[i]);
}

+static struct snd_soc_dai_driver adv748x_dai = {
+ .name = "adv748x-i2s",
+ .capture = {
+ .stream_name = "Capture",
+ .channels_min = 8,
+ .channels_max = 8,
+ .rates = SNDRV_PCM_RATE_48000,
+ .formats = SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_U24_LE,
+ },
+};
+
+static int adv748x_of_xlate_dai_name(struct snd_soc_component *component,
+ struct of_phandle_args *args,
+ const char **dai_name)
+{
+ if (dai_name)
+ *dai_name = adv748x_dai.name;
+ return 0;
+}
+
+static const struct snd_soc_component_driver adv748x_codec = {
+ .of_xlate_dai_name = adv748x_of_xlate_dai_name,
+};
+
static int adv748x_probe(struct i2c_client *client)
{
struct adv748x_state *state;
@@ -782,8 +807,16 @@ static int adv748x_probe(struct i2c_client *client)
goto err_cleanup_txa;
}

+ ret = devm_snd_soc_register_component(state->dev, &adv748x_codec,
+ &adv748x_dai, 1);
+ if (ret < 0) {
+ adv_err(state, "Failed to register the codec");
+ goto err_cleanup_txb;
+ }
return 0;

+err_cleanup_txb:
+ adv748x_csi2_cleanup(&state->txb);
err_cleanup_txa:
adv748x_csi2_cleanup(&state->txa);
err_cleanup_afe:
--
2.24.1.508.g91d2dafee0
\
 
 \ /
  Last update: 2020-01-13 15:16    [W:0.088 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site