Re: [PATCH 4/6] davinci vpbe: VENC( Video Encoder) implementation
On Thursday, December 02, 2010 13:39:07 Manjunath Hadli wrote: This patch adds the VENC or the Video encoder, whichis responsible for the blending of al source planes and timing generation for Video modes like NTSC, PAL and other digital outputs. the VENC implementation currently supports COMPOSITE and COMPONENT outputs and NTSC and PAL resolutions through the analog DACs. The venc block is implemented as a subdevice, allowing for additional extenal and internal encoders of other kind to plug-in. Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com --- drivers/media/video/davinci/vpbe_venc.c | 574 ++ drivers/media/video/davinci/vpbe_venc_regs.h | 189 + include/media/davinci/vpbe_venc.h| 38 ++ 3 files changed, 801 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/davinci/vpbe_venc.c create mode 100644 drivers/media/video/davinci/vpbe_venc_regs.h create mode 100644 include/media/davinci/vpbe_venc.h diff --git a/drivers/media/video/davinci/vpbe_venc.c b/drivers/media/video/davinci/vpbe_venc.c new file mode 100644 index 000..bf30332 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_venc.c snip +static int venc_s_std_output(struct v4l2_subdev *sd, v4l2_std_id norm) +{ + int ret = 0; + + v4l2_dbg(debug, 1, sd, venc_s_std_output\n); + + if (norm V4L2_STD_NTSC) + ret = venc_set_ntsc(sd); + else if (norm V4L2_STD_PAL) Shouldn't this be V4L2_STD_525_60 and V4L2_STD_625_50 instead of NTSC/PAL? + ret = venc_set_pal(sd); + else + ret = -EINVAL; + return ret; +} Regards, Hans -- Hans Verkuil - video4linux developer - sponsored by Cisco -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] davinci vpbe: VENC( Video Encoder) implementation
This patch adds the VENC or the Video encoder, whichis responsible for the blending of al source planes and timing generation for Video modes like NTSC, PAL and other digital outputs. the VENC implementation currently supports COMPOSITE and COMPONENT outputs and NTSC and PAL resolutions through the analog DACs. The venc block is implemented as a subdevice, allowing for additional extenal and internal encoders of other kind to plug-in. Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com --- drivers/media/video/davinci/vpbe_venc.c | 574 ++ drivers/media/video/davinci/vpbe_venc_regs.h | 189 + include/media/davinci/vpbe_venc.h| 38 ++ 3 files changed, 801 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/davinci/vpbe_venc.c create mode 100644 drivers/media/video/davinci/vpbe_venc_regs.h create mode 100644 include/media/davinci/vpbe_venc.h diff --git a/drivers/media/video/davinci/vpbe_venc.c b/drivers/media/video/davinci/vpbe_venc.c new file mode 100644 index 000..bf30332 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_venc.c @@ -0,0 +1,574 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * 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 linux/module.h +#include linux/kernel.h +#include linux/init.h +#include linux/ctype.h +#include linux/delay.h +#include linux/device.h +#include linux/interrupt.h +#include linux/platform_device.h +#include linux/videodev2.h +#include linux/slab.h + +#include mach/hardware.h +#include mach/mux.h +#include mach/io.h +#include mach/i2c.h + +#include linux/io.h + +#include media/davinci/vpbe_types.h +#include media/davinci/vpbe_venc.h +#include media/davinci/vpss.h +#include media/v4l2-device.h + +#include vpbe_venc_regs.h + +#define MODULE_NAMEVPBE_VENC_SUBDEV_NAME + +static int debug = 2; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, Debug level 0-2); + +struct venc_state { + struct v4l2_subdev sd; + struct venc_callback *callback; + struct venc_platform_data *pdata; + struct device *pdev; + u32 output; + v4l2_std_id std; + spinlock_t lock; + void __iomem *venc_base; + void __iomem *vdaccfg_reg; +}; + +static inline struct venc_state *to_state(struct v4l2_subdev *sd) +{ + return container_of(sd, struct venc_state, sd); +} + +static inline u32 venc_read(struct v4l2_subdev *sd, u32 offset) +{ + struct venc_state *venc = to_state(sd); + + return __raw_readl(venc-venc_base + offset); +} + +static inline u32 venc_write(struct v4l2_subdev *sd, u32 offset, u32 val) +{ + struct venc_state *venc = to_state(sd); + __raw_writel(val, (venc-venc_base + offset)); + return val; +} + +static inline u32 venc_modify(struct v4l2_subdev *sd, u32 offset, +u32 val, u32 mask) +{ + u32 new_val = (venc_read(sd, offset) ~mask) | (val mask); + + venc_write(sd, offset, new_val); + return new_val; +} + +static inline u32 vdaccfg_write(struct v4l2_subdev *sd, u32 val) +{ + struct venc_state *venc = to_state(sd); + + __raw_writel(val, venc-vdaccfg_reg); + + val = __raw_readl(venc-vdaccfg_reg); + return val; +} + +/* This function sets the dac of the VPBE for various outputs + */ +static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index) +{ + int ret = 0; + + switch (out_index) { + case 0: + v4l2_dbg(debug, 1, sd, Setting output to Composite\n); + venc_write(sd, VENC_DACSEL, 0); + break; + case 1: + v4l2_dbg(debug, 1, sd, Setting output to S-Video\n); + venc_write(sd, VENC_DACSEL, 0x210); + break; + case 2: + venc_write(sd, VENC_DACSEL, 0x543); + break; + default: + ret = -EINVAL; + } + return ret; +} + +static void enabledigitaloutput(struct v4l2_subdev *sd, int benable) +{ + v4l2_dbg(debug, 2, sd, enabledigitaloutput\n); + + if (benable) { + venc_write(sd, VENC_VMOD, 0); + venc_write(sd, VENC_CVBS, 0); + venc_write(sd, VENC_LCDOUT, 0); + venc_write(sd,
RE: [PATCH 4/6] davinci vpbe: VENC( Video Encoder) implementation
Acked-by Muralidharan Karicheri m-kariche...@ti.com Murali Karicheri Software Design Engineer Texas Instruments Inc. Germantown, MD 20874 phone: 301-407-9583 email: m-kariche...@ti.com -Original Message- From: Hadli, Manjunath Sent: Thursday, December 02, 2010 7:39 AM To: LMML Cc: dlos; Mauro Carvalho Chehab; Hans Verkuil; Hadli, Manjunath; Karicheri, Muralidharan Subject: [PATCH 4/6] davinci vpbe: VENC( Video Encoder) implementation This patch adds the VENC or the Video encoder, whichis responsible for the blending of al source planes and timing generation for Video modes like NTSC, PAL and other digital outputs. the VENC implementation currently supports COMPOSITE and COMPONENT outputs and NTSC and PAL resolutions through the analog DACs. The venc block is implemented as a subdevice, allowing for additional extenal and internal encoders of other kind to plug-in. Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com --- drivers/media/video/davinci/vpbe_venc.c | 574 ++ drivers/media/video/davinci/vpbe_venc_regs.h | 189 + include/media/davinci/vpbe_venc.h| 38 ++ 3 files changed, 801 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/davinci/vpbe_venc.c create mode 100644 drivers/media/video/davinci/vpbe_venc_regs.h create mode 100644 include/media/davinci/vpbe_venc.h diff --git a/drivers/media/video/davinci/vpbe_venc.c b/drivers/media/video/davinci/vpbe_venc.c new file mode 100644 index 000..bf30332 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_venc.c @@ -0,0 +1,574 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * 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 linux/module.h +#include linux/kernel.h +#include linux/init.h +#include linux/ctype.h +#include linux/delay.h +#include linux/device.h +#include linux/interrupt.h +#include linux/platform_device.h +#include linux/videodev2.h +#include linux/slab.h + +#include mach/hardware.h +#include mach/mux.h +#include mach/io.h +#include mach/i2c.h + +#include linux/io.h + +#include media/davinci/vpbe_types.h +#include media/davinci/vpbe_venc.h +#include media/davinci/vpss.h +#include media/v4l2-device.h + +#include vpbe_venc_regs.h + +#define MODULE_NAME VPBE_VENC_SUBDEV_NAME + +static int debug = 2; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, Debug level 0-2); + +struct venc_state { + struct v4l2_subdev sd; + struct venc_callback *callback; + struct venc_platform_data *pdata; + struct device *pdev; + u32 output; + v4l2_std_id std; + spinlock_t lock; + void __iomem *venc_base; + void __iomem *vdaccfg_reg; +}; + +static inline struct venc_state *to_state(struct v4l2_subdev *sd) +{ + return container_of(sd, struct venc_state, sd); +} + +static inline u32 venc_read(struct v4l2_subdev *sd, u32 offset) +{ + struct venc_state *venc = to_state(sd); + + return __raw_readl(venc-venc_base + offset); +} + +static inline u32 venc_write(struct v4l2_subdev *sd, u32 offset, u32 val) +{ + struct venc_state *venc = to_state(sd); + __raw_writel(val, (venc-venc_base + offset)); + return val; +} + +static inline u32 venc_modify(struct v4l2_subdev *sd, u32 offset, + u32 val, u32 mask) +{ + u32 new_val = (venc_read(sd, offset) ~mask) | (val mask); + + venc_write(sd, offset, new_val); + return new_val; +} + +static inline u32 vdaccfg_write(struct v4l2_subdev *sd, u32 val) +{ + struct venc_state *venc = to_state(sd); + + __raw_writel(val, venc-vdaccfg_reg); + + val = __raw_readl(venc-vdaccfg_reg); + return val; +} + +/* This function sets the dac of the VPBE for various outputs + */ +static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index) +{ + int ret = 0; + + switch (out_index) { + case 0: + v4l2_dbg(debug, 1, sd, Setting output to Composite\n); + venc_write(sd, VENC_DACSEL, 0); + break; + case 1: + v4l2_dbg(debug, 1, sd, Setting output to S-Video\n); + venc_write(sd, VENC_DACSEL, 0x210); + break; + case 2: + venc_write(sd, VENC_DACSEL, 0x543
[PATCH 4/6] davinci vpbe: VENC( Video Encoder) implementation
From: Muralidharan Karicheri m-kariche...@ti.com This patch adds the VENC or the Video encoder, whichis responsible for the blending of al source planes and timing generation for Video modes like NTSC, PAL and other digital outputs. the VENC implementation currently supports COMPOSITE and COMPONENT outputs and NTSC and PAL resolutions through the analog DACs. The venc block is implemented as a subdevice, allowing for additional extenal and internal encoders of other kind to plug-in. Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com --- drivers/media/video/davinci/vpbe_venc.c | 617 ++ drivers/media/video/davinci/vpbe_venc_regs.h | 189 include/media/davinci/vpbe_venc.h| 70 +++ 3 files changed, 876 insertions(+), 0 deletions(-) create mode 100644 drivers/media/video/davinci/vpbe_venc.c create mode 100644 drivers/media/video/davinci/vpbe_venc_regs.h create mode 100644 include/media/davinci/vpbe_venc.h diff --git a/drivers/media/video/davinci/vpbe_venc.c b/drivers/media/video/davinci/vpbe_venc.c new file mode 100644 index 000..3bfac47 --- /dev/null +++ b/drivers/media/video/davinci/vpbe_venc.c @@ -0,0 +1,617 @@ +/* + * Copyright (C) 2010 Texas Instruments Inc + * + * 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 linux/module.h +#include linux/kernel.h +#include linux/init.h +#include linux/ctype.h +#include linux/delay.h +#include linux/device.h +#include linux/interrupt.h +#include linux/platform_device.h +#include linux/videodev2.h +#include linux/slab.h + +#include mach/hardware.h +#include mach/mux.h +#include mach/io.h +#include mach/i2c.h + +#include linux/io.h + +#include media/davinci/vpbe_types.h +#include media/davinci/vpbe_venc.h +#include media/davinci/vpss.h +#include media/v4l2-device.h + +#include vpbe_venc_regs.h + +#define MODULE_NAMEVPBE_VENC_SUBDEV_NAME + +static int debug = 2; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, Debug level 0-2); + +struct venc_state { + struct v4l2_subdev sd; + struct venc_callback *callback; + struct venc_platform_data *pdata; + struct vpbe_if_params *if_params; + struct device *pdev; + u32 output; + v4l2_std_id std; + spinlock_t lock; + void __iomem *venc_base; + void __iomem *vdaccfg_reg; +}; + +static inline struct venc_state *to_state(struct v4l2_subdev *sd) +{ + return container_of(sd, struct venc_state, sd); +} + +static inline u32 venc_read(struct v4l2_subdev *sd, u32 offset) +{ + struct venc_state *venc = to_state(sd); + + return __raw_readl(venc-venc_base + offset); +} + +static inline u32 venc_write(struct v4l2_subdev *sd, u32 offset, u32 val) +{ + struct venc_state *venc = to_state(sd); + __raw_writel(val, (venc-venc_base + offset)); + return val; +} + +static inline u32 venc_modify(struct v4l2_subdev *sd, u32 offset, +u32 val, u32 mask) +{ + u32 new_val = (venc_read(sd, offset) ~mask) | (val mask); + + venc_write(sd, offset, new_val); + return new_val; +} + +static inline u32 vdaccfg_write(struct v4l2_subdev *sd, u32 val) +{ + struct venc_state *venc = to_state(sd); + + __raw_writel(val, venc-vdaccfg_reg); + + val = __raw_readl(venc-vdaccfg_reg); + return val; +} + +/* This function sets the dac of the VPBE for various outputs + */ +static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index) +{ + int ret = 0; + + switch (out_index) { + case 0: + v4l2_dbg(debug, 1, sd, Setting output to Composite\n); + venc_write(sd, VENC_DACSEL, 0); + break; + case 1: + v4l2_dbg(debug, 1, sd, Setting output to S-Video\n); + venc_write(sd, VENC_DACSEL, 0x210); + break; + case 2: + venc_write(sd, VENC_DACSEL, 0x543); + break; + default: + ret = -EINVAL; + } + return ret; +} + +static void enableDigitalOutput(struct v4l2_subdev *sd, int bEnable) +{ + v4l2_dbg(debug, 2, sd, enableDigitalOutput\n); + + if (bEnable) { + venc_write(sd, VENC_VMOD, 0); + venc_write(sd,