Skip to content

Commit da863e7

Browse files
committed
Add SDCA DAI ops helpers
Merge series from Charles Keepax <[email protected]>: First, a couple of minor code fixups to already submitted code. Then some patches to add new DAI ops helpers for the SDCA stuff, these allow configuring things like the sample rate and finding out which SoundWire port should be used for a specific SDCA streaming input/output terminal. Still a few bits of outstanding work here (propogation of Cluster information particularly) but his should be good enough to get some basic use-cases working. Hopefully we are getting fairly close to completing a first version of the SDCA work now. Should be one more series to add FDL (firmware downloading), then we should be able to send a first version of the actual SDCA class driver itself.
2 parents 03aa2ed + 4ed357f commit da863e7

File tree

5 files changed

+490
-62
lines changed

5 files changed

+490
-62
lines changed

include/sound/sdca_asoc.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@
1111
#define __SDCA_ASOC_H__
1212

1313
struct device;
14+
struct regmap;
1415
struct sdca_function_data;
1516
struct snd_kcontrol_new;
17+
struct snd_pcm_hw_params;
18+
struct snd_pcm_substream;
1619
struct snd_soc_component_driver;
20+
struct snd_soc_dai;
1721
struct snd_soc_dai_driver;
1822
struct snd_soc_dai_ops;
1923
struct snd_soc_dapm_route;
@@ -39,4 +43,19 @@ int sdca_asoc_populate_component(struct device *dev,
3943
struct snd_soc_dai_driver **dai_drv, int *num_dai_drv,
4044
const struct snd_soc_dai_ops *ops);
4145

46+
int sdca_asoc_set_constraints(struct device *dev, struct regmap *regmap,
47+
struct sdca_function_data *function,
48+
struct snd_pcm_substream *substream,
49+
struct snd_soc_dai *dai);
50+
void sdca_asoc_free_constraints(struct snd_pcm_substream *substream,
51+
struct snd_soc_dai *dai);
52+
int sdca_asoc_get_port(struct device *dev, struct regmap *regmap,
53+
struct sdca_function_data *function,
54+
struct snd_soc_dai *dai);
55+
int sdca_asoc_hw_params(struct device *dev, struct regmap *regmap,
56+
struct sdca_function_data *function,
57+
struct snd_pcm_substream *substream,
58+
struct snd_pcm_hw_params *params,
59+
struct snd_soc_dai *dai);
60+
4261
#endif // __SDCA_ASOC_H__

include/sound/sdca_function.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,14 @@ enum sdca_usage_range {
185185
SDCA_USAGE_NCOLS = 7,
186186
};
187187

188+
/**
189+
* enum sdca_dataport_selector_range - Column definitions for DataPort_Selector
190+
*/
191+
enum sdca_dataport_selector_range {
192+
SDCA_DATAPORT_SELECTOR_NCOLS = 16,
193+
SDCA_DATAPORT_SELECTOR_NROWS = 4,
194+
};
195+
188196
/**
189197
* enum sdca_mu_controls - SDCA Controls for Mixer Unit
190198
*
@@ -1268,6 +1276,15 @@ struct sdca_cluster {
12681276
struct sdca_channel *channels;
12691277
};
12701278

1279+
/**
1280+
* enum sdca_cluster_range - SDCA Range column definitions for ClusterIndex
1281+
*/
1282+
enum sdca_cluster_range {
1283+
SDCA_CLUSTER_BYTEINDEX = 0,
1284+
SDCA_CLUSTER_CLUSTERID = 1,
1285+
SDCA_CLUSTER_NCOLS = 2,
1286+
};
1287+
12711288
/**
12721289
* struct sdca_function_data - top-level information for one SDCA function
12731290
* @desc: Pointer to short descriptor from initial parsing.
@@ -1316,4 +1333,18 @@ int sdca_parse_function(struct device *dev,
13161333
struct sdca_function_desc *desc,
13171334
struct sdca_function_data *function);
13181335

1336+
struct sdca_control *sdca_selector_find_control(struct device *dev,
1337+
struct sdca_entity *entity,
1338+
const int sel);
1339+
struct sdca_control_range *sdca_control_find_range(struct device *dev,
1340+
struct sdca_entity *entity,
1341+
struct sdca_control *control,
1342+
int cols, int rows);
1343+
struct sdca_control_range *sdca_selector_find_range(struct device *dev,
1344+
struct sdca_entity *entity,
1345+
int sel, int cols, int rows);
1346+
struct sdca_cluster *sdca_id_find_cluster(struct device *dev,
1347+
struct sdca_function_data *function,
1348+
const int id);
1349+
13191350
#endif

include/sound/soc-dai.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ struct snd_soc_dai {
463463

464464
/* bit field */
465465
unsigned int probed:1;
466+
467+
/* DAI private data */
468+
void *priv;
466469
};
467470

468471
static inline const struct snd_soc_pcm_stream *

0 commit comments

Comments
 (0)