]> git.karo-electronics.de Git - mv-sheeva.git/blob - sound/soc/s3c24xx/s3c-i2s-v2.h
Merge commit 'v2.6.34-rc1' into for-2.6.35
[mv-sheeva.git] / sound / soc / s3c24xx / s3c-i2s-v2.h
1 /* sound/soc/s3c24xx/s3c-i2s-v2.h
2  *
3  * ALSA Soc Audio Layer - S3C_I2SV2 I2S driver
4  *
5  * Copyright (c) 2007 Simtec Electronics
6  *      http://armlinux.simtec.co.uk/
7  *      Ben Dooks <ben@simtec.co.uk>
8  *
9  *  This program is free software; you can redistribute  it and/or modify it
10  *  under  the terms of  the GNU General  Public License as published by the
11  *  Free Software Foundation;  either version 2 of the  License, or (at your
12  *  option) any later version.
13 */
14
15 /* This code is the core support for the I2S block found in a number of
16  * Samsung SoC devices which is unofficially named I2S-V2. Currently the
17  * S3C2412 and the S3C64XX series use this block to provide 1 or 2 I2S
18  * channels via configurable GPIO.
19  */
20
21 #ifndef __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H
22 #define __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H __FILE__
23
24 #define S3C_I2SV2_DIV_BCLK      (1)
25 #define S3C_I2SV2_DIV_RCLK      (2)
26 #define S3C_I2SV2_DIV_PRESCALER (3)
27
28 #define S3C_I2SV2_CLKSRC_PCLK           0
29 #define S3C_I2SV2_CLKSRC_AUDIOBUS       1
30 #define S3C_I2SV2_CLKSRC_CDCLK          2
31
32 /**
33  * struct s3c_i2sv2_info - S3C I2S-V2 information
34  * @dev: The parent device passed to use from the probe.
35  * @regs: The pointer to the device registe block.
36  * @master: True if the I2S core is the I2S bit clock master.
37  * @dma_playback: DMA information for playback channel.
38  * @dma_capture: DMA information for capture channel.
39  * @suspend_iismod: PM save for the IISMOD register.
40  * @suspend_iiscon: PM save for the IISCON register.
41  * @suspend_iispsr: PM save for the IISPSR register.
42  *
43  * This is the private codec state for the hardware associated with an
44  * I2S channel such as the register mappings and clock sources.
45  */
46 struct s3c_i2sv2_info {
47         struct device   *dev;
48         void __iomem    *regs;
49
50         struct clk      *iis_pclk;
51         struct clk      *iis_cclk;
52         struct clk      *iis_clk;
53
54         unsigned char    master;
55
56         struct s3c_dma_params   *dma_playback;
57         struct s3c_dma_params   *dma_capture;
58
59         u32              suspend_iismod;
60         u32              suspend_iiscon;
61         u32              suspend_iispsr;
62 };
63
64 struct s3c_i2sv2_rate_calc {
65         unsigned int    clk_div;        /* for prescaler */
66         unsigned int    fs_div;         /* for root frame clock */
67 };
68
69 extern int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info,
70                                    unsigned int *fstab,
71                                    unsigned int rate, struct clk *clk);
72
73 /**
74  * s3c_i2sv2_probe - probe for i2s device helper
75  * @pdev: The platform device supplied to the original probe.
76  * @dai: The ASoC DAI structure supplied to the original probe.
77  * @i2s: Our local i2s structure to fill in.
78  * @base: The base address for the registers.
79  */
80 extern int s3c_i2sv2_probe(struct platform_device *pdev,
81                            struct snd_soc_dai *dai,
82                            struct s3c_i2sv2_info *i2s,
83                            unsigned long base);
84
85 /**
86  * s3c_i2sv2_register_dai - register dai with soc core
87  * @dai: The snd_soc_dai structure to register
88  *
89  * Fill in any missing fields and then register the given dai with the
90  * soc core.
91  */
92 extern int s3c_i2sv2_register_dai(struct snd_soc_dai *dai);
93
94 #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */