From 9bb13a6dc3a6f68c990264838ff0493d900c48d7 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 9 Jan 2006 15:25:37 -0200 Subject: V4L/DVB (3233): Fixed API to set I2S speed control - Created a new ioctl to control I2S speed. Old calls to an inadequate V4L2 API replaced. Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index d3fd48157eb8..2f2402996409 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -107,4 +107,11 @@ enum v4l2_chip_ident { be made. */ #define VIDIOC_INT_G_CHIP_IDENT _IOR ('d', 107, enum v4l2_chip_ident *) +/* Sets I2S speed in bps. This is used to provide a standard way to select I2S + clock used by driving digital audio streams at some board designs. + Usual values for the frequency are 1024000 and 2048000. + If the frequency is not supported, then -EINVAL is returned. */ +#define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) + + #endif /* V4L2_COMMON_H_ */ -- cgit v1.2.3 From 3578d3dd0b1e468a44a76a83efe90476a854625d Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 9 Jan 2006 15:25:41 -0200 Subject: V4L/DVB (3214): Calculate the saa7115 AMCLK regs instead of using fixed values - Calculate the audio master clock registers from the actual frequencies. This simplifies the code and it also prepares for adding CGC2 support. - VIDIOC_INT_AUDIO_CLOCK_FREQ now receives an u32 instead of an enum. It is more generic and actually easier to implement. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 2f2402996409..90248d29ed0a 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -26,13 +26,6 @@ #ifndef V4L2_COMMON_H_ #define V4L2_COMMON_H_ -/* VIDIOC_INT_AUDIO_CLOCK_FREQ */ -enum v4l2_audio_clock_freq { - V4L2_AUDCLK_32_KHZ = 32000, - V4L2_AUDCLK_441_KHZ = 44100, - V4L2_AUDCLK_48_KHZ = 48000, -}; - /* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ struct v4l2_register { u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */ @@ -77,10 +70,12 @@ enum v4l2_chip_ident { /* Reset the I2C chip */ #define VIDIOC_INT_RESET _IO ('d', 102) -/* Set the frequency of the audio clock output. +/* Set the frequency (in Hz) of the audio clock output. Used to slave an audio processor to the video decoder, ensuring that audio - and video remain synchronized. */ -#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOR ('d', 103, enum v4l2_audio_clock_freq) + and video remain synchronized. + Usual values for the frequency are 48000, 44100 or 32000 Hz. + If the frequency is not supported, then -EINVAL is returned. */ +#define VIDIOC_INT_AUDIO_CLOCK_FREQ _IOW ('d', 103, u32) /* Video decoders that support sliced VBI need to implement this ioctl. Field p of the v4l2_sliced_vbi_line struct is set to the start of the VBI -- cgit v1.2.3 From 5e453dc757385ec892a818e4e3b5de027987ced9 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 9 Jan 2006 15:32:31 -0200 Subject: V4L/DVB (3269): ioctls cleanups. - Now, all internal ioctls are at v4l2-common.h - removed unused ioctl at saa6752hs.h - all debug ioctl code moved to v4l2-common.c - removed duplicated stuff from other cards Signed-off-by: Michael Krufky Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 90248d29ed0a..9ee616261d66 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -63,6 +63,20 @@ enum v4l2_chip_ident { V4L2_IDENT_CX25843 = 243, }; +/* audio ioctls */ +/* v4l device was opened in Radio mode */ +#define AUDC_SET_RADIO _IO('d',88) +/* select from TV,radio,extern,MUTE */ +#define AUDC_SET_INPUT _IOW('d',89,int) + +/* tuner ioctls */ +/* Sets tuner type and its I2C addr */ +#define TUNER_SET_TYPE_ADDR _IOW('d',90,int) +/* Puts tuner on powersaving state, disabling it, except for i2c */ +#define TUNER_SET_STANDBY _IOW('d',91,int) +/* Sets tda9887 specific stuff, like port1, port2 and qss */ +#define TDA9887_SET_CONFIG _IOW('d',92,int) + /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ #define VIDIOC_INT_S_REGISTER _IOR ('d', 100, struct v4l2_register) #define VIDIOC_INT_G_REGISTER _IOWR('d', 101, struct v4l2_register) @@ -108,5 +122,16 @@ enum v4l2_chip_ident { If the frequency is not supported, then -EINVAL is returned. */ #define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) +/* Prints used ioctl */ +extern void v4l_printk_ioctl(unsigned int cmd); + +#define v4l_print_ioctl(name,cmd) do {\ + printk(KERN_DEBUG "%s: ", name); \ + v4l_printk_ioctl(cmd); } while (0) + +#define v4l_i2c_print_ioctl(client,cmd) do {\ + printk(KERN_DEBUG "%s %d-%04x: ", (client)->driver->name, \ + i2c_adapter_id((client)->adapter),(client)->addr); \ + v4l_printk_ioctl(cmd); } while (0) #endif /* V4L2_COMMON_H_ */ -- cgit v1.2.3 From 7e8b09ea1636e360a8fabebeaeb91c17f64e01b5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 9 Jan 2006 15:32:40 -0200 Subject: V4L/DVB (3276): Added new diagnositics macros, convert msp3400 to the new macros. - Added new v4l_err, v4l_warn, v4l_info and v4l_dbg macros to v4l2-common.h for use in v4l-dvb i2c drivers. This ensures a unique prefix for each device instance. - At a later stage these macros may be reimplemented using the device-generic macros from device.h. - Converted the msp3400 driver to the new macros. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 63 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 12 deletions(-) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 9ee616261d66..c5ca993679ec 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -26,6 +26,57 @@ #ifndef V4L2_COMMON_H_ #define V4L2_COMMON_H_ +/* v4l debugging and diagnostics */ + +/* Common printk constucts for v4l-i2c drivers. These macros create a unique + prefix consisting of the driver name, the adapter number and the i2c + address. */ +#define v4l_printk(level, name, adapter, addr, fmt, arg...) \ + printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg) + +#define v4l_client_printk(level, client, fmt, arg...) \ + v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \ + (client)->addr, fmt , ## arg) + +#define v4l_err(client, fmt, arg...) \ + v4l_client_printk(KERN_ERR, client, fmt , ## arg) + +#define v4l_warn(client, fmt, arg...) \ + v4l_client_printk(KERN_WARNING, client, fmt , ## arg) + +#define v4l_info(client, fmt, arg...) \ + v4l_client_printk(KERN_INFO, client, fmt , ## arg) + +/* These three macros assume that the debug level is set with a module + parameter called 'debug'. */ +#define v4l_dbg(level, client, fmt, arg...) \ + do { \ + if (debug >= (level)) \ + v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ + } while (0) + +/* Prints the ioctl in a human-readable format */ +extern void v4l_printk_ioctl(unsigned int cmd); + +/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */ +#define v4l_print_ioctl(name, cmd) \ + do { \ + printk(KERN_DEBUG "%s: ", name); \ + v4l_printk_ioctl(cmd); \ + } while (0) + +/* Use this macro in I2C drivers where 'client' is the struct i2c_client + pointer */ +#define v4l_i2c_print_ioctl(client, cmd) \ + do { \ + v4l_client_printk(KERN_DEBUG, client, ""); \ + v4l_printk_ioctl(cmd); \ + } while (0) + +/* ------------------------------------------------------------------------- */ + +/* Internal ioctls */ + /* VIDIOC_INT_G_REGISTER and VIDIOC_INT_S_REGISTER */ struct v4l2_register { u32 i2c_id; /* I2C driver ID of the I2C chip. 0 for the I2C adapter. */ @@ -122,16 +173,4 @@ enum v4l2_chip_ident { If the frequency is not supported, then -EINVAL is returned. */ #define VIDIOC_INT_I2S_CLOCK_FREQ _IOW ('d', 108, u32) -/* Prints used ioctl */ -extern void v4l_printk_ioctl(unsigned int cmd); - -#define v4l_print_ioctl(name,cmd) do {\ - printk(KERN_DEBUG "%s: ", name); \ - v4l_printk_ioctl(cmd); } while (0) - -#define v4l_i2c_print_ioctl(client,cmd) do {\ - printk(KERN_DEBUG "%s %d-%04x: ", (client)->driver->name, \ - i2c_adapter_id((client)->adapter),(client)->addr); \ - v4l_printk_ioctl(cmd); } while (0) - #endif /* V4L2_COMMON_H_ */ -- cgit v1.2.3 From fac9e89999a12f378112fe93764b30196bc03f46 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 9 Jan 2006 15:32:40 -0200 Subject: V4L/DVB (3278): convert diagnostics over to the new v4l2-common.h macros. - Convert diagnostics over to the new v4l2-common.h macros. - deprecated tuner_debug option, the new option is debug. - renamed cx25840_debug to debug. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index c5ca993679ec..51cdca8365c9 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -51,6 +51,7 @@ parameter called 'debug'. */ #define v4l_dbg(level, client, fmt, arg...) \ do { \ + extern int debug; \ if (debug >= (level)) \ v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \ } while (0) -- cgit v1.2.3 From cab462f716cdd522edc71436482d8734e8258489 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 9 Jan 2006 15:53:26 -0200 Subject: V4L/DVB (3307): Some cleanups at I2C modules - i2c names shorten - removed obsoleted flags on newer modules - small cleanups Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/media/v4l2-common.h') diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 51cdca8365c9..3cc3132f391e 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -34,7 +34,7 @@ #define v4l_printk(level, name, adapter, addr, fmt, arg...) \ printk(level "%s %d-%04x: " fmt, name, i2c_adapter_id(adapter), addr , ## arg) -#define v4l_client_printk(level, client, fmt, arg...) \ +#define v4l_client_printk(level, client, fmt, arg...) \ v4l_printk(level, (client)->driver->driver.name, (client)->adapter, \ (client)->addr, fmt , ## arg) -- cgit v1.2.3