p1022_ds.c (1ac731c529cd4d6adbce134754b51ff7d822b145) p1022_ds.c (14ec63f678e8beaaa1005ccae6c112bf672ba2b3)
1// SPDX-License-Identifier: GPL-2.0
2//
3// Freescale P1022DS ALSA SoC Machine driver
4//
5// Author: Timur Tabi <timur@freescale.com>
6//
7// Copyright 2010 Freescale Semiconductor, Inc.
8

--- 107 unchanged lines hidden (view full) ---

116 * p1022_ds_startup: program the board with various hardware parameters
117 *
118 * This function takes board-specific information, like clock frequencies
119 * and serial data formats, and passes that information to the codec and
120 * transport drivers.
121 */
122static int p1022_ds_startup(struct snd_pcm_substream *substream)
123{
1// SPDX-License-Identifier: GPL-2.0
2//
3// Freescale P1022DS ALSA SoC Machine driver
4//
5// Author: Timur Tabi <timur@freescale.com>
6//
7// Copyright 2010 Freescale Semiconductor, Inc.
8

--- 107 unchanged lines hidden (view full) ---

116 * p1022_ds_startup: program the board with various hardware parameters
117 *
118 * This function takes board-specific information, like clock frequencies
119 * and serial data formats, and passes that information to the codec and
120 * transport drivers.
121 */
122static int p1022_ds_startup(struct snd_pcm_substream *substream)
123{
124 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
124 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
125 struct machine_data *mdata =
126 container_of(rtd->card, struct machine_data, card);
127 struct device *dev = rtd->card->dev;
128 int ret = 0;
129
130 /* Tell the codec driver what the serial protocol is. */
125 struct machine_data *mdata =
126 container_of(rtd->card, struct machine_data, card);
127 struct device *dev = rtd->card->dev;
128 int ret = 0;
129
130 /* Tell the codec driver what the serial protocol is. */
131 ret = snd_soc_dai_set_fmt(asoc_rtd_to_codec(rtd, 0), mdata->dai_format);
131 ret = snd_soc_dai_set_fmt(snd_soc_rtd_to_codec(rtd, 0), mdata->dai_format);
132 if (ret < 0) {
133 dev_err(dev, "could not set codec driver audio format\n");
134 return ret;
135 }
136
137 /*
138 * Tell the codec driver what the MCLK frequency is, and whether it's
139 * a slave or master.
140 */
132 if (ret < 0) {
133 dev_err(dev, "could not set codec driver audio format\n");
134 return ret;
135 }
136
137 /*
138 * Tell the codec driver what the MCLK frequency is, and whether it's
139 * a slave or master.
140 */
141 ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0), 0, mdata->clk_frequency,
141 ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0), 0, mdata->clk_frequency,
142 mdata->codec_clk_direction);
143 if (ret < 0) {
144 dev_err(dev, "could not set codec driver clock params\n");
145 return ret;
146 }
147
148 return 0;
149}

--- 310 unchanged lines hidden ---
142 mdata->codec_clk_direction);
143 if (ret < 0) {
144 dev_err(dev, "could not set codec driver clock params\n");
145 return ret;
146 }
147
148 return 0;
149}

--- 310 unchanged lines hidden ---