Lines Matching +full:clock +full:- +full:source

1 // SPDX-License-Identifier: GPL-2.0-only
3 * fireworks_command.c - a part of driver for Fireworks based devices
5 * Copyright (c) 2013-2014 Takashi Sakamoto
27 /* for clock source and sampling rate */
29 u32 source; member
90 [EFR_STATUS_BAD_CLOCK] = "bad clock",
119 return -ENOMEM; in efw_transaction()
122 spin_lock(&efw->lock); in efw_transaction()
123 if ((efw->seqnum < KERNEL_SEQNUM_MIN) || in efw_transaction()
124 (efw->seqnum >= KERNEL_SEQNUM_MAX - 2)) in efw_transaction()
125 efw->seqnum = KERNEL_SEQNUM_MIN; in efw_transaction()
127 efw->seqnum += 2; in efw_transaction()
128 seqnum = efw->seqnum; in efw_transaction()
129 spin_unlock(&efw->lock); in efw_transaction()
134 header->length = cpu_to_be32(cmd_bytes / sizeof(__be32)); in efw_transaction()
135 header->version = cpu_to_be32(1); in efw_transaction()
136 header->seqnum = cpu_to_be32(seqnum); in efw_transaction()
137 header->category = cpu_to_be32(category); in efw_transaction()
138 header->command = cpu_to_be32(command); in efw_transaction()
139 header->status = 0; in efw_transaction()
142 memcpy(header->params, params, param_bytes); in efw_transaction()
144 err = snd_efw_transaction_run(efw->unit, buf, cmd_bytes, in efw_transaction()
150 if ((be32_to_cpu(header->version) < 1) || in efw_transaction()
151 (be32_to_cpu(header->category) != category) || in efw_transaction()
152 (be32_to_cpu(header->command) != command) || in efw_transaction()
153 (be32_to_cpu(header->status) != EFR_STATUS_OK)) { in efw_transaction()
154 dev_err(&efw->unit->device, "EFW command failed [%u/%u]: %s\n", in efw_transaction()
155 be32_to_cpu(header->category), in efw_transaction()
156 be32_to_cpu(header->command), in efw_transaction()
157 efr_status_names[be32_to_cpu(header->status)]); in efw_transaction()
158 err = -EIO; in efw_transaction()
168 be32_to_cpu(header->length) * sizeof(__be32) - in efw_transaction()
189 if (!efw->resp_addr_changable) in snd_efw_command_set_resp_addr()
190 return -ENOSYS; in snd_efw_command_set_resp_addr()
222 be32_to_cpus(&hwinfo->flags); in snd_efw_command_get_hwinfo()
223 be32_to_cpus(&hwinfo->guid_hi); in snd_efw_command_get_hwinfo()
224 be32_to_cpus(&hwinfo->guid_lo); in snd_efw_command_get_hwinfo()
225 be32_to_cpus(&hwinfo->type); in snd_efw_command_get_hwinfo()
226 be32_to_cpus(&hwinfo->version); in snd_efw_command_get_hwinfo()
227 be32_to_cpus(&hwinfo->supported_clocks); in snd_efw_command_get_hwinfo()
228 be32_to_cpus(&hwinfo->amdtp_rx_pcm_channels); in snd_efw_command_get_hwinfo()
229 be32_to_cpus(&hwinfo->amdtp_tx_pcm_channels); in snd_efw_command_get_hwinfo()
230 be32_to_cpus(&hwinfo->phys_out); in snd_efw_command_get_hwinfo()
231 be32_to_cpus(&hwinfo->phys_in); in snd_efw_command_get_hwinfo()
232 be32_to_cpus(&hwinfo->phys_out_grp_count); in snd_efw_command_get_hwinfo()
233 be32_to_cpus(&hwinfo->phys_in_grp_count); in snd_efw_command_get_hwinfo()
234 be32_to_cpus(&hwinfo->midi_out_ports); in snd_efw_command_get_hwinfo()
235 be32_to_cpus(&hwinfo->midi_in_ports); in snd_efw_command_get_hwinfo()
236 be32_to_cpus(&hwinfo->max_sample_rate); in snd_efw_command_get_hwinfo()
237 be32_to_cpus(&hwinfo->min_sample_rate); in snd_efw_command_get_hwinfo()
238 be32_to_cpus(&hwinfo->dsp_version); in snd_efw_command_get_hwinfo()
239 be32_to_cpus(&hwinfo->arm_version); in snd_efw_command_get_hwinfo()
240 be32_to_cpus(&hwinfo->mixer_playback_channels); in snd_efw_command_get_hwinfo()
241 be32_to_cpus(&hwinfo->mixer_capture_channels); in snd_efw_command_get_hwinfo()
242 be32_to_cpus(&hwinfo->fpga_version); in snd_efw_command_get_hwinfo()
243 be32_to_cpus(&hwinfo->amdtp_rx_pcm_channels_2x); in snd_efw_command_get_hwinfo()
244 be32_to_cpus(&hwinfo->amdtp_tx_pcm_channels_2x); in snd_efw_command_get_hwinfo()
245 be32_to_cpus(&hwinfo->amdtp_rx_pcm_channels_4x); in snd_efw_command_get_hwinfo()
246 be32_to_cpus(&hwinfo->amdtp_tx_pcm_channels_4x); in snd_efw_command_get_hwinfo()
249 hwinfo->vendor_name[HWINFO_NAME_SIZE_BYTES - 1] = '\0'; in snd_efw_command_get_hwinfo()
250 hwinfo->model_name[HWINFO_NAME_SIZE_BYTES - 1] = '\0'; in snd_efw_command_get_hwinfo()
274 command_get_clock(struct snd_efw *efw, struct efc_clock *clock) in command_get_clock() argument
281 (__be32 *)clock, sizeof(struct efc_clock)); in command_get_clock()
283 be32_to_cpus(&clock->source); in command_get_clock()
284 be32_to_cpus(&clock->sampling_rate); in command_get_clock()
285 be32_to_cpus(&clock->index); in command_get_clock()
294 unsigned int source, unsigned int rate) in command_set_clock() argument
296 struct efc_clock clock = {0}; in command_set_clock() local
300 if ((source == UINT_MAX) && (rate == UINT_MAX)) { in command_set_clock()
301 err = -EINVAL; in command_set_clock()
306 err = command_get_clock(efw, &clock); in command_set_clock()
311 if ((clock.source == source) && (clock.sampling_rate == rate)) in command_set_clock()
315 if ((source != UINT_MAX) && (clock.source != source)) in command_set_clock()
316 clock.source = source; in command_set_clock()
317 if ((rate != UINT_MAX) && (clock.sampling_rate != rate)) in command_set_clock()
318 clock.sampling_rate = rate; in command_set_clock()
319 clock.index = 0; in command_set_clock()
321 cpu_to_be32s(&clock.source); in command_set_clock()
322 cpu_to_be32s(&clock.sampling_rate); in command_set_clock()
323 cpu_to_be32s(&clock.index); in command_set_clock()
327 (__be32 *)&clock, sizeof(struct efc_clock), in command_set_clock()
333 * With firmware version 5.8, just after changing clock state, these in command_set_clock()
343 enum snd_efw_clock_source *source) in snd_efw_command_get_clock_source() argument
346 struct efc_clock clock = {0}; in snd_efw_command_get_clock_source() local
348 err = command_get_clock(efw, &clock); in snd_efw_command_get_clock_source()
350 *source = clock.source; in snd_efw_command_get_clock_source()
358 struct efc_clock clock = {0}; in snd_efw_command_get_sampling_rate() local
360 err = command_get_clock(efw, &clock); in snd_efw_command_get_sampling_rate()
362 *rate = clock.sampling_rate; in snd_efw_command_get_sampling_rate()