diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-11-29 17:38:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:38:44 -0500 |
commit | 67ec09fdf5e05d4670b617256c696348b5df080b (patch) | |
tree | fdf5f16f9b20280f83ce10e435d557bcb371934f /drivers/media/video/ivtv/ivtv-driver.h | |
parent | ca085fb900265b525e3f9fb95fb6d7fd27a302ea (diff) |
V4L/DVB (9835): ivtv/ivtvfb: convert to v4l2_device/v4l2_subdev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-driver.h')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-driver.h | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 3733b2afec5f..ce8d9b74357e 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/dvb/audio.h> | 61 | #include <linux/dvb/audio.h> |
62 | #include <media/v4l2-common.h> | 62 | #include <media/v4l2-common.h> |
63 | #include <media/v4l2-ioctl.h> | 63 | #include <media/v4l2-ioctl.h> |
64 | #include <media/v4l2-device.h> | ||
64 | #include <media/tuner.h> | 65 | #include <media/tuner.h> |
65 | #include <media/cx2341x.h> | 66 | #include <media/cx2341x.h> |
66 | 67 | ||
@@ -113,9 +114,6 @@ | |||
113 | #define IVTV_REG_VPU (0x9058) | 114 | #define IVTV_REG_VPU (0x9058) |
114 | #define IVTV_REG_APU (0xA064) | 115 | #define IVTV_REG_APU (0xA064) |
115 | 116 | ||
116 | /* i2c stuff */ | ||
117 | #define I2C_CLIENTS_MAX 16 | ||
118 | |||
119 | /* debugging */ | 117 | /* debugging */ |
120 | extern int ivtv_debug; | 118 | extern int ivtv_debug; |
121 | 119 | ||
@@ -132,12 +130,10 @@ extern int ivtv_debug; | |||
132 | /* Flag to turn on high volume debugging */ | 130 | /* Flag to turn on high volume debugging */ |
133 | #define IVTV_DBGFLG_HIGHVOL (1 << 10) | 131 | #define IVTV_DBGFLG_HIGHVOL (1 << 10) |
134 | 132 | ||
135 | /* NOTE: extra space before comma in 'itv->num , ## args' is required for | ||
136 | gcc-2.95, otherwise it won't compile. */ | ||
137 | #define IVTV_DEBUG(x, type, fmt, args...) \ | 133 | #define IVTV_DEBUG(x, type, fmt, args...) \ |
138 | do { \ | 134 | do { \ |
139 | if ((x) & ivtv_debug) \ | 135 | if ((x) & ivtv_debug) \ |
140 | printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \ | 136 | v4l2_info(&itv->device, " " type ": " fmt , ##args); \ |
141 | } while (0) | 137 | } while (0) |
142 | #define IVTV_DEBUG_WARN(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_WARN, "warn", fmt , ## args) | 138 | #define IVTV_DEBUG_WARN(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_WARN, "warn", fmt , ## args) |
143 | #define IVTV_DEBUG_INFO(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_INFO, "info", fmt , ## args) | 139 | #define IVTV_DEBUG_INFO(fmt, args...) IVTV_DEBUG(IVTV_DBGFLG_INFO, "info", fmt , ## args) |
@@ -152,8 +148,8 @@ extern int ivtv_debug; | |||
152 | 148 | ||
153 | #define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...) \ | 149 | #define IVTV_DEBUG_HIGH_VOL(x, type, fmt, args...) \ |
154 | do { \ | 150 | do { \ |
155 | if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \ | 151 | if (((x) & ivtv_debug) && (ivtv_debug & IVTV_DBGFLG_HIGHVOL)) \ |
156 | printk(KERN_INFO "ivtv%d " type ": " fmt, itv->num , ## args); \ | 152 | v4l2_info(&itv->device, " " type ": " fmt , ##args); \ |
157 | } while (0) | 153 | } while (0) |
158 | #define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warn", fmt , ## args) | 154 | #define IVTV_DEBUG_HI_WARN(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_WARN, "warn", fmt , ## args) |
159 | #define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info", fmt , ## args) | 155 | #define IVTV_DEBUG_HI_INFO(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_INFO, "info", fmt , ## args) |
@@ -167,9 +163,9 @@ extern int ivtv_debug; | |||
167 | #define IVTV_DEBUG_HI_YUV(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_YUV, "yuv", fmt , ## args) | 163 | #define IVTV_DEBUG_HI_YUV(fmt, args...) IVTV_DEBUG_HIGH_VOL(IVTV_DBGFLG_YUV, "yuv", fmt , ## args) |
168 | 164 | ||
169 | /* Standard kernel messages */ | 165 | /* Standard kernel messages */ |
170 | #define IVTV_ERR(fmt, args...) printk(KERN_ERR "ivtv%d: " fmt, itv->num , ## args) | 166 | #define IVTV_ERR(fmt, args...) v4l2_err(&itv->device, fmt , ## args) |
171 | #define IVTV_WARN(fmt, args...) printk(KERN_WARNING "ivtv%d: " fmt, itv->num , ## args) | 167 | #define IVTV_WARN(fmt, args...) v4l2_warn(&itv->device, fmt , ## args) |
172 | #define IVTV_INFO(fmt, args...) printk(KERN_INFO "ivtv%d: " fmt, itv->num , ## args) | 168 | #define IVTV_INFO(fmt, args...) v4l2_info(&itv->device, fmt , ## args) |
173 | 169 | ||
174 | /* output modes (cx23415 only) */ | 170 | /* output modes (cx23415 only) */ |
175 | #define OUT_NONE 0 | 171 | #define OUT_NONE 0 |
@@ -596,8 +592,6 @@ struct ivtv_card; | |||
596 | /* Struct to hold info about ivtv cards */ | 592 | /* Struct to hold info about ivtv cards */ |
597 | struct ivtv { | 593 | struct ivtv { |
598 | /* General fixed card data */ | 594 | /* General fixed card data */ |
599 | int num; /* board number, -1 during init! */ | ||
600 | char name[8]; /* board name for printk and interrupts (e.g. 'ivtv0') */ | ||
601 | struct pci_dev *dev; /* PCI device */ | 595 | struct pci_dev *dev; /* PCI device */ |
602 | const struct ivtv_card *card; /* card information */ | 596 | const struct ivtv_card *card; /* card information */ |
603 | const char *card_name; /* full name of the card */ | 597 | const char *card_name; /* full name of the card */ |
@@ -609,14 +603,18 @@ struct ivtv { | |||
609 | u32 v4l2_cap; /* V4L2 capabilities of card */ | 603 | u32 v4l2_cap; /* V4L2 capabilities of card */ |
610 | u32 hw_flags; /* hardware description of the board */ | 604 | u32 hw_flags; /* hardware description of the board */ |
611 | v4l2_std_id tuner_std; /* the norm of the card's tuner (fixed) */ | 605 | v4l2_std_id tuner_std; /* the norm of the card's tuner (fixed) */ |
612 | /* controlling video decoder function */ | 606 | struct v4l2_subdev *sd_video; /* controlling video decoder subdev */ |
613 | int (*video_dec_func)(struct ivtv *, unsigned int, void *); | 607 | struct v4l2_subdev *sd_audio; /* controlling audio subdev */ |
608 | struct v4l2_subdev *sd_muxer; /* controlling audio muxer subdev */ | ||
614 | u32 base_addr; /* PCI resource base address */ | 609 | u32 base_addr; /* PCI resource base address */ |
615 | volatile void __iomem *enc_mem; /* pointer to mapped encoder memory */ | 610 | volatile void __iomem *enc_mem; /* pointer to mapped encoder memory */ |
616 | volatile void __iomem *dec_mem; /* pointer to mapped decoder memory */ | 611 | volatile void __iomem *dec_mem; /* pointer to mapped decoder memory */ |
617 | volatile void __iomem *reg_mem; /* pointer to mapped registers */ | 612 | volatile void __iomem *reg_mem; /* pointer to mapped registers */ |
618 | struct ivtv_options options; /* user options */ | 613 | struct ivtv_options options; /* user options */ |
619 | 614 | ||
615 | struct v4l2_device device; | ||
616 | struct v4l2_subdev sd_gpio; /* GPIO sub-device */ | ||
617 | u16 instance; | ||
620 | 618 | ||
621 | /* High-level state info */ | 619 | /* High-level state info */ |
622 | unsigned long i_flags; /* global ivtv flags */ | 620 | unsigned long i_flags; /* global ivtv flags */ |
@@ -676,7 +674,6 @@ struct ivtv { | |||
676 | struct i2c_adapter i2c_adap; | 674 | struct i2c_adapter i2c_adap; |
677 | struct i2c_algo_bit_data i2c_algo; | 675 | struct i2c_algo_bit_data i2c_algo; |
678 | struct i2c_client i2c_client; | 676 | struct i2c_client i2c_client; |
679 | struct i2c_client *i2c_clients[I2C_CLIENTS_MAX];/* pointers to all I2C clients */ | ||
680 | int i2c_state; /* i2c bit state */ | 677 | int i2c_state; /* i2c bit state */ |
681 | struct mutex i2c_bus_lock; /* lock i2c bus */ | 678 | struct mutex i2c_bus_lock; /* lock i2c bus */ |
682 | 679 | ||
@@ -722,11 +719,13 @@ struct ivtv { | |||
722 | struct osd_info *osd_info; /* ivtvfb private OSD info */ | 719 | struct osd_info *osd_info; /* ivtvfb private OSD info */ |
723 | }; | 720 | }; |
724 | 721 | ||
722 | static inline struct ivtv *to_ivtv(struct v4l2_device *dev) | ||
723 | { | ||
724 | return container_of(dev, struct ivtv, device); | ||
725 | } | ||
726 | |||
725 | /* Globals */ | 727 | /* Globals */ |
726 | extern struct ivtv *ivtv_cards[]; | ||
727 | extern int ivtv_cards_active; | ||
728 | extern int ivtv_first_minor; | 728 | extern int ivtv_first_minor; |
729 | extern spinlock_t ivtv_cards_lock; | ||
730 | 729 | ||
731 | /*==============Prototypes==================*/ | 730 | /*==============Prototypes==================*/ |
732 | 731 | ||
@@ -786,4 +785,19 @@ static inline int ivtv_raw_vbi(const struct ivtv *itv) | |||
786 | #define write_dec_sync(val, addr) \ | 785 | #define write_dec_sync(val, addr) \ |
787 | do { write_dec(val, addr); read_dec(addr); } while (0) | 786 | do { write_dec(val, addr); read_dec(addr); } while (0) |
788 | 787 | ||
788 | /* Call the specified callback for all subdevs matching hw (if 0, then | ||
789 | match them all). Ignore any errors. */ | ||
790 | #define ivtv_call_hw(itv, hw, o, f, args...) \ | ||
791 | __v4l2_device_call_subdevs(&(itv)->device, !(hw) || (sd->grp_id & (hw)), o, f , ##args) | ||
792 | |||
793 | #define ivtv_call_all(itv, o, f, args...) ivtv_call_hw(itv, 0, o, f , ##args) | ||
794 | |||
795 | /* Call the specified callback for all subdevs matching hw (if 0, then | ||
796 | match them all). If the callback returns an error other than 0 or | ||
797 | -ENOIOCTLCMD, then return with that error code. */ | ||
798 | #define ivtv_call_hw_err(itv, hw, o, f, args...) \ | ||
799 | __v4l2_device_call_subdevs_until_err(&(itv)->device, !(hw) || (sd->grp_id & (hw)), o, f , ##args) | ||
800 | |||
801 | #define ivtv_call_all_err(itv, o, f, args...) ivtv_call_hw_err(itv, 0, o, f , ##args) | ||
802 | |||
789 | #endif | 803 | #endif |