Commit b0ae27c4 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/rl6231', 'asoc/topic/rockchip',...

Merge remote-tracking branches 'asoc/topic/rl6231', 'asoc/topic/rockchip', 'asoc/topic/rt286', 'asoc/topic/rt5640' and 'asoc/topic/rt5645' into asoc-next
* Rockchip I2S controller
The I2S bus (Inter-IC sound bus) is a serial link for digital
audio data transfer between devices in the system.
Required properties:
- compatible: should be one of the followings
- "rockchip,rk3066-i2s": for rk3066
- "rockchip,rk3188-i2s", "rockchip,rk3066-i2s": for rk3188
- "rockchip,rk3288-i2s", "rockchip,rk3066-i2s": for rk3288
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: should contain the I2S interrupt.
- #address-cells: should be 1.
- #size-cells: should be 0.
- dmas: DMA specifiers for tx and rx dma. See the DMA client binding,
Documentation/devicetree/bindings/dma/dma.txt
- dma-names: should include "tx" and "rx".
- clocks: a list of phandle + clock-specifer pairs, one for each entry in clock-names.
- clock-names: should contain followings:
- "i2s_hclk": clock for I2S BUS
- "i2s_clk" : clock for I2S controller
Example for rk3288 I2S controller:
i2s@ff890000 {
compatible = "rockchip,rk3288-i2s", "rockchip,rk3066-i2s";
reg = <0xff890000 0x10000>;
interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
dmas = <&pdma1 0>, <&pdma1 1>;
dma-names = "rx", "tx";
clock-names = "i2s_hclk", "i2s_clk";
clocks = <&cru HCLK_I2S0>, <&cru SCLK_I2S0>;
};
...@@ -47,6 +47,7 @@ source "sound/soc/kirkwood/Kconfig" ...@@ -47,6 +47,7 @@ source "sound/soc/kirkwood/Kconfig"
source "sound/soc/intel/Kconfig" source "sound/soc/intel/Kconfig"
source "sound/soc/mxs/Kconfig" source "sound/soc/mxs/Kconfig"
source "sound/soc/pxa/Kconfig" source "sound/soc/pxa/Kconfig"
source "sound/soc/rockchip/Kconfig"
source "sound/soc/samsung/Kconfig" source "sound/soc/samsung/Kconfig"
source "sound/soc/s6000/Kconfig" source "sound/soc/s6000/Kconfig"
source "sound/soc/sh/Kconfig" source "sound/soc/sh/Kconfig"
......
...@@ -24,6 +24,7 @@ obj-$(CONFIG_SND_SOC) += nuc900/ ...@@ -24,6 +24,7 @@ obj-$(CONFIG_SND_SOC) += nuc900/
obj-$(CONFIG_SND_SOC) += omap/ obj-$(CONFIG_SND_SOC) += omap/
obj-$(CONFIG_SND_SOC) += kirkwood/ obj-$(CONFIG_SND_SOC) += kirkwood/
obj-$(CONFIG_SND_SOC) += pxa/ obj-$(CONFIG_SND_SOC) += pxa/
obj-$(CONFIG_SND_SOC) += rockchip/
obj-$(CONFIG_SND_SOC) += samsung/ obj-$(CONFIG_SND_SOC) += samsung/
obj-$(CONFIG_SND_SOC) += s6000/ obj-$(CONFIG_SND_SOC) += s6000/
obj-$(CONFIG_SND_SOC) += sh/ obj-$(CONFIG_SND_SOC) += sh/
......
...@@ -11,25 +11,6 @@ ...@@ -11,25 +11,6 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/acpi.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include "rl6231.h" #include "rl6231.h"
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
struct rt286_priv { struct rt286_priv {
struct regmap *regmap; struct regmap *regmap;
struct snd_soc_codec *codec;
struct rt286_platform_data pdata; struct rt286_platform_data pdata;
struct i2c_client *i2c; struct i2c_client *i2c;
struct snd_soc_jack *jack; struct snd_soc_jack *jack;
...@@ -295,9 +294,8 @@ static int rt286_support_power_controls[] = { ...@@ -295,9 +294,8 @@ static int rt286_support_power_controls[] = {
}; };
#define RT286_POWER_REG_LEN ARRAY_SIZE(rt286_support_power_controls) #define RT286_POWER_REG_LEN ARRAY_SIZE(rt286_support_power_controls)
static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic)
{ {
struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
unsigned int val, buf; unsigned int val, buf;
int i; int i;
...@@ -305,23 +303,23 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) ...@@ -305,23 +303,23 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic)
*mic = false; *mic = false;
if (rt286->pdata.cbj_en) { if (rt286->pdata.cbj_en) {
buf = snd_soc_read(codec, RT286_GET_HP_SENSE); regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf);
*hp = buf & 0x80000000; *hp = buf & 0x80000000;
if (*hp) { if (*hp) {
/* power on HV,VERF */ /* power on HV,VERF */
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_POWER_CTRL1, 0x1001, 0x0); RT286_POWER_CTRL1, 0x1001, 0x0);
/* power LDO1 */ /* power LDO1 */
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_POWER_CTRL2, 0x4, 0x4); RT286_POWER_CTRL2, 0x4, 0x4);
snd_soc_write(codec, RT286_SET_MIC1, 0x24); regmap_write(rt286->regmap, RT286_SET_MIC1, 0x24);
val = snd_soc_read(codec, RT286_CBJ_CTRL2); regmap_read(rt286->regmap, RT286_CBJ_CTRL2, &val);
msleep(200); msleep(200);
i = 40; i = 40;
while (((val & 0x0800) == 0) && (i > 0)) { while (((val & 0x0800) == 0) && (i > 0)) {
val = snd_soc_read(codec, regmap_read(rt286->regmap,
RT286_CBJ_CTRL2); RT286_CBJ_CTRL2, &val);
i--; i--;
msleep(20); msleep(20);
} }
...@@ -329,53 +327,53 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) ...@@ -329,53 +327,53 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic)
if (0x0400 == (val & 0x0700)) { if (0x0400 == (val & 0x0700)) {
*mic = false; *mic = false;
snd_soc_write(codec, regmap_write(rt286->regmap,
RT286_SET_MIC1, 0x20); RT286_SET_MIC1, 0x20);
/* power off HV,VERF */ /* power off HV,VERF */
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_POWER_CTRL1, 0x1001, 0x1001); RT286_POWER_CTRL1, 0x1001, 0x1001);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_A_BIAS_CTRL3, 0xc000, 0x0000); RT286_A_BIAS_CTRL3, 0xc000, 0x0000);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_CBJ_CTRL1, 0x0030, 0x0000); RT286_CBJ_CTRL1, 0x0030, 0x0000);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_A_BIAS_CTRL2, 0xc000, 0x0000); RT286_A_BIAS_CTRL2, 0xc000, 0x0000);
} else if ((0x0200 == (val & 0x0700)) || } else if ((0x0200 == (val & 0x0700)) ||
(0x0100 == (val & 0x0700))) { (0x0100 == (val & 0x0700))) {
*mic = true; *mic = true;
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_A_BIAS_CTRL3, 0xc000, 0x8000); RT286_A_BIAS_CTRL3, 0xc000, 0x8000);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_CBJ_CTRL1, 0x0030, 0x0020); RT286_CBJ_CTRL1, 0x0030, 0x0020);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_A_BIAS_CTRL2, 0xc000, 0x8000); RT286_A_BIAS_CTRL2, 0xc000, 0x8000);
} else { } else {
*mic = false; *mic = false;
} }
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_MISC_CTRL1, RT286_MISC_CTRL1,
0x0060, 0x0000); 0x0060, 0x0000);
} else { } else {
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_MISC_CTRL1, RT286_MISC_CTRL1,
0x0060, 0x0020); 0x0060, 0x0020);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_A_BIAS_CTRL3, RT286_A_BIAS_CTRL3,
0xc000, 0x8000); 0xc000, 0x8000);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_CBJ_CTRL1, RT286_CBJ_CTRL1,
0x0030, 0x0020); 0x0030, 0x0020);
snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap,
RT286_A_BIAS_CTRL2, RT286_A_BIAS_CTRL2,
0xc000, 0x8000); 0xc000, 0x8000);
*mic = false; *mic = false;
} }
} else { } else {
buf = snd_soc_read(codec, RT286_GET_HP_SENSE); regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf);
*hp = buf & 0x80000000; *hp = buf & 0x80000000;
buf = snd_soc_read(codec, RT286_GET_MIC1_SENSE); regmap_read(rt286->regmap, RT286_GET_MIC1_SENSE, &buf);
*mic = buf & 0x80000000; *mic = buf & 0x80000000;
} }
...@@ -390,7 +388,7 @@ static void rt286_jack_detect_work(struct work_struct *work) ...@@ -390,7 +388,7 @@ static void rt286_jack_detect_work(struct work_struct *work)
bool hp = false; bool hp = false;
bool mic = false; bool mic = false;
rt286_jack_detect(rt286->codec, &hp, &mic); rt286_jack_detect(rt286, &hp, &mic);
if (hp == true) if (hp == true)
status |= SND_JACK_HEADPHONE; status |= SND_JACK_HEADPHONE;
...@@ -940,11 +938,10 @@ static irqreturn_t rt286_irq(int irq, void *data) ...@@ -940,11 +938,10 @@ static irqreturn_t rt286_irq(int irq, void *data)
bool mic = false; bool mic = false;
int status = 0; int status = 0;
rt286_jack_detect(rt286->codec, &hp, &mic); rt286_jack_detect(rt286, &hp, &mic);
/* Clear IRQ */ /* Clear IRQ */
snd_soc_update_bits(rt286->codec, regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x1, 0x1);
RT286_IRQ_CTRL, 0x1, 0x1);
if (hp == true) if (hp == true)
status |= SND_JACK_HEADPHONE; status |= SND_JACK_HEADPHONE;
...@@ -965,7 +962,16 @@ static int rt286_probe(struct snd_soc_codec *codec) ...@@ -965,7 +962,16 @@ static int rt286_probe(struct snd_soc_codec *codec)
struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
codec->dapm.bias_level = SND_SOC_BIAS_OFF; codec->dapm.bias_level = SND_SOC_BIAS_OFF;
rt286->codec = codec;
if (rt286->i2c->irq) {
regmap_update_bits(rt286->regmap,
RT286_IRQ_CTRL, 0x2, 0x2);
INIT_DELAYED_WORK(&rt286->jack_detect_work,
rt286_jack_detect_work);
schedule_delayed_work(&rt286->jack_detect_work,
msecs_to_jiffies(1250));
}
return 0; return 0;
} }
...@@ -1171,14 +1177,6 @@ static int rt286_i2c_probe(struct i2c_client *i2c, ...@@ -1171,14 +1177,6 @@ static int rt286_i2c_probe(struct i2c_client *i2c,
regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f); regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f);
if (rt286->i2c->irq) { if (rt286->i2c->irq) {
regmap_update_bits(rt286->regmap,
RT286_IRQ_CTRL, 0x2, 0x2);
INIT_DELAYED_WORK(&rt286->jack_detect_work,
rt286_jack_detect_work);
schedule_delayed_work(&rt286->jack_detect_work,
msecs_to_jiffies(1250));
ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq, ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286); IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286);
if (ret != 0) { if (ret != 0) {
......
...@@ -2215,14 +2215,8 @@ static int rt5640_i2c_probe(struct i2c_client *i2c, ...@@ -2215,14 +2215,8 @@ static int rt5640_i2c_probe(struct i2c_client *i2c,
rt5640->hp_mute = 1; rt5640->hp_mute = 1;
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5640, return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5640,
rt5640_dai, ARRAY_SIZE(rt5640_dai)); rt5640_dai, ARRAY_SIZE(rt5640_dai));
if (ret < 0)
goto err;
return 0;
err:
return ret;
} }
static int rt5640_i2c_remove(struct i2c_client *i2c) static int rt5640_i2c_remove(struct i2c_client *i2c)
......
...@@ -2345,14 +2345,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -2345,14 +2345,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
} }
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5645, return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5645,
rt5645_dai, ARRAY_SIZE(rt5645_dai)); rt5645_dai, ARRAY_SIZE(rt5645_dai));
if (ret < 0)
goto err;
return 0;
err:
return ret;
} }
static int rt5645_i2c_remove(struct i2c_client *i2c) static int rt5645_i2c_remove(struct i2c_client *i2c)
......
config SND_SOC_ROCKCHIP
tristate "ASoC support for Rockchip"
depends on COMPILE_TEST || ARCH_ROCKCHIP
select SND_SOC_GENERIC_DMAENGINE_PCM
select SND_ROCKCHIP_I2S
help
Say Y or M if you want to add support for codecs attached to
the Rockchip SoCs' Audio interfaces. You will also need to
select the audio interfaces to support below.
config SND_ROCKCHIP_I2S
tristate
# ROCKCHIP Platform Support
snd-soc-i2s-objs := rockchip_i2s.o
obj-$(CONFIG_SND_ROCKCHIP_I2S) += snd-soc-i2s.o
This diff is collapsed.
/*
* sound/soc/rockchip/rockchip_i2s.h
*
* ALSA SoC Audio Layer - Rockchip I2S Controller driver
*
* Copyright (c) 2014 Rockchip Electronics Co. Ltd.
* Author: Jianqun xu <jay.xu@rock-chips.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ROCKCHIP_IIS_H
#define _ROCKCHIP_IIS_H
/*
* TXCR
* transmit operation control register
*/
#define I2S_TXCR_RCNT_SHIFT 17
#define I2S_TXCR_RCNT_MASK (0x3f << I2S_TXCR_RCNT_SHIFT)
#define I2S_TXCR_CSR_SHIFT 15
#define I2S_TXCR_CSR(x) (x << I2S_TXCR_CSR_SHIFT)
#define I2S_TXCR_CSR_MASK (3 << I2S_TXCR_CSR_SHIFT)
#define I2S_TXCR_HWT BIT(14)
#define I2S_TXCR_SJM_SHIFT 12
#define I2S_TXCR_SJM_R (0 << I2S_TXCR_SJM_SHIFT)
#define I2S_TXCR_SJM_L (1 << I2S_TXCR_SJM_SHIFT)
#define I2S_TXCR_FBM_SHIFT 11
#define I2S_TXCR_FBM_MSB (0 << I2S_TXCR_FBM_SHIFT)
#define I2S_TXCR_FBM_LSB (1 << I2S_TXCR_FBM_SHIFT)
#define I2S_TXCR_IBM_SHIFT 9
#define I2S_TXCR_IBM_NORMAL (0 << I2S_TXCR_IBM_SHIFT)
#define I2S_TXCR_IBM_LSJM (1 << I2S_TXCR_IBM_SHIFT)
#define I2S_TXCR_IBM_RSJM (2 << I2S_TXCR_IBM_SHIFT)
#define I2S_TXCR_IBM_MASK (3 << I2S_TXCR_IBM_SHIFT)
#define I2S_TXCR_PBM_SHIFT 7
#define I2S_TXCR_PBM_MODE(x) (x << I2S_TXCR_PBM_SHIFT)
#define I2S_TXCR_PBM_MASK (3 << I2S_TXCR_PBM_SHIFT)
#define I2S_TXCR_TFS_SHIFT 5
#define I2S_TXCR_TFS_I2S (0 << I2S_TXCR_TFS_SHIFT)
#define I2S_TXCR_TFS_PCM (1 << I2S_TXCR_TFS_SHIFT)
#define I2S_TXCR_VDW_SHIFT 0
#define I2S_TXCR_VDW(x) ((x - 1) << I2S_TXCR_VDW_SHIFT)
#define I2S_TXCR_VDW_MASK (0x1f << I2S_TXCR_VDW_SHIFT)
/*
* RXCR
* receive operation control register
*/
#define I2S_RXCR_HWT BIT(14)
#define I2S_RXCR_SJM_SHIFT 12
#define I2S_RXCR_SJM_R (0 << I2S_RXCR_SJM_SHIFT)
#define I2S_RXCR_SJM_L (1 << I2S_RXCR_SJM_SHIFT)
#define I2S_RXCR_FBM_SHIFT 11
#define I2S_RXCR_FBM_MSB (0 << I2S_RXCR_FBM_SHIFT)
#define I2S_RXCR_FBM_LSB (1 << I2S_RXCR_FBM_SHIFT)
#define I2S_RXCR_IBM_SHIFT 9
#define I2S_RXCR_IBM_NORMAL (0 << I2S_RXCR_IBM_SHIFT)
#define I2S_RXCR_IBM_LSJM (1 << I2S_RXCR_IBM_SHIFT)
#define I2S_RXCR_IBM_RSJM (2 << I2S_RXCR_IBM_SHIFT)
#define I2S_RXCR_IBM_MASK (3 << I2S_RXCR_IBM_SHIFT)
#define I2S_RXCR_PBM_SHIFT 7
#define I2S_RXCR_PBM_MODE(x) (x << I2S_RXCR_PBM_SHIFT)
#define I2S_RXCR_PBM_MASK (3 << I2S_RXCR_PBM_SHIFT)
#define I2S_RXCR_TFS_SHIFT 5
#define I2S_RXCR_TFS_I2S (0 << I2S_RXCR_TFS_SHIFT)
#define I2S_RXCR_TFS_PCM (1 << I2S_RXCR_TFS_SHIFT)
#define I2S_RXCR_VDW_SHIFT 0
#define I2S_RXCR_VDW(x) ((x - 1) << I2S_RXCR_VDW_SHIFT)
#define I2S_RXCR_VDW_MASK (0x1f << I2S_RXCR_VDW_SHIFT)
/*
* CKR
* clock generation register
*/
#define I2S_CKR_MSS_SHIFT 27
#define I2S_CKR_MSS_MASTER (0 << I2S_CKR_MSS_SHIFT)
#define I2S_CKR_MSS_SLAVE (1 << I2S_CKR_MSS_SHIFT)
#define I2S_CKR_MSS_MASK (1 << I2S_CKR_MSS_SHIFT)
#define I2S_CKR_CKP_SHIFT 26
#define I2S_CKR_CKP_NEG (0 << I2S_CKR_CKP_SHIFT)
#define I2S_CKR_CKP_POS (1 << I2S_CKR_CKP_SHIFT)
#define I2S_CKR_RLP_SHIFT 25
#define I2S_CKR_RLP_NORMAL (0 << I2S_CKR_RLP_SHIFT)
#define I2S_CKR_RLP_OPPSITE (1 << I2S_CKR_RLP_SHIFT)
#define I2S_CKR_TLP_SHIFT 24
#define I2S_CKR_TLP_NORMAL (0 << I2S_CKR_TLP_SHIFT)
#define I2S_CKR_TLP_OPPSITE (1 << I2S_CKR_TLP_SHIFT)
#define I2S_CKR_MDIV_SHIFT 16
#define I2S_CKR_MDIV(x) ((x - 1) << I2S_CKR_MDIV_SHIFT)
#define I2S_CKR_MDIV_MASK (0xff << I2S_CKR_MDIV_SHIFT)
#define I2S_CKR_RSD_SHIFT 8
#define I2S_CKR_RSD(x) ((x - 1) << I2S_CKR_RSD_SHIFT)
#define I2S_CKR_RSD_MASK (0xff << I2S_CKR_RSD_SHIFT)
#define I2S_CKR_TSD_SHIFT 0
#define I2S_CKR_TSD(x) ((x - 1) << I2S_CKR_TSD_SHIFT)
#define I2S_CKR_TSD_MASK (0xff << I2S_CKR_TSD_SHIFT)
/*
* FIFOLR
* FIFO level register
*/
#define I2S_FIFOLR_RFL_SHIFT 24
#define I2S_FIFOLR_RFL_MASK (0x3f << I2S_FIFOLR_RFL_SHIFT)
#define I2S_FIFOLR_TFL3_SHIFT 18
#define I2S_FIFOLR_TFL3_MASK (0x3f << I2S_FIFOLR_TFL3_SHIFT)
#define I2S_FIFOLR_TFL2_SHIFT 12
#define I2S_FIFOLR_TFL2_MASK (0x3f << I2S_FIFOLR_TFL2_SHIFT)
#define I2S_FIFOLR_TFL1_SHIFT 6
#define I2S_FIFOLR_TFL1_MASK (0x3f << I2S_FIFOLR_TFL1_SHIFT)
#define I2S_FIFOLR_TFL0_SHIFT 0
#define I2S_FIFOLR_TFL0_MASK (0x3f << I2S_FIFOLR_TFL0_SHIFT)
/*
* DMACR
* DMA control register
*/
#define I2S_DMACR_RDE_SHIFT 24
#define I2S_DMACR_RDE_DISABLE (0 << I2S_DMACR_RDE_SHIFT)
#define I2S_DMACR_RDE_ENABLE (1 << I2S_DMACR_RDE_SHIFT)
#define I2S_DMACR_RDL_SHIFT 16
#define I2S_DMACR_RDL(x) ((x - 1) << I2S_DMACR_RDL_SHIFT)
#define I2S_DMACR_RDL_MASK (0x1f << I2S_DMACR_RDL_SHIFT)
#define I2S_DMACR_TDE_SHIFT 8
#define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT)
#define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT)
#define I2S_DMACR_TDL_SHIFT 0
#define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT)
#define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT)
/*
* INTCR
* interrupt control register
*/
#define I2S_INTCR_RFT_SHIFT 20
#define I2S_INTCR_RFT(x) ((x - 1) << I2S_INTCR_RFT_SHIFT)
#define I2S_INTCR_RXOIC BIT(18)
#define I2S_INTCR_RXOIE_SHIFT 17
#define I2S_INTCR_RXOIE_DISABLE (0 << I2S_INTCR_RXOIE_SHIFT)
#define I2S_INTCR_RXOIE_ENABLE (1 << I2S_INTCR_RXOIE_SHIFT)
#define I2S_INTCR_RXFIE_SHIFT 16
#define I2S_INTCR_RXFIE_DISABLE (0 << I2S_INTCR_RXFIE_SHIFT)
#define I2S_INTCR_RXFIE_ENABLE (1 << I2S_INTCR_RXFIE_SHIFT)
#define I2S_INTCR_TFT_SHIFT 4
#define I2S_INTCR_TFT(x) ((x - 1) << I2S_INTCR_TFT_SHIFT)
#define I2S_INTCR_TFT_MASK (0x1f << I2S_INTCR_TFT_SHIFT)
#define I2S_INTCR_TXUIC BIT(2)
#define I2S_INTCR_TXUIE_SHIFT 1
#define I2S_INTCR_TXUIE_DISABLE (0 << I2S_INTCR_TXUIE_SHIFT)
#define I2S_INTCR_TXUIE_ENABLE (1 << I2S_INTCR_TXUIE_SHIFT)
/*
* INTSR
* interrupt status register
*/
#define I2S_INTSR_TXEIE_SHIFT 0
#define I2S_INTSR_TXEIE_DISABLE (0 << I2S_INTSR_TXEIE_SHIFT)
#define I2S_INTSR_TXEIE_ENABLE (1 << I2S_INTSR_TXEIE_SHIFT)
#define I2S_INTSR_RXOI_SHIFT 17
#define I2S_INTSR_RXOI_INA (0 << I2S_INTSR_RXOI_SHIFT)
#define I2S_INTSR_RXOI_ACT (1 << I2S_INTSR_RXOI_SHIFT)
#define I2S_INTSR_RXFI_SHIFT 16
#define I2S_INTSR_RXFI_INA (0 << I2S_INTSR_RXFI_SHIFT)
#define I2S_INTSR_RXFI_ACT (1 << I2S_INTSR_RXFI_SHIFT)
#define I2S_INTSR_TXUI_SHIFT 1
#define I2S_INTSR_TXUI_INA (0 << I2S_INTSR_TXUI_SHIFT)
#define I2S_INTSR_TXUI_ACT (1 << I2S_INTSR_TXUI_SHIFT)
#define I2S_INTSR_TXEI_SHIFT 0
#define I2S_INTSR_TXEI_INA (0 << I2S_INTSR_TXEI_SHIFT)
#define I2S_INTSR_TXEI_ACT (1 << I2S_INTSR_TXEI_SHIFT)
/*
* XFER
* Transfer start register
*/
#define I2S_XFER_RXS_SHIFT 1
#define I2S_XFER_RXS_STOP (0 << I2S_XFER_RXS_SHIFT)
#define I2S_XFER_RXS_START (1 << I2S_XFER_RXS_SHIFT)
#define I2S_XFER_TXS_SHIFT 0
#define I2S_XFER_TXS_STOP (0 << I2S_XFER_TXS_SHIFT)
#define I2S_XFER_TXS_START (1 << I2S_XFER_TXS_SHIFT)
/*
* CLR
* clear SCLK domain logic register
*/
#define I2S_CLR_RXC BIT(1)
#define I2S_CLR_TXC BIT(0)
/*
* TXDR
* Transimt FIFO data register, write only.
*/
#define I2S_TXDR_MASK (0xff)
/*
* RXDR
* Receive FIFO data register, write only.
*/
#define I2S_RXDR_MASK (0xff)
/* Clock divider id */
enum {
ROCKCHIP_DIV_MCLK = 0,
ROCKCHIP_DIV_BCLK,
};
/* I2S REGS */
#define I2S_TXCR (0x0000)
#define I2S_RXCR (0x0004)
#define I2S_CKR (0x0008)
#define I2S_FIFOLR (0x000c)
#define I2S_DMACR (0x0010)
#define I2S_INTCR (0x0014)
#define I2S_INTSR (0x0018)
#define I2S_XFER (0x001c)
#define I2S_CLR (0x0020)
#define I2S_TXDR (0x0024)
#define I2S_RXDR (0x0028)
#endif /* _ROCKCHIP_IIS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment