Loading Documentation/devicetree/bindings/sound/rockchip-i2s.txt 0 → 100644 +37 −0 Original line number Diff line number Diff line * 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>; }; sound/soc/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ source "sound/soc/kirkwood/Kconfig" source "sound/soc/intel/Kconfig" source "sound/soc/mxs/Kconfig" source "sound/soc/pxa/Kconfig" source "sound/soc/rockchip/Kconfig" source "sound/soc/samsung/Kconfig" source "sound/soc/s6000/Kconfig" source "sound/soc/sh/Kconfig" Loading sound/soc/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ obj-$(CONFIG_SND_SOC) += nuc900/ obj-$(CONFIG_SND_SOC) += omap/ obj-$(CONFIG_SND_SOC) += kirkwood/ obj-$(CONFIG_SND_SOC) += pxa/ obj-$(CONFIG_SND_SOC) += rockchip/ obj-$(CONFIG_SND_SOC) += samsung/ obj-$(CONFIG_SND_SOC) += s6000/ obj-$(CONFIG_SND_SOC) += sh/ Loading sound/soc/codecs/rl6231.c +0 −19 Original line number Diff line number Diff line Loading @@ -11,25 +11,6 @@ */ #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" Loading sound/soc/codecs/rt286.c +36 −38 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ struct rt286_priv { struct regmap *regmap; struct snd_soc_codec *codec; struct rt286_platform_data pdata; struct i2c_client *i2c; struct snd_soc_jack *jack; Loading Loading @@ -295,9 +294,8 @@ static int 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; int i; Loading @@ -305,23 +303,23 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) *mic = false; 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; if (*hp) { /* power on HV,VERF */ snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_POWER_CTRL1, 0x1001, 0x0); /* power LDO1 */ snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_POWER_CTRL2, 0x4, 0x4); snd_soc_write(codec, RT286_SET_MIC1, 0x24); val = snd_soc_read(codec, RT286_CBJ_CTRL2); regmap_write(rt286->regmap, RT286_SET_MIC1, 0x24); regmap_read(rt286->regmap, RT286_CBJ_CTRL2, &val); msleep(200); i = 40; while (((val & 0x0800) == 0) && (i > 0)) { val = snd_soc_read(codec, RT286_CBJ_CTRL2); regmap_read(rt286->regmap, RT286_CBJ_CTRL2, &val); i--; msleep(20); } Loading @@ -329,53 +327,53 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) if (0x0400 == (val & 0x0700)) { *mic = false; snd_soc_write(codec, regmap_write(rt286->regmap, RT286_SET_MIC1, 0x20); /* power off HV,VERF */ snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_POWER_CTRL1, 0x1001, 0x1001); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL3, 0xc000, 0x0000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_CBJ_CTRL1, 0x0030, 0x0000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL2, 0xc000, 0x0000); } else if ((0x0200 == (val & 0x0700)) || (0x0100 == (val & 0x0700))) { *mic = true; snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL3, 0xc000, 0x8000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_CBJ_CTRL1, 0x0030, 0x0020); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL2, 0xc000, 0x8000); } else { *mic = false; } snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_MISC_CTRL1, 0x0060, 0x0000); } else { snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_MISC_CTRL1, 0x0060, 0x0020); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL3, 0xc000, 0x8000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_CBJ_CTRL1, 0x0030, 0x0020); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL2, 0xc000, 0x8000); *mic = false; } } else { buf = snd_soc_read(codec, RT286_GET_HP_SENSE); regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); *hp = buf & 0x80000000; buf = snd_soc_read(codec, RT286_GET_MIC1_SENSE); regmap_read(rt286->regmap, RT286_GET_MIC1_SENSE, &buf); *mic = buf & 0x80000000; } Loading @@ -390,7 +388,7 @@ static void rt286_jack_detect_work(struct work_struct *work) bool hp = false; bool mic = false; rt286_jack_detect(rt286->codec, &hp, &mic); rt286_jack_detect(rt286, &hp, &mic); if (hp == true) status |= SND_JACK_HEADPHONE; Loading Loading @@ -940,11 +938,10 @@ static irqreturn_t rt286_irq(int irq, void *data) bool mic = false; int status = 0; rt286_jack_detect(rt286->codec, &hp, &mic); rt286_jack_detect(rt286, &hp, &mic); /* Clear IRQ */ snd_soc_update_bits(rt286->codec, RT286_IRQ_CTRL, 0x1, 0x1); regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x1, 0x1); if (hp == true) status |= SND_JACK_HEADPHONE; Loading @@ -965,7 +962,16 @@ static int rt286_probe(struct snd_soc_codec *codec) struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); 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; } Loading Loading @@ -1171,14 +1177,6 @@ static int rt286_i2c_probe(struct i2c_client *i2c, regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f); 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, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286); if (ret != 0) { Loading Loading
Documentation/devicetree/bindings/sound/rockchip-i2s.txt 0 → 100644 +37 −0 Original line number Diff line number Diff line * 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>; };
sound/soc/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ source "sound/soc/kirkwood/Kconfig" source "sound/soc/intel/Kconfig" source "sound/soc/mxs/Kconfig" source "sound/soc/pxa/Kconfig" source "sound/soc/rockchip/Kconfig" source "sound/soc/samsung/Kconfig" source "sound/soc/s6000/Kconfig" source "sound/soc/sh/Kconfig" Loading
sound/soc/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ obj-$(CONFIG_SND_SOC) += nuc900/ obj-$(CONFIG_SND_SOC) += omap/ obj-$(CONFIG_SND_SOC) += kirkwood/ obj-$(CONFIG_SND_SOC) += pxa/ obj-$(CONFIG_SND_SOC) += rockchip/ obj-$(CONFIG_SND_SOC) += samsung/ obj-$(CONFIG_SND_SOC) += s6000/ obj-$(CONFIG_SND_SOC) += sh/ Loading
sound/soc/codecs/rl6231.c +0 −19 Original line number Diff line number Diff line Loading @@ -11,25 +11,6 @@ */ #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" Loading
sound/soc/codecs/rt286.c +36 −38 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ struct rt286_priv { struct regmap *regmap; struct snd_soc_codec *codec; struct rt286_platform_data pdata; struct i2c_client *i2c; struct snd_soc_jack *jack; Loading Loading @@ -295,9 +294,8 @@ static int 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; int i; Loading @@ -305,23 +303,23 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) *mic = false; 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; if (*hp) { /* power on HV,VERF */ snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_POWER_CTRL1, 0x1001, 0x0); /* power LDO1 */ snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_POWER_CTRL2, 0x4, 0x4); snd_soc_write(codec, RT286_SET_MIC1, 0x24); val = snd_soc_read(codec, RT286_CBJ_CTRL2); regmap_write(rt286->regmap, RT286_SET_MIC1, 0x24); regmap_read(rt286->regmap, RT286_CBJ_CTRL2, &val); msleep(200); i = 40; while (((val & 0x0800) == 0) && (i > 0)) { val = snd_soc_read(codec, RT286_CBJ_CTRL2); regmap_read(rt286->regmap, RT286_CBJ_CTRL2, &val); i--; msleep(20); } Loading @@ -329,53 +327,53 @@ static int rt286_jack_detect(struct snd_soc_codec *codec, bool *hp, bool *mic) if (0x0400 == (val & 0x0700)) { *mic = false; snd_soc_write(codec, regmap_write(rt286->regmap, RT286_SET_MIC1, 0x20); /* power off HV,VERF */ snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_POWER_CTRL1, 0x1001, 0x1001); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL3, 0xc000, 0x0000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_CBJ_CTRL1, 0x0030, 0x0000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL2, 0xc000, 0x0000); } else if ((0x0200 == (val & 0x0700)) || (0x0100 == (val & 0x0700))) { *mic = true; snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL3, 0xc000, 0x8000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_CBJ_CTRL1, 0x0030, 0x0020); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL2, 0xc000, 0x8000); } else { *mic = false; } snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_MISC_CTRL1, 0x0060, 0x0000); } else { snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_MISC_CTRL1, 0x0060, 0x0020); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL3, 0xc000, 0x8000); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_CBJ_CTRL1, 0x0030, 0x0020); snd_soc_update_bits(codec, regmap_update_bits(rt286->regmap, RT286_A_BIAS_CTRL2, 0xc000, 0x8000); *mic = false; } } else { buf = snd_soc_read(codec, RT286_GET_HP_SENSE); regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); *hp = buf & 0x80000000; buf = snd_soc_read(codec, RT286_GET_MIC1_SENSE); regmap_read(rt286->regmap, RT286_GET_MIC1_SENSE, &buf); *mic = buf & 0x80000000; } Loading @@ -390,7 +388,7 @@ static void rt286_jack_detect_work(struct work_struct *work) bool hp = false; bool mic = false; rt286_jack_detect(rt286->codec, &hp, &mic); rt286_jack_detect(rt286, &hp, &mic); if (hp == true) status |= SND_JACK_HEADPHONE; Loading Loading @@ -940,11 +938,10 @@ static irqreturn_t rt286_irq(int irq, void *data) bool mic = false; int status = 0; rt286_jack_detect(rt286->codec, &hp, &mic); rt286_jack_detect(rt286, &hp, &mic); /* Clear IRQ */ snd_soc_update_bits(rt286->codec, RT286_IRQ_CTRL, 0x1, 0x1); regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x1, 0x1); if (hp == true) status |= SND_JACK_HEADPHONE; Loading @@ -965,7 +962,16 @@ static int rt286_probe(struct snd_soc_codec *codec) struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec); 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; } Loading Loading @@ -1171,14 +1177,6 @@ static int rt286_i2c_probe(struct i2c_client *i2c, regmap_update_bits(rt286->regmap, RT286_DEPOP_CTRL4, 0x00ff, 0x003f); 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, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286); if (ret != 0) { Loading