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

TOMOYO Linux Cross Reference
Linux/sound/soc/qcom/lpass-ipq806x.c

Version: ~ [ linux-5.9-rc6 ] ~ [ linux-5.8.10 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.66 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.146 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.198 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.236 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.236 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
  4  *
  5  * lpass-ipq806x.c -- ALSA SoC CPU DAI driver for QTi LPASS
  6  * Splited out the IPQ8064 soc specific from lpass-cpu.c
  7  */
  8 
  9 #include <linux/clk.h>
 10 #include <linux/device.h>
 11 #include <linux/err.h>
 12 #include <linux/kernel.h>
 13 #include <linux/module.h>
 14 #include <linux/of.h>
 15 #include <linux/platform_device.h>
 16 #include <sound/pcm.h>
 17 #include <sound/soc.h>
 18 #include <sound/soc-dai.h>
 19 
 20 #include "lpass-lpaif-reg.h"
 21 #include "lpass.h"
 22 
 23 enum lpaif_i2s_ports {
 24         IPQ806X_LPAIF_I2S_PORT_CODEC_SPK,
 25         IPQ806X_LPAIF_I2S_PORT_CODEC_MIC,
 26         IPQ806X_LPAIF_I2S_PORT_SEC_SPK,
 27         IPQ806X_LPAIF_I2S_PORT_SEC_MIC,
 28         IPQ806X_LPAIF_I2S_PORT_MI2S,
 29 };
 30 
 31 enum lpaif_dma_channels {
 32         IPQ806X_LPAIF_RDMA_CHAN_MI2S,
 33         IPQ806X_LPAIF_RDMA_CHAN_PCM0,
 34         IPQ806X_LPAIF_RDMA_CHAN_PCM1,
 35 };
 36 
 37 static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = {
 38         .id     = IPQ806X_LPAIF_I2S_PORT_MI2S,
 39         .playback = {
 40                 .stream_name    = "lpass-cpu-playback",
 41                 .formats        = SNDRV_PCM_FMTBIT_S16 |
 42                                         SNDRV_PCM_FMTBIT_S24 |
 43                                         SNDRV_PCM_FMTBIT_S32,
 44                 .rates          = SNDRV_PCM_RATE_8000 |
 45                                         SNDRV_PCM_RATE_16000 |
 46                                         SNDRV_PCM_RATE_32000 |
 47                                         SNDRV_PCM_RATE_48000 |
 48                                         SNDRV_PCM_RATE_96000,
 49                 .rate_min       = 8000,
 50                 .rate_max       = 96000,
 51                 .channels_min   = 1,
 52                 .channels_max   = 8,
 53         },
 54         .probe  = &asoc_qcom_lpass_cpu_dai_probe,
 55         .ops    = &asoc_qcom_lpass_cpu_dai_ops,
 56 };
 57 
 58 static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir)
 59 {
 60         if (dir == SNDRV_PCM_STREAM_PLAYBACK)
 61                 return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
 62         else    /* Capture currently not implemented */
 63                 return -EINVAL;
 64 }
 65 
 66 static int ipq806x_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
 67 {
 68         return 0;
 69 }
 70 
 71 static struct lpass_variant ipq806x_data = {
 72         .i2sctrl_reg_base       = 0x0010,
 73         .i2sctrl_reg_stride     = 0x04,
 74         .i2s_ports              = 5,
 75         .irq_reg_base           = 0x3000,
 76         .irq_reg_stride         = 0x1000,
 77         .irq_ports              = 3,
 78         .rdma_reg_base          = 0x6000,
 79         .rdma_reg_stride        = 0x1000,
 80         .rdma_channels          = 4,
 81         .wrdma_reg_base         = 0xB000,
 82         .wrdma_reg_stride       = 0x1000,
 83         .wrdma_channel_start    = 5,
 84         .wrdma_channels         = 4,
 85         .dai_driver             = &ipq806x_lpass_cpu_dai_driver,
 86         .num_dai                = 1,
 87         .dai_osr_clk_names      = (const char *[]) {
 88                                 "mi2s-osr-clk",
 89                                 },
 90         .dai_bit_clk_names      = (const char *[]) {
 91                                 "mi2s-bit-clk",
 92                                 },
 93         .alloc_dma_channel      = ipq806x_lpass_alloc_dma_channel,
 94         .free_dma_channel       = ipq806x_lpass_free_dma_channel,
 95 };
 96 
 97 static const struct of_device_id ipq806x_lpass_cpu_device_id[] = {
 98         { .compatible = "qcom,lpass-cpu", .data = &ipq806x_data },
 99         {}
100 };
101 MODULE_DEVICE_TABLE(of, ipq806x_lpass_cpu_device_id);
102 
103 static struct platform_driver ipq806x_lpass_cpu_platform_driver = {
104         .driver = {
105                 .name           = "lpass-cpu",
106                 .of_match_table = of_match_ptr(ipq806x_lpass_cpu_device_id),
107         },
108         .probe  = asoc_qcom_lpass_cpu_platform_probe,
109         .remove = asoc_qcom_lpass_cpu_platform_remove,
110 };
111 module_platform_driver(ipq806x_lpass_cpu_platform_driver);
112 
113 MODULE_DESCRIPTION("QTi LPASS CPU Driver");
114 MODULE_LICENSE("GPL v2");
115 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp