[PATCH v3 06/13] ASoC: simple-card-utils: Expose new members for asoc_simple_priv

From: Sameer Pujar
Date: Thu Oct 01 2020 - 13:34:32 EST


Add new members in struct 'asoc_simple_priv'. Idea is to leverage
simple or graph card driver as much as possible and vendor can
maintain a thin driver to control the behavior by populating these
newly exposed members.

Following are the members added in 'asoc_simple_priv':

- 'ops' struct: In some cases SoC vendor drivers may want to
implement 'snd_soc_ops' callbacks differently. In such cases
custom callbacks would be used.

- 'force_dpcm' flag: Right now simple or graph card drivers
detect DAI links as DPCM links if:

* The dpcm_selectable is set AND
* Codec is connected to multiple CPU endpoints or aconvert
property is used for rate/channels.

So there is no way to directly specify usage of DPCM alone. So a
flag is exposed to mark all links as DPCM. Vendor driver can
set this if required.

- 'dpcm_selectable': Currently simple or audio graph drivers
provide a way to enable this for specific compatibles. However
vendor driver may want to define some additional info. Thus
expose this variable where vendor drivers can set this if
required.

- 'data': A void pointer member is provided. This would be useful
when vendor driver wants to define its own structure for internal
usage and still wants to rely on most of the other members from
'asoc_simple_priv'.

Subsequent patches in the series illustrate usage for above.

Signed-off-by: Sameer Pujar <spujar@xxxxxxxxxx>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>
---
include/sound/simple_card_utils.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index 86a1e95..9825308 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -56,6 +56,10 @@ struct asoc_simple_priv {
struct asoc_simple_dai *dais;
struct snd_soc_codec_conf *codec_conf;
struct gpio_desc *pa_gpio;
+ const struct snd_soc_ops *ops;
+ unsigned int force_dpcm:1;
+ uintptr_t dpcm_selectable;
+ void *data;
};
#define simple_priv_to_card(priv) (&(priv)->snd_card)
#define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
--
2.7.4