~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/sound/sdw.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0
  2  *
  3  * linux/sound/sdw.h -- SoundWire helpers for ALSA/ASoC
  4  *
  5  * Copyright (c) 2022 Cirrus Logic Inc.
  6  *
  7  * Author: Charles Keepax <ckeepax@opensource.cirrus.com>
  8  */
  9 
 10 #include <linux/soundwire/sdw.h>
 11 #include <sound/asound.h>
 12 #include <sound/pcm.h>
 13 #include <sound/pcm_params.h>
 14 
 15 #ifndef __INCLUDE_SOUND_SDW_H
 16 #define __INCLUDE_SOUND_SDW_H
 17 
 18 /**
 19  * snd_sdw_params_to_config() - Conversion from hw_params to SoundWire config
 20  *
 21  * @substream: Pointer to the PCM substream structure
 22  * @params: Pointer to the hardware params structure
 23  * @stream_config: Stream configuration for the SoundWire audio stream
 24  * @port_config: Port configuration for the SoundWire audio stream
 25  *
 26  * This function provides a basic conversion from the hw_params structure to
 27  * SoundWire configuration structures. The user will at a minimum need to also
 28  * set the port number in the port config, but may also override more of the
 29  * setup, or in the case of a complex user, not use this helper at all and
 30  * open-code everything.
 31  */
 32 static inline void snd_sdw_params_to_config(struct snd_pcm_substream *substream,
 33                                             struct snd_pcm_hw_params *params,
 34                                             struct sdw_stream_config *stream_config,
 35                                             struct sdw_port_config *port_config)
 36 {
 37         stream_config->frame_rate = params_rate(params);
 38         stream_config->ch_count = params_channels(params);
 39         stream_config->bps = snd_pcm_format_width(params_format(params));
 40 
 41         if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
 42                 stream_config->direction = SDW_DATA_DIR_RX;
 43         else
 44                 stream_config->direction = SDW_DATA_DIR_TX;
 45 
 46         port_config->ch_mask = GENMASK(stream_config->ch_count - 1, 0);
 47 }
 48 
 49 #endif
 50 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php