1 From e28e3e0d01c0fcb628e841977b51c45189b43f47 Mon Sep 17 00:00:00 2001
2 From: Viorel Suman <viorel.suman@nxp.com>
3 Date: Thu, 8 Mar 2018 14:37:30 +0200
4 Subject: [PATCH] MLK-17580: ASoC: fsl: dsd: Add DSD utilities helper
6 Add DSD utilities helper.
8 Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
9 Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com
11 sound/soc/fsl/fsl_dsd.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
12 1 file changed, 59 insertions(+)
13 create mode 100644 sound/soc/fsl/fsl_dsd.h
16 +++ b/sound/soc/fsl/fsl_dsd.h
19 + * Copyright 2018 NXP
21 + * This program is free software; you can redistribute it and/or modify
22 + * it under the terms of the GNU General Public License version 2 as
23 + * published by the Free Software Foundation.
29 +#include <linux/pinctrl/consumer.h>
30 +#include <sound/pcm_params.h>
31 +#include <sound/soc.h>
33 +static bool fsl_is_dsd(struct snd_pcm_hw_params *params)
35 + snd_pcm_format_t format = params_format(params);
38 + case SNDRV_PCM_FORMAT_DSD_U8:
39 + case SNDRV_PCM_FORMAT_DSD_U16_LE:
40 + case SNDRV_PCM_FORMAT_DSD_U16_BE:
41 + case SNDRV_PCM_FORMAT_DSD_U32_LE:
42 + case SNDRV_PCM_FORMAT_DSD_U32_BE:
49 +static struct pinctrl_state *fsl_get_pins_state(struct pinctrl *pinctrl,
50 + struct snd_pcm_hw_params *params)
53 + struct pinctrl_state *state = 0;
55 + if (fsl_is_dsd(params)) {
56 + dsd_bclk = params_rate(params) * params_physical_width(params);
59 + case 22579200: /* DSD512 */
60 + state = pinctrl_lookup_state(pinctrl, "dsd512");
64 + /* Get default DSD state */
65 + if (IS_ERR_OR_NULL(state))
66 + state = pinctrl_lookup_state(pinctrl, "dsd");
69 + /* Get default state */
70 + if (IS_ERR_OR_NULL(state))
71 + state = pinctrl_lookup_state(pinctrl, "default");
76 +#endif /* __FSL_DSD_H */