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

TOMOYO Linux Cross Reference
Linux/sound/soc/codecs/cs42l43-sdw.c

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 // CS42L43 CODEC driver SoundWire handling
  4 //
  5 // Copyright (C) 2022-2023 Cirrus Logic, Inc. and
  6 //                         Cirrus Logic International Semiconductor Ltd.
  7 
  8 #include <linux/errno.h>
  9 #include <linux/mfd/cs42l43.h>
 10 #include <linux/mfd/cs42l43-regs.h>
 11 #include <linux/module.h>
 12 #include <linux/soundwire/sdw.h>
 13 #include <sound/pcm.h>
 14 #include <sound/sdw.h>
 15 #include <sound/soc-component.h>
 16 #include <sound/soc-dai.h>
 17 #include <sound/soc.h>
 18 
 19 #include "cs42l43.h"
 20 
 21 int cs42l43_sdw_add_peripheral(struct snd_pcm_substream *substream,
 22                                struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
 23 {
 24         struct cs42l43_codec *priv = snd_soc_component_get_drvdata(dai->component);
 25         struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
 26         struct sdw_slave *sdw = dev_to_sdw_dev(priv->dev->parent);
 27         struct sdw_stream_config sconfig = {0};
 28         struct sdw_port_config pconfig = {0};
 29         int ret;
 30 
 31         if (!sdw_stream)
 32                 return -EINVAL;
 33 
 34         snd_sdw_params_to_config(substream, params, &sconfig, &pconfig);
 35         pconfig.num = dai->id;
 36 
 37         ret = sdw_stream_add_slave(sdw, &sconfig, &pconfig, 1, sdw_stream);
 38         if (ret) {
 39                 dev_err(priv->dev, "Failed to add sdw stream: %d\n", ret);
 40                 return ret;
 41         }
 42 
 43         return 0;
 44 }
 45 EXPORT_SYMBOL_NS_GPL(cs42l43_sdw_add_peripheral, SND_SOC_CS42L43);
 46 
 47 int cs42l43_sdw_remove_peripheral(struct snd_pcm_substream *substream,
 48                                   struct snd_soc_dai *dai)
 49 {
 50         struct cs42l43_codec *priv = snd_soc_component_get_drvdata(dai->component);
 51         struct sdw_stream_runtime *sdw_stream = snd_soc_dai_get_dma_data(dai, substream);
 52         struct sdw_slave *sdw = dev_to_sdw_dev(priv->dev->parent);
 53 
 54         if (!sdw_stream)
 55                 return -EINVAL;
 56 
 57         return sdw_stream_remove_slave(sdw, sdw_stream);
 58 }
 59 EXPORT_SYMBOL_NS_GPL(cs42l43_sdw_remove_peripheral, SND_SOC_CS42L43);
 60 
 61 int cs42l43_sdw_set_stream(struct snd_soc_dai *dai, void *sdw_stream, int direction)
 62 {
 63         snd_soc_dai_dma_data_set(dai, direction, sdw_stream);
 64 
 65         return 0;
 66 }
 67 EXPORT_SYMBOL_NS_GPL(cs42l43_sdw_set_stream, SND_SOC_CS42L43);
 68 
 69 MODULE_DESCRIPTION("CS42L43 CODEC SoundWire Driver");
 70 MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.cirrus.com>");
 71 MODULE_LICENSE("GPL");
 72 

~ [ 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