Re: [U-Boot] [PATCH 1/9 V3] SOUND: SAMSUNG: Add I2S driver
Hi, On Mon, Oct 22, 2012 at 11:57 PM, Rajeshwari Shinde rajeshwar...@samsung.com wrote: This patch adds driver for I2S interface specific to samsung. Signed-off-by: R. Chandrasekar rcse...@samsung.com Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com --- Changes in V2: - renamed i2s.c to samsung-i2s.c. Changes in V3: - wave sine table removed and the same in calculated in a function. This looks great. There are a few style nits that you might want to correct, but: Acked-by: Simon Glass s...@chromium.org Makefile|1 + drivers/sound/Makefile | 47 ++ drivers/sound/samsung-i2s.c | 358 +++ drivers/sound/sound.c | 228 +++ include/i2s.h | 127 +++ include/sound.h | 62 6 files changed, 823 insertions(+), 0 deletions(-) create mode 100644 drivers/sound/Makefile create mode 100644 drivers/sound/samsung-i2s.c create mode 100644 drivers/sound/sound.c create mode 100644 include/i2s.h create mode 100644 include/sound.h diff --git a/Makefile b/Makefile index a40d4cc..f7d7f47 100644 --- a/Makefile +++ b/Makefile @@ -293,6 +293,7 @@ LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o endif LIBS-y += drivers/rtc/librtc.o LIBS-y += drivers/serial/libserial.o +LIBS-y += drivers/sound/libsound.o LIBS-$(CONFIG_GENERIC_LPC_TPM) += drivers/tpm/libtpm.o LIBS-y += drivers/twserial/libtws.o LIBS-y += drivers/usb/eth/libusb_eth.o diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile new file mode 100644 index 000..18ad2c9 --- /dev/null +++ b/drivers/sound/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2012 Samsung Electronics +# R. Chandrasekar rcse...@samsung.com +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB:= $(obj)libsound.o + +COBJS-$(CONFIG_SOUND) += sound.o +COBJS-$(CONFIG_I2S)+= samsung-i2s.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB):$(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/drivers/sound/samsung-i2s.c b/drivers/sound/samsung-i2s.c new file mode 100644 index 000..3ce0b59 --- /dev/null +++ b/drivers/sound/samsung-i2s.c @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * R. Chandrasekar rcse...@samsung.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include asm/arch/clk.h +#include asm/arch/pinmux.h +#include asm/arch/i2s-regs.h +#include asm/io.h +#include common.h +#include sound.h +#include i2s.h + +#define FIC_TX2COUNT(x)(((x) 24) 0xf) +#define FIC_TX1COUNT(x)(((x) 16) 0xf) +#define FIC_TXCOUNT(x) (((x) 8) 0xf) +#define FIC_RXCOUNT(x) (((x) 0) 0xf) +#define FICS_TXCOUNT(x)(((x) 8) 0x7f) + +#define TIMEOUT_I2S_TX 100 /* i2s transfer timeout */ + +/* + * Sets the frame size for I2S LR clock + * + * @param i2s_reg i2s regiter address + * @param rfs Frame Size + */ +static void i2s_set_lr_framesize(struct i2s_reg *i2s_reg, unsigned int rfs) +{ +
Re: [U-Boot] [PATCH 1/9 V3] SOUND: SAMSUNG: Add I2S driver
Hi Simon Glass, Thank you for the comments. Will correct the issues mentioned. Regards, Rajeshwari Shinde. On Thu, Oct 25, 2012 at 10:32 PM, Simon Glass s...@chromium.org wrote: Hi, On Mon, Oct 22, 2012 at 11:57 PM, Rajeshwari Shinde rajeshwar...@samsung.com wrote: This patch adds driver for I2S interface specific to samsung. Signed-off-by: R. Chandrasekar rcse...@samsung.com Signed-off-by: Rajeshwari Shinde rajeshwar...@samsung.com --- Changes in V2: - renamed i2s.c to samsung-i2s.c. Changes in V3: - wave sine table removed and the same in calculated in a function. This looks great. There are a few style nits that you might want to correct, but: Acked-by: Simon Glass s...@chromium.org Makefile|1 + drivers/sound/Makefile | 47 ++ drivers/sound/samsung-i2s.c | 358 +++ drivers/sound/sound.c | 228 +++ include/i2s.h | 127 +++ include/sound.h | 62 6 files changed, 823 insertions(+), 0 deletions(-) create mode 100644 drivers/sound/Makefile create mode 100644 drivers/sound/samsung-i2s.c create mode 100644 drivers/sound/sound.c create mode 100644 include/i2s.h create mode 100644 include/sound.h diff --git a/Makefile b/Makefile index a40d4cc..f7d7f47 100644 --- a/Makefile +++ b/Makefile @@ -293,6 +293,7 @@ LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o endif LIBS-y += drivers/rtc/librtc.o LIBS-y += drivers/serial/libserial.o +LIBS-y += drivers/sound/libsound.o LIBS-$(CONFIG_GENERIC_LPC_TPM) += drivers/tpm/libtpm.o LIBS-y += drivers/twserial/libtws.o LIBS-y += drivers/usb/eth/libusb_eth.o diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile new file mode 100644 index 000..18ad2c9 --- /dev/null +++ b/drivers/sound/Makefile @@ -0,0 +1,47 @@ +# +# Copyright (C) 2012 Samsung Electronics +# R. Chandrasekar rcse...@samsung.com +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB:= $(obj)libsound.o + +COBJS-$(CONFIG_SOUND) += sound.o +COBJS-$(CONFIG_I2S)+= samsung-i2s.o + +COBJS := $(COBJS-y) +SRCS := $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) + +all: $(LIB) + +$(LIB):$(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/drivers/sound/samsung-i2s.c b/drivers/sound/samsung-i2s.c new file mode 100644 index 000..3ce0b59 --- /dev/null +++ b/drivers/sound/samsung-i2s.c @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * R. Chandrasekar rcse...@samsung.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include asm/arch/clk.h +#include asm/arch/pinmux.h +#include asm/arch/i2s-regs.h +#include asm/io.h +#include common.h +#include sound.h +#include i2s.h + +#define FIC_TX2COUNT(x)(((x) 24) 0xf) +#define FIC_TX1COUNT(x)(((x) 16) 0xf) +#define FIC_TXCOUNT(x) (((x) 8) 0xf) +#define FIC_RXCOUNT(x) (((x) 0) 0xf) +#define FICS_TXCOUNT(x)